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.

251 lines
7.4 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. /** 菜单名称右侧的额外图标 */
  170. extraIcon?: string | FunctionalComponent | IconifyIcon;
  171. /** 是否在菜单中显示(默认`true`)`可选` */
  172. showLink?: boolean;
  173. /** 是否显示父级菜单 `可选` */
  174. showParent?: boolean;
  175. /** 页面级别权限设置 `可选` */
  176. roles?: Array<string>;
  177. /** 按钮级别权限设置 `可选` */
  178. auths?: Array<string>;
  179. /** 路由组件缓存(开启 `true`、关闭 `false`)`可选` */
  180. keepAlive?: boolean;
  181. /** 内嵌的`iframe`链接 `可选` */
  182. frameSrc?: string;
  183. /** `iframe`页是否开启首次加载动画(默认`true`)`可选` */
  184. frameLoading?: boolean;
  185. /** 页面加载动画(有两种形式,一种直接采用vue内置的`transitions`动画,另一种是使用`animate.css`写进、离场动画)`可选` */
  186. transition?: {
  187. /**
  188. * @description
  189. * @see {@link https://next.router.vuejs.org/guide/advanced/transitions.html#transitions}
  190. * @see animate.css {@link https://animate.style}
  191. */
  192. name?: string;
  193. /** 进场动画 */
  194. enterTransition?: string;
  195. /** 离场动画 */
  196. leaveTransition?: string;
  197. };
  198. // 是否不添加信息到标签页,(默认`false`)
  199. hiddenTag?: boolean;
  200. /** 动态路由可打开的最大数量 `可选` */
  201. dynamicLevel?: number;
  202. };
  203. /** 子路由配置项 */
  204. children?: Array<RouteChildrenConfigsTable>;
  205. }
  206. /**
  207. * @description
  208. */
  209. interface RouteConfigsTable {
  210. /** 路由地址 `必填` */
  211. path: string;
  212. /** 路由名字(保持唯一)`可选` */
  213. name?: string;
  214. /** `Layout`组件 `可选` */
  215. component?: RouteComponent;
  216. /** 路由重定向 `可选` */
  217. redirect?: string;
  218. meta?: {
  219. /** 菜单名称(兼容国际化、非国际化,如何用国际化的写法就必须在根目录的`locales`文件夹下对应添加)`必填` */
  220. title: string;
  221. /** 菜单图标 `可选` */
  222. icon?: string | FunctionalComponent | IconifyIcon;
  223. /** 是否在菜单中显示(默认`true`)`可选` */
  224. showLink?: boolean;
  225. /** 菜单升序排序,值越高排的越后(只针对顶级路由)`可选` */
  226. rank?: number;
  227. };
  228. /** 子路由配置项 */
  229. children?: Array<RouteChildrenConfigsTable>;
  230. }
  231. /**
  232. * 访
  233. */
  234. interface GlobalPropertiesApi {
  235. $echarts: ECharts;
  236. $storage: ResponsiveStorage;
  237. $config: ServerConfigs;
  238. }
  239. }