@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.
- package/README.md +1 -0
- package/dist/oinone-kunlun-vue-admin-layout.css +1 -0
- package/dist/oinone-kunlun-vue-admin-layout.esm.js +12049 -0
- package/dist/oinone-kunlun-vue-admin-layout.scss +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/src/basic/MaskWidget.d.ts +17 -0
- package/dist/types/src/basic/index.d.ts +2 -0
- package/dist/types/src/basic/register/index.d.ts +1 -0
- package/dist/types/src/basic/register/manager.d.ts +7 -0
- package/dist/types/src/basic/token/BaseMaskWidget.d.ts +55 -0
- package/dist/types/src/basic/token/index.d.ts +1 -0
- package/dist/types/src/component/app-switcher/AppSwitcher.vue.d.ts +84 -0
- package/dist/types/src/component/app-switcher/AppSwitcherMask.vue.d.ts +61 -0
- package/dist/types/src/component/app-switcher/AppSwitcherWidget.d.ts +33 -0
- package/dist/types/src/component/app-switcher/index.d.ts +3 -0
- package/dist/types/src/component/breadcrumb/BreadcrumbWidget.d.ts +33 -0
- package/dist/types/src/component/breadcrumb/DefaultBreadcrumb.vue.d.ts +58 -0
- package/dist/types/src/component/breadcrumb/index.d.ts +2 -0
- package/dist/types/src/component/debug/Debug.vue.d.ts +11 -0
- package/dist/types/src/component/debug/DebugWidget.d.ts +8 -0
- package/dist/types/src/component/debug/constants.d.ts +2 -0
- package/dist/types/src/component/debug/index.d.ts +6 -0
- package/dist/types/src/component/debug/spi/DebugMaskEditor.d.ts +6 -0
- package/dist/types/src/component/debug/spi/DebugRouterInitializeService.d.ts +4 -0
- package/dist/types/src/component/debug/spi/index.d.ts +1 -0
- package/dist/types/src/component/debug/typing.d.ts +159 -0
- package/dist/types/src/component/debug/view/DebugMainView.vue.d.ts +28 -0
- package/dist/types/src/component/debug/view/DebugMainViewWidget.d.ts +9 -0
- package/dist/types/src/component/debug/view/components/DebugDefaultInfo.vue.d.ts +22 -0
- package/dist/types/src/component/debug/view/components/DebugJsonView.vue.d.ts +26 -0
- package/dist/types/src/component/debug/view/components/DebugRequestInfoPanel.vue.d.ts +22 -0
- package/dist/types/src/component/debug/view/components/DebugResponsePanel.vue.d.ts +12 -0
- package/dist/types/src/component/debug/view/debug-api/DebugApi.vue.d.ts +52 -0
- package/dist/types/src/component/debug/view/debug-api/DebugApiWidget.d.ts +32 -0
- package/dist/types/src/component/debug/view/debug-utils.d.ts +44 -0
- package/dist/types/src/component/debug/view/debug-view/DebugView.vue.d.ts +78 -0
- package/dist/types/src/component/debug/view/debug-view/DebugViewWidget.d.ts +26 -0
- package/dist/types/src/component/debug/view/index.d.ts +5 -0
- package/dist/types/src/component/debug/view/service/DebugRuntimeContextService.d.ts +18 -0
- package/dist/types/src/component/debug/view/service/DebugStackInfoService.d.ts +27 -0
- package/dist/types/src/component/debug/view/service/impl/runtime-context/DebugDefaultRuntimeContextService.d.ts +6 -0
- package/dist/types/src/component/debug/view/service/impl/runtime-context/DebugRuntimeActionService.d.ts +7 -0
- package/dist/types/src/component/debug/view/service/impl/runtime-context/DebugRuntimeDslService.d.ts +6 -0
- package/dist/types/src/component/debug/view/service/impl/runtime-context/DebugRuntimeFieldService.d.ts +7 -0
- package/dist/types/src/component/debug/view/service/impl/runtime-context/DebugRuntimeLayoutService.d.ts +6 -0
- package/dist/types/src/component/debug/view/service/impl/runtime-context/DebugRuntimeMaskService.d.ts +6 -0
- package/dist/types/src/component/debug/view/service/impl/runtime-context/DebugRuntimeTemplateService.d.ts +6 -0
- package/dist/types/src/component/debug/view/service/impl/runtime-context/DebugRuntimeViewService.d.ts +6 -0
- package/dist/types/src/component/debug/view/service/impl/stack-info/DebugBizStackService.d.ts +6 -0
- package/dist/types/src/component/debug/view/service/impl/stack-info/DebugConfigureService.d.ts +4 -0
- package/dist/types/src/component/debug/view/service/impl/stack-info/DebugDefaultStackInfoService.d.ts +8 -0
- package/dist/types/src/component/debug/view/service/impl/stack-info/DebugExceptionStackService.d.ts +6 -0
- package/dist/types/src/component/debug/view/service/impl/stack-info/DebugFunctionService.d.ts +4 -0
- package/dist/types/src/component/debug/view/service/impl/stack-info/DebugHalfBizStackService.d.ts +6 -0
- package/dist/types/src/component/debug/view/service/impl/stack-info/DebugModelService.d.ts +4 -0
- package/dist/types/src/component/debug/view/service/impl/stack-info/DebugPureBizStackService.d.ts +6 -0
- package/dist/types/src/component/debug/view/service/impl/stack-info/DebugStacktraceGqlRequestContextService.d.ts +6 -0
- package/dist/types/src/component/debug/view/service/impl/stack-info/DebugStacktraceSceneAnalysisService.d.ts +7 -0
- package/dist/types/src/component/debug/view/service/impl/stack-info/DebugStacktraceSessionService.d.ts +6 -0
- package/dist/types/src/component/debug/view/service/index.d.ts +20 -0
- package/dist/types/src/component/debug/view/storage.d.ts +19 -0
- package/dist/types/src/component/debug/view/useDebugRequestInfo.d.ts +7 -0
- package/dist/types/src/component/divider/Divider.vue.d.ts +2 -0
- package/dist/types/src/component/divider/DividerWidget.d.ts +4 -0
- package/dist/types/src/component/divider/index.d.ts +1 -0
- package/dist/types/src/component/index.d.ts +14 -0
- package/dist/types/src/component/language/DefaultLanguage.vue.d.ts +34 -0
- package/dist/types/src/component/language/LanguageWidget.d.ts +16 -0
- package/dist/types/src/component/language/index.d.ts +1 -0
- package/dist/types/src/component/layout/BaseMaskLayoutWidget.d.ts +4 -0
- package/dist/types/src/component/layout/MaskBlock.vue.d.ts +24 -0
- package/dist/types/src/component/layout/block/MaskBlockWidget.d.ts +4 -0
- package/dist/types/src/component/layout/block/index.d.ts +1 -0
- package/dist/types/src/component/layout/container/MaskContainerWidget.d.ts +4 -0
- package/dist/types/src/component/layout/container/index.d.ts +1 -0
- package/dist/types/src/component/layout/content/MaskContentWidget.d.ts +7 -0
- package/dist/types/src/component/layout/content/index.d.ts +1 -0
- package/dist/types/src/component/layout/grid/Grid.vue.d.ts +2 -0
- package/dist/types/src/component/layout/grid/GridWidget.d.ts +9 -0
- package/dist/types/src/component/layout/grid/index.d.ts +1 -0
- package/dist/types/src/component/layout/header/MaskHeaderWidget.d.ts +4 -0
- package/dist/types/src/component/layout/header/index.d.ts +1 -0
- package/dist/types/src/component/layout/index.d.ts +9 -0
- package/dist/types/src/component/layout/mask/MaskRootWidget.d.ts +4 -0
- package/dist/types/src/component/layout/mask/index.d.ts +1 -0
- package/dist/types/src/component/layout/sidebar/MaskSidebarWidget.d.ts +10 -0
- package/dist/types/src/component/layout/sidebar/index.d.ts +1 -0
- package/dist/types/src/component/layout/widget/MaskCommonWidget.d.ts +14 -0
- package/dist/types/src/component/layout/widget/index.d.ts +1 -0
- package/dist/types/src/component/menu/DefaultMenu.vue.d.ts +115 -0
- package/dist/types/src/component/menu/DefaultSubMenu.vue.d.ts +17 -0
- package/dist/types/src/component/menu/MenuWidget.d.ts +71 -0
- package/dist/types/src/component/menu/index.d.ts +3 -0
- package/dist/types/src/component/multi-tabs/MultiTabs.vue.d.ts +151 -0
- package/dist/types/src/component/multi-tabs/MultiTabsWidget.d.ts +60 -0
- package/dist/types/src/component/multi-tabs/index.d.ts +2 -0
- package/dist/types/src/component/multi-tabs/typing.d.ts +6 -0
- package/dist/types/src/component/notification/DefaultNotification.vue.d.ts +61 -0
- package/dist/types/src/component/notification/NotificationWidget.d.ts +139 -0
- package/dist/types/src/component/notification/index.d.ts +2 -0
- package/dist/types/src/component/order-statistic/OrderStatistic.vue.d.ts +8 -0
- package/dist/types/src/component/order-statistic/index.d.ts +14 -0
- package/dist/types/src/component/partner-switcher/PartnerSwitcher.vue.d.ts +28 -0
- package/dist/types/src/component/partner-switcher/PartnerSwitcherWidget.d.ts +15 -0
- package/dist/types/src/component/partner-switcher/index.d.ts +6 -0
- package/dist/types/src/component/partner-switcher/service/PartnerSwitcherService.d.ts +17 -0
- package/dist/types/src/component/partner-switcher/service/impl/PartnerSwitcherServiceImpl.d.ts +17 -0
- package/dist/types/src/component/partner-switcher/service/index.d.ts +2 -0
- package/dist/types/src/component/partner-switcher/session/PartnerInfoSession.d.ts +26 -0
- package/dist/types/src/component/partner-switcher/session/impl/DefaultPartnerInfoSession.d.ts +15 -0
- package/dist/types/src/component/partner-switcher/session/index.d.ts +2 -0
- package/dist/types/src/component/partner-switcher/spi/PartnerSwitcherMaskEditor.d.ts +6 -0
- package/dist/types/src/component/partner-switcher/spi/index.d.ts +1 -0
- package/dist/types/src/component/partner-switcher/typing/index.d.ts +1 -0
- package/dist/types/src/component/partner-switcher/typing/partner.d.ts +20 -0
- package/dist/types/src/component/quick-search/QuickSearch.vue.d.ts +29 -0
- package/dist/types/src/component/quick-search/index.d.ts +24 -0
- package/dist/types/src/component/user/DefaultUser.vue.d.ts +39 -0
- package/dist/types/src/component/user/UserWidget.d.ts +16 -0
- package/dist/types/src/component/user/index.d.ts +1 -0
- package/dist/types/src/config/DebugConfig.d.ts +16 -0
- package/dist/types/src/config/PartnerSwitcherConfig.d.ts +16 -0
- package/dist/types/src/config/index.d.ts +2 -0
- package/dist/types/src/index.d.ts +10 -0
- package/dist/types/src/service/index.d.ts +5 -0
- package/dist/types/src/service/menu-service.d.ts +12 -0
- package/dist/types/src/service/message-service.d.ts +16 -0
- package/dist/types/src/service/module-service.d.ts +7 -0
- package/dist/types/src/service/top-bar-service.d.ts +10 -0
- package/dist/types/src/service/user-service.d.ts +4 -0
- package/dist/types/src/spi/index.d.ts +1 -0
- package/dist/types/src/spi/mask-editor.d.ts +54 -0
- package/dist/types/src/tags/Block.vue.d.ts +5 -0
- package/dist/types/src/tags/Breadcrumb.vue.d.ts +5 -0
- package/dist/types/src/tags/Container.vue.d.ts +5 -0
- package/dist/types/src/tags/Content.vue.d.ts +5 -0
- package/dist/types/src/tags/Header.vue.d.ts +5 -0
- package/dist/types/src/tags/Mask.vue.d.ts +5 -0
- package/dist/types/src/tags/MultiTabs.vue.d.ts +5 -0
- package/dist/types/src/tags/Sidebar.vue.d.ts +5 -0
- package/dist/types/src/tags/Widget.vue.d.ts +5 -0
- package/dist/types/src/tags/context/context.d.ts +8 -0
- package/dist/types/src/tags/context/index.d.ts +1 -0
- package/dist/types/src/tags/index.d.ts +6 -0
- package/dist/types/src/tags/mixin/MaskWidgetTagMixin.d.ts +2 -0
- package/dist/types/src/tags/mixin/index.d.ts +3 -0
- package/dist/types/src/tags/mixin/typing.d.ts +6 -0
- package/dist/types/src/tags/mixin/use-mask-widget-tag.d.ts +38 -0
- package/dist/types/src/tags/register/index.d.ts +1 -0
- package/dist/types/src/tags/register/manager.d.ts +9 -0
- package/dist/types/src/tags/resolve/index.d.ts +2 -0
- package/dist/types/src/tags/resolve/internal/index.d.ts +2 -0
- package/dist/types/src/tags/resolve/internal/typing.d.ts +5 -0
- package/dist/types/src/tags/resolve/internal/widget-resolve.d.ts +3 -0
- package/dist/types/src/tags/resolve/typing.d.ts +26 -0
- package/dist/types/src/tags/resolve/widget-resolve.d.ts +5 -0
- package/dist/types/src/template/default-mask.d.ts +2 -0
- package/dist/types/src/template/index.d.ts +6 -0
- package/dist/types/src/theme/index.d.ts +1 -0
- package/dist/types/src/typing/constant.d.ts +1 -0
- package/dist/types/src/typing/index.d.ts +3 -0
- package/dist/types/src/typing/menu.d.ts +12 -0
- package/dist/types/src/typing/stream-symble.d.ts +12 -0
- package/dist/types/src/util/HomepageUtils.d.ts +3 -0
- package/dist/types/src/util/MenuUtil.d.ts +5 -0
- package/dist/types/src/util/index.d.ts +3 -0
- package/dist/types/src/util/unauthorized-action.d.ts +14 -0
- package/dist/types/src/utils.d.ts +86 -0
- package/index.ts +1 -0
- package/package.json +47 -0
- package/rollup.config.js +33 -0
- package/src/basic/MaskWidget.ts +74 -0
- package/src/basic/index.ts +2 -0
- package/src/basic/register/index.ts +1 -0
- package/src/basic/register/manager.ts +17 -0
- package/src/basic/token/BaseMaskWidget.ts +187 -0
- package/src/basic/token/index.ts +1 -0
- package/src/component/app-switcher/AppSwitcher.vue +133 -0
- package/src/component/app-switcher/AppSwitcherMask.vue +237 -0
- package/src/component/app-switcher/AppSwitcherWidget.ts +152 -0
- package/src/component/app-switcher/index.ts +3 -0
- package/src/component/breadcrumb/BreadcrumbWidget.ts +167 -0
- package/src/component/breadcrumb/DefaultBreadcrumb.vue +95 -0
- package/src/component/breadcrumb/index.ts +2 -0
- package/src/component/debug/Debug.vue +28 -0
- package/src/component/debug/DebugWidget.ts +38 -0
- package/src/component/debug/constants.ts +3 -0
- package/src/component/debug/index.ts +6 -0
- package/src/component/debug/spi/DebugMaskEditor.ts +19 -0
- package/src/component/debug/spi/DebugRouterInitializeService.ts +21 -0
- package/src/component/debug/spi/index.ts +1 -0
- package/src/component/debug/typing.ts +191 -0
- package/src/component/debug/view/DebugMainView.vue +206 -0
- package/src/component/debug/view/DebugMainViewWidget.ts +42 -0
- package/src/component/debug/view/components/DebugDefaultInfo.vue +31 -0
- package/src/component/debug/view/components/DebugJsonView.vue +107 -0
- package/src/component/debug/view/components/DebugRequestInfoPanel.vue +129 -0
- package/src/component/debug/view/components/DebugResponsePanel.vue +66 -0
- package/src/component/debug/view/components/runtime-context/DebugRuntimeFieldComponent.vue +29 -0
- package/src/component/debug/view/debug-api/DebugApi.vue +225 -0
- package/src/component/debug/view/debug-api/DebugApiWidget.ts +400 -0
- package/src/component/debug/view/debug-utils.ts +114 -0
- package/src/component/debug/view/debug-view/DebugView.vue +331 -0
- package/src/component/debug/view/debug-view/DebugViewWidget.ts +181 -0
- package/src/component/debug/view/index.ts +6 -0
- package/src/component/debug/view/service/DebugRuntimeContextService.ts +21 -0
- package/src/component/debug/view/service/DebugStackInfoService.ts +33 -0
- package/src/component/debug/view/service/impl/runtime-context/DebugDefaultRuntimeContextService.ts +16 -0
- package/src/component/debug/view/service/impl/runtime-context/DebugRuntimeActionService.ts +28 -0
- package/src/component/debug/view/service/impl/runtime-context/DebugRuntimeDslService.ts +16 -0
- package/src/component/debug/view/service/impl/runtime-context/DebugRuntimeFieldService.ts +33 -0
- package/src/component/debug/view/service/impl/runtime-context/DebugRuntimeLayoutService.ts +16 -0
- package/src/component/debug/view/service/impl/runtime-context/DebugRuntimeMaskService.ts +30 -0
- package/src/component/debug/view/service/impl/runtime-context/DebugRuntimeTemplateService.ts +16 -0
- package/src/component/debug/view/service/impl/runtime-context/DebugRuntimeViewService.ts +16 -0
- package/src/component/debug/view/service/impl/stack-info/DebugBizStackService.ts +19 -0
- package/src/component/debug/view/service/impl/stack-info/DebugConfigureService.ts +6 -0
- package/src/component/debug/view/service/impl/stack-info/DebugDefaultStackInfoService.ts +62 -0
- package/src/component/debug/view/service/impl/stack-info/DebugExceptionStackService.ts +19 -0
- package/src/component/debug/view/service/impl/stack-info/DebugFunctionService.ts +6 -0
- package/src/component/debug/view/service/impl/stack-info/DebugHalfBizStackService.ts +19 -0
- package/src/component/debug/view/service/impl/stack-info/DebugModelService.ts +6 -0
- package/src/component/debug/view/service/impl/stack-info/DebugPureBizStackService.ts +19 -0
- package/src/component/debug/view/service/impl/stack-info/DebugStacktraceGqlRequestContextService.ts +22 -0
- package/src/component/debug/view/service/impl/stack-info/DebugStacktraceSceneAnalysisService.ts +35 -0
- package/src/component/debug/view/service/impl/stack-info/DebugStacktraceSessionService.ts +19 -0
- package/src/component/debug/view/service/index.ts +22 -0
- package/src/component/debug/view/storage.ts +35 -0
- package/src/component/debug/view/useDebugRequestInfo.ts +17 -0
- package/src/component/divider/Divider.vue +15 -0
- package/src/component/divider/DividerWidget.ts +12 -0
- package/src/component/divider/index.ts +1 -0
- package/src/component/index.ts +15 -0
- package/src/component/language/DefaultLanguage.vue +111 -0
- package/src/component/language/LanguageWidget.ts +72 -0
- package/src/component/language/index.ts +1 -0
- package/src/component/layout/BaseMaskLayoutWidget.ts +12 -0
- package/src/component/layout/MaskBlock.vue +31 -0
- package/src/component/layout/block/MaskBlockWidget.ts +17 -0
- package/src/component/layout/block/index.ts +1 -0
- package/src/component/layout/container/MaskContainerWidget.ts +13 -0
- package/src/component/layout/container/index.ts +1 -0
- package/src/component/layout/content/MaskContentWidget.ts +41 -0
- package/src/component/layout/content/index.ts +1 -0
- package/src/component/layout/grid/Grid.vue +10 -0
- package/src/component/layout/grid/GridWidget.ts +62 -0
- package/src/component/layout/grid/index.ts +1 -0
- package/src/component/layout/header/MaskHeaderWidget.ts +13 -0
- package/src/component/layout/header/index.ts +1 -0
- package/src/component/layout/index.ts +9 -0
- package/src/component/layout/mask/MaskRootWidget.ts +13 -0
- package/src/component/layout/mask/index.ts +1 -0
- package/src/component/layout/sidebar/MaskSidebarWidget.ts +31 -0
- package/src/component/layout/sidebar/index.ts +1 -0
- package/src/component/layout/widget/MaskCommonWidget.ts +95 -0
- package/src/component/layout/widget/index.ts +1 -0
- package/src/component/menu/DefaultMenu.vue +252 -0
- package/src/component/menu/DefaultSubMenu.vue +68 -0
- package/src/component/menu/MenuWidget.ts +349 -0
- package/src/component/menu/index.ts +3 -0
- package/src/component/menu/style/common.scss +411 -0
- package/src/component/menu/style/index.scss +2 -0
- package/src/component/menu/style/menu-theme/index.scss +5 -0
- package/src/component/menu/style/menu-theme/theme2.scss +37 -0
- package/src/component/menu/style/menu-theme/theme3.scss +59 -0
- package/src/component/menu/style/menu-theme/theme4.scss +56 -0
- package/src/component/menu/style/menu-theme/theme5.scss +45 -0
- package/src/component/menu/style/menu-theme/theme6.scss +45 -0
- package/src/component/menu/style/mixin.scss +23 -0
- package/src/component/multi-tabs/MultiTabs.vue +475 -0
- package/src/component/multi-tabs/MultiTabsWidget.ts +450 -0
- package/src/component/multi-tabs/index.ts +2 -0
- package/src/component/multi-tabs/style/index.scss +217 -0
- package/src/component/multi-tabs/style/mixin.scss +13 -0
- package/src/component/multi-tabs/style/parameters.scss +2 -0
- package/src/component/multi-tabs/style/theme1.scss +92 -0
- package/src/component/multi-tabs/style/theme2.scss +89 -0
- package/src/component/multi-tabs/style/theme3.scss +60 -0
- package/src/component/multi-tabs/style/theme4.scss +85 -0
- package/src/component/multi-tabs/typing.ts +7 -0
- package/src/component/notification/DefaultNotification.vue +455 -0
- package/src/component/notification/NotificationWidget.ts +332 -0
- package/src/component/notification/index.ts +2 -0
- package/src/component/order-statistic/OrderStatistic.vue +12 -0
- package/src/component/order-statistic/index.ts +146 -0
- package/src/component/partner-switcher/PartnerSwitcher.vue +75 -0
- package/src/component/partner-switcher/PartnerSwitcherWidget.ts +70 -0
- package/src/component/partner-switcher/index.ts +6 -0
- package/src/component/partner-switcher/service/PartnerSwitcherService.ts +20 -0
- package/src/component/partner-switcher/service/impl/PartnerSwitcherServiceImpl.ts +48 -0
- package/src/component/partner-switcher/service/index.ts +2 -0
- package/src/component/partner-switcher/session/PartnerInfoSession.ts +32 -0
- package/src/component/partner-switcher/session/impl/DefaultPartnerInfoSession.ts +46 -0
- package/src/component/partner-switcher/session/index.ts +2 -0
- package/src/component/partner-switcher/spi/PartnerSwitcherMaskEditor.ts +24 -0
- package/src/component/partner-switcher/spi/index.ts +1 -0
- package/src/component/partner-switcher/typing/index.ts +1 -0
- package/src/component/partner-switcher/typing/partner.ts +22 -0
- package/src/component/quick-search/QuickSearch.vue +34 -0
- package/src/component/quick-search/index.ts +237 -0
- package/src/component/style/index.scss +4 -0
- package/src/component/style/layout.scss +229 -0
- package/src/component/user/DefaultUser.vue +92 -0
- package/src/component/user/UserWidget.ts +129 -0
- package/src/component/user/index.ts +1 -0
- package/src/config/DebugConfig.ts +30 -0
- package/src/config/PartnerSwitcherConfig.ts +30 -0
- package/src/config/index.ts +2 -0
- package/src/index.ts +11 -0
- package/src/service/index.ts +5 -0
- package/src/service/menu-service.ts +105 -0
- package/src/service/message-service.ts +65 -0
- package/src/service/module-service.ts +69 -0
- package/src/service/top-bar-service.ts +144 -0
- package/src/service/user-service.ts +10 -0
- package/src/shim-translate.d.ts +7 -0
- package/src/shim-vue.d.ts +6 -0
- package/src/spi/index.ts +1 -0
- package/src/spi/mask-editor.ts +102 -0
- package/src/tags/Block.vue +16 -0
- package/src/tags/Breadcrumb.vue +16 -0
- package/src/tags/Container.vue +16 -0
- package/src/tags/Content.vue +16 -0
- package/src/tags/Header.vue +16 -0
- package/src/tags/Mask.vue +16 -0
- package/src/tags/MultiTabs.vue +16 -0
- package/src/tags/Sidebar.vue +16 -0
- package/src/tags/Widget.vue +16 -0
- package/src/tags/context/context.ts +24 -0
- package/src/tags/context/index.ts +1 -0
- package/src/tags/index.ts +48 -0
- package/src/tags/mixin/MaskWidgetTagMixin.ts +79 -0
- package/src/tags/mixin/index.ts +3 -0
- package/src/tags/mixin/typing.ts +8 -0
- package/src/tags/mixin/use-mask-widget-tag.ts +172 -0
- package/src/tags/register/index.ts +1 -0
- package/src/tags/register/manager.ts +43 -0
- package/src/tags/resolve/index.ts +2 -0
- package/src/tags/resolve/internal/index.ts +2 -0
- package/src/tags/resolve/internal/typing.ts +6 -0
- package/src/tags/resolve/internal/widget-resolve.ts +57 -0
- package/src/tags/resolve/typing.ts +39 -0
- package/src/tags/resolve/widget-resolve.ts +64 -0
- package/src/template/default-mask.ts +51 -0
- package/src/template/index.ts +26 -0
- package/src/theme/index.ts +1 -0
- package/src/typing/constant.ts +3 -0
- package/src/typing/index.ts +3 -0
- package/src/typing/menu.ts +15 -0
- package/src/typing/stream-symble.ts +14 -0
- package/src/util/HomepageUtils.ts +41 -0
- package/src/util/MenuUtil.ts +18 -0
- package/src/util/index.ts +3 -0
- package/src/util/unauthorized-action.ts +98 -0
- package/src/utils.ts +716 -0
|
@@ -0,0 +1,400 @@
|
|
|
1
|
+
import { SPI } from '@oinone/kunlun-spi';
|
|
2
|
+
import { VueWidget, Widget } from '@oinone/kunlun-vue-widget';
|
|
3
|
+
import { DefinitionNode, FieldNode, OperationDefinitionNode, SelectionNode } from 'graphql';
|
|
4
|
+
import gql from 'graphql-tag';
|
|
5
|
+
import { isArray, isPlainObject } from 'lodash-es';
|
|
6
|
+
import {
|
|
7
|
+
DebugErrorPanel,
|
|
8
|
+
DebugFetchRequest,
|
|
9
|
+
DebugFetchResponse,
|
|
10
|
+
DebugRequestFunction,
|
|
11
|
+
DebugRequestGQLBody,
|
|
12
|
+
DebugRequestGraphQLInfo,
|
|
13
|
+
DebugRequestInfo,
|
|
14
|
+
DebugResponseData,
|
|
15
|
+
DebugResponseError,
|
|
16
|
+
RequestResolveResult
|
|
17
|
+
} from '../../typing';
|
|
18
|
+
import { DebugUtils } from '../debug-utils';
|
|
19
|
+
import {
|
|
20
|
+
DebugDefaultStackInfoServiceType,
|
|
21
|
+
DebugStackInfoServiceToken,
|
|
22
|
+
DebugUnhandledExceptionMessage,
|
|
23
|
+
DebugUnhandledExceptionTitle
|
|
24
|
+
} from '../service';
|
|
25
|
+
import { DebugInfoStorage } from '../storage';
|
|
26
|
+
import DebugApi from './DebugApi.vue';
|
|
27
|
+
|
|
28
|
+
const RESOURCE_TIMING_TYPE = 'resource';
|
|
29
|
+
|
|
30
|
+
const STACK_TRACE_CODE = 'stackTrace';
|
|
31
|
+
|
|
32
|
+
function isOperationNode(node: DefinitionNode): node is OperationDefinitionNode {
|
|
33
|
+
return node.kind === 'OperationDefinition';
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function isFieldNode(node: SelectionNode): node is FieldNode {
|
|
37
|
+
return node.kind === 'Field';
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export class DebugApiWidget extends VueWidget {
|
|
41
|
+
private performanceObserver?: PerformanceObserver;
|
|
42
|
+
|
|
43
|
+
public initialize(props) {
|
|
44
|
+
super.initialize(props);
|
|
45
|
+
this.setComponent(DebugApi);
|
|
46
|
+
return this;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@Widget.Inject()
|
|
50
|
+
@Widget.Reactive()
|
|
51
|
+
protected activeDebugTab?: string;
|
|
52
|
+
|
|
53
|
+
@Widget.Reactive()
|
|
54
|
+
private requestInfo: DebugRequestInfo | undefined;
|
|
55
|
+
|
|
56
|
+
@Widget.Reactive()
|
|
57
|
+
private responseData: string | undefined;
|
|
58
|
+
|
|
59
|
+
@Widget.Method()
|
|
60
|
+
public resetInfo() {
|
|
61
|
+
this.requestInfo = undefined;
|
|
62
|
+
this.responseData = undefined;
|
|
63
|
+
DebugUtils.getDebugStorage().requestInfo = undefined;
|
|
64
|
+
DebugUtils.getDebugStorage().responseData = undefined;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@Widget.Method()
|
|
68
|
+
public resolveRequestData(data: string): RequestResolveResult | undefined {
|
|
69
|
+
data = data.replace(/\r?\n/g, '');
|
|
70
|
+
const match = data.match(/(\w+)\((.*)\);/);
|
|
71
|
+
if (!match) {
|
|
72
|
+
return undefined;
|
|
73
|
+
}
|
|
74
|
+
const methodName = match[1];
|
|
75
|
+
if (methodName !== 'fetch') {
|
|
76
|
+
return undefined;
|
|
77
|
+
}
|
|
78
|
+
const argsString = match[2].trim();
|
|
79
|
+
if (!argsString) {
|
|
80
|
+
return undefined;
|
|
81
|
+
}
|
|
82
|
+
let args: unknown[];
|
|
83
|
+
try {
|
|
84
|
+
args = JSON.parse(`[${argsString}]`);
|
|
85
|
+
} catch (e) {
|
|
86
|
+
console.error('Arguments resolve error.', e);
|
|
87
|
+
return undefined;
|
|
88
|
+
}
|
|
89
|
+
if (args.length !== 2) {
|
|
90
|
+
return undefined;
|
|
91
|
+
}
|
|
92
|
+
const [arg1, arg2] = args;
|
|
93
|
+
if (typeof arg1 === 'string' && isPlainObject(arg2)) {
|
|
94
|
+
return {
|
|
95
|
+
url: arg1,
|
|
96
|
+
body: arg2 as RequestInit
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
@Widget.Method()
|
|
102
|
+
public async request(fetchObject: DebugFetchRequest): Promise<DebugFetchResponse | undefined> {
|
|
103
|
+
try {
|
|
104
|
+
const response = await this.requestAnalysis(fetchObject);
|
|
105
|
+
if (!response.ok) {
|
|
106
|
+
return this.requestError('网络请求失败');
|
|
107
|
+
}
|
|
108
|
+
const data = await response.text();
|
|
109
|
+
try {
|
|
110
|
+
const json = JSON.parse(data);
|
|
111
|
+
return this.requestSuccess(await this.responseAnalysis(json));
|
|
112
|
+
} catch (e) {
|
|
113
|
+
const hint = '响应结果解析失败,请查看完整响应结果';
|
|
114
|
+
console.error(hint, e);
|
|
115
|
+
return {
|
|
116
|
+
data,
|
|
117
|
+
hint
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
} catch (e) {
|
|
121
|
+
const hint = '接口测试出现错误';
|
|
122
|
+
console.error(hint, e);
|
|
123
|
+
return {
|
|
124
|
+
data: `${e}`,
|
|
125
|
+
hint
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
protected async requestAnalysis(fetchObject: DebugFetchRequest): Promise<Response> {
|
|
131
|
+
const { url, body, level } = fetchObject;
|
|
132
|
+
this.performanceObserver?.observe({ entryTypes: [RESOURCE_TIMING_TYPE] });
|
|
133
|
+
const requestBody = JSON.parse(`${body.body}`);
|
|
134
|
+
const resolveUrl = new URL(url);
|
|
135
|
+
resolveUrl.searchParams.set('debug', `${level}`);
|
|
136
|
+
const debugUrl = resolveUrl.toString();
|
|
137
|
+
this.requestInfo = {
|
|
138
|
+
url,
|
|
139
|
+
debugUrl,
|
|
140
|
+
method: requestBody.method,
|
|
141
|
+
header: DebugUtils.toJSONString(body.headers),
|
|
142
|
+
...this.gqlAnalysis(requestBody)
|
|
143
|
+
};
|
|
144
|
+
DebugUtils.getDebugStorage().requestInfo = this.requestInfo;
|
|
145
|
+
return await fetch(debugUrl, body);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
protected gqlAnalysis(body: DebugRequestGQLBody | DebugRequestGQLBody[]): {
|
|
149
|
+
gqlInfos: DebugRequestGraphQLInfo[];
|
|
150
|
+
functions: DebugRequestFunction[];
|
|
151
|
+
} {
|
|
152
|
+
const gqlInfos: DebugRequestGraphQLInfo[] = [];
|
|
153
|
+
if (!isArray(body)) {
|
|
154
|
+
body = [body];
|
|
155
|
+
}
|
|
156
|
+
const functions: DebugRequestFunction[] = [];
|
|
157
|
+
for (let i = 0; i < body.length; i++) {
|
|
158
|
+
const gqlBody = body[i];
|
|
159
|
+
const gqlQuery = gqlBody.query?.replace(/\\n/g, '\n');
|
|
160
|
+
if (!gqlQuery) {
|
|
161
|
+
console.error('Invalid gql query.');
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
gqlInfos.push({
|
|
165
|
+
key: `${i + 1}`,
|
|
166
|
+
title: `GQL#${i + 1}`,
|
|
167
|
+
gql: gqlQuery,
|
|
168
|
+
variables: DebugUtils.toJSONString(gqlBody.variables)
|
|
169
|
+
});
|
|
170
|
+
const nodes = gql`
|
|
171
|
+
${gqlQuery}
|
|
172
|
+
`.definitions;
|
|
173
|
+
for (const node of nodes) {
|
|
174
|
+
if (!isOperationNode(node)) {
|
|
175
|
+
continue;
|
|
176
|
+
}
|
|
177
|
+
const method = node.operation;
|
|
178
|
+
const namespaceSelections = node.selectionSet.selections.filter(isFieldNode);
|
|
179
|
+
if (!namespaceSelections) {
|
|
180
|
+
continue;
|
|
181
|
+
}
|
|
182
|
+
for (const namespaceSelection of namespaceSelections) {
|
|
183
|
+
const namespace = namespaceSelection.name.value;
|
|
184
|
+
const nameSelections = namespaceSelection.selectionSet?.selections.filter(isFieldNode);
|
|
185
|
+
if (!nameSelections) {
|
|
186
|
+
continue;
|
|
187
|
+
}
|
|
188
|
+
for (const nameSelection of nameSelections) {
|
|
189
|
+
const name = nameSelection.name.value;
|
|
190
|
+
functions.push({
|
|
191
|
+
key: `${functions.length + 1}`,
|
|
192
|
+
gqlIndex: i,
|
|
193
|
+
method,
|
|
194
|
+
namespace,
|
|
195
|
+
name
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
return {
|
|
202
|
+
gqlInfos,
|
|
203
|
+
functions
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
public async responseAnalysis(responseBody: DebugResponseData | DebugResponseData[]): Promise<string> {
|
|
208
|
+
let { requestInfo } = this;
|
|
209
|
+
if (!requestInfo) {
|
|
210
|
+
requestInfo = this.generatorRequestInfoByResponse(responseBody);
|
|
211
|
+
this.requestInfo = requestInfo;
|
|
212
|
+
DebugUtils.getDebugStorage().requestInfo = requestInfo;
|
|
213
|
+
}
|
|
214
|
+
if (requestInfo) {
|
|
215
|
+
if (!isArray(responseBody)) {
|
|
216
|
+
responseBody = [responseBody];
|
|
217
|
+
}
|
|
218
|
+
this.resolveResponseError(requestInfo, responseBody[0]);
|
|
219
|
+
const { functions, gqlInfos } = requestInfo;
|
|
220
|
+
if (!gqlInfos?.length || !responseBody.length || gqlInfos.length !== responseBody.length) {
|
|
221
|
+
console.error('Invalid response body size.', requestInfo, responseBody);
|
|
222
|
+
return DebugUtils.toJSONString(responseBody);
|
|
223
|
+
}
|
|
224
|
+
for (let i = 0; i < gqlInfos.length; i++) {
|
|
225
|
+
this.resolveResponseDebug(gqlInfos[i], responseBody[i]);
|
|
226
|
+
}
|
|
227
|
+
if (functions) {
|
|
228
|
+
for (const fun of functions) {
|
|
229
|
+
const funData = responseBody[fun.gqlIndex]?.data?.[fun.namespace]?.[fun.name];
|
|
230
|
+
if (funData) {
|
|
231
|
+
fun.responseData = DebugUtils.toJSONString(responseBody[fun.gqlIndex]?.data?.[fun.namespace]?.[fun.name]);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
const responseData = DebugUtils.toJSONString(responseBody);
|
|
237
|
+
this.responseData = responseData;
|
|
238
|
+
return responseData;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
protected resolveResponseError(requestInfo: DebugRequestInfo, responseBody: DebugResponseData) {
|
|
242
|
+
const firstError = responseBody?.errors?.[0];
|
|
243
|
+
if (!firstError) {
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
requestInfo.errorCode = firstError.extensions?.errorCode;
|
|
247
|
+
requestInfo.errorMessage = firstError.extensions?.messages?.[0]?.message || firstError.message;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
protected resolveResponseDebug(
|
|
251
|
+
requestInfo: { handledExceptions?: DebugErrorPanel[] },
|
|
252
|
+
responseBody: DebugResponseData
|
|
253
|
+
) {
|
|
254
|
+
let errors = responseBody.errors;
|
|
255
|
+
if (!errors?.length || errors?.filter((v) => v.extensions?.errorCode === STACK_TRACE_CODE).length === 0) {
|
|
256
|
+
errors = responseBody.extensions?.debug;
|
|
257
|
+
}
|
|
258
|
+
if (!errors?.length) {
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
const defaultStackInfoService = SPI.RawInstantiate(DebugStackInfoServiceToken, {
|
|
262
|
+
name: DebugDefaultStackInfoServiceType
|
|
263
|
+
})!;
|
|
264
|
+
const handledExceptions: DebugErrorPanel[] = [];
|
|
265
|
+
const unhandledExceptions: DebugResponseError[] = [];
|
|
266
|
+
let index = 1;
|
|
267
|
+
for (let i = 0; i < errors.length; i++) {
|
|
268
|
+
const error = errors[i];
|
|
269
|
+
if (error.extensions?.errorCode !== STACK_TRACE_CODE) {
|
|
270
|
+
continue;
|
|
271
|
+
}
|
|
272
|
+
const type = error.extensions?.stackTraceKey;
|
|
273
|
+
if (!type) {
|
|
274
|
+
console.error('Invalid error type.', error);
|
|
275
|
+
unhandledExceptions.push(error);
|
|
276
|
+
continue;
|
|
277
|
+
}
|
|
278
|
+
let stackInfoService = SPI.RawInstantiate(DebugStackInfoServiceToken, { name: type });
|
|
279
|
+
let usingDefaultService = false;
|
|
280
|
+
if (!stackInfoService) {
|
|
281
|
+
stackInfoService = defaultStackInfoService;
|
|
282
|
+
usingDefaultService = true;
|
|
283
|
+
}
|
|
284
|
+
const handledException = stackInfoService.analysis(error, errors) as unknown as DebugErrorPanel;
|
|
285
|
+
if (handledException) {
|
|
286
|
+
handledException.key = `${index++}`;
|
|
287
|
+
handledExceptions.push(handledException);
|
|
288
|
+
} else if (usingDefaultService) {
|
|
289
|
+
console.error('Invalid stack info service.', error);
|
|
290
|
+
unhandledExceptions.push(error);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
if (handledExceptions.length) {
|
|
294
|
+
requestInfo.handledExceptions = handledExceptions;
|
|
295
|
+
}
|
|
296
|
+
if (defaultStackInfoService && unhandledExceptions.length) {
|
|
297
|
+
const unhandledStackInfos: unknown[] = [];
|
|
298
|
+
for (const unhandledException of unhandledExceptions) {
|
|
299
|
+
const unhandledStackInfo = defaultStackInfoService.parseStackInfo(
|
|
300
|
+
unhandledException,
|
|
301
|
+
errors
|
|
302
|
+
) as DebugErrorPanel;
|
|
303
|
+
if (unhandledStackInfo) {
|
|
304
|
+
unhandledStackInfos.push(unhandledStackInfo);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
if (unhandledStackInfos.length) {
|
|
308
|
+
handledExceptions.push({
|
|
309
|
+
key: `${index++}`,
|
|
310
|
+
title: DebugUnhandledExceptionTitle,
|
|
311
|
+
message: DebugUnhandledExceptionMessage,
|
|
312
|
+
stackInfo: DebugUtils.toJSONString(unhandledStackInfos)
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
protected generatorRequestInfoByResponse(
|
|
319
|
+
responseBody: DebugResponseData | DebugResponseData[]
|
|
320
|
+
): DebugRequestInfo | undefined {
|
|
321
|
+
if (!isArray(responseBody)) {
|
|
322
|
+
responseBody = [responseBody];
|
|
323
|
+
}
|
|
324
|
+
const gqlInfos: DebugRequestGraphQLInfo[] = [];
|
|
325
|
+
const functions: DebugRequestFunction[] = [];
|
|
326
|
+
let i = 0;
|
|
327
|
+
for (const response of responseBody) {
|
|
328
|
+
const responseData = response.data || {};
|
|
329
|
+
for (const namespace of Object.keys(responseData) || []) {
|
|
330
|
+
const responseFunctionData = responseData[namespace] || {};
|
|
331
|
+
if (typeof responseFunctionData === 'object') {
|
|
332
|
+
for (const name of Object.keys(responseFunctionData) || []) {
|
|
333
|
+
gqlInfos.push({
|
|
334
|
+
key: `${i + 1}`,
|
|
335
|
+
title: `GQL#${i + 1}`,
|
|
336
|
+
gql: ''
|
|
337
|
+
});
|
|
338
|
+
functions.push({
|
|
339
|
+
key: `${functions.length + 1}`,
|
|
340
|
+
gqlIndex: i,
|
|
341
|
+
method: 'query',
|
|
342
|
+
namespace,
|
|
343
|
+
name
|
|
344
|
+
});
|
|
345
|
+
i++;
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
if (functions.length) {
|
|
351
|
+
return {
|
|
352
|
+
allDuration: -1,
|
|
353
|
+
gqlInfos,
|
|
354
|
+
functions
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
protected requestSuccess(data: string) {
|
|
360
|
+
return {
|
|
361
|
+
data,
|
|
362
|
+
hint: null
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
protected requestError(message: string): DebugFetchResponse {
|
|
367
|
+
return {
|
|
368
|
+
hint: message
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
protected onStorageUpdate = (storage: DebugInfoStorage) => {
|
|
373
|
+
const that = this.getOperator<this>();
|
|
374
|
+
that.requestInfo = storage.requestInfo;
|
|
375
|
+
that.responseData = storage.responseData;
|
|
376
|
+
};
|
|
377
|
+
|
|
378
|
+
protected mounted() {
|
|
379
|
+
this.performanceObserver = new PerformanceObserver((list, observer) => {
|
|
380
|
+
for (const entry of list.getEntries()) {
|
|
381
|
+
if (entry.entryType === RESOURCE_TIMING_TYPE) {
|
|
382
|
+
const { requestInfo } = this;
|
|
383
|
+
if (requestInfo) {
|
|
384
|
+
const resourceTiming = entry as PerformanceResourceTiming;
|
|
385
|
+
requestInfo.allDuration = resourceTiming.duration;
|
|
386
|
+
requestInfo.connectDuration = resourceTiming.connectEnd - resourceTiming.connectStart;
|
|
387
|
+
requestInfo.requestDuration = resourceTiming.responseStart - resourceTiming.connectEnd;
|
|
388
|
+
requestInfo.responseDuration = resourceTiming.responseEnd - resourceTiming.responseStart;
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
observer.disconnect();
|
|
393
|
+
});
|
|
394
|
+
DebugUtils.getDebugStorage().onUpdate(this.onStorageUpdate.bind(this));
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
protected unmounted() {
|
|
398
|
+
DebugUtils.getDebugStorage().clearOnUpdate(this.onStorageUpdate);
|
|
399
|
+
}
|
|
400
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { RuntimeContext, ViewActionQueryParameter } from '@oinone/kunlun-engine';
|
|
2
|
+
import { MessageHub } from '@oinone/kunlun-request';
|
|
3
|
+
import { useMatched } from '@oinone/kunlun-router';
|
|
4
|
+
import { Optional } from '@oinone/kunlun-shared';
|
|
5
|
+
import { DebugRequestInfo } from '../typing';
|
|
6
|
+
import { DebugInfoStorage } from './storage';
|
|
7
|
+
|
|
8
|
+
export class DebugUtils {
|
|
9
|
+
public static generatorDownloadRequestInfo(
|
|
10
|
+
requestInfo: DebugRequestInfo | undefined,
|
|
11
|
+
responseData: string | undefined
|
|
12
|
+
) {
|
|
13
|
+
return {
|
|
14
|
+
...requestInfo,
|
|
15
|
+
decodeURL: Optional.ofNullable(requestInfo?.url)
|
|
16
|
+
.map((v) => decodeURIComponent(v))
|
|
17
|
+
.orElse('no url'),
|
|
18
|
+
header: requestInfo?.header,
|
|
19
|
+
gqlInfos: requestInfo?.gqlInfos?.map((v) => ({
|
|
20
|
+
...v,
|
|
21
|
+
variables: v.variables
|
|
22
|
+
})),
|
|
23
|
+
functions: requestInfo?.functions?.map((v) => ({
|
|
24
|
+
...v,
|
|
25
|
+
responseData: v.responseData
|
|
26
|
+
})),
|
|
27
|
+
responseData
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
public static downloadJSON(data: string, filename: string) {
|
|
32
|
+
if (!data) {
|
|
33
|
+
MessageHub.error('无调试数据,无需下载');
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const blob = new Blob([data], { type: 'application/json' });
|
|
37
|
+
let a = document.createElement('a');
|
|
38
|
+
a.href = URL.createObjectURL(blob);
|
|
39
|
+
a.download = filename;
|
|
40
|
+
document.body.appendChild(a);
|
|
41
|
+
a.click();
|
|
42
|
+
URL.revokeObjectURL(a.href);
|
|
43
|
+
document.body.removeChild(a);
|
|
44
|
+
|
|
45
|
+
a = null as any;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
public static parseJSON = (
|
|
49
|
+
data: string | undefined,
|
|
50
|
+
defaultValue: string
|
|
51
|
+
): string | Record<string, unknown> | Record<string, unknown>[] => {
|
|
52
|
+
return Optional.ofNullable(data)
|
|
53
|
+
.map((v) => {
|
|
54
|
+
try {
|
|
55
|
+
return JSON.parse(v);
|
|
56
|
+
} catch (e) {
|
|
57
|
+
return v;
|
|
58
|
+
}
|
|
59
|
+
})
|
|
60
|
+
.orElse(defaultValue);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
public static toJSONObject = (data: unknown) => {
|
|
64
|
+
if (typeof data === 'string') {
|
|
65
|
+
try {
|
|
66
|
+
return JSON.parse(data);
|
|
67
|
+
} catch (ignored) {}
|
|
68
|
+
return data;
|
|
69
|
+
}
|
|
70
|
+
return data || {};
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
public static toJSONString(data: unknown) {
|
|
74
|
+
return JSON.stringify(data, null, 2);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
public static runtimeContextToJSONString(runtimeContext: RuntimeContext): string {
|
|
78
|
+
return DebugUtils.toJSONString(DebugUtils.simplifyRuntimeContext(runtimeContext));
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
public static simplifyRuntimeContext(runtimeContext: RuntimeContext): RuntimeContext {
|
|
82
|
+
return {
|
|
83
|
+
handle: runtimeContext.handle,
|
|
84
|
+
model: {
|
|
85
|
+
...runtimeContext.model,
|
|
86
|
+
modelFields: runtimeContext.model.modelFields.map((v) => {
|
|
87
|
+
const simplifyField = { ...v };
|
|
88
|
+
delete simplifyField.modelDefinition;
|
|
89
|
+
return simplifyField;
|
|
90
|
+
}),
|
|
91
|
+
modelActions: runtimeContext.model.modelActions.map((v) => {
|
|
92
|
+
const simplifyAction = { ...v };
|
|
93
|
+
delete simplifyAction.modelDefinition;
|
|
94
|
+
return simplifyAction;
|
|
95
|
+
})
|
|
96
|
+
},
|
|
97
|
+
module: runtimeContext.module,
|
|
98
|
+
view: runtimeContext.view,
|
|
99
|
+
viewDsl: runtimeContext.viewDsl,
|
|
100
|
+
viewLayout: runtimeContext.viewLayout,
|
|
101
|
+
viewTemplate: runtimeContext.viewTemplate,
|
|
102
|
+
childrenContext: runtimeContext.childrenContext.map((v) => DebugUtils.simplifyRuntimeContext(v))
|
|
103
|
+
} as RuntimeContext;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
public static getDebugStorage() {
|
|
107
|
+
return DebugInfoStorage.INSTANCE;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
public static getPageParameters(): ViewActionQueryParameter | undefined {
|
|
111
|
+
const { matched } = useMatched();
|
|
112
|
+
return matched.segmentParams?.debug;
|
|
113
|
+
}
|
|
114
|
+
}
|