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

7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
  1. import { IMenu } from '@/types/system/menus'
  2. import { QueryClient } from '@tanstack/react-query'
  3. import { Router } from '@tanstack/react-router'
  4. import { RouteOptions } from '@tanstack/react-router/src/route.ts'
  5. import { Attributes, ReactNode } from 'react'
  6. import { System } from '@/types'
  7. export type LayoutType = 'list' | 'form' | 'tree' | 'normal'
  8. export type IAppData = {
  9. name: string;
  10. version: string;
  11. language: string;
  12. baseUrl: string;
  13. token: string;
  14. device: string;
  15. currentUser: System.IUser
  16. }
  17. export type TRouter = {
  18. router: Router & {
  19. context: IRootContext
  20. }
  21. }
  22. export type IPage = {
  23. page?: number
  24. pageSize?: number
  25. }
  26. export type IPageResult<T = any> = IPage & {
  27. rows: T[]
  28. total: number
  29. }
  30. export type IApiResult<T = any> = {
  31. code: number;
  32. data: T;
  33. message: string;
  34. }
  35. export type TreeItem<T> = {
  36. children?: TreeItem<T>[];
  37. [key: keyof T]: T[keyof T];
  38. }
  39. export type FlattenData<T> = TreeItem<T> & {
  40. key: string,
  41. title?: string,
  42. label?: string,
  43. level?: number,
  44. [key: keyof T]: T[keyof T];
  45. }
  46. export type FiledNames = {
  47. key?: string;
  48. title?: string;
  49. children?: string
  50. }
  51. export type IDataProps<T = any> = {
  52. value?: T;
  53. onChange?: (value: T) => void;
  54. }
  55. export type Props = Attributes & {
  56. children?: ReactNode
  57. };
  58. export interface IRootContext {
  59. menuData: MenuItem[];
  60. queryClient: QueryClient;
  61. }
  62. interface MenuItem extends IMenu {
  63. routes?: MenuItem[];
  64. parent?: IMenu
  65. }
  66. interface IAuth {
  67. isLogin: boolean;
  68. authKey?: string[];
  69. }
  70. declare module '@tanstack/react-router' {
  71. interface Register {
  72. router: TRouter
  73. }
  74. interface AnyRoute {
  75. options: RouteOptions & {
  76. menu: MenuItem
  77. }
  78. }
  79. }