@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.
Files changed (333) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +508 -0
  3. package/dist/cli.mjs +78 -0
  4. package/dist/config-BKkdncJS.mjs +987 -0
  5. package/dist/index.mjs +14 -0
  6. package/package.json +83 -0
  7. package/templates/admin/.env +62 -0
  8. package/templates/admin/.env.prod +7 -0
  9. package/templates/admin/.env.test +7 -0
  10. package/templates/admin/.oxlintrc.json +6 -0
  11. package/templates/admin/README.md +508 -0
  12. package/templates/admin/index.html +14 -0
  13. package/templates/admin/package.json +105 -0
  14. package/templates/admin/public/favicon.svg +3 -0
  15. package/templates/admin/src/App.tsx +71 -0
  16. package/templates/admin/src/assets/audio/wechat-style-notification.wav +0 -0
  17. package/templates/admin/src/assets/imgs/skyroc.jpg +0 -0
  18. package/templates/admin/src/assets/svg-icon/activity.svg +1 -0
  19. package/templates/admin/src/assets/svg-icon/at-sign.svg +1 -0
  20. package/templates/admin/src/assets/svg-icon/avatar.svg +1 -0
  21. package/templates/admin/src/assets/svg-icon/banner.svg +1 -0
  22. package/templates/admin/src/assets/svg-icon/cast.svg +1 -0
  23. package/templates/admin/src/assets/svg-icon/chrome.svg +1 -0
  24. package/templates/admin/src/assets/svg-icon/copy.svg +1 -0
  25. package/templates/admin/src/assets/svg-icon/custom-icon.svg +1 -0
  26. package/templates/admin/src/assets/svg-icon/empty-data.svg +1 -0
  27. package/templates/admin/src/assets/svg-icon/error.svg +1 -0
  28. package/templates/admin/src/assets/svg-icon/expectation.svg +1 -0
  29. package/templates/admin/src/assets/svg-icon/heart.svg +1 -0
  30. package/templates/admin/src/assets/svg-icon/logo.svg +15 -0
  31. package/templates/admin/src/assets/svg-icon/network-error.svg +1 -0
  32. package/templates/admin/src/assets/svg-icon/no-icon.svg +1 -0
  33. package/templates/admin/src/assets/svg-icon/no-permission.svg +1 -0
  34. package/templates/admin/src/assets/svg-icon/not-found.svg +1 -0
  35. package/templates/admin/src/assets/svg-icon/service-error.svg +1 -0
  36. package/templates/admin/src/bootstrap.tsx +60 -0
  37. package/templates/admin/src/components/SkyrocAvatar.tsx +13 -0
  38. package/templates/admin/src/components/SystemLogo.tsx +7 -0
  39. package/templates/admin/src/config.ts +125 -0
  40. package/templates/admin/src/features/antd/AntdProvider.tsx +21 -0
  41. package/templates/admin/src/features/auth/components/UserAvatar.tsx +76 -0
  42. package/templates/admin/src/features/auth/use-auth-form-rules.ts +83 -0
  43. package/templates/admin/src/features/auth/use-auth.ts +96 -0
  44. package/templates/admin/src/features/auth/use-login.ts +72 -0
  45. package/templates/admin/src/features/effects/GlobalEffect.tsx +15 -0
  46. package/templates/admin/src/features/menus/dynamic-routes.ts +10 -0
  47. package/templates/admin/src/features/menus/extras.ts +3 -0
  48. package/templates/admin/src/features/menus/menu-category.ts +14 -0
  49. package/templates/admin/src/features/menus/menu-config.ts +5 -0
  50. package/templates/admin/src/features/router/RouterProvider.tsx +18 -0
  51. package/templates/admin/src/features/router/guard.ts +97 -0
  52. package/templates/admin/src/features/router/index.ts +52 -0
  53. package/templates/admin/src/features/router/routeTree.gen.ts +237 -0
  54. package/templates/admin/src/features/router/router-ref.ts +24 -0
  55. package/templates/admin/src/locales/antd.ts +8 -0
  56. package/templates/admin/src/locales/index.ts +22 -0
  57. package/templates/admin/src/locales/sync.ts +14 -0
  58. package/templates/admin/src/main.tsx +9 -0
  59. package/templates/admin/src/pages/(admin)/home/index.tsx +46 -0
  60. package/templates/admin/src/pages/(admin)/layout.tsx +44 -0
  61. package/templates/admin/src/pages/(auth)/login/index.tsx +102 -0
  62. package/templates/admin/src/pages/(auth)/login/layout.tsx +71 -0
  63. package/templates/admin/src/pages/(auth)/login-out.tsx +27 -0
  64. package/templates/admin/src/pages/(errors)/403.tsx +16 -0
  65. package/templates/admin/src/pages/(errors)/404.tsx +16 -0
  66. package/templates/admin/src/pages/(errors)/500.tsx +16 -0
  67. package/templates/admin/src/pages/__root.tsx +54 -0
  68. package/templates/admin/src/pages/error.tsx +19 -0
  69. package/templates/admin/src/pages/index.tsx +14 -0
  70. package/templates/admin/src/pages/loading.tsx +45 -0
  71. package/templates/admin/src/pages/not-found.tsx +9 -0
  72. package/templates/admin/src/plugins/app.tsx +47 -0
  73. package/templates/admin/src/plugins/assets.ts +4 -0
  74. package/templates/admin/src/plugins/index.ts +32 -0
  75. package/templates/admin/src/service/adapter.ts +63 -0
  76. package/templates/admin/src/service/api/auth/api.ts +31 -0
  77. package/templates/admin/src/service/api/auth/hooks.ts +28 -0
  78. package/templates/admin/src/service/api/auth/index.ts +10 -0
  79. package/templates/admin/src/service/api/auth/keys.ts +7 -0
  80. package/templates/admin/src/service/api/auth/urls.ts +7 -0
  81. package/templates/admin/src/service/api/index.ts +2 -0
  82. package/templates/admin/src/service/api/route/api.ts +7 -0
  83. package/templates/admin/src/service/api/route/hooks.ts +21 -0
  84. package/templates/admin/src/service/api/route/index.ts +10 -0
  85. package/templates/admin/src/service/api/route/keys.ts +3 -0
  86. package/templates/admin/src/service/api/route/urls.ts +5 -0
  87. package/templates/admin/src/service/queryClient.ts +13 -0
  88. package/templates/admin/src/service/request/index.ts +62 -0
  89. package/templates/admin/src/styles/scss/global.scss +1 -0
  90. package/templates/admin/src/styles/scss/scrollbar.scss +28 -0
  91. package/templates/admin/src/types/auto-imports.d.ts +186 -0
  92. package/templates/admin/src/types/global.d.ts +16 -0
  93. package/templates/admin/src/types/router.d.ts +14 -0
  94. package/templates/admin/src/types/storage.d.ts +17 -0
  95. package/templates/admin/src/types/vite-env.d.ts +117 -0
  96. package/templates/admin/src/utils/common.tsx +38 -0
  97. package/templates/admin/src/utils/icon.ts +9 -0
  98. package/templates/admin/src/utils/service.ts +75 -0
  99. package/templates/admin/src/utils/storage.ts +7 -0
  100. package/templates/admin/tsconfig.json +22 -0
  101. package/templates/admin/uno.config.ts +18 -0
  102. package/templates/admin/vite.config.ts +13 -0
  103. package/templates/admin-shell/i18n/atoms/lang.ts +20 -0
  104. package/templates/admin-shell/i18n/config/default.ts +11 -0
  105. package/templates/admin-shell/i18n/features/lang/LangEffect.tsx +25 -0
  106. package/templates/admin-shell/i18n/features/lang/LangSwitch.tsx +49 -0
  107. package/templates/admin-shell/i18n/hooks/use-lang.ts +47 -0
  108. package/templates/admin-shell/i18n/i18n.ts +116 -0
  109. package/templates/admin-shell/i18n/index.ts +23 -0
  110. package/templates/admin-shell/i18n/langs/en-us/common.json +49 -0
  111. package/templates/admin-shell/i18n/langs/en-us/datatable.json +8 -0
  112. package/templates/admin-shell/i18n/langs/en-us/dropdown.json +9 -0
  113. package/templates/admin-shell/i18n/langs/en-us/form.json +27 -0
  114. package/templates/admin-shell/i18n/langs/en-us/icon.json +13 -0
  115. package/templates/admin-shell/i18n/langs/en-us/notification.json +20 -0
  116. package/templates/admin-shell/i18n/langs/en-us/page.json +442 -0
  117. package/templates/admin-shell/i18n/langs/en-us/request.json +8 -0
  118. package/templates/admin-shell/i18n/langs/en-us/route.json +84 -0
  119. package/templates/admin-shell/i18n/langs/en-us/system.json +9 -0
  120. package/templates/admin-shell/i18n/langs/en-us/theme.json +173 -0
  121. package/templates/admin-shell/i18n/langs/index.ts +63 -0
  122. package/templates/admin-shell/i18n/langs/zh-cn/common.json +49 -0
  123. package/templates/admin-shell/i18n/langs/zh-cn/datatable.json +8 -0
  124. package/templates/admin-shell/i18n/langs/zh-cn/dropdown.json +9 -0
  125. package/templates/admin-shell/i18n/langs/zh-cn/form.json +27 -0
  126. package/templates/admin-shell/i18n/langs/zh-cn/icon.json +13 -0
  127. package/templates/admin-shell/i18n/langs/zh-cn/notification.json +20 -0
  128. package/templates/admin-shell/i18n/langs/zh-cn/page.json +442 -0
  129. package/templates/admin-shell/i18n/langs/zh-cn/request.json +8 -0
  130. package/templates/admin-shell/i18n/langs/zh-cn/route.json +84 -0
  131. package/templates/admin-shell/i18n/langs/zh-cn/system.json +9 -0
  132. package/templates/admin-shell/i18n/langs/zh-cn/theme.json +173 -0
  133. package/templates/admin-shell/i18n/types/i18n.ts +29 -0
  134. package/templates/admin-shell/i18n/types.ts +53 -0
  135. package/templates/admin-shell/i18n/utils/helpers.ts +18 -0
  136. package/templates/admin-shell/layouts/AdminLayout.tsx +161 -0
  137. package/templates/admin-shell/layouts/constant.ts +56 -0
  138. package/templates/admin-shell/layouts/context.tsx +101 -0
  139. package/templates/admin-shell/layouts/features/menus/MenuBadge.tsx +76 -0
  140. package/templates/admin-shell/layouts/features/menus/dynamic-routes.ts +146 -0
  141. package/templates/admin-shell/layouts/features/menus/menu-generator.tsx +444 -0
  142. package/templates/admin-shell/layouts/features/menus/menu-renderer.tsx +149 -0
  143. package/templates/admin-shell/layouts/features/menus/permissions.ts +28 -0
  144. package/templates/admin-shell/layouts/features/menus/use-menus.ts +98 -0
  145. package/templates/admin-shell/layouts/features/use-route.ts +30 -0
  146. package/templates/admin-shell/layouts/index.ts +44 -0
  147. package/templates/admin-shell/layouts/materials/index.ts +6 -0
  148. package/templates/admin-shell/layouts/materials/libs/admin-layout/index.module.css +63 -0
  149. package/templates/admin-shell/layouts/materials/libs/admin-layout/index.module.css.d.ts +18 -0
  150. package/templates/admin-shell/layouts/materials/libs/admin-layout/index.tsx +238 -0
  151. package/templates/admin-shell/layouts/materials/libs/admin-layout/shared.ts +67 -0
  152. package/templates/admin-shell/layouts/materials/libs/page-tab/ButtonTab.tsx +44 -0
  153. package/templates/admin-shell/layouts/materials/libs/page-tab/ChromeTab.tsx +54 -0
  154. package/templates/admin-shell/layouts/materials/libs/page-tab/ChromeTabBg.tsx +30 -0
  155. package/templates/admin-shell/layouts/materials/libs/page-tab/SliderTab.tsx +44 -0
  156. package/templates/admin-shell/layouts/materials/libs/page-tab/SvgClose.tsx +51 -0
  157. package/templates/admin-shell/layouts/materials/libs/page-tab/hook.ts +34 -0
  158. package/templates/admin-shell/layouts/materials/libs/page-tab/index.module.css +120 -0
  159. package/templates/admin-shell/layouts/materials/libs/page-tab/index.module.css.d.ts +18 -0
  160. package/templates/admin-shell/layouts/materials/libs/page-tab/index.tsx +76 -0
  161. package/templates/admin-shell/layouts/materials/libs/page-tab/shared.ts +32 -0
  162. package/templates/admin-shell/layouts/materials/types/index.ts +322 -0
  163. package/templates/admin-shell/layouts/modules/AdminContent.tsx +285 -0
  164. package/templates/admin-shell/layouts/modules/AdminFooter.tsx +13 -0
  165. package/templates/admin-shell/layouts/modules/AdminLogo.tsx +28 -0
  166. package/templates/admin-shell/layouts/modules/AdminSider.tsx +50 -0
  167. package/templates/admin-shell/layouts/modules/admin-header/AdminHeader.tsx +132 -0
  168. package/templates/admin-shell/layouts/modules/admin-header/components/Breadcrumb.tsx +62 -0
  169. package/templates/admin-shell/layouts/modules/admin-header/components/ThemeButton.tsx +24 -0
  170. package/templates/admin-shell/layouts/modules/admin-menu/AdminMenu.tsx +37 -0
  171. package/templates/admin-shell/layouts/modules/admin-menu/components/FirstLevelMenu.tsx +156 -0
  172. package/templates/admin-shell/layouts/modules/admin-menu/components/HorizontalMenu.tsx +88 -0
  173. package/templates/admin-shell/layouts/modules/admin-menu/components/MenuPortal.tsx +28 -0
  174. package/templates/admin-shell/layouts/modules/admin-menu/components/VerticalMenu.tsx +123 -0
  175. package/templates/admin-shell/layouts/modules/admin-menu/enum.ts +47 -0
  176. package/templates/admin-shell/layouts/modules/admin-menu/modules/Horizontal.tsx +22 -0
  177. package/templates/admin-shell/layouts/modules/admin-menu/modules/TopHybridHeaderFirst.tsx +15 -0
  178. package/templates/admin-shell/layouts/modules/admin-menu/modules/TopHybridSidebarFirst.tsx +18 -0
  179. package/templates/admin-shell/layouts/modules/admin-menu/modules/Vertical.tsx +14 -0
  180. package/templates/admin-shell/layouts/modules/admin-menu/modules/VerticalHybridHeaderFirst.tsx +18 -0
  181. package/templates/admin-shell/layouts/modules/admin-menu/modules/VerticalMix.tsx +132 -0
  182. package/templates/admin-shell/layouts/modules/admin-search/AdminSearch.tsx +36 -0
  183. package/templates/admin-shell/layouts/modules/admin-search/components/SearchFooter.tsx +38 -0
  184. package/templates/admin-shell/layouts/modules/admin-search/components/SearchModal.tsx +171 -0
  185. package/templates/admin-shell/layouts/modules/admin-search/components/SearchResult.tsx +43 -0
  186. package/templates/admin-shell/layouts/modules/admin-tab/AdminTab.tsx +125 -0
  187. package/templates/admin-shell/layouts/modules/admin-tab/components/TabContextMenu.tsx +107 -0
  188. package/templates/admin-shell/layouts/modules/admin-tab/hooks/useTabScroll.ts +86 -0
  189. package/templates/admin-shell/layouts/modules/shared/logo.ts +42 -0
  190. package/templates/admin-shell/layouts/modules/theme-drawer/ThemeDrawer.tsx +68 -0
  191. package/templates/admin-shell/layouts/modules/theme-drawer/components/AnimatedCollapse.tsx +36 -0
  192. package/templates/admin-shell/layouts/modules/theme-drawer/components/AnimatedItem.tsx +35 -0
  193. package/templates/admin-shell/layouts/modules/theme-drawer/components/LayoutModeCard.tsx +110 -0
  194. package/templates/admin-shell/layouts/modules/theme-drawer/components/SettingItem.tsx +31 -0
  195. package/templates/admin-shell/layouts/modules/theme-drawer/modules/ConfigOperation.tsx +53 -0
  196. package/templates/admin-shell/layouts/modules/theme-drawer/modules/appearance/CustomPicker.tsx +105 -0
  197. package/templates/admin-shell/layouts/modules/theme-drawer/modules/appearance/ThemeColor.tsx +58 -0
  198. package/templates/admin-shell/layouts/modules/theme-drawer/modules/appearance/ThemeSchema.tsx +42 -0
  199. package/templates/admin-shell/layouts/modules/theme-drawer/modules/appearance/ThemeToken.tsx +44 -0
  200. package/templates/admin-shell/layouts/modules/theme-drawer/modules/appearance/index.tsx +23 -0
  201. package/templates/admin-shell/layouts/modules/theme-drawer/modules/general/GlobalSettings.tsx +57 -0
  202. package/templates/admin-shell/layouts/modules/theme-drawer/modules/general/ThemeGeneral.tsx +20 -0
  203. package/templates/admin-shell/layouts/modules/theme-drawer/modules/general/WatermarkSettings.tsx +103 -0
  204. package/templates/admin-shell/layouts/modules/theme-drawer/modules/layout/ContentSettings.tsx +100 -0
  205. package/templates/admin-shell/layouts/modules/theme-drawer/modules/layout/FooterSettings.tsx +71 -0
  206. package/templates/admin-shell/layouts/modules/theme-drawer/modules/layout/HeaderSettings.tsx +63 -0
  207. package/templates/admin-shell/layouts/modules/theme-drawer/modules/layout/LayoutMode.tsx +73 -0
  208. package/templates/admin-shell/layouts/modules/theme-drawer/modules/layout/SiderSettings.tsx +124 -0
  209. package/templates/admin-shell/layouts/modules/theme-drawer/modules/layout/TabSettings.tsx +95 -0
  210. package/templates/admin-shell/layouts/modules/theme-drawer/modules/layout/ThemeLayout.tsx +32 -0
  211. package/templates/admin-shell/layouts/modules/theme-drawer/modules/preset/ThemePreset.tsx +132 -0
  212. package/templates/admin-shell/layouts/options.tsx +79 -0
  213. package/templates/admin-shell/layouts/setup.ts +102 -0
  214. package/templates/admin-shell/layouts/state/AdminEffect.tsx +56 -0
  215. package/templates/admin-shell/layouts/state/AdminTabEffect.tsx +28 -0
  216. package/templates/admin-shell/layouts/state/index.ts +3 -0
  217. package/templates/admin-shell/layouts/state/menus/MenuToggler.tsx +53 -0
  218. package/templates/admin-shell/layouts/state/menus/use-admin-menu-badges.ts +46 -0
  219. package/templates/admin-shell/layouts/state/menus/use-admin-menus.tsx +164 -0
  220. package/templates/admin-shell/layouts/state/tabs/index.ts +1 -0
  221. package/templates/admin-shell/layouts/state/tabs/shared.tsx +148 -0
  222. package/templates/admin-shell/layouts/state/tabs/use-admin-tab.ts +377 -0
  223. package/templates/admin-shell/layouts/state/use-admin-state.ts +118 -0
  224. package/templates/admin-shell/layouts/types/router.d.ts +10 -0
  225. package/templates/admin-shell/layouts/types/storage.ts +18 -0
  226. package/templates/admin-shell/notification/NotificationButton.tsx +91 -0
  227. package/templates/admin-shell/notification/NotificationContext.ts +8 -0
  228. package/templates/admin-shell/notification/NotificationPanel.tsx +194 -0
  229. package/templates/admin-shell/notification/NotificationProvider.tsx +59 -0
  230. package/templates/admin-shell/notification/index.ts +12 -0
  231. package/templates/admin-shell/notification/mock.ts +59 -0
  232. package/templates/admin-shell/notification/notification-store.ts +438 -0
  233. package/templates/admin-shell/notification/notification.css +60 -0
  234. package/templates/admin-shell/notification/types.ts +104 -0
  235. package/templates/admin-shell/notification/use-notification.ts +51 -0
  236. package/templates/admin-shell/notification/useNotificationContext.ts +14 -0
  237. package/templates/admin-shell/runtime/app-update.ts +156 -0
  238. package/templates/admin-shell/runtime/dayjs.ts +20 -0
  239. package/templates/admin-shell/runtime/iconify.ts +17 -0
  240. package/templates/admin-shell/runtime/index.ts +10 -0
  241. package/templates/admin-shell/runtime/nprogress.ts +25 -0
  242. package/templates/admin-shell/runtime/plugins.ts +62 -0
  243. package/templates/admin-shell/styles/global.css +54 -0
  244. package/templates/admin-shell/styles/nprogress.css +85 -0
  245. package/templates/admin-shell/styles/reset.css +378 -0
  246. package/templates/admin-shell/theme/antd/AntdProvider.tsx +106 -0
  247. package/templates/admin-shell/theme/antd/index.ts +23 -0
  248. package/templates/admin-shell/theme/antd/shared.ts +80 -0
  249. package/templates/admin-shell/theme/antd/ui.ts +250 -0
  250. package/templates/admin-shell/theme/antd-algorithm/algorithm/dark/colors.ts +99 -0
  251. package/templates/admin-shell/theme/antd-algorithm/algorithm/dark/index.ts +87 -0
  252. package/templates/admin-shell/theme/antd-algorithm/algorithm/default/colors.ts +91 -0
  253. package/templates/admin-shell/theme/antd-algorithm/algorithm/default/index.ts +77 -0
  254. package/templates/admin-shell/theme/antd-algorithm/index.ts +80 -0
  255. package/templates/admin-shell/theme/antd-algorithm/seed/index.ts +41 -0
  256. package/templates/admin-shell/theme/antd-algorithm/shared/colorAlgorithm.ts +10 -0
  257. package/templates/admin-shell/theme/antd-algorithm/shared/genColorMapToken.ts +165 -0
  258. package/templates/admin-shell/theme/antd-algorithm/shared/genCommonMapToken.ts +23 -0
  259. package/templates/admin-shell/theme/antd-algorithm/shared/genControlHeight.ts +14 -0
  260. package/templates/admin-shell/theme/antd-algorithm/shared/genFontMapToken.ts +274 -0
  261. package/templates/admin-shell/theme/antd-algorithm/shared/genRadiusMapToken.ts +139 -0
  262. package/templates/admin-shell/theme/antd-algorithm/shared/genSizeMapToken.ts +114 -0
  263. package/templates/admin-shell/theme/antd-algorithm/types/index.ts +20 -0
  264. package/templates/admin-shell/theme/components/ThemeEffect.tsx +55 -0
  265. package/templates/admin-shell/theme/components/ThemeSchemaSegmented.tsx +27 -0
  266. package/templates/admin-shell/theme/components/ThemeSchemaSwitch.tsx +77 -0
  267. package/templates/admin-shell/theme/components/shared.ts +5 -0
  268. package/templates/admin-shell/theme/config/default.ts +108 -0
  269. package/templates/admin-shell/theme/config/index.ts +1 -0
  270. package/templates/admin-shell/theme/hooks/index.ts +2 -0
  271. package/templates/admin-shell/theme/hooks/use-theme.ts +244 -0
  272. package/templates/admin-shell/theme/index.ts +78 -0
  273. package/templates/admin-shell/theme/presets/azir.json +39 -0
  274. package/templates/admin-shell/theme/presets/compact.json +38 -0
  275. package/templates/admin-shell/theme/presets/dark.json +93 -0
  276. package/templates/admin-shell/theme/presets/default.json +95 -0
  277. package/templates/admin-shell/theme/presets/index.ts +29 -0
  278. package/templates/admin-shell/theme/presets/shadcn.json +99 -0
  279. package/templates/admin-shell/theme/setup.ts +115 -0
  280. package/templates/admin-shell/theme/types/index.ts +27 -0
  281. package/templates/admin-shell/theme/types/theme.d.ts +316 -0
  282. package/templates/admin-shell/theme/utils/dark-mode.ts +46 -0
  283. package/templates/admin-shell/theme/utils/filters.ts +20 -0
  284. package/templates/admin-shell/theme/utils/index.ts +3 -0
  285. package/templates/admin-shell/theme/utils/settings.ts +43 -0
  286. package/templates/admin-shell/types/api/auth.d.ts +148 -0
  287. package/templates/admin-shell/types/api/common.d.ts +54 -0
  288. package/templates/admin-shell/types/api/route.d.ts +104 -0
  289. package/templates/admin-shell/types/api/service.d.ts +51 -0
  290. package/templates/admin-shell/types/api/system-manage.d.ts +160 -0
  291. package/templates/admin-shell/types/app/common.d.ts +31 -0
  292. package/templates/admin-shell/types/app/global.d.ts +71 -0
  293. package/templates/admin-shell/types/app/menu.d.ts +57 -0
  294. package/templates/admin-shell/types/app/router.d.ts +201 -0
  295. package/templates/admin-shell/types/app/storage.d.ts +10 -0
  296. package/templates/admin-shell/types/app/union-key.d.ts +156 -0
  297. package/templates/admin-shell/types/locales/i18n.d.ts +135 -0
  298. package/templates/admin-shell/ui/antd/components/AppTree.tsx +62 -0
  299. package/templates/admin-shell/ui/antd/components/BeyondHiding.tsx +42 -0
  300. package/templates/admin-shell/ui/antd/components/ButtonIcon.tsx +123 -0
  301. package/templates/admin-shell/ui/antd/components/ButtonLink.tsx +30 -0
  302. package/templates/admin-shell/ui/antd/components/ErrorBoundary.tsx +45 -0
  303. package/templates/admin-shell/ui/antd/components/ExceptionBase.tsx +69 -0
  304. package/templates/admin-shell/ui/antd/components/FullScreen.tsx +33 -0
  305. package/templates/admin-shell/ui/antd/components/PinToggler.tsx +35 -0
  306. package/templates/admin-shell/ui/antd/components/ReloadButton.tsx +20 -0
  307. package/templates/admin-shell/ui/antd/components/index.ts +12 -0
  308. package/templates/admin-shell/ui/antd/components/styles/button-icon-animations.css +246 -0
  309. package/templates/admin-shell/ui/antd/index.ts +1 -0
  310. package/templates/admin-shell/ui/antd/styles.d.ts +1 -0
  311. package/templates/admin-shell/ui/compose/animate-feature.ts +5 -0
  312. package/templates/admin-shell/ui/compose/components/BetterScroll.tsx +51 -0
  313. package/templates/admin-shell/ui/compose/components/DarkModeContainer.tsx +22 -0
  314. package/templates/admin-shell/ui/compose/components/FlipText.tsx +41 -0
  315. package/templates/admin-shell/ui/compose/components/I18nLabel.tsx +18 -0
  316. package/templates/admin-shell/ui/compose/components/LazyAnimate.tsx +10 -0
  317. package/templates/admin-shell/ui/compose/components/LookForward.tsx +24 -0
  318. package/templates/admin-shell/ui/compose/components/NumberTicker.tsx +105 -0
  319. package/templates/admin-shell/ui/compose/components/Portal.tsx +74 -0
  320. package/templates/admin-shell/ui/compose/components/SvgIcon.tsx +39 -0
  321. package/templates/admin-shell/ui/compose/components/TypingAnimation.tsx +83 -0
  322. package/templates/admin-shell/ui/compose/components/WaveBg.tsx +56 -0
  323. package/templates/admin-shell/ui/compose/components/index.ts +11 -0
  324. package/templates/admin-shell/ui/compose/index.ts +2 -0
  325. package/templates/admin-shell/ui/compose/table/DragContent.tsx +239 -0
  326. package/templates/admin-shell/ui/compose/table/TableHeaderOperation.tsx +210 -0
  327. package/templates/admin-shell/ui/compose/table/hooks.ts +196 -0
  328. package/templates/admin-shell/ui/compose/table/index.ts +16 -0
  329. package/templates/admin-shell/ui/compose/table/types.ts +244 -0
  330. package/templates/admin-shell/ui/compose/table/use-table-operate.ts +136 -0
  331. package/templates/admin-shell/ui/compose/table/use-table-scroll.ts +49 -0
  332. package/templates/admin-shell/ui/compose/table/use-table.ts +303 -0
  333. package/templates/admin.meta.json +756 -0
