component.d.ts 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. import { Base } from '@antv/g-base';
  2. import { ILocation } from '../interfaces';
  3. import { BBox, ComponentCfg, LocationCfg, OffsetPoint } from '../types';
  4. declare abstract class Component<T extends ComponentCfg = ComponentCfg> extends Base implements ILocation {
  5. constructor(cfg: T);
  6. /**
  7. * @protected
  8. * 默认的配置项
  9. * @returns {object} 默认的配置项
  10. */
  11. getDefaultCfg(): {
  12. id: string;
  13. name: string;
  14. type: string;
  15. locationType: string;
  16. offsetX: number;
  17. offsetY: number;
  18. animate: boolean;
  19. capture: boolean;
  20. updateAutoRender: boolean;
  21. animateOption: {
  22. appear: any;
  23. update: {
  24. duration: number;
  25. easing: string;
  26. };
  27. enter: {
  28. duration: number;
  29. easing: string;
  30. };
  31. leave: {
  32. duration: number;
  33. easing: string;
  34. };
  35. };
  36. events: any;
  37. defaultCfg: {};
  38. visible: boolean;
  39. };
  40. /**
  41. * 清理组件的内容,一般配合 render 使用
  42. * @example
  43. * axis.clear();
  44. * axis.render();
  45. */
  46. clear(): void;
  47. /**
  48. * 更新组件
  49. * @param {object} cfg 更新属性
  50. */
  51. update(cfg: Partial<T>): void;
  52. protected updateInner(cfg: Partial<T>): void;
  53. protected afterUpdate(cfg: Partial<T>): void;
  54. abstract getBBox(): BBox;
  55. getLayoutBBox(): BBox;
  56. getLocationType(): any;
  57. getOffset(): OffsetPoint;
  58. setOffset(offsetX: number, offsetY: number): void;
  59. setLocation(cfg: LocationCfg): void;
  60. getLocation(): LocationCfg;
  61. isList(): boolean;
  62. isSlider(): boolean;
  63. /**
  64. * @protected
  65. * 初始化,用于具体的组件继承
  66. */
  67. init(): void;
  68. /**
  69. * 绘制组件
  70. */
  71. abstract render(): any;
  72. /**
  73. * 显示
  74. */
  75. abstract show(): any;
  76. abstract setCapture(capture: boolean): any;
  77. /**
  78. * 隐藏
  79. */
  80. abstract hide(): any;
  81. private initCfg;
  82. }
  83. export default Component;