@lcap/nasl 1.0.1 → 2.12.0-beta.1

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 (364) hide show
  1. package/out/automate/engine/index.d.ts +1 -0
  2. package/out/automate/engine/index.js +34 -12
  3. package/out/automate/engine/index.js.map +1 -1
  4. package/out/automate/engine/operators.d.ts +10 -2
  5. package/out/automate/engine/operators.js +105 -7
  6. package/out/automate/engine/operators.js.map +1 -1
  7. package/out/automate/engine/uniqueName.d.ts +8 -2
  8. package/out/automate/engine/uniqueName.js +72 -4
  9. package/out/automate/engine/uniqueName.js.map +1 -1
  10. package/out/automate/engine/utils.d.ts +1 -0
  11. package/out/automate/engine/utils.js +108 -67
  12. package/out/automate/engine/utils.js.map +1 -1
  13. package/out/automate/template/process.d.ts +9 -0
  14. package/out/automate/template/process.js +10976 -0
  15. package/out/automate/template/process.js.map +1 -0
  16. package/out/bak/translator.js +1 -0
  17. package/out/bak/translator.js.map +1 -1
  18. package/out/common/BaseNode.d.ts +6 -1
  19. package/out/common/BaseNode.js +37 -6
  20. package/out/common/BaseNode.js.map +1 -1
  21. package/out/concepts/App__.d.ts +52 -49
  22. package/out/concepts/App__.js +89 -53
  23. package/out/concepts/App__.js.map +1 -1
  24. package/out/concepts/Assignee__.d.ts +11 -0
  25. package/out/concepts/Assignee__.js +34 -0
  26. package/out/concepts/Assignee__.js.map +1 -1
  27. package/out/concepts/BindAttribute__.js +2 -2
  28. package/out/concepts/BindAttribute__.js.map +1 -1
  29. package/out/concepts/BindDirective__.js +10 -3
  30. package/out/concepts/BindDirective__.js.map +1 -1
  31. package/out/concepts/BindEvent__.js +15 -6
  32. package/out/concepts/BindEvent__.js.map +1 -1
  33. package/out/concepts/BooleanLiteral__.d.ts +4 -0
  34. package/out/concepts/BooleanLiteral__.js +11 -0
  35. package/out/concepts/BooleanLiteral__.js.map +1 -1
  36. package/out/concepts/CallFunction__.js +9 -4
  37. package/out/concepts/CallFunction__.js.map +1 -1
  38. package/out/concepts/CallLogic__.js +48 -30
  39. package/out/concepts/CallLogic__.js.map +1 -1
  40. package/out/concepts/CallQueryComponent__.d.ts +34 -4
  41. package/out/concepts/CallQueryComponent__.js +340 -95
  42. package/out/concepts/CallQueryComponent__.js.map +1 -1
  43. package/out/concepts/Comment__.js +1 -1
  44. package/out/concepts/Comment__.js.map +1 -1
  45. package/out/concepts/ConfigGroup__.d.ts +1 -0
  46. package/out/concepts/ConfigGroup__.js +7 -0
  47. package/out/concepts/ConfigGroup__.js.map +1 -1
  48. package/out/concepts/ConfigProperty__.d.ts +1 -0
  49. package/out/concepts/ConfigProperty__.js +3 -0
  50. package/out/concepts/ConfigProperty__.js.map +1 -1
  51. package/out/concepts/Configuration__.d.ts +1 -0
  52. package/out/concepts/Configuration__.js +3 -0
  53. package/out/concepts/Configuration__.js.map +1 -1
  54. package/out/concepts/Constant__.js +6 -6
  55. package/out/concepts/Constant__.js.map +1 -1
  56. package/out/concepts/DataSource__.d.ts +143 -0
  57. package/out/concepts/DataSource__.js +318 -0
  58. package/out/concepts/DataSource__.js.map +1 -0
  59. package/out/concepts/Destination__.js +22 -8
  60. package/out/concepts/Destination__.js.map +1 -1
  61. package/out/concepts/End__.js +2 -2
  62. package/out/concepts/End__.js.map +1 -1
  63. package/out/concepts/EntityIndex__.d.ts +5 -0
  64. package/out/concepts/EntityIndex__.js +10 -2
  65. package/out/concepts/EntityIndex__.js.map +1 -1
  66. package/out/concepts/EntityProperty__.d.ts +9 -0
  67. package/out/concepts/EntityProperty__.js +22 -7
  68. package/out/concepts/EntityProperty__.js.map +1 -1
  69. package/out/concepts/Entity__.d.ts +6 -0
  70. package/out/concepts/Entity__.js +27 -11
  71. package/out/concepts/Entity__.js.map +1 -1
  72. package/out/concepts/Enum__.d.ts +1 -0
  73. package/out/concepts/Enum__.js +14 -4
  74. package/out/concepts/Enum__.js.map +1 -1
  75. package/out/concepts/ForEachStatement__.js +2 -2
  76. package/out/concepts/ForEachStatement__.js.map +1 -1
  77. package/out/concepts/Function__.d.ts +18 -0
  78. package/out/concepts/Function__.js +96 -1
  79. package/out/concepts/Function__.js.map +1 -1
  80. package/out/concepts/Identifier__.js +5 -14
  81. package/out/concepts/Identifier__.js.map +1 -1
  82. package/out/concepts/IfStatement__.js +8 -8
  83. package/out/concepts/IfStatement__.js.map +1 -1
  84. package/out/concepts/InterfaceParam__.js +9 -4
  85. package/out/concepts/InterfaceParam__.js.map +1 -1
  86. package/out/concepts/Interface__.js +19 -12
  87. package/out/concepts/Interface__.js.map +1 -1
  88. package/out/concepts/JSBlock__.js +3 -5
  89. package/out/concepts/JSBlock__.js.map +1 -1
  90. package/out/concepts/Logic__.js +44 -44
  91. package/out/concepts/Logic__.js.map +1 -1
  92. package/out/concepts/Module__.d.ts +116 -194
  93. package/out/concepts/Module__.js +31 -114
  94. package/out/concepts/Module__.js.map +1 -1
  95. package/out/concepts/Namespace__.d.ts +0 -86
  96. package/out/concepts/Namespace__.js +1 -108
  97. package/out/concepts/Namespace__.js.map +1 -1
  98. package/out/concepts/Param__.d.ts +3 -2
  99. package/out/concepts/Param__.js +15 -8
  100. package/out/concepts/Param__.js.map +1 -1
  101. package/out/concepts/ProcessElement__.js +38 -12
  102. package/out/concepts/ProcessElement__.js.map +1 -1
  103. package/out/concepts/Process__.d.ts +1 -1
  104. package/out/concepts/Process__.js +17 -10
  105. package/out/concepts/Process__.js.map +1 -1
  106. package/out/concepts/QueryAggregateExpression__.js +1 -1
  107. package/out/concepts/QueryAggregateExpression__.js.map +1 -1
  108. package/out/concepts/QueryFieldExpression__.d.ts +1 -0
  109. package/out/concepts/QueryFieldExpression__.js +11 -1
  110. package/out/concepts/QueryFieldExpression__.js.map +1 -1
  111. package/out/concepts/QueryFromExpression__.d.ts +4 -0
  112. package/out/concepts/QueryFromExpression__.js +13 -2
  113. package/out/concepts/QueryFromExpression__.js.map +1 -1
  114. package/out/concepts/QueryGroupByExpression__.d.ts +3 -0
  115. package/out/concepts/QueryGroupByExpression__.js +20 -0
  116. package/out/concepts/QueryGroupByExpression__.js.map +1 -1
  117. package/out/concepts/QueryJoinExpression__.d.ts +4 -0
  118. package/out/concepts/QueryJoinExpression__.js +14 -3
  119. package/out/concepts/QueryJoinExpression__.js.map +1 -1
  120. package/out/concepts/Return__.d.ts +1 -1
  121. package/out/concepts/Return__.js +16 -11
  122. package/out/concepts/Return__.js.map +1 -1
  123. package/out/concepts/Role__.js +10 -3
  124. package/out/concepts/Role__.js.map +1 -1
  125. package/out/concepts/SqlQueryComponent__.d.ts +14 -0
  126. package/out/concepts/SqlQueryComponent__.js +48 -5
  127. package/out/concepts/SqlQueryComponent__.js.map +1 -1
  128. package/out/concepts/StringLiteral__.d.ts +1 -1
  129. package/out/concepts/StringLiteral__.js +2 -9
  130. package/out/concepts/StringLiteral__.js.map +1 -1
  131. package/out/concepts/StructureProperty__.js +11 -10
  132. package/out/concepts/StructureProperty__.js.map +1 -1
  133. package/out/concepts/Structure__.js +19 -12
  134. package/out/concepts/Structure__.js.map +1 -1
  135. package/out/concepts/SwitchCase__.d.ts +1 -1
  136. package/out/concepts/SwitchCase__.js +23 -25
  137. package/out/concepts/SwitchCase__.js.map +1 -1
  138. package/out/concepts/SwitchStatement__.js +1 -6
  139. package/out/concepts/SwitchStatement__.js.map +1 -1
  140. package/out/concepts/TypeAnnotation__.d.ts +8 -0
  141. package/out/concepts/TypeAnnotation__.js +53 -3
  142. package/out/concepts/TypeAnnotation__.js.map +1 -1
  143. package/out/concepts/Variable__.d.ts +1 -1
  144. package/out/concepts/Variable__.js +16 -11
  145. package/out/concepts/Variable__.js.map +1 -1
  146. package/out/concepts/ViewElement__.js +25 -20
  147. package/out/concepts/ViewElement__.js.map +1 -1
  148. package/out/concepts/View__.d.ts +1 -3
  149. package/out/concepts/View__.js +42 -36
  150. package/out/concepts/View__.js.map +1 -1
  151. package/out/concepts/WhileStatement__.js +4 -4
  152. package/out/concepts/WhileStatement__.js.map +1 -1
  153. package/out/concepts/basics/stdlib/nasl.auth.js +20 -0
  154. package/out/concepts/basics/stdlib/nasl.auth.js.map +1 -1
  155. package/out/concepts/basics/stdlib/nasl.configuration.js +1 -1
  156. package/out/concepts/basics/stdlib/nasl.configuration.js.map +1 -1
  157. package/out/concepts/basics/stdlib/nasl.interface.d.ts +2 -0
  158. package/out/concepts/basics/stdlib/nasl.interface.js +4 -4
  159. package/out/concepts/basics/stdlib/nasl.interface.js.map +1 -1
  160. package/out/concepts/basics/stdlib/nasl.process.d.ts +4 -0
  161. package/out/concepts/basics/stdlib/nasl.process.js +410 -0
  162. package/out/concepts/basics/stdlib/nasl.process.js.map +1 -1
  163. package/out/concepts/basics/stdlib/nasl.ui.js +1 -11
  164. package/out/concepts/basics/stdlib/nasl.ui.js.map +1 -1
  165. package/out/concepts/basics/stdlib/nasl.util.js +270 -8
  166. package/out/concepts/basics/stdlib/nasl.util.js.map +1 -1
  167. package/out/concepts/basics/stdlib/reference2TypeAnnotationList.js +1 -1
  168. package/out/concepts/basics/stdlib/reference2TypeAnnotationList.js.map +1 -1
  169. package/out/concepts/basics/types/index.d.ts +2 -0
  170. package/out/concepts/basics/types/index.js +6 -1
  171. package/out/concepts/basics/types/index.js.map +1 -1
  172. package/out/concepts/index__.d.ts +1 -0
  173. package/out/concepts/index__.js +1 -0
  174. package/out/concepts/index__.js.map +1 -1
  175. package/out/enums/KEYWORDS.js +0 -7
  176. package/out/enums/KEYWORDS.js.map +1 -1
  177. package/out/generator/genBundleFiles.d.ts +3 -1
  178. package/out/generator/genBundleFiles.js +23 -5
  179. package/out/generator/genBundleFiles.js.map +1 -1
  180. package/out/generator/genMetaData.d.ts +1 -0
  181. package/out/generator/genMetaData.js +20 -12
  182. package/out/generator/genMetaData.js.map +1 -1
  183. package/out/index.d.ts +1 -1
  184. package/out/index.js +2 -1
  185. package/out/index.js.map +1 -1
  186. package/out/manager/diagnostic.d.ts +1 -1
  187. package/out/server/createUiTs.js +1 -0
  188. package/out/server/createUiTs.js.map +1 -1
  189. package/out/{test/integration/connect-file copy.d.ts → server/extendBaseNode.d.ts} +0 -0
  190. package/out/server/extendBaseNode.js +323 -0
  191. package/out/server/extendBaseNode.js.map +1 -0
  192. package/out/server/getLogics.js +49 -2
  193. package/out/server/getLogics.js.map +1 -1
  194. package/out/server/getMemberIdentifier.js +52 -2
  195. package/out/server/getMemberIdentifier.js.map +1 -1
  196. package/out/server/getProcesses.d.ts +8 -2
  197. package/out/server/getProcesses.js +228 -20
  198. package/out/server/getProcesses.js.map +1 -1
  199. package/out/server/getScope.d.ts +1 -0
  200. package/out/server/getScope.js +4 -0
  201. package/out/server/getScope.js.map +1 -1
  202. package/out/server/index.d.ts +1 -0
  203. package/out/server/index.js +1 -0
  204. package/out/server/index.js.map +1 -1
  205. package/out/server/naslServer.d.ts +8 -5
  206. package/out/server/naslServer.js +314 -383
  207. package/out/server/naslServer.js.map +1 -1
  208. package/out/server/process2LogicNamespace.js +10 -1
  209. package/out/server/process2LogicNamespace.js.map +1 -1
  210. package/out/server/translator.d.ts +1 -1
  211. package/out/server/translator.js +40 -2
  212. package/out/server/translator.js.map +1 -1
  213. package/out/service/creator/errHandles.js +5 -0
  214. package/out/service/creator/errHandles.js.map +1 -1
  215. package/out/service/storage/init.d.ts +1 -0
  216. package/out/service/storage/init.js +113 -94
  217. package/out/service/storage/init.js.map +1 -1
  218. package/out/templator/genCreateBlock.js +34 -24
  219. package/out/templator/genCreateBlock.js.map +1 -1
  220. package/out/templator/genCurdEditMultipleKeyBlock.js +28 -18
  221. package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
  222. package/out/templator/genCurdMultipleKeyBlock.js +45 -29
  223. package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
  224. package/out/templator/genEditTableBlock.js +15 -13
  225. package/out/templator/genEditTableBlock.js.map +1 -1
  226. package/out/templator/genEnumSelectBlock.js +1 -1
  227. package/out/templator/genEnumSelectBlock.js.map +1 -1
  228. package/out/templator/genGetBlock.js +1 -1
  229. package/out/templator/genGetBlock.js.map +1 -1
  230. package/out/templator/genGridViewBlock.js +29 -24
  231. package/out/templator/genGridViewBlock.js.map +1 -1
  232. package/out/templator/genListViewBlock.js +7 -5
  233. package/out/templator/genListViewBlock.js.map +1 -1
  234. package/out/templator/genQueryComponent.js +31 -29
  235. package/out/templator/genQueryComponent.js.map +1 -1
  236. package/out/templator/genSelectBlock.js +13 -22
  237. package/out/templator/genSelectBlock.js.map +1 -1
  238. package/out/templator/genTableBlock.js +31 -21
  239. package/out/templator/genTableBlock.js.map +1 -1
  240. package/out/templator/genUpdateBlock.js +35 -25
  241. package/out/templator/genUpdateBlock.js.map +1 -1
  242. package/out/templator/utils.d.ts +5 -3
  243. package/out/templator/utils.js +2 -1
  244. package/out/templator/utils.js.map +1 -1
  245. package/out/test/integration/connect-file.js +6 -6
  246. package/out/test/integration/connect-file.js.map +1 -1
  247. package/out/translator/index.js +1 -1
  248. package/out/translator/index.js.map +1 -1
  249. package/out/utils/index.d.ts +5 -0
  250. package/out/utils/index.js +50 -1
  251. package/out/utils/index.js.map +1 -1
  252. package/package.json +1 -2
  253. package/src/automate/engine/index.js +33 -8
  254. package/src/automate/engine/operators.js +114 -17
  255. package/src/automate/engine/uniqueName.js +77 -9
  256. package/src/automate/engine/utils.js +110 -69
  257. package/src/automate/template/process.js +10999 -0
  258. package/src/bak/translator.js +1 -0
  259. package/src/common/BaseNode.ts +35 -7
  260. package/src/concepts/App__.ts +132 -131
  261. package/src/concepts/Assignee__.ts +30 -0
  262. package/src/concepts/BindAttribute__.ts +2 -2
  263. package/src/concepts/BindDirective__.ts +9 -7
  264. package/src/concepts/BindEvent__.ts +14 -6
  265. package/src/concepts/BooleanLiteral__.ts +12 -0
  266. package/src/concepts/CallFunction__.ts +7 -4
  267. package/src/concepts/CallLogic__.ts +47 -32
  268. package/src/concepts/CallQueryComponent__.ts +352 -101
  269. package/src/concepts/Comment__.ts +1 -1
  270. package/src/concepts/ConfigGroup__.ts +3 -1
  271. package/src/concepts/ConfigProperty__.ts +4 -0
  272. package/src/concepts/Configuration__.ts +3 -0
  273. package/src/concepts/Constant__.ts +6 -6
  274. package/src/concepts/DataSource__.ts +391 -0
  275. package/src/concepts/Destination__.ts +22 -8
  276. package/src/concepts/End__.ts +2 -2
  277. package/src/concepts/EntityIndex__.ts +11 -2
  278. package/src/concepts/EntityProperty__.ts +23 -7
  279. package/src/concepts/Entity__.ts +38 -14
  280. package/src/concepts/Enum__.ts +15 -4
  281. package/src/concepts/ForEachStatement__.ts +2 -2
  282. package/src/concepts/Function__.ts +95 -1
  283. package/src/concepts/Identifier__.ts +5 -14
  284. package/src/concepts/IfStatement__.ts +9 -9
  285. package/src/concepts/InterfaceParam__.ts +9 -4
  286. package/src/concepts/Interface__.ts +20 -12
  287. package/src/concepts/JSBlock__.ts +3 -12
  288. package/src/concepts/Logic__.ts +45 -79
  289. package/src/concepts/Module__.ts +141 -342
  290. package/src/concepts/Namespace__.ts +1 -204
  291. package/src/concepts/Param__.ts +17 -9
  292. package/src/concepts/ProcessElement__.ts +42 -15
  293. package/src/concepts/Process__.ts +18 -12
  294. package/src/concepts/QueryAggregateExpression__.ts +1 -1
  295. package/src/concepts/QueryFieldExpression__.ts +13 -1
  296. package/src/concepts/QueryFromExpression__.ts +13 -2
  297. package/src/concepts/QueryGroupByExpression__.ts +23 -0
  298. package/src/concepts/QueryJoinExpression__.ts +14 -3
  299. package/src/concepts/Return__.ts +16 -11
  300. package/src/concepts/Role__.ts +10 -4
  301. package/src/concepts/SqlQueryComponent__.ts +47 -11
  302. package/src/concepts/StringLiteral__.ts +2 -9
  303. package/src/concepts/StructureProperty__.ts +11 -14
  304. package/src/concepts/Structure__.ts +19 -11
  305. package/src/concepts/SwitchCase__.ts +23 -27
  306. package/src/concepts/SwitchStatement__.ts +1 -5
  307. package/src/concepts/TypeAnnotation__.ts +52 -3
  308. package/src/concepts/Variable__.ts +16 -11
  309. package/src/concepts/ViewElement__.ts +26 -39
  310. package/src/concepts/View__.ts +45 -38
  311. package/src/concepts/WhileStatement__.ts +4 -4
  312. package/src/concepts/basics/stdlib/nasl.auth.ts +20 -0
  313. package/src/concepts/basics/stdlib/nasl.configuration.ts +1 -1
  314. package/src/concepts/basics/stdlib/nasl.interface.ts +1 -1
  315. package/src/concepts/basics/stdlib/nasl.process.ts +406 -0
  316. package/src/concepts/basics/stdlib/nasl.ui.ts +1 -11
  317. package/src/concepts/basics/stdlib/nasl.util.ts +271 -8
  318. package/src/concepts/basics/stdlib/reference2TypeAnnotationList.ts +1 -1
  319. package/src/concepts/basics/types/index.ts +2 -0
  320. package/src/concepts/index__.ts +1 -0
  321. package/src/enums/KEYWORDS.ts +0 -7
  322. package/src/generator/genBundleFiles.ts +28 -7
  323. package/src/generator/genMetaData.ts +22 -13
  324. package/src/index.ts +1 -1
  325. package/src/manager/diagnostic.ts +1 -1
  326. package/src/server/createUiTs.ts +1 -0
  327. package/src/server/extendBaseNode.ts +318 -0
  328. package/src/server/getLogics.ts +51 -5
  329. package/src/server/getMemberIdentifier.ts +53 -2
  330. package/src/server/getProcesses.ts +238 -21
  331. package/src/server/getScope.ts +5 -0
  332. package/src/server/index.ts +1 -0
  333. package/src/server/naslServer.ts +322 -380
  334. package/src/server/process2LogicNamespace.ts +29 -19
  335. package/src/server/translator.ts +42 -2
  336. package/src/service/creator/errHandles.js +6 -0
  337. package/src/service/storage/init.ts +115 -97
  338. package/src/templator/genCreateBlock.ts +35 -26
  339. package/src/templator/genCurdEditMultipleKeyBlock.ts +29 -21
  340. package/src/templator/genCurdMultipleKeyBlock.ts +46 -31
  341. package/src/templator/genEditTableBlock.ts +17 -14
  342. package/src/templator/genEnumSelectBlock.ts +1 -1
  343. package/src/templator/genGetBlock.ts +1 -1
  344. package/src/templator/genGridViewBlock.ts +30 -25
  345. package/src/templator/genListViewBlock.ts +10 -7
  346. package/src/templator/genQueryComponent.ts +34 -30
  347. package/src/templator/genSelectBlock.ts +14 -23
  348. package/src/templator/genTableBlock.ts +32 -23
  349. package/src/templator/genUpdateBlock.ts +36 -26
  350. package/src/templator/utils.ts +5 -2
  351. package/src/test/integration/connect-file.ts +6 -6
  352. package/src/translator/index.ts +1 -1
  353. package/src/utils/index.ts +51 -0
  354. package/out/concepts/basics/stdlib/nasl.browser copy.d.ts +0 -3
  355. package/out/concepts/basics/stdlib/nasl.browser copy.js +0 -70
  356. package/out/concepts/basics/stdlib/nasl.browser copy.js.map +0 -1
  357. package/out/terms/LEVEL_NAME_MAP.d.ts +0 -26
  358. package/out/terms/LEVEL_NAME_MAP.js +0 -30
  359. package/out/terms/LEVEL_NAME_MAP.js.map +0 -1
  360. package/out/test/integration/connect-file copy.js +0 -50
  361. package/out/test/integration/connect-file copy.js.map +0 -1
  362. package/out/test/integration/node-nasl-server.d.ts +0 -1
  363. package/out/test/integration/node-nasl-server.js +0 -41
  364. package/out/test/integration/node-nasl-server.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  import * as utils from '../utils';
