@antv/g6 5.0.33 → 5.0.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/dist/g6.min.js +3 -3
  2. package/dist/lib/behaviors/optimize-viewport-transform.d.ts +1 -1
  3. package/dist/lib/elements/edges/base-edge.d.ts +5 -5
  4. package/dist/lib/elements/nodes/base-node.d.ts +2 -0
  5. package/dist/lib/elements/shapes/base-shape.d.ts +2 -2
  6. package/dist/lib/exports.d.ts +2 -2
  7. package/dist/lib/layouts/fishbone.d.ts +2 -1
  8. package/dist/lib/layouts/index.d.ts +2 -0
  9. package/dist/lib/layouts/snake.d.ts +80 -0
  10. package/dist/lib/layouts/types.d.ts +3 -1
  11. package/dist/lib/plugins/minimap/index.d.ts +1 -1
  12. package/dist/lib/plugins/tooltip.d.ts +6 -0
  13. package/dist/lib/spec/canvas.d.ts +26 -2
  14. package/dist/lib/spec/graph.d.ts +60 -12
  15. package/dist/lib/spec/viewport.d.ts +4 -0
  16. package/dist/lib/utils/cache.d.ts +5 -5
  17. package/dist/lib/utils/style.d.ts +5 -5
  18. package/dist/lib/version.d.ts +1 -1
  19. package/esm/behaviors/optimize-viewport-transform.d.ts +1 -1
  20. package/esm/elements/edges/base-edge.d.ts +5 -5
  21. package/esm/elements/nodes/base-node.d.ts +2 -0
  22. package/esm/elements/nodes/base-node.js +2 -2
  23. package/esm/elements/nodes/base-node.js.map +1 -1
  24. package/esm/elements/shapes/base-shape.d.ts +2 -2
  25. package/esm/elements/shapes/base-shape.js +2 -2
  26. package/esm/exports.d.ts +2 -2
  27. package/esm/exports.js +1 -1
  28. package/esm/exports.js.map +1 -1
  29. package/esm/layouts/fishbone.d.ts +2 -1
  30. package/esm/layouts/fishbone.js +1 -1
  31. package/esm/layouts/fishbone.js.map +1 -1
  32. package/esm/layouts/index.d.ts +2 -0
  33. package/esm/layouts/index.js +1 -0
  34. package/esm/layouts/index.js.map +1 -1
  35. package/esm/layouts/snake.d.ts +80 -0
  36. package/esm/layouts/snake.js +162 -0
  37. package/esm/layouts/snake.js.map +1 -0
  38. package/esm/layouts/types.d.ts +3 -1
  39. package/esm/plugins/minimap/index.d.ts +1 -1
  40. package/esm/plugins/tooltip.d.ts +6 -0
  41. package/esm/plugins/tooltip.js +8 -6
  42. package/esm/plugins/tooltip.js.map +1 -1
  43. package/esm/registry/build-in.js +2 -1
  44. package/esm/registry/build-in.js.map +1 -1
  45. package/esm/spec/canvas.d.ts +26 -2
  46. package/esm/spec/graph.d.ts +60 -12
  47. package/esm/spec/viewport.d.ts +4 -0
  48. package/esm/utils/cache.d.ts +5 -5
  49. package/esm/utils/cache.js +5 -5
  50. package/esm/utils/style.d.ts +5 -5
  51. package/esm/utils/style.js +5 -5
  52. package/esm/version.d.ts +1 -1
  53. package/esm/version.js +1 -1
  54. package/lib/behaviors/optimize-viewport-transform.d.ts +1 -1
  55. package/lib/elements/edges/base-edge.d.ts +5 -5
  56. package/lib/elements/nodes/base-node.d.ts +2 -0
  57. package/lib/elements/nodes/base-node.js +2 -2
  58. package/lib/elements/nodes/base-node.js.map +1 -1
  59. package/lib/elements/shapes/base-shape.d.ts +2 -2
  60. package/lib/elements/shapes/base-shape.js +2 -2
  61. package/lib/exports.d.ts +2 -2
  62. package/lib/exports.js +3 -2
  63. package/lib/exports.js.map +1 -1
  64. package/lib/layouts/fishbone.d.ts +2 -1
  65. package/lib/layouts/fishbone.js +2 -2
  66. package/lib/layouts/fishbone.js.map +1 -1
  67. package/lib/layouts/index.d.ts +2 -0
  68. package/lib/layouts/index.js +3 -1
  69. package/lib/layouts/index.js.map +1 -1
  70. package/lib/layouts/snake.d.ts +80 -0
  71. package/lib/layouts/snake.js +166 -0
  72. package/lib/layouts/snake.js.map +1 -0
  73. package/lib/layouts/types.d.ts +3 -1
  74. package/lib/plugins/minimap/index.d.ts +1 -1
  75. package/lib/plugins/tooltip.d.ts +6 -0
  76. package/lib/plugins/tooltip.js +8 -6
  77. package/lib/plugins/tooltip.js.map +1 -1
  78. package/lib/registry/build-in.js +1 -0
  79. package/lib/registry/build-in.js.map +1 -1
  80. package/lib/spec/canvas.d.ts +26 -2
  81. package/lib/spec/graph.d.ts +60 -12
  82. package/lib/spec/viewport.d.ts +4 -0
  83. package/lib/utils/cache.d.ts +5 -5
  84. package/lib/utils/cache.js +5 -5
  85. package/lib/utils/style.d.ts +5 -5
  86. package/lib/utils/style.js +5 -5
  87. package/lib/version.d.ts +1 -1
  88. package/lib/version.js +1 -1
  89. package/package.json +1 -1
  90. package/src/behaviors/optimize-viewport-transform.ts +1 -1
  91. package/src/elements/edges/base-edge.ts +5 -5
  92. package/src/elements/nodes/base-node.ts +4 -2
  93. package/src/elements/shapes/base-shape.ts +2 -2
  94. package/src/exports.ts +2 -1
  95. package/src/layouts/fishbone.ts +3 -2
  96. package/src/layouts/index.ts +3 -0
  97. package/src/layouts/snake.ts +235 -0
  98. package/src/layouts/types.ts +5 -1
  99. package/src/plugins/minimap/index.ts +1 -1
  100. package/src/plugins/tooltip.ts +11 -4
  101. package/src/registry/build-in.ts +2 -0
  102. package/src/spec/canvas.ts +26 -2
  103. package/src/spec/graph.ts +60 -12
  104. package/src/spec/viewport.ts +4 -0
  105. package/src/utils/cache.ts +5 -5
  106. package/src/utils/style.ts +5 -5
  107. package/src/version.ts +1 -1
