utils.d.ts 1.7 KB

123456789101112131415161718192021222324252627282930313233343536
  1. import { CustomElement, Group } from '@antv/g';
  2. import { Layout } from '@antv/gui';
  3. import { FlexLayout, GuideComponentComponent, GuideComponentOrientation, GuideComponentPosition, Scale } from '../runtime';
  4. import { G2Element, Selection } from '../utils/selection';
  5. type Descriptor<T> = {
  6. render?: (attributes: T, container: CustomElement<T>) => void;
  7. };
  8. export declare function createComponent<T>(descriptor: Descriptor<T>): any;
  9. export declare function maybeAppend<T>(parent: Group, selector: string, node: string | ((data: T, i: number) => G2Element)): Selection<T>;
  10. export declare function titleContent(field: string | string[]): string;
  11. export declare function inferComponentLayout(position: GuideComponentPosition, userDefinitions?: FlexLayout): {
  12. flexDirection: string;
  13. justifyContent: string;
  14. alignItems: string;
  15. display: string;
  16. };
  17. export declare class G2Layout extends Layout {
  18. get child(): any;
  19. update(options: any): void;
  20. }
  21. export declare class LegendCategoryLayout extends G2Layout {
  22. update(options: any): void;
  23. }
  24. export declare function scaleOf(scales: Scale[], type: string): Scale | undefined;
  25. export declare function isHorizontal(orientation: GuideComponentOrientation): boolean;
  26. export declare function isVertical(orientation: GuideComponentOrientation): boolean;
  27. export declare function inferComponentShape(value: Record<string, any>, options: Record<string, any>, component: GuideComponentComponent): {
  28. readonly orientation: "horizontal" | "vertical";
  29. readonly width: any;
  30. readonly height: any;
  31. readonly size: any;
  32. readonly length: any;
  33. };
  34. export declare function domainOf(scales: Scale[]): any[];
  35. export declare function adaptor<T>(style: T): any;
  36. export {};