@lcap/nasl 3.3.0-alpha.1 → 3.3.0-alpha.3

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 (380) hide show
  1. package/out/automate/upgrader/2.20.js.map +1 -1
  2. package/out/bak/translator.js +52 -1
  3. package/out/bak/translator.js.map +1 -1
  4. package/out/breakpoint/shared/utils.js +0 -2
  5. package/out/breakpoint/shared/utils.js.map +1 -1
  6. package/out/common/Command.d.ts +1 -0
  7. package/out/common/Command.js +9 -1
  8. package/out/common/Command.js.map +1 -1
  9. package/out/concepts/Abort__.js +2 -1
  10. package/out/concepts/Abort__.js.map +1 -1
  11. package/out/concepts/Anchor__.js +1 -1
  12. package/out/concepts/Anchor__.js.map +1 -1
  13. package/out/concepts/AnonymousFunction__.js +2 -2
  14. package/out/concepts/AnonymousFunction__.js.map +1 -1
  15. package/out/concepts/Argument__.js +1 -1
  16. package/out/concepts/Argument__.js.map +1 -1
  17. package/out/concepts/Assignee__.js.map +1 -1
  18. package/out/concepts/AssignmentLine__.js +1 -1
  19. package/out/concepts/AssignmentLine__.js.map +1 -1
  20. package/out/concepts/Assignment__.js +2 -2
  21. package/out/concepts/Assignment__.js.map +1 -1
  22. package/out/concepts/BackendVariable__.js +1 -1
  23. package/out/concepts/BackendVariable__.js.map +1 -1
  24. package/out/concepts/Backend__.js +1 -1
  25. package/out/concepts/Backend__.js.map +1 -1
  26. package/out/concepts/BatchAssignment__.js +2 -2
  27. package/out/concepts/BatchAssignment__.js.map +1 -1
  28. package/out/concepts/BinaryExpression__.js +2 -2
  29. package/out/concepts/BinaryExpression__.js.map +1 -1
  30. package/out/concepts/BindAttribute__.d.ts +2 -0
  31. package/out/concepts/BindAttribute__.js +79 -4
  32. package/out/concepts/BindAttribute__.js.map +1 -1
  33. package/out/concepts/BindDirective__.js +1 -1
  34. package/out/concepts/BindDirective__.js.map +1 -1
  35. package/out/concepts/BindEvent__.d.ts +2 -1
  36. package/out/concepts/BindEvent__.js +44 -37
  37. package/out/concepts/BindEvent__.js.map +1 -1
  38. package/out/concepts/BindStyle__.js +1 -1
  39. package/out/concepts/BindStyle__.js.map +1 -1
  40. package/out/concepts/BooleanLiteral__.js +1 -1
  41. package/out/concepts/BooleanLiteral__.js.map +1 -1
  42. package/out/concepts/CallAuthInterface__.js +1 -1
  43. package/out/concepts/CallAuthInterface__.js.map +1 -1
  44. package/out/concepts/CallConnector__.js +1 -1
  45. package/out/concepts/CallConnector__.js.map +1 -1
  46. package/out/concepts/CallFunction__.js +2 -2
  47. package/out/concepts/CallFunction__.js.map +1 -1
  48. package/out/concepts/CallInterface__.js +2 -2
  49. package/out/concepts/CallInterface__.js.map +1 -1
  50. package/out/concepts/CallLogic__.js +69 -12
  51. package/out/concepts/CallLogic__.js.map +1 -1
  52. package/out/concepts/CallQueryComponent__.d.ts +1 -1
  53. package/out/concepts/CallQueryComponent__.js +1 -1
  54. package/out/concepts/CallQueryComponent__.js.map +1 -1
  55. package/out/concepts/Comment__.js +1 -1
  56. package/out/concepts/Comment__.js.map +1 -1
  57. package/out/concepts/ConfigProperty__.js +1 -1
  58. package/out/concepts/ConfigProperty__.js.map +1 -1
  59. package/out/concepts/Connection__.js +9 -10
  60. package/out/concepts/Connection__.js.map +1 -1
  61. package/out/concepts/Constant__.js +1 -1
  62. package/out/concepts/Constant__.js.map +1 -1
  63. package/out/concepts/DataSource__.js +1 -1
  64. package/out/concepts/DataSource__.js.map +1 -1
  65. package/out/concepts/Destination__.js +2 -2
  66. package/out/concepts/Destination__.js.map +1 -1
  67. package/out/concepts/End__.js +1 -1
  68. package/out/concepts/End__.js.map +1 -1
  69. package/out/concepts/EntityIndex__.js +1 -1
  70. package/out/concepts/EntityIndex__.js.map +1 -1
  71. package/out/concepts/EntityProperty__.js +2 -2
  72. package/out/concepts/EntityProperty__.js.map +1 -1
  73. package/out/concepts/Entity__.js +2 -2
  74. package/out/concepts/Entity__.js.map +1 -1
  75. package/out/concepts/EnumItem__.js +2 -2
  76. package/out/concepts/EnumItem__.js.map +1 -1
  77. package/out/concepts/Enum__.js +2 -2
  78. package/out/concepts/Enum__.js.map +1 -1
  79. package/out/concepts/ForEachStatement__.js +27 -37
  80. package/out/concepts/ForEachStatement__.js.map +1 -1
  81. package/out/concepts/Frontend__.js +1 -1
  82. package/out/concepts/Frontend__.js.map +1 -1
  83. package/out/concepts/Function__.js +2 -2
  84. package/out/concepts/Function__.js.map +1 -1
  85. package/out/concepts/Identifier__.js +1 -1
  86. package/out/concepts/Identifier__.js.map +1 -1
  87. package/out/concepts/IfStatement__.js +2 -2
  88. package/out/concepts/IfStatement__.js.map +1 -1
  89. package/out/concepts/Interface__.js +1 -1
  90. package/out/concepts/Interface__.js.map +1 -1
  91. package/out/concepts/JSBlock__.js +1 -1
  92. package/out/concepts/JSBlock__.js.map +1 -1
  93. package/out/concepts/JavaLogic__.js +1 -1
  94. package/out/concepts/JavaLogic__.js.map +1 -1
  95. package/out/concepts/LogicItem__.js +3 -2
  96. package/out/concepts/LogicItem__.js.map +1 -1
  97. package/out/concepts/Logic__.js +2 -1
  98. package/out/concepts/Logic__.js.map +1 -1
  99. package/out/concepts/MatchCase__.js +1 -1
  100. package/out/concepts/MatchCase__.js.map +1 -1
  101. package/out/concepts/Match__.js +2 -2
  102. package/out/concepts/Match__.js.map +1 -1
  103. package/out/concepts/MemberExpression__.d.ts +1 -0
  104. package/out/concepts/MemberExpression__.js +117 -2
  105. package/out/concepts/MemberExpression__.js.map +1 -1
  106. package/out/concepts/Module__.d.ts +1 -1
  107. package/out/concepts/Module__.js +34 -35
  108. package/out/concepts/Module__.js.map +1 -1
  109. package/out/concepts/NewComposite__.js +2 -2
  110. package/out/concepts/NewComposite__.js.map +1 -1
  111. package/out/concepts/NewList__.js +2 -2
  112. package/out/concepts/NewList__.js.map +1 -1
  113. package/out/concepts/NewMap__.js +2 -2
  114. package/out/concepts/NewMap__.js.map +1 -1
  115. package/out/concepts/New__.js +1 -1
  116. package/out/concepts/New__.js.map +1 -1
  117. package/out/concepts/NullLiteral__.js +1 -1
  118. package/out/concepts/NullLiteral__.js.map +1 -1
  119. package/out/concepts/NumericLiteral__.js +1 -1
  120. package/out/concepts/NumericLiteral__.js.map +1 -1
  121. package/out/concepts/OqlQueryComponent__.js +2 -2
  122. package/out/concepts/OqlQueryComponent__.js.map +1 -1
  123. package/out/concepts/Param__.js +1 -1
  124. package/out/concepts/Param__.js.map +1 -1
  125. package/out/concepts/ProcessElement__.js +1 -1
  126. package/out/concepts/ProcessElement__.js.map +1 -1
  127. package/out/concepts/ProcessOutcome__.js +1 -1
  128. package/out/concepts/ProcessOutcome__.js.map +1 -1
  129. package/out/concepts/ProcessOutcomes__.js +1 -1
  130. package/out/concepts/ProcessOutcomes__.js.map +1 -1
  131. package/out/concepts/Process__.js +1 -1
  132. package/out/concepts/Process__.js.map +1 -1
  133. package/out/concepts/QueryAggregateExpression__.js +1 -1
  134. package/out/concepts/QueryAggregateExpression__.js.map +1 -1
  135. package/out/concepts/QueryFieldExpression__.js +1 -1
  136. package/out/concepts/QueryFieldExpression__.js.map +1 -1
  137. package/out/concepts/QueryFromExpression__.js +1 -1
  138. package/out/concepts/QueryFromExpression__.js.map +1 -1
  139. package/out/concepts/QueryJoinExpression__.js +1 -1
  140. package/out/concepts/QueryJoinExpression__.js.map +1 -1
  141. package/out/concepts/QueryLimitExpression__.js +1 -1
  142. package/out/concepts/QueryLimitExpression__.js.map +1 -1
  143. package/out/concepts/QueryOrderByExpression__.js +1 -1
  144. package/out/concepts/QueryOrderByExpression__.js.map +1 -1
  145. package/out/concepts/Return__.js +2 -2
  146. package/out/concepts/Return__.js.map +1 -1
  147. package/out/concepts/Role__.js +1 -1
  148. package/out/concepts/Role__.js.map +1 -1
  149. package/out/concepts/SelectMembers__.js +1 -1
  150. package/out/concepts/SelectMembers__.js.map +1 -1
  151. package/out/concepts/SqlQueryComponent__.js +2 -2
  152. package/out/concepts/SqlQueryComponent__.js.map +1 -1
  153. package/out/concepts/Start__.js +1 -1
  154. package/out/concepts/Start__.js.map +1 -1
  155. package/out/concepts/StringInterpolation__.js +2 -2
  156. package/out/concepts/StringInterpolation__.js.map +1 -1
  157. package/out/concepts/StringLiteral__.js +1 -1
  158. package/out/concepts/StringLiteral__.js.map +1 -1
  159. package/out/concepts/StructureProperty__.js +2 -2
  160. package/out/concepts/StructureProperty__.js.map +1 -1
  161. package/out/concepts/Structure__.js +2 -2
  162. package/out/concepts/Structure__.js.map +1 -1
  163. package/out/concepts/SwitchCase__.js +1 -1
  164. package/out/concepts/SwitchCase__.js.map +1 -1
  165. package/out/concepts/SwitchStatement__.js +2 -2
  166. package/out/concepts/SwitchStatement__.js.map +1 -1
  167. package/out/concepts/TriggerLauncher__.js +1 -1
  168. package/out/concepts/TriggerLauncher__.js.map +1 -1
  169. package/out/concepts/TypeAnnotation__.d.ts +4 -3
  170. package/out/concepts/TypeAnnotation__.js +116 -75
  171. package/out/concepts/TypeAnnotation__.js.map +1 -1
  172. package/out/concepts/TypeParam__.js +1 -1
  173. package/out/concepts/TypeParam__.js.map +1 -1
  174. package/out/concepts/UnaryExpression__.js +2 -2
  175. package/out/concepts/UnaryExpression__.js.map +1 -1
  176. package/out/concepts/ValidationRule__.d.ts +14 -14
  177. package/out/concepts/ValidationRule__.js +28 -24
  178. package/out/concepts/ValidationRule__.js.map +1 -1
  179. package/out/concepts/Variable__.js +2 -2
  180. package/out/concepts/Variable__.js.map +1 -1
  181. package/out/concepts/ViewElement__.d.ts +88 -87
  182. package/out/concepts/ViewElement__.js +268 -204
  183. package/out/concepts/ViewElement__.js.map +1 -1
  184. package/out/concepts/View__.d.ts +6 -0
  185. package/out/concepts/View__.js +254 -11
  186. package/out/concepts/View__.js.map +1 -1
  187. package/out/concepts/WhileStatement__.js +2 -2
  188. package/out/concepts/WhileStatement__.js.map +1 -1
  189. package/out/concepts/basics/stdlib/nasl.browser.js +1 -0
  190. package/out/concepts/basics/stdlib/nasl.browser.js.map +1 -1
  191. package/out/concepts/basics/stdlib/nasl.event.js +2 -0
  192. package/out/concepts/basics/stdlib/nasl.event.js.map +1 -1
  193. package/out/generator/genBundleFiles.js +90 -1
  194. package/out/generator/genBundleFiles.js.map +1 -1
  195. package/out/generator/genReleaseBody.js +1 -1
  196. package/out/generator/genReleaseBody.js.map +1 -1
  197. package/out/generator/permission.js +3 -3
  198. package/out/generator/permission.js.map +1 -1
  199. package/out/index.d.ts +1 -0
  200. package/out/index.js +1 -0
  201. package/out/index.js.map +1 -1
  202. package/out/natural/genNaturalTS.js +7 -3
  203. package/out/natural/genNaturalTS.js.map +1 -1
  204. package/out/natural/knowledgeMap.js +12 -12
  205. package/out/natural/knowledgeMap.js.map +1 -1
  206. package/out/natural/transformTSCode.d.ts +1 -1
  207. package/out/natural/transformTSCode.js +115 -141
  208. package/out/natural/transformTSCode.js.map +1 -1
  209. package/out/server/extendBaseNode.js +69 -44
  210. package/out/server/extendBaseNode.js.map +1 -1
  211. package/out/server/formatTsUtils.js +72 -63
  212. package/out/server/formatTsUtils.js.map +1 -1
  213. package/out/server/getLogics.js +20 -23
  214. package/out/server/getLogics.js.map +1 -1
  215. package/out/server/getMemberIdentifier.d.ts +1 -0
  216. package/out/server/getMemberIdentifier.js +149 -1
  217. package/out/server/getMemberIdentifier.js.map +1 -1
  218. package/out/server/naslServer.d.ts +3 -3
  219. package/out/server/naslServer.js +182 -132
  220. package/out/server/naslServer.js.map +1 -1
  221. package/out/server/translator.js +43 -33
  222. package/out/server/translator.js.map +1 -1
  223. package/out/service/defaultErrorMessage.json +6 -6
  224. package/out/service/storage/init.js +16 -0
  225. package/out/service/storage/init.js.map +1 -1
  226. package/out/templator/genCreateBlock.js +5 -3
  227. package/out/templator/genCreateBlock.js.map +1 -1
  228. package/out/templator/genCurdEditMultipleKeyBlock.js +12 -8
  229. package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
  230. package/out/templator/genCurdMultipleKeyBlock.js +8 -7
  231. package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
  232. package/out/templator/genEditTableBlock.d.ts +1 -1
  233. package/out/templator/genEditTableBlock.js +12 -6
  234. package/out/templator/genEditTableBlock.js.map +1 -1
  235. package/out/templator/genEnumSelectBlock.js +2 -2
  236. package/out/templator/genEnumSelectBlock.js.map +1 -1
  237. package/out/templator/genGetBlock.js +1 -1
  238. package/out/templator/genGetBlock.js.map +1 -1
  239. package/out/templator/genGridViewBlock.d.ts +2 -2
  240. package/out/templator/genGridViewBlock.js +20 -7
  241. package/out/templator/genGridViewBlock.js.map +1 -1
  242. package/out/templator/genListViewBlock.d.ts +2 -2
  243. package/out/templator/genListViewBlock.js +13 -5
  244. package/out/templator/genListViewBlock.js.map +1 -1
  245. package/out/templator/genSelectBlock.d.ts +2 -2
  246. package/out/templator/genSelectBlock.js +8 -6
  247. package/out/templator/genSelectBlock.js.map +1 -1
  248. package/out/templator/genTableBlock.d.ts +1 -1
  249. package/out/templator/genTableBlock.js +10 -5
  250. package/out/templator/genTableBlock.js.map +1 -1
  251. package/out/templator/genUpdateBlock.js +5 -3
  252. package/out/templator/genUpdateBlock.js.map +1 -1
  253. package/package.json +3 -1
  254. package/sandbox/stdlib/nasl.auth.ts +40 -44
  255. package/sandbox/stdlib/nasl.core.ts +8 -1
  256. package/sandbox/stdlib/nasl.http.ts +22 -22
  257. package/sandbox-natural/stdlib/nasl.util.ts +74 -15
  258. package/src/automate/upgrader/2.20.js +17 -13
  259. package/src/bak/translator.js +50 -1
  260. package/src/breakpoint/shared/utils.ts +0 -2
  261. package/src/common/Command.ts +8 -0
  262. package/src/concepts/Abort__.ts +2 -2
  263. package/src/concepts/Anchor__.ts +2 -2
  264. package/src/concepts/AnonymousFunction__.ts +3 -3
  265. package/src/concepts/Argument__.ts +2 -2
  266. package/src/concepts/Assignee__.ts +1 -1
  267. package/src/concepts/AssignmentLine__.ts +2 -2
  268. package/src/concepts/Assignment__.ts +3 -3
  269. package/src/concepts/BackendVariable__.ts +2 -2
  270. package/src/concepts/Backend__.ts +1 -1
  271. package/src/concepts/BatchAssignment__.ts +3 -3
  272. package/src/concepts/BinaryExpression__.ts +3 -3
  273. package/src/concepts/BindAttribute__.ts +69 -4
  274. package/src/concepts/BindDirective__.ts +2 -2
  275. package/src/concepts/BindEvent__.ts +44 -64
  276. package/src/concepts/BindStyle__.ts +2 -2
  277. package/src/concepts/BooleanLiteral__.ts +2 -2
  278. package/src/concepts/CallAuthInterface__.ts +2 -2
  279. package/src/concepts/CallConnector__.ts +2 -2
  280. package/src/concepts/CallFunction__.ts +3 -3
  281. package/src/concepts/CallInterface__.ts +3 -3
  282. package/src/concepts/CallLogic__.ts +69 -13
  283. package/src/concepts/CallQueryComponent__.ts +2 -2
  284. package/src/concepts/Comment__.ts +2 -2
  285. package/src/concepts/ConfigProperty__.ts +2 -2
  286. package/src/concepts/Connection__.ts +15 -21
  287. package/src/concepts/Constant__.ts +2 -2
  288. package/src/concepts/DataSource__.ts +1 -1
  289. package/src/concepts/Destination__.ts +3 -3
  290. package/src/concepts/End__.ts +2 -2
  291. package/src/concepts/EntityIndex__.ts +2 -2
  292. package/src/concepts/EntityProperty__.ts +3 -3
  293. package/src/concepts/Entity__.ts +2 -2
  294. package/src/concepts/EnumItem__.ts +3 -3
  295. package/src/concepts/Enum__.ts +2 -2
  296. package/src/concepts/ForEachStatement__.ts +35 -46
  297. package/src/concepts/Frontend__.ts +1 -1
  298. package/src/concepts/Function__.ts +3 -3
  299. package/src/concepts/Identifier__.ts +2 -2
  300. package/src/concepts/IfStatement__.ts +3 -3
  301. package/src/concepts/Interface__.ts +1 -1
  302. package/src/concepts/JSBlock__.ts +2 -2
  303. package/src/concepts/JavaLogic__.ts +2 -2
  304. package/src/concepts/LogicItem__.ts +3 -3
  305. package/src/concepts/Logic__.ts +2 -1
  306. package/src/concepts/MatchCase__.ts +2 -2
  307. package/src/concepts/Match__.ts +3 -3
  308. package/src/concepts/MemberExpression__.ts +112 -4
  309. package/src/concepts/Module__.ts +41 -58
  310. package/src/concepts/NewComposite__.ts +3 -3
  311. package/src/concepts/NewList__.ts +3 -3
  312. package/src/concepts/NewMap__.ts +3 -3
  313. package/src/concepts/New__.ts +2 -2
  314. package/src/concepts/NullLiteral__.ts +2 -2
  315. package/src/concepts/NumericLiteral__.ts +2 -2
  316. package/src/concepts/OqlQueryComponent__.ts +3 -3
  317. package/src/concepts/Param__.ts +2 -2
  318. package/src/concepts/ProcessElement__.ts +2 -2
  319. package/src/concepts/ProcessOutcome__.ts +2 -2
  320. package/src/concepts/ProcessOutcomes__.ts +2 -2
  321. package/src/concepts/Process__.ts +1 -1
  322. package/src/concepts/QueryAggregateExpression__.ts +2 -2
  323. package/src/concepts/QueryFieldExpression__.ts +2 -2
  324. package/src/concepts/QueryFromExpression__.ts +2 -2
  325. package/src/concepts/QueryJoinExpression__.ts +2 -2
  326. package/src/concepts/QueryLimitExpression__.ts +2 -2
  327. package/src/concepts/QueryOrderByExpression__.ts +2 -2
  328. package/src/concepts/Return__.ts +3 -3
  329. package/src/concepts/Role__.ts +1 -1
  330. package/src/concepts/SelectMembers__.ts +2 -2
  331. package/src/concepts/SqlQueryComponent__.ts +3 -3
  332. package/src/concepts/Start__.ts +2 -2
  333. package/src/concepts/StringInterpolation__.ts +3 -3
  334. package/src/concepts/StringLiteral__.ts +2 -2
  335. package/src/concepts/StructureProperty__.ts +3 -3
  336. package/src/concepts/Structure__.ts +2 -2
  337. package/src/concepts/SwitchCase__.ts +2 -2
  338. package/src/concepts/SwitchStatement__.ts +3 -3
  339. package/src/concepts/TriggerLauncher__.ts +1 -1
  340. package/src/concepts/TypeAnnotation__.ts +145 -125
  341. package/src/concepts/TypeParam__.ts +2 -2
  342. package/src/concepts/UnaryExpression__.ts +3 -3
  343. package/src/concepts/ValidationRule__.ts +554 -524
  344. package/src/concepts/Variable__.ts +3 -3
  345. package/src/concepts/ViewElement__.ts +2445 -2498
  346. package/src/concepts/View__.ts +258 -10
  347. package/src/concepts/WhileStatement__.ts +3 -3
  348. package/src/concepts/basics/stdlib/nasl.browser.ts +1 -0
  349. package/src/concepts/basics/stdlib/nasl.event.ts +2 -0
  350. package/src/generator/genBundleFiles.ts +91 -1
  351. package/src/generator/genReleaseBody.ts +1 -1
  352. package/src/generator/permission.ts +3 -3
  353. package/src/index.ts +1 -0
  354. package/src/natural/genNaturalTS.ts +8 -4
  355. package/src/natural/knowledgeMap.ts +12 -12
  356. package/src/natural/transformTSCode.ts +139 -151
  357. package/src/server/extendBaseNode.ts +71 -45
  358. package/src/server/formatTsUtils.ts +64 -64
  359. package/src/server/getLogics.ts +23 -30
  360. package/src/server/getMemberIdentifier.ts +143 -0
  361. package/src/server/naslServer.ts +174 -148
  362. package/src/server/translator.ts +40 -39
  363. package/src/service/defaultErrorMessage.json +6 -6
  364. package/src/service/storage/init.ts +17 -0
  365. package/src/templator/genCreateBlock.ts +5 -3
  366. package/src/templator/genCurdEditMultipleKeyBlock.ts +12 -8
  367. package/src/templator/genCurdMultipleKeyBlock.ts +8 -7
  368. package/src/templator/genEditTableBlock.ts +12 -7
  369. package/src/templator/genEnumSelectBlock.ts +2 -2
  370. package/src/templator/genGetBlock.ts +6 -6
  371. package/src/templator/genGridViewBlock.ts +22 -9
  372. package/src/templator/genListViewBlock.ts +14 -5
  373. package/src/templator/genSelectBlock.ts +8 -6
  374. package/src/templator/genTableBlock.ts +10 -9
  375. package/src/templator/genUpdateBlock.ts +5 -3
  376. package/test/concepts/validation-rule/__snapshots__/toEmbeddedTS.spec.ts.snap +11 -0
  377. package/test/concepts/validation-rule/__snapshots__/toJS.spec.ts.snap +10 -0
  378. package/test/concepts/validation-rule/fixtures/argument-without-keyword.json +34 -0
  379. package/test/concepts/validation-rule/fixtures/empty-rule.json +9 -0
  380. package/test/concepts/validation-rule/validation-rule.spec.ts +15 -0