@@ -0,0 +1,39 @@
1
+ import { Icon } from '@iconify/react';
2
+ import type { CSSProperties } from 'react';
3
+
4
+ interface Props {
5
+ readonly className?: string;
6
+ /** Iconify icon name */
7
+ readonly icon?: string | null;
8
+ /** Local svg icon name */
9
+ readonly localIcon?: string | null;
10
+ /** Local icon prefix (default: 'icon-local') */
11
+ readonly localIconPrefix?: string;
12
+ readonly style?: CSSProperties;
13
+ }
14
+
15
+ const defaultLocalIcon = 'no-icon';
16
+ const symbolId = (localIconPrefix: string, localIcon: string | null = defaultLocalIcon) => {
17
+ const iconName = localIcon || defaultLocalIcon;
18
+
19
+ return `#${localIconPrefix}-${iconName}`;
20
+ };
21
+
22
+ /**
23
+ * Props
24
+ *
25
+ * - Support iconify and local svg icon
26
+ * - If icon and localIcon are passed at the same time, localIcon will be rendered first
27
+ */
28
+ const SvgIcon = ({ icon, localIcon, localIconPrefix = 'icon-local', ...props }: Props) => {
29
+ /** If localIcon is passed, render localIcon first */
30
+ return localIcon || !icon ? (
31
+ <svg height="1em" width="1em" {...props} aria-hidden="true">
32
+ <use fill="currentColor" href={symbolId(localIconPrefix, localIcon)} />
33
+ </svg>
34
+ ) : (
35
+ <Icon icon={icon} {...props} />
36
+ );
37
+ };
38
+
39
+ export default SvgIcon;
@@ -0,0 +1,83 @@
1
+ import { clsx } from 'clsx';
2
+ import type { MotionProps } from 'motion/react';
3
+ import { motion } from 'motion/react';
4
+ import { useEffect, useRef, useState } from 'react';
5
+
6
+ interface TypingAnimationProps extends MotionProps {
7
+ as?: React.ElementType;
8
+ children: string;
9
+ className?: string;
10
+ delay?: number;
11
+ duration?: number;
12
+ startOnView?: boolean;
13
+ }
14
+
15
+ export function TypingAnimation({
16
+ as: Component = 'div',
17
+ children,
18
+ className,
19
+ delay = 0,
20
+ duration = 50,
21
+ startOnView = false,
22
+ ...props
23
+ }: TypingAnimationProps) {
24
+ const MotionComponent = motion.create(Component, {
25
+ forwardMotionProps: true
26
+ });
27
+
28
+ const [displayedText, setDisplayedText] = useState<string>('');
29
+ const [started, setStarted] = useState(false);
30
+ const elementRef = useRef<HTMLElement | null>(null);
31
+
32
+ useEffect(() => {
33
+ if (!startOnView) {
34
+ const startTimeout = setTimeout(() => {
35
+ setStarted(true);
36
+ }, delay);
37
+ return () => clearTimeout(startTimeout);
38
+ }
39
+
40
+ const observer = new IntersectionObserver(
41
+ ([entry]) => {
42
+ if (entry.isIntersecting) {
43
+ setTimeout(() => {
44
+ setStarted(true);
45
+ }, delay);
46
+ observer.disconnect();
47
+ }
48
+ },
49
+ { threshold: 0.1 }
50
+ );
51
+
52
+ if (elementRef.current) {
53
+ observer.observe(elementRef.current);
54
+ }
55
+
56
+ return () => observer.disconnect();
57
+ }, [delay, startOnView]);
58
+
59
+ useEffect(() => {
60
+ if (!started) return;
61
+
62
+ let i = 0;
63
+ const typingEffect = setInterval(() => {
64
+ if (i < children.length) {
65
+ setDisplayedText(children.substring(0, i + 1));
66
+ i += 1;
67
+ } else {
68
+ clearInterval(typingEffect);
69
+ }
70
+ }, duration);
71
+
72
+ // eslint-disable-next-line consistent-return
73
+ return () => {
74
+ clearInterval(typingEffect);
75
+ };
76
+ }, [children, duration, started]);
77
+
78
+ return (
79
+ <MotionComponent className={clsx('tracking-[-0.02em]', className)} ref={elementRef} {...props}>
80
+ {displayedText}
81
+ </MotionComponent>
82
+ );
83
+ }
@@ -0,0 +1,56 @@
1
+ import { getPaletteColorByNumber } from '@skyroc/color';
2
+
3
+ interface Props {
4
+ /** Theme color */
5
+ themeColor: string;
6
+ }
7
+
8
+ const WaveBg = ({ themeColor }: Props) => {
9
+ const lightColor = getPaletteColorByNumber(themeColor, 200);
10
+ const darkColor = getPaletteColorByNumber(themeColor, 500);
11
+
12
+ return (
13
+ <div className="absolute-lt z-1 size-full overflow-hidden">
14
+ <div className="absolute -right-300px -top-900px lt-sm:(-right-100px -top-1170px)">
15
+ <svg height="1337" width="1337">
16
+ <defs>
17
+ <path
18
+ d="M1337,668.5 C1337,1037.455193874239 1037.455193874239,1337 668.5,1337 C523.6725684305388,1337 337,1236 370.50000000000006,1094 C434.03835568300906,824.6732385973953 6.906089672974592e-14,892.6277623047779 0,668.5000000000001 C0,299.5448061257611 299.5448061257609,1.1368683772161603e-13 668.4999999999999,0 C1037.455193874239,0 1337,299.544806125761 1337,668.5Z"
19
+ fillRule="evenodd"
20
+ id="path-1"
21
+ opacity="1"
22
+ />
23
+ <linearGradient id="linearGradient-2" x1="0.79" x2="0.21" y1="0.62" y2="0.86">
24
+ <stop offset="0" stopColor={lightColor} stopOpacity="1" />
25
+ <stop offset="1" stopColor={darkColor} stopOpacity="1" />
26
+ </linearGradient>
27
+ </defs>
28
+ <g opacity="1">
29
+ <use fill="url(#linearGradient-2)" fillOpacity="1" xlinkHref="#path-1" />
30
+ </g>
31
+ </svg>
32
+ </div>
33
+ <div className="absolute -bottom-400px -left-200px lt-sm:(-bottom-760px -left-100px)">
34
+ <svg height="896" width="967.8852157128662">
35
+ <defs>
36
+ <path
37
+ d="M896,448 C1142.6325445712241,465.5747656464056 695.2579309733121,896 448,896 C200.74206902668806,896 5.684341886080802e-14,695.2579309733121 0,448.0000000000001 C0,200.74206902668806 200.74206902668791,5.684341886080802e-14 447.99999999999994,0 C695.2579309733121,0 475,418 896,448Z"
38
+ fillRule="evenodd"
39
+ id="path-2"
40
+ opacity="1"
41
+ />
42
+ <linearGradient id="linearGradient-3" x1="0.5" x2="0.5" y1="0" y2="1">
43
+ <stop offset="0" stopColor={lightColor} stopOpacity="1" />
44
+ <stop offset="1" stopColor={darkColor} stopOpacity="1" />
45
+ </linearGradient>
46
+ </defs>
47
+ <g opacity="1">
48
+ <use fill="url(#linearGradient-3)" fillOpacity="1" xlinkHref="#path-2" />
49
+ </g>
50
+ </svg>
51
+ </div>
52
+ </div>
53
+ );
54
+ };
55
+
56
+ export default WaveBg;
@@ -0,0 +1,11 @@
1
+ export { default as BetterScroll } from './BetterScroll';
2
+ export { default as DarkModeContainer } from './DarkModeContainer';
3
+ export { default as FlipText } from './FlipText';
4
+ export { default as I18nLabel } from './I18nLabel';
5
+ export { default as LazyAnimate } from './LazyAnimate';
6
+ export { default as LookForward } from './LookForward';
7
+ export { default as NumberTicker } from './NumberTicker';
8
+ export { default as Portal } from './Portal';
9
+ export { default as SvgIcon } from './SvgIcon';
10
+ export { TypingAnimation } from './TypingAnimation';
11
+ export { default as WaveBg } from './WaveBg';
@@ -0,0 +1,2 @@
1
+ export * from './components';
2
+ export * from './table';
@@ -0,0 +1,239 @@
1
+ import type { DragEndEvent } from '@dnd-kit/core';
2
+ import { DndContext, PointerSensor, useSensor, useSensors } from '@dnd-kit/core';
3
+ import { SortableContext, arrayMove, useSortable, verticalListSortingStrategy } from '@dnd-kit/sortable';
4
+ import { CSS } from '@dnd-kit/utilities';
5
+ import { Button, Checkbox, Divider, Tooltip } from 'antd';
6
+ import type { CSSProperties, ReactNode } from 'react';
7
+ import { useTranslation } from 'react-i18next';
8
+
9
+ import { SvgIcon } from '../components';
10
+
11
+ import type { TableColumnCheck, TableColumnFixed } from './types';
12
+
13
+ interface DragContentProps {
14
+ /** 可配置显隐、排序和固定位置的表格列。 */
15
+ columns: TableColumnCheck[];
16
+ /** 更新列设置后的回调。 */
17
+ setColumnChecks: (checks: TableColumnCheck[]) => void;
18
+ }
19
+
20
+ interface SortableItemProps {
21
+ /** 当前列配置项。 */
22
+ item: TableColumnCheck;
23
+ /** 切换列固定位置时触发。 */
24
+ onFixedChange: (item: TableColumnCheck) => void;
25
+ /** 切换列显示状态时触发。 */
26
+ onVisibleChange: (item: TableColumnCheck, checked: boolean) => void;
27
+ }
28
+
29
+ const FIXED_OPTIONS: TableColumnFixed[] = ['left', 'right', 'unFixed'];
30
+
31
+ const fixedTooltipRecord: Record<TableColumnFixed, string> = {
32
+ left: 'datatable.fixed.right',
33
+ right: 'datatable.fixed.unFixed',
34
+ unFixed: 'datatable.fixed.left'
35
+ };
36
+
37
+ /** 单个可拖拽列项组件。 */
38
+ const SortableItem = (props: SortableItemProps) => {
39
+ const { item, onFixedChange, onVisibleChange } = props;
40
+
41
+ const { t } = useTranslation();
42
+ const { attributes, isDragging, listeners, setNodeRef, transform, transition } = useSortable({
43
+ id: item.key
44
+ });
45
+
46
+ const style: CSSProperties = {
47
+ opacity: isDragging ? 0.6 : 1,
48
+ transform: CSS.Transform.toString(transform),
49
+ transition
50
+ };
51
+
52
+ function handleCheckChange(event: { target: { checked: boolean } }) {
53
+ onVisibleChange(item, event.target.checked);
54
+ }
55
+
56
+ function handleFixedClick() {
57
+ onFixedChange(item);
58
+ }
59
+
60
+ return (
61
+ <div
62
+ className="h-36px flex items-center justify-between gap-6px rd-4px px-6px transition-colors hover:bg-primary hover:bg-opacity-10"
63
+ ref={setNodeRef}
64
+ style={style}
65
+ {...attributes}
66
+ >
67
+ <div className="min-w-0 flex flex-1 items-center">
68
+ <span className="mr-8px h-full flex cursor-move items-center text-icon" {...listeners}>
69
+ <SvgIcon icon="mdi:drag" />
70
+ </span>
71
+ <Checkbox checked={item.checked} className="min-w-0 flex-1" onChange={handleCheckChange}>
72
+ <span className="block truncate">{renderColumnTitle(item.title, item.key)}</span>
73
+ </Checkbox>
74
+ </div>
75
+ <Tooltip title={t(fixedTooltipRecord[item.fixed])}>
76
+ <Button
77
+ disabled={!item.checked}
78
+ icon={renderFixedIcon(item.fixed)}
79
+ size="small"
80
+ tabIndex={-1}
81
+ type="text"
82
+ onClick={handleFixedClick}
83
+ />
84
+ </Tooltip>
85
+ </div>
86
+ );
87
+ };
88
+
89
+ /** 列设置拖拽内容组件。 */
90
+ const DragContent = (props: DragContentProps) => {
91
+ const { columns, setColumnChecks } = props;
92
+
93
+ const { t } = useTranslation();
94
+ const sensors = useSensors(
95
+ useSensor(PointerSensor, {
96
+ activationConstraint: {
97
+ distance: 8
98
+ }
99
+ })
100
+ );
101
+
102
+ const visibleColumns = columns.filter(item => item.visible);
103
+ const visibleStats = getVisibleStats(columns);
104
+ const selectAllChecked = visibleStats.total > 0 && visibleStats.checked === visibleStats.total;
105
+ const selectAllIndeterminate = visibleStats.checked > 0 && visibleStats.checked < visibleStats.total;
106
+
107
+ function handleSelectAll(event: { target: { checked: boolean } }) {
108
+ const nextColumns = columns.map(item => {
109
+ if (!item.visible) return item;
110
+
111
+ return {
112
+ ...item,
113
+ checked: event.target.checked
114
+ };
115
+ });
116
+
117
+ setColumnChecks(nextColumns);
118
+ }
119
+
120
+ function handleVisibleChange(target: TableColumnCheck, checked: boolean) {
121
+ const nextColumns = columns.map(item => {
122
+ if (item.key !== target.key) return item;
123
+
124
+ return {
125
+ ...item,
126
+ checked
127
+ };
128
+ });
129
+
130
+ setColumnChecks(nextColumns);
131
+ }
132
+
133
+ function handleFixedChange(target: TableColumnCheck) {
134
+ const nextFixed = getNextFixed(target.fixed);
135
+ const nextColumns = columns.map(item => {
136
+ if (item.key !== target.key) return item;
137
+
138
+ return {
139
+ ...item,
140
+ fixed: nextFixed
141
+ };
142
+ });
143
+
144
+ setColumnChecks(nextColumns);
145
+ }
146
+
147
+ function handleDragEnd(event: DragEndEvent) {
148
+ const { active, over } = event;
149
+
150
+ if (!over || active.id === over.id) return;
151
+
152
+ const oldIndex = columns.findIndex(item => item.key === active.id);
153
+ const newIndex = columns.findIndex(item => item.key === over.id);
154
+
155
+ if (oldIndex === -1 || newIndex === -1) return;
156
+
157
+ setColumnChecks(arrayMove(columns, oldIndex, newIndex));
158
+ }
159
+
160
+ return (
161
+ <div className="w-220px">
162
+ <div className="h-36px flex items-center rd-4px px-26px transition-colors hover:bg-primary hover:bg-opacity-10">
163
+ <Checkbox
164
+ checked={selectAllChecked}
165
+ className="flex-1"
166
+ disabled={visibleStats.total === 0}
167
+ indeterminate={selectAllIndeterminate}
168
+ onChange={handleSelectAll}
169
+ >
170
+ {t('common.selectAll')}
171
+ </Checkbox>
172
+ </div>
173
+ <Divider className="!my-4px" />
174
+ <div className="max-h-240px overflow-y-auto">
175
+ <DndContext sensors={sensors} onDragEnd={handleDragEnd}>
176
+ <SortableContext items={visibleColumns.map(item => item.key)} strategy={verticalListSortingStrategy}>
177
+ {visibleColumns.map(item => (
178
+ <SortableItem
179
+ item={item}
180
+ key={item.key}
181
+ onFixedChange={handleFixedChange}
182
+ onVisibleChange={handleVisibleChange}
183
+ />
184
+ ))}
185
+ </SortableContext>
186
+ </DndContext>
187
+ </div>
188
+ </div>
189
+ );
190
+ };
191
+
192
+ export default DragContent;
193
+
194
+ function getVisibleStats(columns: TableColumnCheck[]) {
195
+ let total = 0;
196
+ let checked = 0;
197
+
198
+ columns.forEach(item => {
199
+ if (!item.visible) return;
200
+
201
+ total += 1;
202
+
203
+ if (item.checked) {
204
+ checked += 1;
205
+ }
206
+ });
207
+
208
+ return { checked, total };
209
+ }
210
+
211
+ function getNextFixed(fixed: TableColumnFixed) {
212
+ const index = FIXED_OPTIONS.findIndex(item => item === fixed);
213
+
214
+ if (index === -1 || index === FIXED_OPTIONS.length - 1) {
215
+ return FIXED_OPTIONS[0];
216
+ }
217
+
218
+ return FIXED_OPTIONS[index + 1];
219
+ }
220
+
221
+ function renderColumnTitle(title: TableColumnCheck['title'], fallback: string): ReactNode {
222
+ if (typeof title === 'function') {
223
+ return fallback;
224
+ }
225
+
226
+ return title ?? fallback;
227
+ }
228
+
229
+ function renderFixedIcon(fixed: TableColumnFixed) {
230
+ if (fixed === 'left') {
231
+ return <SvgIcon className="rotate-270" icon="octicon:pin-16" />;
232
+ }
233
+
234
+ if (fixed === 'right') {
235
+ return <SvgIcon icon="octicon:pin-slash-16" />;
236
+ }
237
+
238
+ return <SvgIcon icon="octicon:pin-16" />;
239
+ }
@@ -0,0 +1,210 @@
1
+ import { Button, Popconfirm, Popover, Space, Upload } from 'antd';
2
+ import type { SpaceProps } from 'antd';
3
+ import classNames from 'clsx';
4
+ import type { ReactNode } from 'react';
5
+ import { useTranslation } from 'react-i18next';
6
+
7
+ import { SvgIcon } from '../components';
8
+
9
+ import DragContent from './DragContent';
10
+ import type { TableColumnCheck } from './types';
11
+
12
+ interface TableHeaderOperationProps {
13
+ /** 添加按钮点击事件 */
14
+ add?: () => Promise<void> | void;
15
+ /** 添加按钮文案,默认使用 common.add */
16
+ addText?: string;
17
+ /** 批量删除按钮文案,默认使用 common.batchDelete */
18
+ batchDeleteText?: string;
19
+ /** 自定义操作按钮(会替换默认的添加和批量删除按钮) */
20
+ children?: ReactNode;
21
+ /** 表格列配置 */
22
+ columns: TableColumnCheck[];
23
+ /** 列设置按钮文案,默认使用 common.columnSetting */
24
+ columnSettingText?: string;
25
+ /** 是否禁用删除按钮 */
26
+ disabledDelete?: boolean;
27
+ /** 下载导入模板点击事件 */
28
+ downloadTemplate?: () => Promise<void> | void;
29
+ /** 导出按钮点击事件 */
30
+ exportData?: () => Promise<void> | void;
31
+ /** 导出按钮加载状态 */
32
+ exportLoading?: boolean;
33
+ /** 导出按钮文案 */
34
+ exportText?: string;
35
+ /** 导入文件选择事件 */
36
+ importData?: (file: File) => Promise<void> | void;
37
+ /** 导入按钮加载状态 */
38
+ importLoading?: boolean;
39
+ /** 导入按钮文案 */
40
+ importText?: string;
41
+ /** Space 组件的对齐方式 */
42
+ itemAlign?: SpaceProps['align'];
43
+ /** 加载状态(刷新按钮图标会旋转) */
44
+ loading?: boolean;
45
+ /** 批量删除按钮点击事件 */
46
+ onDelete?: () => Promise<void> | void;
47
+ /** 前缀内容(显示在最前面) */
48
+ prefix?: ReactNode;
49
+ /** 刷新按钮点击事件 */
50
+ refresh: () => Promise<void> | void;
51
+ /** 刷新按钮文案,默认使用 common.refresh */
52
+ refreshText?: string;
53
+ /** 更新列配置的回调 */
54
+ setColumnChecks: (checks: TableColumnCheck[]) => void;
55
+ /** 后缀内容(显示在最后面) */
56
+ suffix?: ReactNode;
57
+ /** 下载模板按钮加载状态 */
58
+ templateLoading?: boolean;
59
+ /** 下载模板按钮文案 */
60
+ templateText?: string;
61
+ }
62
+
63
+ /**
64
+ * 表格头部操作栏组件
65
+ *
66
+ * 提供常用的表格操作功能: - 添加按钮 - 批量删除按钮 - 刷新按钮 - 列设置(显示/隐藏、拖拽排序)
67
+ *
68
+ * @example
69
+ * ```tsx
70
+ * <TableHeaderOperation
71
+ * columns={columnChecks}
72
+ * setColumnChecks={setColumnChecks}
73
+ * add={handleAdd}
74
+ * onDelete={handleBatchDelete}
75
+ * disabledDelete={checkedRowKeys.length === 0}
76
+ * refresh={getData}
77
+ * loading={loading}
78
+ * />;
79
+ * ```
80
+ */
81
+ const TableHeaderOperation = (props: TableHeaderOperationProps) => {
82
+ const {
83
+ add,
84
+ addText,
85
+ batchDeleteText,
86
+ children,
87
+ columns,
88
+ columnSettingText,
89
+ disabledDelete = false,
90
+ downloadTemplate,
91
+ exportData,
92
+ exportLoading = false,
93
+ exportText = '导出数据',
94
+ importData,
95
+ importLoading = false,
96
+ importText = '导入数据',
97
+ itemAlign,
98
+ loading = false,
99
+ onDelete,
100
+ prefix,
101
+ refresh,
102
+ refreshText,
103
+ setColumnChecks,
104
+ suffix,
105
+ templateLoading = false,
106
+ templateText = '下载模板'
107
+ } = props;
108
+
109
+ const { t } = useTranslation();
110
+
111
+ return (
112
+ <Space wrap align={itemAlign} className="lt-sm:w-200px">
113
+ {prefix}
114
+
115
+ {children || (
116
+ <>
117
+ {add && (
118
+ <Button
119
+ ghost
120
+ icon={<SvgIcon className="text-icon" icon="ic:round-plus" />}
121
+ size="small"
122
+ type="primary"
123
+ onClick={add}
124
+ >
125
+ {addText ?? t('common.add')}
126
+ </Button>
127
+ )}
128
+
129
+ {onDelete && (
130
+ <Popconfirm title={t('common.confirmDelete')} onConfirm={onDelete}>
131
+ <Button
132
+ danger
133
+ ghost
134
+ disabled={disabledDelete}
135
+ icon={<SvgIcon className="text-icon" icon="ic:round-delete" />}
136
+ size="small"
137
+ >
138
+ {batchDeleteText ?? t('common.batchDelete')}
139
+ </Button>
140
+ </Popconfirm>
141
+ )}
142
+ </>
143
+ )}
144
+
145
+ {importData && (
146
+ <Upload
147
+ accept=".xlsx,.xls"
148
+ beforeUpload={file => {
149
+ Promise.resolve(importData(file)).catch(() => undefined);
150
+ return false;
151
+ }}
152
+ maxCount={1}
153
+ showUploadList={false}
154
+ >
155
+ <Button
156
+ disabled={importLoading} icon={<SvgIcon icon="mdi:upload" />} loading={importLoading} size="small">
157
+ {importText}
158
+ </Button>
159
+ </Upload>
160
+ )}
161
+
162
+ {exportData && (
163
+ <Button
164
+ icon={<SvgIcon icon="mdi:download" />} loading={exportLoading} size="small" onClick={exportData}>
165
+ {exportText}
166
+ </Button>
167
+ )}
168
+
169
+ {downloadTemplate && (
170
+ <Button
171
+ icon={<SvgIcon icon="mdi:file-download-outline" />}
172
+ loading={templateLoading}
173
+ size="small"
174
+ onClick={downloadTemplate}
175
+ >
176
+ {templateText}
177
+ </Button>
178
+ )}
179
+
180
+ <Button
181
+ size="small"
182
+ icon={
183
+ <SvgIcon
184
+ className={classNames('text-icon', {
185
+ 'animate-spin': loading
186
+ })}
187
+ icon="mdi:refresh"
188
+ />
189
+ }
190
+ onClick={refresh}
191
+ >
192
+ {refreshText ?? t('common.refresh')}
193
+ </Button>
194
+
195
+ <Popover
196
+ placement="bottomRight"
197
+ trigger="click"
198
+ content={<DragContent columns={columns} setColumnChecks={setColumnChecks} />}
199
+ >
200
+ <Button icon={<SvgIcon icon="ant-design:setting-outlined" />} size="small">
201
+ {columnSettingText ?? t('common.columnSetting')}
202
+ </Button>
203
+ </Popover>
204
+
205
+ {suffix}
206
+ </Space>
207
+ );
208
+ };
209
+
210
+ export default TableHeaderOperation;