interaction.d.ts 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. import type { TooltipStyleProps } from '@antv/gui';
  2. import { BBox, InteractionComponent } from '../runtime';
  3. import { FisheyeCoordinate } from './coordinateTransform';
  4. import { TooltipItemValue } from './component';
  5. export type Interaction = ElementHighlightInteraction | ElementHighlightByColorInteraction | ElementHighlightByXInteraction | ElementSelectByColorInteraction | ElementSelectByXInteraction | ElementSelectInteraction | TooltipInteraction | FisheyeInteraction | ChartIndexInteraction | CustomInteraction | LegendFilterInteraction | LegendHighlightInteraction | BrushHighlightInteraction | BrushXHighlightInteraction | BrushYHighlightInteraction | BrushAxisHighlightInteraction | BrushFilterInteraction | BrushYFilterInteraction | BrushXFilterInteraction | SliderFilterInteraction | PoptipInteraction;
  6. export type InteractionTypes = 'elementHighlight' | 'elementHighlightByX' | 'elementHighlightByColor' | 'fisheye' | 'chartIndex' | 'elementSelect' | 'elementSelectByX' | 'elementSelectByColor' | 'fisheye' | 'tooltip' | 'legendFilter' | 'legendHighlight' | 'brushXHighlight' | 'brushYHighlight' | 'brushHighlight' | 'brushFilter' | 'brushXFilter' | 'brushYFilter' | 'sliderFilter' | 'poptip' | InteractionComponent;
  7. export type BrushHighlightInteraction = {
  8. type?: 'brushHighlight';
  9. brushKey?: string;
  10. reverse?: boolean;
  11. series?: boolean;
  12. facet?: boolean;
  13. } & Record<`${'mask'}${any}`, any>;
  14. export type BrushXHighlightInteraction = {
  15. type?: 'brushXHighlight';
  16. brushKey?: string;
  17. reverse?: boolean;
  18. series?: boolean;
  19. facet?: boolean;
  20. } & Record<`${'mask'}${any}`, any>;
  21. export type BrushYHighlightInteraction = {
  22. type?: 'brushYHighlight';
  23. brushKey?: string;
  24. reverse?: boolean;
  25. series?: boolean;
  26. facet?: boolean;
  27. } & Record<`${'mask'}${any}`, any>;
  28. export type BrushAxisHighlightInteraction = {
  29. type?: 'brushAxisHighlight';
  30. reverse?: boolean;
  31. brushKey?: string;
  32. } & Record<`${'mask'}${any}`, any>;
  33. export type BrushFilterInteraction = {
  34. type?: 'brushFilter';
  35. reverse?: boolean;
  36. } & Record<`${'mask'}${any}`, any>;
  37. export type BrushXFilterInteraction = {
  38. type?: 'brushXFilter';
  39. reverse?: boolean;
  40. } & Record<`${'mask'}${any}`, any>;
  41. export type BrushYFilterInteraction = {
  42. type?: 'brushYFilter';
  43. reverse?: boolean;
  44. } & Record<`${'mask'}${any}`, any>;
  45. export type ElementHighlightInteraction = {
  46. type?: 'elementHighlight';
  47. link?: boolean;
  48. background?: boolean;
  49. offset?: number;
  50. } & Record<`${'link' | 'background'}${any}`, any>;
  51. export type ElementSelectInteraction = {
  52. type?: 'elementSelect';
  53. single?: boolean;
  54. background?: boolean;
  55. offset?: number;
  56. } & Record<`${'link' | 'background'}${any}`, any>;
  57. export type ElementSelectByColorInteraction = {
  58. type?: 'elementSelectByColor';
  59. single?: boolean;
  60. offset?: number;
  61. background?: boolean;
  62. } & Record<`${'link' | 'background'}${any}`, any>;
  63. export type ElementSelectByXInteraction = {
  64. type?: 'elementSelectByX';
  65. single?: boolean;
  66. background?: boolean;
  67. offset?: number;
  68. } & Record<`${'link' | 'background'}${any}`, any>;
  69. export type ElementHighlightByXInteraction = {
  70. type?: 'elementHighlightByX';
  71. link?: boolean;
  72. background?: boolean;
  73. offset?: number;
  74. } & Record<`${'link' | 'background'}${any}`, any>;
  75. export type ElementHighlightByColorInteraction = {
  76. type?: 'elementHighlightByColor';
  77. color?: string;
  78. background?: boolean;
  79. link?: boolean;
  80. offset?: number;
  81. } & Record<`${'link' | 'background'}${any}`, any>;
  82. export type PoptipInteraction = {
  83. type?: 'poptip';
  84. offsetX?: number;
  85. offsetY?: number;
  86. } & Record<`tip${any}`, any>;
  87. export type LegendFilterInteraction = {
  88. type?: 'legendFilter';
  89. };
  90. export type LegendHighlightInteraction = {
  91. type?: 'legendHighlight';
  92. };
  93. export type ChartIndexInteraction = {
  94. type?: 'chartIndex';
  95. wait?: number;
  96. leading?: boolean;
  97. trailing?: boolean;
  98. } & Record<`${'rule' | 'label'}${any}`, any>;
  99. export type SliderFilterInteraction = {
  100. type?: 'sliderFilter';
  101. wait?: number;
  102. leading?: boolean;
  103. trailing?: boolean;
  104. };
  105. export type TooltipInteraction = {
  106. type?: 'tooltip';
  107. shared?: boolean;
  108. series?: boolean;
  109. facet?: boolean;
  110. body?: boolean;
  111. crosshairs?: boolean;
  112. groupName?: boolean;
  113. position?: TooltipStyleProps['position'];
  114. bounding?: BBox;
  115. mount?: string | HTMLElement;
  116. sort?: (d: TooltipItemValue) => any;
  117. filter?: (d: TooltipItemValue) => any;
  118. render?: (event: any, // @todo
  119. options: {
  120. title: 'string';
  121. items: TooltipItemValue[];
  122. }) => HTMLElement | string;
  123. style?: Record<`crosshairs${any}`, any>;
  124. };
  125. export type FisheyeInteraction = {
  126. type?: 'fisheye';
  127. wait?: number;
  128. leading?: boolean;
  129. trailing?: boolean;
  130. } & Omit<FisheyeCoordinate, 'type'>;
  131. export type CustomInteraction = {
  132. type?: InteractionComponent;
  133. [key: string]: any;
  134. };