@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,53 @@
|
|
|
1
|
+
import { ButtonIcon } from '@shell/ui/antd';
|
|
2
|
+
import { SvgIcon } from '@shell/ui/compose';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
|
|
5
|
+
import { useAdminState } from '../use-admin-state';
|
|
6
|
+
|
|
7
|
+
interface Props {
|
|
8
|
+
/** Arrow style icon */
|
|
9
|
+
arrowIcon?: boolean;
|
|
10
|
+
/** Button class name. */
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
type NumberBool = 0 | 1;
|
|
15
|
+
|
|
16
|
+
const icons: Record<NumberBool, Record<NumberBool, string>> = {
|
|
17
|
+
0: {
|
|
18
|
+
0: 'line-md:menu-fold-left',
|
|
19
|
+
1: 'line-md:menu-fold-right'
|
|
20
|
+
},
|
|
21
|
+
1: {
|
|
22
|
+
0: 'ph-caret-double-left-bold',
|
|
23
|
+
1: 'ph-caret-double-right-bold'
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const MenuToggler = (props: Props) => {
|
|
28
|
+
const { arrowIcon, className } = props;
|
|
29
|
+
|
|
30
|
+
const { t } = useTranslation();
|
|
31
|
+
|
|
32
|
+
const { siderCollapse, toggleSiderCollapse } = useAdminState();
|
|
33
|
+
|
|
34
|
+
const isArrowIcon = Number(arrowIcon || false) as NumberBool;
|
|
35
|
+
const isCollapsed = Number(siderCollapse || false) as NumberBool;
|
|
36
|
+
|
|
37
|
+
const icon = icons[isArrowIcon][isCollapsed];
|
|
38
|
+
|
|
39
|
+
const tooltipContent = siderCollapse ? t('icon.expand') : t('icon.collapse');
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<ButtonIcon
|
|
43
|
+
className={className}
|
|
44
|
+
tooltipContent={tooltipContent}
|
|
45
|
+
tooltipPlacement="bottomLeft"
|
|
46
|
+
onClick={toggleSiderCollapse}
|
|
47
|
+
>
|
|
48
|
+
<SvgIcon icon={icon} />
|
|
49
|
+
</ButtonIcon>
|
|
50
|
+
);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export default MenuToggler;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { setAtomValue } from '@skyroc/core-state';
|
|
2
|
+
import { atom, useAtomValue } from 'jotai';
|
|
3
|
+
|
|
4
|
+
export type MenuBadgeValues = Record<string, Router.MenuBadgeValue | undefined>;
|
|
5
|
+
|
|
6
|
+
const menuBadgeValuesAtom = atom<MenuBadgeValues>({});
|
|
7
|
+
|
|
8
|
+
function updateMenuBadgeValues(getNextValues: (currentValues: MenuBadgeValues) => MenuBadgeValues) {
|
|
9
|
+
setAtomValue(menuBadgeValuesAtom, getNextValues);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function setMenuBadgeValue(key: string, value: Router.MenuBadgeValue | undefined) {
|
|
13
|
+
updateMenuBadgeValues(currentValues => ({ ...currentValues, [key]: value }));
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function setMenuBadgeValues(values: MenuBadgeValues) {
|
|
17
|
+
updateMenuBadgeValues(currentValues => ({ ...currentValues, ...values }));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function clearMenuBadgeValues(keys?: string[]) {
|
|
21
|
+
if (!keys) {
|
|
22
|
+
setAtomValue(menuBadgeValuesAtom, {});
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
updateMenuBadgeValues(currentValues => {
|
|
27
|
+
const nextValues = { ...currentValues };
|
|
28
|
+
|
|
29
|
+
keys.forEach(key => {
|
|
30
|
+
delete nextValues[key];
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
return nextValues;
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function useAdminMenuBadges() {
|
|
38
|
+
const badgeValues = useAtomValue(menuBadgeValuesAtom);
|
|
39
|
+
|
|
40
|
+
return {
|
|
41
|
+
badgeValues,
|
|
42
|
+
clearMenuBadgeValues,
|
|
43
|
+
setMenuBadgeValue,
|
|
44
|
+
setMenuBadgeValues
|
|
45
|
+
};
|
|
46
|
+
}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/* eslint-disable complexity */
|
|
2
|
+
import { atomWithPartial } from '@skyroc/core-state';
|
|
3
|
+
import { useNavigate } from '@tanstack/react-router';
|
|
4
|
+
import { useUpdateEffect } from 'ahooks';
|
|
5
|
+
import { useAtom } from 'jotai';
|
|
6
|
+
import { useMemo } from 'react';
|
|
7
|
+
|
|
8
|
+
import { useAdminLayoutContext } from '../../context';
|
|
9
|
+
import { normalizePath } from '../../features/menus/menu-generator';
|
|
10
|
+
import type { GeneratedMenu } from '../../features/menus/menu-generator';
|
|
11
|
+
import { renderCommonMenus } from '../../features/menus/menu-renderer';
|
|
12
|
+
import { useMenus } from '../../features/menus/use-menus';
|
|
13
|
+
import { useRoute } from '../../features/use-route';
|
|
14
|
+
|
|
15
|
+
interface MenusAtom {
|
|
16
|
+
activeFirstLevelMenuKey: string;
|
|
17
|
+
activeSecondLevelMenuKey: string;
|
|
18
|
+
drawerVisible: boolean;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const initialState: MenusAtom = {
|
|
22
|
+
activeFirstLevelMenuKey: '',
|
|
23
|
+
activeSecondLevelMenuKey: '',
|
|
24
|
+
drawerVisible: false
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const EMPTY_GENERATED_MENUS: GeneratedMenu[] = [];
|
|
28
|
+
|
|
29
|
+
const menusAtom = atomWithPartial(initialState);
|
|
30
|
+
|
|
31
|
+
export const useAdminMenus = (categoryKey?: string) => {
|
|
32
|
+
const [menuState, setMenuState] = useAtom(menusAtom);
|
|
33
|
+
const { activeFirstLevelMenuKey, activeSecondLevelMenuKey, drawerVisible } = menuState;
|
|
34
|
+
const adminLayoutContext = useAdminLayoutContext();
|
|
35
|
+
|
|
36
|
+
const route = useRoute();
|
|
37
|
+
|
|
38
|
+
const navigate = useNavigate();
|
|
39
|
+
|
|
40
|
+
const { home, menus: allMenus, quickReferenceMenus: allQuickReferenceMenus } = useMenus();
|
|
41
|
+
const activeCategoryKey = categoryKey ?? adminLayoutContext.categoryKey;
|
|
42
|
+
|
|
43
|
+
const rawMenus = allMenus?.get(activeCategoryKey) || EMPTY_GENERATED_MENUS;
|
|
44
|
+
const menus = useMemo(() => renderCommonMenus(rawMenus), [rawMenus]);
|
|
45
|
+
const quickReferenceMenus = allQuickReferenceMenus?.get(activeCategoryKey);
|
|
46
|
+
|
|
47
|
+
const fullPath = normalizePath(route.originPath) as Router.RoutePath;
|
|
48
|
+
const currentMenu = quickReferenceMenus?.get(fullPath);
|
|
49
|
+
|
|
50
|
+
const { activeMenu, hide } = currentMenu?.menu || {};
|
|
51
|
+
|
|
52
|
+
const selectedRouteKey = (hide ? activeMenu : currentMenu?.key) || currentMenu?.key || '';
|
|
53
|
+
const activeMenuInfo = activeMenu ? getMenuInfoByPath(activeMenu) : currentMenu;
|
|
54
|
+
const openKeys = activeMenuInfo?.parentKeys || [];
|
|
55
|
+
|
|
56
|
+
const selectedKey = [selectedRouteKey];
|
|
57
|
+
const routeFirstLevelMenuKey = openKeys[0] || selectedRouteKey;
|
|
58
|
+
const routeSecondLevelMenuKey = openKeys[1] || selectedRouteKey;
|
|
59
|
+
const derivedActiveFirstLevelMenuKey = activeFirstLevelMenuKey || routeFirstLevelMenuKey;
|
|
60
|
+
const derivedActiveSecondLevelMenuKey = activeSecondLevelMenuKey || routeSecondLevelMenuKey;
|
|
61
|
+
|
|
62
|
+
const firstLevelMenus = menus.map(menu => {
|
|
63
|
+
const { children: _, ...rest } = menu;
|
|
64
|
+
|
|
65
|
+
return rest;
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
const secondLevelMenus = menus.find(item => item?.key === derivedActiveFirstLevelMenuKey)?.children || [];
|
|
69
|
+
|
|
70
|
+
const isActiveFirstLevelMenuHasChildren = derivedActiveFirstLevelMenuKey ? Boolean(secondLevelMenus.length) : false;
|
|
71
|
+
|
|
72
|
+
const childLevelMenus = secondLevelMenus.find(menu => menu.key === derivedActiveSecondLevelMenuKey)?.children || [];
|
|
73
|
+
|
|
74
|
+
const isActiveSecondLevelMenuHasChildren = derivedActiveSecondLevelMenuKey ? Boolean(childLevelMenus.length) : false;
|
|
75
|
+
|
|
76
|
+
function routerPushByKey(key: string) {
|
|
77
|
+
const newRoute = quickReferenceMenus?.get(key as Router.RoutePath);
|
|
78
|
+
|
|
79
|
+
if (newRoute) {
|
|
80
|
+
if (newRoute.href) {
|
|
81
|
+
window.open(newRoute.href, '_blank', 'noopener,noreferrer');
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const search = createRouteSearch(newRoute.query);
|
|
86
|
+
|
|
87
|
+
if (search) {
|
|
88
|
+
navigate({
|
|
89
|
+
search,
|
|
90
|
+
to: newRoute.path
|
|
91
|
+
});
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
navigate({
|
|
96
|
+
to: newRoute.path
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/** 可以手动指定菜单或者是默认当前路由的一级菜单 */
|
|
102
|
+
function changeActiveFirstLevelMenuKey(key?: string) {
|
|
103
|
+
setMenuState({ activeFirstLevelMenuKey: key || '' });
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/** 可以手动指定菜单或者是默认当前路由的二级菜单 */
|
|
107
|
+
function changeActiveSecondLevelMenuKey(key?: string) {
|
|
108
|
+
setMenuState({ activeSecondLevelMenuKey: key || '' });
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function setDrawerVisible(visible: boolean) {
|
|
112
|
+
setMenuState({ drawerVisible: visible });
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function getMenuInfoByPath(path: Router.RoutePath) {
|
|
116
|
+
return quickReferenceMenus?.get(path);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
useUpdateEffect(() => {
|
|
120
|
+
setMenuState({
|
|
121
|
+
activeFirstLevelMenuKey: '',
|
|
122
|
+
activeSecondLevelMenuKey: '',
|
|
123
|
+
drawerVisible: false
|
|
124
|
+
});
|
|
125
|
+
}, [selectedRouteKey]);
|
|
126
|
+
|
|
127
|
+
return {
|
|
128
|
+
menus,
|
|
129
|
+
home,
|
|
130
|
+
quickReferenceMenus,
|
|
131
|
+
firstLevelMenus,
|
|
132
|
+
secondLevelMenus,
|
|
133
|
+
childLevelMenus,
|
|
134
|
+
activeFirstLevelMenuKey: derivedActiveFirstLevelMenuKey,
|
|
135
|
+
activeSecondLevelMenuKey: derivedActiveSecondLevelMenuKey,
|
|
136
|
+
isActiveFirstLevelMenuHasChildren,
|
|
137
|
+
isActiveSecondLevelMenuHasChildren,
|
|
138
|
+
route,
|
|
139
|
+
openKeys,
|
|
140
|
+
currentMenu,
|
|
141
|
+
activeMenu,
|
|
142
|
+
selectedKey,
|
|
143
|
+
drawerVisible,
|
|
144
|
+
setDrawerVisible,
|
|
145
|
+
routerPushByKey,
|
|
146
|
+
changeActiveFirstLevelMenuKey,
|
|
147
|
+
changeActiveSecondLevelMenuKey,
|
|
148
|
+
getMenuInfoByPath
|
|
149
|
+
};
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
function createRouteSearch(query: Api.Route.BackendRouteQuery[] | null | undefined) {
|
|
153
|
+
const search: Record<string, string> = {};
|
|
154
|
+
|
|
155
|
+
query?.forEach(item => {
|
|
156
|
+
const key = item.key.trim();
|
|
157
|
+
|
|
158
|
+
if (key) {
|
|
159
|
+
search[key] = item.value;
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
return Object.keys(search).length ? search : undefined;
|
|
164
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './shared';
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { getAdminLayoutsOptions } from '../../setup';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Get all tabs
|
|
5
|
+
*
|
|
6
|
+
* @param tabs Tabs
|
|
7
|
+
* @param homeTab Home tab
|
|
8
|
+
*/
|
|
9
|
+
export function getAllTabs(tabs: App.Global.Tab[], homeTab: App.Global.Tab | null) {
|
|
10
|
+
if (!homeTab) {
|
|
11
|
+
return [];
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const filterHomeTabs = tabs.filter(tab => tab.id !== homeTab.id);
|
|
15
|
+
|
|
16
|
+
const fixedTabs = filterHomeTabs.filter(isFixedTab).toSorted((a, b) => a.fixedIndex! - b.fixedIndex!);
|
|
17
|
+
|
|
18
|
+
const remainTabs = filterHomeTabs.filter(tab => !isFixedTab(tab));
|
|
19
|
+
|
|
20
|
+
const allTabs = [homeTab, ...fixedTabs, ...remainTabs];
|
|
21
|
+
|
|
22
|
+
return allTabs;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Is fixed tab
|
|
27
|
+
*
|
|
28
|
+
* @param tab
|
|
29
|
+
*/
|
|
30
|
+
function isFixedTab(tab: App.Global.Tab) {
|
|
31
|
+
return tab.fixedIndex !== undefined && tab.fixedIndex !== null;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Get tab id by route
|
|
36
|
+
*
|
|
37
|
+
* @param route
|
|
38
|
+
*/
|
|
39
|
+
export function getTabIdByRoute(pathname: string, multiTab: boolean, fullPath: string) {
|
|
40
|
+
let id = pathname;
|
|
41
|
+
|
|
42
|
+
if (multiTab) {
|
|
43
|
+
id = fullPath;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return id;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Get tab by route
|
|
51
|
+
*
|
|
52
|
+
* @param route
|
|
53
|
+
*/
|
|
54
|
+
export function getTabByMenuInfo(
|
|
55
|
+
menuInfo: Menu.QuickReferenceMenu,
|
|
56
|
+
pathname: Router.RoutePath,
|
|
57
|
+
fullPath: string
|
|
58
|
+
): App.Global.Tab {
|
|
59
|
+
const { defaultIcon } = getAdminLayoutsOptions();
|
|
60
|
+
|
|
61
|
+
return {
|
|
62
|
+
id: getTabIdByRoute(pathname, menuInfo.tab?.multi ?? false, fullPath),
|
|
63
|
+
routePath: pathname,
|
|
64
|
+
fullPath,
|
|
65
|
+
fixedIndex: menuInfo.tab?.fixedIndex,
|
|
66
|
+
i18nKey: menuInfo.i18nKey,
|
|
67
|
+
icon: menuInfo.menu?.icon || defaultIcon,
|
|
68
|
+
keepAlive: menuInfo.keepAlive,
|
|
69
|
+
localIcon: menuInfo.menu?.localIcon,
|
|
70
|
+
label: menuInfo.title || '',
|
|
71
|
+
oldLabel: menuInfo.title
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Is tab in tabs
|
|
77
|
+
*
|
|
78
|
+
* @param tabId
|
|
79
|
+
* @param tabs
|
|
80
|
+
*/
|
|
81
|
+
export function isTabInTabs(tabId: string, tabs: App.Global.Tab[]) {
|
|
82
|
+
return tabs.some(tab => tab.id === tabId);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Filter tabs by ids
|
|
87
|
+
*
|
|
88
|
+
* @param tabIds
|
|
89
|
+
* @param tabs
|
|
90
|
+
*/
|
|
91
|
+
export function filterTabsByIds(tabIds: string[], tabs: App.Global.Tab[]) {
|
|
92
|
+
return tabs.filter(tab => !tabIds.includes(tab.id));
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Extract tabs by all routes
|
|
97
|
+
*
|
|
98
|
+
* @param routeIds All route IDs
|
|
99
|
+
* @param tabs Cached tabs
|
|
100
|
+
*/
|
|
101
|
+
export function extractTabsByAllRoutes(routeIds: string[], tabs: App.Global.Tab[]) {
|
|
102
|
+
return tabs.filter(tab => routeIds.includes(tab.routePath));
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Get fixed tabs
|
|
107
|
+
*
|
|
108
|
+
* @param tabs
|
|
109
|
+
*/
|
|
110
|
+
export function getFixedTabs(tabs: App.Global.Tab[]) {
|
|
111
|
+
return tabs.filter(isFixedTab);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Get fixed tab ids
|
|
116
|
+
*
|
|
117
|
+
* @param tabs
|
|
118
|
+
*/
|
|
119
|
+
export function getFixedTabIds(tabs: App.Global.Tab[]) {
|
|
120
|
+
const fixedTabs = getFixedTabs(tabs);
|
|
121
|
+
|
|
122
|
+
return fixedTabs.map(tab => tab.id);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Reorder fixed tabs fixedIndex
|
|
127
|
+
*
|
|
128
|
+
* @param tabs
|
|
129
|
+
*/
|
|
130
|
+
export function reorderFixedTabs(tabs: App.Global.Tab[]) {
|
|
131
|
+
const fixedTabs = getFixedTabs(tabs);
|
|
132
|
+
fixedTabs.forEach((t, i) => {
|
|
133
|
+
t.fixedIndex = i;
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Find tab by route name
|
|
139
|
+
*
|
|
140
|
+
* @param routePath
|
|
141
|
+
* @param tabs
|
|
142
|
+
*/
|
|
143
|
+
export function findTabByRoutePath(routePath: Router.RoutePath, tabs: App.Global.Tab[]) {
|
|
144
|
+
const tabId = routePath;
|
|
145
|
+
const multiTabId = `${routePath}?`;
|
|
146
|
+
|
|
147
|
+
return tabs.find(tab => tab.id === tabId || tab.id.startsWith(multiTabId));
|
|
148
|
+
}
|