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

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