@lcap/nasl 3.5.0-beta.4 → 3.6.0-alpha.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 (238) hide show
  1. package/out/bak/translator.js +39 -119
  2. package/out/bak/translator.js.map +1 -1
  3. package/out/breakpoint/generator/BreakpointNode.d.ts +0 -3
  4. package/out/breakpoint/generator/BreakpointNode.js +0 -9
  5. package/out/breakpoint/generator/BreakpointNode.js.map +1 -1
  6. package/out/breakpoint/shared/constants.js +0 -1
  7. package/out/breakpoint/shared/constants.js.map +1 -1
  8. package/out/breakpoint/shared/utils.js +7 -31
  9. package/out/breakpoint/shared/utils.js.map +1 -1
  10. package/out/common/BaseNode.d.ts +13 -1
  11. package/out/common/BaseNode.js +52 -23
  12. package/out/common/BaseNode.js.map +1 -1
  13. package/out/common/Command.js +1 -0
  14. package/out/common/Command.js.map +1 -1
  15. package/out/common/EventEmitter.d.ts +1 -1
  16. package/out/common/EventEmitter.js +0 -4
  17. package/out/common/EventEmitter.js.map +1 -1
  18. package/out/concepts/App__.d.ts +76 -51
  19. package/out/concepts/App__.js +190 -87
  20. package/out/concepts/App__.js.map +1 -1
  21. package/out/concepts/BackendVariable__.js +2 -10
  22. package/out/concepts/BackendVariable__.js.map +1 -1
  23. package/out/concepts/BindAttribute__.js +6 -16
  24. package/out/concepts/BindAttribute__.js.map +1 -1
  25. package/out/concepts/BindDirective__.d.ts +0 -1
  26. package/out/concepts/BindDirective__.js +4 -19
  27. package/out/concepts/BindDirective__.js.map +1 -1
  28. package/out/concepts/BindEvent__.d.ts +1 -3
  29. package/out/concepts/BindEvent__.js +13 -38
  30. package/out/concepts/BindEvent__.js.map +1 -1
  31. package/out/concepts/CallFunction__.js +2 -10
  32. package/out/concepts/CallFunction__.js.map +1 -1
  33. package/out/concepts/CallLogic__.d.ts +0 -2
  34. package/out/concepts/CallLogic__.js +27 -38
  35. package/out/concepts/CallLogic__.js.map +1 -1
  36. package/out/concepts/Constant__.js +6 -7
  37. package/out/concepts/Constant__.js.map +1 -1
  38. package/out/concepts/Destination__.d.ts +1 -1
  39. package/out/concepts/Destination__.js +4 -6
  40. package/out/concepts/Destination__.js.map +1 -1
  41. package/out/concepts/End__.js +1 -2
  42. package/out/concepts/End__.js.map +1 -1
  43. package/out/concepts/Entity__.d.ts +1 -1
  44. package/out/concepts/Entity__.js +2 -0
  45. package/out/concepts/Entity__.js.map +1 -1
  46. package/out/concepts/Event__.d.ts +0 -14
  47. package/out/concepts/Event__.js +0 -61
  48. package/out/concepts/Event__.js.map +1 -1
  49. package/out/concepts/Frontend__.d.ts +88 -0
  50. package/out/concepts/Frontend__.js +143 -1
  51. package/out/concepts/Frontend__.js.map +1 -1
  52. package/out/concepts/Identifier__.d.ts +0 -5
  53. package/out/concepts/Identifier__.js +9 -19
  54. package/out/concepts/Identifier__.js.map +1 -1
  55. package/out/concepts/LogicItem__.d.ts +1 -1
  56. package/out/concepts/LogicItem__.js.map +1 -1
  57. package/out/concepts/Logic__.d.ts +1 -3
  58. package/out/concepts/Logic__.js +13 -16
  59. package/out/concepts/Logic__.js.map +1 -1
  60. package/out/concepts/MemberExpression__.d.ts +1 -1
  61. package/out/concepts/MemberExpression__.js +3 -3
  62. package/out/concepts/MemberExpression__.js.map +1 -1
  63. package/out/concepts/NewComposite__.js.map +1 -1
  64. package/out/concepts/Param__.js +3 -11
  65. package/out/concepts/Param__.js.map +1 -1
  66. package/out/concepts/ProcessElement__.js +1 -9
  67. package/out/concepts/ProcessElement__.js.map +1 -1
  68. package/out/concepts/Return__.js +9 -17
  69. package/out/concepts/Return__.js.map +1 -1
  70. package/out/concepts/Variable__.js +8 -17
  71. package/out/concepts/Variable__.js.map +1 -1
  72. package/out/concepts/ViewElement__.d.ts +2 -17
  73. package/out/concepts/ViewElement__.js +31 -143
  74. package/out/concepts/ViewElement__.js.map +1 -1
  75. package/out/concepts/View__.js +6 -6
  76. package/out/concepts/View__.js.map +1 -1
  77. package/out/concepts/index__.d.ts +0 -5
  78. package/out/concepts/index__.js +0 -5
  79. package/out/concepts/index__.js.map +1 -1
  80. package/out/concepts/utils/asserts.d.ts +3 -258
  81. package/out/concepts/utils/asserts.js +13 -351
  82. package/out/concepts/utils/asserts.js.map +1 -1
  83. package/out/concepts/utils/types.d.ts +3 -20
  84. package/out/generator/genBundleFiles.js +11 -25
  85. package/out/generator/genBundleFiles.js.map +1 -1
  86. package/out/generator/genReleaseBody.js +3 -12
  87. package/out/generator/genReleaseBody.js.map +1 -1
  88. package/out/generator/permission.js +3 -3
  89. package/out/generator/permission.js.map +1 -1
  90. package/out/natural/transformTSCode.js +1 -1
  91. package/out/natural/transformTSCode.js.map +1 -1
  92. package/out/server/extendBaseNode.js +22 -6
  93. package/out/server/extendBaseNode.js.map +1 -1
  94. package/out/server/getLogics.js +27 -62
  95. package/out/server/getLogics.js.map +1 -1
  96. package/out/server/getMemberIdentifier.js +1 -6
  97. package/out/server/getMemberIdentifier.js.map +1 -1
  98. package/out/server/naslServer.js +11 -28
  99. package/out/server/naslServer.js.map +1 -1
  100. package/out/server/translator.js +1 -6
  101. package/out/server/translator.js.map +1 -1
  102. package/out/service/storage/init.js +26 -2
  103. package/out/service/storage/init.js.map +1 -1
  104. package/out/templator/genCreateBlock.js +6 -6
  105. package/out/templator/genCreateBlock.js.map +1 -1
  106. package/out/templator/genCurdEditMultipleKeyBlock.js +16 -16
  107. package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
  108. package/out/templator/genCurdMultipleKeyBlock.d.ts +27 -0
  109. package/out/templator/genCurdMultipleKeyBlock.js +709 -37
  110. package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
  111. package/out/templator/genGetBlock.js +4 -4
  112. package/out/templator/genGetBlock.js.map +1 -1
  113. package/out/templator/genGridViewBlock.js +12 -12
  114. package/out/templator/genGridViewBlock.js.map +1 -1
  115. package/out/templator/genListViewBlock.js +4 -4
  116. package/out/templator/genListViewBlock.js.map +1 -1
  117. package/out/templator/genSelectBlock.js +3 -3
  118. package/out/templator/genSelectBlock.js.map +1 -1
  119. package/out/templator/genTableBlock.d.ts +2 -0
  120. package/out/templator/genTableBlock.js +124 -11
  121. package/out/templator/genTableBlock.js.map +1 -1
  122. package/out/templator/genUpdateBlock.js +8 -8
  123. package/out/templator/genUpdateBlock.js.map +1 -1
  124. package/out/templator/utils.d.ts +2 -2
  125. package/out/templator/utils.js.map +1 -1
  126. package/out/translator/utils.js +18 -0
  127. package/out/translator/utils.js.map +1 -1
  128. package/out/utils/i18nInfo.js +2 -7
  129. package/out/utils/i18nInfo.js.map +1 -1
  130. package/package.json +2 -2
  131. package/src/bak/translator.js +43 -121
  132. package/src/breakpoint/generator/BreakpointNode.ts +0 -12
  133. package/src/breakpoint/shared/constants.ts +0 -1
  134. package/src/breakpoint/shared/utils.ts +10 -37
  135. package/src/common/BaseNode.ts +60 -22
  136. package/src/common/Command.ts +1 -0
  137. package/src/common/EventEmitter.ts +1 -6
  138. package/src/concepts/App__.ts +251 -139
  139. package/src/concepts/BackendVariable__.ts +2 -10
  140. package/src/concepts/BindAttribute__.ts +6 -15
  141. package/src/concepts/BindDirective__.ts +4 -19
  142. package/src/concepts/BindEvent__.ts +12 -40
  143. package/src/concepts/CallFunction__.ts +2 -10
  144. package/src/concepts/CallLogic__.ts +32 -45
  145. package/src/concepts/Constant__.ts +7 -5
  146. package/src/concepts/Destination__.ts +4 -6
  147. package/src/concepts/End__.ts +0 -1
  148. package/src/concepts/Entity__.ts +3 -1
  149. package/src/concepts/Event__.ts +0 -70
  150. package/src/concepts/Frontend__.ts +251 -3
  151. package/src/concepts/Identifier__.ts +13 -29
  152. package/src/concepts/LogicItem__.ts +0 -1
  153. package/src/concepts/Logic__.ts +14 -21
  154. package/src/concepts/MemberExpression__.ts +3 -3
  155. package/src/concepts/NewComposite__.ts +6 -4
  156. package/src/concepts/Param__.ts +3 -11
  157. package/src/concepts/ProcessElement__.ts +1 -8
  158. package/src/concepts/Return__.ts +12 -15
  159. package/src/concepts/Variable__.ts +9 -17
  160. package/src/concepts/ViewElement__.ts +54 -166
  161. package/src/concepts/View__.ts +6 -8
  162. package/src/concepts/index__.ts +0 -5
  163. package/src/concepts/utils/asserts.ts +4 -367
  164. package/src/concepts/utils/types.ts +0 -28
  165. package/src/generator/genBundleFiles.ts +15 -33
  166. package/src/generator/genReleaseBody.ts +3 -14
  167. package/src/generator/permission.ts +6 -8
  168. package/src/natural/transformTSCode.ts +1 -1
  169. package/src/server/extendBaseNode.ts +41 -22
  170. package/src/server/getLogics.ts +41 -79
  171. package/src/server/getMemberIdentifier.ts +1 -7
  172. package/src/server/naslServer.ts +12 -30
  173. package/src/server/translator.ts +1 -7
  174. package/src/service/storage/init.ts +33 -2
  175. package/src/templator/genCreateBlock.ts +6 -6
  176. package/src/templator/genCurdEditMultipleKeyBlock.ts +16 -16
  177. package/src/templator/genCurdMultipleKeyBlock.ts +817 -93
  178. package/src/templator/genGetBlock.ts +4 -4
  179. package/src/templator/genGridViewBlock.ts +12 -12
  180. package/src/templator/genListViewBlock.ts +4 -4
  181. package/src/templator/genSelectBlock.ts +3 -3
  182. package/src/templator/genTableBlock.ts +137 -12
  183. package/src/templator/genUpdateBlock.ts +8 -8
  184. package/src/templator/utils.ts +2 -2
  185. package/src/translator/utils.ts +20 -0
  186. package/src/utils/i18nInfo.ts +2 -7
  187. package/test/concepts/call-function/fixtures/from-string.json +59 -68
  188. package/test/concepts/call-function/fixtures/to-string-global-tz.json +58 -67
  189. package/test/concepts/call-function/fixtures/to-string-no-tz.json +48 -57
  190. package/test/concepts/call-function/fixtures/to-string-user-tz.json +60 -69
  191. package/test/concepts/call-function/fixtures/to-string-utc-tz.json +60 -69
  192. package/test/concepts/call-interface/fixtures/only-interface.json +72 -81
  193. package/test/concepts/call-interface/fixtures/with-body-complex-argument.json +214 -223
  194. package/test/concepts/call-interface/fixtures/with-body-no-argument.json +76 -85
  195. package/test/concepts/call-interface/fixtures/with-body-simple-argument.json +91 -100
  196. package/test/concepts/call-interface/fixtures/with-headers-no-argument.json +79 -88
  197. package/test/concepts/call-interface/fixtures/with-headers.json +81 -90
  198. package/test/concepts/call-interface/fixtures/with-query-no-argument.json +79 -88
  199. package/test/concepts/call-interface/fixtures/with-query.json +81 -90
  200. package/test/concepts/call-logic/__snapshots__/getQuickInfoOffset.spec.ts.snap +2 -4
  201. package/test/concepts/call-logic/fixtures/entries-get-with-arguments.json +95 -104
  202. package/test/concepts/call-logic/fixtures/entries-update-with-arguments.json +200 -209
  203. package/test/concepts/call-logic/fixtures/global-logic-argument-no-expression.json +88 -97
  204. package/test/concepts/call-logic/fixtures/global-logic-argument-some-expression.json +115 -124
  205. package/test/concepts/call-logic/fixtures/json-deserialize.json +111 -120
  206. package/test/concepts/call-logic/fixtures/json-serialize-with-string.json +115 -124
  207. package/test/concepts/call-logic/fixtures/json-serialize.json +115 -124
  208. package/test/concepts/call-logic/fixtures/view-buildin-logic-with-argument.json +82 -91
  209. package/test/concepts/call-logic/fixtures/view-component-logic-no-argument.json +79 -88
  210. package/test/concepts/call-logic/fixtures/view-component-with-validation.json +135 -144
  211. package/test/concepts/identifier/fixtures/view-variable.json +136 -145
  212. package/test/concepts/view-element/__snapshots__/toVue.spec.ts.snap +1 -1
  213. package/test/concepts/view-element/fixtures/default-login.json +212 -221
  214. package/test/concepts/view-element/fixtures/default-not-found.json +174 -183
  215. package/test/concepts/view-element/fixtures/with-role-auth.json +82 -91
  216. package/test/concepts/view-element/fixtures/with-table.json +1834 -1843
  217. package/test/concepts/view-element/toVue.spec.ts +0 -1
  218. package/ts-worker/package.json +1 -1
  219. package/out/concepts/BusinessComponent__.d.ts +0 -641
  220. package/out/concepts/BusinessComponent__.js +0 -1901
  221. package/out/concepts/BusinessComponent__.js.map +0 -1
  222. package/out/concepts/BusinessLogic__.d.ts +0 -38
  223. package/out/concepts/BusinessLogic__.js +0 -358
  224. package/out/concepts/BusinessLogic__.js.map +0 -1
  225. package/out/concepts/CallEvent__.d.ts +0 -97
  226. package/out/concepts/CallEvent__.js +0 -263
  227. package/out/concepts/CallEvent__.js.map +0 -1
  228. package/out/concepts/FrontendType__.d.ts +0 -308
  229. package/out/concepts/FrontendType__.js +0 -605
  230. package/out/concepts/FrontendType__.js.map +0 -1
  231. package/out/concepts/ParamWithGroup__.d.ts +0 -39
  232. package/out/concepts/ParamWithGroup__.js +0 -85
  233. package/out/concepts/ParamWithGroup__.js.map +0 -1
  234. package/src/concepts/BusinessComponent__.ts +0 -2669
  235. package/src/concepts/BusinessLogic__.ts +0 -376
  236. package/src/concepts/CallEvent__.ts +0 -334
  237. package/src/concepts/FrontendType__.ts +0 -919
  238. package/src/concepts/ParamWithGroup__.ts +0 -101