2
- import { App, Namespace, Entity, EntityProperty } from '../concepts';
2
+ import { App, Module, Namespace, Entity, EntityProperty, DataSource } from '../concepts';
3
3
  import {
4
4
  getExpression, filterProperty, NameGroup,
5
5
  getFirstDisplayedProperty, getParamFromLogic, genCallComponentLogic,
@@ -15,7 +15,7 @@ import {
15
15
  * @param property 实体属性
16
16
  */
17
17
  export function genEditTableColumnTemplate(entity: Entity, property: EntityProperty, nameGroup: NameGroup, selectNameGroupMap?: Map<string, NameGroup>) {
18
- const parentNode = entity.parentNode as App | Namespace;
18
+ const dataSource = entity.parentNode as DataSource;
19
19
  const lowerEntityName = utils.firstLowerCase(entity.name);
20
20
  const valueExpression = `scope.item.${lowerEntityName}.${property.name}`;
21
21
  const title = property.label || property.name;
@@ -45,13 +45,15 @@ export function genEditTableColumnTemplate(entity: Entity, property: EntityPrope
45
45
  const propertyTypeName = property.typeAnnotation.typeName;
46
46
  if (property.relationEntity && selectNameGroupMap) {
47
47
  // 有外键关联
48
- const relationEntity = parentNode?.findEntityByName(property.relationEntity);
48
+ const relationEntity = dataSource?.findEntityByName(property.relationEntity);
49
49
  if (relationEntity) {
50
50
  const relationProperty = relationEntity.properties.find((prop) => prop.name === property.relationProperty);
51
51
  const displayedProperty = getFirstDisplayedProperty(relationEntity);
52
52
  if (displayedProperty) {
53
53
  const lowerEntityName = utils.firstLowerCase(relationEntity.name);
54
- const selectNameGroup = selectNameGroupMap.get(relationEntity.name);
54
+ // 存在多个属性关联同一个实体的情况,因此加上属性名用以唯一标识
55
+ const key = [property.name, relationEntity.name].join('-');
56
+ const selectNameGroup = selectNameGroupMap.get(key);
55
57
  formItem += `
56
58
  <u-select clearable placeholder="请选择${label}" :data-source="${selectNameGroup.viewLogicLoad}"
57
59
  :autofocus="true" :opened="true" append-to="body" @blur="${nameGroup.viewLogicBlurUpdate}" @select="${nameGroup.viewLogicBlurUpdate}"
@@ -135,8 +137,9 @@ export function genEditTableTemplate(entity: Entity, nameGroup: NameGroup, selec
135
137
  * @param entity 实体
136
138
  */
137
139
  export function genEditTableLoadLogic(entity: Entity, nameGroup: NameGroup, newLogic: any, supportFilter: boolean) {
138
- const parentNode = entity.parentNode as App | Namespace;
139
- const parentNamespace = parentNode?.getNamespace();
140
+ const moduleNode = utils.findClosestModule(entity) as App | Module;
141
+ const moduleNamespace = moduleNode?.getNamespace();
142
+
140
143
  const params = [
141
144
  genLogicParam(`${newLogic.params[0].name}`, 'params.page'),
142
145
  genLogicParam(`${newLogic.params[1].name}`, 'params.size'),
@@ -160,7 +163,7 @@ export function genEditTableLoadLogic(entity: Entity, nameGroup: NameGroup, newL
160
163
  name: 'result',
161
164
  typeAnnotation: NaslCollectionTypeAnnotation.PageOf([
162
165
  NaslTypeAnnotation.Reference({
163
- typeNamespace: `${parentNamespace}.structures`,
166
+ typeNamespace: `${moduleNamespace}.structures`,
164
167
  typeName: nameGroup.structure,
165
168
  }),
166
169
  ]),
@@ -174,7 +177,7 @@ export function genEditTableLoadLogic(entity: Entity, nameGroup: NameGroup, newL
174
177
  name: 'result',
175
178
  }),
176
179
  right: NaslLogicItem.CallLogic({
177
- calleeNamespace: `${parentNamespace}.logics`,
180
+ calleeNamespace: `${moduleNamespace}.logics`,
178
181
  calleeName: newLogic.name,
179
182
  arguments: params,
180
183
  }),
@@ -190,8 +193,8 @@ export function genEditTableLoadLogic(entity: Entity, nameGroup: NameGroup, newL
190
193
  */
191
194
  export function genEditTableRemoveLogic(entity: Entity, nameGroup: NameGroup) {
192
195
  const lowerEntityName = utils.firstLowerCase(entity.name);
193
- const parentNode = entity.parentNode as App | Namespace;
194
- const parentNamespace = parentNode?.getNamespace();
196
+ const moduleNode = utils.findClosestModule(entity) as App | Module;
197
+ const moduleNamespace = moduleNode?.getNamespace();
195
198
 
196
199
  const ns = entity.ns;
197
200
  const deleteLogic = ns?.logics?.find((logic) => logic.name === `delete`);
@@ -208,7 +211,7 @@ export function genEditTableRemoveLogic(entity: Entity, nameGroup: NameGroup) {
208
211
  name: 'scope',
209
212
  typeAnnotation: NaslUITypeAnnotation.ScopeOf([
210
213
  NaslTypeAnnotation.Reference({
211
- typeNamespace: `${parentNamespace}.structures`,
214
+ typeNamespace: `${moduleNamespace}.structures`,
212
215
  typeName: nameGroup.structure,
213
216
  }),
214
217
  ]),
@@ -239,8 +242,8 @@ export function genEditTableRemoveLogic(entity: Entity, nameGroup: NameGroup) {
239
242
 
240
243
  export function genBlurUpdateLogic(entity: Entity, nameGroup: NameGroup) {
241
244
  const lowerEntityName = utils.firstLowerCase(entity.name);
242
- const parentNode = entity.parentNode as App | Namespace;
243
- const parentNamespace = parentNode?.getNamespace();
245
+ const moduleNode = utils.findClosestModule(entity) as App | Module;
246
+ const moduleNamespace = moduleNode?.getNamespace();
244
247
  const ns = entity.ns;
245
248
  const updateLogic = ns?.logics?.find((logic) => logic.name === `update`);
246
249
  return NaslNode.Logic({
@@ -255,7 +258,7 @@ export function genBlurUpdateLogic(entity: Entity, nameGroup: NameGroup) {
255
258
  name: 'scope',
256
259
  typeAnnotation: NaslUITypeAnnotation.ScopeOf([
257
260
  NaslTypeAnnotation.Reference({
258
- typeNamespace: `${parentNamespace}.structures`,
261
+ typeNamespace: `${moduleNamespace}.structures`,
259
262
  typeName: nameGroup.structure,
260
263
  }),
261
264
  ]),
@@ -10,7 +10,7 @@ import { Enum } from '../concepts';
10
10
  */
11
11
  export function genEnumSelectBlock(enumeration: Enum, vModel?: string, size?: string, placeholder?: string, hiddenAll?: boolean) {
12
12
  if (config.scope === 'h5')
13
- return `<van-cascader ${vModel ? ` v-model="${vModel}"` : ''}${placeholder ? ` title="${placeholder}" placeholder="${placeholder}"` : ''}
13
+ return `<van-cascader input-align="left" ${vModel ? ` v-model="${vModel}"` : ''}${placeholder ? ` title="${placeholder}" placeholder="${placeholder}"` : ''}
14
14
  :data-source="$utils.EnumList('${enumeration.name}', '${enumeration.getNamespace()}')" labelField="${!hiddenAll ? (placeholder || '') : ''}" :notitleblock="${hiddenAll}"></van-cascader>`;
15
15
 
16
16
  return `<u-select clearable${vModel ? ` v-model="${vModel}"` : ''}${size ? ` size="${size}"` : ''}${placeholder ? ` placeholder="${placeholder}"` : ''}
@@ -24,7 +24,7 @@ export function genGetTemplate(entity: Entity, nameGroup: NameGroup) {
24
24
  }
25
25
 
26
26
  function genLoadLogic(getLogic: Logic, nameGroup: NameGroup) {
27
- const params = [genLogicParam(`${getLogic.params[0].name}`, 'id')];
27
+ const params = [genLogicParam(`${getLogic.params[0].name}`, nameGroup.viewParamId)];
28
28
 
29
29
  return NaslNode.Logic({
30
30
  name: nameGroup.viewLogicLoad,
@@ -1,6 +1,6 @@
1
1
  import { config } from '../config';
2
2
  import * as utils from '../utils';
3
- import { App, Namespace, Entity, EntityProperty, View } from '../concepts';
3
+ import { App, Module, Namespace, Entity, EntityProperty, View, DataSource } from '../concepts';
4
4
  import {
5
5
  getExpression,
6
6
  filterProperty,
@@ -21,14 +21,14 @@ import { NaslCoreTypeAnnotation, NaslUITypeAnnotation, NaslCollectionTypeAnnotat
21
21
  */
22
22
  export function genGridViewCardTemplate(property: EntityProperty) {
23
23
  const entity = property.entity;
24
- const parentNode = entity.parentNode as App | Namespace;
24
+ const dataSource = entity.parentNode as DataSource;
25
25
  const lowerEntityName = utils.firstLowerCase(entity.name);
26
26
  let expression = `scope.item.${lowerEntityName}.${property.name}`;
27
27
  const title = property.label || property.name;
28
28
 
29
29
  if (property.relationEntity) {
30
30
  // 有外键关联
31
- const relationEntity = parentNode?.findEntityByName(property.relationEntity);
31
+ const relationEntity = dataSource?.findEntityByName(property.relationEntity);
32
32
  if (relationEntity) {
33
33
  const displayedProperty = getFirstDisplayedProperty(relationEntity);
34
34
  if (displayedProperty) {
@@ -60,14 +60,13 @@ export function genGridViewCardTemplate(property: EntityProperty) {
60
60
 
61
61
  export function genH5GridViewCardTemplate(property: EntityProperty) {
62
62
  const entity = property.entity;
63
- const parentNode = entity.parentNode as App | Namespace;
63
+ const dataSource = entity.parentNode as DataSource;
64
64
  const lowerEntityName = utils.firstLowerCase(entity.name);
65
65
  let expression = `scope.item.${lowerEntityName}.${property.name}`;
66
- const title = property.label || property.name;
67
66
 
68
67
  if (property.relationEntity) {
69
68
  // 有外键关联
70
- const relationEntity = parentNode?.findEntityByName(property.relationEntity);
69
+ const relationEntity = dataSource?.findEntityByName(property.relationEntity);
71
70
  if (relationEntity) {
72
71
  const displayedProperty = getFirstDisplayedProperty(relationEntity);
73
72
  if (displayedProperty) {
@@ -149,8 +148,8 @@ export function genH5GridViewTemplate(entity: Entity, nameGroup: NameGroup) {
149
148
  * @param entity 实体
150
149
  */
151
150
  export function genGridViewLoadLogic(entity: Entity, nameGroup: NameGroup, newLogic: any, supportFilter: boolean) {
152
- const parentNode = entity.parentNode as App | Namespace;
153
- const parentNamespace = parentNode?.getNamespace();
151
+ const moduleNode = utils.findClosestModule(entity) as App | Module;
152
+ const moduleNamespace = moduleNode?.getNamespace();
154
153
  const params = [
155
154
  genLogicParam(`${newLogic.params[0].name}`, 'params.page'),
156
155
  genLogicParam(`${newLogic.params[1].name}`, 'params.size'),
@@ -174,7 +173,7 @@ export function genGridViewLoadLogic(entity: Entity, nameGroup: NameGroup, newLo
174
173
  name: 'result',
175
174
  typeAnnotation: NaslCollectionTypeAnnotation.PageOf([
176
175
  NaslTypeAnnotation.Reference({
177
- typeNamespace: `${parentNamespace}.structures`,
176
+ typeNamespace: `${moduleNamespace}.structures`,
178
177
  typeName: nameGroup.structure,
179
178
  }),
180
179
  ]),
@@ -188,7 +187,7 @@ export function genGridViewLoadLogic(entity: Entity, nameGroup: NameGroup, newLo
188
187
  name: 'result',
189
188
  }),
190
189
  right: NaslLogicItem.CallLogic({
191
- calleeNamespace: `${parentNamespace}.logics`,
190
+ calleeNamespace: `${moduleNamespace}.logics`,
192
191
  calleeName: newLogic.name,
193
192
  arguments: params,
194
193
  }),
@@ -204,8 +203,8 @@ export function genGridViewLoadLogic(entity: Entity, nameGroup: NameGroup, newLo
204
203
  */
205
204
  export function genGridViewRemoveLogic(entity: Entity, nameGroup: NameGroup) {
206
205
  const lowerEntityName = utils.firstLowerCase(entity.name);
207
- const parentNode = entity.parentNode as App | Namespace;
208
- const parentNamespace = parentNode?.getNamespace();
206
+ const moduleNode = utils.findClosestModule(entity) as App | Module;
207
+ const moduleNamespace = moduleNode?.getNamespace();
209
208
  const ns = entity.ns;
210
209
  const deleteLogic = ns?.logics?.find((logic) => logic.name === `delete`);
211
210
  const idPropertys = entity.properties.filter((property) => property.primaryKey || property.name === 'id');
@@ -221,7 +220,7 @@ export function genGridViewRemoveLogic(entity: Entity, nameGroup: NameGroup) {
221
220
  name: 'scope',
222
221
  typeAnnotation: NaslUITypeAnnotation.ScopeOf([
223
222
  NaslTypeAnnotation.Reference({
224
- typeNamespace: `${parentNamespace}.structures`,
223
+ typeNamespace: `${moduleNamespace}.structures`,
225
224
  typeName: nameGroup.structure,
226
225
  }),
227
226
  ]),
@@ -260,32 +259,35 @@ export function genGridViewRemoveLogic(entity: Entity, nameGroup: NameGroup) {
260
259
  */
261
260
  // 数据网格(简)
262
261
  export function genGridViewBlock(entity: Entity, view: View) {
263
- const parentNode = entity.parentNode as App | Namespace;
262
+ const dataSource = entity.parentNode as DataSource;
263
+ const module = dataSource.parentNode as App | Module | Namespace;
264
264
 
265
265
  const viewElementMainView = view.getViewElementUniqueName('gridView');
266
- const nameGroup = genUniqueQueryNameGroup(parentNode, view, viewElementMainView);
266
+ const nameGroup = genUniqueQueryNameGroup(module, view, viewElementMainView);
267
267
  nameGroup.viewElementMainView = viewElementMainView;
268
268
  nameGroup.viewVariableEntity = view.getVariableUniqueName(utils.firstLowerCase(entity.name));
269
269
  nameGroup.viewLogicRemove = view.getLogicUniqueName('remove');
270
270
 
271
271
  // 收集所有和本实体关联的实体
272
- const allEntities = [entity];
272
+ const entitySet: Set<Entity> = new Set();
273
+ entitySet.add(entity);
273
274
  const newStructures: any[] = [];
274
275
  const newLogics: any[] = [];
275
276
  entity.properties.forEach((property) => {
276
277
  if (property.relationEntity) {
277
278
  // 有外键关联
278
- const relationEntity = parentNode?.findEntityByName(property.relationEntity);
279
+ const relationEntity = dataSource?.findEntityByName(property.relationEntity);
279
280
  if (relationEntity) {
280
281
  const displayedProperty = getFirstDisplayedProperty(relationEntity);
281
282
  if (displayedProperty)
282
- allEntities.push(relationEntity);
283
+ entitySet.add(relationEntity);
283
284
  }
284
285
  }
285
286
  });
287
+ const allEntities = [...entitySet];
286
288
  const entityStructure = genQueryStructure(allEntities, nameGroup);
287
289
  newStructures.push(entityStructure);
288
- const entityLogic = genQueryLogic(allEntities, nameGroup, false, true, parentNode);
290
+ const entityLogic = genQueryLogic(allEntities, nameGroup, false, true, module);
289
291
  newLogics.push(entityLogic);
290
292
 
291
293
  return `
@@ -308,32 +310,35 @@ export function genGridViewBlock(entity: Entity, view: View) {
308
310
 
309
311
  export function genGridViewCardBlock(property: EntityProperty, view: View) {
310
312
  const entity = property.entity;
311
- const parentNode = entity.parentNode as App | Namespace;
313
+ const dataSource = entity.parentNode as DataSource;
314
+ const module = dataSource.parentNode as App | Module | Namespace;
312
315
 
313
316
  const viewElementMainView = view.getViewElementUniqueName('gridView');
314
- const nameGroup = genUniqueQueryNameGroup(parentNode, view, viewElementMainView);
317
+ const nameGroup = genUniqueQueryNameGroup(module, view, viewElementMainView);
315
318
  nameGroup.viewElementMainView = viewElementMainView;
316
319
  nameGroup.viewVariableEntity = view.getVariableUniqueName(utils.firstLowerCase(entity.name));
317
320
  nameGroup.viewLogicRemove = view.getLogicUniqueName('remove');
318
321
 
319
322
  // 收集所有和本实体关联的实体
320
- const allEntities = [entity];
323
+ const entitySet: Set<Entity> = new Set();
324
+ entitySet.add(entity);
321
325
  const newStructures: any[] = [];
322
326
  const newLogics: any[] = [];
323
327
  entity.properties.forEach((property) => {
324
328
  if (property.relationEntity) {
325
329
  // 有外键关联
326
- const relationEntity = parentNode?.findEntityByName(property.relationEntity);
330
+ const relationEntity = dataSource?.findEntityByName(property.relationEntity);
327
331
  if (relationEntity) {
328
332
  const displayedProperty = getFirstDisplayedProperty(relationEntity);
329
333
  if (displayedProperty)
330
- allEntities.push(relationEntity);
334
+ entitySet.add(relationEntity);
331
335
  }
332
336
  }
333
337
  });
338
+ const allEntities = [...entitySet];
334
339
  const entityStructure = genQueryStructure(allEntities, nameGroup);
335
340
  newStructures.push(entityStructure);
336
- const entityLogic = genQueryLogic(allEntities, nameGroup, true, true, parentNode);
341
+ const entityLogic = genQueryLogic(allEntities, nameGroup, true, true, module);
337
342
  newLogics.push(entityLogic);
338
343
 
339
344
  return `
@@ -1,6 +1,6 @@
1
1
  import { config } from '../config';
2
2
  import * as utils from '../utils';
3
- import { App, Namespace, Entity, EntityProperty, View } from '../concepts';
3
+ import { App, Module, Namespace, Entity, EntityProperty, View, DataSource } from '../concepts';
4
4
  import { getExpression, genUniqueQueryNameGroup, getFirstDisplayedProperty, genQueryLogic, genQueryStructure, genLogicParam } from '.';
5
5
  import {
6
6
  NameGroup, NaslUITypeAnnotation, NaslCollectionTypeAnnotation,
@@ -39,8 +39,10 @@ export function genH5ListViewTemplate(property: EntityProperty, nameGroup: NameG
39
39
  }
40
40
 
41
41
  export function genLoadListViewLogic(entity: Entity, nameGroup: NameGroup, newStructures: Array<any>, newLogics: Array<any>) {
42
- const parentNode = entity.parentNode as App | Namespace;
43
- const parentNamespace = parentNode?.getNamespace();
42
+ const parentNode = entity.parentNode as App | Module | Namespace;
43
+
44
+ const moduleNode = utils.findClosestModule(entity) as App | Module;
45
+ const moduleNamespace = moduleNode?.getNamespace();
44
46
 
45
47
  // Select 和 table 不一样,直接在内部产生了
46
48
  const entityStructure = genQueryStructure([entity], nameGroup);
@@ -61,7 +63,7 @@ export function genLoadListViewLogic(entity: Entity, nameGroup: NameGroup, newSt
61
63
  name: 'result',
62
64
  typeAnnotation: NaslCollectionTypeAnnotation.PageOf([
63
65
  NaslTypeAnnotation.Reference({
64
- typeNamespace: `${parentNamespace}.structures`,
66
+ typeNamespace: `${moduleNamespace}.structures`,
65
67
  typeName: nameGroup.structure,
66
68
  }),
67
69
  ]),
@@ -75,7 +77,7 @@ export function genLoadListViewLogic(entity: Entity, nameGroup: NameGroup, newSt
75
77
  name: 'result',
76
78
  }),
77
79
  right: NaslLogicItem.CallLogic({
78
- calleeNamespace: `${parentNamespace}.logics`,
80
+ calleeNamespace: `${moduleNamespace}.logics`,
79
81
  calleeName: entityLogic.name,
80
82
  arguments: [
81
83
  genLogicParam(`${entityLogic.params[0].name}`, 'params.page'),
@@ -92,10 +94,11 @@ export function genLoadListViewLogic(entity: Entity, nameGroup: NameGroup, newSt
92
94
  * 生成实体选择框区块
93
95
  */
94
96
  export function genListViewBlock(entity: Entity, view: View, property: EntityProperty) {
95
- const parentNode = entity.parentNode as App | Namespace;
97
+ const dataSource = entity.parentNode as DataSource;
98
+ const module = dataSource.parentNode as App | Module | Namespace;
96
99
 
97
100
  const viewElementMainView = view.getViewElementUniqueName('listView');
98
- const nameGroup = genUniqueQueryNameGroup(parentNode, view, viewElementMainView, false);
101
+ const nameGroup = genUniqueQueryNameGroup(module, view, viewElementMainView, false);
99
102
  nameGroup.viewElementMainView = viewElementMainView;
100
103
  nameGroup.viewVariableEntity = view.getVariableUniqueName(utils.firstLowerCase(entity.name));
101
104
 
@@ -1,5 +1,5 @@
1
1
  import * as utils from '../utils';
2
- import { App, Namespace, Entity, Structure, QueryJoinExpression, CallQueryComponent, StructureProperty } from '../concepts';
2
+ import { App, Module, Namespace, Entity, Structure, QueryJoinExpression, CallQueryComponent, StructureProperty, DataSource } from '../concepts';
3
3
  import { NameGroup, NaslCoreTypeAnnotation, NaslCollectionTypeAnnotation, NaslTypeAnnotation, NaslQueryExpression, NaslLogicItem, NaslNode } from './utils';
4
4
 
5
5
  export function genQueryStructure(allEntities: Array<Entity>, nameGroup: NameGroup) {
@@ -66,35 +66,33 @@ function genWhereExpression(entity: Entity) {
66
66
  export function genQueryAssignment(allEntities: Array<Entity>, nameGroup: NameGroup, supportFilter: boolean, supportSort: boolean) {
67
67
  allEntities = Array.from(allEntities);
68
68
  const entity = allEntities.shift();
69
- const parentNode = entity.parentNode as App | Namespace;
70
- const parentNamespace = parentNode.getNamespace();
69
+ const moduleNode = utils.findClosestModule(entity) as App | Module;
70
+ const moduleNamespace = moduleNode?.getNamespace();
71
71
 
72
72
  const from = NaslQueryExpression.QueryFromExpression({
73
73
  entityNamespace: entity.getNamespace(),
74
74
  entityName: entity.name,
75
75
  joinParts: allEntities.map((relationEntity) => {
76
- const leftProperty = entity.properties.find((property) => property.relationEntity === relationEntity.name);
76
+ const onExpressions = entity.properties?.filter((property) => property.relationEntity === relationEntity.name).map((leftProperty) => NaslLogicItem.BinaryExpression({
77
+ operator: '==',
78
+ left: NaslQueryExpression.QueryFieldExpression({
79
+ label: '查询组件实体属性',
80
+ isDotStar: false,
81
+ entityAsName: entity.name,
82
+ propertyName: leftProperty.name,
83
+ }),
84
+ right: NaslQueryExpression.QueryFieldExpression({
85
+ label: '查询组件实体属性',
86
+ isDotStar: false,
87
+ entityAsName: relationEntity.name,
88
+ propertyName: leftProperty.relationProperty,
89
+ }),
90
+ }));
77
91
  return NaslQueryExpression.QueryJoinExpression({
78
92
  entityNamespace: relationEntity.getNamespace(),
79
93
  entityName: relationEntity.name,
80
94
  joinType: 'LEFT',
81
- onExpressions: [
82
- NaslLogicItem.BinaryExpression({
83
- operator: '==',
84
- left: NaslQueryExpression.QueryFieldExpression({
85
- label: '查询组件实体属性',
86
- isDotStar: false,
87
- entityAsName: entity.name,
88
- propertyName: leftProperty.name,
89
- }),
90
- right: NaslQueryExpression.QueryFieldExpression({
91
- label: '查询组件实体属性',
92
- isDotStar: false,
93
- entityAsName: relationEntity.name,
94
- propertyName: leftProperty.relationProperty,
95
- }),
96
- }),
97
- ],
95
+ onExpressions,
98
96
  joinParts: [],
99
97
  });
100
98
  }),
@@ -106,10 +104,13 @@ export function genQueryAssignment(allEntities: Array<Entity>, nameGroup: NameGr
106
104
  }),
107
105
  right: NaslQueryExpression.CallQueryComponent({
108
106
  label: '数据查询',
109
- typeAnnotation: NaslTypeAnnotation.Reference({
110
- typeNamespace: `${parentNamespace}.structures`,
111
- typeName: nameGroup.structure,
112
- }),
107
+ ideVersion: '2.11', // 2.11版本新创建的数据查询组件,返回类型将自动推断
108
+ typeAnnotation: NaslCollectionTypeAnnotation.PageOf([
109
+ NaslTypeAnnotation.Reference({
110
+ typeNamespace: `${moduleNamespace}.structures`,
111
+ typeName: nameGroup.structure,
112
+ }),
113
+ ]),
113
114
  select: NaslQueryExpression.QuerySelectExpression({
114
115
  label: '查询组件Select子句',
115
116
  distinct: false,
@@ -147,7 +148,10 @@ export function genQueryAssignment(allEntities: Array<Entity>, nameGroup: NameGr
147
148
  }
148
149
 
149
150
  export function genQueryLogic(allEntities: Array<Entity>, nameGroup: NameGroup, supportFilter: boolean, supportSort: boolean, parentNode: any) {
150
- const parentNamespace = parentNode?.getNamespace();
151
+ const entity = allEntities?.[0];
152
+ const moduleNode = utils.findClosestModule(entity) as App | Module;
153
+ const moduleNamespace = moduleNode?.getNamespace();
154
+
151
155
  const logic = NaslNode.Logic({
152
156
  name: nameGroup.logic,
153
157
  description: '',
@@ -166,7 +170,7 @@ export function genQueryLogic(allEntities: Array<Entity>, nameGroup: NameGroup,
166
170
  name: 'result',
167
171
  typeAnnotation: NaslCollectionTypeAnnotation.PageOf([
168
172
  NaslTypeAnnotation.Reference({
169
- typeNamespace: `${parentNamespace}.structures`,
173
+ typeNamespace: `${moduleNamespace}.structures`,
170
174
  typeName: nameGroup.structure,
171
175
  }),
172
176
  ]),
@@ -185,7 +189,7 @@ export function genQueryLogic(allEntities: Array<Entity>, nameGroup: NameGroup,
185
189
  typeAnnotation: NaslCoreTypeAnnotation.String,
186
190
  }));
187
191
  }
188
- const entity = allEntities?.[0];
192
+
189
193
  if (supportFilter && entity) {
190
194
  logic.params.push(NaslNode.Param({
191
195
  name: 'filter',
@@ -199,11 +203,11 @@ export function genQueryLogic(allEntities: Array<Entity>, nameGroup: NameGroup,
199
203
  }
200
204
 
201
205
  export async function joinEntity(callQueryComponent: CallQueryComponent, entity: Entity, recordStructure: Structure) {
202
- const parentNode = entity.parentNode as App | Namespace;
206
+ const dataSource = entity.parentNode as DataSource;
203
207
  const from = callQueryComponent.from;
204
208
  let joinInfo;
205
209
  // 无法判断用户行为,优先加有关系的
206
- const lastEntity = parentNode.findEntityByName(from.entityName);
210
+ const lastEntity = dataSource.findEntityByName(from.entityName);
207
211
  // lastEntity 和 entity Join
208
212
  // 判断要不要自动关联 onExpression
209
213
  // 一般左联是自动有的了
@@ -1,6 +1,6 @@
1
1
  import { config } from '../config';
2
2
  import * as utils from '../utils';
3
- import { App, Namespace, Entity, EntityProperty, View } from '../concepts';
3
+ import { App, Module, Namespace, Entity, EntityProperty, View, DataSource } from '../concepts';
4
4
  import { NameGroup, genUniqueQueryNameGroup, getFirstDisplayedProperty, genQueryLogic, genQueryStructure, genLogicParam } from '.';
5
5
  import {
6
6
  NaslUITypeAnnotation, NaslCollectionTypeAnnotation, NaslLogicItem,
@@ -15,8 +15,8 @@ import {
15
15
  */
16
16
  export function genSelectTemplate(property: EntityProperty, nameGroup: NameGroup) {
17
17
  return `<u-select clearable placeholder="请选择" ref="${nameGroup.viewElementMainView}" :data-source="${nameGroup.viewLogicLoad}" data-schema="${nameGroup.structure}"
18
- text-field="${nameGroup.viewVariableEntity}.${property.name}"
19
- value-field="${nameGroup.viewVariableEntity}.id" :pageable="true" :remote-paging="true">
18
+ text-field="${nameGroup.lowerEntity}.${property.name}"
19
+ value-field="${nameGroup.lowerEntity}.id" :pageable="true" :remote-paging="true">
20
20
  </u-select>`;
21
21
  }
22
22
 
@@ -29,14 +29,14 @@ export function genSelectTemplate(property: EntityProperty, nameGroup: NameGroup
29
29
  export function genH5SelectTemplate(property: EntityProperty, nameGroup: NameGroup) {
30
30
  const label = property.label || property.name;
31
31
  return `<van-cascader title="请选择" placeholder="请选择" ref="${nameGroup.viewElementMainView}" :data-source="${nameGroup.viewLogicLoad}" data-schema="${nameGroup.structure}"
32
- text-field="${nameGroup.viewVariableEntity}.${property.name}"
33
- value-field="${nameGroup.viewVariableEntity}.id" :pageable="true" :remote-paging="true" v-model="${nameGroup.viewVariableEntity}.${property.name}" labelField="${label}">
32
+ text-field="${nameGroup.lowerEntity}.${property.name}"
33
+ value-field="${nameGroup.lowerEntity}.id" :pageable="true" :remote-paging="true" labelField="${label}">
34
34
  </van-cascader>`;
35
35
  }
36
36
 
37
37
  export function genLoadSelectLogic(entity: Entity, nameGroup: NameGroup, newLogic: any) {
38
- const parentNode = entity.parentNode as App | Namespace;
39
- const parentNamespace = parentNode?.getNamespace();
38
+ const moduleNode = utils.findClosestModule(entity) as App | Module;
39
+ const moduleNamespace = moduleNode?.getNamespace();
40
40
  const params = [
41
41
  genLogicParam(`${newLogic.params[0].name}`, 'params.page'),
42
42
  genLogicParam(`${newLogic.params[1].name}`, 'params.size'),
@@ -54,7 +54,7 @@ export function genLoadSelectLogic(entity: Entity, nameGroup: NameGroup, newLogi
54
54
  name: 'result',
55
55
  typeAnnotation: NaslCollectionTypeAnnotation.PageOf([
56
56
  NaslTypeAnnotation.Reference({
57
- typeNamespace: `${parentNamespace}.structures`,
57
+ typeNamespace: `${moduleNamespace}.structures`,
58
58
  typeName: nameGroup.structure,
59
59
  }),
60
60
  ]),
@@ -68,7 +68,7 @@ export function genLoadSelectLogic(entity: Entity, nameGroup: NameGroup, newLogi
68
68
  name: 'result',
69
69
  }),
70
70
  right: NaslLogicItem.CallLogic({
71
- calleeNamespace: `${parentNamespace}.logics`,
71
+ calleeNamespace: `${moduleNamespace}.logics`,
72
72
  calleeName: newLogic.name,
73
73
  arguments: params,
74
74
  }),
@@ -85,12 +85,13 @@ export function genLoadSelectLogic(entity: Entity, nameGroup: NameGroup, newLogi
85
85
  * @returns
86
86
  */
87
87
  export function genSelectBlock(entity: Entity, view: View) {
88
- const parentNode = entity.parentNode as App | Namespace;
88
+ const dataSource = entity.parentNode as DataSource;
89
+ const module = dataSource.parentNode as App | Module | Namespace;
89
90
 
90
91
  const viewElementMainView = view.getViewElementUniqueName('select');
91
- const nameGroup = genUniqueQueryNameGroup(parentNode, view, viewElementMainView, false);
92
+ const nameGroup = genUniqueQueryNameGroup(module, view, viewElementMainView, false);
92
93
  nameGroup.viewElementMainView = viewElementMainView;
93
- nameGroup.viewVariableEntity = view.getVariableUniqueName(utils.firstLowerCase(entity.name));
94
+ nameGroup.lowerEntity = utils.firstLowerCase(entity.name);
94
95
 
95
96
  const displayedProperty = getFirstDisplayedProperty(entity);
96
97
 
@@ -101,7 +102,7 @@ export function genSelectBlock(entity: Entity, view: View) {
101
102
  const newStructures: Array<any> = [
102
103
  genQueryStructure(allEntities, nameGroup),
103
104
  ];
104
- const newLogic = genQueryLogic(allEntities, nameGroup, false, false, parentNode);
105
+ const newLogic = genQueryLogic(allEntities, nameGroup, false, false, module);
105
106
  const newLogics: Array<any> = [
106
107
  newLogic,
107
108
  ];
@@ -115,16 +116,6 @@ export function genSelectBlock(entity: Entity, view: View) {
115
116
  "viewLogics": [
116
117
  ${JSON.stringify(genLoadSelectLogic(entity, nameGroup, newLogic))}
117
118
  ],
118
- "viewVariables": [
119
- {
120
- "concept": "Variable",
121
- "name": "${nameGroup.viewVariableEntity}",
122
- "typeAnnotation": ${JSON.stringify(NaslTypeAnnotation.Reference({
123
- typeNamespace: entity.getNamespace(),
124
- typeName: entity.name,
125
- }))}
126
- }
127
- ],
128
119
  "logics": ${JSON.stringify(newLogics)},
129
120
  "structures": ${JSON.stringify(newStructures)}
130
121
  }