@skyroc/scripts 2.5.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/LICENSE +21 -0
- package/README.md +508 -0
- package/dist/cli.mjs +78 -0
- package/dist/config-BKkdncJS.mjs +987 -0
- package/dist/index.mjs +14 -0
- package/package.json +83 -0
- package/templates/admin/.env +62 -0
- package/templates/admin/.env.prod +7 -0
- package/templates/admin/.env.test +7 -0
- package/templates/admin/.oxlintrc.json +6 -0
- package/templates/admin/README.md +508 -0
- package/templates/admin/index.html +14 -0
- package/templates/admin/package.json +105 -0
- package/templates/admin/public/favicon.svg +3 -0
- package/templates/admin/src/App.tsx +71 -0
- package/templates/admin/src/assets/audio/wechat-style-notification.wav +0 -0
- package/templates/admin/src/assets/imgs/skyroc.jpg +0 -0
- package/templates/admin/src/assets/svg-icon/activity.svg +1 -0
- package/templates/admin/src/assets/svg-icon/at-sign.svg +1 -0
- package/templates/admin/src/assets/svg-icon/avatar.svg +1 -0
- package/templates/admin/src/assets/svg-icon/banner.svg +1 -0
- package/templates/admin/src/assets/svg-icon/cast.svg +1 -0
- package/templates/admin/src/assets/svg-icon/chrome.svg +1 -0
- package/templates/admin/src/assets/svg-icon/copy.svg +1 -0
- package/templates/admin/src/assets/svg-icon/custom-icon.svg +1 -0
- package/templates/admin/src/assets/svg-icon/empty-data.svg +1 -0
- package/templates/admin/src/assets/svg-icon/error.svg +1 -0
- package/templates/admin/src/assets/svg-icon/expectation.svg +1 -0
- package/templates/admin/src/assets/svg-icon/heart.svg +1 -0
- package/templates/admin/src/assets/svg-icon/logo.svg +15 -0
- package/templates/admin/src/assets/svg-icon/network-error.svg +1 -0
- package/templates/admin/src/assets/svg-icon/no-icon.svg +1 -0
- package/templates/admin/src/assets/svg-icon/no-permission.svg +1 -0
- package/templates/admin/src/assets/svg-icon/not-found.svg +1 -0
- package/templates/admin/src/assets/svg-icon/service-error.svg +1 -0
- package/templates/admin/src/bootstrap.tsx +60 -0
- package/templates/admin/src/components/SkyrocAvatar.tsx +13 -0
- package/templates/admin/src/components/SystemLogo.tsx +7 -0
- package/templates/admin/src/config.ts +125 -0
- package/templates/admin/src/features/antd/AntdProvider.tsx +21 -0
- package/templates/admin/src/features/auth/components/UserAvatar.tsx +76 -0
- package/templates/admin/src/features/auth/use-auth-form-rules.ts +83 -0
- package/templates/admin/src/features/auth/use-auth.ts +96 -0
- package/templates/admin/src/features/auth/use-login.ts +72 -0
- package/templates/admin/src/features/effects/GlobalEffect.tsx +15 -0
- package/templates/admin/src/features/menus/dynamic-routes.ts +10 -0
- package/templates/admin/src/features/menus/extras.ts +3 -0
- package/templates/admin/src/features/menus/menu-category.ts +14 -0
- package/templates/admin/src/features/menus/menu-config.ts +5 -0
- package/templates/admin/src/features/router/RouterProvider.tsx +18 -0
- package/templates/admin/src/features/router/guard.ts +97 -0
- package/templates/admin/src/features/router/index.ts +52 -0
- package/templates/admin/src/features/router/routeTree.gen.ts +237 -0
- package/templates/admin/src/features/router/router-ref.ts +24 -0
- package/templates/admin/src/locales/antd.ts +8 -0
- package/templates/admin/src/locales/index.ts +22 -0
- package/templates/admin/src/locales/sync.ts +14 -0
- package/templates/admin/src/main.tsx +9 -0
- package/templates/admin/src/pages/(admin)/home/index.tsx +46 -0
- package/templates/admin/src/pages/(admin)/layout.tsx +44 -0
- package/templates/admin/src/pages/(auth)/login/index.tsx +102 -0
- package/templates/admin/src/pages/(auth)/login/layout.tsx +71 -0
- package/templates/admin/src/pages/(auth)/login-out.tsx +27 -0
- package/templates/admin/src/pages/(errors)/403.tsx +16 -0
- package/templates/admin/src/pages/(errors)/404.tsx +16 -0
- package/templates/admin/src/pages/(errors)/500.tsx +16 -0
- package/templates/admin/src/pages/__root.tsx +54 -0
- package/templates/admin/src/pages/error.tsx +19 -0
- package/templates/admin/src/pages/index.tsx +14 -0
- package/templates/admin/src/pages/loading.tsx +45 -0
- package/templates/admin/src/pages/not-found.tsx +9 -0
- package/templates/admin/src/plugins/app.tsx +47 -0
- package/templates/admin/src/plugins/assets.ts +4 -0
- package/templates/admin/src/plugins/index.ts +32 -0
- package/templates/admin/src/service/adapter.ts +63 -0
- package/templates/admin/src/service/api/auth/api.ts +31 -0
- package/templates/admin/src/service/api/auth/hooks.ts +28 -0
- package/templates/admin/src/service/api/auth/index.ts +10 -0
- package/templates/admin/src/service/api/auth/keys.ts +7 -0
- package/templates/admin/src/service/api/auth/urls.ts +7 -0
- package/templates/admin/src/service/api/index.ts +2 -0
- package/templates/admin/src/service/api/route/api.ts +7 -0
- package/templates/admin/src/service/api/route/hooks.ts +21 -0
- package/templates/admin/src/service/api/route/index.ts +10 -0
- package/templates/admin/src/service/api/route/keys.ts +3 -0
- package/templates/admin/src/service/api/route/urls.ts +5 -0
- package/templates/admin/src/service/queryClient.ts +13 -0
- package/templates/admin/src/service/request/index.ts +62 -0
- package/templates/admin/src/styles/scss/global.scss +1 -0
- package/templates/admin/src/styles/scss/scrollbar.scss +28 -0
- package/templates/admin/src/types/auto-imports.d.ts +186 -0
- package/templates/admin/src/types/global.d.ts +16 -0
- package/templates/admin/src/types/router.d.ts +14 -0
- package/templates/admin/src/types/storage.d.ts +17 -0
- package/templates/admin/src/types/vite-env.d.ts +117 -0
- package/templates/admin/src/utils/common.tsx +38 -0
- package/templates/admin/src/utils/icon.ts +9 -0
- package/templates/admin/src/utils/service.ts +75 -0
- package/templates/admin/src/utils/storage.ts +7 -0
- package/templates/admin/tsconfig.json +22 -0
- package/templates/admin/uno.config.ts +18 -0
- package/templates/admin/vite.config.ts +13 -0
- package/templates/admin-shell/i18n/atoms/lang.ts +20 -0
- package/templates/admin-shell/i18n/config/default.ts +11 -0
- package/templates/admin-shell/i18n/features/lang/LangEffect.tsx +25 -0
- package/templates/admin-shell/i18n/features/lang/LangSwitch.tsx +49 -0
- package/templates/admin-shell/i18n/hooks/use-lang.ts +47 -0
- package/templates/admin-shell/i18n/i18n.ts +116 -0
- package/templates/admin-shell/i18n/index.ts +23 -0
- package/templates/admin-shell/i18n/langs/en-us/common.json +49 -0
- package/templates/admin-shell/i18n/langs/en-us/datatable.json +8 -0
- package/templates/admin-shell/i18n/langs/en-us/dropdown.json +9 -0
- package/templates/admin-shell/i18n/langs/en-us/form.json +27 -0
- package/templates/admin-shell/i18n/langs/en-us/icon.json +13 -0
- package/templates/admin-shell/i18n/langs/en-us/notification.json +20 -0
- package/templates/admin-shell/i18n/langs/en-us/page.json +442 -0
- package/templates/admin-shell/i18n/langs/en-us/request.json +8 -0
- package/templates/admin-shell/i18n/langs/en-us/route.json +84 -0
- package/templates/admin-shell/i18n/langs/en-us/system.json +9 -0
- package/templates/admin-shell/i18n/langs/en-us/theme.json +173 -0
- package/templates/admin-shell/i18n/langs/index.ts +63 -0
- package/templates/admin-shell/i18n/langs/zh-cn/common.json +49 -0
- package/templates/admin-shell/i18n/langs/zh-cn/datatable.json +8 -0
- package/templates/admin-shell/i18n/langs/zh-cn/dropdown.json +9 -0
- package/templates/admin-shell/i18n/langs/zh-cn/form.json +27 -0
- package/templates/admin-shell/i18n/langs/zh-cn/icon.json +13 -0
- package/templates/admin-shell/i18n/langs/zh-cn/notification.json +20 -0
- package/templates/admin-shell/i18n/langs/zh-cn/page.json +442 -0
- package/templates/admin-shell/i18n/langs/zh-cn/request.json +8 -0
- package/templates/admin-shell/i18n/langs/zh-cn/route.json +84 -0
- package/templates/admin-shell/i18n/langs/zh-cn/system.json +9 -0
- package/templates/admin-shell/i18n/langs/zh-cn/theme.json +173 -0
- package/templates/admin-shell/i18n/types/i18n.ts +29 -0
- package/templates/admin-shell/i18n/types.ts +53 -0
- package/templates/admin-shell/i18n/utils/helpers.ts +18 -0
- package/templates/admin-shell/layouts/AdminLayout.tsx +161 -0
- package/templates/admin-shell/layouts/constant.ts +56 -0
- package/templates/admin-shell/layouts/context.tsx +101 -0
- package/templates/admin-shell/layouts/features/menus/MenuBadge.tsx +76 -0
- package/templates/admin-shell/layouts/features/menus/dynamic-routes.ts +146 -0
- package/templates/admin-shell/layouts/features/menus/menu-generator.tsx +444 -0
- package/templates/admin-shell/layouts/features/menus/menu-renderer.tsx +149 -0
- package/templates/admin-shell/layouts/features/menus/permissions.ts +28 -0
- package/templates/admin-shell/layouts/features/menus/use-menus.ts +98 -0
- package/templates/admin-shell/layouts/features/use-route.ts +30 -0
- package/templates/admin-shell/layouts/index.ts +44 -0
- package/templates/admin-shell/layouts/materials/index.ts +6 -0
- package/templates/admin-shell/layouts/materials/libs/admin-layout/index.module.css +63 -0
- package/templates/admin-shell/layouts/materials/libs/admin-layout/index.module.css.d.ts +18 -0
- package/templates/admin-shell/layouts/materials/libs/admin-layout/index.tsx +238 -0
- package/templates/admin-shell/layouts/materials/libs/admin-layout/shared.ts +67 -0
- package/templates/admin-shell/layouts/materials/libs/page-tab/ButtonTab.tsx +44 -0
- package/templates/admin-shell/layouts/materials/libs/page-tab/ChromeTab.tsx +54 -0
- package/templates/admin-shell/layouts/materials/libs/page-tab/ChromeTabBg.tsx +30 -0
- package/templates/admin-shell/layouts/materials/libs/page-tab/SliderTab.tsx +44 -0
- package/templates/admin-shell/layouts/materials/libs/page-tab/SvgClose.tsx +51 -0
- package/templates/admin-shell/layouts/materials/libs/page-tab/hook.ts +34 -0
- package/templates/admin-shell/layouts/materials/libs/page-tab/index.module.css +120 -0
- package/templates/admin-shell/layouts/materials/libs/page-tab/index.module.css.d.ts +18 -0
- package/templates/admin-shell/layouts/materials/libs/page-tab/index.tsx +76 -0
- package/templates/admin-shell/layouts/materials/libs/page-tab/shared.ts +32 -0
- package/templates/admin-shell/layouts/materials/types/index.ts +322 -0
- package/templates/admin-shell/layouts/modules/AdminContent.tsx +285 -0
- package/templates/admin-shell/layouts/modules/AdminFooter.tsx +13 -0
- package/templates/admin-shell/layouts/modules/AdminLogo.tsx +28 -0
- package/templates/admin-shell/layouts/modules/AdminSider.tsx +50 -0
- package/templates/admin-shell/layouts/modules/admin-header/AdminHeader.tsx +132 -0
- package/templates/admin-shell/layouts/modules/admin-header/components/Breadcrumb.tsx +62 -0
- package/templates/admin-shell/layouts/modules/admin-header/components/ThemeButton.tsx +24 -0
- package/templates/admin-shell/layouts/modules/admin-menu/AdminMenu.tsx +37 -0
- package/templates/admin-shell/layouts/modules/admin-menu/components/FirstLevelMenu.tsx +156 -0
- package/templates/admin-shell/layouts/modules/admin-menu/components/HorizontalMenu.tsx +88 -0
- package/templates/admin-shell/layouts/modules/admin-menu/components/MenuPortal.tsx +28 -0
- package/templates/admin-shell/layouts/modules/admin-menu/components/VerticalMenu.tsx +123 -0
- package/templates/admin-shell/layouts/modules/admin-menu/enum.ts +47 -0
- package/templates/admin-shell/layouts/modules/admin-menu/modules/Horizontal.tsx +22 -0
- package/templates/admin-shell/layouts/modules/admin-menu/modules/TopHybridHeaderFirst.tsx +15 -0
- package/templates/admin-shell/layouts/modules/admin-menu/modules/TopHybridSidebarFirst.tsx +18 -0
- package/templates/admin-shell/layouts/modules/admin-menu/modules/Vertical.tsx +14 -0
- package/templates/admin-shell/layouts/modules/admin-menu/modules/VerticalHybridHeaderFirst.tsx +18 -0
- package/templates/admin-shell/layouts/modules/admin-menu/modules/VerticalMix.tsx +132 -0
- package/templates/admin-shell/layouts/modules/admin-search/AdminSearch.tsx +36 -0
- package/templates/admin-shell/layouts/modules/admin-search/components/SearchFooter.tsx +38 -0
- package/templates/admin-shell/layouts/modules/admin-search/components/SearchModal.tsx +171 -0
- package/templates/admin-shell/layouts/modules/admin-search/components/SearchResult.tsx +43 -0
- package/templates/admin-shell/layouts/modules/admin-tab/AdminTab.tsx +125 -0
- package/templates/admin-shell/layouts/modules/admin-tab/components/TabContextMenu.tsx +107 -0
- package/templates/admin-shell/layouts/modules/admin-tab/hooks/useTabScroll.ts +86 -0
- package/templates/admin-shell/layouts/modules/shared/logo.ts +42 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/ThemeDrawer.tsx +68 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/components/AnimatedCollapse.tsx +36 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/components/AnimatedItem.tsx +35 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/components/LayoutModeCard.tsx +110 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/components/SettingItem.tsx +31 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/modules/ConfigOperation.tsx +53 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/modules/appearance/CustomPicker.tsx +105 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/modules/appearance/ThemeColor.tsx +58 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/modules/appearance/ThemeSchema.tsx +42 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/modules/appearance/ThemeToken.tsx +44 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/modules/appearance/index.tsx +23 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/modules/general/GlobalSettings.tsx +57 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/modules/general/ThemeGeneral.tsx +20 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/modules/general/WatermarkSettings.tsx +103 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/modules/layout/ContentSettings.tsx +100 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/modules/layout/FooterSettings.tsx +71 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/modules/layout/HeaderSettings.tsx +63 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/modules/layout/LayoutMode.tsx +73 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/modules/layout/SiderSettings.tsx +124 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/modules/layout/TabSettings.tsx +95 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/modules/layout/ThemeLayout.tsx +32 -0
- package/templates/admin-shell/layouts/modules/theme-drawer/modules/preset/ThemePreset.tsx +132 -0
- package/templates/admin-shell/layouts/options.tsx +79 -0
- package/templates/admin-shell/layouts/setup.ts +102 -0
- package/templates/admin-shell/layouts/state/AdminEffect.tsx +56 -0
- package/templates/admin-shell/layouts/state/AdminTabEffect.tsx +28 -0
- package/templates/admin-shell/layouts/state/index.ts +3 -0
- package/templates/admin-shell/layouts/state/menus/MenuToggler.tsx +53 -0
- package/templates/admin-shell/layouts/state/menus/use-admin-menu-badges.ts +46 -0
- package/templates/admin-shell/layouts/state/menus/use-admin-menus.tsx +164 -0
- package/templates/admin-shell/layouts/state/tabs/index.ts +1 -0
- package/templates/admin-shell/layouts/state/tabs/shared.tsx +148 -0
- package/templates/admin-shell/layouts/state/tabs/use-admin-tab.ts +377 -0
- package/templates/admin-shell/layouts/state/use-admin-state.ts +118 -0
- package/templates/admin-shell/layouts/types/router.d.ts +10 -0
- package/templates/admin-shell/layouts/types/storage.ts +18 -0
- package/templates/admin-shell/notification/NotificationButton.tsx +91 -0
- package/templates/admin-shell/notification/NotificationContext.ts +8 -0
- package/templates/admin-shell/notification/NotificationPanel.tsx +194 -0
- package/templates/admin-shell/notification/NotificationProvider.tsx +59 -0
- package/templates/admin-shell/notification/index.ts +12 -0
- package/templates/admin-shell/notification/mock.ts +59 -0
- package/templates/admin-shell/notification/notification-store.ts +438 -0
- package/templates/admin-shell/notification/notification.css +60 -0
- package/templates/admin-shell/notification/types.ts +104 -0
- package/templates/admin-shell/notification/use-notification.ts +51 -0
- package/templates/admin-shell/notification/useNotificationContext.ts +14 -0
- package/templates/admin-shell/runtime/app-update.ts +156 -0
- package/templates/admin-shell/runtime/dayjs.ts +20 -0
- package/templates/admin-shell/runtime/iconify.ts +17 -0
- package/templates/admin-shell/runtime/index.ts +10 -0
- package/templates/admin-shell/runtime/nprogress.ts +25 -0
- package/templates/admin-shell/runtime/plugins.ts +62 -0
- package/templates/admin-shell/styles/global.css +54 -0
- package/templates/admin-shell/styles/nprogress.css +85 -0
- package/templates/admin-shell/styles/reset.css +378 -0
- package/templates/admin-shell/theme/antd/AntdProvider.tsx +106 -0
- package/templates/admin-shell/theme/antd/index.ts +23 -0
- package/templates/admin-shell/theme/antd/shared.ts +80 -0
- package/templates/admin-shell/theme/antd/ui.ts +250 -0
- package/templates/admin-shell/theme/antd-algorithm/algorithm/dark/colors.ts +99 -0
- package/templates/admin-shell/theme/antd-algorithm/algorithm/dark/index.ts +87 -0
- package/templates/admin-shell/theme/antd-algorithm/algorithm/default/colors.ts +91 -0
- package/templates/admin-shell/theme/antd-algorithm/algorithm/default/index.ts +77 -0
- package/templates/admin-shell/theme/antd-algorithm/index.ts +80 -0
- package/templates/admin-shell/theme/antd-algorithm/seed/index.ts +41 -0
- package/templates/admin-shell/theme/antd-algorithm/shared/colorAlgorithm.ts +10 -0
- package/templates/admin-shell/theme/antd-algorithm/shared/genColorMapToken.ts +165 -0
- package/templates/admin-shell/theme/antd-algorithm/shared/genCommonMapToken.ts +23 -0
- package/templates/admin-shell/theme/antd-algorithm/shared/genControlHeight.ts +14 -0
- package/templates/admin-shell/theme/antd-algorithm/shared/genFontMapToken.ts +274 -0
- package/templates/admin-shell/theme/antd-algorithm/shared/genRadiusMapToken.ts +139 -0
- package/templates/admin-shell/theme/antd-algorithm/shared/genSizeMapToken.ts +114 -0
- package/templates/admin-shell/theme/antd-algorithm/types/index.ts +20 -0
- package/templates/admin-shell/theme/components/ThemeEffect.tsx +55 -0
- package/templates/admin-shell/theme/components/ThemeSchemaSegmented.tsx +27 -0
- package/templates/admin-shell/theme/components/ThemeSchemaSwitch.tsx +77 -0
- package/templates/admin-shell/theme/components/shared.ts +5 -0
- package/templates/admin-shell/theme/config/default.ts +108 -0
- package/templates/admin-shell/theme/config/index.ts +1 -0
- package/templates/admin-shell/theme/hooks/index.ts +2 -0
- package/templates/admin-shell/theme/hooks/use-theme.ts +244 -0
- package/templates/admin-shell/theme/index.ts +78 -0
- package/templates/admin-shell/theme/presets/azir.json +39 -0
- package/templates/admin-shell/theme/presets/compact.json +38 -0
- package/templates/admin-shell/theme/presets/dark.json +93 -0
- package/templates/admin-shell/theme/presets/default.json +95 -0
- package/templates/admin-shell/theme/presets/index.ts +29 -0
- package/templates/admin-shell/theme/presets/shadcn.json +99 -0
- package/templates/admin-shell/theme/setup.ts +115 -0
- package/templates/admin-shell/theme/types/index.ts +27 -0
- package/templates/admin-shell/theme/types/theme.d.ts +316 -0
- package/templates/admin-shell/theme/utils/dark-mode.ts +46 -0
- package/templates/admin-shell/theme/utils/filters.ts +20 -0
- package/templates/admin-shell/theme/utils/index.ts +3 -0
- package/templates/admin-shell/theme/utils/settings.ts +43 -0
- package/templates/admin-shell/types/api/auth.d.ts +148 -0
- package/templates/admin-shell/types/api/common.d.ts +54 -0
- package/templates/admin-shell/types/api/route.d.ts +104 -0
- package/templates/admin-shell/types/api/service.d.ts +51 -0
- package/templates/admin-shell/types/api/system-manage.d.ts +160 -0
- package/templates/admin-shell/types/app/common.d.ts +31 -0
- package/templates/admin-shell/types/app/global.d.ts +71 -0
- package/templates/admin-shell/types/app/menu.d.ts +57 -0
- package/templates/admin-shell/types/app/router.d.ts +201 -0
- package/templates/admin-shell/types/app/storage.d.ts +10 -0
- package/templates/admin-shell/types/app/union-key.d.ts +156 -0
- package/templates/admin-shell/types/locales/i18n.d.ts +135 -0
- package/templates/admin-shell/ui/antd/components/AppTree.tsx +62 -0
- package/templates/admin-shell/ui/antd/components/BeyondHiding.tsx +42 -0
- package/templates/admin-shell/ui/antd/components/ButtonIcon.tsx +123 -0
- package/templates/admin-shell/ui/antd/components/ButtonLink.tsx +30 -0
- package/templates/admin-shell/ui/antd/components/ErrorBoundary.tsx +45 -0
- package/templates/admin-shell/ui/antd/components/ExceptionBase.tsx +69 -0
- package/templates/admin-shell/ui/antd/components/FullScreen.tsx +33 -0
- package/templates/admin-shell/ui/antd/components/PinToggler.tsx +35 -0
- package/templates/admin-shell/ui/antd/components/ReloadButton.tsx +20 -0
- package/templates/admin-shell/ui/antd/components/index.ts +12 -0
- package/templates/admin-shell/ui/antd/components/styles/button-icon-animations.css +246 -0
- package/templates/admin-shell/ui/antd/index.ts +1 -0
- package/templates/admin-shell/ui/antd/styles.d.ts +1 -0
- package/templates/admin-shell/ui/compose/animate-feature.ts +5 -0
- package/templates/admin-shell/ui/compose/components/BetterScroll.tsx +51 -0
- package/templates/admin-shell/ui/compose/components/DarkModeContainer.tsx +22 -0
- package/templates/admin-shell/ui/compose/components/FlipText.tsx +41 -0
- package/templates/admin-shell/ui/compose/components/I18nLabel.tsx +18 -0
- package/templates/admin-shell/ui/compose/components/LazyAnimate.tsx +10 -0
- package/templates/admin-shell/ui/compose/components/LookForward.tsx +24 -0
- package/templates/admin-shell/ui/compose/components/NumberTicker.tsx +105 -0
- package/templates/admin-shell/ui/compose/components/Portal.tsx +74 -0
- package/templates/admin-shell/ui/compose/components/SvgIcon.tsx +39 -0
- package/templates/admin-shell/ui/compose/components/TypingAnimation.tsx +83 -0
- package/templates/admin-shell/ui/compose/components/WaveBg.tsx +56 -0
- package/templates/admin-shell/ui/compose/components/index.ts +11 -0
- package/templates/admin-shell/ui/compose/index.ts +2 -0
- package/templates/admin-shell/ui/compose/table/DragContent.tsx +239 -0
- package/templates/admin-shell/ui/compose/table/TableHeaderOperation.tsx +210 -0
- package/templates/admin-shell/ui/compose/table/hooks.ts +196 -0
- package/templates/admin-shell/ui/compose/table/index.ts +16 -0
- package/templates/admin-shell/ui/compose/table/types.ts +244 -0
- package/templates/admin-shell/ui/compose/table/use-table-operate.ts +136 -0
- package/templates/admin-shell/ui/compose/table/use-table-scroll.ts +49 -0
- package/templates/admin-shell/ui/compose/table/use-table.ts +303 -0
- package/templates/admin.meta.json +756 -0
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
/* prettier-ignore */
|
|
3
|
+
// @ts-nocheck
|
|
4
|
+
// noinspection JSUnusedGlobalSymbols
|
|
5
|
+
// Generated by unplugin-auto-import
|
|
6
|
+
// biome-ignore lint: disable
|
|
7
|
+
export {}
|
|
8
|
+
declare global {
|
|
9
|
+
const AApp: typeof import('antd').App
|
|
10
|
+
const ABadge: typeof import('antd').Badge
|
|
11
|
+
const ABreadcrumb: typeof import('antd').Breadcrumb
|
|
12
|
+
const AButton: typeof import('antd').Button
|
|
13
|
+
const ACard: typeof import('antd').Card
|
|
14
|
+
const ACheckbox: typeof import('antd').Checkbox
|
|
15
|
+
const ACol: typeof import('antd').Col
|
|
16
|
+
const AColorPicker: typeof import('antd').ColorPicker
|
|
17
|
+
const AConfigProvider: typeof import('antd').ConfigProvider
|
|
18
|
+
const ADescriptions: typeof import('antd').Descriptions
|
|
19
|
+
const ADivider: typeof import('antd').Divider
|
|
20
|
+
const ADrawer: typeof import('antd').Drawer
|
|
21
|
+
const ADropdown: typeof import('antd').Dropdown
|
|
22
|
+
const AEmpty: typeof import('antd').Empty
|
|
23
|
+
const AFlex: typeof import('antd').Flex
|
|
24
|
+
const AForm: typeof import('antd').Form
|
|
25
|
+
const AInput: typeof import('antd').Input
|
|
26
|
+
const AInputNumber: typeof import('antd').InputNumber
|
|
27
|
+
const AList: typeof import('antd').List
|
|
28
|
+
const AMenu: typeof import('antd').Menu
|
|
29
|
+
const AModal: typeof import('antd').Modal
|
|
30
|
+
const ARow: typeof import('antd').Row
|
|
31
|
+
const ASegmented: typeof import('antd').Segmented
|
|
32
|
+
const ASelect: typeof import('antd').Select
|
|
33
|
+
const ASpace: typeof import('antd').Space
|
|
34
|
+
const AStatistic: typeof import('antd').Statistic
|
|
35
|
+
const ASwitch: typeof import('antd').Switch
|
|
36
|
+
const ATag: typeof import('antd').Tag
|
|
37
|
+
const ATooltip: typeof import('antd').Tooltip
|
|
38
|
+
const AWatermark: typeof import('antd').Watermark
|
|
39
|
+
const Activity: typeof import('react').Activity
|
|
40
|
+
const Fragment: typeof import('react').Fragment
|
|
41
|
+
const IconAntDesignEnterOutlined: typeof import('~icons/ant-design/enter-outlined.tsx').default
|
|
42
|
+
const IconLocalBanner: typeof import('~icons/local/banner.tsx').default
|
|
43
|
+
const IconLocalLogo: typeof import('~icons/local/logo.tsx').default
|
|
44
|
+
const IconMdiArrowDownThin: typeof import('~icons/mdi/arrow-down-thin.tsx').default
|
|
45
|
+
const IconMdiArrowUpThin: typeof import('~icons/mdi/arrow-up-thin.tsx').default
|
|
46
|
+
const IconMdiInformationOutline: typeof import('~icons/mdi/information-outline.tsx').default
|
|
47
|
+
const IconMdiKeyboardEsc: typeof import('~icons/mdi/keyboard-esc.tsx').default
|
|
48
|
+
const IconMdiKeyboardReturn: typeof import('~icons/mdi/keyboard-return.tsx').default
|
|
49
|
+
const IconUilSearch: typeof import('~icons/uil/search.tsx').default
|
|
50
|
+
const SkyrocAvatar: typeof import('../components/SkyrocAvatar').default
|
|
51
|
+
const Suspense: typeof import('react').Suspense
|
|
52
|
+
const SystemLogo: typeof import('../components/SystemLogo').default
|
|
53
|
+
const cache: typeof import('react').cache
|
|
54
|
+
const cacheSignal: typeof import('react').cacheSignal
|
|
55
|
+
const createContext: typeof import('react').createContext
|
|
56
|
+
const createRef: typeof import('react').createRef
|
|
57
|
+
const destroyMessage: typeof import('../config').destroyMessage
|
|
58
|
+
const destroyNotification: typeof import('../config').destroyNotification
|
|
59
|
+
const forwardRef: typeof import('react').forwardRef
|
|
60
|
+
const globalConfig: typeof import('../config').globalConfig
|
|
61
|
+
const initAntdProvider: typeof import('../config').initAntdProvider
|
|
62
|
+
const initNProgress: typeof import('../config').initNProgress
|
|
63
|
+
const lazy: typeof import('react').lazy
|
|
64
|
+
const memo: typeof import('react').memo
|
|
65
|
+
const showConfirmModal: typeof import('../config').showConfirmModal
|
|
66
|
+
const showErrorMessage: typeof import('../config').showErrorMessage
|
|
67
|
+
const showErrorModal: typeof import('../config').showErrorModal
|
|
68
|
+
const showErrorNotification: typeof import('../config').showErrorNotification
|
|
69
|
+
const showInfoMessage: typeof import('../config').showInfoMessage
|
|
70
|
+
const showInfoModal: typeof import('../config').showInfoModal
|
|
71
|
+
const showInfoNotification: typeof import('../config').showInfoNotification
|
|
72
|
+
const showLoadingMessage: typeof import('../config').showLoadingMessage
|
|
73
|
+
const showMessage: typeof import('../config').showMessage
|
|
74
|
+
const showModal: typeof import('../config').showModal
|
|
75
|
+
const showNotification: typeof import('../config').showNotification
|
|
76
|
+
const showSuccessMessage: typeof import('../config').showSuccessMessage
|
|
77
|
+
const showSuccessModal: typeof import('../config').showSuccessModal
|
|
78
|
+
const showSuccessNotification: typeof import('../config').showSuccessNotification
|
|
79
|
+
const showWarningMessage: typeof import('../config').showWarningMessage
|
|
80
|
+
const showWarningModal: typeof import('../config').showWarningModal
|
|
81
|
+
const showWarningNotification: typeof import('../config').showWarningNotification
|
|
82
|
+
const startTransition: typeof import('react').startTransition
|
|
83
|
+
const use: typeof import('react').use
|
|
84
|
+
const useActionState: typeof import('react').useActionState
|
|
85
|
+
const useAntdTable: typeof import('ahooks').useAntdTable
|
|
86
|
+
const useAsyncEffect: typeof import('ahooks').useAsyncEffect
|
|
87
|
+
const useBoolean: typeof import('ahooks').useBoolean
|
|
88
|
+
const useCallback: typeof import('react').useCallback
|
|
89
|
+
const useClickAway: typeof import('ahooks').useClickAway
|
|
90
|
+
const useContext: typeof import('react').useContext
|
|
91
|
+
const useControllableValue: typeof import('ahooks').useControllableValue
|
|
92
|
+
const useCookieState: typeof import('ahooks').useCookieState
|
|
93
|
+
const useCountDown: typeof import('ahooks').useCountDown
|
|
94
|
+
const useCounter: typeof import('ahooks').useCounter
|
|
95
|
+
const useCreation: typeof import('ahooks').useCreation
|
|
96
|
+
const useDebounce: typeof import('ahooks').useDebounce
|
|
97
|
+
const useDebounceEffect: typeof import('ahooks').useDebounceEffect
|
|
98
|
+
const useDebounceFn: typeof import('ahooks').useDebounceFn
|
|
99
|
+
const useDebugValue: typeof import('react').useDebugValue
|
|
100
|
+
const useDeepCompareEffect: typeof import('ahooks').useDeepCompareEffect
|
|
101
|
+
const useDeepCompareLayoutEffect: typeof import('ahooks').useDeepCompareLayoutEffect
|
|
102
|
+
const useDeferredValue: typeof import('react').useDeferredValue
|
|
103
|
+
const useDocumentVisibility: typeof import('ahooks').useDocumentVisibility
|
|
104
|
+
const useDrag: typeof import('ahooks').useDrag
|
|
105
|
+
const useDrop: typeof import('ahooks').useDrop
|
|
106
|
+
const useDynamicList: typeof import('ahooks').useDynamicList
|
|
107
|
+
const useEffect: typeof import('react').useEffect
|
|
108
|
+
const useEffectEvent: typeof import('react').useEffectEvent
|
|
109
|
+
const useEventEmitter: typeof import('ahooks').useEventEmitter
|
|
110
|
+
const useEventListener: typeof import('ahooks').useEventListener
|
|
111
|
+
const useEventTarget: typeof import('ahooks').useEventTarget
|
|
112
|
+
const useExternal: typeof import('ahooks').useExternal
|
|
113
|
+
const useFavicon: typeof import('ahooks').useFavicon
|
|
114
|
+
const useFocusWithin: typeof import('ahooks').useFocusWithin
|
|
115
|
+
const useFullscreen: typeof import('ahooks').useFullscreen
|
|
116
|
+
const useFusionTable: typeof import('ahooks').useFusionTable
|
|
117
|
+
const useGetState: typeof import('ahooks').useGetState
|
|
118
|
+
const useHistoryTravel: typeof import('ahooks').useHistoryTravel
|
|
119
|
+
const useHover: typeof import('ahooks').useHover
|
|
120
|
+
const useId: typeof import('react').useId
|
|
121
|
+
const useImperativeHandle: typeof import('react').useImperativeHandle
|
|
122
|
+
const useInViewport: typeof import('ahooks').useInViewport
|
|
123
|
+
const useInfiniteScroll: typeof import('ahooks').useInfiniteScroll
|
|
124
|
+
const useInsertionEffect: typeof import('react').useInsertionEffect
|
|
125
|
+
const useInterval: typeof import('ahooks').useInterval
|
|
126
|
+
const useIsomorphicLayoutEffect: typeof import('ahooks').useIsomorphicLayoutEffect
|
|
127
|
+
const useKeyPress: typeof import('ahooks').useKeyPress
|
|
128
|
+
const useLatest: typeof import('ahooks').useLatest
|
|
129
|
+
const useLayoutEffect: typeof import('react').useLayoutEffect
|
|
130
|
+
const useLocalStorageState: typeof import('ahooks').useLocalStorageState
|
|
131
|
+
const useLockFn: typeof import('ahooks').useLockFn
|
|
132
|
+
const useLongPress: typeof import('ahooks').useLongPress
|
|
133
|
+
const useMap: typeof import('ahooks').useMap
|
|
134
|
+
const useMemo: typeof import('react').useMemo
|
|
135
|
+
const useMemoizedFn: typeof import('ahooks').useMemoizedFn
|
|
136
|
+
const useMount: typeof import('ahooks').useMount
|
|
137
|
+
const useMouse: typeof import('ahooks').useMouse
|
|
138
|
+
const useMutationObserver: typeof import('ahooks').useMutationObserver
|
|
139
|
+
const useNetwork: typeof import('ahooks').useNetwork
|
|
140
|
+
const useOptimistic: typeof import('react').useOptimistic
|
|
141
|
+
const usePagination: typeof import('ahooks').usePagination
|
|
142
|
+
const usePrevious: typeof import('ahooks').usePrevious
|
|
143
|
+
const useRafInterval: typeof import('ahooks').useRafInterval
|
|
144
|
+
const useRafState: typeof import('ahooks').useRafState
|
|
145
|
+
const useRafTimeout: typeof import('ahooks').useRafTimeout
|
|
146
|
+
const useReactive: typeof import('ahooks').useReactive
|
|
147
|
+
const useReducer: typeof import('react').useReducer
|
|
148
|
+
const useRef: typeof import('react').useRef
|
|
149
|
+
const useRequest: typeof import('ahooks').useRequest
|
|
150
|
+
const useResetState: typeof import('ahooks').useResetState
|
|
151
|
+
const useResponsive: typeof import('ahooks').useResponsive
|
|
152
|
+
const useSafeState: typeof import('ahooks').useSafeState
|
|
153
|
+
const useScroll: typeof import('ahooks').useScroll
|
|
154
|
+
const useSelections: typeof import('ahooks').useSelections
|
|
155
|
+
const useSessionStorageState: typeof import('ahooks').useSessionStorageState
|
|
156
|
+
const useSet: typeof import('ahooks').useSet
|
|
157
|
+
const useSetState: typeof import('ahooks').useSetState
|
|
158
|
+
const useSize: typeof import('ahooks').useSize
|
|
159
|
+
const useState: typeof import('react').useState
|
|
160
|
+
const useSyncExternalStore: typeof import('react').useSyncExternalStore
|
|
161
|
+
const useTextSelection: typeof import('ahooks').useTextSelection
|
|
162
|
+
const useTheme: typeof import('ahooks').useTheme
|
|
163
|
+
const useThrottle: typeof import('ahooks').useThrottle
|
|
164
|
+
const useThrottleEffect: typeof import('ahooks').useThrottleEffect
|
|
165
|
+
const useThrottleFn: typeof import('ahooks').useThrottleFn
|
|
166
|
+
const useTimeout: typeof import('ahooks').useTimeout
|
|
167
|
+
const useTitle: typeof import('ahooks').useTitle
|
|
168
|
+
const useToggle: typeof import('ahooks').useToggle
|
|
169
|
+
const useTrackedEffect: typeof import('ahooks').useTrackedEffect
|
|
170
|
+
const useTransition: typeof import('react').useTransition
|
|
171
|
+
const useTranslation: typeof import('react-i18next').useTranslation
|
|
172
|
+
const useUnmount: typeof import('ahooks').useUnmount
|
|
173
|
+
const useUnmountedRef: typeof import('ahooks').useUnmountedRef
|
|
174
|
+
const useUpdate: typeof import('ahooks').useUpdate
|
|
175
|
+
const useUpdateEffect: typeof import('ahooks').useUpdateEffect
|
|
176
|
+
const useUpdateLayoutEffect: typeof import('ahooks').useUpdateLayoutEffect
|
|
177
|
+
const useVirtualList: typeof import('ahooks').useVirtualList
|
|
178
|
+
const useWebSocket: typeof import('ahooks').useWebSocket
|
|
179
|
+
const useWhyDidYouUpdate: typeof import('ahooks').useWhyDidYouUpdate
|
|
180
|
+
}
|
|
181
|
+
// for type re-export
|
|
182
|
+
declare global {
|
|
183
|
+
// @ts-ignore
|
|
184
|
+
export type { FC } from 'react'
|
|
185
|
+
import('react')
|
|
186
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// oxlint-disable unicorn/require-module-specifiers
|
|
2
|
+
import type { MessageInstance } from 'antd/es/message/interface';
|
|
3
|
+
|
|
4
|
+
export {};
|
|
5
|
+
|
|
6
|
+
declare global {
|
|
7
|
+
/** Whether current runtime is development mode */
|
|
8
|
+
export const __DEV__: boolean;
|
|
9
|
+
|
|
10
|
+
/** Build time of the project */
|
|
11
|
+
export const BUILD_TIME: string;
|
|
12
|
+
|
|
13
|
+
interface Window {
|
|
14
|
+
$message?: MessageInstance;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// oxlint-disable unicorn/require-module-specifiers
|
|
2
|
+
declare global {
|
|
3
|
+
namespace Router {
|
|
4
|
+
interface RouteIdRegistry extends Record<keyof import('@/features/router/routeTree.gen').FileRoutesById, true> {}
|
|
5
|
+
|
|
6
|
+
interface RoutePathRegistry extends Record<keyof import('@/features/router/routeTree.gen').FileRoutesByTo, true> {}
|
|
7
|
+
|
|
8
|
+
interface MenuExtraRegistry extends Record<import('@/features/menus/extras').ExtraKey, true> {}
|
|
9
|
+
|
|
10
|
+
interface MenuCategoryRegistry extends Record<import('@/features/menus/menu-category').MenuCategoryKey, true> {}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// oxlint-disable unicorn/require-module-specifiers
|
|
2
|
+
declare global {
|
|
3
|
+
namespace StorageType {
|
|
4
|
+
interface Local {
|
|
5
|
+
/** The i18n language selected by the admin app. */
|
|
6
|
+
lang: I18n.LangType;
|
|
7
|
+
/** The last login user id, used to reset cached tabs after account changes. */
|
|
8
|
+
lastLoginUserId: string;
|
|
9
|
+
/** The refresh token owned by the admin auth flow. */
|
|
10
|
+
refreshToken: string;
|
|
11
|
+
/** The access token owned by the admin auth flow. */
|
|
12
|
+
token: string;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Namespace Env
|
|
3
|
+
*
|
|
4
|
+
* It is used to declare the type of the import.meta object
|
|
5
|
+
*/
|
|
6
|
+
declare namespace Env {
|
|
7
|
+
/** The router history mode */
|
|
8
|
+
type RouterHistoryMode = 'hash' | 'history' | 'memory';
|
|
9
|
+
|
|
10
|
+
interface AppImportMetaEnv {
|
|
11
|
+
/** The description of the application */
|
|
12
|
+
readonly VITE_APP_DESC: string;
|
|
13
|
+
/** The title of the application */
|
|
14
|
+
readonly VITE_APP_TITLE: string;
|
|
15
|
+
/**
|
|
16
|
+
* The auth route mode
|
|
17
|
+
*
|
|
18
|
+
* - Static: the auth routes is generated in front-end
|
|
19
|
+
* - Dynamic: the auth routes is generated in back-end
|
|
20
|
+
*/
|
|
21
|
+
readonly VITE_AUTH_ROUTE_MODE: 'dynamic' | 'static';
|
|
22
|
+
/** Whether to automatically detect updates after configuring application packaging */
|
|
23
|
+
readonly VITE_AUTOMATICALLY_DETECT_UPDATE?: Common.YesOrNo;
|
|
24
|
+
/** The base url of the application */
|
|
25
|
+
readonly VITE_BASE_URL: string;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Whether to enable the http proxy
|
|
29
|
+
*
|
|
30
|
+
* Only valid in the development environment
|
|
31
|
+
*/
|
|
32
|
+
readonly VITE_HTTP_PROXY?: Common.YesOrNo;
|
|
33
|
+
/**
|
|
34
|
+
* The prefix of the local icon
|
|
35
|
+
*
|
|
36
|
+
* This prefix is start with the icon prefix
|
|
37
|
+
*/
|
|
38
|
+
readonly VITE_ICON_LOCAL_PREFIX: 'icon-local';
|
|
39
|
+
/** The prefix of the iconify icon */
|
|
40
|
+
readonly VITE_ICON_PREFIX: 'icon';
|
|
41
|
+
/**
|
|
42
|
+
* Iconify api provider url
|
|
43
|
+
*
|
|
44
|
+
* If the project is deployed in intranet, you can set the api provider url to the local iconify server
|
|
45
|
+
*
|
|
46
|
+
* @link https://docs.iconify.design/api/providers.html
|
|
47
|
+
*/
|
|
48
|
+
readonly VITE_ICONIFY_URL?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Default menu icon if menu icon is not set
|
|
51
|
+
*
|
|
52
|
+
* Iconify icon name
|
|
53
|
+
*/
|
|
54
|
+
readonly VITE_MENU_ICON: string;
|
|
55
|
+
/**
|
|
56
|
+
* Other backend service base url
|
|
57
|
+
*
|
|
58
|
+
* The value is a json
|
|
59
|
+
*/
|
|
60
|
+
readonly VITE_OTHER_SERVICE_BASE_URL: string;
|
|
61
|
+
/** Show proxy url log in terminal */
|
|
62
|
+
readonly VITE_PROXY_LOG?: Common.YesOrNo;
|
|
63
|
+
/**
|
|
64
|
+
* The home route key
|
|
65
|
+
*
|
|
66
|
+
* It only has effect when the auth route mode is static, if the route mode is dynamic, the home route key is
|
|
67
|
+
* defined in the back-end
|
|
68
|
+
*/
|
|
69
|
+
readonly VITE_ROUTE_HOME: Router.RoutePath;
|
|
70
|
+
/** The router history mode */
|
|
71
|
+
readonly VITE_ROUTER_HISTORY_MODE?: RouterHistoryMode;
|
|
72
|
+
/** Backend service base url */
|
|
73
|
+
readonly VITE_SERVICE_BASE_URL: string;
|
|
74
|
+
/**
|
|
75
|
+
* Token expired codes of backend service
|
|
76
|
+
*
|
|
77
|
+
* When the code is received, it will refresh the token and resend the request
|
|
78
|
+
*
|
|
79
|
+
* Use "," to separate multiple codes
|
|
80
|
+
*/
|
|
81
|
+
readonly VITE_SERVICE_EXPIRED_TOKEN_CODES: string;
|
|
82
|
+
/**
|
|
83
|
+
* Logout codes of backend service
|
|
84
|
+
*
|
|
85
|
+
* When the code is received, the user will be logged out and redirected to login page
|
|
86
|
+
*
|
|
87
|
+
* Use "," to separate multiple codes
|
|
88
|
+
*/
|
|
89
|
+
readonly VITE_SERVICE_LOGOUT_CODES: string;
|
|
90
|
+
/**
|
|
91
|
+
* Modal logout codes of backend service
|
|
92
|
+
*
|
|
93
|
+
* When the code is received, the user will be logged out by displaying a modal
|
|
94
|
+
*
|
|
95
|
+
* Use "," to separate multiple codes
|
|
96
|
+
*/
|
|
97
|
+
readonly VITE_SERVICE_MODAL_LOGOUT_CODES: string;
|
|
98
|
+
/**
|
|
99
|
+
* Success code of backend service
|
|
100
|
+
*
|
|
101
|
+
* When the code is received, the request is successful
|
|
102
|
+
*/
|
|
103
|
+
readonly VITE_SERVICE_SUCCESS_CODE: string;
|
|
104
|
+
/** Whether to build with sourcemap */
|
|
105
|
+
readonly VITE_SOURCE_MAP?: Common.YesOrNo;
|
|
106
|
+
/** When the route mode is static, the defined super role */
|
|
107
|
+
readonly VITE_STATIC_SUPER_ROLE: string;
|
|
108
|
+
/** Used to differentiate storage across different domains */
|
|
109
|
+
readonly VITE_STORAGE_PREFIX?: string;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
type ImportMeta = AppImportMetaEnv;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
interface ImportMetaEnv extends Env.AppImportMetaEnv {}
|
|
116
|
+
|
|
117
|
+
declare module 'virtual:svg-icons-register';
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { I18nLabel } from '@shell/ui/compose';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Transform record to option
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* const record = {
|
|
9
|
+
* key1: 'label1',
|
|
10
|
+
* key2: 'label2'
|
|
11
|
+
* };
|
|
12
|
+
* const options = transformRecordToOption(record);
|
|
13
|
+
* // [
|
|
14
|
+
* // { value: 'key1', label: 'label1' },
|
|
15
|
+
* // { value: 'key2', label: 'label2' }
|
|
16
|
+
* // ]
|
|
17
|
+
* ```;
|
|
18
|
+
*
|
|
19
|
+
* @param record
|
|
20
|
+
*/
|
|
21
|
+
export function transformRecordToOption<T extends Record<string, string>>(record: T) {
|
|
22
|
+
return Object.entries(record).map(([value, label]) => ({
|
|
23
|
+
label,
|
|
24
|
+
value
|
|
25
|
+
})) as Common.Option<keyof T, T[keyof T]>[];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Translate options
|
|
30
|
+
*
|
|
31
|
+
* @param options
|
|
32
|
+
*/
|
|
33
|
+
export function translateOptions(options: Common.Option<string, I18n.I18nKey>[]) {
|
|
34
|
+
return options.map(option => ({
|
|
35
|
+
...option,
|
|
36
|
+
label: <I18nLabel i18nKey={option.label} />
|
|
37
|
+
}));
|
|
38
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import json5 from 'json5';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Create service config by current env
|
|
5
|
+
*
|
|
6
|
+
* @param env The current env
|
|
7
|
+
*/
|
|
8
|
+
export function createServiceConfig(env: Env.ImportMeta) {
|
|
9
|
+
const { VITE_OTHER_SERVICE_BASE_URL, VITE_SERVICE_BASE_URL } = env;
|
|
10
|
+
|
|
11
|
+
let other = {} as Record<Api.Service.OtherBaseURLKey, string>;
|
|
12
|
+
try {
|
|
13
|
+
other = json5.parse(VITE_OTHER_SERVICE_BASE_URL);
|
|
14
|
+
} catch {
|
|
15
|
+
// eslint-disable-next-line no-console
|
|
16
|
+
console.error('VITE_OTHER_SERVICE_BASE_URL is not a valid json5 string');
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const httpConfig: Api.Service.SimpleServiceConfig = {
|
|
20
|
+
baseURL: VITE_SERVICE_BASE_URL,
|
|
21
|
+
other
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const otherHttpKeys = Object.keys(httpConfig.other) as Api.Service.OtherBaseURLKey[];
|
|
25
|
+
|
|
26
|
+
const otherConfig: Api.Service.OtherServiceConfigItem[] = otherHttpKeys.map(key => {
|
|
27
|
+
return {
|
|
28
|
+
baseURL: httpConfig.other[key],
|
|
29
|
+
key,
|
|
30
|
+
proxyPattern: createProxyPattern(key)
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
const config: Api.Service.ServiceConfig = {
|
|
35
|
+
baseURL: httpConfig.baseURL,
|
|
36
|
+
other: otherConfig,
|
|
37
|
+
proxyPattern: createProxyPattern()
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
return config;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Get backend service base url
|
|
45
|
+
*
|
|
46
|
+
* @param env - The current env
|
|
47
|
+
* @param isProxy - If use proxy
|
|
48
|
+
*/
|
|
49
|
+
export function getServiceBaseURL(env: Env.ImportMeta, isProxy: boolean) {
|
|
50
|
+
const { baseURL, other } = createServiceConfig(env);
|
|
51
|
+
|
|
52
|
+
const otherBaseURL = {} as Record<Api.Service.OtherBaseURLKey, string>;
|
|
53
|
+
|
|
54
|
+
other.forEach(item => {
|
|
55
|
+
otherBaseURL[item.key] = isProxy ? item.proxyPattern : item.baseURL;
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
return {
|
|
59
|
+
baseURL: isProxy ? createProxyPattern() : baseURL,
|
|
60
|
+
otherBaseURL
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Get proxy pattern of backend service base url
|
|
66
|
+
*
|
|
67
|
+
* @param key If not set, will use the default key
|
|
68
|
+
*/
|
|
69
|
+
function createProxyPattern(key?: Api.Service.OtherBaseURLKey) {
|
|
70
|
+
if (!key) {
|
|
71
|
+
return '/proxy-default';
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return `/proxy-${key}`;
|
|
75
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createStorage } from '@skyroc/utils/web';
|
|
2
|
+
|
|
3
|
+
const DEFAULT_STORAGE_PREFIX = 'SR_';
|
|
4
|
+
|
|
5
|
+
export const storagePrefix = import.meta.env.VITE_STORAGE_PREFIX || DEFAULT_STORAGE_PREFIX;
|
|
6
|
+
|
|
7
|
+
export const localStg = createStorage<StorageType.Local>('local', storagePrefix);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
+
"extends": "@skyroc/tsconfig/web-app.json",
|
|
4
|
+
"compilerOptions": {
|
|
5
|
+
"paths": {
|
|
6
|
+
"@/*": [
|
|
7
|
+
"./src/*"
|
|
8
|
+
],
|
|
9
|
+
"~/*": [
|
|
10
|
+
"./*"
|
|
11
|
+
],
|
|
12
|
+
"@shell/*": [
|
|
13
|
+
"../../packages/web/admin/*"
|
|
14
|
+
]
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"include": [
|
|
18
|
+
"./**/*.ts",
|
|
19
|
+
"./**/*.tsx",
|
|
20
|
+
"../../packages/web/admin/**/*.d.ts"
|
|
21
|
+
]
|
|
22
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { presetSoybeanAdmin } from '@sa/uno-config';
|
|
2
|
+
import { defineConfig, presetWind3, transformerDirectives, transformerVariantGroup } from 'unocss';
|
|
3
|
+
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
content: {
|
|
6
|
+
pipeline: {
|
|
7
|
+
include: [/\.tsx($|\?)/],
|
|
8
|
+
exclude: ['node_modules', 'dist']
|
|
9
|
+
},
|
|
10
|
+
filesystem: ['../../ui-kit/ui', '../../packages/web/ui/shadcn/src/**/*.{ts,tsx}']
|
|
11
|
+
},
|
|
12
|
+
presets: [
|
|
13
|
+
presetWind3({ dark: 'class', variablePrefix: '', important: '.root', preflight: 'on-demand' }),
|
|
14
|
+
presetSoybeanAdmin()
|
|
15
|
+
],
|
|
16
|
+
|
|
17
|
+
transformers: [transformerDirectives(), transformerVariantGroup()]
|
|
18
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { defineConfig } from '@skyroc/web-admin-vite';
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
application: {
|
|
5
|
+
css: {
|
|
6
|
+
additionalData: '@use "@/styles/scss/global.scss" as *;'
|
|
7
|
+
},
|
|
8
|
+
// monorepo 内 shell 源码在 packages/web/admin;独立项目用默认值 src/framework
|
|
9
|
+
resolve: {
|
|
10
|
+
shellAlias: '../../packages/web/admin'
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { atom } from 'jotai';
|
|
2
|
+
import { defaultLangConfig } from '../config/default';
|
|
3
|
+
import type { LangOption, LangType } from '../types';
|
|
4
|
+
|
|
5
|
+
/** Current language atom. */
|
|
6
|
+
export const langAtom = atom<LangType>(defaultLangConfig.defaultLang);
|
|
7
|
+
|
|
8
|
+
/** Language options shared by language switch UI. */
|
|
9
|
+
export const localeOptionsAtom = atom<LangOption[]>(defaultLangConfig.langOptions);
|
|
10
|
+
|
|
11
|
+
/** Fallback language atom. */
|
|
12
|
+
export const fallbackLangAtom = atom<LangType>(defaultLangConfig.fallbackLang);
|
|
13
|
+
|
|
14
|
+
/** Derived atom: Current language option */
|
|
15
|
+
export const currentLangOptionAtom = atom(get => {
|
|
16
|
+
const lang = get(langAtom);
|
|
17
|
+
const options = get(localeOptionsAtom);
|
|
18
|
+
|
|
19
|
+
return options.find(opt => opt.key === lang);
|
|
20
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { LangConfig } from '../types';
|
|
2
|
+
|
|
3
|
+
/** Default language configuration */
|
|
4
|
+
export const defaultLangConfig: LangConfig = {
|
|
5
|
+
defaultLang: 'zh-CN',
|
|
6
|
+
fallbackLang: 'en-US',
|
|
7
|
+
langOptions: [
|
|
8
|
+
{ key: 'zh-CN', label: '中文' },
|
|
9
|
+
{ key: 'en-US', label: 'English' }
|
|
10
|
+
]
|
|
11
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
import type { LangType } from '../../types';
|
|
4
|
+
|
|
5
|
+
import { useLang } from '../../hooks/use-lang';
|
|
6
|
+
|
|
7
|
+
interface LangEffectProps {
|
|
8
|
+
/** Extra effect that should run after the active admin locale changes. */
|
|
9
|
+
onLocaleChange?: (locale: LangType) => void;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const LangEffect = (props: LangEffectProps) => {
|
|
13
|
+
const { onLocaleChange } = props;
|
|
14
|
+
|
|
15
|
+
const { locale } = useLang();
|
|
16
|
+
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
document.documentElement.lang = locale;
|
|
19
|
+
onLocaleChange?.(locale);
|
|
20
|
+
}, [locale, onLocaleChange]);
|
|
21
|
+
|
|
22
|
+
return null;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export default LangEffect;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { ButtonIcon } from '@shell/ui/antd';
|
|
2
|
+
import { Dropdown } from 'antd';
|
|
3
|
+
import type { MenuProps } from 'antd';
|
|
4
|
+
import { useTranslation } from 'react-i18next';
|
|
5
|
+
|
|
6
|
+
import { useLang } from '../../hooks/use-lang';
|
|
7
|
+
|
|
8
|
+
interface LangSwitchProps {
|
|
9
|
+
/** Extra class name applied to the icon button. */
|
|
10
|
+
className?: string;
|
|
11
|
+
/** Whether to show the language switch tooltip. */
|
|
12
|
+
showTooltip?: boolean;
|
|
13
|
+
/** Whether the language switch should be rendered by the host admin layout. */
|
|
14
|
+
visible?: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const LangSwitch = (props: LangSwitchProps) => {
|
|
18
|
+
const { className, showTooltip = true, visible = true } = props;
|
|
19
|
+
|
|
20
|
+
const { t } = useTranslation();
|
|
21
|
+
|
|
22
|
+
const { locale, localeOptions, setLocale } = useLang();
|
|
23
|
+
|
|
24
|
+
const tooltipContent = showTooltip ? t('icon.lang') : '';
|
|
25
|
+
const localeItems: MenuProps['items'] = localeOptions.map(item => ({
|
|
26
|
+
key: item.key,
|
|
27
|
+
label: item.label
|
|
28
|
+
}));
|
|
29
|
+
|
|
30
|
+
function changeLocales({ key }: Parameters<NonNullable<MenuProps['onClick']>>[0]) {
|
|
31
|
+
setLocale(key as I18n.LangType);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (!visible) return null;
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<Dropdown menu={{ items: localeItems, onClick: changeLocales, selectedKeys: [locale] }}>
|
|
38
|
+
<ButtonIcon
|
|
39
|
+
className={className}
|
|
40
|
+
hoverAnimation="scale"
|
|
41
|
+
icon="heroicons:language"
|
|
42
|
+
tooltipContent={tooltipContent}
|
|
43
|
+
tooltipPlacement="left"
|
|
44
|
+
/>
|
|
45
|
+
</Dropdown>
|
|
46
|
+
);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export default LangSwitch;
|