@lcap/nasl 3.6.0-alpha.1 → 3.6.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (245) hide show
  1. package/out/bak/translator.js +119 -39
  2. package/out/bak/translator.js.map +1 -1
  3. package/out/breakpoint/generator/BreakpointNode.d.ts +3 -0
  4. package/out/breakpoint/generator/BreakpointNode.js +9 -0
  5. package/out/breakpoint/generator/BreakpointNode.js.map +1 -1
  6. package/out/breakpoint/shared/constants.js +1 -0
  7. package/out/breakpoint/shared/constants.js.map +1 -1
  8. package/out/breakpoint/shared/utils.js +12 -6
  9. package/out/breakpoint/shared/utils.js.map +1 -1
  10. package/out/breakpoint/store/core.js +1 -1
  11. package/out/breakpoint/store/core.js.map +1 -1
  12. package/out/common/BaseNode.d.ts +1 -4
  13. package/out/common/BaseNode.js +23 -37
  14. package/out/common/BaseNode.js.map +1 -1
  15. package/out/concepts/AnonymousFunction__.d.ts +6 -1
  16. package/out/concepts/AnonymousFunction__.js +34 -16
  17. package/out/concepts/AnonymousFunction__.js.map +1 -1
  18. package/out/concepts/App__.d.ts +55 -51
  19. package/out/concepts/App__.js +76 -80
  20. package/out/concepts/App__.js.map +1 -1
  21. package/out/concepts/BackendVariable__.js +10 -2
  22. package/out/concepts/BackendVariable__.js.map +1 -1
  23. package/out/concepts/BindAttribute__.js +16 -6
  24. package/out/concepts/BindAttribute__.js.map +1 -1
  25. package/out/concepts/BindDirective__.d.ts +1 -0
  26. package/out/concepts/BindDirective__.js +19 -4
  27. package/out/concepts/BindDirective__.js.map +1 -1
  28. package/out/concepts/BindEvent__.d.ts +3 -1
  29. package/out/concepts/BindEvent__.js +39 -14
  30. package/out/concepts/BindEvent__.js.map +1 -1
  31. package/out/concepts/BusinessComponent__.d.ts +641 -0
  32. package/out/concepts/BusinessComponent__.js +1921 -0
  33. package/out/concepts/BusinessComponent__.js.map +1 -0
  34. package/out/concepts/BusinessLogic__.d.ts +38 -0
  35. package/out/concepts/BusinessLogic__.js +358 -0
  36. package/out/concepts/BusinessLogic__.js.map +1 -0
  37. package/out/concepts/CallEvent__.d.ts +101 -0
  38. package/out/concepts/CallEvent__.js +280 -0
  39. package/out/concepts/CallEvent__.js.map +1 -0
  40. package/out/concepts/CallFunction__.d.ts +0 -1
  41. package/out/concepts/CallFunction__.js +10 -10
  42. package/out/concepts/CallFunction__.js.map +1 -1
  43. package/out/concepts/CallLogic__.d.ts +2 -0
  44. package/out/concepts/CallLogic__.js +38 -27
  45. package/out/concepts/CallLogic__.js.map +1 -1
  46. package/out/concepts/Constant__.js +7 -6
  47. package/out/concepts/Constant__.js.map +1 -1
  48. package/out/concepts/Destination__.d.ts +1 -1
  49. package/out/concepts/Destination__.js +7 -5
  50. package/out/concepts/Destination__.js.map +1 -1
  51. package/out/concepts/End__.js +2 -1
  52. package/out/concepts/End__.js.map +1 -1
  53. package/out/concepts/Event__.d.ts +14 -0
  54. package/out/concepts/Event__.js +61 -0
  55. package/out/concepts/Event__.js.map +1 -1
  56. package/out/concepts/FrontendType__.d.ts +308 -0
  57. package/out/concepts/FrontendType__.js +605 -0
  58. package/out/concepts/FrontendType__.js.map +1 -0
  59. package/out/concepts/Frontend__.d.ts +0 -88
  60. package/out/concepts/Frontend__.js +1 -143
  61. package/out/concepts/Frontend__.js.map +1 -1
  62. package/out/concepts/Identifier__.d.ts +5 -0
  63. package/out/concepts/Identifier__.js +19 -9
  64. package/out/concepts/Identifier__.js.map +1 -1
  65. package/out/concepts/LogicItem__.d.ts +1 -1
  66. package/out/concepts/LogicItem__.js.map +1 -1
  67. package/out/concepts/Logic__.d.ts +3 -1
  68. package/out/concepts/Logic__.js +31 -21
  69. package/out/concepts/Logic__.js.map +1 -1
  70. package/out/concepts/Match__.d.ts +1 -1
  71. package/out/concepts/MemberExpression__.d.ts +1 -1
  72. package/out/concepts/MemberExpression__.js +3 -3
  73. package/out/concepts/MemberExpression__.js.map +1 -1
  74. package/out/concepts/NewComposite__.js.map +1 -1
  75. package/out/concepts/ParamWithGroup__.d.ts +39 -0
  76. package/out/concepts/ParamWithGroup__.js +85 -0
  77. package/out/concepts/ParamWithGroup__.js.map +1 -0
  78. package/out/concepts/Param__.js +11 -3
  79. package/out/concepts/Param__.js.map +1 -1
  80. package/out/concepts/ProcessElement__.js +9 -1
  81. package/out/concepts/ProcessElement__.js.map +1 -1
  82. package/out/concepts/Return__.js +17 -9
  83. package/out/concepts/Return__.js.map +1 -1
  84. package/out/concepts/ValidationRule__.js +2 -1
  85. package/out/concepts/ValidationRule__.js.map +1 -1
  86. package/out/concepts/Variable__.js +17 -8
  87. package/out/concepts/Variable__.js.map +1 -1
  88. package/out/concepts/ViewElement__.d.ts +17 -1
  89. package/out/concepts/ViewElement__.js +145 -16
  90. package/out/concepts/ViewElement__.js.map +1 -1
  91. package/out/concepts/View__.js +21 -20
  92. package/out/concepts/View__.js.map +1 -1
  93. package/out/concepts/index__.d.ts +5 -0
  94. package/out/concepts/index__.js +5 -0
  95. package/out/concepts/index__.js.map +1 -1
  96. package/out/concepts/utils/asserts.d.ts +258 -3
  97. package/out/concepts/utils/asserts.js +351 -13
  98. package/out/concepts/utils/asserts.js.map +1 -1
  99. package/out/concepts/utils/types.d.ts +20 -3
  100. package/out/generator/genBundleFiles.js +25 -11
  101. package/out/generator/genBundleFiles.js.map +1 -1
  102. package/out/generator/genReleaseBody.js +12 -3
  103. package/out/generator/genReleaseBody.js.map +1 -1
  104. package/out/generator/permission.js +3 -3
  105. package/out/generator/permission.js.map +1 -1
  106. package/out/natural/transformTSCode.js +1 -1
  107. package/out/natural/transformTSCode.js.map +1 -1
  108. package/out/server/extendBaseNode.js +6 -4
  109. package/out/server/extendBaseNode.js.map +1 -1
  110. package/out/server/getLogics.js +62 -27
  111. package/out/server/getLogics.js.map +1 -1
  112. package/out/server/getMemberIdentifier.js +6 -1
  113. package/out/server/getMemberIdentifier.js.map +1 -1
  114. package/out/server/getProcesses.js +3 -3
  115. package/out/server/getProcesses.js.map +1 -1
  116. package/out/server/naslServer.js +40 -19
  117. package/out/server/naslServer.js.map +1 -1
  118. package/out/server/translator.js +6 -1
  119. package/out/server/translator.js.map +1 -1
  120. package/out/service/storage/init.js +1 -2
  121. package/out/service/storage/init.js.map +1 -1
  122. package/out/templator/genCreateBlock.js +6 -6
  123. package/out/templator/genCreateBlock.js.map +1 -1
  124. package/out/templator/genCurdEditMultipleKeyBlock.js +16 -16
  125. package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
  126. package/out/templator/genCurdMultipleKeyBlock.js +36 -36
  127. package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
  128. package/out/templator/genGetBlock.js +6 -5
  129. package/out/templator/genGetBlock.js.map +1 -1
  130. package/out/templator/genGridViewBlock.js +12 -12
  131. package/out/templator/genGridViewBlock.js.map +1 -1
  132. package/out/templator/genListViewBlock.js +4 -4
  133. package/out/templator/genListViewBlock.js.map +1 -1
  134. package/out/templator/genSelectBlock.js +3 -3
  135. package/out/templator/genSelectBlock.js.map +1 -1
  136. package/out/templator/genTableBlock.js +10 -10
  137. package/out/templator/genTableBlock.js.map +1 -1
  138. package/out/templator/genUpdateBlock.js +10 -9
  139. package/out/templator/genUpdateBlock.js.map +1 -1
  140. package/out/templator/utils.d.ts +2 -2
  141. package/out/templator/utils.js.map +1 -1
  142. package/out/translator/utils.js +12 -1
  143. package/out/translator/utils.js.map +1 -1
  144. package/out/utils/i18nInfo.js +7 -2
  145. package/out/utils/i18nInfo.js.map +1 -1
  146. package/out/utils/index.d.ts +17 -0
  147. package/out/utils/index.js +184 -1
  148. package/out/utils/index.js.map +1 -1
  149. package/package.json +2 -2
  150. package/src/bak/translator.js +121 -43
  151. package/src/breakpoint/generator/BreakpointNode.ts +12 -0
  152. package/src/breakpoint/shared/constants.ts +1 -0
  153. package/src/breakpoint/shared/utils.ts +13 -8
  154. package/src/breakpoint/store/core.ts +1 -1
  155. package/src/common/BaseNode.ts +22 -41
  156. package/src/concepts/AnonymousFunction__.ts +36 -18
  157. package/src/concepts/App__.ts +129 -130
  158. package/src/concepts/BackendVariable__.ts +10 -2
  159. package/src/concepts/BindAttribute__.ts +14 -6
  160. package/src/concepts/BindDirective__.ts +19 -4
  161. package/src/concepts/BindEvent__.ts +41 -13
  162. package/src/concepts/BusinessComponent__.ts +2693 -0
  163. package/src/concepts/BusinessLogic__.ts +376 -0
  164. package/src/concepts/CallEvent__.ts +351 -0
  165. package/src/concepts/CallFunction__.ts +10 -13
  166. package/src/concepts/CallLogic__.ts +45 -32
  167. package/src/concepts/Constant__.ts +5 -7
  168. package/src/concepts/Destination__.ts +7 -5
  169. package/src/concepts/End__.ts +1 -0
  170. package/src/concepts/Event__.ts +70 -0
  171. package/src/concepts/FrontendType__.ts +919 -0
  172. package/src/concepts/Frontend__.ts +3 -251
  173. package/src/concepts/Identifier__.ts +29 -13
  174. package/src/concepts/LogicItem__.ts +1 -0
  175. package/src/concepts/Logic__.ts +36 -23
  176. package/src/concepts/MemberExpression__.ts +3 -3
  177. package/src/concepts/NewComposite__.ts +4 -6
  178. package/src/concepts/ParamWithGroup__.ts +101 -0
  179. package/src/concepts/Param__.ts +11 -3
  180. package/src/concepts/ProcessElement__.ts +8 -1
  181. package/src/concepts/Return__.ts +15 -12
  182. package/src/concepts/ValidationRule__.ts +6 -1
  183. package/src/concepts/Variable__.ts +17 -9
  184. package/src/concepts/ViewElement__.ts +168 -33
  185. package/src/concepts/View__.ts +23 -20
  186. package/src/concepts/index__.ts +5 -0
  187. package/src/concepts/utils/asserts.ts +367 -4
  188. package/src/concepts/utils/types.ts +28 -0
  189. package/src/generator/genBundleFiles.ts +33 -15
  190. package/src/generator/genReleaseBody.ts +14 -3
  191. package/src/generator/permission.ts +8 -6
  192. package/src/natural/transformTSCode.ts +1 -1
  193. package/src/server/extendBaseNode.ts +22 -20
  194. package/src/server/getLogics.ts +79 -41
  195. package/src/server/getMemberIdentifier.ts +7 -1
  196. package/src/server/getProcesses.ts +3 -3
  197. package/src/server/naslServer.ts +44 -20
  198. package/src/server/translator.ts +7 -1
  199. package/src/service/storage/init.ts +1 -2
  200. package/src/templator/genCreateBlock.ts +6 -6
  201. package/src/templator/genCurdEditMultipleKeyBlock.ts +16 -16
  202. package/src/templator/genCurdMultipleKeyBlock.ts +36 -36
  203. package/src/templator/genGetBlock.ts +6 -5
  204. package/src/templator/genGridViewBlock.ts +12 -12
  205. package/src/templator/genListViewBlock.ts +4 -4
  206. package/src/templator/genSelectBlock.ts +3 -3
  207. package/src/templator/genTableBlock.ts +10 -10
  208. package/src/templator/genUpdateBlock.ts +10 -9
  209. package/src/templator/utils.ts +2 -2
  210. package/src/translator/utils.ts +12 -1
  211. package/src/utils/i18nInfo.ts +7 -2
  212. package/src/utils/index.ts +211 -1
  213. package/test/concepts/call-function/fixtures/from-string.json +68 -59
  214. package/test/concepts/call-function/fixtures/to-string-global-tz.json +67 -58
  215. package/test/concepts/call-function/fixtures/to-string-no-tz.json +57 -48
  216. package/test/concepts/call-function/fixtures/to-string-user-tz.json +69 -60
  217. package/test/concepts/call-function/fixtures/to-string-utc-tz.json +69 -60
  218. package/test/concepts/call-interface/fixtures/only-interface.json +81 -72
  219. package/test/concepts/call-interface/fixtures/with-body-complex-argument.json +223 -214
  220. package/test/concepts/call-interface/fixtures/with-body-no-argument.json +85 -76
  221. package/test/concepts/call-interface/fixtures/with-body-simple-argument.json +100 -91
  222. package/test/concepts/call-interface/fixtures/with-headers-no-argument.json +88 -79
  223. package/test/concepts/call-interface/fixtures/with-headers.json +90 -81
  224. package/test/concepts/call-interface/fixtures/with-query-no-argument.json +88 -79
  225. package/test/concepts/call-interface/fixtures/with-query.json +90 -81
  226. package/test/concepts/call-logic/__snapshots__/getQuickInfoOffset.spec.ts.snap +4 -2
  227. package/test/concepts/call-logic/fixtures/entries-get-with-arguments.json +104 -95
  228. package/test/concepts/call-logic/fixtures/entries-update-with-arguments.json +209 -200
  229. package/test/concepts/call-logic/fixtures/global-logic-argument-no-expression.json +97 -88
  230. package/test/concepts/call-logic/fixtures/global-logic-argument-some-expression.json +124 -115
  231. package/test/concepts/call-logic/fixtures/json-deserialize.json +120 -111
  232. package/test/concepts/call-logic/fixtures/json-serialize-with-string.json +124 -115
  233. package/test/concepts/call-logic/fixtures/json-serialize.json +124 -115
  234. package/test/concepts/call-logic/fixtures/view-buildin-logic-with-argument.json +91 -82
  235. package/test/concepts/call-logic/fixtures/view-component-logic-no-argument.json +88 -79
  236. package/test/concepts/call-logic/fixtures/view-component-with-validation.json +144 -135
  237. package/test/concepts/identifier/fixtures/view-variable.json +145 -136
  238. package/test/concepts/view-element/__snapshots__/toVue.spec.ts.snap +1 -1
  239. package/test/concepts/view-element/fixtures/default-login.json +221 -212
  240. package/test/concepts/view-element/fixtures/default-not-found.json +183 -174
  241. package/test/concepts/view-element/fixtures/with-role-auth.json +91 -82
  242. package/test/concepts/view-element/fixtures/with-table.json +1894 -1885
  243. package/test/concepts/view-element/toVue.spec.ts +1 -0
  244. package/ts-worker/package.json +1 -1
  245. package/ts-worker/src/index.js +1 -0
