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.

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