@oinone/kunlun-vue-admin-layout 6.2.0

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 (355) hide show
  1. package/README.md +1 -0
  2. package/dist/oinone-kunlun-vue-admin-layout.css +1 -0
  3. package/dist/oinone-kunlun-vue-admin-layout.esm.js +12049 -0
  4. package/dist/oinone-kunlun-vue-admin-layout.scss +1 -0
  5. package/dist/types/index.d.ts +1 -0
  6. package/dist/types/src/basic/MaskWidget.d.ts +17 -0
  7. package/dist/types/src/basic/index.d.ts +2 -0
  8. package/dist/types/src/basic/register/index.d.ts +1 -0
  9. package/dist/types/src/basic/register/manager.d.ts +7 -0
  10. package/dist/types/src/basic/token/BaseMaskWidget.d.ts +55 -0
  11. package/dist/types/src/basic/token/index.d.ts +1 -0
  12. package/dist/types/src/component/app-switcher/AppSwitcher.vue.d.ts +84 -0
  13. package/dist/types/src/component/app-switcher/AppSwitcherMask.vue.d.ts +61 -0
  14. package/dist/types/src/component/app-switcher/AppSwitcherWidget.d.ts +33 -0
  15. package/dist/types/src/component/app-switcher/index.d.ts +3 -0
  16. package/dist/types/src/component/breadcrumb/BreadcrumbWidget.d.ts +33 -0
  17. package/dist/types/src/component/breadcrumb/DefaultBreadcrumb.vue.d.ts +58 -0
  18. package/dist/types/src/component/breadcrumb/index.d.ts +2 -0
  19. package/dist/types/src/component/debug/Debug.vue.d.ts +11 -0
  20. package/dist/types/src/component/debug/DebugWidget.d.ts +8 -0
  21. package/dist/types/src/component/debug/constants.d.ts +2 -0
  22. package/dist/types/src/component/debug/index.d.ts +6 -0
  23. package/dist/types/src/component/debug/spi/DebugMaskEditor.d.ts +6 -0
  24. package/dist/types/src/component/debug/spi/DebugRouterInitializeService.d.ts +4 -0
  25. package/dist/types/src/component/debug/spi/index.d.ts +1 -0
  26. package/dist/types/src/component/debug/typing.d.ts +159 -0
  27. package/dist/types/src/component/debug/view/DebugMainView.vue.d.ts +28 -0
  28. package/dist/types/src/component/debug/view/DebugMainViewWidget.d.ts +9 -0
  29. package/dist/types/src/component/debug/view/components/DebugDefaultInfo.vue.d.ts +22 -0
  30. package/dist/types/src/component/debug/view/components/DebugJsonView.vue.d.ts +26 -0
  31. package/dist/types/src/component/debug/view/components/DebugRequestInfoPanel.vue.d.ts +22 -0
  32. package/dist/types/src/component/debug/view/components/DebugResponsePanel.vue.d.ts +12 -0
  33. package/dist/types/src/component/debug/view/debug-api/DebugApi.vue.d.ts +52 -0
  34. package/dist/types/src/component/debug/view/debug-api/DebugApiWidget.d.ts +32 -0
  35. package/dist/types/src/component/debug/view/debug-utils.d.ts +44 -0
  36. package/dist/types/src/component/debug/view/debug-view/DebugView.vue.d.ts +78 -0
  37. package/dist/types/src/component/debug/view/debug-view/DebugViewWidget.d.ts +26 -0
  38. package/dist/types/src/component/debug/view/index.d.ts +5 -0
  39. package/dist/types/src/component/debug/view/service/DebugRuntimeContextService.d.ts +18 -0
  40. package/dist/types/src/component/debug/view/service/DebugStackInfoService.d.ts +27 -0
  41. package/dist/types/src/component/debug/view/service/impl/runtime-context/DebugDefaultRuntimeContextService.d.ts +6 -0
  42. package/dist/types/src/component/debug/view/service/impl/runtime-context/DebugRuntimeActionService.d.ts +7 -0
  43. package/dist/types/src/component/debug/view/service/impl/runtime-context/DebugRuntimeDslService.d.ts +6 -0
  44. package/dist/types/src/component/debug/view/service/impl/runtime-context/DebugRuntimeFieldService.d.ts +7 -0
  45. package/dist/types/src/component/debug/view/service/impl/runtime-context/DebugRuntimeLayoutService.d.ts +6 -0
  46. package/dist/types/src/component/debug/view/service/impl/runtime-context/DebugRuntimeMaskService.d.ts +6 -0
  47. package/dist/types/src/component/debug/view/service/impl/runtime-context/DebugRuntimeTemplateService.d.ts +6 -0
  48. package/dist/types/src/component/debug/view/service/impl/runtime-context/DebugRuntimeViewService.d.ts +6 -0
  49. package/dist/types/src/component/debug/view/service/impl/stack-info/DebugBizStackService.d.ts +6 -0
  50. package/dist/types/src/component/debug/view/service/impl/stack-info/DebugConfigureService.d.ts +4 -0
  51. package/dist/types/src/component/debug/view/service/impl/stack-info/DebugDefaultStackInfoService.d.ts +8 -0
  52. package/dist/types/src/component/debug/view/service/impl/stack-info/DebugExceptionStackService.d.ts +6 -0
  53. package/dist/types/src/component/debug/view/service/impl/stack-info/DebugFunctionService.d.ts +4 -0
  54. package/dist/types/src/component/debug/view/service/impl/stack-info/DebugHalfBizStackService.d.ts +6 -0
  55. package/dist/types/src/component/debug/view/service/impl/stack-info/DebugModelService.d.ts +4 -0
  56. package/dist/types/src/component/debug/view/service/impl/stack-info/DebugPureBizStackService.d.ts +6 -0
  57. package/dist/types/src/component/debug/view/service/impl/stack-info/DebugStacktraceGqlRequestContextService.d.ts +6 -0
  58. package/dist/types/src/component/debug/view/service/impl/stack-info/DebugStacktraceSceneAnalysisService.d.ts +7 -0
  59. package/dist/types/src/component/debug/view/service/impl/stack-info/DebugStacktraceSessionService.d.ts +6 -0
  60. package/dist/types/src/component/debug/view/service/index.d.ts +20 -0
  61. package/dist/types/src/component/debug/view/storage.d.ts +19 -0
  62. package/dist/types/src/component/debug/view/useDebugRequestInfo.d.ts +7 -0
  63. package/dist/types/src/component/divider/Divider.vue.d.ts +2 -0
  64. package/dist/types/src/component/divider/DividerWidget.d.ts +4 -0
  65. package/dist/types/src/component/divider/index.d.ts +1 -0
  66. package/dist/types/src/component/index.d.ts +14 -0
  67. package/dist/types/src/component/language/DefaultLanguage.vue.d.ts +34 -0
  68. package/dist/types/src/component/language/LanguageWidget.d.ts +16 -0
  69. package/dist/types/src/component/language/index.d.ts +1 -0
  70. package/dist/types/src/component/layout/BaseMaskLayoutWidget.d.ts +4 -0
  71. package/dist/types/src/component/layout/MaskBlock.vue.d.ts +24 -0
  72. package/dist/types/src/component/layout/block/MaskBlockWidget.d.ts +4 -0
  73. package/dist/types/src/component/layout/block/index.d.ts +1 -0
  74. package/dist/types/src/component/layout/container/MaskContainerWidget.d.ts +4 -0
  75. package/dist/types/src/component/layout/container/index.d.ts +1 -0
  76. package/dist/types/src/component/layout/content/MaskContentWidget.d.ts +7 -0
  77. package/dist/types/src/component/layout/content/index.d.ts +1 -0
  78. package/dist/types/src/component/layout/grid/Grid.vue.d.ts +2 -0
  79. package/dist/types/src/component/layout/grid/GridWidget.d.ts +9 -0
  80. package/dist/types/src/component/layout/grid/index.d.ts +1 -0
  81. package/dist/types/src/component/layout/header/MaskHeaderWidget.d.ts +4 -0
  82. package/dist/types/src/component/layout/header/index.d.ts +1 -0
  83. package/dist/types/src/component/layout/index.d.ts +9 -0
  84. package/dist/types/src/component/layout/mask/MaskRootWidget.d.ts +4 -0
  85. package/dist/types/src/component/layout/mask/index.d.ts +1 -0
  86. package/dist/types/src/component/layout/sidebar/MaskSidebarWidget.d.ts +10 -0
  87. package/dist/types/src/component/layout/sidebar/index.d.ts +1 -0
  88. package/dist/types/src/component/layout/widget/MaskCommonWidget.d.ts +14 -0
  89. package/dist/types/src/component/layout/widget/index.d.ts +1 -0
  90. package/dist/types/src/component/menu/DefaultMenu.vue.d.ts +115 -0
  91. package/dist/types/src/component/menu/DefaultSubMenu.vue.d.ts +17 -0
  92. package/dist/types/src/component/menu/MenuWidget.d.ts +71 -0
  93. package/dist/types/src/component/menu/index.d.ts +3 -0
  94. package/dist/types/src/component/multi-tabs/MultiTabs.vue.d.ts +151 -0
  95. package/dist/types/src/component/multi-tabs/MultiTabsWidget.d.ts +60 -0
  96. package/dist/types/src/component/multi-tabs/index.d.ts +2 -0
  97. package/dist/types/src/component/multi-tabs/typing.d.ts +6 -0
  98. package/dist/types/src/component/notification/DefaultNotification.vue.d.ts +61 -0
  99. package/dist/types/src/component/notification/NotificationWidget.d.ts +139 -0
  100. package/dist/types/src/component/notification/index.d.ts +2 -0
  101. package/dist/types/src/component/order-statistic/OrderStatistic.vue.d.ts +8 -0
  102. package/dist/types/src/component/order-statistic/index.d.ts +14 -0
  103. package/dist/types/src/component/partner-switcher/PartnerSwitcher.vue.d.ts +28 -0
  104. package/dist/types/src/component/partner-switcher/PartnerSwitcherWidget.d.ts +15 -0
  105. package/dist/types/src/component/partner-switcher/index.d.ts +6 -0
  106. package/dist/types/src/component/partner-switcher/service/PartnerSwitcherService.d.ts +17 -0
  107. package/dist/types/src/component/partner-switcher/service/impl/PartnerSwitcherServiceImpl.d.ts +17 -0
  108. package/dist/types/src/component/partner-switcher/service/index.d.ts +2 -0
  109. package/dist/types/src/component/partner-switcher/session/PartnerInfoSession.d.ts +26 -0
  110. package/dist/types/src/component/partner-switcher/session/impl/DefaultPartnerInfoSession.d.ts +15 -0
  111. package/dist/types/src/component/partner-switcher/session/index.d.ts +2 -0
  112. package/dist/types/src/component/partner-switcher/spi/PartnerSwitcherMaskEditor.d.ts +6 -0
  113. package/dist/types/src/component/partner-switcher/spi/index.d.ts +1 -0
  114. package/dist/types/src/component/partner-switcher/typing/index.d.ts +1 -0
  115. package/dist/types/src/component/partner-switcher/typing/partner.d.ts +20 -0
  116. package/dist/types/src/component/quick-search/QuickSearch.vue.d.ts +29 -0
  117. package/dist/types/src/component/quick-search/index.d.ts +24 -0
  118. package/dist/types/src/component/user/DefaultUser.vue.d.ts +39 -0
  119. package/dist/types/src/component/user/UserWidget.d.ts +16 -0
  120. package/dist/types/src/component/user/index.d.ts +1 -0
  121. package/dist/types/src/config/DebugConfig.d.ts +16 -0
  122. package/dist/types/src/config/PartnerSwitcherConfig.d.ts +16 -0
  123. package/dist/types/src/config/index.d.ts +2 -0
  124. package/dist/types/src/index.d.ts +10 -0
  125. package/dist/types/src/service/index.d.ts +5 -0
  126. package/dist/types/src/service/menu-service.d.ts +12 -0
  127. package/dist/types/src/service/message-service.d.ts +16 -0
  128. package/dist/types/src/service/module-service.d.ts +7 -0
  129. package/dist/types/src/service/top-bar-service.d.ts +10 -0
  130. package/dist/types/src/service/user-service.d.ts +4 -0
  131. package/dist/types/src/spi/index.d.ts +1 -0
  132. package/dist/types/src/spi/mask-editor.d.ts +54 -0
  133. package/dist/types/src/tags/Block.vue.d.ts +5 -0
  134. package/dist/types/src/tags/Breadcrumb.vue.d.ts +5 -0
  135. package/dist/types/src/tags/Container.vue.d.ts +5 -0
  136. package/dist/types/src/tags/Content.vue.d.ts +5 -0
  137. package/dist/types/src/tags/Header.vue.d.ts +5 -0
  138. package/dist/types/src/tags/Mask.vue.d.ts +5 -0
  139. package/dist/types/src/tags/MultiTabs.vue.d.ts +5 -0
  140. package/dist/types/src/tags/Sidebar.vue.d.ts +5 -0
  141. package/dist/types/src/tags/Widget.vue.d.ts +5 -0
  142. package/dist/types/src/tags/context/context.d.ts +8 -0
  143. package/dist/types/src/tags/context/index.d.ts +1 -0
  144. package/dist/types/src/tags/index.d.ts +6 -0
  145. package/dist/types/src/tags/mixin/MaskWidgetTagMixin.d.ts +2 -0
  146. package/dist/types/src/tags/mixin/index.d.ts +3 -0
  147. package/dist/types/src/tags/mixin/typing.d.ts +6 -0
  148. package/dist/types/src/tags/mixin/use-mask-widget-tag.d.ts +38 -0
  149. package/dist/types/src/tags/register/index.d.ts +1 -0
  150. package/dist/types/src/tags/register/manager.d.ts +9 -0
  151. package/dist/types/src/tags/resolve/index.d.ts +2 -0
  152. package/dist/types/src/tags/resolve/internal/index.d.ts +2 -0
  153. package/dist/types/src/tags/resolve/internal/typing.d.ts +5 -0
  154. package/dist/types/src/tags/resolve/internal/widget-resolve.d.ts +3 -0
  155. package/dist/types/src/tags/resolve/typing.d.ts +26 -0
  156. package/dist/types/src/tags/resolve/widget-resolve.d.ts +5 -0
  157. package/dist/types/src/template/default-mask.d.ts +2 -0
  158. package/dist/types/src/template/index.d.ts +6 -0
  159. package/dist/types/src/theme/index.d.ts +1 -0
  160. package/dist/types/src/typing/constant.d.ts +1 -0
  161. package/dist/types/src/typing/index.d.ts +3 -0
  162. package/dist/types/src/typing/menu.d.ts +12 -0
  163. package/dist/types/src/typing/stream-symble.d.ts +12 -0
  164. package/dist/types/src/util/HomepageUtils.d.ts +3 -0
  165. package/dist/types/src/util/MenuUtil.d.ts +5 -0
  166. package/dist/types/src/util/index.d.ts +3 -0
  167. package/dist/types/src/util/unauthorized-action.d.ts +14 -0
  168. package/dist/types/src/utils.d.ts +86 -0
  169. package/index.ts +1 -0
  170. package/package.json +47 -0
  171. package/rollup.config.js +33 -0
  172. package/src/basic/MaskWidget.ts +74 -0
  173. package/src/basic/index.ts +2 -0
  174. package/src/basic/register/index.ts +1 -0
  175. package/src/basic/register/manager.ts +17 -0
  176. package/src/basic/token/BaseMaskWidget.ts +187 -0
  177. package/src/basic/token/index.ts +1 -0
  178. package/src/component/app-switcher/AppSwitcher.vue +133 -0
  179. package/src/component/app-switcher/AppSwitcherMask.vue +237 -0
  180. package/src/component/app-switcher/AppSwitcherWidget.ts +152 -0
  181. package/src/component/app-switcher/index.ts +3 -0
  182. package/src/component/breadcrumb/BreadcrumbWidget.ts +167 -0
  183. package/src/component/breadcrumb/DefaultBreadcrumb.vue +95 -0
  184. package/src/component/breadcrumb/index.ts +2 -0
  185. package/src/component/debug/Debug.vue +28 -0
  186. package/src/component/debug/DebugWidget.ts +38 -0
  187. package/src/component/debug/constants.ts +3 -0
  188. package/src/component/debug/index.ts +6 -0
  189. package/src/component/debug/spi/DebugMaskEditor.ts +19 -0
  190. package/src/component/debug/spi/DebugRouterInitializeService.ts +21 -0
  191. package/src/component/debug/spi/index.ts +1 -0
  192. package/src/component/debug/typing.ts +191 -0
  193. package/src/component/debug/view/DebugMainView.vue +206 -0
  194. package/src/component/debug/view/DebugMainViewWidget.ts +42 -0
  195. package/src/component/debug/view/components/DebugDefaultInfo.vue +31 -0
  196. package/src/component/debug/view/components/DebugJsonView.vue +107 -0
  197. package/src/component/debug/view/components/DebugRequestInfoPanel.vue +129 -0
  198. package/src/component/debug/view/components/DebugResponsePanel.vue +66 -0
  199. package/src/component/debug/view/components/runtime-context/DebugRuntimeFieldComponent.vue +29 -0
  200. package/src/component/debug/view/debug-api/DebugApi.vue +225 -0
  201. package/src/component/debug/view/debug-api/DebugApiWidget.ts +400 -0
  202. package/src/component/debug/view/debug-utils.ts +114 -0
  203. package/src/component/debug/view/debug-view/DebugView.vue +331 -0
  204. package/src/component/debug/view/debug-view/DebugViewWidget.ts +181 -0
  205. package/src/component/debug/view/index.ts +6 -0
  206. package/src/component/debug/view/service/DebugRuntimeContextService.ts +21 -0
  207. package/src/component/debug/view/service/DebugStackInfoService.ts +33 -0
  208. package/src/component/debug/view/service/impl/runtime-context/DebugDefaultRuntimeContextService.ts +16 -0
  209. package/src/component/debug/view/service/impl/runtime-context/DebugRuntimeActionService.ts +28 -0
  210. package/src/component/debug/view/service/impl/runtime-context/DebugRuntimeDslService.ts +16 -0
  211. package/src/component/debug/view/service/impl/runtime-context/DebugRuntimeFieldService.ts +33 -0
  212. package/src/component/debug/view/service/impl/runtime-context/DebugRuntimeLayoutService.ts +16 -0
  213. package/src/component/debug/view/service/impl/runtime-context/DebugRuntimeMaskService.ts +30 -0
  214. package/src/component/debug/view/service/impl/runtime-context/DebugRuntimeTemplateService.ts +16 -0
  215. package/src/component/debug/view/service/impl/runtime-context/DebugRuntimeViewService.ts +16 -0
  216. package/src/component/debug/view/service/impl/stack-info/DebugBizStackService.ts +19 -0
  217. package/src/component/debug/view/service/impl/stack-info/DebugConfigureService.ts +6 -0
  218. package/src/component/debug/view/service/impl/stack-info/DebugDefaultStackInfoService.ts +62 -0
  219. package/src/component/debug/view/service/impl/stack-info/DebugExceptionStackService.ts +19 -0
  220. package/src/component/debug/view/service/impl/stack-info/DebugFunctionService.ts +6 -0
  221. package/src/component/debug/view/service/impl/stack-info/DebugHalfBizStackService.ts +19 -0
  222. package/src/component/debug/view/service/impl/stack-info/DebugModelService.ts +6 -0
  223. package/src/component/debug/view/service/impl/stack-info/DebugPureBizStackService.ts +19 -0
  224. package/src/component/debug/view/service/impl/stack-info/DebugStacktraceGqlRequestContextService.ts +22 -0
  225. package/src/component/debug/view/service/impl/stack-info/DebugStacktraceSceneAnalysisService.ts +35 -0
  226. package/src/component/debug/view/service/impl/stack-info/DebugStacktraceSessionService.ts +19 -0
  227. package/src/component/debug/view/service/index.ts +22 -0
  228. package/src/component/debug/view/storage.ts +35 -0
  229. package/src/component/debug/view/useDebugRequestInfo.ts +17 -0
  230. package/src/component/divider/Divider.vue +15 -0
  231. package/src/component/divider/DividerWidget.ts +12 -0
  232. package/src/component/divider/index.ts +1 -0
  233. package/src/component/index.ts +15 -0
  234. package/src/component/language/DefaultLanguage.vue +111 -0
  235. package/src/component/language/LanguageWidget.ts +72 -0
  236. package/src/component/language/index.ts +1 -0
  237. package/src/component/layout/BaseMaskLayoutWidget.ts +12 -0
  238. package/src/component/layout/MaskBlock.vue +31 -0
  239. package/src/component/layout/block/MaskBlockWidget.ts +17 -0
  240. package/src/component/layout/block/index.ts +1 -0
  241. package/src/component/layout/container/MaskContainerWidget.ts +13 -0
  242. package/src/component/layout/container/index.ts +1 -0
  243. package/src/component/layout/content/MaskContentWidget.ts +41 -0
  244. package/src/component/layout/content/index.ts +1 -0
  245. package/src/component/layout/grid/Grid.vue +10 -0
  246. package/src/component/layout/grid/GridWidget.ts +62 -0
  247. package/src/component/layout/grid/index.ts +1 -0
  248. package/src/component/layout/header/MaskHeaderWidget.ts +13 -0
  249. package/src/component/layout/header/index.ts +1 -0
  250. package/src/component/layout/index.ts +9 -0
  251. package/src/component/layout/mask/MaskRootWidget.ts +13 -0
  252. package/src/component/layout/mask/index.ts +1 -0
  253. package/src/component/layout/sidebar/MaskSidebarWidget.ts +31 -0
  254. package/src/component/layout/sidebar/index.ts +1 -0
  255. package/src/component/layout/widget/MaskCommonWidget.ts +95 -0
  256. package/src/component/layout/widget/index.ts +1 -0
  257. package/src/component/menu/DefaultMenu.vue +252 -0
  258. package/src/component/menu/DefaultSubMenu.vue +68 -0
  259. package/src/component/menu/MenuWidget.ts +349 -0
  260. package/src/component/menu/index.ts +3 -0
  261. package/src/component/menu/style/common.scss +411 -0
  262. package/src/component/menu/style/index.scss +2 -0
  263. package/src/component/menu/style/menu-theme/index.scss +5 -0
  264. package/src/component/menu/style/menu-theme/theme2.scss +37 -0
  265. package/src/component/menu/style/menu-theme/theme3.scss +59 -0
  266. package/src/component/menu/style/menu-theme/theme4.scss +56 -0
  267. package/src/component/menu/style/menu-theme/theme5.scss +45 -0
  268. package/src/component/menu/style/menu-theme/theme6.scss +45 -0
  269. package/src/component/menu/style/mixin.scss +23 -0
  270. package/src/component/multi-tabs/MultiTabs.vue +475 -0
  271. package/src/component/multi-tabs/MultiTabsWidget.ts +450 -0
  272. package/src/component/multi-tabs/index.ts +2 -0
  273. package/src/component/multi-tabs/style/index.scss +217 -0
  274. package/src/component/multi-tabs/style/mixin.scss +13 -0
  275. package/src/component/multi-tabs/style/parameters.scss +2 -0
  276. package/src/component/multi-tabs/style/theme1.scss +92 -0
  277. package/src/component/multi-tabs/style/theme2.scss +89 -0
  278. package/src/component/multi-tabs/style/theme3.scss +60 -0
  279. package/src/component/multi-tabs/style/theme4.scss +85 -0
  280. package/src/component/multi-tabs/typing.ts +7 -0
  281. package/src/component/notification/DefaultNotification.vue +455 -0
  282. package/src/component/notification/NotificationWidget.ts +332 -0
  283. package/src/component/notification/index.ts +2 -0
  284. package/src/component/order-statistic/OrderStatistic.vue +12 -0
  285. package/src/component/order-statistic/index.ts +146 -0
  286. package/src/component/partner-switcher/PartnerSwitcher.vue +75 -0
  287. package/src/component/partner-switcher/PartnerSwitcherWidget.ts +70 -0
  288. package/src/component/partner-switcher/index.ts +6 -0
  289. package/src/component/partner-switcher/service/PartnerSwitcherService.ts +20 -0
  290. package/src/component/partner-switcher/service/impl/PartnerSwitcherServiceImpl.ts +48 -0
  291. package/src/component/partner-switcher/service/index.ts +2 -0
  292. package/src/component/partner-switcher/session/PartnerInfoSession.ts +32 -0
  293. package/src/component/partner-switcher/session/impl/DefaultPartnerInfoSession.ts +46 -0
  294. package/src/component/partner-switcher/session/index.ts +2 -0
  295. package/src/component/partner-switcher/spi/PartnerSwitcherMaskEditor.ts +24 -0
  296. package/src/component/partner-switcher/spi/index.ts +1 -0
  297. package/src/component/partner-switcher/typing/index.ts +1 -0
  298. package/src/component/partner-switcher/typing/partner.ts +22 -0
  299. package/src/component/quick-search/QuickSearch.vue +34 -0
  300. package/src/component/quick-search/index.ts +237 -0
  301. package/src/component/style/index.scss +4 -0
  302. package/src/component/style/layout.scss +229 -0
  303. package/src/component/user/DefaultUser.vue +92 -0
  304. package/src/component/user/UserWidget.ts +129 -0
  305. package/src/component/user/index.ts +1 -0
  306. package/src/config/DebugConfig.ts +30 -0
  307. package/src/config/PartnerSwitcherConfig.ts +30 -0
  308. package/src/config/index.ts +2 -0
  309. package/src/index.ts +11 -0
  310. package/src/service/index.ts +5 -0
  311. package/src/service/menu-service.ts +105 -0
  312. package/src/service/message-service.ts +65 -0
  313. package/src/service/module-service.ts +69 -0
  314. package/src/service/top-bar-service.ts +144 -0
  315. package/src/service/user-service.ts +10 -0
  316. package/src/shim-translate.d.ts +7 -0
  317. package/src/shim-vue.d.ts +6 -0
  318. package/src/spi/index.ts +1 -0
  319. package/src/spi/mask-editor.ts +102 -0
  320. package/src/tags/Block.vue +16 -0
  321. package/src/tags/Breadcrumb.vue +16 -0
  322. package/src/tags/Container.vue +16 -0
  323. package/src/tags/Content.vue +16 -0
  324. package/src/tags/Header.vue +16 -0
  325. package/src/tags/Mask.vue +16 -0
  326. package/src/tags/MultiTabs.vue +16 -0
  327. package/src/tags/Sidebar.vue +16 -0
  328. package/src/tags/Widget.vue +16 -0
  329. package/src/tags/context/context.ts +24 -0
  330. package/src/tags/context/index.ts +1 -0
  331. package/src/tags/index.ts +48 -0
  332. package/src/tags/mixin/MaskWidgetTagMixin.ts +79 -0
  333. package/src/tags/mixin/index.ts +3 -0
  334. package/src/tags/mixin/typing.ts +8 -0
  335. package/src/tags/mixin/use-mask-widget-tag.ts +172 -0
  336. package/src/tags/register/index.ts +1 -0
  337. package/src/tags/register/manager.ts +43 -0
  338. package/src/tags/resolve/index.ts +2 -0
  339. package/src/tags/resolve/internal/index.ts +2 -0
  340. package/src/tags/resolve/internal/typing.ts +6 -0
  341. package/src/tags/resolve/internal/widget-resolve.ts +57 -0
  342. package/src/tags/resolve/typing.ts +39 -0
  343. package/src/tags/resolve/widget-resolve.ts +64 -0
  344. package/src/template/default-mask.ts +51 -0
  345. package/src/template/index.ts +26 -0
  346. package/src/theme/index.ts +1 -0
  347. package/src/typing/constant.ts +3 -0
  348. package/src/typing/index.ts +3 -0
  349. package/src/typing/menu.ts +15 -0
  350. package/src/typing/stream-symble.ts +14 -0
  351. package/src/util/HomepageUtils.ts +41 -0
  352. package/src/util/MenuUtil.ts +18 -0
  353. package/src/util/index.ts +3 -0
  354. package/src/util/unauthorized-action.ts +98 -0
  355. package/src/utils.ts +716 -0
