global.d.ts 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. import type { ComponentRenderProxy, VNode, VNodeChild, ComponentPublicInstance, FunctionalComponent, PropType as VuePropType } from 'vue';
  2. declare global {
  3. // [perf-base-v1] 卡1/卡7: public/js/config.js 注入的全局配置(经典脚本顶层 const,为全局词法绑定,不在 window 上)
  4. const VUE_APP_URL: {
  5. baseUrl: string; // 后台地址
  6. webRtcUrl: string; // rtsp 服务器地址前缀
  7. wsUrl: string; // WebSocket 地址
  8. onlyOfficeUrl?: string; // OnlyOffice Document Server 反向代理前缀
  9. };
  10. // [perf-base-v1] 卡1: OnlyOffice Documents API 全局(由 src/utils/onlyOffice.ts loadDocsApi 按需注入)
  11. const DocsAPI: {
  12. DocEditor: new (placeholderId: string, config?: Recordable<any>) => any;
  13. };
  14. const VENT_PARAM: {
  15. simulatedPassword: string;
  16. showReport: boolean;
  17. isoOpenSso: string;
  18. modalText: string;
  19. productionCrlPlatformUrl: string;
  20. safetyCrlPlatformUrl: string;
  21. gasControlMock: boolean;
  22. historyIsMultiple: boolean;
  23. is2DModel: boolean;
  24. };
  25. interface GlobalConfig {
  26. simulatedPassword: string;
  27. History_Type: string;
  28. pageType: string;
  29. showReport: boolean;
  30. is2DModel: boolean;
  31. }
  32. const __APP_INFO__: {
  33. pkg: {
  34. name: string;
  35. version: string;
  36. dependencies: Recordable<string>;
  37. devDependencies: Recordable<string>;
  38. };
  39. lastBuildTime: string;
  40. };
  41. // declare interface Window {
  42. // // Global vue app instance
  43. // __APP__: App<Element>;
  44. // }
  45. // vue
  46. declare type PropType<T> = VuePropType<T>;
  47. declare type VueNode = VNodeChild | JSX.Element;
  48. export type Writable<T> = {
  49. -readonly [P in keyof T]: T[P];
  50. };
  51. declare type Nullable<T> = T | null;
  52. declare type NonNullable<T> = T extends null | undefined ? never : T;
  53. declare type Recordable<T = any> = Record<string, T>;
  54. declare type ReadonlyRecordable<T = any> = {
  55. readonly [key: string]: T;
  56. };
  57. declare type Indexable<T = any> = {
  58. [key: string]: T;
  59. };
  60. declare type DeepPartial<T> = {
  61. [P in keyof T]?: DeepPartial<T[P]>;
  62. };
  63. declare type TimeoutHandle = ReturnType<typeof setTimeout>;
  64. declare type IntervalHandle = ReturnType<typeof setInterval>;
  65. declare interface ChangeEvent extends Event {
  66. target: HTMLInputElement;
  67. }
  68. declare interface WheelEvent {
  69. path?: EventTarget[];
  70. }
  71. interface ImportMetaEnv extends ViteEnv {
  72. __: unknown;
  73. }
  74. interface ImportMeta {
  75. readonly env: ImportMetaEnv;
  76. }
  77. declare interface ViteEnv {
  78. VITE_PORT: number;
  79. VITE_USE_MOCK: boolean;
  80. VITE_PUBLIC_PATH: string;
  81. VITE_PROXY: [string, string][];
  82. VITE_GLOB_APP_TITLE: string;
  83. VITE_GLOB_APP_SHORT_NAME: string;
  84. VITE_USE_CDN: boolean;
  85. VITE_BUILD_COMPRESS: 'gzip' | 'brotli' | 'none';
  86. VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE: boolean;
  87. VITE_GLOB_DOMAIN_URL: string;
  88. VITE_CACHE_CIPHER_KEY_CHAR_CODE: string;
  89. VITE_CACHE_CIPHER_IV_CHAR_CODE: string;
  90. VITE_LOGIN_CIPHER_KEY_CHAR_CODE: string;
  91. VITE_LOGIN_CIPHER_IV_CHAR_CODE: string;
  92. VITE_MOCK_LOGIN_USERNAME_CHAR_CODE: string;
  93. VITE_MOCK_LOGIN_PASSWORD_CHAR_CODE: string;
  94. VITE_SIGNATURE_SECRET_CHAR_CODE: string;
  95. PROD: boolean;
  96. }
  97. declare function parseInt(s: string | number, radix?: number): number;
  98. declare function parseFloat(string: string | number): number;
  99. namespace JSX {
  100. // tslint:disable no-empty-interface
  101. type Element = VNode;
  102. // tslint:disable no-empty-interface
  103. type ElementClass = ComponentRenderProxy;
  104. interface ElementAttributesProperty {
  105. $props: any;
  106. }
  107. interface IntrinsicElements {
  108. [elem: string]: any;
  109. }
  110. interface IntrinsicAttributes {
  111. [elem: string]: any;
  112. }
  113. }
  114. }
  115. declare module 'vue' {
  116. export type JSXComponent<Props = any> = { new (): ComponentPublicInstance<Props> } | FunctionalComponent<Props>;
  117. }