@@ -68,14 +68,14 @@ export function genH5GetTemplate(entity: Entity, nameGroup: NameGroup) {
68
68
  }
69
69
 
70
70
  export function genGetBlock(entity: Entity, oldNode: ViewElement) {
71
- const likeComponent = oldNode?.likeComponent;
71
+ const { view } = oldNode;
72
72
  const { ns } = entity;
73
73
  const getLogic = ns?.logics?.find((logic) => logic.name === `get`);
74
74
 
75
75
  const nameGroup: NameGroup = {};
76
- nameGroup.viewParamId = likeComponent.getParamUniqueName('id');
77
- nameGroup.viewVariableEntity = likeComponent.getVariableUniqueName(utils.firstLowerCase(entity.name));
78
- nameGroup.viewLogicLoad = likeComponent.getLogicUniqueName('load');
76
+ nameGroup.viewParamId = view.getParamUniqueName('id');
77
+ nameGroup.viewVariableEntity = view.getVariableUniqueName(utils.firstLowerCase(entity.name));
78
+ nameGroup.viewLogicLoad = view.getLogicUniqueName('load');
79
79
 
80
80
  return `<template>
81
81
  ${config.scope === 'h5' ? genH5GetTemplate(entity, nameGroup) : genGetTemplate(entity, nameGroup)}
@@ -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 likeComponent = oldNode?.likeComponent;
248
+ const { view } = oldNode;
249
249
  const dataSource = entity.parentNode as DataSource;
250
250
  const module = dataSource.app;
251
251
 
252
- const viewElementMainView = likeComponent.getViewElementUniqueName('gridView');
253
- const nameGroup = genUniqueQueryNameGroup(module, likeComponent, viewElementMainView);
252
+ const viewElementMainView = view.getViewElementUniqueName('gridView');
253
+ const nameGroup = genUniqueQueryNameGroup(module, view, viewElementMainView);
254
254
  nameGroup.viewElementMainView = viewElementMainView;
255
- nameGroup.viewVariableEntity = likeComponent.getVariableUniqueName(utils.firstLowerCase(entity.name));
256
- nameGroup.viewLogicRemove = likeComponent.getLogicUniqueName('remove');
257
- nameGroup.viewVariableFilter = likeComponent.getVariableUniqueName('filter');
255
+ nameGroup.viewVariableEntity = view.getVariableUniqueName(utils.firstLowerCase(entity.name));
256
+ nameGroup.viewLogicRemove = view.getLogicUniqueName('remove');
257
+ nameGroup.viewVariableFilter = view.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 likeComponent = oldNode?.likeComponent;
297
+ const { view } = oldNode;
298
298
  const { entity } = property;
299
299
  const dataSource = entity.parentNode as DataSource;
300
300
  const module = dataSource.app;
301
301
 
302
- const viewElementMainView = likeComponent.getViewElementUniqueName('gridView');
303
- const nameGroup = genUniqueQueryNameGroup(module, likeComponent, viewElementMainView);
302
+ const viewElementMainView = view.getViewElementUniqueName('gridView');
303
+ const nameGroup = genUniqueQueryNameGroup(module, view, viewElementMainView);
304
304
  nameGroup.viewElementMainView = viewElementMainView;
305
- nameGroup.viewVariableEntity = likeComponent.getVariableUniqueName(utils.firstLowerCase(entity.name));
306
- nameGroup.viewLogicRemove = likeComponent.getLogicUniqueName('remove');
307
- nameGroup.viewVariableFilter = likeComponent.getVariableUniqueName('filter');
305
+ nameGroup.viewVariableEntity = view.getVariableUniqueName(utils.firstLowerCase(entity.name));
306
+ nameGroup.viewLogicRemove = view.getLogicUniqueName('remove');
307
+ nameGroup.viewVariableFilter = view.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 likeComponent = oldNode?.likeComponent;
97
+ const { view } = oldNode;
98
98
  const dataSource = entity.parentNode as DataSource;
99
99
  const module = dataSource.app;
100
100
 
101
- const viewElementMainView = likeComponent.getViewElementUniqueName('listView');
102
- const nameGroup = genUniqueQueryNameGroup(module, likeComponent, viewElementMainView, false);
101
+ const viewElementMainView = view.getViewElementUniqueName('listView');
102
+ const nameGroup = genUniqueQueryNameGroup(module, view, viewElementMainView, false);
103
103
  nameGroup.viewElementMainView = viewElementMainView;
104
- nameGroup.viewVariableEntity = likeComponent.getVariableUniqueName(utils.firstLowerCase(entity.name));
104
+ nameGroup.viewVariableEntity = view.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 likeComponent = oldNode?.likeComponent;
107
+ const { view } = oldNode;
108
108
  const dataSource = entity.parentNode as DataSource;
109
109
  const module = dataSource.app;
110
110
 
111
- const viewElementMainView = likeComponent.getViewElementUniqueName('select');
112
- const nameGroup = genUniqueQueryNameGroup(module, likeComponent, viewElementMainView, false);
111
+ const viewElementMainView = view.getViewElementUniqueName('select');
112
+ const nameGroup = genUniqueQueryNameGroup(module, view, viewElementMainView, false);
113
113
  nameGroup.viewElementMainView = viewElementMainView;
114
114
  nameGroup.lowerEntity = utils.firstLowerCase(entity.name);
115
115
 
@@ -62,7 +62,7 @@ export function genTableColumnTemplate(property: EntityProperty, currentName: st
62
62
  * @param entity 实体
63
63
  * @param nameGroup 命名组
64
64
  */
65
- export function genTableTemplate(entity: Entity, nameGroup: NameGroup,newLogic: any, modifyable?: boolean, entryFromCall?: string) {
65
+ export function genTableTemplate(entity: Entity, nameGroup: NameGroup, newLogic: any, modifyable?: boolean, entryFromCall?: string) {
66
66
  const currentName = nameGroup.currentName || 'current';
67
67
  const properties = entity.properties.filter(filterProperty('inTable'));
68
68
  let dataSourceValue = `(params) => ${newLogic.name}(elements.$ce.page, elements.$ce.size,elements.$ce.sort,elements.$ce.order)`;
@@ -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 likeComponent = oldNode?.likeComponent;
201
+ const { view } = oldNode;
202
202
  const dataSource = entity.parentNode as DataSource;
203
203
  const module = dataSource.app;
204
204
 
205
- const viewElementMainView = likeComponent.getViewElementUniqueName('tableView');
206
- const nameGroup = genUniqueQueryNameGroup(module, likeComponent, viewElementMainView);
205
+ const viewElementMainView = view.getViewElementUniqueName('tableView');
206
+ const nameGroup = genUniqueQueryNameGroup(module, view, viewElementMainView);
207
207
  nameGroup.viewElementMainView = viewElementMainView;
208
- nameGroup.viewVariableEntity = likeComponent.getVariableUniqueName(utils.firstLowerCase(entity.name));
209
- nameGroup.viewLogicRemove = likeComponent.getLogicUniqueName('remove');
208
+ nameGroup.viewVariableEntity = view.getVariableUniqueName(utils.firstLowerCase(entity.name));
209
+ nameGroup.viewLogicRemove = view.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 likeComponent = oldNode?.likeComponent;
248
+ const { view } = oldNode;
249
249
  const { entity } = property;
250
250
  const dataSource = entity.parentNode as DataSource;
251
251
  const module = dataSource.app;
252
252
 
253
- const viewElementMainView = likeComponent.getViewElementUniqueName('tableView');
254
- const nameGroup = genUniqueQueryNameGroup(module, likeComponent, viewElementMainView);
253
+ const viewElementMainView = view.getViewElementUniqueName('tableView');
254
+ const nameGroup = genUniqueQueryNameGroup(module, view, viewElementMainView);
255
255
  nameGroup.viewElementMainView = viewElementMainView;
256
- nameGroup.viewVariableEntity = likeComponent.getVariableUniqueName(utils.firstLowerCase(entity.name));
257
- nameGroup.viewLogicRemove = likeComponent.getLogicUniqueName('remove');
256
+ nameGroup.viewVariableEntity = view.getVariableUniqueName(utils.firstLowerCase(entity.name));
257
+ nameGroup.viewLogicRemove = view.getLogicUniqueName('remove');
258
258
 
259
259
  // 收集所有和本实体关联的实体
260
260
  const entitySet: Set<Entity> = new Set();
@@ -277,7 +277,9 @@ export function genTableColumnBlock(property: EntityProperty, oldNode: ViewEleme
277
277
  let dataSourceValue = `(params) => ${entityLogic.name}(elements.$ce.page, elements.$ce.size,elements.$ce.sort,elements.$ce.order)`;
278
278
  return `
279
279
  <template>
280
- <u-table-view ref="${nameGroup.viewElementMainView}" :data-source="${dataSourceValue}" :pagination="true" :page-size="20" :page-number="1" :show-sizer="true" data-schema="${nameGroup.structure}">
280
+ <u-table-view ref="${
281
+ nameGroup.viewElementMainView
282
+ }" :data-source="${dataSourceValue}" :pagination="true" :page-size="20" :page-number="1" :show-sizer="true" data-schema="${nameGroup.structure}">
281
283
  ${properties.map((property) => `${genTableColumnTemplate(property)}\n`).join('')}
