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.
94 lines
1.5 KiB
94 lines
1.5 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'
|
|
|
|
export type LayoutType = 'list' | 'form' | 'tree' | 'normal'
|
|
|
|
export type IAppData = {
|
|
name: string;
|
|
version: string;
|
|
language: string;
|
|
baseUrl: string;
|
|
token: string;
|
|
device: string;
|
|
}
|
|
|
|
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> = {
|
|
[key: keyof T]: T[keyof T];
|
|
children?: TreeItem<T>[];
|
|
}
|
|
|
|
export type FlattenData<T> = TreeItem<T> & {
|
|
key: string,
|
|
title?: string,
|
|
label?: string,
|
|
level?: number,
|
|
}
|
|
|
|
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[];
|
|
}
|
|
|
|
interface IAuth {
|
|
isLogin: boolean;
|
|
authKey?: string[];
|
|
}
|
|
|
|
declare module '@tanstack/react-router' {
|
|
interface Register {
|
|
router: TRouter
|
|
}
|
|
|
|
interface AnyRoute {
|
|
options: RouteOptions & {
|
|
menu: MenuItem
|
|
}
|
|
}
|
|
|
|
}
|