import { IMenu } from '@/types/system/menus' import { QueryClient } from '@tanstack/react-query' import { Router } from '@tanstack/react-router' import { RouteOptions } from '@tanstack/react-router/src/route.ts' import { Attributes, ReactNode } from 'react' import { System } from '@/types' export type LayoutType = 'list' | 'form' | 'tree' | 'normal' export type IAppData = { name: string; version: string; language: string; baseUrl: string; token: string; device: string; currentUser: System.IUser } export type TRouter = { router: Router & { context: IRootContext } } export type IPage = { page?: number pageSize?: number } export type IPageResult = IPage & { rows: T[] total: number } export type IApiResult = { code: number; data: T; message: string; } export type TreeItem = { children?: TreeItem[]; [key: keyof T]: T[keyof T]; } export type FlattenData = TreeItem & { key: string, title?: string, label?: string, level?: number, [key: keyof T]: T[keyof T]; } export type FiledNames = { key?: string; title?: string; children?: string } export type IDataProps = { value?: T; onChange?: (value: T) => void; } export type Props = Attributes & { children?: ReactNode }; export interface IRootContext { menuData: MenuItem[]; queryClient: QueryClient; } interface MenuItem extends IMenu { routes?: MenuItem[]; parent?: IMenu } interface IAuth { isLogin: boolean; authKey?: string[]; } declare module '@tanstack/react-router' { interface Register { router: TRouter } interface AnyRoute { options: RouteOptions & { menu: MenuItem } } }