282
284
  </u-table-view>
283
285
  </template>
@@ -294,3 +296,126 @@ export function genTableColumnBlock(property: EntityProperty, oldNode: ViewEleme
294
296
  }
295
297
 
296
298
  export default genTableBlock;
299
+
300
+ export function genTableTemplateTableDesigner(
301
+ entity: Entity,
302
+ nameGroup: NameGroup,
303
+ newLogic: any,
304
+ modifyable?: boolean,
305
+ entryFromCall?: string,
306
+ optionsMap?: any
307
+ ) {
308
+ const currentName = nameGroup.currentName || 'current';
309
+ const properties = entity.properties.filter(filterProperty('inTable'));
310
+ let dataSourceValue = `(params) => ${newLogic.name}(elements.$ce.page, elements.$ce.size,elements.$ce.sort,elements.$ce.order)`;
311
+ if (['genCurdMultipleKeyBlock'].includes(entryFromCall)) {
312
+ dataSourceValue = `(params) => ${newLogic.name}(elements.$ce.page, elements.$ce.size,elements.$ce.sort,elements.$ce.order,${nameGroup.viewVariableFilter})`;
313
+ }
314
+ return `
315
+ <u-linear-layout style="background: #fff; padding: 15px" >
316
+ <u-button color="primary" @click="${nameGroup.viewLogicCreate}" style="margin-right: 5px" icon="add">新 增</u-button>
317
+ <u-uploader
318
+ style="--custom-start: auto;margin-right: 5px"
319
+ display="inline"
320
+ url="/api/${entity.name.toLowerCase()}/import"
321
+ url-field="filePath"
322
+ :limit="999"
323
+ max-size="50MB"
324
+ converter="json"
325
+ :file-icon-switcher="false"
326
+ :download-icon-switcher="false"
327
+ :file-size="false"
328
+ :show-file-list="false"
329
+ name="file"
330
+ accept=""
331
+ @success="${nameGroup.viewLogicReload}"
332
+ >
333
+ <template #file-list>
334
+ <i-ico
335
+ style="margin: 0px 8px 0px 0px"
336
+ flag="file-icon"
337
+ name="file-default"
338
+ icotype="only"
339
+ ></i-ico>
340
+ <u-text
341
+ style="
342
+ margin: 0px 8px 0px 0px;
343
+ white-space: nowrap;
344
+ overflow: hidden;
345
+ text-overflow: ellipsis;
346
+ display: inherit;
347
+ "
348
+ flag="file-name"
349
+ text="文件名称"
350
+ ></u-text>
351
+ <u-text style="margin: 0px 8px 0px 0px" flag="file-size" text="文件大小"></u-text>
352
+ <i-ico
353
+ style="margin: 0px 8px 0px 0px"
354
+ flag="download-icon"
355
+ name="download"
356
+ icotype="only"
357
+ ></i-ico>
358
+ </template>
359
+ <u-button color="default" icon="upload" text="上传"></u-button
360
+ ></u-uploader>
361
+ <u-button style="margin-right: 5px" icon="download" @click="${nameGroup.viewLogicExportData}">导 出</u-button>
362
+ <u-table-view ref="${nameGroup.viewElementMainView}" :data-source="${dataSourceValue}" data-schema="${nameGroup.structure}"
363
+ value-field="${nameGroup.viewVariableEntity}.id"
364
+ :pagination="true" :show-sizer="true" :page-size="20" :page-number="1" style="margin-top: 12px">
365
+ <u-table-view-column type="index" width="60"><template #title><u-text text="序号"></u-text></template><template #cell="current"></template></u-table-view-column>
366
+ ${properties.map((property) => `${genTableColumnTemplateTableDesigner(property, currentName, optionsMap)}\n`).join('')}
367
+ <u-table-view-column title="操作">
368
+ <template #title><u-text text="操作"></u-text></template>
369
+ <template #cell="current">
370
+ <u-link style="margin-right:5px;" @click="${nameGroup.viewLogicPreview}">详情</u-link>
371
+ <u-link ${modifyable ? `@click="${nameGroup.viewLogicModify || 'modify'}"` : ''} style="margin-right:5px;">编辑</u-link>
372
+ <u-link style="margin-right:5px;" @click="${nameGroup.viewLogicOpenDelModal}">删除</u-link>
373
+ </template>
374
+ </u-table-view-column>
375
+ </u-table-view>
376
+ </u-linear-layout>
377
+
378
+ `;
379
+ }
380
+
381
+ export const genTableColumnTemplateTableDesigner = (property: EntityProperty, currentName: string = 'current', optionsMap?: any) => {
382
+ const { entity } = property;
383
+ const hasOptions = optionsMap?.[property.name];
384
+
385
+ const dataSource = entity.parentNode as DataSource;
386
+ const lowerEntityName = utils.firstLowerCase(entity.name);
387
+ let valueExpression = `${currentName}.item.${lowerEntityName}.${property.name}`;
388
+ const title = (property.label || property.name).replace(/"/g, '&quot;');
389
+ const multiple = property?.typeAnnotation?.typeName === 'List';
390
+
391
+ if (property.relationEntity) {
392
+ const relationLowerEntityName = utils.firstLowerCase(property.relationEntity);
393
+ const relationEntity = dataSource?.findEntityByName(property.relationEntity);
394
+ const displayedProperty = getFirstDisplayedProperty(relationEntity);
395
+ valueExpression = `${currentName}.item.${relationLowerEntityName}.${displayedProperty?.name || property.relationProperty}`;
396
+ }
397
+
398
+ const getText = (property: EntityProperty) => {
399
+ if (hasOptions) {
400
+ const options = optionsMap[property.name];
401
+ return `
402
+ <u-select :preview="true" :value="${valueExpression}" placeholder="--" ${multiple ? 'multiple' : ''}>
403
+ ${options.map((option: any) => `<u-select-item value="${option.value}" text="${option.label}">${option.label}</u-select-item>`)}
404
+ </u-select>
405
+ `;
406
+ } else if (property.typeAnnotation.typeName === 'Boolean') {
407
+ return `
408
+ <u-text v-if="${valueExpression}" text="是"></u-text>
409
+ <u-text v-if="!${valueExpression}" text="否"></u-text>
410
+ `;
411
+ }
412
+ return `<u-text :text="${valueExpression}"></u-text>`;
413
+ };
414
+
415
+ return `<u-table-view-column field="${lowerEntityName}.${property.name}">
416
+ <template #title><u-text text="${title}"></u-text></template>
417
+ <template #cell="current">
418
+ ${getText(property)}
419
+ </template>
420
+ </u-table-view-column>`;
421
+ };
@@ -307,7 +307,7 @@ function genLoadLogic(getLogic: Logic, nameGroup: NameGroup) {
307
307
 
308
308
  // 生成修改区块
309
309
  export function genUpdateBlock(entity: Entity, oldNode: ViewElement) {
310
- const likeComponent = oldNode?.likeComponent;
310
+ const { view } = oldNode;
311
311
  const dataSource = entity.parentNode as DataSource;
312
312
  const module = dataSource.app;
313
313
  const { ns } = entity;
@@ -315,11 +315,11 @@ export function genUpdateBlock(entity: Entity, oldNode: ViewElement) {
315
315
  const updateLogic = ns?.logics?.find((logic) => logic.name === `update`);
316
316
 
317
317
  const nameGroup: NameGroup = {};
318
- nameGroup.viewElementMainView = likeComponent.getViewElementUniqueName('form1');
319
- nameGroup.viewVariableEntity = likeComponent.getVariableUniqueName(utils.firstLowerCase(entity.name));
320
- nameGroup.viewParamId = likeComponent.getParamUniqueName('id');
321
- nameGroup.viewLogicLoad = likeComponent.getLogicUniqueName('load');
322
- nameGroup.viewLogicSubmit = likeComponent.getLogicUniqueName('submit');
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');
323
323
 
324
324
  // 收集所有和本实体关联的实体
325
325
  const selectNameGroupMap: Map<string, NameGroup> = new Map();
@@ -332,8 +332,8 @@ export function genUpdateBlock(entity: Entity, oldNode: ViewElement) {
332
332
  if (relationEntity) {
333
333
  const displayedProperty = getFirstDisplayedProperty(relationEntity);
334
334
  if (displayedProperty) {
335
- const viewElementSelect = likeComponent.getViewElementUniqueName('select');
336
- const selectNameGroup = genUniqueQueryNameGroup(module, likeComponent, viewElementSelect, false, relationEntity.name);
335
+ const viewElementSelect = view.getViewElementUniqueName('select');
336
+ const selectNameGroup = genUniqueQueryNameGroup(module, view, viewElementSelect, false, relationEntity.name);
337
337
  selectNameGroup.viewElementSelect = viewElementSelect;
338
338
  // 存在多个属性关联同一个实体的情况,因此加上属性名用以唯一标识
339
339
  const key = [property.name, relationEntity.name].join('-');
@@ -1,5 +1,5 @@
1
1
  import { utils } from '..';
2
- import { App, Module, Entity, EntityProperty, Logic, View, Namespace, TypeAnnotation, BusinessComponent } from '../concepts';
2
+ import { App, Module, Entity, EntityProperty, Logic, View, Namespace, TypeAnnotation } from '../concepts';
3
3
 
4
4
  export const filterProperty = (key: 'inTable' | 'inFilter' | 'inForm' | 'inDetail') => (property: EntityProperty) => {
5
5
  if (property.display) {
@@ -131,7 +131,7 @@ function capFirstLetter(word: string) {
131
131
  */
132
132
  export function genUniqueQueryNameGroup(
133
133
  scope: App | Module | Namespace,
134
- view: View | BusinessComponent,
134
+ view: View,
135
135
  componentName: string = '',
136
136
  defaultInView: boolean = true,
137
137
  suffix: string = ''
@@ -58,6 +58,22 @@ export function isSameRange(rangeA: Range, rangeB : Range) {
58
58
  return rangeA.start.offset === rangeB.start.offset && rangeA.end.offset === rangeB.end.offset;
59
59
  }
60
60
 
61
+ const statementMap = [
62
+ "Assignment",
63
+ "BatchAssignment",
64
+ "IfStatement",
65
+ "ForEachStatement",
66
+ "SwitchStatement",
67
+ "WhileStatement",
68
+ "Match",
69
+ "Comment",
70
+ "CallLogic",
71
+ "CallInterface",
72
+ "Destination",
73
+ "JSBlock",
74
+ 'JavaLogic'
75
+ ];
76
+
61
77
  /**
62
78
  * 翻译方法修饰器
63
79
  *
@@ -115,6 +131,10 @@ export function withSourceMap() {
115
131
  end: shiftPosition(state.position, code),
116
132
  });
117
133
 
134
+ if (isNatural && statementMap?.includes(this.concept) && code) {
135
+ before += `// nodePath: '${this.nodePath}' \n`;
136
+ }
137
+
118
138
  return before + code;
119
139
  };
120
140
 
@@ -1,19 +1,14 @@
1
1
  export const languageList = [
2
2
  {
3
3
  id: 'en-US',
4
- name: 'English',
5
- title: '英语',
4
+ name: 'English (United States)',
5
+ title: '英语(美国)',
6
6
  },
7
7
  {
8
8
  id: 'fr-FR',
9
9
  name: 'Français',
10
10
  title: '法语',
11
11
  },
12
- {
13
- id: 'ko-KR',
14
- name: '한국어',
15
- title: '韩语',
16
- },
17
12
  {
18
13
  id: 'zh-CN',
19
14
  name: '中文 (简体)',
@@ -14,86 +14,77 @@
14
14
  "enums": [],
15
15
  "logics": [],
16
16
  "interfaces": [],
17
- "frontendTypes": [
17
+ "frontends": [
18
18
  {
19
- "concept": "FrontendType",
19
+ "concept": "Frontend",
20
20
  "name": "pc",
21
- "kind": "pc",
22
- "frontends": [
21
+ "title": "PC端",
22
+ "type": "pc",
23
+ "path": "/",
24
+ "documentTitle": null,
25
+ "documentIcon": null,
26
+ "views": [
23
27
  {
24
- "concept": "Frontend",
25
- "name": "pc",
26
- "title": "PC端",
27
- "type": "pc",
28
- "path": "/",
29
- "documentTitle": null,
30
- "documentIcon": null,
31
- "views": [
28
+ "concept": "View",
29
+ "changedTime": 1691568444284,
30
+ "name": "test",
31
+ "title": "测试",
32
+ "crumb": null,
33
+ "auth": false,
34
+ "isIndex": true,
35
+ "script": "",
36
+ "params": [],
37
+ "variables": [],
38
+ "logics": [
32
39
  {
33
- "concept": "View",
34
- "changedTime": 1691568444284,
35
- "name": "test",
36
- "title": "测试",
37
- "crumb": null,
38
- "auth": false,
39
- "isIndex": true,
40
- "script": "",
41
- "params": [],
42
- "variables": [],
43
- "logics": [
40
+ "__$Selected": true,
41
+ "concept": "CallFunction",
42
+ "name": "",
43
+ "label": "内置函数",
44
+ "folded": false,
45
+ "offsetX": 361.90234375,
46
+ "offsetY": 198.10546875,
47
+ "calleeNamespace": "nasl.util",
48
+ "calleeName": "FromString",
49
+ "typeArguments": [
44
50
  {
45
- "__$Selected": true,
46
- "concept": "CallFunction",
51
+ "concept": "TypeAnnotation",
47
52
  "name": "",
48
- "label": "内置函数",
49
- "folded": false,
50
- "offsetX": 361.90234375,
51
- "offsetY": 198.10546875,
52
- "calleeNamespace": "nasl.util",
53
- "calleeName": "FromString",
54
- "typeArguments": [
55
- {
56
- "concept": "TypeAnnotation",
57
- "name": "",
58
- "typeKind": "primitive",
59
- "typeNamespace": "nasl.core",
60
- "typeName": "Boolean",
61
- "typeArguments": null,
62
- "returnType": null,
63
- "properties": null
64
- }
65
- ],
66
- "arguments": [
67
- {
68
- "concept": "Argument",
69
- "name": "",
70
- "folded": false,
71
- "keyword": "value",
72
- "expression": {
73
- "concept": "Identifier",
74
- "name": "str",
75
- "folded": false
76
- }
77
- }
78
- ]
53
+ "typeKind": "primitive",
54
+ "typeNamespace": "nasl.core",
55
+ "typeName": "Boolean",
56
+ "typeArguments": null,
57
+ "returnType": null,
58
+ "properties": null
79
59
  }
80
60
  ],
81
- "bindEvents": [],
82
- "bindRoles": [],
83
- "children": []
61
+ "arguments": [
62
+ {
63
+ "concept": "Argument",
64
+ "name": "",
65
+ "folded": false,
66
+ "keyword": "value",
67
+ "expression": {
68
+ "concept": "Identifier",
69
+ "name": "str",
70
+ "folded": false
71
+ }
72
+ }
73
+ ]
84
74
  }
85
75
  ],
86
- "variables": [],
87
- "theme": {
88
- "concept": "Theme",
89
- "name": "",
90
- "title": "默认主题样式",
91
- "variableMap": {}
92
- },
93
- "componentDependencies": []
76
+ "bindEvents": [],
77
+ "bindRoles": [],
78
+ "children": []
94
79
  }
95
80
  ],
96
- "businessComponents": [],
81
+ "variables": [],
82
+ "theme": {
83
+ "concept": "Theme",
84
+ "name": "",
85
+ "title": "默认主题样式",
86
+ "variableMap": {}
87
+ },
97
88
  "componentDependencies": []
98
89
  }
99
90
  ],