@lcap/nasl 0.3.9-beta

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 (881) hide show
  1. package/DEVELOPMENT.md +58 -0
  2. package/README.md +11 -0
  3. package/analysis/mergeBlock/README.md +14 -0
  4. package/analysis/mergeBlock/raw1.json +0 -0
  5. package/analysis/mergeBlock/raw2.json +2522 -0
  6. package/analysis/mergeBlock/raw3.json +505 -0
  7. package/analysis/mergeBlock/req2.json +2219 -0
  8. package/analysis/mergeBlock/req3.json +462 -0
  9. package/analysis/mergeBlock/script.js +159 -0
  10. package/docs/assets/css/main.css +2638 -0
  11. package/docs/assets/js/main.js +248 -0
  12. package/docs/assets/js/search.js +1 -0
  13. package/docs/classes/app_app.app.html +1359 -0
  14. package/docs/classes/app_service.microservice.html +1572 -0
  15. package/docs/classes/app_service.service.html +1233 -0
  16. package/docs/classes/app_service.webservice.html +1635 -0
  17. package/docs/classes/common_eventemitter.eventemitter.html +387 -0
  18. package/docs/classes/common_vertex.vertex.html +1086 -0
  19. package/docs/classes/data_datanode.datanode.html +1157 -0
  20. package/docs/classes/data_entity.entity.html +1656 -0
  21. package/docs/classes/data_entityproperty.entityproperty.html +1903 -0
  22. package/docs/classes/data_enum.enum.html +1402 -0
  23. package/docs/classes/data_enumitem.enumitem.html +1252 -0
  24. package/docs/classes/data_interface.interface.html +1673 -0
  25. package/docs/classes/data_structure.structure.html +1427 -0
  26. package/docs/classes/data_structureproperty.structureproperty.html +1656 -0
  27. package/docs/classes/logic_basevariable.basevariable.html +1261 -0
  28. package/docs/classes/logic_logic.logic.html +1639 -0
  29. package/docs/classes/logic_logicitem.expressionnode.html +1982 -0
  30. package/docs/classes/logic_logicitem.logicitem.html +1828 -0
  31. package/docs/classes/logic_logicitem.logicnode.html +2229 -0
  32. package/docs/classes/logic_param.param.html +1707 -0
  33. package/docs/classes/logic_return.return.html +1605 -0
  34. package/docs/classes/logic_variable.variable.html +1631 -0
  35. package/docs/classes/nuims_nuims.nuims.html +596 -0
  36. package/docs/classes/page_attr.attr.html +1335 -0
  37. package/docs/classes/page_block.block.html +1272 -0
  38. package/docs/classes/page_directive.directive.html +1350 -0
  39. package/docs/classes/page_element.element.html +2118 -0
  40. package/docs/classes/page_event.event.html +1284 -0
  41. package/docs/classes/page_lifecycle.lifecycle.html +1286 -0
  42. package/docs/classes/page_page.page.html +1389 -0
  43. package/docs/classes/page_view.view.html +2299 -0
  44. package/docs/classes/page_viewparam.viewparam.html +1727 -0
  45. package/docs/classes/page_viewvariable.viewvariable.html +1668 -0
  46. package/docs/classes/process_process.process.html +1532 -0
  47. package/docs/classes/process_processcomponent.processcomponent.html +1589 -0
  48. package/docs/classes/process_processcomponentattribute.processcomponentattribute.html +1236 -0
  49. package/docs/classes/process_processcomponentproperty.processcomponentproperty.html +1727 -0
  50. package/docs/classes/process_processcomponentreturn.processcomponentreturn.html +1704 -0
  51. package/docs/classes/process_processcomponentvariable.processcomponentvariable.html +1679 -0
  52. package/docs/classes/process_processinterface.processinterface.html +1462 -0
  53. package/docs/classes/process_processparam.processparam.html +1778 -0
  54. package/docs/classes/process_processproperty.processproperty.html +1727 -0
  55. package/docs/classes/process_processreturn.processreturn.html +1678 -0
  56. package/docs/enums/app_service.service_type.html +186 -0
  57. package/docs/enums/data_basictypes.basic_type.html +312 -0
  58. package/docs/enums/index.level_enum.html +655 -0
  59. package/docs/enums/logic_logicitem.logic_type.html +441 -0
  60. package/docs/index.html +313 -0
  61. package/docs/interfaces/app_service.assetsinfo.html +209 -0
  62. package/docs/interfaces/common_packagejson.default.html +431 -0
  63. package/docs/interfaces/data_entity.resolver.html +228 -0
  64. package/docs/interfaces/data_entityproperty.display.html +214 -0
  65. package/docs/interfaces/data_schema.arrayschema.html +306 -0
  66. package/docs/interfaces/data_schema.baseschema.html +361 -0
  67. package/docs/interfaces/data_schema.basicrefschema.html +362 -0
  68. package/docs/interfaces/data_schema.basicschema.html +334 -0
  69. package/docs/interfaces/data_schema.booleanschema.html +306 -0
  70. package/docs/interfaces/data_schema.enumitemschema.html +225 -0
  71. package/docs/interfaces/data_schema.enumschema.html +306 -0
  72. package/docs/interfaces/data_schema.integerschema.html +334 -0
  73. package/docs/interfaces/data_schema.mapschema.html +320 -0
  74. package/docs/interfaces/data_schema.numberschema.html +334 -0
  75. package/docs/interfaces/data_schema.objectschema.html +313 -0
  76. package/docs/interfaces/data_schema.refschema.html +332 -0
  77. package/docs/interfaces/data_schema.schema.html +511 -0
  78. package/docs/interfaces/data_schema.setschema.html +306 -0
  79. package/docs/interfaces/data_schema.stringschema.html +334 -0
  80. package/docs/interfaces/history.historyrecord.html +183 -0
  81. package/docs/interfaces/index.arrayschema.html +261 -0
  82. package/docs/interfaces/index.baseschema.html +236 -0
  83. package/docs/interfaces/index.basicrefschema.html +317 -0
  84. package/docs/interfaces/index.basicschema.html +289 -0
  85. package/docs/interfaces/index.booleanschema.html +261 -0
  86. package/docs/interfaces/index.enumitemschema.html +180 -0
  87. package/docs/interfaces/index.enumschema.html +261 -0
  88. package/docs/interfaces/index.integerschema.html +289 -0
  89. package/docs/interfaces/index.mapschema.html +275 -0
  90. package/docs/interfaces/index.numberschema.html +289 -0
  91. package/docs/interfaces/index.objectschema.html +261 -0
  92. package/docs/interfaces/index.refschema.html +287 -0
  93. package/docs/interfaces/index.schema.html +459 -0
  94. package/docs/interfaces/index.setschema.html +261 -0
  95. package/docs/interfaces/index.stringschema.html +289 -0
  96. package/docs/interfaces/page_element.elementtovueoptions.html +283 -0
  97. package/docs/interfaces/typecheck.typecheckrecord.html +211 -0
  98. package/docs/interfaces/utils.inode.html +212 -0
  99. package/docs/interfaces/utils.inodeinfo.html +295 -0
  100. package/docs/interfaces/utils_traverse.inode.html +191 -0
  101. package/docs/interfaces/utils_traverse.inodeinfo.html +274 -0
  102. package/docs/modules/app_app.html +149 -0
  103. package/docs/modules/app_service.html +175 -0
  104. package/docs/modules/cachedata.html +198 -0
  105. package/docs/modules/common_eventemitter.html +192 -0
  106. package/docs/modules/common_packagejson.html +132 -0
  107. package/docs/modules/common_vertex.html +149 -0
  108. package/docs/modules/config.html +168 -0
  109. package/docs/modules/data_basictypes.html +271 -0
  110. package/docs/modules/data_datanode.html +149 -0
  111. package/docs/modules/data_datatypes.html +196 -0
  112. package/docs/modules/data_datatypeutils.html +430 -0
  113. package/docs/modules/data_entity.html +158 -0
  114. package/docs/modules/data_entityproperty.html +158 -0
  115. package/docs/modules/data_entityutils.html +342 -0
  116. package/docs/modules/data_enum.html +149 -0
  117. package/docs/modules/data_enumitem.html +149 -0
  118. package/docs/modules/data_interface.html +149 -0
  119. package/docs/modules/data_schema.html +205 -0
  120. package/docs/modules/data_structure.html +149 -0
  121. package/docs/modules/data_structureproperty.html +149 -0
  122. package/docs/modules/data_systemtypes.html +167 -0
  123. package/docs/modules/decorators.html +333 -0
  124. package/docs/modules/eventbus.html +116 -0
  125. package/docs/modules/generator.html +749 -0
  126. package/docs/modules/generator_data.html +495 -0
  127. package/docs/modules/generator_hotreload.html +200 -0
  128. package/docs/modules/generator_load.html +247 -0
  129. package/docs/modules/generator_page.html +200 -0
  130. package/docs/modules/history.html +200 -0
  131. package/docs/modules/index.html +1163 -0
  132. package/docs/modules/logic_basevariable.html +238 -0
  133. package/docs/modules/logic_callinterface.html +116 -0
  134. package/docs/modules/logic_logic.html +149 -0
  135. package/docs/modules/logic_logicitem.html +220 -0
  136. package/docs/modules/logic_param.html +149 -0
  137. package/docs/modules/logic_return.html +149 -0
  138. package/docs/modules/logic_tools.html +326 -0
  139. package/docs/modules/logic_translator.html +158 -0
  140. package/docs/modules/logic_variable.html +149 -0
  141. package/docs/modules/nuims_nuims.html +149 -0
  142. package/docs/modules/page_attr.html +149 -0
  143. package/docs/modules/page_block.html +149 -0
  144. package/docs/modules/page_directive.html +149 -0
  145. package/docs/modules/page_element.html +158 -0
  146. package/docs/modules/page_event.html +149 -0
  147. package/docs/modules/page_lifecycle.html +149 -0
  148. package/docs/modules/page_page.html +149 -0
  149. package/docs/modules/page_view.html +149 -0
  150. package/docs/modules/page_viewparam.html +149 -0
  151. package/docs/modules/page_viewvariable.html +149 -0
  152. package/docs/modules/process_process.html +149 -0
  153. package/docs/modules/process_processcomponent.html +149 -0
  154. package/docs/modules/process_processcomponentattribute.html +149 -0
  155. package/docs/modules/process_processcomponentproperty.html +149 -0
  156. package/docs/modules/process_processcomponentreturn.html +149 -0
  157. package/docs/modules/process_processcomponentvariable.html +149 -0
  158. package/docs/modules/process_processinterface.html +149 -0
  159. package/docs/modules/process_processparam.html +149 -0
  160. package/docs/modules/process_processproperty.html +149 -0
  161. package/docs/modules/process_processreturn.html +149 -0
  162. package/docs/modules/typecheck.html +269 -0
  163. package/docs/modules/utils.html +536 -0
  164. package/docs/modules/utils_logger.html +172 -0
  165. package/docs/modules/utils_string.html +347 -0
  166. package/docs/modules/utils_traverse.html +248 -0
  167. package/docs/modules.html +377 -0
  168. package/docs-build/style.css +3 -0
  169. package/docs-build/typedoc.json +8 -0
  170. package/index.js +12 -0
  171. package/module/base.js +11 -0
  172. package/out/service/app/api.d.ts +75 -0
  173. package/out/service/app/api.js +87 -0
  174. package/out/service/app/api.js.map +1 -0
  175. package/out/service/app/index.d.ts +2 -0
  176. package/out/service/app/index.js +10 -0
  177. package/out/service/app/index.js.map +1 -0
  178. package/out/service/assets/asset.d.ts +104 -0
  179. package/out/service/assets/asset.js +78 -0
  180. package/out/service/assets/asset.js.map +1 -0
  181. package/out/service/assets/block.d.ts +9 -0
  182. package/out/service/assets/block.js +11 -0
  183. package/out/service/assets/block.js.map +1 -0
  184. package/out/service/assets/index.d.ts +2 -0
  185. package/out/service/assets/index.js +12 -0
  186. package/out/service/assets/index.js.map +1 -0
  187. package/out/service/common/findUsage.d.ts +9 -0
  188. package/out/service/common/findUsage.js +11 -0
  189. package/out/service/common/findUsage.js.map +1 -0
  190. package/out/service/common/index.d.ts +2 -0
  191. package/out/service/common/index.js +12 -0
  192. package/out/service/common/index.js.map +1 -0
  193. package/out/service/common/preprocess.d.ts +14 -0
  194. package/out/service/common/preprocess.js +75 -0
  195. package/out/service/common/preprocess.js.map +1 -0
  196. package/out/service/common/schema.d.ts +9 -0
  197. package/out/service/common/schema.js +12 -0
  198. package/out/service/common/schema.js.map +1 -0
  199. package/out/service/create/add.configs.d.ts +1 -0
  200. package/out/service/create/add.configs.js +68 -0
  201. package/out/service/create/add.configs.js.map +1 -0
  202. package/out/service/create/errHandles.d.ts +18 -0
  203. package/out/service/create/errHandles.js +40 -0
  204. package/out/service/create/errHandles.js.map +1 -0
  205. package/out/service/create/index.d.ts +1 -0
  206. package/out/service/create/index.js +72 -0
  207. package/out/service/create/index.js.map +1 -0
  208. package/out/service/data/api.d.ts +36 -0
  209. package/out/service/data/api.js +36 -0
  210. package/out/service/data/api.js.map +1 -0
  211. package/out/service/data/entity.d.ts +135 -0
  212. package/out/service/data/entity.js +103 -0
  213. package/out/service/data/entity.js.map +1 -0
  214. package/out/service/data/enum.d.ts +63 -0
  215. package/out/service/data/enum.js +55 -0
  216. package/out/service/data/enum.js.map +1 -0
  217. package/out/service/data/enumProperty.d.ts +28 -0
  218. package/out/service/data/enumProperty.js +23 -0
  219. package/out/service/data/enumProperty.js.map +1 -0
  220. package/out/service/data/generic.d.ts +9 -0
  221. package/out/service/data/generic.js +11 -0
  222. package/out/service/data/generic.js.map +1 -0
  223. package/out/service/data/index.d.ts +8 -0
  224. package/out/service/data/index.js +23 -0
  225. package/out/service/data/index.js.map +1 -0
  226. package/out/service/data/interface.d.ts +67 -0
  227. package/out/service/data/interface.js +58 -0
  228. package/out/service/data/interface.js.map +1 -0
  229. package/out/service/data/structure.d.ts +92 -0
  230. package/out/service/data/structure.js +77 -0
  231. package/out/service/data/structure.js.map +1 -0
  232. package/out/service/logic/index.d.ts +2 -0
  233. package/out/service/logic/index.js +14 -0
  234. package/out/service/logic/index.js.map +1 -0
  235. package/out/service/logic/logic.d.ts +121 -0
  236. package/out/service/logic/logic.js +90 -0
  237. package/out/service/logic/logic.js.map +1 -0
  238. package/out/service/logic/param.d.ts +37 -0
  239. package/out/service/logic/param.js +29 -0
  240. package/out/service/logic/param.js.map +1 -0
  241. package/out/service/nuims/api.d.ts +264 -0
  242. package/out/service/nuims/api.js +194 -0
  243. package/out/service/nuims/api.js.map +1 -0
  244. package/out/service/nuims/index.d.ts +2 -0
  245. package/out/service/nuims/index.js +17 -0
  246. package/out/service/nuims/index.js.map +1 -0
  247. package/out/service/page/api.d.ts +186 -0
  248. package/out/service/page/api.js +1376 -0
  249. package/out/service/page/api.js.map +1 -0
  250. package/out/service/page/attribute.d.ts +28 -0
  251. package/out/service/page/attribute.js +23 -0
  252. package/out/service/page/attribute.js.map +1 -0
  253. package/out/service/page/directive.d.ts +28 -0
  254. package/out/service/page/directive.js +23 -0
  255. package/out/service/page/directive.js.map +1 -0
  256. package/out/service/page/element.d.ts +36 -0
  257. package/out/service/page/element.js +36 -0
  258. package/out/service/page/element.js.map +1 -0
  259. package/out/service/page/event.d.ts +28 -0
  260. package/out/service/page/event.js +23 -0
  261. package/out/service/page/event.js.map +1 -0
  262. package/out/service/page/index.d.ts +8 -0
  263. package/out/service/page/index.js +23 -0
  264. package/out/service/page/index.js.map +1 -0
  265. package/out/service/page/lifecycle.d.ts +28 -0
  266. package/out/service/page/lifecycle.js +23 -0
  267. package/out/service/page/lifecycle.js.map +1 -0
  268. package/out/service/page/templates.d.ts +14 -0
  269. package/out/service/page/templates.js +70 -0
  270. package/out/service/page/templates.js.map +1 -0
  271. package/out/service/page/view.d.ts +130 -0
  272. package/out/service/page/view.js +116 -0
  273. package/out/service/page/view.js.map +1 -0
  274. package/out/service/process/api.d.ts +136 -0
  275. package/out/service/process/api.js +95 -0
  276. package/out/service/process/api.js.map +1 -0
  277. package/out/service/process/index.d.ts +2 -0
  278. package/out/service/process/index.js +10 -0
  279. package/out/service/process/index.js.map +1 -0
  280. package/out/service/undoredo/api.d.ts +36 -0
  281. package/out/service/undoredo/api.js +29 -0
  282. package/out/service/undoredo/api.js.map +1 -0
  283. package/out/service/undoredo/index.d.ts +2 -0
  284. package/out/service/undoredo/index.js +10 -0
  285. package/out/service/undoredo/index.js.map +1 -0
  286. package/out/service/webFile/api.d.ts +45 -0
  287. package/out/service/webFile/api.js +35 -0
  288. package/out/service/webFile/api.js.map +1 -0
  289. package/out/service/webFile/index.d.ts +3 -0
  290. package/out/service/webFile/index.js +27 -0
  291. package/out/service/webFile/index.js.map +1 -0
  292. package/out/service/webFile/loadCache.d.ts +18 -0
  293. package/out/service/webFile/loadCache.js +17 -0
  294. package/out/service/webFile/loadCache.js.map +1 -0
  295. package/out/test/fixtures/env.d.ts +5 -0
  296. package/out/test/fixtures/env.js +21 -0
  297. package/out/test/fixtures/env.js.map +1 -0
  298. package/out/test/units/app/App.spec.d.ts +1 -0
  299. package/out/test/units/app/App.spec.js +17 -0
  300. package/out/test/units/app/App.spec.js.map +1 -0
  301. package/out/test/units/app/Service.spec.d.ts +1 -0
  302. package/out/test/units/app/Service.spec.js +24 -0
  303. package/out/test/units/app/Service.spec.js.map +1 -0
  304. package/out/test/units/common/Vertex.spec.d.ts +1 -0
  305. package/out/test/units/common/Vertex.spec.js +44 -0
  306. package/out/test/units/common/Vertex.spec.js.map +1 -0
  307. package/out/test/units/config.spec.d.ts +1 -0
  308. package/out/test/units/config.spec.js +12 -0
  309. package/out/test/units/config.spec.js.map +1 -0
  310. package/out/test/units/data/Entity.spec.d.ts +1 -0
  311. package/out/test/units/data/Entity.spec.js +12 -0
  312. package/out/test/units/data/Entity.spec.js.map +1 -0
  313. package/out/test/units/login.spec.d.ts +1 -0
  314. package/out/test/units/login.spec.js +12 -0
  315. package/out/test/units/login.spec.js.map +1 -0
  316. package/out/test/units/page/Block.spec.d.ts +1 -0
  317. package/out/test/units/page/Block.spec.js +34 -0
  318. package/out/test/units/page/Block.spec.js.map +1 -0
  319. package/out/test/units/page/Element.spec.d.ts +1 -0
  320. package/out/test/units/page/Element.spec.js +44 -0
  321. package/out/test/units/page/Element.spec.js.map +1 -0
  322. package/out/test/units/temp/temp.spec.d.ts +1 -0
  323. package/out/test/units/temp/temp.spec.js +68 -0
  324. package/out/test/units/temp/temp.spec.js.map +1 -0
  325. package/out/types/app/App.d.ts +135 -0
  326. package/out/types/app/App.js +304 -0
  327. package/out/types/app/App.js.map +1 -0
  328. package/out/types/app/History.d.ts +36 -0
  329. package/out/types/app/History.js +365 -0
  330. package/out/types/app/History.js.map +1 -0
  331. package/out/types/app/Service.d.ts +247 -0
  332. package/out/types/app/Service.js +846 -0
  333. package/out/types/app/Service.js.map +1 -0
  334. package/out/types/cacheData.d.ts +4 -0
  335. package/out/types/cacheData.js +34 -0
  336. package/out/types/cacheData.js.map +1 -0
  337. package/out/types/common/ComponentAPI.d.ts +110 -0
  338. package/out/types/common/ComponentAPI.js +3 -0
  339. package/out/types/common/ComponentAPI.js.map +1 -0
  340. package/out/types/common/EventEmitter.d.ts +29 -0
  341. package/out/types/common/EventEmitter.js +66 -0
  342. package/out/types/common/EventEmitter.js.map +1 -0
  343. package/out/types/common/PackageJSON.d.ts +32 -0
  344. package/out/types/common/PackageJSON.js +3 -0
  345. package/out/types/common/PackageJSON.js.map +1 -0
  346. package/out/types/common/Vertex.d.ts +125 -0
  347. package/out/types/common/Vertex.js +283 -0
  348. package/out/types/common/Vertex.js.map +1 -0
  349. package/out/types/config.d.ts +24 -0
  350. package/out/types/config.js +22 -0
  351. package/out/types/config.js.map +1 -0
  352. package/out/types/data/DataNode.d.ts +24 -0
  353. package/out/types/data/DataNode.js +52 -0
  354. package/out/types/data/DataNode.js.map +1 -0
  355. package/out/types/data/Entity.d.ts +121 -0
  356. package/out/types/data/Entity.js +528 -0
  357. package/out/types/data/Entity.js.map +1 -0
  358. package/out/types/data/EntityIndex.d.ts +87 -0
  359. package/out/types/data/EntityIndex.js +262 -0
  360. package/out/types/data/EntityIndex.js.map +1 -0
  361. package/out/types/data/EntityProperty.d.ts +191 -0
  362. package/out/types/data/EntityProperty.js +568 -0
  363. package/out/types/data/EntityProperty.js.map +1 -0
  364. package/out/types/data/Enum.d.ts +92 -0
  365. package/out/types/data/Enum.js +262 -0
  366. package/out/types/data/Enum.js.map +1 -0
  367. package/out/types/data/EnumItem.d.ts +57 -0
  368. package/out/types/data/EnumItem.js +170 -0
  369. package/out/types/data/EnumItem.js.map +1 -0
  370. package/out/types/data/GlobalLogicNode.d.ts +44 -0
  371. package/out/types/data/GlobalLogicNode.js +194 -0
  372. package/out/types/data/GlobalLogicNode.js.map +1 -0
  373. package/out/types/data/Interface.d.ts +153 -0
  374. package/out/types/data/Interface.js +480 -0
  375. package/out/types/data/Interface.js.map +1 -0
  376. package/out/types/data/Schema.d.ts +121 -0
  377. package/out/types/data/Schema.js +3 -0
  378. package/out/types/data/Schema.js.map +1 -0
  379. package/out/types/data/Structure.d.ts +104 -0
  380. package/out/types/data/Structure.js +319 -0
  381. package/out/types/data/Structure.js.map +1 -0
  382. package/out/types/data/StructureProperty.d.ts +134 -0
  383. package/out/types/data/StructureProperty.js +380 -0
  384. package/out/types/data/StructureProperty.js.map +1 -0
  385. package/out/types/data/basicTypes.d.ts +25 -0
  386. package/out/types/data/basicTypes.js +77 -0
  387. package/out/types/data/basicTypes.js.map +1 -0
  388. package/out/types/data/dataTypeUtils.d.ts +94 -0
  389. package/out/types/data/dataTypeUtils.js +441 -0
  390. package/out/types/data/dataTypeUtils.js.map +1 -0
  391. package/out/types/data/dataTypes.d.ts +21 -0
  392. package/out/types/data/dataTypes.js +64 -0
  393. package/out/types/data/dataTypes.js.map +1 -0
  394. package/out/types/data/entityUtils.d.ts +164 -0
  395. package/out/types/data/entityUtils.js +632 -0
  396. package/out/types/data/entityUtils.js.map +1 -0
  397. package/out/types/data/genBlock/builtInFunctions.json +545 -0
  398. package/out/types/data/genBlock/genCallComponentLogic.d.ts +20 -0
  399. package/out/types/data/genBlock/genCallComponentLogic.js +32 -0
  400. package/out/types/data/genBlock/genCallComponentLogic.js.map +1 -0
  401. package/out/types/data/genBlock/genCallInterface.d.ts +41 -0
  402. package/out/types/data/genBlock/genCallInterface.js +86 -0
  403. package/out/types/data/genBlock/genCallInterface.js.map +1 -0
  404. package/out/types/data/genBlock/genCreateBlock.d.ts +10 -0
  405. package/out/types/data/genBlock/genCreateBlock.js +313 -0
  406. package/out/types/data/genBlock/genCreateBlock.js.map +1 -0
  407. package/out/types/data/genBlock/genCurdBlock.d.ts +4 -0
  408. package/out/types/data/genBlock/genCurdBlock.js +648 -0
  409. package/out/types/data/genBlock/genCurdBlock.js.map +1 -0
  410. package/out/types/data/genBlock/genEnumSelectBlock.d.ts +10 -0
  411. package/out/types/data/genBlock/genEnumSelectBlock.js +23 -0
  412. package/out/types/data/genBlock/genEnumSelectBlock.js.map +1 -0
  413. package/out/types/data/genBlock/genGetBlock.d.ts +6 -0
  414. package/out/types/data/genBlock/genGetBlock.js +151 -0
  415. package/out/types/data/genBlock/genGetBlock.js.map +1 -0
  416. package/out/types/data/genBlock/genGridViewBlock.d.ts +136 -0
  417. package/out/types/data/genBlock/genGridViewBlock.js +263 -0
  418. package/out/types/data/genBlock/genGridViewBlock.js.map +1 -0
  419. package/out/types/data/genBlock/genListViewBlock.d.ts +63 -0
  420. package/out/types/data/genBlock/genListViewBlock.js +110 -0
  421. package/out/types/data/genBlock/genListViewBlock.js.map +1 -0
  422. package/out/types/data/genBlock/genQueryComponent.d.ts +316 -0
  423. package/out/types/data/genBlock/genQueryComponent.js +470 -0
  424. package/out/types/data/genBlock/genQueryComponent.js.map +1 -0
  425. package/out/types/data/genBlock/genSelectBlock.d.ts +63 -0
  426. package/out/types/data/genBlock/genSelectBlock.js +106 -0
  427. package/out/types/data/genBlock/genSelectBlock.js.map +1 -0
  428. package/out/types/data/genBlock/genTableBlock.d.ts +136 -0
  429. package/out/types/data/genBlock/genTableBlock.js +255 -0
  430. package/out/types/data/genBlock/genTableBlock.js.map +1 -0
  431. package/out/types/data/genBlock/genUpdateBlock.d.ts +6 -0
  432. package/out/types/data/genBlock/genUpdateBlock.js +384 -0
  433. package/out/types/data/genBlock/genUpdateBlock.js.map +1 -0
  434. package/out/types/data/genBlock/index.d.ts +15 -0
  435. package/out/types/data/genBlock/index.js +29 -0
  436. package/out/types/data/genBlock/index.js.map +1 -0
  437. package/out/types/data/genBlock/utils.d.ts +92 -0
  438. package/out/types/data/genBlock/utils.js +187 -0
  439. package/out/types/data/genBlock/utils.js.map +1 -0
  440. package/out/types/data/genericTypes.d.ts +40 -0
  441. package/out/types/data/genericTypes.js +145 -0
  442. package/out/types/data/genericTypes.js.map +1 -0
  443. package/out/types/data/systemTypes.d.ts +9 -0
  444. package/out/types/data/systemTypes.js +1516 -0
  445. package/out/types/data/systemTypes.js.map +1 -0
  446. package/out/types/decorators/index.d.ts +25 -0
  447. package/out/types/decorators/index.js +57 -0
  448. package/out/types/decorators/index.js.map +1 -0
  449. package/out/types/eventBus.d.ts +1 -0
  450. package/out/types/eventBus.js +5 -0
  451. package/out/types/eventBus.js.map +1 -0
  452. package/out/types/generator/data.d.ts +36 -0
  453. package/out/types/generator/data.js +197 -0
  454. package/out/types/generator/data.js.map +1 -0
  455. package/out/types/generator/hotReload.d.ts +12 -0
  456. package/out/types/generator/hotReload.js +39 -0
  457. package/out/types/generator/hotReload.js.map +1 -0
  458. package/out/types/generator/index.d.ts +4 -0
  459. package/out/types/generator/index.js +17 -0
  460. package/out/types/generator/index.js.map +1 -0
  461. package/out/types/generator/load.d.ts +8 -0
  462. package/out/types/generator/load.js +92 -0
  463. package/out/types/generator/load.js.map +1 -0
  464. package/out/types/generator/page.d.ts +11 -0
  465. package/out/types/generator/page.js +42 -0
  466. package/out/types/generator/page.js.map +1 -0
  467. package/out/types/history.d.ts +10 -0
  468. package/out/types/history.js +13 -0
  469. package/out/types/history.js.map +1 -0
  470. package/out/types/index.d.ts +142 -0
  471. package/out/types/index.js +221 -0
  472. package/out/types/index.js.map +1 -0
  473. package/out/types/logic/BaseVariable.d.ts +75 -0
  474. package/out/types/logic/BaseVariable.js +159 -0
  475. package/out/types/logic/BaseVariable.js.map +1 -0
  476. package/out/types/logic/CallInterface.d.ts +1 -0
  477. package/out/types/logic/CallInterface.js +9 -0
  478. package/out/types/logic/CallInterface.js.map +1 -0
  479. package/out/types/logic/Logic.d.ts +148 -0
  480. package/out/types/logic/Logic.js +481 -0
  481. package/out/types/logic/Logic.js.map +1 -0
  482. package/out/types/logic/LogicItem.d.ts +319 -0
  483. package/out/types/logic/LogicItem.js +1278 -0
  484. package/out/types/logic/LogicItem.js.map +1 -0
  485. package/out/types/logic/Param.d.ts +85 -0
  486. package/out/types/logic/Param.js +357 -0
  487. package/out/types/logic/Param.js.map +1 -0
  488. package/out/types/logic/Return.d.ts +73 -0
  489. package/out/types/logic/Return.js +326 -0
  490. package/out/types/logic/Return.js.map +1 -0
  491. package/out/types/logic/Variable.d.ts +72 -0
  492. package/out/types/logic/Variable.js +317 -0
  493. package/out/types/logic/Variable.js.map +1 -0
  494. package/out/types/logic/expressions/BinaryExpression.d.ts +27 -0
  495. package/out/types/logic/expressions/BinaryExpression.js +56 -0
  496. package/out/types/logic/expressions/BinaryExpression.js.map +1 -0
  497. package/out/types/logic/expressions/BooleanLiteral.d.ts +19 -0
  498. package/out/types/logic/expressions/BooleanLiteral.js +42 -0
  499. package/out/types/logic/expressions/BooleanLiteral.js.map +1 -0
  500. package/out/types/logic/expressions/Identifier.d.ts +28 -0
  501. package/out/types/logic/expressions/Identifier.js +57 -0
  502. package/out/types/logic/expressions/Identifier.js.map +1 -0
  503. package/out/types/logic/expressions/LogicalExpression.d.ts +27 -0
  504. package/out/types/logic/expressions/LogicalExpression.js +56 -0
  505. package/out/types/logic/expressions/LogicalExpression.js.map +1 -0
  506. package/out/types/logic/expressions/MemberExpression.d.ts +23 -0
  507. package/out/types/logic/expressions/MemberExpression.js +52 -0
  508. package/out/types/logic/expressions/MemberExpression.js.map +1 -0
  509. package/out/types/logic/expressions/NullLiteral.d.ts +15 -0
  510. package/out/types/logic/expressions/NullLiteral.js +35 -0
  511. package/out/types/logic/expressions/NullLiteral.js.map +1 -0
  512. package/out/types/logic/expressions/NumericLiteral.d.ts +19 -0
  513. package/out/types/logic/expressions/NumericLiteral.js +42 -0
  514. package/out/types/logic/expressions/NumericLiteral.js.map +1 -0
  515. package/out/types/logic/expressions/StringLiteral.d.ts +19 -0
  516. package/out/types/logic/expressions/StringLiteral.js +42 -0
  517. package/out/types/logic/expressions/StringLiteral.js.map +1 -0
  518. package/out/types/logic/expressions/UnaryExpression.d.ts +23 -0
  519. package/out/types/logic/expressions/UnaryExpression.js +49 -0
  520. package/out/types/logic/expressions/UnaryExpression.js.map +1 -0
  521. package/out/types/logic/expressions/Unparsed.d.ts +19 -0
  522. package/out/types/logic/expressions/Unparsed.js +42 -0
  523. package/out/types/logic/expressions/Unparsed.js.map +1 -0
  524. package/out/types/logic/nodes/AssignmentExpression.d.ts +23 -0
  525. package/out/types/logic/nodes/AssignmentExpression.js +49 -0
  526. package/out/types/logic/nodes/AssignmentExpression.js.map +1 -0
  527. package/out/types/logic/nodes/BuiltInFuncParam.d.ts +27 -0
  528. package/out/types/logic/nodes/BuiltInFuncParam.js +56 -0
  529. package/out/types/logic/nodes/BuiltInFuncParam.js.map +1 -0
  530. package/out/types/logic/nodes/BuiltInFunction.d.ts +24 -0
  531. package/out/types/logic/nodes/BuiltInFunction.js +55 -0
  532. package/out/types/logic/nodes/BuiltInFunction.js.map +1 -0
  533. package/out/types/logic/nodes/CallConsoleLog.d.ts +19 -0
  534. package/out/types/logic/nodes/CallConsoleLog.js +42 -0
  535. package/out/types/logic/nodes/CallConsoleLog.js.map +1 -0
  536. package/out/types/logic/nodes/CallGraphQL.d.ts +28 -0
  537. package/out/types/logic/nodes/CallGraphQL.js +56 -0
  538. package/out/types/logic/nodes/CallGraphQL.js.map +1 -0
  539. package/out/types/logic/nodes/CallInterParam.d.ts +23 -0
  540. package/out/types/logic/nodes/CallInterParam.js +49 -0
  541. package/out/types/logic/nodes/CallInterParam.js.map +1 -0
  542. package/out/types/logic/nodes/CallInterface.d.ts +24 -0
  543. package/out/types/logic/nodes/CallInterface.js +49 -0
  544. package/out/types/logic/nodes/CallInterface.js.map +1 -0
  545. package/out/types/logic/nodes/CallLogic.d.ts +24 -0
  546. package/out/types/logic/nodes/CallLogic.js +55 -0
  547. package/out/types/logic/nodes/CallLogic.js.map +1 -0
  548. package/out/types/logic/nodes/CallMessageShow.d.ts +27 -0
  549. package/out/types/logic/nodes/CallMessageShow.js +56 -0
  550. package/out/types/logic/nodes/CallMessageShow.js.map +1 -0
  551. package/out/types/logic/nodes/Comment.d.ts +19 -0
  552. package/out/types/logic/nodes/Comment.js +42 -0
  553. package/out/types/logic/nodes/Comment.js.map +1 -0
  554. package/out/types/logic/nodes/CronJob.d.ts +19 -0
  555. package/out/types/logic/nodes/CronJob.js +42 -0
  556. package/out/types/logic/nodes/CronJob.js.map +1 -0
  557. package/out/types/logic/nodes/DBQuery.d.ts +19 -0
  558. package/out/types/logic/nodes/DBQuery.js +42 -0
  559. package/out/types/logic/nodes/DBQuery.js.map +1 -0
  560. package/out/types/logic/nodes/Destination.d.ts +32 -0
  561. package/out/types/logic/nodes/Destination.js +73 -0
  562. package/out/types/logic/nodes/Destination.js.map +1 -0
  563. package/out/types/logic/nodes/DestinationParam.d.ts +24 -0
  564. package/out/types/logic/nodes/DestinationParam.js +49 -0
  565. package/out/types/logic/nodes/DestinationParam.js.map +1 -0
  566. package/out/types/logic/nodes/End.d.ts +15 -0
  567. package/out/types/logic/nodes/End.js +36 -0
  568. package/out/types/logic/nodes/End.js.map +1 -0
  569. package/out/types/logic/nodes/ForEachStatement.d.ts +40 -0
  570. package/out/types/logic/nodes/ForEachStatement.js +77 -0
  571. package/out/types/logic/nodes/ForEachStatement.js.map +1 -0
  572. package/out/types/logic/nodes/IfStatement.d.ts +27 -0
  573. package/out/types/logic/nodes/IfStatement.js +56 -0
  574. package/out/types/logic/nodes/IfStatement.js.map +1 -0
  575. package/out/types/logic/nodes/JSBlock.d.ts +19 -0
  576. package/out/types/logic/nodes/JSBlock.js +46 -0
  577. package/out/types/logic/nodes/JSBlock.js.map +1 -0
  578. package/out/types/logic/nodes/JSONDeserialize.d.ts +19 -0
  579. package/out/types/logic/nodes/JSONDeserialize.js +42 -0
  580. package/out/types/logic/nodes/JSONDeserialize.js.map +1 -0
  581. package/out/types/logic/nodes/JSONSerialize.d.ts +19 -0
  582. package/out/types/logic/nodes/JSONSerialize.js +42 -0
  583. package/out/types/logic/nodes/JSONSerialize.js.map +1 -0
  584. package/out/types/logic/nodes/ProcessOutcome.d.ts +27 -0
  585. package/out/types/logic/nodes/ProcessOutcome.js +56 -0
  586. package/out/types/logic/nodes/ProcessOutcome.js.map +1 -0
  587. package/out/types/logic/nodes/Start.d.ts +15 -0
  588. package/out/types/logic/nodes/Start.js +35 -0
  589. package/out/types/logic/nodes/Start.js.map +1 -0
  590. package/out/types/logic/nodes/SwitchCase.d.ts +23 -0
  591. package/out/types/logic/nodes/SwitchCase.js +49 -0
  592. package/out/types/logic/nodes/SwitchCase.js.map +1 -0
  593. package/out/types/logic/nodes/SwitchStatement.d.ts +20 -0
  594. package/out/types/logic/nodes/SwitchStatement.js +42 -0
  595. package/out/types/logic/nodes/SwitchStatement.js.map +1 -0
  596. package/out/types/logic/nodes/TypeNote.d.ts +19 -0
  597. package/out/types/logic/nodes/TypeNote.js +42 -0
  598. package/out/types/logic/nodes/TypeNote.js.map +1 -0
  599. package/out/types/logic/nodes/WhileStatement.d.ts +23 -0
  600. package/out/types/logic/nodes/WhileStatement.js +49 -0
  601. package/out/types/logic/nodes/WhileStatement.js.map +1 -0
  602. package/out/types/logic/tools.d.ts +15 -0
  603. package/out/types/logic/tools.js +164 -0
  604. package/out/types/logic/tools.js.map +1 -0
  605. package/out/types/logic/translator.d.ts +1 -0
  606. package/out/types/logic/translator.js +595 -0
  607. package/out/types/logic/translator.js.map +1 -0
  608. package/out/types/login.d.ts +7 -0
  609. package/out/types/login.js +39 -0
  610. package/out/types/login.js.map +1 -0
  611. package/out/types/nuims/Nuims.d.ts +128 -0
  612. package/out/types/nuims/Nuims.js +439 -0
  613. package/out/types/nuims/Nuims.js.map +1 -0
  614. package/out/types/page/Attr.d.ts +79 -0
  615. package/out/types/page/Attr.js +217 -0
  616. package/out/types/page/Attr.js.map +1 -0
  617. package/out/types/page/Block.d.ts +65 -0
  618. package/out/types/page/Block.js +82 -0
  619. package/out/types/page/Block.js.map +1 -0
  620. package/out/types/page/Directive.d.ts +78 -0
  621. package/out/types/page/Directive.js +202 -0
  622. package/out/types/page/Directive.js.map +1 -0
  623. package/out/types/page/Element.d.ts +239 -0
  624. package/out/types/page/Element.js +1322 -0
  625. package/out/types/page/Element.js.map +1 -0
  626. package/out/types/page/Event.d.ts +63 -0
  627. package/out/types/page/Event.js +212 -0
  628. package/out/types/page/Event.js.map +1 -0
  629. package/out/types/page/Lifecycle.d.ts +58 -0
  630. package/out/types/page/Lifecycle.js +192 -0
  631. package/out/types/page/Lifecycle.js.map +1 -0
  632. package/out/types/page/Page.d.ts +90 -0
  633. package/out/types/page/Page.js +379 -0
  634. package/out/types/page/Page.js.map +1 -0
  635. package/out/types/page/View.d.ts +235 -0
  636. package/out/types/page/View.js +1065 -0
  637. package/out/types/page/View.js.map +1 -0
  638. package/out/types/page/ViewParam.d.ts +72 -0
  639. package/out/types/page/ViewParam.js +277 -0
  640. package/out/types/page/ViewParam.js.map +1 -0
  641. package/out/types/page/ViewVariable.d.ts +73 -0
  642. package/out/types/page/ViewVariable.js +287 -0
  643. package/out/types/page/ViewVariable.js.map +1 -0
  644. package/out/types/process/Process.d.ts +118 -0
  645. package/out/types/process/Process.js +357 -0
  646. package/out/types/process/Process.js.map +1 -0
  647. package/out/types/process/ProcessComponent.d.ts +133 -0
  648. package/out/types/process/ProcessComponent.js +339 -0
  649. package/out/types/process/ProcessComponent.js.map +1 -0
  650. package/out/types/process/ProcessComponentAttribute.d.ts +63 -0
  651. package/out/types/process/ProcessComponentAttribute.js +163 -0
  652. package/out/types/process/ProcessComponentAttribute.js.map +1 -0
  653. package/out/types/process/ProcessComponentProperty.d.ts +37 -0
  654. package/out/types/process/ProcessComponentProperty.js +81 -0
  655. package/out/types/process/ProcessComponentProperty.js.map +1 -0
  656. package/out/types/process/ProcessComponentReturn.d.ts +77 -0
  657. package/out/types/process/ProcessComponentReturn.js +260 -0
  658. package/out/types/process/ProcessComponentReturn.js.map +1 -0
  659. package/out/types/process/ProcessComponentVariable.d.ts +78 -0
  660. package/out/types/process/ProcessComponentVariable.js +252 -0
  661. package/out/types/process/ProcessComponentVariable.js.map +1 -0
  662. package/out/types/process/ProcessInterface.d.ts +112 -0
  663. package/out/types/process/ProcessInterface.js +227 -0
  664. package/out/types/process/ProcessInterface.js.map +1 -0
  665. package/out/types/process/ProcessParam.d.ts +77 -0
  666. package/out/types/process/ProcessParam.js +259 -0
  667. package/out/types/process/ProcessParam.js.map +1 -0
  668. package/out/types/process/ProcessProperty.d.ts +37 -0
  669. package/out/types/process/ProcessProperty.js +81 -0
  670. package/out/types/process/ProcessProperty.js.map +1 -0
  671. package/out/types/process/ProcessReturn.d.ts +73 -0
  672. package/out/types/process/ProcessReturn.js +237 -0
  673. package/out/types/process/ProcessReturn.js.map +1 -0
  674. package/out/types/typeCheck.d.ts +30 -0
  675. package/out/types/typeCheck.js +81 -0
  676. package/out/types/typeCheck.js.map +1 -0
  677. package/out/types/utils/index.d.ts +25 -0
  678. package/out/types/utils/index.js +81 -0
  679. package/out/types/utils/index.js.map +1 -0
  680. package/out/types/utils/logger.d.ts +3 -0
  681. package/out/types/utils/logger.js +14 -0
  682. package/out/types/utils/logger.js.map +1 -0
  683. package/out/types/utils/string.d.ts +34 -0
  684. package/out/types/utils/string.js +62 -0
  685. package/out/types/utils/string.js.map +1 -0
  686. package/out/types/utils/traverse.d.ts +35 -0
  687. package/out/types/utils/traverse.js +126 -0
  688. package/out/types/utils/traverse.js.map +1 -0
  689. package/package.json +64 -0
  690. package/spec/conceptMap.json +3310 -0
  691. package/spec/spec.yaml +416 -0
  692. package/spec-build/index.ts +98 -0
  693. package/src/routes.map.js +5 -0
  694. package/src/service/app/api.js +84 -0
  695. package/src/service/app/index.d.tmp +16 -0
  696. package/src/service/app/index.js +6 -0
  697. package/src/service/assets/asset.js +76 -0
  698. package/src/service/assets/block.js +8 -0
  699. package/src/service/assets/index.js +7 -0
  700. package/src/service/common/findUsage.js +8 -0
  701. package/src/service/common/index.js +6 -0
  702. package/src/service/common/preprocess.js +54 -0
  703. package/src/service/common/schema.js +9 -0
  704. package/src/service/create/add.configs.js +66 -0
  705. package/src/service/create/errHandles.js +42 -0
  706. package/src/service/create/index.js +74 -0
  707. package/src/service/data/api.js +33 -0
  708. package/src/service/data/entity.js +101 -0
  709. package/src/service/data/enum.js +53 -0
  710. package/src/service/data/enumProperty.js +20 -0
  711. package/src/service/data/generic.js +8 -0
  712. package/src/service/data/index.js +18 -0
  713. package/src/service/data/interface.js +56 -0
  714. package/src/service/data/structure.js +75 -0
  715. package/src/service/logic/index.js +11 -0
  716. package/src/service/logic/logic.js +88 -0
  717. package/src/service/logic/param.js +26 -0
  718. package/src/service/nuims/api.js +192 -0
  719. package/src/service/nuims/index.js +13 -0
  720. package/src/service/page/api.js +1374 -0
  721. package/src/service/page/attribute.js +20 -0
  722. package/src/service/page/directive.js +20 -0
  723. package/src/service/page/element.js +34 -0
  724. package/src/service/page/event.js +20 -0
  725. package/src/service/page/index.js +19 -0
  726. package/src/service/page/lifecycle.js +20 -0
  727. package/src/service/page/templates.ts +72 -0
  728. package/src/service/page/view.js +116 -0
  729. package/src/service/process/api.js +92 -0
  730. package/src/service/process/index.js +6 -0
  731. package/src/service/undoredo/api.js +26 -0
  732. package/src/service/undoredo/index.js +6 -0
  733. package/src/service/webFile/api.js +32 -0
  734. package/src/service/webFile/index.d.tmp +62 -0
  735. package/src/service/webFile/index.js +23 -0
  736. package/src/service/webFile/loadCache.js +14 -0
  737. package/src/test/fixtures/env.ts +21 -0
  738. package/src/test/units/app/App.spec.ts +16 -0
  739. package/src/test/units/app/Service.spec.ts +31 -0
  740. package/src/test/units/common/Vertex.spec.ts +25 -0
  741. package/src/test/units/data/Entity.spec.ts +10 -0
  742. package/src/test/units/login.spec.ts +10 -0
  743. package/src/test/units/page/Block.spec.ts +15 -0
  744. package/src/test/units/page/Element.spec.ts +45 -0
  745. package/src/test/units/page/example.dashboard.html +46 -0
  746. package/src/test/units/page/example.view1.html +63 -0
  747. package/src/test/units/temp/temp.spec.ts +66 -0
  748. package/src/types/app/App.ts +267 -0
  749. package/src/types/app/History.ts +388 -0
  750. package/src/types/app/Service.ts +920 -0
  751. package/src/types/cacheData.ts +33 -0
  752. package/src/types/common/ComponentAPI.ts +103 -0
  753. package/src/types/common/EventEmitter.ts +56 -0
  754. package/src/types/common/PackageJSON.ts +22 -0
  755. package/src/types/common/Vertex.ts +265 -0
  756. package/src/types/config.ts +22 -0
  757. package/src/types/data/DataNode.ts +37 -0
  758. package/src/types/data/Entity.ts +516 -0
  759. package/src/types/data/EntityIndex.ts +238 -0
  760. package/src/types/data/EntityProperty.ts +507 -0
  761. package/src/types/data/Enum.ts +235 -0
  762. package/src/types/data/EnumItem.ts +156 -0
  763. package/src/types/data/GlobalLogicNode.ts +201 -0
  764. package/src/types/data/Interface.ts +435 -0
  765. package/src/types/data/Schema.ts +133 -0
  766. package/src/types/data/Structure.ts +300 -0
  767. package/src/types/data/StructureProperty.ts +332 -0
  768. package/src/types/data/basicTypes.ts +76 -0
  769. package/src/types/data/dataTypeUtils.ts +426 -0
  770. package/src/types/data/dataTypes.ts +68 -0
  771. package/src/types/data/entityUtils.ts +681 -0
  772. package/src/types/data/genBlock/builtInFunctions.json +545 -0
  773. package/src/types/data/genBlock/genCallComponentLogic.ts +28 -0
  774. package/src/types/data/genBlock/genCallInterface.ts +87 -0
  775. package/src/types/data/genBlock/genCreateBlock.ts +306 -0
  776. package/src/types/data/genBlock/genCurdBlock.ts +654 -0
  777. package/src/types/data/genBlock/genEnumSelectBlock.ts +21 -0
  778. package/src/types/data/genBlock/genGetBlock.ts +160 -0
  779. package/src/types/data/genBlock/genGridViewBlock.ts +305 -0
  780. package/src/types/data/genBlock/genListViewBlock.ts +130 -0
  781. package/src/types/data/genBlock/genQueryComponent.ts +492 -0
  782. package/src/types/data/genBlock/genSelectBlock.ts +123 -0
  783. package/src/types/data/genBlock/genTableBlock.ts +300 -0
  784. package/src/types/data/genBlock/genUpdateBlock.ts +391 -0
  785. package/src/types/data/genBlock/index.ts +18 -0
  786. package/src/types/data/genBlock/utils.ts +214 -0
  787. package/src/types/data/genericTypes.ts +147 -0
  788. package/src/types/data/systemTypes.ts +1515 -0
  789. package/src/types/decorators/index.ts +52 -0
  790. package/src/types/generator/data.ts +206 -0
  791. package/src/types/generator/hotReload.ts +31 -0
  792. package/src/types/generator/index.ts +4 -0
  793. package/src/types/generator/load.ts +97 -0
  794. package/src/types/generator/page.ts +37 -0
  795. package/src/types/history.ts +14 -0
  796. package/src/types/index.ts +161 -0
  797. package/src/types/logic/BaseVariable.ts +130 -0
  798. package/src/types/logic/Logic.ts +442 -0
  799. package/src/types/logic/LogicItem.ts +1257 -0
  800. package/src/types/logic/Param.ts +328 -0
  801. package/src/types/logic/Return.ts +305 -0
  802. package/src/types/logic/Variable.ts +294 -0
  803. package/src/types/logic/expressions/BinaryExpression.ts +35 -0
  804. package/src/types/logic/expressions/BooleanLiteral.ts +25 -0
  805. package/src/types/logic/expressions/Identifier.ts +36 -0
  806. package/src/types/logic/expressions/LogicalExpression.ts +35 -0
  807. package/src/types/logic/expressions/MemberExpression.ts +33 -0
  808. package/src/types/logic/expressions/NullLiteral.ts +20 -0
  809. package/src/types/logic/expressions/NumericLiteral.ts +25 -0
  810. package/src/types/logic/expressions/StringLiteral.ts +25 -0
  811. package/src/types/logic/expressions/UnaryExpression.ts +30 -0
  812. package/src/types/logic/expressions/Unparsed.ts +25 -0
  813. package/src/types/logic/nodes/AssignmentExpression.ts +30 -0
  814. package/src/types/logic/nodes/BuiltInFuncParam.ts +35 -0
  815. package/src/types/logic/nodes/BuiltInFunction.ts +39 -0
  816. package/src/types/logic/nodes/CallConsoleLog.ts +25 -0
  817. package/src/types/logic/nodes/CallGraphQL.ts +36 -0
  818. package/src/types/logic/nodes/CallInterParam.ts +30 -0
  819. package/src/types/logic/nodes/CallInterface.ts +31 -0
  820. package/src/types/logic/nodes/CallLogic.ts +39 -0
  821. package/src/types/logic/nodes/CallMessageShow.ts +35 -0
  822. package/src/types/logic/nodes/Comment.ts +25 -0
  823. package/src/types/logic/nodes/CronJob.ts +25 -0
  824. package/src/types/logic/nodes/DBQuery.ts +25 -0
  825. package/src/types/logic/nodes/Destination.ts +52 -0
  826. package/src/types/logic/nodes/DestinationParam.ts +31 -0
  827. package/src/types/logic/nodes/End.ts +21 -0
  828. package/src/types/logic/nodes/ForEachStatement.ts +52 -0
  829. package/src/types/logic/nodes/IfStatement.ts +35 -0
  830. package/src/types/logic/nodes/JSBlock.ts +29 -0
  831. package/src/types/logic/nodes/JSONDeserialize.ts +25 -0
  832. package/src/types/logic/nodes/JSONSerialize.ts +25 -0
  833. package/src/types/logic/nodes/ProcessOutcome.ts +35 -0
  834. package/src/types/logic/nodes/Start.ts +20 -0
  835. package/src/types/logic/nodes/SwitchCase.ts +30 -0
  836. package/src/types/logic/nodes/SwitchStatement.ts +26 -0
  837. package/src/types/logic/nodes/TypeNote.ts +25 -0
  838. package/src/types/logic/nodes/WhileStatement.ts +30 -0
  839. package/src/types/logic/tools.js +170 -0
  840. package/src/types/logic/translator.js +636 -0
  841. package/src/types/logic/translator_backup.js +643 -0
  842. package/src/types/login.ts +36 -0
  843. package/src/types/nuims/Nuims.ts +493 -0
  844. package/src/types/page/Attr.ts +217 -0
  845. package/src/types/page/Block.ts +103 -0
  846. package/src/types/page/Directive.ts +208 -0
  847. package/src/types/page/Element.ts +1320 -0
  848. package/src/types/page/Event.ts +191 -0
  849. package/src/types/page/Lifecycle.ts +172 -0
  850. package/src/types/page/Page.ts +363 -0
  851. package/src/types/page/View.ts +1089 -0
  852. package/src/types/page/ViewParam.ts +265 -0
  853. package/src/types/page/ViewVariable.ts +274 -0
  854. package/src/types/process/Process.ts +306 -0
  855. package/src/types/process/ProcessComponent.ts +276 -0
  856. package/src/types/process/ProcessComponentAttribute.ts +131 -0
  857. package/src/types/process/ProcessComponentProperty.ts +68 -0
  858. package/src/types/process/ProcessComponentReturn.ts +235 -0
  859. package/src/types/process/ProcessComponentVariable.ts +225 -0
  860. package/src/types/process/ProcessInterface.ts +175 -0
  861. package/src/types/process/ProcessParam.ts +234 -0
  862. package/src/types/process/ProcessProperty.ts +69 -0
  863. package/src/types/process/ProcessReturn.ts +210 -0
  864. package/src/types/typeCheck.ts +109 -0
  865. package/src/types/utils/index.ts +82 -0
  866. package/src/types/utils/logger.ts +8 -0
  867. package/src/types/utils/string.ts +56 -0
  868. package/src/types/utils/traverse.ts +160 -0
  869. package/src/views/components/lcap-json-view/README.md +80 -0
  870. package/src/views/components/lcap-json-view/index.js +9 -0
  871. package/src/views/components/lcap-json-view/index.vue +61 -0
  872. package/src/views/components/lcap-json-view/node.vue +328 -0
  873. package/src/views/components/lcap-json-view/utils.js +41 -0
  874. package/src/views/examples/index.vue +44 -0
  875. package/src/views/examples/logic.json +1576 -0
  876. package/src/views/index.vue +28 -0
  877. package/src/views/specification/README.md +10 -0
  878. package/src/views/specification/conceptTree.js +1179 -0
  879. package/src/views/specification/index.vue +255 -0
  880. package/src/views/theme.css +138 -0
  881. package/tsconfig.json +34 -0
