interface.ts 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. import { ComponentType, CSSProperties, MouseEvent, ReactNode } from 'react';
  2. import { Motion } from '../_base/base';
  3. export type TabType = 'line' | 'card' | 'button';
  4. export type TabSize = 'small' | 'medium' | 'large';
  5. export type TabPosition = 'top' | 'left';
  6. export interface PlainTab {
  7. disabled?: boolean;
  8. icon?: ReactNode;
  9. itemKey: string;
  10. tab?: ReactNode;
  11. closable?: boolean;
  12. }
  13. export interface TabsProps {
  14. activeKey?: string;
  15. children?: ReactNode | Array<ReactNode>;
  16. className?: string;
  17. collapsible?: boolean;
  18. contentStyle?: CSSProperties;
  19. defaultActiveKey?: string;
  20. keepDOM?: boolean;
  21. lazyRender?: boolean;
  22. onChange?: (activeKey: string) => void;
  23. onTabClick?: (activeKey: string, e: MouseEvent<Element>) => void;
  24. renderTabBar?: (tabBarProps: TabBarProps, defaultTabBar: ComponentType) => ReactNode;
  25. size?: TabSize;
  26. style?: CSSProperties;
  27. tabBarClassName?: string;
  28. tabBarExtraContent?: ReactNode;
  29. tabBarStyle?: CSSProperties;
  30. tabList?: PlainTab[];
  31. tabPaneMotion?: boolean;
  32. tabPosition?: TabPosition;
  33. type?: TabType;
  34. onTabClose?: (tabKey: string) => void;
  35. }
  36. export interface TabBarProps {
  37. activeKey?: string;
  38. className?: string;
  39. collapsible?: boolean;
  40. list?: Array<PlainTab>;
  41. onTabClick?: (activeKey: string, event: MouseEvent<Element>) => void;
  42. size?: TabSize;
  43. style?: CSSProperties;
  44. tabBarExtraContent?: ReactNode;
  45. tabPosition?: TabPosition;
  46. type?: TabType;
  47. dropdownClassName?: string;
  48. dropdownStyle?: CSSProperties;
  49. closable?: boolean;
  50. deleteTabItem?: (tabKey: string, event: MouseEvent<Element>) => void;
  51. }
  52. export interface TabPaneProps {
  53. className?: string;
  54. disabled?: boolean;
  55. icon?: ReactNode;
  56. itemKey?: string;
  57. style?: CSSProperties;
  58. tab?: ReactNode;
  59. closable?: boolean,
  60. }
  61. export interface TabPaneTransitionProps {
  62. [key: string]: any;
  63. children?: ((p: { transform?: string; opacity: number }) => ReactNode | undefined) | undefined;
  64. direction?: boolean;
  65. mode?: 'vertical' | 'horizontal';
  66. motion?: Motion;
  67. }
  68. export interface TabContextValue {
  69. activeKey?: string;
  70. lazyRender?: boolean;
  71. panes?: Array<PlainTab>;
  72. tabPaneMotion?: boolean;
  73. tabPosition?: TabPosition;
  74. }