component.d.ts 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. import { Primitive } from '../runtime';
  2. import { UsePrefix } from './utils';
  3. export type Component = TitleComponent | AxisComponent | LegendComponent | ScrollbarComponent | SliderComponent | TooltipComponent;
  4. export type TitleComponent = {
  5. /**
  6. * Height of title, default is 36.
  7. */
  8. size?: number;
  9. /**
  10. * Text of title.
  11. */
  12. title?: string;
  13. /**
  14. * Text of subtitle.
  15. */
  16. subtitle?: string | null;
  17. /**
  18. * Styles.
  19. */
  20. style?: UsePrefix<'title' | 'subtitle', Record<string, any>> & {
  21. /**
  22. * Align method for title.
  23. */
  24. align?: 'left' | 'center' | 'right';
  25. /**
  26. * The vertical spacing between title and subtitle, default is 2.
  27. */
  28. spacing?: number;
  29. };
  30. };
  31. export type AxisComponent = {
  32. tickCount?: number;
  33. labelFormatter?: any;
  34. tickFilter?: any;
  35. title?: any;
  36. state?: Partial<Record<'active' | 'selected' | 'inactive' | 'unselected', Record<string, any>>>;
  37. [key: string]: any;
  38. };
  39. export type LegendComponent = {
  40. tickCount?: number;
  41. labelFormatter?: any;
  42. tickFilter?: any;
  43. title?: any;
  44. position?: string;
  45. state?: Partial<Record<'active' | 'selected' | 'inactive' | 'unselected', Record<string, any>>>;
  46. [key: string]: any;
  47. };
  48. export type SliderComponent = any;
  49. export type ScrollbarComponent = any;
  50. export type TooltipComponent = TooltipItem | TooltipItem[] | {
  51. title?: Encodeable<TooltipTitle>;
  52. items?: TooltipItem[] | null | false;
  53. [key: string]: any;
  54. } | null | false;
  55. export type TooltipTitle = string | {
  56. field?: string;
  57. channel?: string;
  58. value?: string;
  59. };
  60. export type TooltipItem = string | {
  61. name?: string;
  62. color?: string;
  63. channel?: string;
  64. field?: string;
  65. value?: string;
  66. valueFormatter?: string | ((d: any) => string);
  67. } | Encodeable<Primitive> | Encodeable<TooltipItemValue>;
  68. export type TooltipItemValue = {
  69. name?: string;
  70. color?: string;
  71. value?: Primitive;
  72. };
  73. export type Encodeable<T> = T | ((d: any, index?: number, data?: any[], column?: any) => T);