@@ -0,0 +1,92 @@
1
+ <template>
2
+ <a-dropdown :trigger="['click']" placement="bottomLeft" overlayClassName="top-bar-common-dropdown">
3
+ <div class="k-user">
4
+ <img :src="pamirsUser.avatarUrl || genStaticPath('man_1651543408256.png')" />
5
+ <span v-if="hasCurrentUser">{{ pamirsUser.nickname || pamirsUser.name || pamirsUser.realname }}</span>
6
+ <caret-down-outlined :style="{ fontSize: '12px', color: 'var(--oio-icon-color)' }" />
7
+ </div>
8
+ <template #overlay>
9
+ <a-menu class="k-user-dropdown">
10
+ <a-menu-item @click="onUserCenter">
11
+ <div class="menu-user">
12
+ <img :src="pamirsUser.avatarUrl || genStaticPath('man_1651543408256.png')" />
13
+ <span v-if="hasCurrentUser">{{ pamirsUser.nickname || pamirsUser.name || pamirsUser.realname }}</span>
14
+ </div>
15
+ </a-menu-item>
16
+
17
+ <div class="k-user-dropdown-group" v-for="(item, index) in actionGroups" :key="index">
18
+ <a-menu-item
19
+ class="k-user-dropdown-action"
20
+ v-for="action in item.actions"
21
+ :key="action.id"
22
+ @click="executeAction(action)"
23
+ >
24
+ <oio-icon
25
+ v-if="action.attributes"
26
+ :icon="action.attributes.icon || 'oinone-yingyong'"
27
+ :size="action.attributes.size || 14"
28
+ :style="{ 'margin-right': '12px', color: action.attributes.color || 'var(--user-dropdown-icon-color)' }"
29
+ />
30
+ {{ $translate(action.displayName) }}
31
+ </a-menu-item>
32
+ </div>
33
+ </a-menu>
34
+ </template>
35
+ </a-dropdown>
36
+ </template>
37
+ <script lang="ts">
38
+ import { CaretDownOutlined } from '@ant-design/icons-vue';
39
+ import { UserInfo } from '@oinone/kunlun-engine';
40
+
41
+ import { OioIcon } from '@oinone/kunlun-vue-ui-antd';
42
+ import { computed, defineComponent, PropType } from 'vue';
43
+
44
+ export default defineComponent({
45
+ name: 'DefaultUser',
46
+ inheritAttrs: false,
47
+ components: {
48
+ CaretDownOutlined,
49
+ OioIcon
50
+ },
51
+ props: {
52
+ userInfo: {
53
+ type: Object as PropType<UserInfo>,
54
+ default: () => ({})
55
+ },
56
+ executeAction: {
57
+ type: Function,
58
+ required: true
59
+ },
60
+ genStaticPath: {
61
+ type: Function,
62
+ required: true
63
+ }
64
+ },
65
+ setup(props) {
66
+ const pamirsUser = computed(() => (props.userInfo ? props.userInfo.pamirsUser || {} : {}));
67
+
68
+ const hasCurrentUser = computed(() => {
69
+ return !!props.userInfo?.pamirsUser;
70
+ });
71
+
72
+ const userCenterAction = computed(() => {
73
+ return props.userInfo.userAvatarAction;
74
+ });
75
+
76
+ const actionGroups = computed(() => {
77
+ if (!props.userInfo) {
78
+ return [];
79
+ }
80
+ return props.userInfo.actionGroups || [];
81
+ });
82
+
83
+ const onUserCenter = () => {
84
+ if (userCenterAction.value) {
85
+ props.executeAction!(userCenterAction.value);
86
+ }
87
+ };
88
+
89
+ return { actionGroups, pamirsUser, onUserCenter, hasCurrentUser };
90
+ }
91
+ });
92
+ </script>
@@ -0,0 +1,129 @@
1
+ import {
2
+ baseActionTokenSymbol,
3
+ ClearCache,
4
+ executeServerAction,
5
+ executeUrlAction,
6
+ executeViewAction,
7
+ getDefaultBrowser,
8
+ isRuntimeClientAction,
9
+ isRuntimeServerAction,
10
+ isRuntimeUrlAction,
11
+ isRuntimeViewAction,
12
+ MultiTabsRuntimeManifestMergedConfigManager,
13
+ OioProvider,
14
+ PamirsUser,
15
+ ReloadMaskCallChainingParameters,
16
+ RuntimeAction,
17
+ ServerActionCache,
18
+ UrlActionCache,
19
+ UserInfo,
20
+ ViewActionCache
21
+ } from '@oinone/kunlun-engine';
22
+ import { GlobalConfig, IURLAction, ViewActionTarget } from '@oinone/kunlun-meta';
23
+ import { setSessionPath, useSessionPath } from '@oinone/kunlun-request';
24
+ import { Matched, Router, useMatched } from '@oinone/kunlun-router';
25
+ import { SPI, SPIOperator } from '@oinone/kunlun-spi';
26
+ import { useRouter } from '@oinone/kunlun-vue-router';
27
+ import { Widget, WidgetSubjection } from '@oinone/kunlun-vue-widget';
28
+ import { MaskWidget } from '../../basic';
29
+ import { TopBarService } from '../../service';
30
+ import { pamirsUserSymbol } from '../../typing';
31
+ import DefaultUser from './DefaultUser.vue';
32
+
33
+ @SPI.ClassFactory(MaskWidget.Token({ widget: 'user' }))
34
+ export class UserWidget extends MaskWidget {
35
+ protected router!: Router;
36
+
37
+ protected matched!: Matched;
38
+
39
+ @Widget.SubContext(pamirsUserSymbol)
40
+ private pamirsUser$!: WidgetSubjection<PamirsUser>;
41
+
42
+ public initialize(props) {
43
+ super.initialize(props);
44
+ this.setComponent(DefaultUser);
45
+ return this;
46
+ }
47
+
48
+ @Widget.Reactive()
49
+ protected userInfo: UserInfo | undefined;
50
+
51
+ @Widget.Method()
52
+ public async executeAction(action: RuntimeAction) {
53
+ const { model, name } = action;
54
+
55
+ if (isRuntimeViewAction(action)) {
56
+ const viewAction = await useSessionPath(action.sessionPath, () => ViewActionCache.get(model, name));
57
+ if (viewAction) {
58
+ if (MultiTabsRuntimeManifestMergedConfigManager.isEnabled() && viewAction.target === ViewActionTarget.Router) {
59
+ viewAction.target = ViewActionTarget.OpenWindow;
60
+ }
61
+ executeViewAction(viewAction, this.router, this.matched);
62
+ }
63
+ } else if (isRuntimeServerAction(action)) {
64
+ const serverAction = await useSessionPath(action.sessionPath, () => ServerActionCache.get(model, name));
65
+ if (serverAction) {
66
+ await executeServerAction(serverAction, {});
67
+ }
68
+ if (name === 'logout') {
69
+ this.logout();
70
+ }
71
+ } else if (isRuntimeUrlAction(action)) {
72
+ const urlAction = await useSessionPath(action.sessionPath, () => UrlActionCache.get(model, name));
73
+ await executeUrlAction(urlAction as unknown as IURLAction);
74
+ } else if (isRuntimeClientAction(action)) {
75
+ const actionOptions = {
76
+ actionType: action.actionType,
77
+ model: action.model,
78
+ name: action.fun,
79
+ widget: action.widget
80
+ };
81
+
82
+ // eslint-disable-next-line @typescript-eslint/no-shadow
83
+ const Widget = SPIOperator.selector(baseActionTokenSymbol, actionOptions) as any;
84
+ const actionWidget = new Widget();
85
+ actionWidget.initialize({ action });
86
+ await actionWidget.click();
87
+ }
88
+ }
89
+
90
+ public logout() {
91
+ const loginPath = GlobalConfig.getConfigByName('login') as string;
92
+ let url = loginPath;
93
+ if (loginPath.startsWith('/')) {
94
+ url = loginPath.slice(1);
95
+ }
96
+ OioProvider.setBrowserConfig(getDefaultBrowser());
97
+ setSessionPath(undefined);
98
+ ClearCache.clear();
99
+ this.router.push({ segments: [{ path: url }] });
100
+ OioProvider.refreshSystemMajorConfig();
101
+ }
102
+
103
+ protected fetchUserInfo(): Promise<UserInfo> {
104
+ return TopBarService.getUserInfo();
105
+ }
106
+
107
+ protected async initUserInfo(): Promise<void> {
108
+ if (!this.userInfo) {
109
+ const data = await this.fetchUserInfo();
110
+ this.userInfo = data;
111
+ }
112
+ }
113
+
114
+ protected reloadMaskProcess(reloadParameters: ReloadMaskCallChainingParameters) {
115
+ return this.initUserInfo();
116
+ }
117
+
118
+ protected $$mounted() {
119
+ super.$$mounted();
120
+ this.matched = useMatched().matched;
121
+ this.router = useRouter().router;
122
+
123
+ this.pamirsUser$.subscribe((v) => {
124
+ if (v && Object.keys(v).length) {
125
+ this.userInfo!.pamirsUser = JSON.parse(JSON.stringify(v));
126
+ }
127
+ });
128
+ }
129
+ }
@@ -0,0 +1 @@
1
+ export * from './UserWidget';
@@ -0,0 +1,30 @@
1
+ import { ConfigHelper, EnabledConfig } from '@oinone/kunlun-engine';
2
+ import { RuntimeConfig, RuntimeConfigOptions } from '@oinone/kunlun-meta';
3
+
4
+ /**
5
+ * 调试配置
6
+ */
7
+ export interface DebugConfig extends RuntimeConfigOptions, EnabledConfig {
8
+ /**
9
+ * 是否启用
10
+ */
11
+ enabled?: boolean;
12
+ }
13
+
14
+ export class DebugConfigManager {
15
+ private constructor() {
16
+ // reject create object
17
+ }
18
+
19
+ public static getConfig(): DebugConfig {
20
+ return ConfigHelper.getConfig(RuntimeConfig.getConfig('debug'));
21
+ }
22
+
23
+ public static isEnabled(): boolean {
24
+ let { enabled } = DebugConfigManager.getConfig();
25
+ if (enabled == null) {
26
+ enabled = true;
27
+ }
28
+ return enabled;
29
+ }
30
+ }
@@ -0,0 +1,30 @@
1
+ import { ConfigHelper, EnabledConfig } from '@oinone/kunlun-engine';
2
+ import { RuntimeConfig, RuntimeConfigOptions } from '@oinone/kunlun-meta';
3
+
4
+ /**
5
+ * 合作伙伴切换配置
6
+ */
7
+ export interface PartnerSwitcherConfig extends RuntimeConfigOptions, EnabledConfig {
8
+ /**
9
+ * 是否启用
10
+ */
11
+ enabled?: boolean;
12
+ }
13
+
14
+ export class PartnerSwitcherConfigManager {
15
+ private constructor() {
16
+ // reject create object
17
+ }
18
+
19
+ public static getConfig(): PartnerSwitcherConfig {
20
+ return ConfigHelper.getConfig(RuntimeConfig.getConfig('partnerSwitcher'));
21
+ }
22
+
23
+ public static isEnabled(): boolean {
24
+ let { enabled } = PartnerSwitcherConfigManager.getConfig();
25
+ if (enabled == null) {
26
+ enabled = false;
27
+ }
28
+ return enabled;
29
+ }
30
+ }
@@ -0,0 +1,2 @@
1
+ export * from './DebugConfig';
2
+ export * from './PartnerSwitcherConfig';
package/src/index.ts ADDED
@@ -0,0 +1,11 @@
1
+ export * from './config';
2
+ export * from './spi';
3
+ export * from './tags';
4
+
5
+ export * from './basic';
6
+ export * from './component';
7
+ export * from './service';
8
+ export * from './template';
9
+ export * from './typing';
10
+ export * from './util';
11
+ export * from './utils';
@@ -0,0 +1,5 @@
1
+ export * from './menu-service';
2
+ export * from './message-service';
3
+ export * from './module-service';
4
+ export * from './top-bar-service';
5
+ export * from './user-service';
@@ -0,0 +1,105 @@
1
+ import { ModuleCache } from '@oinone/kunlun-engine';
2
+ import { IMenu } from '@oinone/kunlun-meta';
3
+ import { Comparator, TreeHelper, TreeNode } from '@oinone/kunlun-shared';
4
+ import { MenuUrlParameters, RuntimeMenu } from '../typing';
5
+
6
+ const defaultCompareFunction: Comparator<TreeNode<RuntimeMenu>> = (a, b) => {
7
+ const ap = a.value?.priority;
8
+ const bp = b.value?.priority;
9
+ if (ap == null || bp == null) {
10
+ return 0;
11
+ }
12
+ return Number(ap) - Number(bp);
13
+ };
14
+
15
+ export class MenuService {
16
+ public static async queryMenus(moduleName: string): Promise<IMenu[]> {
17
+ const module = await ModuleCache.get(moduleName);
18
+ if (module) {
19
+ return module.allMenus || [];
20
+ }
21
+ return [];
22
+ }
23
+
24
+ public static convert(menus: IMenu[]): TreeNode<RuntimeMenu>[] {
25
+ const nodes: TreeNode<RuntimeMenu>[] = TreeHelper.convert(
26
+ menus,
27
+ (v) => v.name,
28
+ (v) => v.parentName,
29
+ (v) => {
30
+ const runtimeValue = v as RuntimeMenu;
31
+ runtimeValue.title = v.displayName || v.name;
32
+ return runtimeValue;
33
+ }
34
+ );
35
+ return MenuService.clearInvalidNodes(nodes);
36
+ }
37
+
38
+ private static clearInvalidNodes(nodes: TreeNode<RuntimeMenu>[]): TreeNode<RuntimeMenu>[] {
39
+ return nodes.filter((node) => {
40
+ if (node.value) {
41
+ node.children = MenuService.clearInvalidNodes(node.children);
42
+ return true;
43
+ }
44
+ return false;
45
+ });
46
+ }
47
+
48
+ public static sort(nodes: TreeNode<RuntimeMenu>[]): void {
49
+ nodes.sort(defaultCompareFunction);
50
+ for (const node of nodes) {
51
+ MenuService.sort(node.children || []);
52
+ }
53
+ }
54
+
55
+ public static findSelectedMenuItemByAction(
56
+ nodes: TreeNode<RuntimeMenu>[],
57
+ action: string
58
+ ): TreeNode<RuntimeMenu> | undefined {
59
+ for (const node of nodes) {
60
+ const { children, value } = node;
61
+ const key = value?.viewAction?.name;
62
+ if (key && key === action) {
63
+ return node;
64
+ }
65
+ if (children && children.length) {
66
+ const selectedMenu = MenuService.findSelectedMenuItemByAction(children, action);
67
+ if (selectedMenu) {
68
+ return selectedMenu;
69
+ }
70
+ }
71
+ }
72
+ }
73
+
74
+ public static findSelectedMenuItemByKey(
75
+ nodes: TreeNode<RuntimeMenu>[],
76
+ key: string
77
+ ): TreeNode<RuntimeMenu> | undefined {
78
+ for (const node of nodes) {
79
+ const { key: targetKey, children } = node;
80
+ if (targetKey === key) {
81
+ return node;
82
+ }
83
+ if (children && children.length) {
84
+ const selectedMenu = MenuService.findSelectedMenuItemByKey(children, key);
85
+ if (selectedMenu) {
86
+ return selectedMenu;
87
+ }
88
+ }
89
+ }
90
+ }
91
+
92
+ public static generatorMenuUrlParameters(selected: TreeNode<RuntimeMenu>): MenuUrlParameters {
93
+ const selectedKeys: string[] = [selected.key];
94
+ let openKeys: string[] = [];
95
+ let currentNode: TreeNode<RuntimeMenu> | undefined = selected;
96
+ while (currentNode) {
97
+ openKeys = [currentNode.key, ...openKeys];
98
+ currentNode = currentNode.parent;
99
+ }
100
+ return {
101
+ selectedKeys,
102
+ openKeys
103
+ };
104
+ }
105
+ }
@@ -0,0 +1,65 @@
1
+ import { SYSTEM_MODULE_NAME } from '@oinone/kunlun-meta';
2
+ import { gql } from '@oinone/kunlun-request';
3
+ import { http } from '@oinone/kunlun-service';
4
+
5
+ export interface PamirsMessage {
6
+ id: string;
7
+ messageType: string;
8
+ createDate: string;
9
+ message: { body: string; id: string; resId: string; workFlowTaskType: string };
10
+ }
11
+
12
+ export class MessageService {
13
+ public static async unreadWorkflowList() {
14
+ const body = gql`
15
+ {
16
+ unreadMessageQuery {
17
+ unreadWorkflowList(data: {}) {
18
+ id
19
+ messageType
20
+ createDate
21
+ message {
22
+ body
23
+ name
24
+ extendIcon
25
+ id
26
+ resId
27
+ workFlowTaskType
28
+ messageType
29
+ }
30
+ }
31
+ }
32
+ }
33
+ `;
34
+ const result = await http.query<PamirsMessage[]>(SYSTEM_MODULE_NAME.MESSAGE, body);
35
+ return result.data.unreadMessageQuery.unreadWorkflowList;
36
+ }
37
+
38
+ public static async readWorkflowMessage(id: string) {
39
+ const query = gql`
40
+ {
41
+ unreadMessageQuery {
42
+ readWorkflowMessage(data: { id: ${id} }) {
43
+ id
44
+ messageType
45
+ createDate
46
+ }
47
+ }
48
+ }
49
+ `;
50
+ const result = await http.query(SYSTEM_MODULE_NAME.MESSAGE, query);
51
+ return result.data.unreadMessageQuery.readWorkflowMessage;
52
+ }
53
+
54
+ public static async unreadCount() {
55
+ const body = gql`
56
+ {
57
+ unreadMessageQuery {
58
+ unreadCount(data: {})
59
+ }
60
+ }
61
+ `;
62
+ const result = await http.query<number>(SYSTEM_MODULE_NAME.MESSAGE, body);
63
+ return result.data.unreadMessageQuery.unreadCount;
64
+ }
65
+ }
@@ -0,0 +1,69 @@
1
+ import {
2
+ ClearCache,
3
+ ModelCache,
4
+ QueryPageResult,
5
+ RuntimeViewAction
6
+ } from '@oinone/kunlun-engine';
7
+ import { IModule, SYSTEM_MODULE_NAME } from '@oinone/kunlun-meta';
8
+ import { gql } from '@oinone/kunlun-request';
9
+ import { http } from '@oinone/kunlun-service';
10
+
11
+ export class ModuleService {
12
+ public static apps: IModule[] = [];
13
+
14
+ public static async queryApplications(): Promise<IModule[]> {
15
+ if (ModuleService.apps.length) {
16
+ return ModuleService.apps;
17
+ }
18
+
19
+ ClearCache.register(() => {
20
+ ModuleService.apps = [];
21
+ });
22
+ const model = await ModelCache.get('apps.AppsManagementModule');
23
+ const bindUrlFieldExist = (model?.modelFields ?? []).filter(it => it.data === 'urlHomePage').length > 0;
24
+
25
+ const body = gql`
26
+ {
27
+ appSwitcherModuleProxyQuery {
28
+ queryPage(
29
+ page: { currentPage: 1, size: -1, sort: { orders: { field: "priority", direction: ASC } } }
30
+ queryWrapper: {}
31
+ ) {
32
+ content {
33
+ id
34
+ homepageViewId
35
+ homePageModel
36
+ homepageViewSystemSource
37
+ displayName
38
+ name
39
+ logo
40
+ like
41
+ systemSource
42
+ category
43
+ module
44
+ state
45
+ priority
46
+ application
47
+ latestVersion
48
+ platformVersion
49
+ ${bindUrlFieldExist ? 'urlHomePage {\ntarget\nurl\n}' : ''}
50
+ }
51
+ size
52
+ totalPages
53
+ totalElements
54
+ }
55
+ }
56
+ }
57
+ `;
58
+ const res = await http.query<QueryPageResult<IModule>>(SYSTEM_MODULE_NAME.BASE, body, {}, {batch: true});
59
+ // fixme @zbh 20230417 后端排序未生效
60
+ return (ModuleService.apps = res.data.appSwitcherModuleProxyQuery.queryPage.content.sort(
61
+ (a, b) => Number(a.priority) - Number(b.priority)
62
+ ));
63
+ }
64
+
65
+ public static generatorViewTitle(action: RuntimeViewAction): string {
66
+ const {resView} = action;
67
+ return action.title || resView?.title || resView?.name || '未命名';
68
+ }
69
+ }
@@ -0,0 +1,144 @@
1
+ import { ClearCache, CurrentLanguage, UserInfo, UserLang } from '@oinone/kunlun-engine';
2
+ import { MetadataFragment, SYSTEM_MODULE_NAME } from '@oinone/kunlun-meta';
3
+ import { gql } from '@oinone/kunlun-request';
4
+ import { http } from '@oinone/kunlun-service';
5
+ import { RuntimeLanguage } from '@oinone/kunlun-vue-ui-common';
6
+
7
+ export class TopBarService {
8
+ private static userInfoCache: Promise<UserInfo> | null | undefined;
9
+
10
+ static {
11
+ ClearCache.register(() => {
12
+ TopBarService.userInfoCache = null;
13
+ });
14
+ }
15
+
16
+ public static getUserInfo(): Promise<UserInfo> {
17
+ if (TopBarService.userInfoCache) {
18
+ return TopBarService.userInfoCache;
19
+ }
20
+ TopBarService.userInfoCache = TopBarService.queryUserInfo();
21
+ return TopBarService.userInfoCache;
22
+ }
23
+
24
+ public static async getCurrentLang(): Promise<UserLang | undefined> {
25
+ try {
26
+ return await CurrentLanguage.get();
27
+ } catch (error) {
28
+ return undefined;
29
+ }
30
+ }
31
+
32
+ public static async queryUserInfo(): Promise<UserInfo> {
33
+ const body = gql`
34
+ {
35
+ topBarUserBlockQuery {
36
+ construct(data: {}) {
37
+ userAvatarAction {
38
+ ...Action
39
+ }
40
+ actionGroups {
41
+ actions {
42
+ ...Action
43
+ }
44
+ }
45
+ pamirsUser {
46
+ name
47
+ nickname
48
+ realname
49
+ id
50
+ userType
51
+ birthday
52
+ gender
53
+ phone
54
+ idCard
55
+ contactPhone
56
+ contactEmail
57
+ avatarBig {
58
+ name
59
+ id
60
+ url
61
+ }
62
+ avatarUrl
63
+ lang {
64
+ code
65
+ isoCode
66
+ active
67
+ installState
68
+ name
69
+ id
70
+ }
71
+ email
72
+ }
73
+ }
74
+ }
75
+ }
76
+
77
+ ${MetadataFragment.Action}
78
+ `;
79
+ try {
80
+ const res = await http.mutate<UserInfo>(SYSTEM_MODULE_NAME.USER, body);
81
+ return res.data.topBarUserBlockQuery.construct;
82
+ } catch (e) {
83
+ console.error('error query user info.', e);
84
+ return {} as UserInfo;
85
+ }
86
+ }
87
+
88
+ public static async queryLanguageList(): Promise<RuntimeLanguage[]> {
89
+ const body = `
90
+ {
91
+ resourceLangQuery {
92
+ queryListByWrapper(queryWrapper: { rsql: "active == 'ACTIVE' and installState == true" }) {
93
+ id
94
+ name
95
+ active
96
+ installState
97
+ code
98
+ isoCode
99
+ }
100
+ }
101
+ }
102
+ `;
103
+ try {
104
+ const res = await http.query<RuntimeLanguage[]>(SYSTEM_MODULE_NAME.RESOURCE, body);
105
+ return res.data.resourceLangQuery.queryListByWrapper;
106
+ } catch (e) {
107
+ console.error('error query language list.', e);
108
+ return [];
109
+ }
110
+ }
111
+
112
+ public static async activeLang(id: string) {
113
+ const body = gql`
114
+ mutation {
115
+ topBarLangTransientModelMutation {
116
+ activeLang(topBarLangTransientModel: { id: ${id} }) {
117
+ id
118
+ langList {
119
+ groupingRule
120
+ name
121
+ timezoneType
122
+ thousandsSep
123
+ installState
124
+ id
125
+ decimalPoint
126
+ timeFormat
127
+ calendarType
128
+ writeDate
129
+ isoCode
130
+ weekStart
131
+ dateFormat
132
+ active
133
+ code
134
+ iconId
135
+ direction
136
+ }
137
+ }
138
+ }
139
+ }
140
+ `;
141
+ const res = await http.mutate(SYSTEM_MODULE_NAME.USER, body);
142
+ return res.data.topBarLangTransientModelMutation.activeLang;
143
+ }
144
+ }