@@ -56,7 +56,6 @@ import { SourceMapItem } from '../translator';
56
56
  import { Diagnostic } from '../manager/diagnostic';
57
57
  import { sortTsString } from '../utils/sortTsString';
58
58
  import { getNodeByNodeCallee } from '../automate/engine/utils.js';
59
-
60
59
  export interface MinRange {
61
60
  node: BaseNode;
62
61
  item: SourceMapItem;
@@ -66,16 +65,16 @@ const mapAstString = new Map();
66
65
 
67
66
  function transformType(tsType: string): string {
68
67
  if (tsType === 'string' || tsType === 'String') return '字符串';
69
- if (tsType === 'number') return '数字';
70
- if (tsType === 'Integer') return '整数';
71
- if (tsType === 'Double') return '小数';
72
- if (tsType === 'Decimal') return '小数';
73
- if (tsType === 'Long') return '整数';
74
- if (tsType === 'DateTime') return '日期时间';
75
- if (tsType === 'Date') return '日期';
76
- if (tsType === 'Time') return '时间';
77
- if (tsType === 'boolean' || tsType === 'Boolean') return '布尔值';
78
- if (tsType === 'unknown') return '未知类型';
68
+ else if (tsType === 'number') return '数字';
69
+ else if (tsType === 'Integer') return '整数';
70
+ else if (tsType === 'Double') return '小数';
71
+ else if (tsType === 'Decimal') return '小数';
72
+ else if (tsType === 'Long') return '整数';
73
+ else if (tsType === 'DateTime') return '日期时间';
74
+ else if (tsType === 'Date') return '日期';
75
+ else if (tsType === 'Time') return '时间';
76
+ else if (tsType === 'boolean' || tsType === 'Boolean') return '布尔值';
77
+ else if (tsType === 'unknown') return '未知类型';
79
78
  else if (tsType === 'Enums') return '枚举';
80
79
  else if (tsType === 'views') return '页面';
81
80
  else if (tsType === 'void') return '无返回值';
@@ -143,12 +142,12 @@ function transformNamespace(tsNamespace: string): string {
143
142
 
144
143
  function transformMethod(tsMethod: string): string {
145
144
  if (tsMethod === 'forEach') return 'ForEach';
146
- return tsMethod;
145
+ else return tsMethod;
147
146
  }
148
147
 
149
148
  function transformIdentifier(identifier: string): string {
150
149
  if (NAMESPACE_CONCEPT_MAP[identifier]) return NAMESPACE_CONCEPT_MAP[identifier];
151
- return ` ${transformType(identifier)} 上的`;
150
+ else return ` ${transformType(identifier)} 上的`;
152
151
  }
153
152
 
154
153
  export function outOriginalvalue(value: string) {
@@ -298,6 +297,10 @@ const TS_RULES: Array<{
298
297
  re: /Cannot find name '__assignmentLineEmpty__'./,
299
298
  result: '批量赋值没有连线',
300
299
  },
300
+ {
301
+ re: /Cannot find name '__ValidationRule__'./,
302
+ result: '校验规则不能为空',
303
+ },
301
304
  {
302
305
  re: /No value exists in scope for the shorthand property '__(?:IDENTIFIER|LEFT|RIGHT)__'. Either declare one or provide an initializer./,
303
306
  result: '用户任务未关联页面',
@@ -473,14 +476,11 @@ export function naslNodeTranslateMessage(minRange: MinRange, tsErrorDetail: Diag
473
476
  if (node instanceof View || node instanceof ViewElement) {
474
477
  if (text.startsWith(`'nasl.ui' has no exported member named `)) {
475
478
  return null;
476
- }
477
- if (text.startsWith(`Property '`) && text.includes(`does not exist on type 'typeof ui'.`)) {
479
+ } else if (text.startsWith(`Property '`) && text.includes(`does not exist on type 'typeof ui'.`)) {
478
480
  return null;
479
- }
480
- if (text.startsWith(`Namespace 'nasl.ui' has no exported member `)) {
481
+ } else if (text.startsWith(`Namespace 'nasl.ui' has no exported member `)) {
481
482
  return null;
482
- }
483
- if (text.startsWith(`Function expression, which lacks return-type annotation, implicitly has an 'any[]' return type.`)) {
483
+ } else if (text.startsWith(`Function expression, which lacks return-type annotation, implicitly has an 'any[]' return type.`)) {
484
484
  return null;
485
485
  }
486
486
  }
@@ -600,7 +600,7 @@ export function naslNodeTranslateMessage(minRange: MinRange, tsErrorDetail: Diag
600
600
  node = parentNode || node;
601
601
 
602
602
  let str = tsErrorDetail.message;
603
- str = `${(node as any).constructor.nodeTitle}:${str}`;
603
+ str = (node as any).constructor.nodeTitle + ':' + str;
604
604
  tsErrorDetail.message = str;
605
605
  }
606
606
  }
@@ -611,7 +611,7 @@ export function naslNodeTranslateMessage(minRange: MinRange, tsErrorDetail: Diag
611
611
  // node = node.parentNode;
612
612
  let str = tsErrorDetail.message;
613
613
  if (node) {
614
- str = `${(node as any).parentNode.constructor.nodeTitle}:${str}`;
614
+ str = (node as any).parentNode.constructor.nodeTitle + ':' + str;
615
615
  }
616
616
  tsErrorDetail.message = str;
617
617
  }
@@ -623,7 +623,7 @@ export function naslNodeTranslateMessage(minRange: MinRange, tsErrorDetail: Diag
623
623
  */
624
624
  if (/^Cannot find name '__(?:IDENTIFIER|LEFT|RIGHT)__'\.$/.exec(text)) {
625
625
  if (node instanceof IfStatement || node instanceof SwitchCase || node instanceof WhileStatement) {
626
- tsErrorDetail.message = `${(node as any).constructor.nodeTitle}:参数不能为空!所需类型:基础类型>布尔值`;
626
+ tsErrorDetail.message = (node as any).constructor.nodeTitle + ':参数不能为空!所需类型:基础类型>布尔值';
627
627
  } else if (node instanceof ForEachStatement) {
628
628
  tsErrorDetail.message = 'ForEach:结束值:不能为空!所需类型:基础类型>整数';
629
629
  } else if (node instanceof UnaryExpression) {
@@ -639,14 +639,14 @@ export function naslNodeTranslateMessage(minRange: MinRange, tsErrorDetail: Diag
639
639
  } else if ((node instanceof Argument && node.parentNode instanceof CallLogic) || node instanceof CallLogic) {
640
640
  tsErrorDetail.message = '调用逻辑:参数不能为空!';
641
641
  } else if (node instanceof ProcessOutcome || node instanceof Function || node instanceof MatchCase) {
642
- tsErrorDetail.message = `${(node as any).constructor.nodeTitle}:不能为空!`;
642
+ tsErrorDetail.message = (node as any).constructor.nodeTitle + ':不能为空!';
643
643
  } else if (node instanceof NewMap) {
644
644
  tsErrorDetail.message = 'Map推导不出类型!请手动设置!';
645
645
  } else if (node instanceof NewList) {
646
646
  tsErrorDetail.message = 'List推导不出类型!请手动设置!';
647
647
  } else if (node instanceof Argument) {
648
648
  let str = tsErrorDetail.message;
649
- str = `${(node.parentNode as any).constructor.nodeTitle}:${str}`;
649
+ str = (node.parentNode as any).constructor.nodeTitle + ':' + str;
650
650
  tsErrorDetail.message = str;
651
651
  } else if (node instanceof TypeAnnotation) {
652
652
  // 如果是TypeAnnotation 嵌套TypeAnnotation,就往上冒,多是那种T嵌套的
@@ -655,7 +655,7 @@ export function naslNodeTranslateMessage(minRange: MinRange, tsErrorDetail: Diag
655
655
  while (node.parentNode && node.parentNode instanceof TypeAnnotation) {
656
656
  node = node.parentNode;
657
657
  }
658
- str = `${(node.parentNode as any).constructor.nodeTitle}:${str}`;
658
+ str = (node.parentNode as any).constructor.nodeTitle + ':' + str;
659
659
 
660
660
  tsErrorDetail.message = str;
661
661
  } else if (node instanceof Identifier) {
@@ -669,7 +669,7 @@ export function naslNodeTranslateMessage(minRange: MinRange, tsErrorDetail: Diag
669
669
  } else if (node.parentNode instanceof ValidationRule) {
670
670
  str = '验证逻辑:验证对象不能为空!';
671
671
  } else {
672
- str = `${(node.parentNode as any).constructor.nodeTitle}:${str}`;
672
+ str = (node.parentNode as any).constructor.nodeTitle + ':' + str;
673
673
  tsErrorDetail.message = str;
674
674
  }
675
675
  return str;
@@ -705,7 +705,7 @@ export function naslNodeTranslateMessage(minRange: MinRange, tsErrorDetail: Diag
705
705
  }
706
706
  } else {
707
707
  let str = tsErrorDetail.message;
708
- str = `${(node.parentNode as any).constructor.nodeTitle}:${str}`;
708
+ str = (node.parentNode as any).constructor.nodeTitle + ':' + str;
709
709
  tsErrorDetail.message = str;
710
710
  if (node.parentNode instanceof AnonymousFunction) {
711
711
  // 匿名函数:左右参数类型不一致!左边类型:布尔值,右边类型:整数。
@@ -773,8 +773,9 @@ export function naslNodeTranslateMessage(minRange: MinRange, tsErrorDetail: Diag
773
773
  const rightCode = oldStr[index + value.length] || '';
774
774
  if (/^[A-Za-z]+$/.test(leftCode) || /^[A-Za-z]+$/.test(rightCode)) {
775
775
  return value;
776
+ } else {
777
+ return rule.result;
776
778
  }
777
- return rule.result;
778
779
  } catch (err) {
779
780
  return value;
780
781
  }
@@ -809,18 +810,18 @@ export function checkAStructure_(errorText: string) {
809
810
  const y = sortTsString(transformType(cap[2]));
810
811
  if (x === y) {
811
812
  return true;
812
- }
813
- if (mapAstString.get(x) === y || mapAstString.get(y) === x) {
814
- return true;
815
- }
816
- const regex = /Type '"AStructure_(.*)' is not assignable to type '"AStructure_(.*)'/;
817
- const nameError = regex.exec(errorText);
818
- const length1 = x.match(/:/g) ? x.match(/:/g).length : -1;
819
- const length2 = y.match(/:/g) ? y.match(/:/g).length : -2;
820
- if (nameError && length1 === length2) {
821
- mapAstString.set(x, y);
822
- mapAstString.set(y, x);
813
+ } else if (mapAstString.get(x) === y || mapAstString.get(y) === x) {
823
814
  return true;
815
+ } else {
816
+ const regex = /Type '"AStructure_(.*)' is not assignable to type '"AStructure_(.*)'/;
817
+ const nameError = regex.exec(errorText);
818
+ const length1 = x.match(/:/g) ? x.match(/:/g).length : -1;
819
+ const length2 = y.match(/:/g) ? y.match(/:/g).length : -2;
820
+ if (nameError && length1 === length2) {
821
+ mapAstString.set(x, y);
822
+ mapAstString.set(y, x);
823
+ return true;
824
+ }
824
825
  }
825
826
  }
826
827
  }
@@ -1,15 +1,15 @@
1
1
  {
2
- "required": "{label}不得为空",
3
- "filled": "{label}不得为空",
4
- "notEmpty": "{label}不得为空",
5
- "empty": "{label}必须为空",
2
+ "required": "表单项不得为空",
3
+ "filled": "表单项不得为空",
4
+ "notEmpty": "表单项不得为空",
5
+ "empty": "表单项必须为空",
6
6
  "minLength": "不得少于{args}个字符",
7
7
  "maxLength": "不得超过{args}个字符",
8
8
  "rangeLength": "请输入{args}-{args}个字符",
9
9
  "min": "不能小于{args}",
10
10
  "max": "不能大于{args}",
11
11
  "range": "范围在{args}-{args}之间",
12
- "pattern": "{label}格式不正确",
12
+ "pattern": "表单项格式不正确",
13
13
  "is": "必须与{args}相同",
14
14
  "isNot": "必须与{args}不同",
15
15
  "equals": "必须等于{args}",
@@ -19,7 +19,7 @@
19
19
  "excludes": "不能包含{args}",
20
20
  "included": "必须为{args}中的值",
21
21
  "excluded": "不能为{args}中的值",
22
- "unique": "该{label}已经存在",
22
+ "unique": "该表单项已经存在",
23
23
  "noDuplicates": "不能出现重复项",
24
24
  "string": "请输入字符串",
25
25
  "number": "请输入数字",
@@ -127,6 +127,22 @@ function getMiniAppChange(target: any, obj: any, action: string) {
127
127
  }
128
128
  }
129
129
 
130
+ let aiExecuted = 0;
131
+ let sessionId = '';
132
+ // AI 生成内容是否被采纳
133
+ const handleAIPoint = (app: any, actionItem: any) => {
134
+ const { actionMsg, action } = actionItem || {};
135
+ if (aiExecuted > 0) {
136
+ app.emit('logic:accepted', { ...actionItem, sessionId });
137
+ aiExecuted -= 1;
138
+ }
139
+ if (actionMsg.includes('自然语言生成代码') && !action) {
140
+ aiExecuted += 1;
141
+ // eslint-disable-next-line prefer-destructuring
142
+ sessionId = actionMsg.match(/:(.*)/)[1];
143
+ }
144
+ }
145
+
130
146
  /**
131
147
  * 执行更新
132
148
  */
@@ -135,6 +151,7 @@ async function doAction(app: any, actionItem: any) {
135
151
  let hasBackEnd = false;
136
152
  const actionList: any[] = [];
137
153
  const { list, actionMsg, action } = actionItem || {};
154
+ handleAIPoint(app, actionItem);
138
155
  const itemloop = (_i: LogicItem, app: any, diffArr: string[]) => {
139
156
  const _l = getStatement(_i, app, diffArr);
140
157
  if (_l.length) {
@@ -55,9 +55,10 @@ export function genCreateFormTemplate(entity: Entity, nameGroup: NameGroup, sele
55
55
  // 存在多个属性关联同一个实体的情况,因此加上属性名用以唯一标识
56
56
  const key = [property.name, relationEntity.name].join('-');
57
57
  const selectNameGroup = selectNameGroupMap.get(key);
58
+ let dataSourceValue = `(params) => ${selectNameGroup.logic}(elements.$ce.page, elements.$ce.size)`
58
59
  formItem += `
59
- <u-select clearable placeholder="请选择${label}" :data-source="${selectNameGroup.viewLogicLoad}"
60
- text-field="${lowerEntityName}.${displayedProperty.name}" value-field="${lowerEntityName}.${relationProperty.name}" :pageable="true" :remote-paging="true" v-model="${vModel}">
60
+ <u-select clearable placeholder="请选择${label}" :data-source="${dataSourceValue}" :page-size="50"
61
+ text-field="${lowerEntityName}.${displayedProperty.name}" value-field="${lowerEntityName}.${relationProperty.name}" :pagination="true" v-model="${vModel}">
61
62
  </u-select>
62
63
  `;
63
64
  } else return '';
@@ -134,9 +135,10 @@ export function genH5CreateFormTemplate(entity: Entity, nameGroup: NameGroup, se
134
135
  // 存在多个属性关联同一个实体的情况,因此加上属性名用以唯一标识
135
136
  const key = [property.name, relationEntity.name].join('-');
136
137
  const selectNameGroup = selectNameGroupMap.get(key);
138
+ let dataSourceValue = `(params) => ${selectNameGroup.logic}(elements.$ce.page, elements.$ce.size)`
137
139
  formItem += `
138
140
  <template #input><van-linear-layout style="width:100%;" direction="horizontal"><van-pickerson type="list" :show-toolbar="true" title="请选择${label}" placeholder="请选择${label}"
139
- v-model="${vModel}" :data-source="${selectNameGroup.viewLogicLoad}"
141
+ v-model="${vModel}" :data-source="${dataSourceValue}" :page-size="50"
140
142
  text-field="${lowerEntityName}.${displayedProperty.name}" value-field="${lowerEntityName}.${relationProperty.name}"
141
143
  :notitleblock="true"
142
144
  :pageable="true" input-align="left" :remote-paging="true"></van-pickerson></van-linear-layout></template>
@@ -58,9 +58,10 @@ function genFilterTemplate(entity: Entity, nameGroup: NameGroup, selectNameGroup
58
58
  // 存在多个属性关联同一个实体的情况,因此加上属性名用以唯一标识
59
59
  const key = [property.name, relationEntity.name].join('-');
60
60
  const selectNameGroup = selectNameGroupMap.get(key);
61
+ let dataSourceValue = `(params) => ${selectNameGroup.logic}(elements.$ce.page, elements.$ce.size)`
61
62
  formItem += `
62
- <u-select clearable placeholder="请选择${label}" :data-source="${selectNameGroup.viewLogicLoad}"
63
- text-field="${lowerEntityName}.${displayedProperty.name}" value-field="${lowerEntityName}.${relationProperty.name}" :pageable="true" :remote-paging="true" v-model="${vModel}">
63
+ <u-select clearable placeholder="请选择${label}" :data-source="${dataSourceValue}" :page-size="50"
64
+ text-field="${lowerEntityName}.${displayedProperty.name}" value-field="${lowerEntityName}.${relationProperty.name}" :pagination="true" v-model="${vModel}">
64
65
  </u-select>
65
66
  `;
66
67
  } else return '';
@@ -161,9 +162,10 @@ function genSaveModalTemplate(entity: Entity, nameGroup: NameGroup, selectNameGr
161
162
  // 存在多个属性关联同一个实体的情况,因此加上属性名用以唯一标识
162
163
  const key = [property.name, relationEntity.name].join('-');
163
164
  const selectNameGroup = selectNameGroupMap.get(key);
165
+ let dataSourceValue = `(params) => ${selectNameGroup.logic}(elements.$ce.page, elements.$ce.size)`
164
166
  formItem += `
165
- <u-select clearable placeholder="请选择${label}" :data-source="${selectNameGroup.load}"
166
- text-field="${lowerEntityName}.${displayedProperty.name}" value-field="${lowerEntityName}.${relationProperty.name}" :pageable="true" :remote-paging="true" v-model="${vModel}">
167
+ <u-select clearable placeholder="请选择${label}" :data-source="${dataSourceValue}" :page-size="50"
168
+ text-field="${lowerEntityName}.${displayedProperty.name}" value-field="${lowerEntityName}.${relationProperty.name}" :pagination="true" v-model="${vModel}">
167
169
  </u-select>
168
170
  `;
169
171
  } else return '';
@@ -325,7 +327,7 @@ export function genCurdEditMultipleKeyBlock(entity: Entity, oldNode: ViewElement
325
327
  return `<template>
326
328
  <u-linear-layout direction="vertical">
327
329
  ${genFilterTemplate(entity, nameGroup, selectNameGroupMap)}
328
- ${genEditTableTemplate(entity, nameGroup, selectNameGroupMap)}
330
+ ${genEditTableTemplate(entity, nameGroup, entityLogic, selectNameGroupMap, 'genCurdEditMultipleKeyBlock')}
329
331
  ${genSaveModalTemplate(entity, nameGroup, selectNameGroupMap)}
330
332
  </u-linear-layout>
331
333
  </template>
@@ -427,6 +429,7 @@ export function genEditTableColumnComponent(app: App, entity: Entity, property:
427
429
  viewLogicLoad: nameGroup.viewElementSelectLogic,
428
430
  viewElementSelect: '',
429
431
  };
432
+ let dataSourceValue = selectNameGroup.viewLogicLoad
430
433
  if (!nameGroup.viewElementSelectLogic) {
431
434
  const viewElementSelect = view.getViewElementUniqueName('select');
432
435
  const selectNameGroup = genUniqueQueryNameGroup(module, view, viewElementSelect, false, relationEntity.name);
@@ -434,11 +437,12 @@ export function genEditTableColumnComponent(app: App, entity: Entity, property:
434
437
  const newLogic = genQueryLogic([relationEntity], selectNameGroup, false, false, module);
435
438
  newLogics.push(newLogic);
436
439
  newLoadSelectLogics.push(genLoadSelectLogic(relationEntity, selectNameGroup, newLogic));
440
+ dataSourceValue = `(params) => ${selectNameGroup.viewLogicLoad}(elements.$ce.page, elements.$ce.size)`
437
441
  }
438
442
  formItem += `
439
- <u-select clearable placeholder="请选择${label}" :data-source="${selectNameGroup.viewLogicLoad}"
443
+ <u-select clearable placeholder="请选择${label}" :data-source="${dataSourceValue}" :page-size="50"
440
444
  :autofocus="true" :opened="true" append-to="body" @blur="${nameGroup.viewLogicBlurUpdate}" @select="${nameGroup.viewLogicBlurUpdate}"
441
- text-field="${lowerEntityName}.${displayedProperty.name}" value-field="${lowerEntityName}.${relationProperty.name}" :pageable="true" :remote-paging="true" :value.sync="${valueExpression}">
445
+ text-field="${lowerEntityName}.${displayedProperty.name}" value-field="${lowerEntityName}.${relationProperty.name}" :pagination="true" :value.sync="${valueExpression}">
442
446
  </u-select>
443
447
  `;
444
448
  } else return '';
@@ -474,7 +478,7 @@ export function genEditTableColumnComponent(app: App, entity: Entity, property:
474
478
  const name = enumeration?.name || '';
475
479
  const enumTypeAnnotationStr = `__enumTypeAnnotation_${namespace}.${name}`;
476
480
  formItem += `<u-select clearable
477
- :data-source="$utils.EnumToList('${enumTypeAnnotationStr}')"
481
+ :data-source="$utils.EnumToList('${enumTypeAnnotationStr}')" :page-size="50"
478
482
  :value.sync="${valueExpression}" placeholder="请输入${label}"
479
483
  :autofocus="true" :opened="true" append-to="body" @blur="${nameGroup.viewLogicBlurUpdate}" @select="${nameGroup.viewLogicBlurUpdate}">
480
484
  </u-select>`;
@@ -57,9 +57,10 @@ function genFilterTemplate(entity: Entity, nameGroup: NameGroup, selectNameGroup
57
57
  // 存在多个属性关联同一个实体的情况,因此加上属性名用以唯一标识
58
58
  const key = [property.name, relationEntity.name].join('-');
59
59
  const selectNameGroup = selectNameGroupMap.get(key);
60
+ let dataSourceValue = `(params) => ${selectNameGroup.logic}(elements.$ce.page, elements.$ce.size)`
60
61
  formItem += `
61
- <u-select clearable placeholder="请选择${label}" :data-source="${selectNameGroup.viewLogicLoad}"
62
- text-field="${lowerEntityName}.${displayedProperty.name}" value-field="${lowerEntityName}.${relationProperty.name}" :pageable="true" :remote-paging="true" v-model="${vModel}">
62
+ <u-select clearable placeholder="请选择${label}" :data-source="${dataSourceValue}" :page-size="50"
63
+ text-field="${lowerEntityName}.${displayedProperty.name}" value-field="${lowerEntityName}.${relationProperty.name}" :pagination="true" v-model="${vModel}">
63
64
  </u-select>
64
65
  `;
65
66
  } else return '';
@@ -158,13 +159,13 @@ function genSaveModalTemplate(entity: Entity, nameGroup: NameGroup, selectNameGr
158
159
  // 存在多个属性关联同一个实体的情况,因此加上属性名用以唯一标识
159
160
  const key = [property.name, relationEntity.name].join('-');
160
161
  const selectNameGroup = selectNameGroupMap.get(key);
162
+ let dataSourceValue = `(params) => ${selectNameGroup.logic}(elements.$ce.page, elements.$ce.size)`
161
163
  formItem += `
162
164
  <u-select clearable placeholder="请选择${label}"
163
165
  text-field="${lowerEntityName}.${displayedProperty.name}"
164
166
  value-field="${lowerEntityName}.${relationProperty.name}"
165
- :data-source="${selectNameGroup.viewLogicLoad}"
166
- :pageable="true"
167
- :remote-paging="true"
167
+ :data-source="${dataSourceValue}" :page-size="50"
168
+ :pagination="true"
168
169
  ${property.primaryKey ? `:disabled="${nameGroup.viewVariableIsUpdate}"` : ''}
169
170
  v-model="${vModel}">
170
171
  </u-select>
@@ -507,7 +508,7 @@ export function genCurdMultipleKeyBlock(entity: Entity, oldNode: ViewElement) {
507
508
  return `<template>
508
509
  <u-linear-layout direction="vertical">
509
510
  ${genFilterTemplate(entity, nameGroup, selectNameGroupMap)}
510
- ${genTableTemplate(entity, nameGroup, true)}
511
+ ${genTableTemplate(entity, nameGroup, entityLogic, true, 'genCurdMultipleKeyBlock')}
511
512
  ${genSaveModalTemplate(entity, nameGroup, selectNameGroupMap)}
512
513
  </u-linear-layout>
513
514
  </template>
@@ -635,7 +636,7 @@ export function genGridViewMultipleKeyBlock(entity: Entity, oldNode: ViewElement
635
636
  return `<template>
636
637
  <u-linear-layout direction="vertical">
637
638
  ${genFilterTemplate(entity, nameGroup, selectNameGroupMap)}
638
- ${genGridViewTemplate(entity, nameGroup, true)}
639
+ ${genTableTemplate(entity, nameGroup, entityLogic, true, 'genCurdMultipleKeyBlock')}
639
640
  ${genSaveModalTemplate(entity, nameGroup, selectNameGroupMap)}
640
641
  </u-linear-layout>
641
642
  </template>
@@ -63,10 +63,12 @@ export function genEditTableColumnTemplate(
63
63
  // 存在多个属性关联同一个实体的情况,因此加上属性名用以唯一标识
64
64
  const key = [property.name, relationEntity.name].join('-');
65
65
  const selectNameGroup = selectNameGroupMap.get(key);
66
+ let dataSourceValue = `(params) => ${selectNameGroup.logic}(elements.$ce.page, elements.$ce.size)`
67
+ debugger
66
68
  formItem += `
67
- <u-select clearable placeholder="请选择${label}" :data-source="${selectNameGroup.viewLogicLoad}"
69
+ <u-select clearable placeholder="请选择${label}" :data-source="${dataSourceValue}" :page-size="50"
68
70
  :autofocus="true" :opened="true" append-to="body" @blur="${nameGroup.viewLogicBlurUpdate}" @select="${nameGroup.viewLogicBlurUpdate}"
69
- text-field="${lowerEntityName}.${displayedProperty.name}" value-field="${lowerEntityName}.${relationProperty.name}" :pageable="true" :remote-paging="true" :value.sync="${valueExpression}">
71
+ text-field="${lowerEntityName}.${displayedProperty.name}" value-field="${lowerEntityName}.${relationProperty.name}" :pagination="true" :value.sync="${valueExpression}">
70
72
  </u-select>
71
73
  `;
72
74
  } else return '';
@@ -102,7 +104,7 @@ export function genEditTableColumnTemplate(
102
104
  const name = enumeration?.name || '';
103
105
  const enumTypeAnnotationStr = `__enumTypeAnnotation_${namespace}.${name}`;
104
106
  formItem += `<u-select clearable
105
- :data-source="$utils.EnumToList('${enumTypeAnnotationStr}')"
107
+ :data-source="$utils.EnumToList('${enumTypeAnnotationStr}')" :page-size="50"
106
108
  :value.sync="${valueExpression}" placeholder="请输入${label}"
107
109
  :autofocus="true" :opened="true" append-to="body" @blur="${nameGroup.viewLogicBlurUpdate}" @select="${nameGroup.viewLogicBlurUpdate}">
108
110
  </u-select>`;
@@ -135,12 +137,15 @@ export function genEditTableColumnTemplate(
135
137
  * @param entity 实体
136
138
  * @param nameGroup 命名组
137
139
  */
138
- export function genEditTableTemplate(entity: Entity, nameGroup: NameGroup, selectNameGroupMap?: Map<string, NameGroup>) {
140
+ export function genEditTableTemplate(entity: Entity, nameGroup: NameGroup, newLogic: any, selectNameGroupMap?: Map<string, NameGroup>, entryFromCall?:string) {
139
141
  const properties = entity.properties.filter(filterProperty('inTable'));
140
-
141
- return `<u-table-view ref="${nameGroup.viewElementMainView}" :data-source="${nameGroup.viewLogicLoad}" data-schema="${nameGroup.structure}"
142
+ let dataSourceValue = `(params) => ${newLogic.name}(elements.$ce.page,elements.$ce.size,elements.$ce.sort,elements.$ce.order)`;
143
+ if (['genCurdEditMultipleKeyBlock'].includes(entryFromCall)) {
144
+ dataSourceValue = `(params) => ${newLogic.name}(elements.$ce.page,elements.$ce.size,elements.$ce.sort,elements.$ce.order,${nameGroup.viewVariableFilter})`;
145
+ }
146
+ return `<u-table-view ref="${nameGroup.viewElementMainView}" :data-source="${dataSourceValue}" data-schema="${nameGroup.structure}"
142
147
  value-field="${nameGroup.viewVariableEntity}.id"
143
- :pagination="true" :show-sizer="true" :default-column-width="300" editable>
148
+ :pagination="true" :show-sizer="true" :page-size="20" :page-number="1" :default-column-width="300" editable>
144
149
  <u-table-view-column type="index" width="60"><template #title><u-text text="序号"></u-text></template><template #cell="current"></template></u-table-view-column>
145
150
 
146
151
  ${properties.map((property) => `${genEditTableColumnTemplate(entity, property, nameGroup, selectNameGroupMap)}\n`).join('')}
@@ -16,14 +16,14 @@ export function genEnumSelectBlock(enumeration: Enum, vModel?: string, size?: st
16
16
  return `<van-pickerson type="list" :show-toolbar="true" ${vModel ? ` v-model="${vModel}"` : ''}${
17
17
  placeholder ? ` title="${placeholder}" placeholder="${placeholder}"` : ''
18
18
  }
19
- :data-source="$utils.EnumToList('${enumTypeAnnotationStr}')" :notitleblock="${hiddenAll}"><template #title>${
19
+ :data-source="$utils.EnumToList('${enumTypeAnnotationStr}')" :page-size="50" :notitleblock="${hiddenAll}"><template #title>${
20
20
  !hiddenAll ? placeholder || '' : ''
21
21
  }</template></van-pickerson>`;
22
22
 
23
23
  return `<u-select clearable${vModel ? ` v-model="${vModel}"` : ''}${size ? ` size="${size}"` : ''}${
24
24
  placeholder ? ` placeholder="${placeholder}"` : ''
25
25
  }
26
- :data-source="$utils.EnumToList('${enumTypeAnnotationStr}')">
26
+ :data-source="$utils.EnumToList('${enumTypeAnnotationStr}')" :page-size="50">
27
27
  ${hiddenAll ? '' : '<u-select-item text="全部"></u-select-item>'}
28
28
  </u-select>`;
29
29
  }
@@ -58,12 +58,12 @@ export function genH5GetTemplate(entity: Entity, nameGroup: NameGroup) {
58
58
  const temptitle = property.label || property.name;
59
59
  let formItem = ` <van-cell isLink`;
60
60
 
61
- formItem += ' :value="' + `${nameGroup.viewVariableEntity}.${property.name}` + '">';
62
- formItem += `<template #title>${temptitle}</template>`;
63
- formItem += `<template>{{ ${`${nameGroup.viewVariableEntity}.${property.name}`} }}</template> </van-cell>\n`;
64
- return formItem;
65
- })
66
- .join('')}
61
+ formItem += ' :value="' + `${nameGroup.viewVariableEntity}.${property.name}` + '">';
62
+ formItem += `<template #title>${temptitle}</template>`;
63
+ formItem += `{{ ${`${nameGroup.viewVariableEntity}.${property.name}`} }} </van-cell>\n`;
64
+ return formItem;
65
+ })
66
+ .join('')}
67
67
  </van-cell-group>`;
68
68
  }
69
69
 
@@ -93,12 +93,17 @@ export function genH5GridViewCardTemplate(property: EntityProperty, nameGroup?:
93
93
  * @param entity 实体
94
94
  * @param nameGroup 命名组
95
95
  */
96
- export function genGridViewTemplate(entity: Entity, nameGroup: NameGroup, modifyable?: boolean) {
96
+ export function genGridViewTemplate(entity: Entity, nameGroup: NameGroup, newLogic: any, modifyable?: boolean, entryFromCall?: string) {
97
97
  const currentName = nameGroup.currentName || 'current';
98
98
  const properties = entity.properties.filter(filterProperty('inTable'));
99
- return `<u-grid-view ref="${nameGroup.viewElementMainView}" :data-source="${nameGroup.viewLogicLoad}" data-schema="${nameGroup.structure}"
99
+ let dataSourceValue = `(params) => ${newLogic.name}(elements.$ce.page, elements.$ce.size,elements.$ce.sort,elements.$ce.order)`;
100
+ if (['genCurdMultipleKeyBlock'].includes(entryFromCall)) {
101
+ dataSourceValue = `(params) => ${newLogic.name}(elements.$ce.page, elements.$ce.size,elements.$ce.sort,elements.$ce.order,${nameGroup.viewVariableFilter})`;
102
+ }
103
+ return `<u-grid-view ref="${nameGroup.viewElementMainView}" :data-source="${dataSourceValue}" data-schema="${nameGroup.structure}"
100
104
  value-field="${nameGroup.viewVariableEntity}.id"
101
- :page-size="20"
105
+ :page-size="50"
106
+ :page-number="1"
102
107
  :pageable="true"
103
108
  :remote-paging="true"
104
109
  :show-sizer="true"
@@ -122,11 +127,17 @@ export function genGridViewTemplate(entity: Entity, nameGroup: NameGroup, modify
122
127
  `;
123
128
  }
124
129
 
125
- export function genH5GridViewTemplate(entity: Entity, nameGroup: NameGroup) {
126
- const currentName = nameGroup.currentName || 'current';
127
- const properties = entity.properties.filter(filterProperty('inTable'));
128
- return `<van-grid-view ref="gridView" :data-source="${nameGroup.viewLogicLoad}" data-schema="${nameGroup.structure}"
130
+ export function genH5GridViewTemplate(entity: Entity, nameGroup: NameGroup, newLogic: any, modifyable?: boolean, entryFromCall?: string) {
131
+ const currentName = nameGroup.currentName || 'current';
132
+ const properties = entity.properties.filter(filterProperty('inTable'));
133
+ let dataSourceValue = `(params) => ${newLogic.name}(elements.$ce.page, elements.$ce.size,elements.$ce.sort,elements.$ce.order)`;
134
+ if (['genCurdMultipleKeyBlock'].includes(entryFromCall)) {
135
+ dataSourceValue = `(params) => ${newLogic.name}(elements.$ce.page, elements.$ce.size,elements.$ce.sort,elements.$ce.order,${nameGroup.viewVariableFilter})`;
136
+ }
137
+ return `<van-grid-view ref="${nameGroup.viewElementMainView}" :data-source="${dataSourceValue}" data-schema="${nameGroup.structure}"
129
138
  pageable="auto-more"
139
+ :page-size="50"
140
+ :page-number="1"
130
141
  :remote-paging="true"
131
142
  :col="2"
132
143
  :iffall="false">
@@ -243,6 +254,7 @@ export function genGridViewBlock(entity: Entity, oldNode: ViewElement) {
243
254
  nameGroup.viewElementMainView = viewElementMainView;
244
255
  nameGroup.viewVariableEntity = view.getVariableUniqueName(utils.firstLowerCase(entity.name));
245
256
  nameGroup.viewLogicRemove = view.getLogicUniqueName('remove');
257
+ nameGroup.viewVariableFilter = view.getVariableUniqueName('filter');
246
258
 
247
259
  // 当前节点的currentName
248
260
  nameGroup.currentName = oldNode.getCurrentName();
@@ -266,7 +278,7 @@ export function genGridViewBlock(entity: Entity, oldNode: ViewElement) {
266
278
 
267
279
  return `
268
280
  <template>
269
- ${config.scope === 'h5' ? genH5GridViewTemplate(entity, nameGroup) : genGridViewTemplate(entity, nameGroup)}
281
+ ${config.scope === 'h5' ? genH5GridViewTemplate(entity, nameGroup, entityLogic) : genGridViewTemplate(entity, nameGroup, entityLogic)}
270
282
  </template>
271
283
  <definition>
272
284
  {
@@ -292,6 +304,7 @@ export function genGridViewCardBlock(property: EntityProperty, oldNode: ViewElem
292
304
  nameGroup.viewElementMainView = viewElementMainView;
293
305
  nameGroup.viewVariableEntity = view.getVariableUniqueName(utils.firstLowerCase(entity.name));
294
306
  nameGroup.viewLogicRemove = view.getLogicUniqueName('remove');
307
+ nameGroup.viewVariableFilter = view.getVariableUniqueName('filter');
295
308
 
296
309
  // 收集所有和本实体关联的实体
297
310
  const entitySet: Set<Entity> = new Set();
@@ -313,7 +326,7 @@ export function genGridViewCardBlock(property: EntityProperty, oldNode: ViewElem
313
326
 
314
327
  return `
315
328
  <template>
316
- ${genGridViewTemplate(entity, nameGroup)}
329
+ ${genGridViewTemplate(entity, nameGroup, entityLogic)}
317
330
  </template>
318
331
  <definition>
319
332
  {
@@ -4,12 +4,15 @@ import { App, Module, Namespace, Entity, EntityProperty, DataSource, ViewElement
4
4
  import { genUniqueQueryNameGroup, getFirstDisplayedProperty, genQueryLogic, genLogicParam } from '.';
5
5
  import { NameGroup, NaslUITypeAnnotation, NaslLogicItem, NaslNode } from './utils';
6
6
 
7
- export function genListViewTemplate(property: EntityProperty, nameGroup: NameGroup) {
7
+ export function genListViewTemplate(property: EntityProperty, nameGroup: NameGroup, newLogic: any) {
8
8
  const { entity } = property;
9
9
  const lowerEntityName = utils.firstLowerCase(entity.name);
10
10
  const currentName = nameGroup.currentName || 'current';
11
11
  const valueExpression = `${currentName}.item.${lowerEntityName}.${property.name}`;
12
- return `<u-list-view ref="${nameGroup.viewElementMainView}" :data-source="${nameGroup.viewLogicLoad}" data-schema="${nameGroup.structure}"
12
+ let dataSourceValue = `(params) => ${newLogic.name}(elements.$ce.page, elements.$ce.size)`;
13
+ return `<u-list-view ref="${nameGroup.viewElementMainView}" :data-source="${dataSourceValue}" data-schema="${nameGroup.structure}"
14
+ :page-size="50"
15
+ :page-number="1"
13
16
  text-field="${nameGroup.viewVariableEntity}.${property.name}"
14
17
  value-field="${nameGroup.viewVariableEntity}.id" :pageable="true" :remote-paging="true">
15
18
  <template #item="current">
@@ -20,12 +23,15 @@ export function genListViewTemplate(property: EntityProperty, nameGroup: NameGro
20
23
  </u-list-view>`;
21
24
  }
22
25
 
23
- export function genH5ListViewTemplate(property: EntityProperty, nameGroup: NameGroup) {
26
+ export function genH5ListViewTemplate(property: EntityProperty, nameGroup: NameGroup, newLogic: any) {
24
27
  const { entity } = property;
25
28
  const lowerEntityName = utils.firstLowerCase(entity.name);
26
29
  const currentName = nameGroup.currentName || 'current';
27
30
  const valueExpression = `${currentName}.item.${lowerEntityName}.${property.name}`;
28
- return `<van-list-view ref="${nameGroup.viewElementMainView}" :data-source="${nameGroup.viewLogicLoad}" data-schema="${nameGroup.structure}"
31
+ let dataSourceValue = `(params) => ${newLogic.name}(elements.$ce.page, elements.$ce.size)`;
32
+ return `<van-list-view ref="${nameGroup.viewElementMainView}" :data-source="${dataSourceValue}" data-schema="${nameGroup.structure}"
33
+ :page-size="50"
34
+ :page-number="1"
29
35
  text-field="${nameGroup.viewVariableEntity}.${property.name}"
30
36
  value-field="${nameGroup.viewVariableEntity}.id" pageable="auto-more" :remote-paging="true">
31
37
  <template #item="current">
@@ -102,8 +108,11 @@ export function genListViewBlock(entity: Entity, oldNode: ViewElement, property:
102
108
 
103
109
  const newLogics: Array<any> = [];
104
110
 
111
+ const parentNode = entity.parentNode as App | Module | Namespace;
112
+ const entityLogic = genQueryLogic([entity], nameGroup, false, false, parentNode);
113
+
105
114
  return `<template>
106
- ${config.scope === 'h5' ? genH5ListViewTemplate(displayedProperty, nameGroup) : genListViewTemplate(displayedProperty, nameGroup)}
115
+ ${config.scope === 'h5' ? genH5ListViewTemplate(displayedProperty, nameGroup, entityLogic) : genListViewTemplate(displayedProperty, nameGroup, entityLogic)}
107
116
  </template>
108
117
 
109
118
  <definition>