You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

99 lines
1.7 KiB

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<T = any> = IPage & {
rows: T[]
total: number
}
export type IApiResult<T = any> = {
code: number;
data: T;
message: string;
}
export type TreeItem<T> = {
children?: TreeItem<T>[];
[key: keyof T]: T[keyof T];
}
export type FlattenData<T> = TreeItem<T> & {
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<T = any> = {
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
}
}
}