forked from alibaba/lowcode-engine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlocation.ts
More file actions
56 lines (48 loc) · 1.42 KB
/
location.ts
File metadata and controls
56 lines (48 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import { IPublicModelNode, IPublicModelLocateEvent } from '../model';
// eslint-disable-next-line no-shadow
export enum IPublicTypeLocationDetailType {
Children = 'Children',
Prop = 'Prop',
}
/**
* @deprecated please use IPublicTypeLocationDetailType
*/
export enum LocationDetailType {
Children = 'Children',
Prop = 'Prop',
}
export type IPublicTypeRect = DOMRect & {
elements?: Array<Element | Text>;
computed?: boolean;
};
export interface IPublicTypeLocationChildrenDetail {
type: IPublicTypeLocationDetailType.Children;
index?: number | null;
/**
* 是否有效位置
*/
valid?: boolean;
edge?: DOMRect;
near?: {
node: IPublicModelNode;
pos: 'before' | 'after' | 'replace';
rect?: IPublicTypeRect;
align?: 'V' | 'H';
};
focus?: { type: 'slots' } | { type: 'node'; node: IPublicModelNode };
}
export interface IPublicTypeLocationPropDetail {
// cover 形态,高亮 domNode,如果 domNode 为空,取 container 的值
type: IPublicTypeLocationDetailType.Prop;
name: string;
domNode?: HTMLElement;
}
export type IPublicTypeLocationDetail = IPublicTypeLocationChildrenDetail | IPublicTypeLocationPropDetail | { [key: string]: any; type: string };
export interface IPublicTypeLocationData<
Node = IPublicModelNode
> {
target: Node; // shadowNode | ConditionFlow | ElementNode | RootNode
detail: IPublicTypeLocationDetail;
source: string;
event: IPublicModelLocateEvent;
}