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.

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