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 { TableColumns } from "@pureadmin/table";
  10. import { type RouteComponent, type RouteLocationNormalized } from "vue-router";
  11. /**
  12. * `.vue` `.ts` `.tsx` 使
  13. */
  14. declare global {
  15. /**
  16. *
  17. */
  18. const __APP_INFO__: {
  19. pkg: {
  20. name: string;
  21. version: string;
  22. dependencies: Recordable<string>;
  23. devDependencies: Recordable<string>;
  24. };
  25. lastBuildTime: string;
  26. };
  27. /**
  28. * Window
  29. */
  30. interface Window {
  31. // Global vue app instance
  32. __APP__: App<Element>;
  33. webkitCancelAnimationFrame: (handle: number) => void;
  34. mozCancelAnimationFrame: (handle: number) => void;
  35. oCancelAnimationFrame: (handle: number) => void;
  36. msCancelAnimationFrame: (handle: number) => void;
  37. webkitRequestAnimationFrame: (callback: FrameRequestCallback) => number;
  38. mozRequestAnimationFrame: (callback: FrameRequestCallback) => number;
  39. oRequestAnimationFrame: (callback: FrameRequestCallback) => number;
  40. msRequestAnimationFrame: (callback: FrameRequestCallback) => number;
  41. }
  42. /**
  43. *
  44. */
  45. type ViteCompression =
  46. | "none"
  47. | "gzip"
  48. | "brotli"
  49. | "both"
  50. | "gzip-clear"
  51. | "brotli-clear"
  52. | "both-clear";
  53. /**
  54. *
  55. * @see {@link https://yiming_chang.gitee.io/pure-admin-doc/pages/config/#%E5%85%B7%E4%BD%93%E9%85%8D%E7%BD%AE}
  56. */
  57. interface ViteEnv {
  58. VITE_PORT: number;
  59. VITE_PUBLIC_PATH: string;
  60. VITE_ROUTER_HISTORY: string;
  61. VITE_CDN: boolean;
  62. VITE_COMPRESSION: ViteCompression;
  63. }
  64. /**
  65. * `@pureadmin/table` `TableColumns` 便
  66. */
  67. interface TableColumnList extends Array<TableColumns> {}
  68. /**
  69. * `public/serverConfig.json`
  70. * @see {@link https://yiming_chang.gitee.io/pure-admin-doc/pages/config/#serverconfig-json}
  71. */
  72. interface ServerConfigs {
  73. Version?: string;
  74. Title?: string;
  75. FixedHeader?: boolean;
  76. HiddenSideBar?: boolean;
  77. MultiTagsCache?: boolean;
  78. KeepAlive?: boolean;
  79. Locale?: string;
  80. Layout?: string;
  81. Theme?: string;
  82. DarkMode?: boolean;
  83. Grey?: boolean;
  84. Weak?: boolean;
  85. HideTabs?: boolean;
  86. SidebarStatus?: boolean;
  87. EpThemeColor?: string;
  88. ShowLogo?: boolean;
  89. ShowModel?: string;
  90. MenuArrowIconNoTransition?: boolean;
  91. CachingAsyncRoutes?: boolean;
  92. TooltipEffect?: Effect;
  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. }