mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-03-06 18:37:07 +00:00
feat: 大纲树埋点
This commit is contained in:
parent
51025f01f1
commit
fa2482151d
@ -12,7 +12,9 @@ export interface ITreeBoard {
|
|||||||
|
|
||||||
export class TreeMaster {
|
export class TreeMaster {
|
||||||
constructor(readonly designer: Designer) {
|
constructor(readonly designer: Designer) {
|
||||||
|
let startTime: any;
|
||||||
designer.dragon.onDragstart(() => {
|
designer.dragon.onDragstart(() => {
|
||||||
|
startTime = Date.now() / 1000;
|
||||||
// needs?
|
// needs?
|
||||||
this.toVision();
|
this.toVision();
|
||||||
});
|
});
|
||||||
@ -33,6 +35,25 @@ export class TreeMaster {
|
|||||||
board.scrollToNode(treeNode, detail);
|
board.scrollToNode(treeNode, detail);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
designer.dragon.onDragend(() => {
|
||||||
|
const endTime: any = Date.now() / 1000;
|
||||||
|
const editor = designer?.editor;
|
||||||
|
const nodes = designer.currentSelection?.getNodes();
|
||||||
|
editor?.emit('outlinePane.drag', {
|
||||||
|
selected: nodes
|
||||||
|
?.map((n) => {
|
||||||
|
if (!n) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const npm = n?.componentMeta?.npm;
|
||||||
|
return (
|
||||||
|
[npm?.package, npm?.componentName].filter((item) => !!item).join('-') || n?.componentMeta?.componentName
|
||||||
|
);
|
||||||
|
})
|
||||||
|
.join('&'),
|
||||||
|
time: (endTime - startTime).toFixed(2),
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private toVision() {
|
private toVision() {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { Component, KeyboardEvent, FocusEvent, Fragment } from 'react';
|
import { Component, KeyboardEvent, FocusEvent, Fragment } from 'react';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { observer, Title, Tip } from '@ali/lowcode-editor-core';
|
import { observer, Title, Tip, globalContext, Editor } from '@ali/lowcode-editor-core';
|
||||||
import { IconArrowRight } from '../icons/arrow-right';
|
import { IconArrowRight } from '../icons/arrow-right';
|
||||||
import { IconEyeClose } from '../icons/eye-close';
|
import { IconEyeClose } from '../icons/eye-close';
|
||||||
import { IconLock } from '../icons/lock';
|
import { IconLock } from '../icons/lock';
|
||||||
@ -165,6 +165,16 @@ class HideBtn extends Component<{ treeNode: TreeNode }> {
|
|||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
treeNode.setHidden(!treeNode.hidden);
|
treeNode.setHidden(!treeNode.hidden);
|
||||||
|
const editor = globalContext.get(Editor);
|
||||||
|
const node = treeNode?.node;
|
||||||
|
const npm = node?.componentMeta?.npm;
|
||||||
|
const selected =
|
||||||
|
[npm?.package, npm?.componentName].filter((item) => !!item).join('-') ||
|
||||||
|
node?.componentMeta?.componentName ||
|
||||||
|
'';
|
||||||
|
editor?.emit('outlinePane.hide', {
|
||||||
|
selected,
|
||||||
|
});
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{treeNode.hidden ? <IconEyeClose /> : <IconEye />}
|
{treeNode.hidden ? <IconEyeClose /> : <IconEye />}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { Component, MouseEvent as ReactMouseEvent } from 'react';
|
import { Component, MouseEvent as ReactMouseEvent } from 'react';
|
||||||
import { observer } from '@ali/lowcode-editor-core';
|
import { observer, Editor, globalContext } from '@ali/lowcode-editor-core';
|
||||||
import { isRootNode, Node, DragObjectType, isShaken } from '@ali/lowcode-designer';
|
import { isRootNode, Node, DragObjectType, isShaken } from '@ali/lowcode-designer';
|
||||||
import { isFormEvent } from '@ali/lowcode-utils';
|
import { isFormEvent } from '@ali/lowcode-utils';
|
||||||
import { Tree } from '../tree';
|
import { Tree } from '../tree';
|
||||||
@ -60,6 +60,16 @@ export default class TreeView extends Component<{ tree: Tree }> {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
selection.select(id);
|
selection.select(id);
|
||||||
|
const editor = globalContext.get(Editor);
|
||||||
|
const selectedNode = designer.currentSelection?.getNodes()?.[0];
|
||||||
|
const npm = selectedNode?.componentMeta?.npm;
|
||||||
|
const selected =
|
||||||
|
[npm?.package, npm?.componentName].filter((item) => !!item).join('-') ||
|
||||||
|
selectedNode?.componentMeta?.componentName ||
|
||||||
|
'';
|
||||||
|
editor?.emit('outlinePane.select', {
|
||||||
|
selected,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user