@@ -88,6 +88,8 @@ import {
88
88
  UnaryExpression,
89
89
  types,
90
90
  asserts,
91
+ BusinessComponent,
92
+ CallEvent,
91
93
  } from '../concepts';
92
94
 
93
95
  import * as utils from '../utils';
@@ -429,7 +431,7 @@ class NaslServer {
429
431
  const {
430
432
  structures = [],
431
433
  metadataTypes = [],
432
- frontends = [],
434
+ frontendTypes = [],
433
435
  interfaces = [],
434
436
  enums = [],
435
437
  logics = [],
@@ -449,6 +451,10 @@ class NaslServer {
449
451
  namespaces = [],
450
452
  } = module as Connector;
451
453
 
454
+ const {
455
+ frontends = []
456
+ } = module as Module;
457
+
452
458
  yield* getTsFiles(structures, 'structure');
453
459
  yield* getTsFiles(metadataTypes, 'metadataType');
454
460
 
@@ -456,20 +462,25 @@ class NaslServer {
456
462
  yield* getTsFiles(overriddenLogics, 'overriddenLogic', OverriddenLogic);
457
463
  yield* getTsFiles(backend?.variables ?? [], 'backend_variable');
458
464
 
459
- for (const frontend of frontends) {
460
- yield* getTsFile(frontend, 'frontend');
461
- yield* getTsFiles(frontend.variables, 'frontend_variable');
462
- yield* getTsFiles(concat(frontend.bindEvents, 'logics'), 'frontend_bindEvent_logic');
463
-
464
- if (!config.closeViews) {
465
- yield* view2TSFile(frontend.views);
465
+ for (const frontendType of frontendTypes) {
466
+ yield* getTsFile(frontendType, 'frontendType');
467
+ for (const dep of frontendType.componentDependencies) {
468
+ results.push(...(yield* self.contentToFile(dep)));
466
469
  }
470
+ for (const frontend of frontendType.frontends) {
471
+ yield* getTsFile(frontend, 'frontend');
472
+ yield* getTsFiles(frontend.variables, 'frontend_variable');
473
+ yield* getTsFiles(concat(frontend.bindEvents, 'logics'), 'frontend_bindEvent_logic');
467
474
 
468
- for (const dep of frontend.componentDependencies) {
469
- results.push(...(yield* self.contentToFile(dep)));
475
+ if (!config.closeViews) {
476
+ yield* view2TSFile(frontend.views);
477
+ }
470
478
  }
479
+ // 业务组件
480
+ yield* getTsFiles(frontendType.businessComponents, 'businessComponents');
471
481
  }
472
482
  } else {
483
+ // 依赖库
473
484
  yield* getTsFiles(concat(frontends, 'logics' as any), 'frontend_logic');
474
485
  }
475
486
 
@@ -810,7 +821,7 @@ class NaslServer {
810
821
 
811
822
  const types = /<([^()]+)>/g.exec(displayString);
812
823
  const typeStr = types && types[1];
813
- const {app} = node;
824
+ const app = node.getAncestor('App') as App;
814
825
  if (typeStr.includes('__name: "AStructure_')) {
815
826
  const properties: StructureProperty[] = [];
816
827
  typeStr.replace(/([^:\s]+):\s+([^;]+);/g, ($1, name, typeKey) => {
@@ -1593,9 +1604,10 @@ class NaslServer {
1593
1604
  const self = this;
1594
1605
  const diagnostics: Diagnostic[] = [];
1595
1606
 
1596
- if (fileNode instanceof View) {
1607
+ if (fileNode instanceof View || fileNode instanceof BusinessComponent) {
1597
1608
  yield* utils.wrapIteratorToGenerator(fileNode.sourceMap.entries(), function* attachView([node, value]) {
1598
- if (node instanceof ViewElement && node.view === fileNode) {
1609
+ const likeComponent = node.getAncestor('View') || node.getAncestor('BusinessComponent');
1610
+ if (node instanceof ViewElement && likeComponent === fileNode) {
1599
1611
  if (node.tag) {
1600
1612
  yield* utils.wrapForEachToGenerator(node.bindAttrs, (bindAttr) => {
1601
1613
  if ((bindAttr.model || bindAttr.sync) && bindAttr.expression) {
@@ -1636,14 +1648,14 @@ class NaslServer {
1636
1648
  }
1637
1649
  });
1638
1650
  }
1639
- } else if ((node instanceof Variable || node instanceof Return) && node.view === fileNode) {
1651
+ } else if ((node instanceof Variable || node instanceof Return) && likeComponent === fileNode) {
1640
1652
  if (!node.typeAnnotation && !node.__TypeAnnotation) {
1641
1653
  const nodeTypeName = node.concept === 'Return' ? '输出参数' : '局部变量';
1642
1654
  let msg;
1643
1655
  yield* fileNode.traverseChildrenGenerator((nodeIn) => {
1644
1656
  if (nodeIn && (nodeIn instanceof BatchAssignment || (nodeIn instanceof Assignment && nodeIn.left?.name))) {
1645
1657
  // 子页面内部逻辑过滤
1646
- if (nodeIn.view !== fileNode) return;
1658
+ if ((nodeIn.view || nodeIn.getAncestor('BusinessComponent')) !== fileNode) return;
1647
1659
  // 当局部变量、输出参数属于页面内逻辑时,需过滤同页面下不同逻辑下的同名变量
1648
1660
  if (node.logic && node.logic !== nodeIn.logic) return;
1649
1661
  // 跟变量无关的赋值过滤
@@ -2179,7 +2191,7 @@ class NaslServer {
2179
2191
  const diagnostic = {
2180
2192
  node: fileNode,
2181
2193
  severity: 'error',
2182
- message: `连接器 ${fileNode.name} 参数配置缺失`,
2194
+ message: `连接器 ${fileNode.name} 参数配置有更新`,
2183
2195
  // 保留原来的内容方便查询一些问题
2184
2196
  originalDiagnostic: {
2185
2197
  fileName: '',
@@ -2460,6 +2472,7 @@ class NaslServer {
2460
2472
  node.parentKey !== 'playground' &&
2461
2473
  node.parentKey !== 'consequent' &&
2462
2474
  node.parentNode?.parentNode?.concept !== 'CallInterface' &&
2475
+ node.parentNode.concept !== 'Block' &&
2463
2476
  !node.__TypeAnnotation
2464
2477
  ) {
2465
2478
  let showErr = false;
@@ -2719,7 +2732,7 @@ class NaslServer {
2719
2732
  }
2720
2733
 
2721
2734
  if (!minRange) {
2722
- if (fileNode instanceof View) {
2735
+ if (fileNode instanceof View || fileNode instanceof BusinessComponent) {
2723
2736
  return { node: fileNode, item: sourceMap.get(fileNode) } as MinRange;
2724
2737
  }
2725
2738
  if (process.env.NODE_ENV === 'development') {
@@ -3120,6 +3133,9 @@ class NaslServer {
3120
3133
  );
3121
3134
  const results = await Promise.all(promises);
3122
3135
  results.forEach((constRefs) => {
3136
+ if(constRefs.symbolDisplayString.includes('(parameter)')) {
3137
+ return;
3138
+ }
3123
3139
  refsList = [...refsList, ...constRefs.refs];
3124
3140
  });
3125
3141
  }
@@ -3170,6 +3186,9 @@ class NaslServer {
3170
3186
  minRange.setTypeMethods = 'setCalleeNamespace';
3171
3187
  minRange.newValue = `elements.${ newValue }.logics`;
3172
3188
  }
3189
+ if (minRange.node instanceof CallEvent) {
3190
+ minRange.setTypeMethods = 'setCalleeName';
3191
+ }
3173
3192
  // 如果节点是实体修改引发calllogic修改
3174
3193
  if (
3175
3194
  minRange.node instanceof CallLogic &&
@@ -3540,11 +3559,12 @@ class NaslServer {
3540
3559
  if (node instanceof Param && minRange.node instanceof Interface) {
3541
3560
  return null;
3542
3561
  }
3543
- // 如果是被影响的是页面
3544
- if (minRange.node instanceof View) {
3545
- if (node instanceof View) {
3562
+ // 如果是被影响的是页面/业务组件
3563
+ if (minRange.node instanceof View || minRange.node instanceof BusinessComponent) {
3564
+ if (node instanceof View || node instanceof BusinessComponent) {
3546
3565
  // 如果是子页面修改
3547
3566
  // 父页面引起子页面改名,就可以不改了,自动同步
3567
+ // 页面中的业务组件,业务组件中的业务组件等都需要忽略
3548
3568
  if (minRange.node !== node) {
3549
3569
  return null;
3550
3570
  }
@@ -3563,6 +3583,9 @@ class NaslServer {
3563
3583
  if (minRange.node !== node) {
3564
3584
  return null;
3565
3585
  }
3586
+ } else if (node instanceof BusinessComponent) {
3587
+ minRange.setTypeMethods = 'setTag';
3588
+ minRange.newValue = `bs-${newValue}`;
3566
3589
  } else if (!(node instanceof Role)) {
3567
3590
  /**
3568
3591
  * 无论是逻辑还是实体中的key,修改都不应该触发
@@ -3846,6 +3869,7 @@ class NaslServer {
3846
3869
  !(fileNode.parentNode instanceof Backend) &&
3847
3870
  !isConnectorLogic &&
3848
3871
  !(fileNode instanceof View) &&
3872
+ !(fileNode instanceof BusinessComponent) &&
3849
3873
  !(fileNode instanceof ConfigProperty)
3850
3874
  ) {
3851
3875
  fileNode = fileNode.parentNode as FileNode & types.SyntaxNode;
@@ -11,6 +11,7 @@ import {
11
11
  EntityProperty,
12
12
  EntityIndex,
13
13
  View,
14
+ BusinessComponent,
14
15
  Destination,
15
16
  Enum,
16
17
  BindEvent,
@@ -172,6 +173,11 @@ const TS_RULES: Array<{
172
173
  result: '找不到配置参数$2',
173
174
  transforms: [transformType, transformType],
174
175
  },
176
+ {
177
+ re: /Property '(.+?)' is private and only accessible within class '(.+?)'./,
178
+ result: '“$1”是私有的,只能在“$2”中访问。',
179
+ transforms: [transformType, transformType],
180
+ },
175
181
  {
176
182
  re: /Object literal may only specify known properties, and '(.+?)' does not exist in type/,
177
183
  result: '当前参数$1,不可用。',
@@ -473,7 +479,7 @@ export function naslNodeTranslateMessage(minRange: MinRange, tsErrorDetail: Diag
473
479
  // const isFELogic = ['BindEvent', 'View'].includes(parentNode.concept);
474
480
 
475
481
  // 有一些节点报错信息不向外暴露,缺失一些原生标签等等的展示
476
- if (node instanceof View || node instanceof ViewElement) {
482
+ if (node instanceof View || node instanceof BusinessComponent || node instanceof ViewElement) {
477
483
  if (text.startsWith(`'nasl.ui' has no exported member named `)) {
478
484
  return null;
479
485
  } else if (text.startsWith(`Property '`) && text.includes(`does not exist on type 'typeof ui'.`)) {
@@ -88,7 +88,6 @@ async function deleteExpiredRecords() {
88
88
  expiredRecordsRequest.onsuccess = (event: any) => {
89
89
  const cursor = event.target.result;
90
90
  if (cursor) {
91
- console.log(cursor);
92
91
  objectStore.delete(cursor.primaryKey);
93
92
  cursor.continue();
94
93
  } else {
@@ -1213,7 +1212,7 @@ export async function loadApp(appId?: string) {
1213
1212
  roles: [],
1214
1213
  dependencies: [],
1215
1214
  interfaceDependencies: [],
1216
- frontends: [],
1215
+ frontendTypes: [],
1217
1216
  metadataTypes: []
1218
1217
  });
1219
1218
  } else {
@@ -287,16 +287,16 @@ function genSubmitLogic(createLogic: Logic, nameGroup: NameGroup) {
287
287
  * @param resolver 实体创建 Action
288
288
  */
289
289
  export function genCreateBlock(entity: Entity, oldNode: ViewElement) {
290
- const { view } = oldNode;
290
+ const likeComponent = oldNode?.likeComponent;
291
291
  const dataSource = entity.parentNode as DataSource;
292
292
  const module = dataSource.app;
293
293
  const { ns } = entity;
294
294
  const createLogic = ns?.logics?.find((logic) => logic.name === `create`);
295
295
 
296
296
  const nameGroup: NameGroup = {};
297
- nameGroup.viewElementMainView = view.getViewElementUniqueName('form1');
298
- nameGroup.viewVariableEntity = view.getVariableUniqueName(utils.firstLowerCase(entity.name));
299
- nameGroup.viewLogicSubmit = view.getLogicUniqueName('submit');
297
+ nameGroup.viewElementMainView = likeComponent.getViewElementUniqueName('form1');
298
+ nameGroup.viewVariableEntity = likeComponent.getVariableUniqueName(utils.firstLowerCase(entity.name));
299
+ nameGroup.viewLogicSubmit = likeComponent.getLogicUniqueName('submit');
300
300
 
301
301
  // 收集所有和本实体关联的实体
302
302
  const selectNameGroupMap: Map<string, NameGroup> = new Map();
@@ -309,8 +309,8 @@ export function genCreateBlock(entity: Entity, oldNode: ViewElement) {
309
309
  if (relationEntity) {
310
310
  const displayedProperty = getFirstDisplayedProperty(relationEntity);
311
311
  if (displayedProperty) {
312
- const viewElementSelect = view.getViewElementUniqueName('select');
313
- const selectNameGroup = genUniqueQueryNameGroup(module, view, viewElementSelect, false, relationEntity.name);
312
+ const viewElementSelect = likeComponent.getViewElementUniqueName('select');
313
+ const selectNameGroup = genUniqueQueryNameGroup(module, likeComponent, viewElementSelect, false, relationEntity.name);
314
314
  selectNameGroup.viewElementSelect = viewElementSelect;
315
315
  // 存在多个属性关联同一个实体的情况,因此加上属性名用以唯一标识
316
316
  const key = [property.name, relationEntity.name].join('-');
@@ -275,24 +275,24 @@ function genCreateLogic(nameGroup: NameGroup) {
275
275
  }
276
276
 
277
277
  export function genCurdEditMultipleKeyBlock(entity: Entity, oldNode: ViewElement) {
278
- const { view } = oldNode;
278
+ const likeComponent = oldNode?.likeComponent;
279
279
  const dataSource = entity.parentNode as DataSource;
280
280
  const module = dataSource.app;
281
281
 
282
- const viewElementMainView = view.getViewElementUniqueName('tableView');
283
- const nameGroup = genUniqueQueryNameGroup(module, view, viewElementMainView);
282
+ const viewElementMainView = likeComponent.getViewElementUniqueName('tableView');
283
+ const nameGroup = genUniqueQueryNameGroup(module, likeComponent, viewElementMainView);
284
284
  nameGroup.viewElementMainView = viewElementMainView;
285
- nameGroup.viewElementSaveModal = view.getViewElementUniqueName('saveModal');
286
- nameGroup.viewElementSaveModalForm = view.getViewElementUniqueName('saveModalForm');
287
- nameGroup.viewLogicRemove = view.getLogicUniqueName('remove');
288
- nameGroup.viewLogicInit = view.getLogicUniqueName('init');
289
- nameGroup.viewLogicCreate = view.getLogicUniqueName('create');
290
- nameGroup.viewLogicSubmit = view.getLogicUniqueName('submit');
291
- nameGroup.viewLogicBlurUpdate = view.getLogicUniqueName('blurUpdate');
292
- nameGroup.viewLogicReload = view.getLogicUniqueName('reload');
293
- nameGroup.viewVariableEntity = view.getVariableUniqueName(utils.firstLowerCase(entity.name));
294
- nameGroup.viewVariableInput = view.getVariableUniqueName('input');
295
- nameGroup.viewVariableFilter = view.getVariableUniqueName('filter');
285
+ nameGroup.viewElementSaveModal = likeComponent.getViewElementUniqueName('saveModal');
286
+ nameGroup.viewElementSaveModalForm = likeComponent.getViewElementUniqueName('saveModalForm');
287
+ nameGroup.viewLogicRemove = likeComponent.getLogicUniqueName('remove');
288
+ nameGroup.viewLogicInit = likeComponent.getLogicUniqueName('init');
289
+ nameGroup.viewLogicCreate = likeComponent.getLogicUniqueName('create');
290
+ nameGroup.viewLogicSubmit = likeComponent.getLogicUniqueName('submit');
291
+ nameGroup.viewLogicBlurUpdate = likeComponent.getLogicUniqueName('blurUpdate');
292
+ nameGroup.viewLogicReload = likeComponent.getLogicUniqueName('reload');
293
+ nameGroup.viewVariableEntity = likeComponent.getVariableUniqueName(utils.firstLowerCase(entity.name));
294
+ nameGroup.viewVariableInput = likeComponent.getVariableUniqueName('input');
295
+ nameGroup.viewVariableFilter = likeComponent.getVariableUniqueName('filter');
296
296
 
297
297
  // 收集所有和本实体关联的实体
298
298
  const entitySet: Set<Entity> = new Set();
@@ -308,8 +308,8 @@ export function genCurdEditMultipleKeyBlock(entity: Entity, oldNode: ViewElement
308
308
  const displayedProperty = getFirstDisplayedProperty(relationEntity);
309
309
  if (displayedProperty) {
310
310
  entitySet.add(relationEntity);
311
- const viewElementSelect = view.getViewElementUniqueName('select');
312
- const selectNameGroup = genUniqueQueryNameGroup(module, view, viewElementSelect, false, relationEntity.name);
311
+ const viewElementSelect = likeComponent.getViewElementUniqueName('select');
312
+ const selectNameGroup = genUniqueQueryNameGroup(module, likeComponent, viewElementSelect, false, relationEntity.name);
313
313
  selectNameGroup.viewElementSelect = viewElementSelect;
314
314
  // 存在多个属性关联同一个实体的情况,因此加上属性名用以唯一标识
315
315
  const key = [property.name, relationEntity.name].join('-');
@@ -518,26 +518,26 @@ function genDetailLogic(entity: Entity, nameGroup: NameGroup) {
518
518
 
519
519
  // 列表(全)
520
520
  export function genCurdMultipleKeyBlock(entity: Entity, oldNode: ViewElement) {
521
- const { view } = oldNode;
521
+ const likeComponent = oldNode?.likeComponent;
522
522
  const dataSource = entity.parentNode as DataSource;
523
523
  const module = dataSource.app;
524
524
 
525
- const viewElementMainView = view.getViewElementUniqueName('tableView');
526
- const nameGroup = genUniqueQueryNameGroup(module, view, viewElementMainView);
525
+ const viewElementMainView = likeComponent.getViewElementUniqueName('tableView');
526
+ const nameGroup = genUniqueQueryNameGroup(module, likeComponent, viewElementMainView);
527
527
  nameGroup.viewElementMainView = viewElementMainView;
528
- nameGroup.viewElementSaveModal = view.getViewElementUniqueName('saveModal');
529
- nameGroup.viewElementSaveModalForm = view.getViewElementUniqueName('saveModalForm');
530
- nameGroup.viewLogicRemove = view.getLogicUniqueName('remove');
531
- nameGroup.viewLogicInit = view.getLogicUniqueName('init');
532
- nameGroup.viewLogicCreate = view.getLogicUniqueName('create');
533
- nameGroup.viewLogicModify = view.getLogicUniqueName('modify');
534
- nameGroup.viewLogicSubmit = view.getLogicUniqueName('submit');
535
- nameGroup.viewLogicUpdateSubmit = view.getLogicUniqueName('updateSubmit');
536
- nameGroup.viewLogicReload = view.getLogicUniqueName('reload');
537
- nameGroup.viewVariableEntity = view.getVariableUniqueName(utils.firstLowerCase(entity.name));
538
- nameGroup.viewVariableInput = view.getVariableUniqueName('input');
539
- nameGroup.viewVariableFilter = view.getVariableUniqueName('filter');
540
- nameGroup.viewVariableIsUpdate = view.getVariableUniqueName('isUpdate');
528
+ nameGroup.viewElementSaveModal = likeComponent.getViewElementUniqueName('saveModal');
529
+ nameGroup.viewElementSaveModalForm = likeComponent.getViewElementUniqueName('saveModalForm');
530
+ nameGroup.viewLogicRemove = likeComponent.getLogicUniqueName('remove');
531
+ nameGroup.viewLogicInit = likeComponent.getLogicUniqueName('init');
532
+ nameGroup.viewLogicCreate = likeComponent.getLogicUniqueName('create');
533
+ nameGroup.viewLogicModify = likeComponent.getLogicUniqueName('modify');
534
+ nameGroup.viewLogicSubmit = likeComponent.getLogicUniqueName('submit');
535
+ nameGroup.viewLogicUpdateSubmit = likeComponent.getLogicUniqueName('updateSubmit');
536
+ nameGroup.viewLogicReload = likeComponent.getLogicUniqueName('reload');
537
+ nameGroup.viewVariableEntity = likeComponent.getVariableUniqueName(utils.firstLowerCase(entity.name));
538
+ nameGroup.viewVariableInput = likeComponent.getVariableUniqueName('input');
539
+ nameGroup.viewVariableFilter = likeComponent.getVariableUniqueName('filter');
540
+ nameGroup.viewVariableIsUpdate = likeComponent.getVariableUniqueName('isUpdate');
541
541
 
542
542
  // 收集所有和本实体关联的实体
543
543
  const entitySet: Set<Entity> = new Set();
@@ -553,8 +553,8 @@ export function genCurdMultipleKeyBlock(entity: Entity, oldNode: ViewElement) {
553
553
  const displayedProperty = getFirstDisplayedProperty(relationEntity);
554
554
  if (displayedProperty) {
555
555
  entitySet.add(relationEntity);
556
- const viewElementSelect = view.getViewElementUniqueName('select');
557
- const selectNameGroup = genUniqueQueryNameGroup(module, view, viewElementSelect, false, relationEntity.name);
556
+ const viewElementSelect = likeComponent.getViewElementUniqueName('select');
557
+ const selectNameGroup = genUniqueQueryNameGroup(module, likeComponent, viewElementSelect, false, relationEntity.name);
558
558
  selectNameGroup.viewElementSelect = viewElementSelect;
559
559
  // 存在多个属性关联同一个实体的情况,因此加上属性名用以唯一标识
560
560
  const key = [property.name, relationEntity.name].join('-');
@@ -646,26 +646,26 @@ export function genCurdMultipleKeyBlock(entity: Entity, oldNode: ViewElement) {
646
646
 
647
647
  // 数据网格(全)
648
648
  export function genGridViewMultipleKeyBlock(entity: Entity, oldNode: ViewElement) {
649
- const { view } = oldNode;
649
+ const likeComponent = oldNode?.likeComponent;
650
650
  const dataSource = entity.parentNode as DataSource;
651
651
  const module = dataSource.app;
652
652
 
653
- const viewElementMainView = view.getViewElementUniqueName('gridView');
654
- const nameGroup = genUniqueQueryNameGroup(module, view, viewElementMainView);
653
+ const viewElementMainView = likeComponent.getViewElementUniqueName('gridView');
654
+ const nameGroup = genUniqueQueryNameGroup(module, likeComponent, viewElementMainView);
655
655
  nameGroup.viewElementMainView = viewElementMainView;
656
- nameGroup.viewElementSaveModal = view.getViewElementUniqueName('saveModal');
657
- nameGroup.viewElementSaveModalForm = view.getViewElementUniqueName('saveModalForm');
658
- nameGroup.viewLogicRemove = view.getLogicUniqueName('remove');
659
- nameGroup.viewLogicInit = view.getLogicUniqueName('init');
660
- nameGroup.viewLogicCreate = view.getLogicUniqueName('create');
661
- nameGroup.viewLogicModify = view.getLogicUniqueName('modify');
662
- nameGroup.viewLogicSubmit = view.getLogicUniqueName('submit');
663
- nameGroup.viewLogicUpdateSubmit = view.getLogicUniqueName('updateSubmit');
664
- nameGroup.viewLogicReload = view.getLogicUniqueName('reload');
665
- nameGroup.viewVariableEntity = view.getVariableUniqueName(utils.firstLowerCase(entity.name));
666
- nameGroup.viewVariableInput = view.getVariableUniqueName('input');
667
- nameGroup.viewVariableFilter = view.getVariableUniqueName('filter');
668
- nameGroup.viewVariableIsUpdate = view.getVariableUniqueName('isUpdate');
656
+ nameGroup.viewElementSaveModal = likeComponent.getViewElementUniqueName('saveModal');
657
+ nameGroup.viewElementSaveModalForm = likeComponent.getViewElementUniqueName('saveModalForm');
658
+ nameGroup.viewLogicRemove = likeComponent.getLogicUniqueName('remove');
659
+ nameGroup.viewLogicInit = likeComponent.getLogicUniqueName('init');
660
+ nameGroup.viewLogicCreate = likeComponent.getLogicUniqueName('create');
661
+ nameGroup.viewLogicModify = likeComponent.getLogicUniqueName('modify');
662
+ nameGroup.viewLogicSubmit = likeComponent.getLogicUniqueName('submit');
663
+ nameGroup.viewLogicUpdateSubmit = likeComponent.getLogicUniqueName('updateSubmit');
664
+ nameGroup.viewLogicReload = likeComponent.getLogicUniqueName('reload');
665
+ nameGroup.viewVariableEntity = likeComponent.getVariableUniqueName(utils.firstLowerCase(entity.name));
666
+ nameGroup.viewVariableInput = likeComponent.getVariableUniqueName('input');
667
+ nameGroup.viewVariableFilter = likeComponent.getVariableUniqueName('filter');
668
+ nameGroup.viewVariableIsUpdate = likeComponent.getVariableUniqueName('isUpdate');
669
669
 
670
670
  // 收集所有和本实体关联的实体
671
671
  const entitySet: Set<Entity> = new Set();
@@ -681,8 +681,8 @@ export function genGridViewMultipleKeyBlock(entity: Entity, oldNode: ViewElement
681
681
  const displayedProperty = getFirstDisplayedProperty(relationEntity);
682
682
  if (displayedProperty) {
683
683
  entitySet.add(relationEntity);
684
- const viewElementSelect = view.getViewElementUniqueName('select');
685
- const selectNameGroup = genUniqueQueryNameGroup(module, view, viewElementSelect, false, relationEntity.name);
684
+ const viewElementSelect = likeComponent.getViewElementUniqueName('select');
685
+ const selectNameGroup = genUniqueQueryNameGroup(module, likeComponent, viewElementSelect, false, relationEntity.name);
686
686
  selectNameGroup.viewElementSelect = viewElementSelect;
687
687
  // 存在多个属性关联同一个实体的情况,因此加上属性名用以唯一标识
688
688
  const key = [property.name, relationEntity.name].join('-');
@@ -68,14 +68,15 @@ export function genH5GetTemplate(entity: Entity, nameGroup: NameGroup) {
68
68
  }
69
69
 
70
70
  export function genGetBlock(entity: Entity, oldNode: ViewElement) {
71
- const { view } = oldNode;
71
+ const likeComponent = oldNode?.likeComponent;
72
+ const isBusinessComponent = likeComponent.concept === 'BusinessComponent';
72
73
  const { ns } = entity;
73
74
  const getLogic = ns?.logics?.find((logic) => logic.name === `get`);
74
75
 
75
76
  const nameGroup: NameGroup = {};
76
- nameGroup.viewParamId = view.getParamUniqueName('id');
77
- nameGroup.viewVariableEntity = view.getVariableUniqueName(utils.firstLowerCase(entity.name));
78
- nameGroup.viewLogicLoad = view.getLogicUniqueName('load');
77
+ nameGroup.viewParamId = likeComponent.getParamUniqueName('id');
78
+ nameGroup.viewVariableEntity = likeComponent.getVariableUniqueName(utils.firstLowerCase(entity.name));
79
+ nameGroup.viewLogicLoad = likeComponent.getLogicUniqueName('load');
79
80
 
80
81
  return `<template>
81
82
  ${config.scope === 'h5' ? genH5GetTemplate(entity, nameGroup) : genGetTemplate(entity, nameGroup)}
@@ -85,7 +86,7 @@ export function genGetBlock(entity: Entity, oldNode: ViewElement) {
85
86
  {
86
87
  "viewParams": [
87
88
  {
88
- "concept": "Param",
89
+ "concept": "${isBusinessComponent ? 'ParamWithGroup' : 'Param'}",
89
90
  "name": "${nameGroup.viewParamId}",
90
91
  "typeAnnotation": ${JSON.stringify(NaslCoreTypeAnnotation.Long)}
91
92
  }
@@ -245,16 +245,16 @@ export function genGridViewRemoveLogic(entity: Entity, nameGroup: NameGroup) {
245
245
  */
246
246
  // 数据网格(简)
247
247
  export function genGridViewBlock(entity: Entity, oldNode: ViewElement) {
248
- const { view } = oldNode;
248
+ const likeComponent = oldNode?.likeComponent;
249
249
  const dataSource = entity.parentNode as DataSource;
250
250
  const module = dataSource.app;
251
251
 
252
- const viewElementMainView = view.getViewElementUniqueName('gridView');
253
- const nameGroup = genUniqueQueryNameGroup(module, view, viewElementMainView);
252
+ const viewElementMainView = likeComponent.getViewElementUniqueName('gridView');
253
+ const nameGroup = genUniqueQueryNameGroup(module, likeComponent, viewElementMainView);
254
254
  nameGroup.viewElementMainView = viewElementMainView;
255
- nameGroup.viewVariableEntity = view.getVariableUniqueName(utils.firstLowerCase(entity.name));
256
- nameGroup.viewLogicRemove = view.getLogicUniqueName('remove');
257
- nameGroup.viewVariableFilter = view.getVariableUniqueName('filter');
255
+ nameGroup.viewVariableEntity = likeComponent.getVariableUniqueName(utils.firstLowerCase(entity.name));
256
+ nameGroup.viewLogicRemove = likeComponent.getLogicUniqueName('remove');
257
+ nameGroup.viewVariableFilter = likeComponent.getVariableUniqueName('filter');
258
258
 
259
259
  // 当前节点的currentName
260
260
  nameGroup.currentName = oldNode.getCurrentName();
@@ -294,17 +294,17 @@ export function genGridViewBlock(entity: Entity, oldNode: ViewElement) {
294
294
  }
295
295
 
296
296
  export function genGridViewCardBlock(property: EntityProperty, oldNode: ViewElement) {
297
- const { view } = oldNode;
297
+ const likeComponent = oldNode?.likeComponent;
298
298
  const { entity } = property;
299
299
  const dataSource = entity.parentNode as DataSource;
300
300
  const module = dataSource.app;
301
301
 
302
- const viewElementMainView = view.getViewElementUniqueName('gridView');
303
- const nameGroup = genUniqueQueryNameGroup(module, view, viewElementMainView);
302
+ const viewElementMainView = likeComponent.getViewElementUniqueName('gridView');
303
+ const nameGroup = genUniqueQueryNameGroup(module, likeComponent, viewElementMainView);
304
304
  nameGroup.viewElementMainView = viewElementMainView;
305
- nameGroup.viewVariableEntity = view.getVariableUniqueName(utils.firstLowerCase(entity.name));
306
- nameGroup.viewLogicRemove = view.getLogicUniqueName('remove');
307
- nameGroup.viewVariableFilter = view.getVariableUniqueName('filter');
305
+ nameGroup.viewVariableEntity = likeComponent.getVariableUniqueName(utils.firstLowerCase(entity.name));
306
+ nameGroup.viewLogicRemove = likeComponent.getLogicUniqueName('remove');
307
+ nameGroup.viewVariableFilter = likeComponent.getVariableUniqueName('filter');
308
308
 
309
309
  // 收集所有和本实体关联的实体
310
310
  const entitySet: Set<Entity> = new Set();
@@ -94,14 +94,14 @@ export function genLoadListViewLogic(entity: Entity, nameGroup: NameGroup, newLo
94
94
  * 生成实体选择框区块
95
95
  */
96
96
  export function genListViewBlock(entity: Entity, oldNode: ViewElement, property: EntityProperty) {
97
- const { view } = oldNode;
97
+ const likeComponent = oldNode?.likeComponent;
98
98
  const dataSource = entity.parentNode as DataSource;
99
99
  const module = dataSource.app;
100
100
 
101
- const viewElementMainView = view.getViewElementUniqueName('listView');
102
- const nameGroup = genUniqueQueryNameGroup(module, view, viewElementMainView, false);
101
+ const viewElementMainView = likeComponent.getViewElementUniqueName('listView');
102
+ const nameGroup = genUniqueQueryNameGroup(module, likeComponent, viewElementMainView, false);
103
103
  nameGroup.viewElementMainView = viewElementMainView;
104
- nameGroup.viewVariableEntity = view.getVariableUniqueName(utils.firstLowerCase(entity.name));
104
+ nameGroup.viewVariableEntity = likeComponent.getVariableUniqueName(utils.firstLowerCase(entity.name));
105
105
  // 当前节点的currentName
106
106
  nameGroup.currentName = oldNode.getCurrentName();
107
107
  const displayedProperty = property || getFirstDisplayedProperty(entity);
@@ -104,12 +104,12 @@ export function genLoadSelectLogic(entity: Entity, nameGroup: NameGroup, newLogi
104
104
  * @returns
105
105
  */
106
106
  export function genSelectBlock(entity: Entity, oldNode: ViewElement) {
107
- const { view } = oldNode;
107
+ const likeComponent = oldNode?.likeComponent;
108
108
  const dataSource = entity.parentNode as DataSource;
109
109
  const module = dataSource.app;
110
110
 
111
- const viewElementMainView = view.getViewElementUniqueName('select');
112
- const nameGroup = genUniqueQueryNameGroup(module, view, viewElementMainView, false);
111
+ const viewElementMainView = likeComponent.getViewElementUniqueName('select');
112
+ const nameGroup = genUniqueQueryNameGroup(module, likeComponent, viewElementMainView, false);
113
113
  nameGroup.viewElementMainView = viewElementMainView;
114
114
  nameGroup.lowerEntity = utils.firstLowerCase(entity.name);
115
115
 
@@ -198,15 +198,15 @@ export function genTableRemoveLogic(entity: Entity, nameGroup: NameGroup) {
198
198
  * load_select_student -> load_someView_select_student
199
199
  */
200
200
  export function genTableBlock(entity: Entity, oldNode: ViewElement) {
201
- const { view } = oldNode;
201
+ const likeComponent = oldNode?.likeComponent;
202
202
  const dataSource = entity.parentNode as DataSource;
203
203
  const module = dataSource.app;
204
204
 
205
- const viewElementMainView = view.getViewElementUniqueName('tableView');
206
- const nameGroup = genUniqueQueryNameGroup(module, view, viewElementMainView);
205
+ const viewElementMainView = likeComponent.getViewElementUniqueName('tableView');
206
+ const nameGroup = genUniqueQueryNameGroup(module, likeComponent, viewElementMainView);
207
207
  nameGroup.viewElementMainView = viewElementMainView;
208
- nameGroup.viewVariableEntity = view.getVariableUniqueName(utils.firstLowerCase(entity.name));
209
- nameGroup.viewLogicRemove = view.getLogicUniqueName('remove');
208
+ nameGroup.viewVariableEntity = likeComponent.getVariableUniqueName(utils.firstLowerCase(entity.name));
209
+ nameGroup.viewLogicRemove = likeComponent.getLogicUniqueName('remove');
210
210
  // 当前节点的currentName
211
211
  nameGroup.currentName = oldNode.getCurrentName();
212
212
  // 收集所有和本实体关联的实体
@@ -245,16 +245,16 @@ export function genTableBlock(entity: Entity, oldNode: ViewElement) {
245
245
  }
246
246
 
247
247
  export function genTableColumnBlock(property: EntityProperty, oldNode: ViewElement) {
248
- const { view } = oldNode;
248
+ const likeComponent = oldNode?.likeComponent;
249
249
  const { entity } = property;
250
250
  const dataSource = entity.parentNode as DataSource;
251
251
  const module = dataSource.app;
252
252
 
253
- const viewElementMainView = view.getViewElementUniqueName('tableView');
254
- const nameGroup = genUniqueQueryNameGroup(module, view, viewElementMainView);
253
+ const viewElementMainView = likeComponent.getViewElementUniqueName('tableView');
254
+ const nameGroup = genUniqueQueryNameGroup(module, likeComponent, viewElementMainView);
255
255
  nameGroup.viewElementMainView = viewElementMainView;
256
- nameGroup.viewVariableEntity = view.getVariableUniqueName(utils.firstLowerCase(entity.name));
257
- nameGroup.viewLogicRemove = view.getLogicUniqueName('remove');
256
+ nameGroup.viewVariableEntity = likeComponent.getVariableUniqueName(utils.firstLowerCase(entity.name));
257
+ nameGroup.viewLogicRemove = likeComponent.getLogicUniqueName('remove');
258
258
 
259
259
  // 收集所有和本实体关联的实体
260
260
  const entitySet: Set<Entity> = new Set();
@@ -307,7 +307,8 @@ function genLoadLogic(getLogic: Logic, nameGroup: NameGroup) {
307
307
 
308
308
  // 生成修改区块
309
309
  export function genUpdateBlock(entity: Entity, oldNode: ViewElement) {
310
- const { view } = oldNode;
310
+ const likeComponent = oldNode?.likeComponent;
311
+ const isBusinessComponent = likeComponent.concept === 'BusinessComponent';
311
312
  const dataSource = entity.parentNode as DataSource;
312
313
  const module = dataSource.app;
313
314
  const { ns } = entity;
@@ -315,11 +316,11 @@ export function genUpdateBlock(entity: Entity, oldNode: ViewElement) {
315
316
  const updateLogic = ns?.logics?.find((logic) => logic.name === `update`);
316
317
 
317
318
  const nameGroup: NameGroup = {};
318
- nameGroup.viewElementMainView = view.getViewElementUniqueName('form1');
319
- nameGroup.viewVariableEntity = view.getVariableUniqueName(utils.firstLowerCase(entity.name));
320
- nameGroup.viewParamId = view.getParamUniqueName('id');
321
- nameGroup.viewLogicLoad = view.getLogicUniqueName('load');
322
- nameGroup.viewLogicSubmit = view.getLogicUniqueName('submit');
319
+ nameGroup.viewElementMainView = likeComponent.getViewElementUniqueName('form1');
320
+ nameGroup.viewVariableEntity = likeComponent.getVariableUniqueName(utils.firstLowerCase(entity.name));
321
+ nameGroup.viewParamId = likeComponent.getParamUniqueName('id');
322
+ nameGroup.viewLogicLoad = likeComponent.getLogicUniqueName('load');
323
+ nameGroup.viewLogicSubmit = likeComponent.getLogicUniqueName('submit');
323
324
 
324
325
  // 收集所有和本实体关联的实体
325
326
  const selectNameGroupMap: Map<string, NameGroup> = new Map();
@@ -332,8 +333,8 @@ export function genUpdateBlock(entity: Entity, oldNode: ViewElement) {
332
333
  if (relationEntity) {
333
334
  const displayedProperty = getFirstDisplayedProperty(relationEntity);
334
335
  if (displayedProperty) {
335
- const viewElementSelect = view.getViewElementUniqueName('select');
336
- const selectNameGroup = genUniqueQueryNameGroup(module, view, viewElementSelect, false, relationEntity.name);
336
+ const viewElementSelect = likeComponent.getViewElementUniqueName('select');
337
+ const selectNameGroup = genUniqueQueryNameGroup(module, likeComponent, viewElementSelect, false, relationEntity.name);
337
338
  selectNameGroup.viewElementSelect = viewElementSelect;
338
339
  // 存在多个属性关联同一个实体的情况,因此加上属性名用以唯一标识
339
340
  const key = [property.name, relationEntity.name].join('-');
@@ -357,7 +358,7 @@ export function genUpdateBlock(entity: Entity, oldNode: ViewElement) {
357
358
  {
358
359
  "viewParams": [
359
360
  {
360
- "concept": "Param",
361
+ "concept": "${isBusinessComponent ? 'ParamWithGroup' : 'Param'}",
361
362
  "name": "${nameGroup.viewParamId}",
362
363
  "typeAnnotation": ${JSON.stringify(NaslCoreTypeAnnotation.Long)}
363
364
  }