@@ -18,18 +18,30 @@ export interface CanvasOptions {
18
18
  * <zh/> 画布宽度
19
19
  *
20
20
  * <en/> canvas width
21
+ * @remarks
22
+ * <zh/> 如果未设置,则会自动获取容器宽度
23
+ *
24
+ * <en/> If not set, the container width will be automatically obtained
21
25
  */
22
26
  width?: number;
23
27
  /**
24
28
  * <zh/> 画布高度
25
29
  *
26
30
  * <en/> canvas height
31
+ * @remarks
32
+ * <zh/> 如果未设置,则会自动获取容器高度
33
+ *
34
+ * <en/> If not set, the container height will be automatically obtained
27
35
  */
28
36
  height?: number;
29
37
  /**
30
- * <zh/> 获取渲染器
38
+ * <zh/> 手动置顶渲染器
39
+ *
40
+ * <en/> manually set renderer
41
+ * @remarks
42
+ * <zh/> G6 采用了分层渲染的方式,分为 background、main、label、transient 四层,用户可以通过该配置项分别设置每层画布的渲染器
31
43
  *
32
- * <en/> get renderer
44
+ * <en/> G6 adopts a layered rendering method, divided into four layers: background, main, label, transient. Users can set the renderer of each layer canvas separately through this configuration item
33
45
  */
34
46
  renderer?: (layer: 'background' | 'main' | 'label' | 'transient') => IRenderer;
35
47
  /**
@@ -37,18 +49,30 @@ export interface CanvasOptions {
37
49
  *
38
50
  * <en/> whether to auto resize canvas
39
51
  * @defaultValue false
52
+ * @remarks
53
+ * <zh/> 基于 window.onresize 事件自动调整画布大小
54
+ *
55
+ * <en/> Automatically adjust the canvas size based on the window.onresize event
40
56
  */
41
57
  autoResize?: boolean;
42
58
  /**
43
59
  * <zh/> 画布背景色
44
60
  *
45
61
  * <en/> canvas background color
62
+ * @remarks
63
+ * <zh/> 该颜色作为导出图片时的背景色
64
+ *
65
+ * <en/> This color is used as the background color when exporting images
46
66
  */
47
67
  background?: string;
48
68
  /**
49
69
  * <zh/> 设备像素比
50
70
  *
51
71
  * <en/> device pixel ratio
72
+ * @remarks
73
+ * <zh/> 用于高清屏的设备像素比,默认为 [window.devicePixelRatio](https://developer.mozilla.org/zh-CN/docs/Web/API/Window/devicePixelRatio)
74
+ *
75
+ * <en/> Device pixel ratio for high-definition screens, default is [window.devicePixelRatio](https://developer.mozilla.org/en-US/docs/Web/API/Window/devicePixelRatio)
52
76
  */
53
77
  devicePixelRatio?: number;
54
78
  /**
package/src/spec/graph.ts CHANGED
@@ -40,30 +40,50 @@ export interface GraphOptions extends CanvasOptions, ViewportOptions {
40
40
  * <zh/> 数据
41
41
  *
42
42
  * <en/> Data
43
+ * @remarks
44
+ * <zh/> 详见 [Data](/api/data/graph-data)
45
+ *
46
+ * <en/> See [Data](/en/api/data/graph-data)
43
47
  */
44
48
  data?: GraphData;
45
49
  /**
46
- * <zh/> 布局
50
+ * <zh/> 布局配置项
51
+ *
52
+ * <en/> Layout options
53
+ * @remarks
54
+ * <zh/> 详见 [Layout](/api/layouts/antv-dagre-layout)
47
55
  *
48
- * <en/> Layout
56
+ * <en/> See [Layout](/en/api/layouts/antv-dagre-layout)
49
57
  */
50
58
  layout?: LayoutOptions;
51
59
  /**
52
- * <zh/> 节点
60
+ * <zh/> 节点配置项
61
+ *
62
+ * <en/> Node options
63
+ * @remarks
64
+ * <zh/> 详见 [Node](/api/elements/nodes/base-node)
53
65
  *
54
- * <en/> Node
66
+ * <en/> See [Node](/en/api/elements/nodes/base-node)
55
67
  */
56
68
  node?: NodeOptions;
57
69
  /**
58
- * <zh/> 边
70
+ * <zh/> 边配置项
59
71
  *
60
- * <en/> Edge
72
+ * <en/> Edge options
73
+ * @remarks
74
+ * <zh/> 详见 [Edge](/api/elements/edges/base-edge)
75
+ *
76
+ * <en/> See [Edge](/en/api/elements/edges/base-edge)
61
77
  */
62
78
  edge?: EdgeOptions;
63
79
  /**
64
- * <zh/> Combo
80
+ * <zh/> 组合配置项
65
81
  *
66
- * <en/> Combo
82
+ * <en/> Combo options
83
+ * @remarks
84
+ * <zh/> 详见 [Combo](/api/elements/combos/base-combo)
85
+ *
86
+ * <en/> See [Combo](/en/api/elements/combos/base-combo)
67
87
  */
68
88
  combo?: ComboOptions;
69
89
  /**
@@ -73,15 +93,43 @@ export interface GraphOptions extends CanvasOptions, ViewportOptions {
73
93
  */
74
94
  theme?: ThemeOptions;
75
95
  /**
76
- * <zh/> 交互
96
+ * <zh/> 启用交互
97
+ *
98
+ * <en/> Enable interactions
99
+ * @remarks
100
+ * <zh/>
101
+ * - 概念:[核心概念 - 交互](/manual/core-concept/behavior)
102
+ *
103
+ * - 内置交互: [交互](/api/behaviors/auto-adapt-label)
104
+ *
105
+ * - 自定义交互: [自定义扩展 - 自定义交互](/manual/advanced/custom-behavior)
77
106
  *
78
- * <en/> Behaviors
107
+ * <en/>
108
+ * - Concept: [Concepts - Behavior](/en/manual/core-concept/behavior)
109
+ *
110
+ * - Built-in behaviors: [Behavior](/en/api/behaviors/auto-adapt-label)
111
+ *
112
+ * - Custom behaviors: [Custom Extension - Custom Behavior](/en/manual/advanced/custom-behavior)
79
113
  */
80
114
  behaviors?: BehaviorOptions;
81
115
  /**
82
- * <zh/> 画布插件
116
+ * <zh/> 启用插件
117
+ *
118
+ * <en/> Enable plugins
119
+ * @remarks
120
+ * <zh/>
121
+ * - 概念:[核心概念 - 插件](/manual/core-concept/plugin)
122
+ *
123
+ * - 内置插件: [插件](/en/api/plugins/background)
124
+ *
125
+ * - 自定义插件: [自定义扩展 - 自定义插件](/manual/advanced/custom-plugin)
126
+ *
127
+ * <en/>
128
+ * - Concept: [Concepts - Plugin](/en/manual/core-concept/plugin)
129
+ *
130
+ * - Built-in plugins: [Plugin](/en/api/plugins/background)
83
131
  *
84
- * <en/> Canvas plugins
132
+ * - Custom plugins: [Custom Extension - Custom Plugin](/en/manual/advanced/custom-plugin)
85
133
  */
86
134
  plugins?: PluginOptions;
87
135
  /**
@@ -24,6 +24,10 @@ export interface ViewportOptions {
24
24
  * <zh/> 是否自动适应
25
25
  *
26
26
  * <en/> whether to auto fit
27
+ * @remarks
28
+ * <zh/> 每次执行 `render` 时,都会根据 `autoFit` 进行自适应
29
+ *
30
+ * <en/> Every time `render` is executed, it will be adapted according to `autoFit`
27
31
  */
28
32
  autoFit?:
29
33
  | { type: 'view'; options?: FitViewOptions; animation?: ViewportAnimationEffectTiming }
@@ -8,8 +8,8 @@ const getStyleCacheKey = (name: string) => `__${name}__`;
8
8
  /**
9
9
  * <zh/> 缓存图形样式
10
10
  *
11
- * <en/> Cache graphic style
12
- * @param element - <zh/> 图形元素 | <en/> graphic element
11
+ * <en/> Cache shape style
12
+ * @param element - <zh/> 图形元素 | <en/> shape element
13
13
  * @param name - <zh/> 样式名 | <en/> style name
14
14
  */
15
15
  export function cacheStyle(element: DisplayObject, name: string | string[]) {
@@ -24,7 +24,7 @@ export function cacheStyle(element: DisplayObject, name: string | string[]) {
24
24
  * <zh/> 获取缓存的样式
25
25
  *
26
26
  * <en/> Get cached style
27
- * @param element - <zh/> 图形元素 | <en/> graphic element
27
+ * @param element - <zh/> 图形元素 | <en/> shape element
28
28
  * @param name - <zh/> 样式名 | <en/> style name
29
29
  * @returns <zh/> 样式值 | <en/> style value
30
30
  */
@@ -36,7 +36,7 @@ export function getCachedStyle(element: DisplayObject, name: string) {
36
36
  * <zh/> 是否有缓存的样式
37
37
  *
38
38
  * <en/> Whether there is a cached style
39
- * @param element - <zh/> 图形元素 | <en/> graphic element
39
+ * @param element - <zh/> 图形元素 | <en/> shape element
40
40
  * @param name - <zh/> 样式名 | <en/> style name
41
41
  * @returns <zh/> 是否有缓存的样式 | <en/> Whether there is a cached style
42
42
  */
@@ -48,7 +48,7 @@ export function hasCachedStyle(element: DisplayObject, name: string) {
48
48
  * <zh/> 设置缓存的样式
49
49
  *
50
50
  * <en/> Set cached style
51
- * @param element - <zh/> 图形元素 | <en/> graphic element
51
+ * @param element - <zh/> 图形元素 | <en/> shape element
52
52
  * @param name - <zh/> 样式名 | <en/> style name
53
53
  * @param value - <zh/> 样式值 | <en/> style value
54
54
  */
@@ -34,7 +34,7 @@ export function computeElementCallbackStyle(
34
34
  /**
35
35
  * <zh/> 合并图形配置项
36
36
  *
37
- * <en/> Merge graphic configuration
37
+ * <en/> Merge shape configuration
38
38
  * @param opt1 - <zh/> 配置项1 | <en/> configuration 1
39
39
  * @param opt2 - <zh/> 配置项2 | <en/> configuration 2
40
40
  * @returns <zh/> 合并后的配置项 | <en/> merged configuration
@@ -50,14 +50,14 @@ export function mergeOptions(opt1: DisplayObjectConfig<any>, opt2: DisplayObject
50
50
  /**
51
51
  * <zh/> 获取图形子图形样式
52
52
  *
53
- * <en/> Get the style of the sub-shape of the graphic
54
- * @param style - <zh/> 图形样式 | <en/> graphic style
53
+ * <en/> Get the style of the sub-shape of the shape
54
+ * @param style - <zh/> 图形样式 | <en/> shape style
55
55
  * @returns <zh/> 子图形样式 | <en/> sub-shape style
56
56
  * @remarks
57
57
  * <zh/> 从给定的属性对象中提取图形样式属性。删除特定的属性,如位置、变换和类名
58
58
  *
59
- * <en/> Extracts the graphic style properties from a given attribute object.
60
- * Removes specific properties like position, transformation, and class name.
59
+ * <en/> Extracts the shape styles from a given attribute object.
60
+ * Removes specific styles like position, transformation, and class name.
61
61
  */
62
62
  export function getSubShapeStyle<T extends Record<string, any>>(
63
63
  style: T,
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '5.0.33';
1
+ export const version = '5.0.35';