| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230 |
- declare module 'slash2';
- declare module '*.css';
- declare module '*.less';
- declare module '*.scss';
- declare module '*.sass';
- declare module '*.svg';
- declare module '*.png';
- declare module '*.jpg';
- declare module '*.jpeg';
- declare module '*.gif';
- declare module '*.bmp';
- declare module '*.webp';
- declare module '*.tiff';
- declare module 'omit.js';
- declare module 'numeral';
- declare module 'mockjs';
- declare module 'react-fittext';
- // CAP widget type declarations
- declare module '@cap.js/widget' {
- export interface CapWidgetElement extends HTMLElement {
- verify: () => Promise<{ token: string }>;
- reset: () => void;
- }
- }
- declare namespace JSX {
- interface IntrinsicElements {
- 'cap-widget': React.DetailedHTMLProps<
- React.HTMLAttributes<HTMLElement> & {
- id?: string;
- 'data-cap-api-endpoint'?: string;
- style?: React.CSSProperties;
- },
- HTMLElement
- >;
- }
- }
- declare const REACT_APP_ENV: 'test' | 'dev' | 'pre' | false;
- declare namespace NodeJS {
- interface ProcessEnv {
- /** 环境 */
- REACT_APP_ENV?: 'test' | 'dev' | 'pre' | 'prod' | false;
- /** 产品ID */
- REACT_APP_ID?: string;
- /** 产品名称 */
- REACT_APP_NAME?: string;
- /** 产品版本 */
- REACT_APP_VERSION?: string;
- /** 构建时间 */
- REACT_APP_BUILD_TIME?: number;
- /** 存储空间名称 */
- STORAGE_NAME_SPACE?: string;
- /** 是否启用请求加密 */
- ENABLE_REQUEST_ENCRYPTION?: boolean;
- /** 请求加密密钥 */
- REQUEST_ENCRYPTION_KEY?: string;
- /** 是否启用存储加密 */
- ENABLE_STORAGE_ENCRYPTION?: boolean;
- /** 存储加密密钥 */
- STORAGE_ENCRYPTION_KEY?: string;
- /** 管理后台登录密钥(对应服务端 Auth.ManagementKey,由前端透明传递,不在表单中展示) */
- REACT_APP_MANAGEMENT_KEY?: string;
- /** 请求数据压缩方式(nozip / br / gzip),默认 nozip */
- REQUEST_DATA_COMPRESSION?: string;
- /** 接口服务器地址,开发环境下通常与 proxy 配置配合,将请求代理到 REACT_APP_REAL_API_URL 指定的服务器。生产环境下若 接口服务器 与 web服务器 的地址不同,需配置为完整地址 */
- REACT_APP_API_URL?: string;
- }
- interface DevProcessEnv extends ProcessEnv {
- /** 接口服务器的实际地址,不要在项目代码中引用,该配置仅在开发环境中才能被 本地代理服务器 成功引用 */
- REACT_APP_REAL_API_URL?: string;
- }
- }
- /**
- * 将 T 中的 K 字段设置为可选,其他字段保持不变
- * @example
- * type User = { id: number; name: string; email?: string };
- * type PartialName = PartialFields<User, 'name'>;
- * // { id: number; name?: string; email?: string }
- */
- type PartialFields<T, K extends keyof T> = Partial<Pick<T, K>> & Omit<T, K>;
- /**
- * 将 T 中除了 K 字段外的其他字段设置为可选,K字段保持不变
- * @example
- * type User = { id: number; name: string; email?: string };
- * type PartialExceptId = PartialExcept<User, 'id'>;
- * // { id: number; name?: string; email?: string }
- */
- type PartialExcept<T, K extends keyof T> = Partial<Omit<T, K>> & Pick<T, K>;
- /**
- * 将 T 中的 K 字段设置为必需,其他字段保持不变
- * @example
- * type User = { id: number; name?: string; email?: string };
- * type RequiredEmail = RequiredFields<User, 'email'>;
- * // { id: number; name?: string; email: string }
- */
- type RequiredFields<T, K extends keyof T> = Required<Pick<T, K>> & Omit<T, K>;
- /**
- * 将 T 中除了 K 字段外的其他字段设置为必须,K字段保持不变
- * @example
- * type User = { id?: number; name?: string; email?: string };
- * type RequiredExceptId = RequiredExcept<User, 'id'>;
- * // { id?: number; name: string; email: string }
- */
- type RequiredExcept<T, K extends keyof T> = Required<Omit<T, K>> & Pick<T, K>;
- /**
- * 将 T 中的 K 字段设置为必选,其他字段可选
- * @example
- * type User = { id?: number; name?: string; email?: string };
- * type RequiredEmail = RequiredKOptionalOthers<User, 'id'>;
- * // { id: number; name?: string; email?: string }
- */
- type RequiredKOptionalOthers<T, K extends keyof T> = Partial<Omit<T, K>> & Required<Pick<T, K>>;
- /**
- * 将 T 中的 K 字段设置为可选,其他字段必须
- * @example
- * type User = { id: number; name?: string; email: string };
- * type OptionalEmail = OptionalKRequiredOthers<User, 'email'>;
- * // { id: number; name: string; email?: string }
- */
- type OptionalKRequiredOthers<T, K extends keyof T> = Required<Omit<T, K>> & Partial<Pick<T, K>>;
- // type Primitive = string | number | boolean | bigint | symbol | undefined | null;
- // type Builtin = Primitive | ((...args: any[]) => any) | Date | Error | RegExp;
- // type IsArray<T> = T extends any[] ? true : false;
- // type IsObject<T> = T extends Builtin
- // ? false
- // : T extends ReadonlyArray<any>
- // ? false
- // : T extends object
- // ? true
- // : false;
- // type FormFieldPath<T> = T extends object
- // ? {
- // [K in keyof T]-?: K extends string
- // ? // 单层路径:字符串形式
- // | K
- // // 嵌套路径:如果是对象且不是数组
- // | (IsObject<T[K]> extends true
- // ? IsArray<T[K]> extends true
- // ? never // 不深入数组内部
- // : FormFieldPath<T[K]> extends infer SubPaths
- // ? SubPaths extends string
- // ? [K, SubPaths] // 二级嵌套
- // : SubPaths extends any[]
- // ? [K, ...SubPaths] // 多级嵌套
- // : never
- // : never
- // : never)
- // : never;
- // }[keyof T]
- // : never;
- type FormFieldPath<T = any> = T extends object ? string | string[] : never;
- type ErrorShowType = import('@/defines').ErrorShowType;
- type EditorFormMode = 'edit' | 'add' | 'copy';
- declare namespace API {
- type OPT<T = number | string> = { label: string; value: T; [key: string]: any };
- type MenuKey<T = number | string> = { label: string; key: T; [key: string]: any };
- type TabKey<T = number | string> = { tab: string; key: T; [key: string]: any };
- type Empty = Record<string, never>;
- interface Result<T = any> {
- success?: boolean;
- data?: T;
- errorCode?: number;
- errorMessage?: string;
- showType?: ErrorShowType;
- traceId?: string;
- host?: string;
- }
- type ResultEmpty = Result<Empty>;
- type SvrResultList<T = any> = Result<{
- total: number;
- list: T[];
- }>;
- interface ResultList<T = any> extends Result<T[]> {
- total: number;
- }
- interface AntdPageParams {
- current?: number;
- pageSize?: number;
- keyword?: string;
- [key: string]: any;
- }
- interface CommonListReq {
- ids?: number[];
- excludeIds?: number[];
- }
- type ReqList<T> = T & CommonListReq & AntdPageParams;
- interface SortBy {
- column: string;
- asc: boolean;
- }
- type SvrReqList<T> = T & {
- page: number;
- pageSize: number;
- sortBy?: string | SortBy | SortBy[];
- };
- interface ReqDelete<T extends number | string = number> {
- ids: T[];
- }
- interface NumberRange {
- min?: number;
- max?: number;
- }
- }
|