@@ -0,0 +1,1320 @@
1
+ // import stringify = require('json-stringify-safe');
2
+ import { action, circular, excludedInJSON, immutable } from '../decorators';
3
+ import { config, history, utils, LEVEL_ENUM, Vertex, PackageJSON, App, Page, DataNode, View, Attr, Directive, Event, ExpressionNode, Logic, dataTypesMap, Entity, LogicItem, ActionOptions, ACTION_MODE, Nuims, Structure } from '..';
4
+ import * as compiler from 'vue-template-compiler';
5
+ import * as json5 from 'json5';
6
+ import { elementService, attributeService, eventService, directiveService } from '../../service/page';
7
+ import { vertexsMap } from '../cacheData';
8
+ import Variable from '../logic/Variable';
9
+ import * as babelParser from '@babel/parser';
10
+ import { traverse } from '../utils';
11
+ import { isPlainObject, cloneDeep } from 'lodash';
12
+
13
+ export interface ElementToVueOptions {
14
+ indentStyle?: 'space' | 'tab';
15
+ tabSize?: number;
16
+ indentLevel?: number;
17
+ aslIdAttr?: string | boolean;
18
+ nodePathAttr?: string | boolean;
19
+ getExtraParts?: (element?: Element) => Array<string>;
20
+ attrFormat?: (attr: Attr | Event | Directive, element?: Element, defaultResult?: string) => string;
21
+ finalCode?: boolean,
22
+ }
23
+
24
+ export interface ParseContext {
25
+ variables?: Array<Variable>;
26
+ structures?: Array<Structure>;
27
+ dataSchema?: string;
28
+ [key: string]: any;
29
+ }
30
+
31
+ /**
32
+ * 前端页面元素
33
+ * @example
34
+ * <u-input size="small" v-model="value" @change="onChange"></u-input>
35
+ */
36
+ export class Element extends Vertex {
37
+ /**
38
+ * 概念类型
39
+ */
40
+ @immutable()
41
+ public readonly level: LEVEL_ENUM = LEVEL_ENUM.element;
42
+ /**
43
+ * 元素类型
44
+ * 去除了 expression 和 text,目前只有一种节点类型
45
+ */
46
+ @immutable()
47
+ // public readonly type: 'element' = 'element';
48
+ public readonly type: number = 0;
49
+ /**
50
+ * 元素 Id
51
+ */
52
+ @immutable()
53
+ public readonly id: string = undefined;
54
+ /**
55
+ * 元素标签
56
+ */
57
+ @immutable()
58
+ public readonly tag: string = undefined;
59
+ /**
60
+ * 元素名称
61
+ * 用户可以自定义
62
+ * Vue 中的 ref
63
+ */
64
+ @immutable()
65
+ public readonly name: string = undefined;
66
+ /**
67
+ * 属性列表
68
+ * 和原来的 attrsList 不同,注意区分
69
+ */
70
+ @immutable()
71
+ public readonly attrList?: Array<Attr> = [];
72
+ /**
73
+ * 事件列表
74
+ */
75
+ @immutable()
76
+ public readonly eventList?: Array<Event> = [];
77
+ /**
78
+ * 指令列表
79
+ */
80
+ @immutable()
81
+ public readonly directiveList?: Array<Directive> = [];
82
+ /**
83
+ * 插槽目标
84
+ * @example
85
+ * 'cell'
86
+ */
87
+ @immutable()
88
+ public readonly slotTarget?: string = undefined;
89
+ /**
90
+ * 插槽 scope 表达式
91
+ * @example
92
+ * 'scope'
93
+ */
94
+ @immutable()
95
+ public readonly slotScope?: string = undefined;
96
+ /**
97
+ * 静态 class 名
98
+ * 不计划支持动态 class
99
+ */
100
+ @immutable()
101
+ public readonly staticClass?: string = undefined;
102
+ /**
103
+ * 静态 style
104
+ * 不计划支持动态样式
105
+ */
106
+ @immutable()
107
+ public readonly staticStyle?: string = undefined;
108
+ /**
109
+ * 当前节点路径,只在前端动态计算后使用
110
+ */
111
+ @excludedInJSON()
112
+ public nodePath: string = undefined;
113
+ /**
114
+ * 所在父元素 Id
115
+ */
116
+ @immutable()
117
+ public readonly parentId: string = undefined;
118
+ /**
119
+ * 所在位置
120
+ */
121
+ @immutable()
122
+ public _posIndex: number = undefined;
123
+ /**
124
+ * 所在父元素
125
+ */
126
+ @circular()
127
+ @immutable()
128
+ public readonly parent?: Element = undefined;
129
+ /**
130
+ * 所在父元素 Id
131
+ */
132
+ @immutable()
133
+ public readonly viewId: string = undefined;
134
+ /**
135
+ * 所在子页面
136
+ */
137
+ @circular()
138
+ @immutable()
139
+ public readonly view?: View = undefined;
140
+ /**
141
+ * 子元素
142
+ */
143
+ @immutable()
144
+ public readonly children?: Array<Element> = [];
145
+ /**
146
+ * @param source 需要合并的部分参数
147
+ */
148
+ constructor(source?: Partial<Element>) {
149
+ super();
150
+ source && this.assign(source);
151
+ // 为了给生成的节点使用
152
+ // !this.id && this.assign({ id: uuidv4() });
153
+ // this.assign({ id: 'temp-' + uuidv4() });
154
+ }
155
+ assign(source?: any) {
156
+ ['attrList', 'eventList', 'directiveList', 'children'].forEach((key) => {
157
+ if (source[key] === null)
158
+ delete source[key];
159
+ });
160
+ super.assign(source);
161
+ }
162
+ /**
163
+ * 添加元素
164
+ */
165
+ @action('添加元素')
166
+ async create(none?: void, actionOptions?: ActionOptions) {
167
+ if (actionOptions?.actionMode === ACTION_MODE.local) {
168
+ this.view && this.view.emit('local-change');
169
+ return this;
170
+ }
171
+
172
+ config.defaultApp?.emit('saving');
173
+ try {
174
+ if (actionOptions?.actionMode !== ACTION_MODE.undoRedo) {
175
+ const body = this.toJSON();
176
+ body.parentId = this.parent && this.parent.id;
177
+ body._posIndex = this.parent && this.parent.children.indexOf(this);
178
+ utils.logger.debug('添加元素', body);
179
+ const result = await elementService.create({
180
+ headers: {
181
+ appId: config.defaultApp?.id,
182
+ operationAction: 'Element.create',
183
+ operationDesc: `添加组件"${this.getElementTitle()}"`,
184
+ },
185
+ body,
186
+ });
187
+
188
+ // Nuims createResource
189
+ // Element 对应资源增删在 undo/redo 情况下可能存在权限丢失的情况
190
+ // 暂时只增不减
191
+ // new Nuims({
192
+ // domainName: this.view.page.service.app.name,
193
+ // element: this,
194
+ // }).createResource();
195
+
196
+ this.deepPick(result, ['id', 'parentId', 'elementId']);
197
+ // attr,directive,event的id,exprssion需要合并
198
+ this.attrList.forEach((attr, index) => {
199
+ attr.deepPick(result.attrList[index], ['id', 'expression']);
200
+ });
201
+ this.directiveList.forEach((directive, index) => {
202
+ directive.deepPick(result.directiveList[index], ['id', 'expression']);
203
+ });
204
+ this.eventList.forEach((event, index) => {
205
+ event.deepPick(result.eventList[index], ['id']);
206
+ });
207
+ }
208
+
209
+ this.view && this.view.emit('change');
210
+
211
+ if (actionOptions?.loadHistory !== false) {
212
+ await config.defaultApp?.history.load(actionOptions?.actionMode !== ACTION_MODE.undoRedo && {
213
+ operationAction: 'Element.create',
214
+ operationBeforeImage: null,
215
+ operationAfterImage: JSON.parse(JSON.stringify(this)),
216
+ operationDesc: `添加组件"${this.getElementTitle()}"`,
217
+ });
218
+ config.defaultApp?.emit('saved');
219
+ }
220
+ return this;
221
+ } catch (err) {
222
+ if (this.view) {
223
+ await this.view.load();
224
+ this.view.emit('change');
225
+ config.defaultApp?.emit('saved');
226
+ }
227
+ throw err;
228
+ }
229
+ }
230
+ /**
231
+ * 删除元素
232
+ */
233
+ @action('删除元素')
234
+ async delete(none?: void, actionOptions?: ActionOptions) {
235
+ if (actionOptions?.actionMode === ACTION_MODE.local) {
236
+ const index = this.parent.children.indexOf(this);
237
+ ~index && this.parent.children.splice(index, 1);
238
+ this.view && this.view.emit('local-change');
239
+ return this;
240
+ }
241
+
242
+ config.defaultApp?.emit('saving');
243
+
244
+ if (!this.parent)
245
+ throw Error('该元素为根节点!');
246
+
247
+ if (actionOptions?.actionMode !== ACTION_MODE.undoRedo) {
248
+ if (this.id) {
249
+ try {
250
+ await elementService.delete({
251
+ headers: {
252
+ appId: config.defaultApp?.id,
253
+ operationAction: 'Element.delete',
254
+ operationDesc: `删除组件"${this.getElementTitle()}"`,
255
+ },
256
+ query: {
257
+ id: this.id,
258
+ },
259
+ });
260
+ } catch (err) {
261
+ await config.defaultApp?.history.load();
262
+ throw err;
263
+ }
264
+
265
+ // Nuims deleteResource
266
+ // Element 对应资源增删在 undo/redo 情况下可能存在权限丢失的情况
267
+ // 暂时只增不减
268
+ // new Nuims({
269
+ // domainName: this.view.page.service.app.name,
270
+ // element: this,
271
+ // }).deleteResources();
272
+ }
273
+ }
274
+
275
+ const index = this.parent.children.indexOf(this);
276
+ ~index && this.parent.children.splice(index, 1);
277
+ this.destroy();
278
+ this.view && this.view.emit('change');
279
+ if (actionOptions?.loadHistory !== false) {
280
+ await config.defaultApp?.history.load(actionOptions?.actionMode !== ACTION_MODE.undoRedo && {
281
+ operationAction: 'Element.delete',
282
+ operationBeforeImage: JSON.parse(JSON.stringify(this)),
283
+ operationAfterImage: null,
284
+ operationDesc: `删除组件"${this.getElementTitle()}"`,
285
+ });
286
+ config.defaultApp?.emit('saved');
287
+ }
288
+ }
289
+ /**
290
+ * 修改元素
291
+ */
292
+ async update(source?: Element, actionOptions?: ActionOptions) {
293
+ config.defaultApp?.emit('saving');
294
+
295
+ source && this.assign(source);
296
+ try {
297
+ if (actionOptions?.actionMode !== ACTION_MODE.undoRedo) {
298
+ const body = this.toPlainJSON();
299
+ utils.logger.debug('修改组件', body);
300
+ await elementService.update({
301
+ headers: {
302
+ appId: config.defaultApp?.id,
303
+ operationAction: actionOptions?.actionName || 'Element.update',
304
+ operationDesc: actionOptions?.actionDesc || `修改组件"${this.getElementTitle()}"`,
305
+ },
306
+ body,
307
+ });
308
+ }
309
+
310
+ this.view && this.view.emit('change');
311
+ await config.defaultApp?.history.load(actionOptions?.actionMode !== ACTION_MODE.undoRedo && {
312
+ operationAction: 'Element.update',
313
+ operationBeforeImage: null, // JSON.parse(JSON.stringify(this)),
314
+ operationAfterImage: null,
315
+ operationDesc: `修改组件"${this.getElementTitle()}"`,
316
+ });
317
+
318
+ config.defaultApp?.emit('saved');
319
+ return this;
320
+ } catch (err) {
321
+ if (this.view) {
322
+ await this.view.load();
323
+ this.view.emit('change');
324
+ config.defaultApp?.emit('saved');
325
+ }
326
+ throw err;
327
+ }
328
+ }
329
+ async move(options: {
330
+ parentId?: string,
331
+ _posIndex?: number,
332
+ nodePath?: string,
333
+ position?: 'append' | 'insertBefore' | 'insertAfter',
334
+ }, actionOptions?: ActionOptions) {
335
+ try {
336
+ if (!options.parentId)
337
+ return;
338
+
339
+ config.defaultApp?.emit('element.moving');
340
+
341
+ const index = this.parent.children.indexOf(this);
342
+ ~index && this.parent.children.splice(index, 1);
343
+
344
+ const parent = vertexsMap.get(options.parentId) as Element;
345
+ parent.children.splice(options._posIndex, 0, this);
346
+
347
+ this.assign({
348
+ parent,
349
+ parentId: options.parentId,
350
+ _posIndex: options._posIndex,
351
+ });
352
+
353
+ if (actionOptions?.actionMode !== ACTION_MODE.undoRedo) {
354
+ await this.update(undefined, {
355
+ actionName: 'Element.move',
356
+ actionDesc: `移动组件"${this.getElementTitle()}"`,
357
+ });
358
+ this.view.attachNodePath();
359
+ } else {
360
+ this.view.attachNodePath();
361
+ this.view && this.view.emit('change');
362
+ await config.defaultApp?.history.load();
363
+ }
364
+
365
+ config.defaultApp?.emit('element.moved');
366
+ } catch (err) {
367
+ if (this.view) {
368
+ await this.view.load();
369
+ this.view.emit('change');
370
+ }
371
+ throw err;
372
+ }
373
+ }
374
+ /**
375
+ * 添加元素副本
376
+ * 在所在父节点的后面添加一个相同的元素
377
+ */
378
+ @action('添加元素副本')
379
+ async duplicate() {
380
+ const code = this.toVue();
381
+
382
+ const index = this.parent.children.indexOf(this);
383
+ const newNode = Element.fromHTML(code, this.parent, this.view);
384
+ const mergeExpression = (originList: Array<Attr|Directive>, newList: Array<Attr|Directive>) => {
385
+ newList.forEach((item) => {
386
+ const originItem = originList.find((originItem) => originItem.name === item.name);
387
+ if (originItem && originItem.expression) {
388
+ // item.expression可能为空
389
+ const expression = cloneDeep(originItem.expression);
390
+ Object.assign(item, { expression, value: '' });
391
+ Object.assign(item.expression, { id: '' });
392
+ utils.traverse((current) => {
393
+ delete current.node.editable;
394
+ delete current.node.index;
395
+ delete current.node.parentAttr;
396
+ delete current.node.parentId;
397
+ delete current.node.id;
398
+ }, { node: item.expression as any }, { mode: 'anyObject' });
399
+ }
400
+ });
401
+ };
402
+
403
+ // 遍历合并
404
+ const traverseMergeNode = (origiNode:Element, newNode:Element) => {
405
+ const originalStack: Array<Element> = [];
406
+ const newStack: Array<Element> = [];
407
+ originalStack.push(origiNode);
408
+ newStack.push(newNode);
409
+ let originalTempNode: Element;
410
+ let newTempNode: Element;
411
+ while (originalStack.length) {
412
+ originalTempNode = originalStack.pop();
413
+ newTempNode = newStack.pop();
414
+ if (newTempNode) {
415
+ mergeExpression(originalTempNode.attrList, newTempNode.attrList);
416
+ mergeExpression(originalTempNode.directiveList, newTempNode.directiveList);
417
+ newTempNode.eventList.forEach((event) => {
418
+ const originEvent = originalTempNode.eventList.find((eventTemp:Event) => eventTemp.name === event.name);
419
+ if (originEvent) {
420
+ Object.assign(event, {
421
+ logicId: originEvent.logicId,
422
+ });
423
+ }
424
+ });
425
+ if (originalTempNode.children.length) {
426
+ for (let i = originalTempNode.children.length - 1; i >= 0; i--) {
427
+ originalStack.push(originalTempNode.children[i]);
428
+ newStack.push(newTempNode.children[i]);
429
+ }
430
+ }
431
+ }
432
+ }
433
+ };
434
+
435
+ traverseMergeNode(this, newNode);
436
+ ~index && this.parent.children.splice(index + 1, 0, newNode);
437
+ this.parent.children.forEach((item, index) => {
438
+ item._posIndex = index;
439
+ });
440
+
441
+ try {
442
+ await newNode.create();
443
+ } catch {
444
+ ~index && this.parent.children.splice(index + 1, 1);
445
+ this.parent.children.forEach((item, index) => {
446
+ item._posIndex = index;
447
+ });
448
+ }
449
+ }
450
+ /**
451
+ * 添加子元素
452
+ * @param child
453
+ */
454
+ addChild(child: string | Element, actionOptions?: ActionOptions) {
455
+ if (typeof child === 'string') {
456
+ child = Element.fromHTML(child, this, this.view);
457
+ }
458
+ if (isPlainObject(child)) {
459
+ child = Element.from(child, this, this.view);
460
+ }
461
+ if (!this.children.includes(child)) {
462
+ const index = child._posIndex === undefined ? this.children.length : child._posIndex;
463
+ this.children.splice(index, 0, child);
464
+ }
465
+ return child.create(undefined, actionOptions);
466
+ }
467
+ /**
468
+ * 删除子元素
469
+ * @param child
470
+ */
471
+ removeChild(child: Element, actionOptions?: ActionOptions) {
472
+ if (isPlainObject(child)) {
473
+ child = this.children.find((item) => item.id === child.id);
474
+ }
475
+ return child.delete(undefined, actionOptions);
476
+ }
477
+ getElementTitle() {
478
+ const currentNode = config.allNodesAPI?.[this.tag];
479
+ return currentNode?.title || this.tag;
480
+ }
481
+ /**
482
+ * 设置组件名称
483
+ */
484
+ @action('设置组件名称')
485
+ async setName(name: string) {
486
+ const oldName = this.name;
487
+ this.assign({ name });
488
+ await this.update(undefined, {
489
+ actionDesc: `设置组件"${this.getElementTitle()}"的名称为"${name}"`,
490
+ });
491
+ // 同步权限
492
+ new Nuims({
493
+ domainName: this.view.page.service.app.name,
494
+ element: this,
495
+ }).editResourceFromResourceValue(oldName ? `${this.view.tempPath}/${oldName}` : null);
496
+
497
+ this.view && this.view.emit('change');
498
+ if (this.view && this.view.page && this.view.page.service) {
499
+ this.view.page.service.emit('vertexIdToNameChange', this.id, this.name);
500
+ }
501
+ }
502
+ /**
503
+ * 添加组件属性
504
+ */
505
+ @action('添加组件属性')
506
+ async addAttr(attr: Attr, actionOptions?: ActionOptions) {
507
+ if (isPlainObject(attr)) {
508
+ attr = Attr.from(attr, this);
509
+ }
510
+ if (!this.attrList.includes(attr))
511
+ this.attrList.push(attr);
512
+
513
+ await attr.create(undefined, Object.assign({
514
+ actionDesc: `添加组件"${this.getElementTitle()}"属性"${attr.name}"`,
515
+ }, actionOptions));
516
+ }
517
+ /**
518
+ * 删除组件属性
519
+ */
520
+ @action('删除组件属性')
521
+ async deleteAttr(attr: Attr, actionOptions?: ActionOptions) {
522
+ if (!attr)
523
+ throw Error(`该组件"${this.getElementTitle()}"没有属性"${attr.name}"`);
524
+ if (isPlainObject(attr))
525
+ attr = this.attrList.find((item) => item.id === attr.id);
526
+
527
+ await attr.delete(undefined, Object.assign({
528
+ actionDesc: `删除组件"${this.getElementTitle()}"属性"${attr.name}"`,
529
+ }, actionOptions));
530
+ }
531
+ /**
532
+ * 获取组件属性
533
+ */
534
+ getAttr(name: string) {
535
+ return this.attrList.find((attr) => attr.name === name);
536
+ }
537
+ /**
538
+ * 设置组件属性
539
+ */
540
+ @action('设置组件属性')
541
+ async setAttr(name: string, type: 'string' | 'static' | 'dynamic', value?: any) {
542
+ let attr = this.getAttr(name);
543
+ //
544
+ if (value === undefined) {
545
+
546
+ } else {
547
+ if (typeof value !== 'string')
548
+ value = JSON.stringify(value);
549
+
550
+ if (attr) {
551
+ attr.assign({
552
+ type,
553
+ value,
554
+ });
555
+ await attr.update(undefined, {
556
+ actionDesc: `设置组件"${this.getElementTitle()}"属性"${attr.name}"的值为"${attr.value}"`,
557
+ });
558
+ } else {
559
+ attr = Attr.from({
560
+ name,
561
+ type,
562
+ value,
563
+ elementId: this.id,
564
+ }, this);
565
+ await attr.create(undefined, {
566
+ actionDesc: `设置组件"${this.getElementTitle()}"属性"${attr.name}"的值为"${attr.value}"`,
567
+ });
568
+ this.attrList.push(attr);
569
+ }
570
+ }
571
+
572
+ this.view && this.view.emit('change');
573
+ }
574
+ /**
575
+ * 添加组件事件
576
+ */
577
+ @action('添加组件事件')
578
+ async addEvent(data: Event, actionOptions?: ActionOptions) {
579
+ // (data as any).element = this;
580
+ let event = new Event(data);
581
+
582
+ await event.create(undefined, Object.assign({
583
+ actionDesc: `添加组件"${this.getElementTitle()}"事件"${event.name}"`,
584
+ }, actionOptions));
585
+ event = Event.from(event, this);
586
+ this.eventList.push(event);
587
+
588
+ this.view && this.view.emit('change');
589
+
590
+ await config.defaultApp?.history.load();
591
+ config.defaultApp?.emit('saved');
592
+
593
+ return event;
594
+ }
595
+ /**
596
+ * 删除组件属性
597
+ */
598
+ @action('删除组件事件')
599
+ async deleteEvent(event: Event, actionOptions?: ActionOptions) {
600
+ if (!event)
601
+ throw Error(`该组件"${this.getElementTitle()}"没有事件"${event.name}"`);
602
+ if (isPlainObject(event))
603
+ event = this.eventList.find((item) => item.id === event.id);
604
+
605
+ await event.delete(undefined, Object.assign({
606
+ actionDesc: `删除组件"${this.getElementTitle()}"事件"${event.name}"`,
607
+ }, actionOptions));
608
+ const index = this.eventList.indexOf(event);
609
+ ~index && this.eventList.splice(index, 1);
610
+
611
+ this.view && this.view.emit('change');
612
+
613
+ await config.defaultApp?.history.load();
614
+ config.defaultApp?.emit('saved');
615
+ }
616
+ /**
617
+ * 添加组件指令
618
+ */
619
+ @action('添加组件指令')
620
+ async addDirective(data: Directive, actionOptions?: ActionOptions) {
621
+ // (data as any).element = this;
622
+ const directive = new Directive(data);
623
+ await directive.create(undefined, Object.assign({
624
+ actionDesc: `添加组件"${this.getElementTitle()}"指令"${directive.name}"`,
625
+ }, actionOptions));
626
+ this.directiveList.push(Directive.from(directive, this));
627
+
628
+ this.view && this.view.emit('change');
629
+ }
630
+ /**
631
+ * 删除组件属性
632
+ */
633
+ @action('删除组件指令')
634
+ async deleteDirective(directive: Directive, actionOptions?: ActionOptions) {
635
+ if (!directive)
636
+ throw Error(`该组件"${this.getElementTitle()}"没有指令"${directive.name}"`);
637
+ if (isPlainObject(directive))
638
+ directive = this.directiveList.find((item) => item.id === directive.id);
639
+
640
+ await directive.delete(undefined, Object.assign({
641
+ actionDesc: `删除组件"${this.getElementTitle()}"属性"${directive.name}"`,
642
+ }, actionOptions));
643
+ const index = this.directiveList.indexOf(directive);
644
+ ~index && this.directiveList.splice(index, 1);
645
+
646
+ this.view && this.view.emit('change');
647
+ }
648
+ /**
649
+ * 转换成 Vue 的模板格式
650
+ */
651
+ toVue(options?: ElementToVueOptions) {
652
+ options = Object.assign({
653
+ indentStyle: 'space',
654
+ tabSize: 4,
655
+ indentLevel: 0,
656
+ aslIdAttr: false,
657
+ nodePathAttr: false,
658
+ getExtraParts: () => [],
659
+ attrFormat: (attr: Attr | Event | Directive, element?: Element, defaultResult?: string) => defaultResult,
660
+ }, options);
661
+ const tabString = ' '.repeat(options.tabSize * options.indentLevel);
662
+ const insideTabString = ' '.repeat(options.tabSize * (options.indentLevel + 1));
663
+ let shouldIndent = true;
664
+
665
+ const content: string = !this.children ? '' : this.children.map((element) => {
666
+ const childOptions = Object.assign({}, options);
667
+ childOptions.indentLevel++;
668
+ return (shouldIndent ? '\n' + insideTabString : '') + element.toVue(childOptions);
669
+ }).join('');
670
+ if (!content.length)
671
+ shouldIndent = false;
672
+
673
+ const parts = [];
674
+ if (options.aslIdAttr) {
675
+ if (options.aslIdAttr === true)
676
+ options.aslIdAttr = 'asl-id';
677
+ parts.push(`${options.aslIdAttr}="${this.id}"`);
678
+ }
679
+ if (options.nodePathAttr) {
680
+ // 注入 asl 的 node-path
681
+ parts.push(`vusion-node-path="${this.nodePath}"`);
682
+ }
683
+
684
+ this.slotTarget && parts.push(`#${this.slotTarget}` + (this.slotScope ? `="${this.slotScope}"` : ''));
685
+ this.name && parts.push(`ref="${this.name}"`);
686
+ this.staticClass && parts.push(`class="${this.staticClass}"`);
687
+ this.staticStyle && parts.push(`style="${this.staticStyle}"`);
688
+
689
+ const { finalCode } = options;
690
+ [].concat(this.attrList, this.directiveList, this.eventList)
691
+ .forEach((attr: Attr | Directive | Event) => {
692
+ const result = options.attrFormat(attr, this, attr.toVue(this, finalCode));
693
+ result && parts.push(result);
694
+ });
695
+
696
+ options.getExtraParts(this).forEach((part) => parts.push(part));
697
+
698
+ let partsLength = 0;
699
+ let partsString = '';
700
+ parts.forEach((part) => {
701
+ if (partsLength >= 120 || part.length >= 120) {
702
+ partsString += '\n' + tabString + ' '.repeat(3); // ' '.repeat(el.tag.length + 1);
703
+ partsLength = 0;
704
+ }
705
+ partsString += ' ' + part;
706
+ partsLength += part.length;
707
+ });
708
+
709
+ return `<${this.tag}${partsString.length ? partsString : ''}>` + content + (shouldIndent ? '\n' + tabString : '') + `</${this.tag}>`;
710
+ }
711
+ /**
712
+ * 转换成设计器中使用的 Vue 文件
713
+ * @param options
714
+ */
715
+ toDesignerVue(options?: ElementToVueOptions) {
716
+ options = Object.assign({
717
+ nodePathAttr: true,
718
+ attrFormat: (attr: Attr | Directive | Event, el: Element, defaultResult?: string) => {
719
+ if (attr.level === LEVEL_ENUM.event || attr.level === LEVEL_ENUM.directive)
720
+ return false;
721
+ if (attr.level === LEVEL_ENUM.attr) {
722
+ const api = config.allNodesAPI[el.tag];
723
+ const apiOfAttr = api && api.attrs && api.attrs.find((_attr) => _attr.name === attr.name);
724
+ if (apiOfAttr && apiOfAttr['designer-value']) {
725
+ const designerValue = apiOfAttr['designer-value'].replace(/"/g, '\'');
726
+ try {
727
+ json5.parse(designerValue);
728
+ return `:${attr.name}="${designerValue}"`;
729
+ } catch (e) {
730
+ return `${attr.name}="${designerValue}"`;
731
+ }
732
+ }
733
+ if ((attr as Attr).type === 'dynamic'
734
+ && !(el.tag === 'u-cascade-select' && attr.name === 'categories'))
735
+ return defaultResult.replace(/:?(\w+)(?:.*?)="(.*)"/, (m, name, value) => {
736
+ try {
737
+ const tempValue = json5.parse(value);
738
+ if (typeof tempValue === 'boolean' || typeof tempValue === 'number') { // 简单类型走属性
739
+ return `:${name}="${value.replace(/"/g, '\'')}"`;
740
+ }
741
+ } catch (e) {
742
+ if (apiOfAttr && !apiOfAttr.type.includes('string'))
743
+ return '';
744
+ }
745
+ return `${name}="{{ ${value.replace(/"/g, '\'')} }}"`;
746
+ });
747
+ else
748
+ return defaultResult;
749
+ }
750
+ return false;
751
+ },
752
+ getExtraParts: (el: Element) => {
753
+ const parts = [];
754
+
755
+ const api = config.allNodesAPI[el.tag];
756
+ const emptySlot = api && api.slots && api.slots.find((slot) => slot.name === 'default' && slot['empty-background']);
757
+ if (!el.children.length && emptySlot) {
758
+ let addEmpty = true;
759
+ if (el.tag === 'u-grid-view'
760
+ || el.tag === 'u-list-view'
761
+ || el.tag === 'van-list-view') {
762
+ const hasDataSource = el.attrList.find((attr) => attr.name === 'data-source');
763
+ addEmpty = !hasDataSource;
764
+ }
765
+ addEmpty && parts.push(`vusion-empty-background="${emptySlot['empty-background']}"`);
766
+ }
767
+
768
+ return parts;
769
+ },
770
+ }, options);
771
+ return this.toVue(options);
772
+ }
773
+ /**
774
+ * 同 toVue 方法
775
+ * @param options 缩进等选项
776
+ */
777
+ toHTML(options?: ElementToVueOptions) {
778
+ return this.toVue(options);
779
+ }
780
+ /**
781
+ * 根据标签查找元素
782
+ * @param tag
783
+ */
784
+ findElementByTag(tag: string): Element {
785
+ if (this.tag === tag)
786
+ return this;
787
+ else {
788
+ for (const child of this.children) {
789
+ const result = child.findElementByTag(tag);
790
+ if (result)
791
+ return result;
792
+ }
793
+ }
794
+ }
795
+ /**
796
+ * 根据属性查找元素
797
+ * @param name
798
+ * @param value
799
+ */
800
+ findElementByAttr(name: string, value: string): Element {
801
+ if (this.attrList.find((attr) => attr.name === name && attr.value === value))
802
+ return this;
803
+ else {
804
+ for (const child of this.children) {
805
+ const result = child.findElementByAttr(name, value);
806
+ if (result)
807
+ return result;
808
+ }
809
+ }
810
+ }
811
+ /**
812
+ * 从 Vue 的 ASTNode 转换成 ASL 元素
813
+ * @param astNode Vue 的 ASTNode
814
+ */
815
+ private static _fromASTNode(astNode: compiler.ASTElement, context?: ParseContext): Element {
816
+ // 临时处理组件的 text
817
+ //h5-mock
818
+ if (['u-text', 'van-text', 'u-link', 'u-button', 'u-label', 'u-radio', 'u-checkbox', 'u-navbar-item', 'u-sidebar-item', 'u-menu-item'].includes(astNode.tag)
819
+ && astNode.children.length === 1 && astNode.children[0].type === 3) {
820
+ astNode.attrs = astNode.attrs || [];
821
+ astNode.attrs.push({ name: 'text', value: JSON.stringify(astNode.children[0].text) });
822
+ astNode.children = [];
823
+ }
824
+
825
+ // 将 scopedSlots 合并到 children 中
826
+ if (astNode.scopedSlots) {
827
+ astNode.children = astNode.children || [];
828
+ Object.keys(astNode.scopedSlots).forEach((key) => {
829
+ if (!astNode.children.find((child) => key === (child as compiler.ASTElement).slotTarget))
830
+ astNode.children.unshift(astNode.scopedSlots[key]);
831
+ });
832
+ delete astNode.scopedSlots;
833
+ }
834
+
835
+ // 提示不支持的字段
836
+ [
837
+ 'component', 'inlineTemplate', 'pre', 'ns',
838
+ 'transition', 'transitionOnAppear', 'transitionMode',
839
+ 'slotName', 'classBinding', 'styleBinding',
840
+ ].forEach((key) => {
841
+ if ((astNode as any)[key])
842
+ console.warn(`[warn] Element NASL unsupports '${key}' field in node `, astNode);
843
+ });
844
+
845
+ let element: Element;
846
+ if (astNode.type === 1) {
847
+ if (astNode.tag === 'router-view') {
848
+ if (config.scope === 'h5') {
849
+ astNode.tag = 'van-router-view';
850
+ } else {
851
+ astNode.tag = 'u-router-view';
852
+ }
853
+ }
854
+
855
+ // if (astNode.tag === 'template')
856
+ // astNode.tag = 'div';
857
+ element = new Element({
858
+ tag: astNode.tag,
859
+ name: astNode.attrsMap.ref,
860
+ staticClass: astNode.attrsMap.class,
861
+ staticStyle: astNode.attrsMap.style,
862
+ slotTarget: astNode.slotTarget && json5.parse(astNode.slotTarget),
863
+ slotScope: astNode.slotScope === '_empty_' ? '' : astNode.slotScope,
864
+ children: astNode.children as unknown as Array<Element>,
865
+ });
866
+
867
+ astNode.attrs && astNode.attrs.forEach((oldAttr) => {
868
+ let attr: Attr;
869
+ if (oldAttr.value === '""' && (oldAttr as any).end - (oldAttr as any).start === oldAttr.name.length) {
870
+ attr = Attr.from({
871
+ type: 'static',
872
+ name: oldAttr.name,
873
+ value: 'true',
874
+ }, element);
875
+ } else {
876
+ try {
877
+ const tmp = json5.parse(oldAttr.value);
878
+ attr = Attr.from({
879
+ type: typeof tmp === 'string' ? 'string' : 'static',
880
+ name: oldAttr.name,
881
+ value: typeof tmp === 'string' ? tmp : oldAttr.value,
882
+ }, element);
883
+ } catch (e) {
884
+ const expression = <ExpressionNode> this._parseExpression(oldAttr.value, context);
885
+ attr = Attr.from({
886
+ type: 'dynamic',
887
+ name: oldAttr.name,
888
+ value: expression ? '' : oldAttr.value,
889
+ expression,
890
+ }, element);
891
+ if (astNode.attrsMap[`:${attr.name}.sync`]) {
892
+ attr.assign({ sync: true });
893
+ }
894
+ }
895
+ }
896
+ element.attrList.push(attr);
897
+ // element.attrMap[attr.name] = attr;
898
+ });
899
+
900
+ // compiler 处理:value.sync 时会加上update:value事件,需要过滤
901
+ astNode.events && Object.keys(astNode.events).filter((name) => !name.startsWith('update:')).forEach((name) => {
902
+ const oldEvent = astNode.events[name] as compiler.ASTElementHandler;
903
+ const value = oldEvent.value.split('(')[0];
904
+ element.eventList.push(Event.from({
905
+ name,
906
+ value,
907
+ logicId: value[0] === '$' ? undefined : value,
908
+ }, element));
909
+ // element.eventMap[name] = new Event({
910
+ // name,
911
+ // value: oldEvent.value,
912
+ // });
913
+ });
914
+
915
+ astNode.directives && astNode.directives.forEach((directive) => {
916
+ if (directive.name === 'model') {
917
+ const valueAttr = astNode.attrs && astNode.attrs.find((attr) => attr.name === 'value');
918
+ if (!valueAttr) {
919
+ const expression = <ExpressionNode> this._parseExpression(directive.value, context);
920
+ element.attrList.push(Attr.from({
921
+ type: 'dynamic',
922
+ name: 'value',
923
+ value: expression ? '' : directive.value,
924
+ expression,
925
+ sync: true,
926
+ }, element));
927
+ }
928
+ } else {
929
+ const expression = <ExpressionNode> this._parseExpression(directive.value, context);
930
+ element.directiveList.push(Directive.from({
931
+ type: expression ? 'string' : 'dynamic',
932
+ name: directive.name,
933
+ rawName: directive.rawName,
934
+ value: expression ? '' : directive.value,
935
+ expression,
936
+ arg: directive.arg,
937
+ modifiers: directive.modifiers,
938
+ }, element));
939
+ // element.directiveMap[directive.name] = );
940
+ }
941
+ });
942
+
943
+ if (astNode.if) {
944
+ element.directiveList.push(Directive.from({
945
+ type: 'dynamic',
946
+ name: 'if',
947
+ rawName: 'v-if',
948
+ value: '',
949
+ expression: <ExpressionNode> this._parseExpression(astNode.if, context),
950
+ }, element));
951
+ }
952
+
953
+ // Removed
954
+ // hasBindings:
955
+ // static:
956
+ // staticRoot:
957
+
958
+ // refInFor?: boolean;
959
+
960
+ // if?: string;
961
+ // ifProcessed?: boolean;
962
+ // elseif?: string;
963
+ // else?: true;
964
+ // ifConditions?: ASTIfCondition[];
965
+
966
+ // for?: string;
967
+ // forProcessed?: boolean;
968
+ // key?: string;
969
+ // alias?: string;
970
+ // iterator1?: string;
971
+ // iterator2?: string;
972
+
973
+ // events?: ASTElementHandlers;
974
+ // nativeEvents?: ASTElementHandlers;
975
+
976
+ // model?: {
977
+ // value: string;
978
+ // callback: string;
979
+ // expression: string;
980
+ // };
981
+
982
+ // directives?: ASTDirective[];
983
+ } else if (astNode.type === 2) {
984
+ if (config.scope === 'h5') {
985
+ element = new Element({
986
+ tag: 'van-text',
987
+ });
988
+ } else {
989
+ element = new Element({
990
+ tag: 'u-text',
991
+ });
992
+ }
993
+ const value = astNode.text.match(/{{(.*?)}}/)[1].trim();
994
+ const expression = <ExpressionNode> this._parseExpression(value, context);
995
+ element.attrList.push(new Attr({
996
+ type: 'dynamic',
997
+ name: 'text',
998
+ value: expression ? '' : value,
999
+ expression,
1000
+ element,
1001
+ }));
1002
+ } else if (astNode.type === 3) {
1003
+ if (config.scope === 'h5') {
1004
+ element = new Element({
1005
+ tag: 'van-text',
1006
+ });
1007
+ } else {
1008
+ element = new Element({
1009
+ tag: 'u-text',
1010
+ });
1011
+ }
1012
+
1013
+ element.attrList.push(new Attr({
1014
+ name: 'text',
1015
+ value: astNode.text,
1016
+ element,
1017
+ }));
1018
+ }
1019
+
1020
+ return element;
1021
+ }
1022
+
1023
+ /**
1024
+ * 解析属性中的表达式
1025
+ * @param value
1026
+ * @param $def 目前 $def 只用来查找 $def.variables 和 $def.structures
1027
+ * @param dataSchema
1028
+ */
1029
+ private static _parseExpression(value: string, context: ParseContext = {}) {
1030
+ try {
1031
+ let ast = babelParser.parseExpression(value) as any;
1032
+
1033
+ utils.traverse((current) => {
1034
+ if (!current.node)
1035
+ return;
1036
+ current.node.level = 'expressionNode';
1037
+ delete current.node.loc;
1038
+ delete current.node.start;
1039
+ delete current.node.end;
1040
+ delete current.node.errors;
1041
+ delete current.node.comments;
1042
+ delete current.node.innerComments;
1043
+ delete current.node.leadingComments;
1044
+ delete current.node.trailingComments;
1045
+ if (current.node.type === 'CallExpression' && current.node.callee.object.name === '$utils') {
1046
+ const calleeCode = current.node.callee.property.name || current.node.callee.property.value;
1047
+ if (calleeCode === 'Enum') {
1048
+ const enumName = current.node.arguments[0] && current.node.arguments[0].value;
1049
+ if (enumName) {
1050
+ let enumNode: any;
1051
+ Object.keys(dataTypesMap).forEach((dataTypeKey) => {
1052
+ if (dataTypesMap[dataTypeKey].type === 'enum') {
1053
+ if (dataTypesMap[dataTypeKey].name === enumName) {
1054
+ enumNode = dataTypesMap[dataTypeKey];
1055
+ }
1056
+ }
1057
+ });
1058
+ if (enumNode) {
1059
+ const code = 'ID_' + enumNode.id;
1060
+ current.node.arguments[0].value = code;
1061
+ current.node.arguments[0].code = code;
1062
+ }
1063
+ }
1064
+ }
1065
+ Object.assign(current.node, {
1066
+ type: 'BuiltInFunction',
1067
+ value: calleeCode,
1068
+ calleeCode,
1069
+ label: '内置函数',
1070
+ level: 'expressionNode',
1071
+ builtInFuncParams: current.node.arguments.map((argument: any) => ({
1072
+ level: 'expressionNode',
1073
+ type: 'BuiltInFuncParam',
1074
+ name: '',
1075
+ builtInFuncParamValue: Object.assign({
1076
+ level: 'expressionNode',
1077
+ }, argument),
1078
+ })),
1079
+ });
1080
+ delete current.node.arguments;
1081
+ delete current.node.callee;
1082
+ } else if (current.node.type === 'MemberExpression') {
1083
+ let object = current.node.object;
1084
+ const properties = [current.node.property];
1085
+ while (object.type === 'MemberExpression') {
1086
+ properties.push(object.property);
1087
+ object = object.object;
1088
+ }
1089
+ if (object.name === 'scope') {
1090
+ let schema: any = {
1091
+ $ref: '',
1092
+ };
1093
+ if (context.dataSchema) { // 可以直接用 dataSchema,处理 mergeBlock 的情况
1094
+ const typeKey = '#/genericTypes/ScopeOf';
1095
+ schema = {
1096
+ type: 'genericType',
1097
+ typeKey,
1098
+ typeInstantiation: {
1099
+ typeName: 'ScopeOf',
1100
+ typeParams: [
1101
+ {
1102
+ typeParamName: 'T',
1103
+ typeParamValue:
1104
+ {
1105
+ $ref: context.dataSchema,
1106
+ typeKey: context.dataSchema,
1107
+ },
1108
+
1109
+ },
1110
+ ],
1111
+ },
1112
+ };
1113
+ }
1114
+ Object.assign(object, { schema, code: object.name });
1115
+ }
1116
+ if (context && object.name) {
1117
+ let variable = (context.variables || []).find((variable:Variable) => variable.name === object.name);
1118
+ variable = variable || object;
1119
+ if (variable) {
1120
+ let schemaData = dataTypesMap[variable.schema && variable.schema.$ref];
1121
+ if (variable.schema && variable.schema.type === 'genericType') {
1122
+ const genericClass = dataTypesMap[variable.schema.typeKey];
1123
+ let propertyList: any = [];
1124
+ if (genericClass) {
1125
+ propertyList = cloneDeep(genericClass.propertyList);
1126
+ propertyList = propertyList.map((property: any) => {
1127
+ if (property.type === 'genericParam' && variable.schema.typeInstantiation) {
1128
+ const param = variable.schema.typeInstantiation.typeParams.find((typeParam: any) => typeParam.typeParamName === property.typeParamName);
1129
+ if (param) {
1130
+ property = Object.assign({ name: property.name }, param.typeParamValue);
1131
+ }
1132
+ }
1133
+ return property;
1134
+ });
1135
+ }
1136
+ schemaData = { propertyList };
1137
+ }
1138
+
1139
+ // 这部分功能还不稳定,先单独处理一下
1140
+ if (object.name === 'scope' && properties.length >= 3) {
1141
+ const tempStructure = context.structures.find((structure: any) => context.dataSchema === structure.schemaRef || context.dataSchema === structure.name);
1142
+ if (tempStructure && !tempStructure.id) {
1143
+ properties.pop(); // scope.item 那一项
1144
+ let property = properties.pop();
1145
+ property.schemaRef = tempStructure.name + '.' + property.name;
1146
+
1147
+ const originProp = tempStructure.propertyList.find((tempProp) => tempProp.name === property.name);
1148
+ schemaData = originProp && dataTypesMap[originProp.$ref];
1149
+ property = properties.pop();
1150
+ while (property && schemaData) {
1151
+ if (schemaData.propertyList) {
1152
+ const originProp = schemaData.propertyList.find((tempProp) => tempProp.name === property.name);
1153
+ if (originProp) {
1154
+ if (originProp.id) {
1155
+ Object.assign(property, {
1156
+ schemaRef: '#/' + originProp.id,
1157
+ code: `ID_${originProp.id}`,
1158
+ });
1159
+ }
1160
+ schemaData = dataTypesMap[originProp.$ref];
1161
+ }
1162
+ }
1163
+ property = properties.pop();
1164
+ }
1165
+ } else if (tempStructure && tempStructure.id && context.recordProperty) {
1166
+ properties.pop(); // scope.item 那一项
1167
+ let property = properties.pop();
1168
+ property.schemaRef = context.recordProperty.$ref;
1169
+ property.code = `ID_${context.recordProperty.id}`;
1170
+
1171
+ const originProp = context.recordProperty;
1172
+ schemaData = originProp && dataTypesMap[originProp.$ref];
1173
+ property = properties.pop();
1174
+ while (property && schemaData) {
1175
+ if (schemaData.propertyList) {
1176
+ const originProp = schemaData.propertyList.find((tempProp) => tempProp.name === property.name);
1177
+ if (originProp) {
1178
+ if (originProp.id) {
1179
+ Object.assign(property, {
1180
+ schemaRef: `#/${originProp.id}`,
1181
+ code: `ID_${originProp.id}`,
1182
+ });
1183
+ }
1184
+ schemaData = dataTypesMap[originProp.$ref];
1185
+ }
1186
+ }
1187
+ property = properties.pop();
1188
+ }
1189
+ }
1190
+ } else {
1191
+ let property = properties.pop();
1192
+ while (property && schemaData) {
1193
+ if (schemaData.propertyList) {
1194
+ const originProp = schemaData.propertyList.find((tempProp) => tempProp.name === property.name);
1195
+ if (originProp) {
1196
+ if (originProp.id) {
1197
+ Object.assign(property, {
1198
+ schemaRef: '#/' + originProp.id,
1199
+ });
1200
+ }
1201
+ schemaData = dataTypesMap[originProp.$ref];
1202
+ }
1203
+ }
1204
+ property = properties.pop();
1205
+ }
1206
+ }
1207
+ }
1208
+ }
1209
+
1210
+ const property = current.node.property;
1211
+ if (property.type === 'StringLiteral') {
1212
+ // 区分单引号的变量和纯文字
1213
+ // $utils['FormatDate']()
1214
+ // 把 'FormatDate' 变成 Identifier, 因为内置函数名是通过选择出来的;如果不改,会展示成输入框
1215
+ if (property.extra.raw.includes("'")) {
1216
+ property.type = 'Identifier';
1217
+ property.name = ast.value;
1218
+ property.level = 'expressionNode';
1219
+ }
1220
+ }
1221
+ } else if (current.node.type === 'Identifier') {
1222
+ if (current.node.name && current.node.name.startsWith('ID_ENUM_LIST_')) {
1223
+ current.node.schemaRef = current.node.name.replace('ID_ENUM_LIST_', '');
1224
+ current.node.code = current.node.name;
1225
+ }
1226
+ }
1227
+ delete current.node.extra;
1228
+ }, { node: ast }, { mode: 'anyObject' });
1229
+
1230
+ if (ast) {
1231
+ let hasSchema = !!context.dataSchema;
1232
+ let object = ast;
1233
+ while (!hasSchema && object) {
1234
+ if (object.schema || object.schemaRef || (object.property && (object.property.schema || object.property.schemaRef)))
1235
+ hasSchema = true;
1236
+ object = object.object;
1237
+ }
1238
+
1239
+ if (ast.type === 'ArrayExpression' || ast.type === 'ObjectExpression'
1240
+ || ast.type === 'MemberExpression' && !hasSchema) {
1241
+ ast = {
1242
+ label: '原子项',
1243
+ level: 'expressionNode',
1244
+ type: 'Unparsed',
1245
+ editable: true,
1246
+ code: value,
1247
+ };
1248
+ }
1249
+ }
1250
+
1251
+ return LogicItem.from(ast, null, null);
1252
+ } catch (e) {
1253
+ return null;
1254
+ }
1255
+ }
1256
+
1257
+ /**
1258
+ * 解析 Vue 模板
1259
+ * 该方法不会绑定 view 和 parent,如果是添加元素优先使用 fromHTML
1260
+ * @param html Vue 的模板
1261
+ * @TODO 处理多个元素的问题
1262
+ */
1263
+ public static parse(html: string, context?: ParseContext) {
1264
+ html = html || '<div></div>';
1265
+
1266
+ const compilerOptions: compiler.CompilerOptions = {
1267
+ preserveWhitespace: false,
1268
+ outputSourceRange: true,
1269
+ };
1270
+
1271
+ let ast = compiler.compile(html, compilerOptions).ast;
1272
+ if (ast.tag === 'template' && !ast.slotTarget)
1273
+ ast = ast.children[0] as compiler.ASTElement;
1274
+
1275
+ if (context && !context.dataSchema) {
1276
+ const cap = html.match(/data-schema="(.*?)"/);
1277
+ context.dataSchema = cap ? cap[1] : '';
1278
+ }
1279
+ let root: Element;
1280
+ utils.traverse((current) => {
1281
+ // 处理 scopedSlots;
1282
+ if (!current.parent)
1283
+ root = this._fromASTNode(current.node, context);
1284
+ else
1285
+ (current.parent.children as any)[current.index] = this._fromASTNode(current.node, context);
1286
+ }, { node: ast });
1287
+
1288
+ return root;
1289
+ }
1290
+ /**
1291
+ * 从模板生成规范的 Element 对象
1292
+ */
1293
+ public static fromHTML(html: string, parent: Element, view: View, context?: ParseContext) {
1294
+ const element = this.parse(html, context);
1295
+ utils.traverse((current) => {
1296
+ current.node.assign({ view, parent: current.parent });
1297
+ }, { node: element, parent });
1298
+ return element;
1299
+ }
1300
+ /**
1301
+ * 从后端 JSON 生成规范的 Element 对象
1302
+ */
1303
+ public static from(source: any, parent: Element, view: View, currentElement?: Element) {
1304
+ const element = new Element(source);
1305
+ currentElement = currentElement || element;
1306
+
1307
+ element.assign({
1308
+ attrList: element.attrList.map((attr) => Attr.from(attr, currentElement)),
1309
+ eventList: element.eventList.map((ret) => Event.from(ret, currentElement)),
1310
+ directiveList: element.directiveList.map((directive) => Directive.from(directive, currentElement)),
1311
+ children: element.children.map((child) => Element.from(child, currentElement, view)),
1312
+ view,
1313
+ parent,
1314
+ });
1315
+
1316
+ return element;
1317
+ }
1318
+ }
1319
+
1320
+ export default Element;