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.

104 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
3 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 IError = {
  36. code: number;
  37. message: string;
  38. }
  39. export type TreeItem<T> = {
  40. children?: TreeItem<T>[];
  41. [key: keyof T]: T[keyof T];
  42. }
  43. export type FlattenData<T> = TreeItem<T> & {
  44. key: string,
  45. title?: string,
  46. label?: string,
  47. level?: number,
  48. [key: keyof T]: T[keyof T];
  49. }
  50. export type FiledNames = {
  51. key?: string;
  52. title?: string;
  53. children?: string
  54. }
  55. export type IDataProps<T = any> = {
  56. value?: T;
  57. onChange?: (value: T) => void;
  58. }
  59. export type Props = Attributes & {
  60. children?: ReactNode
  61. };
  62. export interface IRootContext {
  63. menuData: MenuItem[];
  64. queryClient: QueryClient;
  65. }
  66. interface MenuItem extends IMenu {
  67. routes?: MenuItem[];
  68. parent?: IMenu
  69. }
  70. interface IAuth {
  71. isLogin: boolean;
  72. authKey?: string[];
  73. }
  74. declare module '@tanstack/react-router' {
  75. interface Register {
  76. router: TRouter
  77. }
  78. interface AnyRoute {
  79. options: RouteOptions & {
  80. menu: MenuItem
  81. }
  82. }
  83. }