@antv/g6 5.0.16 → 5.0.18
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.
- package/dist/g6.min.js +2 -2
- package/dist/lib/behaviors/click-select.d.ts +0 -1
- package/dist/lib/behaviors/optimize-viewport-transform.d.ts +0 -1
- package/dist/lib/constants/events/canvas.d.ts +1 -1
- package/dist/lib/constants/registry.d.ts +7 -1
- package/dist/lib/elements/edges/polyline.d.ts +1 -0
- package/dist/lib/elements/effect.d.ts +19 -2
- package/dist/lib/elements/nodes/html.d.ts +14 -0
- package/dist/lib/elements/shapes/base-shape.d.ts +51 -2
- package/dist/lib/exports.d.ts +4 -2
- package/dist/lib/plugins/edge-filter-lens/index.d.ts +141 -0
- package/dist/lib/plugins/fisheye/index.d.ts +167 -0
- package/dist/lib/plugins/index.d.ts +4 -0
- package/dist/lib/plugins/tooltip.d.ts +1 -0
- package/dist/lib/registry/types.d.ts +4 -0
- package/dist/lib/runtime/element.d.ts +3 -1
- package/dist/lib/runtime/plugin.d.ts +1 -1
- package/dist/lib/types/element.d.ts +7 -0
- package/dist/lib/utils/dom.d.ts +8 -5
- package/dist/lib/version.d.ts +1 -1
- package/esm/behaviors/click-select.d.ts +0 -1
- package/esm/behaviors/click-select.js.map +1 -1
- package/esm/behaviors/optimize-viewport-transform.d.ts +0 -1
- package/esm/behaviors/optimize-viewport-transform.js +5 -4
- package/esm/behaviors/optimize-viewport-transform.js.map +1 -1
- package/esm/constants/events/canvas.d.ts +1 -1
- package/esm/constants/events/canvas.js +1 -1
- package/esm/constants/events/canvas.js.map +1 -1
- package/esm/constants/registry.d.ts +7 -1
- package/esm/constants/registry.js +6 -0
- package/esm/constants/registry.js.map +1 -1
- package/esm/elements/edges/polyline.d.ts +1 -0
- package/esm/elements/edges/polyline.js +5 -1
- package/esm/elements/edges/polyline.js.map +1 -1
- package/esm/elements/effect.d.ts +19 -2
- package/esm/elements/effect.js +19 -2
- package/esm/elements/effect.js.map +1 -1
- package/esm/elements/nodes/html.d.ts +14 -0
- package/esm/elements/nodes/html.js +10 -4
- package/esm/elements/nodes/html.js.map +1 -1
- package/esm/elements/shapes/base-shape.d.ts +51 -2
- package/esm/elements/shapes/base-shape.js +22 -4
- package/esm/elements/shapes/base-shape.js.map +1 -1
- package/esm/exports.d.ts +4 -2
- package/esm/exports.js +2 -1
- package/esm/exports.js.map +1 -1
- package/esm/plugins/contextmenu/index.js +1 -1
- package/esm/plugins/contextmenu/index.js.map +1 -1
- package/esm/plugins/edge-filter-lens/index.d.ts +141 -0
- package/esm/plugins/edge-filter-lens/index.js +241 -0
- package/esm/plugins/edge-filter-lens/index.js.map +1 -0
- package/esm/plugins/fisheye/index.d.ts +167 -0
- package/esm/plugins/fisheye/index.js +288 -0
- package/esm/plugins/fisheye/index.js.map +1 -0
- package/esm/plugins/index.d.ts +4 -0
- package/esm/plugins/index.js +2 -0
- package/esm/plugins/index.js.map +1 -1
- package/esm/plugins/snapline/index.js +2 -2
- package/esm/plugins/snapline/index.js.map +1 -1
- package/esm/plugins/tooltip.d.ts +1 -0
- package/esm/plugins/tooltip.js +16 -17
- package/esm/plugins/tooltip.js.map +1 -1
- package/esm/registry/build-in.js +20 -1
- package/esm/registry/build-in.js.map +1 -1
- package/esm/registry/store.js +1 -0
- package/esm/registry/store.js.map +1 -1
- package/esm/registry/types.d.ts +4 -0
- package/esm/runtime/element.d.ts +3 -1
- package/esm/runtime/element.js +8 -2
- package/esm/runtime/element.js.map +1 -1
- package/esm/runtime/plugin.d.ts +1 -1
- package/esm/runtime/plugin.js +8 -1
- package/esm/runtime/plugin.js.map +1 -1
- package/esm/types/element.d.ts +7 -0
- package/esm/utils/dom.d.ts +8 -5
- package/esm/utils/dom.js +24 -15
- package/esm/utils/dom.js.map +1 -1
- package/esm/version.d.ts +1 -1
- package/esm/version.js +1 -1
- package/lib/behaviors/click-select.d.ts +0 -1
- package/lib/behaviors/click-select.js.map +1 -1
- package/lib/behaviors/optimize-viewport-transform.d.ts +0 -1
- package/lib/behaviors/optimize-viewport-transform.js +5 -4
- package/lib/behaviors/optimize-viewport-transform.js.map +1 -1
- package/lib/constants/events/canvas.d.ts +1 -1
- package/lib/constants/events/canvas.js +1 -1
- package/lib/constants/events/canvas.js.map +1 -1
- package/lib/constants/registry.d.ts +7 -1
- package/lib/constants/registry.js +6 -0
- package/lib/constants/registry.js.map +1 -1
- package/lib/elements/edges/polyline.d.ts +1 -0
- package/lib/elements/edges/polyline.js +5 -1
- package/lib/elements/edges/polyline.js.map +1 -1
- package/lib/elements/effect.d.ts +19 -2
- package/lib/elements/effect.js +19 -2
- package/lib/elements/effect.js.map +1 -1
- package/lib/elements/nodes/html.d.ts +14 -0
- package/lib/elements/nodes/html.js +10 -4
- package/lib/elements/nodes/html.js.map +1 -1
- package/lib/elements/shapes/base-shape.d.ts +51 -2
- package/lib/elements/shapes/base-shape.js +22 -4
- package/lib/elements/shapes/base-shape.js.map +1 -1
- package/lib/exports.d.ts +4 -2
- package/lib/exports.js +7 -2
- package/lib/exports.js.map +1 -1
- package/lib/plugins/contextmenu/index.js +1 -1
- package/lib/plugins/contextmenu/index.js.map +1 -1
- package/lib/plugins/edge-filter-lens/index.d.ts +141 -0
- package/lib/plugins/edge-filter-lens/index.js +245 -0
- package/lib/plugins/edge-filter-lens/index.js.map +1 -0
- package/lib/plugins/fisheye/index.d.ts +167 -0
- package/lib/plugins/fisheye/index.js +292 -0
- package/lib/plugins/fisheye/index.js.map +1 -0
- package/lib/plugins/index.d.ts +4 -0
- package/lib/plugins/index.js +5 -1
- package/lib/plugins/index.js.map +1 -1
- package/lib/plugins/snapline/index.js +2 -2
- package/lib/plugins/snapline/index.js.map +1 -1
- package/lib/plugins/tooltip.d.ts +1 -0
- package/lib/plugins/tooltip.js +16 -17
- package/lib/plugins/tooltip.js.map +1 -1
- package/lib/registry/build-in.js +19 -0
- package/lib/registry/build-in.js.map +1 -1
- package/lib/registry/store.js +1 -0
- package/lib/registry/store.js.map +1 -1
- package/lib/registry/types.d.ts +4 -0
- package/lib/runtime/element.d.ts +3 -1
- package/lib/runtime/element.js +8 -2
- package/lib/runtime/element.js.map +1 -1
- package/lib/runtime/plugin.d.ts +1 -1
- package/lib/runtime/plugin.js +8 -1
- package/lib/runtime/plugin.js.map +1 -1
- package/lib/types/element.d.ts +7 -0
- package/lib/utils/dom.d.ts +8 -5
- package/lib/utils/dom.js +24 -15
- package/lib/utils/dom.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +1 -1
- package/src/behaviors/click-select.ts +0 -1
- package/src/behaviors/optimize-viewport-transform.ts +4 -10
- package/src/constants/events/canvas.ts +1 -1
- package/src/constants/registry.ts +6 -0
- package/src/elements/edges/polyline.ts +7 -1
- package/src/elements/effect.ts +19 -2
- package/src/elements/nodes/html.ts +28 -4
- package/src/elements/shapes/base-shape.ts +75 -5
- package/src/exports.ts +8 -0
- package/src/plugins/contextmenu/index.ts +1 -1
- package/src/plugins/edge-filter-lens/index.ts +404 -0
- package/src/plugins/fisheye/index.ts +481 -0
- package/src/plugins/index.ts +4 -0
- package/src/plugins/snapline/index.ts +2 -2
- package/src/plugins/tooltip.ts +18 -17
- package/src/registry/build-in.ts +32 -0
- package/src/registry/store.ts +1 -0
- package/src/registry/types.ts +2 -0
- package/src/runtime/element.ts +11 -3
- package/src/runtime/plugin.ts +8 -1
- package/src/types/element.ts +7 -0
- package/src/utils/dom.ts +24 -15
- package/src/version.ts +1 -1
package/src/runtime/plugin.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { BasePlugin } from '../plugins/base-plugin';
|
|
2
2
|
import { ExtensionController } from '../registry/extension';
|
|
3
3
|
import type { CustomPluginOption, PluginOptions } from '../spec/plugin';
|
|
4
|
+
import { print } from '../utils/print';
|
|
4
5
|
import type { RuntimeContext } from './types';
|
|
5
6
|
|
|
6
7
|
export class PluginController extends ExtensionController<BasePlugin<CustomPluginOption>> {
|
|
@@ -16,6 +17,12 @@ export class PluginController extends ExtensionController<BasePlugin<CustomPlugi
|
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
public getPluginInstance(key: string) {
|
|
19
|
-
|
|
20
|
+
const exactly = this.extensionMap[key];
|
|
21
|
+
if (exactly) return exactly;
|
|
22
|
+
|
|
23
|
+
print.warn(`Cannot find the plugin ${key}, will try to find it by type.`);
|
|
24
|
+
|
|
25
|
+
const fussily = this.extensions.find((extension) => extension.type === key);
|
|
26
|
+
if (fussily) return this.extensionMap[fussily.key];
|
|
20
27
|
}
|
|
21
28
|
}
|
package/src/types/element.ts
CHANGED
|
@@ -79,6 +79,13 @@ export interface BaseElementStyleProps extends BaseShapeStyleProps {
|
|
|
79
79
|
* <en/> Element methods
|
|
80
80
|
*/
|
|
81
81
|
export interface ElementMethods {
|
|
82
|
+
/**
|
|
83
|
+
* <zh/> 更新元素属性
|
|
84
|
+
*
|
|
85
|
+
* <en/> Update element attributes
|
|
86
|
+
* @param attr - <zh/> 属性 | <en/> Attributes
|
|
87
|
+
*/
|
|
88
|
+
update(attr: any): void;
|
|
82
89
|
/**
|
|
83
90
|
* <zh/> 获取当前元素内的子图形
|
|
84
91
|
*
|
package/src/utils/dom.ts
CHANGED
|
@@ -44,28 +44,37 @@ export function sizeOf(container: HTMLElement): [number, number] {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* @
|
|
47
|
+
* <zh/> 创建插件容器
|
|
48
|
+
*
|
|
49
|
+
* <en/> Create a plugin container
|
|
50
|
+
* @param type - <zh/> 插件类型 | <en/> plugin type
|
|
51
|
+
* @param cover - <zh/> 容器是否覆盖整个画布 | <en/> Whether the container covers the entire canvas
|
|
52
|
+
* @param style - <zh/> 额外样式 | <en/> Additional style
|
|
53
|
+
* @returns <zh/> 插件容器 | <en/> plugin container
|
|
51
54
|
*/
|
|
52
|
-
export function createPluginContainer(type: string, cover = true) {
|
|
53
|
-
const
|
|
55
|
+
export function createPluginContainer(type: string, cover = true, style?: Partial<CSSStyleDeclaration>): HTMLElement {
|
|
56
|
+
const container = document.createElement('div');
|
|
54
57
|
|
|
55
|
-
|
|
58
|
+
container.setAttribute('class', `g6-${type}`);
|
|
56
59
|
|
|
57
|
-
|
|
58
|
-
|
|
60
|
+
Object.assign(container.style, {
|
|
61
|
+
position: 'absolute',
|
|
62
|
+
display: 'block',
|
|
63
|
+
});
|
|
59
64
|
|
|
60
65
|
if (cover) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
+
Object.assign(container.style, {
|
|
67
|
+
inset: '0px',
|
|
68
|
+
height: '100%',
|
|
69
|
+
width: '100%',
|
|
70
|
+
overflow: 'hidden',
|
|
71
|
+
pointerEvents: 'none',
|
|
72
|
+
});
|
|
66
73
|
}
|
|
67
74
|
|
|
68
|
-
|
|
75
|
+
if (style) Object.assign(container.style, style);
|
|
76
|
+
|
|
77
|
+
return container;
|
|
69
78
|
}
|
|
70
79
|
|
|
71
80
|
/**
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '5.0.
|
|
1
|
+
export const version = '5.0.18';
|