global.d.ts 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. import type {
  2. ComponentRenderProxy,
  3. VNode,
  4. ComponentPublicInstance,
  5. FunctionalComponent,
  6. PropType as VuePropType
  7. } from "vue";
  8. import type { ECharts } from "echarts";
  9. import { type ResponsiveStorage } from "./index";
  10. import type { TableColumns } from "@pureadmin/table";
  11. // GlobalComponents for Volar
  12. declare module "vue" {
  13. export interface GlobalComponents {
  14. IconifyIconOffline: typeof import("../src/components/ReIcon")["IconifyIconOffline"];
  15. IconifyIconOnline: typeof import("../src/components/ReIcon")["IconifyIconOnline"];
  16. FontIcon: typeof import("../src/components/ReIcon")["FontIcon"];
  17. Auth: typeof import("../src/components/ReAuth")["Auth"];
  18. }
  19. }
  20. declare global {
  21. const __APP_INFO__: {
  22. pkg: {
  23. name: string;
  24. version: string;
  25. dependencies: Recordable<string>;
  26. devDependencies: Recordable<string>;
  27. };
  28. lastBuildTime: string;
  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. // vue
  43. type PropType<T> = VuePropType<T>;
  44. type Writable<T> = {
  45. -readonly [P in keyof T]: T[P];
  46. };
  47. type Nullable<T> = T | null;
  48. type NonNullable<T> = T extends null | undefined ? never : T;
  49. type Recordable<T = any> = Record<string, T>;
  50. type ReadonlyRecordable<T = any> = {
  51. readonly [key: string]: T;
  52. };
  53. type Indexable<T = any> = {
  54. [key: string]: T;
  55. };
  56. type DeepPartial<T> = {
  57. [P in keyof T]?: DeepPartial<T[P]>;
  58. };
  59. type TimeoutHandle = ReturnType<typeof setTimeout>;
  60. type IntervalHandle = ReturnType<typeof setInterval>;
  61. interface ChangeEvent extends Event {
  62. target: HTMLInputElement;
  63. }
  64. interface WheelEvent {
  65. path?: EventTarget[];
  66. }
  67. interface ImportMetaEnv extends ViteEnv {
  68. __: unknown;
  69. }
  70. type ViteCompression =
  71. | "none"
  72. | "gzip"
  73. | "brotli"
  74. | "both"
  75. | "gzip-clear"
  76. | "brotli-clear"
  77. | "both-clear";
  78. declare interface ViteEnv {
  79. VITE_PORT: number;
  80. VITE_PUBLIC_PATH: string;
  81. VITE_ROUTER_HISTORY: string;
  82. VITE_CDN: boolean;
  83. VITE_COMPRESSION: ViteCompression;
  84. }
  85. declare interface ServerConfigs {
  86. Version?: string;
  87. Title?: string;
  88. FixedHeader?: boolean;
  89. HiddenSideBar?: boolean;
  90. MultiTagsCache?: boolean;
  91. KeepAlive?: boolean;
  92. Locale?: string;
  93. Layout?: string;
  94. Theme?: string;
  95. DarkMode?: boolean;
  96. Grey?: boolean;
  97. Weak?: boolean;
  98. HideTabs?: boolean;
  99. SidebarStatus?: boolean;
  100. EpThemeColor?: string;
  101. ShowLogo?: boolean;
  102. ShowModel?: string;
  103. MenuArrowIconNoTransition?: boolean;
  104. MapConfigure?: {
  105. amapKey?: string;
  106. options: {
  107. resizeEnable?: boolean;
  108. center?: number[];
  109. zoom?: number;
  110. };
  111. };
  112. }
  113. declare interface GlobalPropertiesApi {
  114. $echarts: ECharts;
  115. $storage: ResponsiveStorage;
  116. $config: ServerConfigs;
  117. }
  118. // 继承 @pureadmin/table 的 TableColumns,方便全局直接调用
  119. declare interface TableColumnList extends Array<TableColumns> {}
  120. function parseInt(s: string | number, radix?: number): number;
  121. function parseFloat(string: string | number): number;
  122. namespace JSX {
  123. // tslint:disable no-empty-interface
  124. type Element = VNode;
  125. // tslint:disable no-empty-interface
  126. type ElementClass = ComponentRenderProxy;
  127. interface ElementAttributesProperty {
  128. $props: any;
  129. }
  130. interface IntrinsicElements {
  131. [elem: string]: any;
  132. }
  133. interface IntrinsicAttributes {
  134. [elem: string]: any;
  135. }
  136. }
  137. }