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.

253 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_HIDE_HOME: string;
  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. TooltipEffect?: Effect;
  94. ResponsiveStorageNameSpace?: string;
  95. }
  96. /**
  97. * `ServerConfigs`
  98. * @see {@link https://yiming_chang.gitee.io/pure-admin-doc/pages/config/#serverconfig-json}
  99. */
  100. interface StorageConfigs {
  101. version?: string;
  102. title?: string;
  103. fixedHeader?: boolean;
  104. hiddenSideBar?: boolean;
  105. multiTagsCache?: boolean;
  106. keepAlive?: boolean;
  107. locale?: string;
  108. layout?: string;
  109. theme?: string;
  110. darkMode?: boolean;
  111. grey?: boolean;
  112. weak?: boolean;
  113. hideTabs?: boolean;
  114. sidebarStatus?: boolean;
  115. epThemeColor?: string;
  116. showLogo?: boolean;
  117. showModel?: string;
  118. username?: string;
  119. }
  120. /**
  121. * `responsive-storage` `storage`
  122. */
  123. interface ResponsiveStorage {
  124. locale: {
  125. locale?: string;
  126. };
  127. layout: {
  128. layout?: string;
  129. theme?: string;
  130. darkMode?: boolean;
  131. sidebarStatus?: boolean;
  132. epThemeColor?: string;
  133. };
  134. configure: {
  135. grey?: boolean;
  136. weak?: boolean;
  137. hideTabs?: boolean;
  138. showLogo?: boolean;
  139. showModel?: string;
  140. multiTagsCache?: boolean;
  141. };
  142. tags?: Array<any>;
  143. }
  144. /**
  145. * `src/router`
  146. */
  147. interface toRouteType extends RouteLocationNormalized {
  148. meta: {
  149. roles: Array<string>;
  150. keepAlive?: boolean;
  151. dynamicLevel?: string;
  152. };
  153. }
  154. /**
  155. * @description
  156. */
  157. interface RouteChildrenConfigsTable {
  158. /** 子路由地址 `必填` */
  159. path: string;
  160. /** 路由名字(对应不要重复,和当前组件的`name`保持一致)`必填` */
  161. name?: string;
  162. /** 路由重定向 `可选` */
  163. redirect?: string;
  164. /** 按需加载组件 `可选` */
  165. component?: RouteComponent;
  166. meta?: {
  167. /** 菜单名称(兼容国际化、非国际化,如何用国际化的写法就必须在根目录的`locales`文件夹下对应添加) `必填` */
  168. title: string;
  169. /** 菜单图标 `可选` */
  170. icon?: string | FunctionalComponent | IconifyIcon;
  171. /** 菜单名称右侧的额外图标 */
  172. extraIcon?: string | FunctionalComponent | IconifyIcon;
  173. /** 是否在菜单中显示(默认`true`)`可选` */
  174. showLink?: boolean;
  175. /** 是否显示父级菜单 `可选` */
  176. showParent?: boolean;
  177. /** 页面级别权限设置 `可选` */
  178. roles?: Array<string>;
  179. /** 按钮级别权限设置 `可选` */
  180. auths?: Array<string>;
  181. /** 路由组件缓存(开启 `true`、关闭 `false`)`可选` */
  182. keepAlive?: boolean;
  183. /** 内嵌的`iframe`链接 `可选` */
  184. frameSrc?: string;
  185. /** `iframe`页是否开启首次加载动画(默认`true`)`可选` */
  186. frameLoading?: boolean;
  187. /** 页面加载动画(有两种形式,一种直接采用vue内置的`transitions`动画,另一种是使用`animate.css`写进、离场动画)`可选` */
  188. transition?: {
  189. /**
  190. * @description
  191. * @see {@link https://next.router.vuejs.org/guide/advanced/transitions.html#transitions}
  192. * @see animate.css {@link https://animate.style}
  193. */
  194. name?: string;
  195. /** 进场动画 */
  196. enterTransition?: string;
  197. /** 离场动画 */
  198. leaveTransition?: string;
  199. };
  200. // 是否不添加信息到标签页,(默认`false`)
  201. hiddenTag?: boolean;
  202. /** 动态路由可打开的最大数量 `可选` */
  203. dynamicLevel?: number;
  204. };
  205. /** 子路由配置项 */
  206. children?: Array<RouteChildrenConfigsTable>;
  207. }
  208. /**
  209. * @description
  210. */
  211. interface RouteConfigsTable {
  212. /** 路由地址 `必填` */
  213. path: string;
  214. /** 路由名字(保持唯一)`可选` */
  215. name?: string;
  216. /** `Layout`组件 `可选` */
  217. component?: RouteComponent;
  218. /** 路由重定向 `可选` */
  219. redirect?: string;
  220. meta?: {
  221. /** 菜单名称(兼容国际化、非国际化,如何用国际化的写法就必须在根目录的`locales`文件夹下对应添加)`必填` */
  222. title: string;
  223. /** 菜单图标 `可选` */
  224. icon?: string | FunctionalComponent | IconifyIcon;
  225. /** 是否在菜单中显示(默认`true`)`可选` */
  226. showLink?: boolean;
  227. /** 菜单升序排序,值越高排的越后(只针对顶级路由)`可选` */
  228. rank?: number;
  229. };
  230. /** 子路由配置项 */
  231. children?: Array<RouteChildrenConfigsTable>;
  232. }
  233. /**
  234. * 访
  235. */
  236. interface GlobalPropertiesApi {
  237. $echarts: ECharts;
  238. $storage: ResponsiveStorage;
  239. $config: ServerConfigs;
  240. }
  241. }