@antv/g6 5.0.37 → 5.0.39
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 +28 -28
- package/dist/lib/plugins/tooltip.d.ts +3 -3
- package/dist/lib/utils/element.d.ts +3 -2
- package/dist/lib/version.d.ts +1 -1
- package/esm/elements/nodes/html.js +1 -1
- package/esm/elements/nodes/html.js.map +1 -1
- package/esm/plugins/tooltip.d.ts +3 -3
- package/esm/plugins/tooltip.js +15 -6
- package/esm/plugins/tooltip.js.map +1 -1
- package/esm/utils/element.d.ts +3 -2
- package/esm/utils/element.js +3 -1
- package/esm/utils/element.js.map +1 -1
- package/esm/version.d.ts +1 -1
- package/esm/version.js +1 -1
- package/lib/elements/nodes/html.js +1 -1
- package/lib/elements/nodes/html.js.map +1 -1
- package/lib/plugins/tooltip.d.ts +3 -3
- package/lib/plugins/tooltip.js +15 -6
- package/lib/plugins/tooltip.js.map +1 -1
- package/lib/utils/element.d.ts +3 -2
- package/lib/utils/element.js +3 -1
- package/lib/utils/element.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +1 -1
- package/src/elements/nodes/html.ts +1 -1
- package/src/plugins/tooltip.ts +5 -5
- package/src/utils/element.ts +5 -3
- package/src/version.ts +1 -1
package/lib/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "5.0.
|
|
1
|
+
export declare const version = "5.0.39";
|
package/lib/version.js
CHANGED
package/package.json
CHANGED
|
@@ -268,7 +268,7 @@ export class HTML extends BaseNode<HTMLStyleProps> {
|
|
|
268
268
|
let x: number;
|
|
269
269
|
let y: number;
|
|
270
270
|
const { offsetX, offsetY, clientX, clientY } = nativeEvent;
|
|
271
|
-
if (
|
|
271
|
+
if (!isNil(offsetX) && !isNil(offsetY)) {
|
|
272
272
|
x = offsetX;
|
|
273
273
|
y = offsetY;
|
|
274
274
|
} else {
|
package/src/plugins/tooltip.ts
CHANGED
|
@@ -31,7 +31,7 @@ export interface TooltipOptions
|
|
|
31
31
|
*
|
|
32
32
|
* <en/> Function for getting tooltip content
|
|
33
33
|
*/
|
|
34
|
-
getContent?: (event: IElementEvent, items: ElementDatum[]) => HTMLElement | string
|
|
34
|
+
getContent?: (event: IElementEvent, items: ElementDatum[]) => Promise<HTMLElement | string>;
|
|
35
35
|
/**
|
|
36
36
|
* <zh/> 是否启用
|
|
37
37
|
*
|
|
@@ -215,11 +215,11 @@ export class Tooltip extends BasePlugin<TooltipOptions> {
|
|
|
215
215
|
* <en/> Show tooltip of target element
|
|
216
216
|
* @param id - <zh/> 元素 ID | <en/> element ID
|
|
217
217
|
*/
|
|
218
|
-
public showById = (id: ID) => {
|
|
218
|
+
public showById = async (id: ID) => {
|
|
219
219
|
const event = {
|
|
220
220
|
target: { id },
|
|
221
221
|
} as IElementEvent;
|
|
222
|
-
this.show(event);
|
|
222
|
+
await this.show(event);
|
|
223
223
|
};
|
|
224
224
|
|
|
225
225
|
private getElementData = (id: ID, targetType: ElementType) => {
|
|
@@ -243,7 +243,7 @@ export class Tooltip extends BasePlugin<TooltipOptions> {
|
|
|
243
243
|
* @param event - <zh/> 目标元素 | <en/> target element
|
|
244
244
|
* @internal
|
|
245
245
|
*/
|
|
246
|
-
public show = (event: IElementEvent) => {
|
|
246
|
+
public show = async (event: IElementEvent) => {
|
|
247
247
|
const {
|
|
248
248
|
client,
|
|
249
249
|
target: { id },
|
|
@@ -258,7 +258,7 @@ export class Tooltip extends BasePlugin<TooltipOptions> {
|
|
|
258
258
|
|
|
259
259
|
let tooltipContent: { [key: string]: unknown } = {};
|
|
260
260
|
if (getContent) {
|
|
261
|
-
tooltipContent.content = getContent(event, items);
|
|
261
|
+
tooltipContent.content = await getContent(event, items);
|
|
262
262
|
if (!tooltipContent.content) return;
|
|
263
263
|
} else {
|
|
264
264
|
const style = this.context.graph.getElementRenderStyle(id);
|
package/src/utils/element.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { AABB,
|
|
1
|
+
import type { AABB, DisplayObject, TextStyleProps } from '@antv/g';
|
|
2
2
|
import { get, isNumber, isString, set } from '@antv/util';
|
|
3
3
|
import { BaseCombo, BaseEdge, BaseNode } from '../elements';
|
|
4
|
+
import type { BaseShape } from '../elements/shapes';
|
|
4
5
|
import type { Combo, Edge, Element, Node, NodePortStyleProps, Placement, Point, TriangleDirection } from '../types';
|
|
5
6
|
import type { NodeLabelStyleProps, Port } from '../types/node';
|
|
6
7
|
import { getBBoxHeight, getBBoxWidth } from './bbox';
|
|
@@ -474,8 +475,8 @@ export function isVisible(element: DisplayObject) {
|
|
|
474
475
|
* @param element - <zh/> 元素 | <en/> element
|
|
475
476
|
* @param style - <zh/> 样式 | <en/> style
|
|
476
477
|
*/
|
|
477
|
-
export function setAttributes(element:
|
|
478
|
-
const { zIndex, transform, transformOrigin, visibility, cursor, clipPath, ...rest } = style;
|
|
478
|
+
export function setAttributes(element: BaseShape<any>, style: Record<string, any>) {
|
|
479
|
+
const { zIndex, transform, transformOrigin, visibility, cursor, clipPath, component, ...rest } = style;
|
|
479
480
|
Object.assign(element.attributes, rest);
|
|
480
481
|
|
|
481
482
|
if (transform) element.setAttribute('transform', transform);
|
|
@@ -484,6 +485,7 @@ export function setAttributes(element: DisplayObject, style: BaseStyleProps) {
|
|
|
484
485
|
if (visibility) element.setAttribute('visibility', visibility);
|
|
485
486
|
if (cursor) element.setAttribute('cursor', cursor);
|
|
486
487
|
if (clipPath) element.setAttribute('clipPath', clipPath);
|
|
488
|
+
if (component) element.setAttribute('component', component);
|
|
487
489
|
}
|
|
488
490
|
|
|
489
491
|
/**
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '5.0.
|
|
1
|
+
export const version = '5.0.39';
|