You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

254 lines
7.5 KiB

  1. import type {
  2. VNode,
  3. FunctionalComponent,
  4. PropType as VuePropType,
  5. ComponentPublicInstance
  6. } from "vue";
  7. import type { ECharts } from "echarts";
  8. import type { IconifyIcon } from "@iconify/vue";
  9. import type { ResponsiveStorage } from "./index";
  10. import type { TableColumns } from "@pureadmin/table";
  11. import { type RouteComponent, type RouteLocationNormalized } from "vue-router";
  12. /**
  13. * `.vue` `.ts` `.tsx` 使
  14. */
  15. declare global {
  16. /**
  17. *
  18. */
  19. const __APP_INFO__: {
  20. pkg: {
  21. name: string;
  22. version: string;
  23. dependencies: Recordable<string>;
  24. devDependencies: Recordable<string>;
  25. };
  26. lastBuildTime: string;
  27. };
  28. /**
  29. * Window
  30. */
  31. interface Window {
  32. // Global vue app instance
  33. __APP__: App<Element>;
  34. webkitCancelAnimationFrame: (handle: number) => void;
  35. mozCancelAnimationFrame: (handle: number) => void;
  36. oCancelAnimationFrame: (handle: number) => void;
  37. msCancelAnimationFrame: (handle: number) => void;
  38. webkitRequestAnimationFrame: (callback: FrameRequestCallback) => number;
  39. mozRequestAnimationFrame: (callback: FrameRequestCallback) => number;
  40. oRequestAnimationFrame: (callback: FrameRequestCallback) => number;
  41. msRequestAnimationFrame: (callback: FrameRequestCallback) => number;
  42. }
  43. /**
  44. *
  45. */
  46. type ViteCompression =
  47. | "none"
  48. | "gzip"
  49. | "brotli"
  50. | "both"
  51. | "gzip-clear"
  52. | "brotli-clear"
  53. | "both-clear";
  54. /**
  55. *
  56. * @see {@link https://yiming_chang.gitee.io/pure-admin-doc/pages/config/#%E5%85%B7%E4%BD%93%E9%85%8D%E7%BD%AE}
  57. */
  58. interface ViteEnv {
  59. VITE_PORT: number;
  60. VITE_PUBLIC_PATH: string;
  61. VITE_ROUTER_HISTORY: string;
  62. VITE_CDN: boolean;
  63. VITE_COMPRESSION: ViteCompression;
  64. }
  65. /**
  66. * `@pureadmin/table` `TableColumns` 便
  67. */
  68. interface TableColumnList extends Array<TableColumns> {}
  69. /**
  70. * `public/serverConfig.json`
  71. * @see {@link https://yiming_chang.gitee.io/pure-admin-doc/pages/config/#serverconfig-json}
  72. */
  73. interface ServerConfigs {
  74. Version?: string;
  75. Title?: string;
  76. FixedHeader?: boolean;
  77. HiddenSideBar?: boolean;
  78. MultiTagsCache?: boolean;
  79. KeepAlive?: boolean;
  80. Locale?: string;
  81. Layout?: string;
  82. Theme?: string;
  83. DarkMode?: boolean;
  84. Grey?: boolean;
  85. Weak?: boolean;
  86. HideTabs?: boolean;
  87. SidebarStatus?: boolean;
  88. EpThemeColor?: string;
  89. ShowLogo?: boolean;
  90. ShowModel?: string;
  91. MenuArrowIconNoTransition?: boolean;
  92. CachingAsyncRoutes?: boolean;
  93. }
  94. /**
  95. * `ServerConfigs`
  96. * @see {@link https://yiming_chang.gitee.io/pure-admin-doc/pages/config/#serverconfig-json}
  97. */
  98. interface StorageConfigs {
  99. version?: string;
  100. title?: string;
  101. fixedHeader?: boolean;
  102. hiddenSideBar?: boolean;
  103. multiTagsCache?: boolean;
  104. keepAlive?: boolean;
  105. locale?: string;
  106. layout?: string;
  107. theme?: string;
  108. darkMode?: boolean;
  109. grey?: boolean;
  110. weak?: boolean;
  111. hideTabs?: boolean;
  112. sidebarStatus?: boolean;
  113. epThemeColor?: string;
  114. showLogo?: boolean;
  115. showModel?: string;
  116. username?: string;
  117. }
  118. /**
  119. * `responsive-storage` `storage`
  120. */
  121. interface ResponsiveStorage {
  122. locale: {
  123. locale?: string;
  124. };
  125. layout: {
  126. layout?: string;
  127. theme?: string;
  128. darkMode?: boolean;
  129. sidebarStatus?: boolean;
  130. epThemeColor?: string;
  131. };
  132. configure: {
  133. grey?: boolean;
  134. weak?: boolean;
  135. hideTabs?: boolean;
  136. showLogo?: boolean;
  137. showModel?: string;
  138. multiTagsCache?: boolean;
  139. };
  140. tags?: Array<any>;
  141. }
  142. /**
  143. * `src/router`
  144. */
  145. interface toRouteType extends RouteLocationNormalized {
  146. meta: {
  147. roles: Array<string>;
  148. keepAlive?: boolean;
  149. dynamicLevel?: string;
  150. };
  151. }
  152. /**
  153. * @description
  154. */
  155. interface RouteChildrenConfigsTable {
  156. /** 子路由地址 `必填` */
  157. path: string;
  158. /** 路由名字(对应不要重复,和当前组件的`name`保持一致)`必填` */
  159. name?: string;
  160. /** 路由重定向 `可选` */
  161. redirect?: string;
  162. /** 按需加载组件 `可选` */
  163. component?: RouteComponent;
  164. meta?: {
  165. /** 菜单名称(兼容国际化、非国际化,如何用国际化的写法就必须在根目录的`locales`文件夹下对应添加) `必填` */
  166. title: string;
  167. /** 菜单图标 `可选` */
  168. icon?: string | FunctionalComponent | IconifyIcon;
  169. /** 菜单名称右侧的额外图标,支持`fontawesome`、`iconfont`、`element-plus-icon` `可选` */
  170. extraIcon?: {
  171. svg?: boolean;
  172. name?: string;
  173. };
  174. /** 是否在菜单中显示(默认`true`)`可选` */
  175. showLink?: boolean;
  176. /** 是否显示父级菜单 `可选` */
  177. showParent?: boolean;
  178. /** 页面级别权限设置 `可选` */
  179. roles?: Array<string>;
  180. /** 按钮级别权限设置 `可选` */
  181. auths?: Array<string>;
  182. /** 路由组件缓存(开启 `true`、关闭 `false`)`可选` */
  183. keepAlive?: boolean;
  184. /** 内嵌的`iframe`链接 `可选` */
  185. frameSrc?: string;
  186. /** `iframe`页是否开启首次加载动画(默认`true`)`可选` */
  187. frameLoading?: boolean;
  188. /** 页面加载动画(有两种形式,一种直接采用vue内置的`transitions`动画,另一种是使用`animate.css`写进、离场动画)`可选` */
  189. transition?: {
  190. /**
  191. * @description
  192. * @see {@link https://next.router.vuejs.org/guide/advanced/transitions.html#transitions}
  193. * @see animate.css {@link https://animate.style}
  194. */
  195. name?: string;
  196. /** 进场动画 */
  197. enterTransition?: string;
  198. /** 离场动画 */
  199. leaveTransition?: string;
  200. };
  201. // 是否不添加信息到标签页,(默认`false`)
  202. hiddenTag?: boolean;
  203. /** 动态路由可打开的最大数量 `可选` */
  204. dynamicLevel?: number;
  205. };
  206. /** 子路由配置项 */
  207. children?: Array<RouteChildrenConfigsTable>;
  208. }
  209. /**
  210. * @description
  211. */
  212. interface RouteConfigsTable {
  213. /** 路由地址 `必填` */
  214. path: string;
  215. /** 路由名字(保持唯一)`可选` */
  216. name?: string;
  217. /** `Layout`组件 `可选` */
  218. component?: RouteComponent;
  219. /** 路由重定向 `可选` */
  220. redirect?: string;
  221. meta?: {
  222. /** 菜单名称(兼容国际化、非国际化,如何用国际化的写法就必须在根目录的`locales`文件夹下对应添加)`必填` */
  223. title: string;
  224. /** 菜单图标 `可选` */
  225. icon?: string | FunctionalComponent | IconifyIcon;
  226. /** 是否在菜单中显示(默认`true`)`可选` */
  227. showLink?: boolean;
  228. /** 菜单升序排序,值越高排的越后(只针对顶级路由)`可选` */
  229. rank?: number;
  230. };
  231. /** 子路由配置项 */
  232. children?: Array<RouteChildrenConfigsTable>;
  233. }
  234. /**
  235. * 访
  236. */
  237. interface GlobalPropertiesApi {
  238. $echarts: ECharts;
  239. $storage: ResponsiveStorage;
  240. $config: ServerConfigs;
  241. }
  242. }