interface.d.ts 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /**
  2. * Use of this source code is governed by an MIT-style license that can be
  3. * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
  4. */
  5. import { HierarchyBaseEdgeInfo, HierarchyBaseNodeInfo, HierarchyGraphDef, HierarchyGraphEdgeDef, HierarchyGraphNodeDef, HierarchyGraphNodeInfo, HierarchyGraphOption, LayoutConfig } from 'dagre-compound';
  6. import { NzSafeAny } from 'ng-zorro-antd/core/types';
  7. export declare enum NzGraphEdgeType {
  8. LINE = "line",
  9. CURVE = "curve"
  10. }
  11. export interface NzGraphDataDef extends HierarchyGraphDef {
  12. nodes: NzGraphNodeDef[];
  13. edges: NzGraphEdgeDef[];
  14. }
  15. export interface NzGraphNodeDef extends HierarchyGraphNodeDef {
  16. label?: string;
  17. }
  18. export interface NzGraphEdgeDef extends HierarchyGraphEdgeDef {
  19. label?: string;
  20. }
  21. export interface NzGraphOption extends HierarchyGraphOption {
  22. }
  23. export declare type NzRankDirection = 'TB' | 'BT' | 'LR' | 'RL';
  24. export interface NzGraphGroupNode extends HierarchyGraphNodeInfo {
  25. nodes: Array<NzGraphNode | NzGraphGroupNode>;
  26. edges: NzGraphEdge[];
  27. [key: string]: NzSafeAny;
  28. }
  29. export interface NzGraphNode extends HierarchyBaseNodeInfo {
  30. id: NzSafeAny;
  31. name: NzSafeAny;
  32. label?: string;
  33. [key: string]: NzSafeAny;
  34. }
  35. export interface NzGraphEdge extends HierarchyBaseEdgeInfo {
  36. id: NzSafeAny;
  37. v: NzSafeAny;
  38. w: NzSafeAny;
  39. label?: string;
  40. }
  41. export interface NzLayoutSetting extends LayoutConfig {
  42. }
  43. export interface NzGraphBaseLayout {
  44. layout: {
  45. nodeSep: number;
  46. rankSep: number;
  47. edgeSep: number;
  48. };
  49. subScene: {
  50. paddingTop: number;
  51. paddingBottom: number;
  52. paddingLeft: number;
  53. paddingRight: number;
  54. labelHeight: number;
  55. };
  56. defaultCompoundNode: {
  57. width: number;
  58. height: number;
  59. maxLabelWidth: number;
  60. };
  61. defaultNode: {
  62. width: number;
  63. height: number;
  64. labelOffset: number;
  65. maxLabelWidth: number;
  66. };
  67. defaultEdge: {
  68. type: NzGraphEdgeType | string;
  69. };
  70. }
  71. export declare function nzTypeDefinition<T>(): (item: unknown) => T;
  72. export type NzDeepPartial<T> = {
  73. [P in keyof T]?: T[P] extends Array<infer U> ? Array<NzDeepPartial<U>> : T[P] extends ReadonlyArray<infer U> ? ReadonlyArray<NzDeepPartial<U>> : NzDeepPartial<T[P]>;
  74. };
  75. export type NzGraphLayoutConfig = NzDeepPartial<NzGraphBaseLayout>;
  76. export declare const NZ_GRAPH_LAYOUT_SETTING: NzLayoutSetting;
  77. export interface NzZoomTransform {
  78. x: number;
  79. y: number;
  80. k: number;
  81. }
  82. export interface RelativePositionInfo {
  83. topLeft: {
  84. x: number;
  85. y: number;
  86. };
  87. bottomRight: {
  88. x: number;
  89. y: number;
  90. };
  91. }