pure-admin-thin/types/global.d.ts
Truong Nguyen f0c4f1f39e update
2024-07-10 18:08:06 +07:00

191 lines
4.9 KiB
TypeScript

import type { ECharts } from "echarts";
import type { TableColumns } from "@pureadmin/table";
/**
* Khai báo toàn cầu, không cần nhập trực tiếp để sử dụng gợi ý kiểu trong các tệp `.vue`, `.ts`, `.tsx`
*/
declare global {
/**
* Thông tin ứng dụng như tên, phiên bản, yêu cầu phiên bản `node` và `pnpm`, các phụ thuộc,
* các phụ thuộc phát triển và thời gian xây dựng cuối cùng của nó.
*/
const __APP_INFO__: {
pkg: {
name: string;
version: string;
engines: {
node: string;
pnpm: string;
};
dependencies: Recordable<string>;
devDependencies: Recordable<string>;
};
lastBuildTime: string;
};
/**
* Kiểu gợi ý cho đối tượng Window
*/
interface Window {
// Thể hiện ứng dụng Vue toàn cục
__APP__: App<Element>;
webkitCancelAnimationFrame: (handle: number) => void;
mozCancelAnimationFrame: (handle: number) => void;
oCancelAnimationFrame: (handle: number) => void;
msCancelAnimationFrame: (handle: number) => void;
webkitRequestAnimationFrame: (callback: FrameRequestCallback) => number;
mozRequestAnimationFrame: (callback: FrameRequestCallback) => number;
oRequestAnimationFrame: (callback: FrameRequestCallback) => number;
msRequestAnimationFrame: (callback: FrameRequestCallback) => number;
}
/**
* Kiểu gợi ý cho đối tượng Document
*/
interface Document {
webkitFullscreenElement?: Element;
mozFullScreenElement?: Element;
msFullscreenElement?: Element;
}
/**
* Kiểu gợi ý cho các lựa chọn nén và đóng gói
*/
type ViteCompression =
| "none"
| "gzip"
| "brotli"
| "both"
| "gzip-clear"
| "brotli-clear"
| "both-clear";
/**
* Kiểu gợi ý cho các biến môi trường tùy chỉnh toàn cầu
*/
interface ViteEnv {
VITE_PORT: number;
VITE_PUBLIC_PATH: string;
VITE_ROUTER_HISTORY: string;
VITE_CDN: boolean;
VITE_HIDE_HOME: string;
VITE_COMPRESSION: ViteCompression;
}
/**
* Mảng kiểu gợi ý cho các cột trong bảng, mở rộng từ `@pureadmin/table`
*/
interface TableColumnList extends Array<TableColumns> {}
/**
* Kiểu dữ liệu tương ứng với tệp `public/platform-config.json`
*/
interface PlatformConfigs {
Version?: string;
Title?: string;
FixedHeader?: boolean;
HiddenSideBar?: boolean;
MultiTagsCache?: boolean;
MaxTagsLevel?: number;
KeepAlive?: boolean;
Locale?: string;
Layout?: string;
Theme?: string;
DarkMode?: boolean;
OverallStyle?: string;
Grey?: boolean;
Weak?: boolean;
HideTabs?: boolean;
HideFooter?: boolean;
Stretch?: boolean | number;
SidebarStatus?: boolean;
EpThemeColor?: string;
ShowLogo?: boolean;
ShowModel?: string;
MenuArrowIconNoTransition?: boolean;
CachingAsyncRoutes?: boolean;
TooltipEffect?: Effect;
ResponsiveStorageNameSpace?: string;
MenuSearchHistory?: number;
}
/**
* Kiểu dữ liệu lưu trữ trong bộ nhớ cục bộ, khác biệt so với `PlatformConfigs`
*/
interface StorageConfigs {
version?: string;
title?: string;
fixedHeader?: boolean;
hiddenSideBar?: boolean;
multiTagsCache?: boolean;
keepAlive?: boolean;
locale?: string;
layout?: string;
theme?: string;
darkMode?: boolean;
grey?: boolean;
weak?: boolean;
hideTabs?: boolean;
hideFooter?: boolean;
sidebarStatus?: boolean;
epThemeColor?: string;
themeColor?: string;
overallStyle?: string;
showLogo?: boolean;
showModel?: string;
menuSearchHistory?: number;
username?: string;
}
/**
* Đối tượng lưu trữ phản ứng cục bộ dựa trên `responsive-storage`
*/
interface ResponsiveStorage {
locale: {
locale?: string;
};
layout: {
layout?: string;
theme?: string;
darkMode?: boolean;
sidebarStatus?: boolean;
epThemeColor?: string;
themeColor?: string;
overallStyle?: string;
};
configure: {
grey?: boolean;
weak?: boolean;
hideTabs?: boolean;
hideFooter?: boolean;
showLogo?: boolean;
showModel?: string;
multiTagsCache?: boolean;
stretch?: boolean | number;
};
tags?: Array<any>;
}
/**
* Thuộc tính toàn cầu cho tất cả các thể hiện thành phần trong ứng dụng
*/
interface GlobalPropertiesApi {
$echarts: ECharts;
$storage: ResponsiveStorage;
$config: PlatformConfigs;
}
/**
* Mở rộng đối tượng Element để hỗ trợ v-ripple từ `src/directives/ripple/index.ts`
*/
interface Element {
_ripple?: {
enabled?: boolean;
centered?: boolean;
class?: string;
circle?: boolean;
touched?: boolean;
};
}
}