amis-editor-core 6.11.0 → 6.12.0-ab.1

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.
@@ -49,6 +49,10 @@ export default class Preview extends Component<PreviewProps> {
49
49
  handleDBClick(e: MouseEvent): void;
50
50
  handleNavSwitch(id: string): void;
51
51
  handleMouseMove(e: MouseEvent): void;
52
+ getElementPoint(e: MouseEvent): {
53
+ x: number;
54
+ y: number;
55
+ };
52
56
  handleMouseLeave(): void;
53
57
  handeMouseOver(e: MouseEvent): void;
54
58
  handleSubmit(e: Event): void;
@@ -1,12 +1,15 @@
1
- import { EditorDNDManager } from '.';
1
+ import { EditorDNDManager } from './index';
2
2
  import { EditorNodeType } from '../store/node';
3
3
  import { DNDModeInterface } from './interface';
4
4
  export declare class DefaultDNDMode implements DNDModeInterface {
5
5
  readonly dnd: EditorDNDManager;
6
6
  readonly region: EditorNodeType;
7
7
  readonly dndContainer: HTMLElement;
8
- dropBeforeId?: string;
8
+ readonly relativeContainer: HTMLElement;
9
+ dropOn?: string;
10
+ dropPosition?: 'top' | 'bottom' | 'left' | 'right' | 'center' | 'middle';
9
11
  constructor(dnd: EditorDNDManager, region: EditorNodeType);
12
+ layoutInfo: LayoutInfo | null;
10
13
  /**
11
14
  * 记录上次交换时的鼠标位置。
12
15
  */
@@ -33,15 +36,19 @@ export declare class DefaultDNDMode implements DNDModeInterface {
33
36
  * 获取当时拖动到了哪个节点上面。
34
37
  */
35
38
  getTarget(e: DragEvent): HTMLElement | null;
36
- /**
37
- * 获取区域的直接孩子,因为有时候会在孩子的孩子里面。
38
- * 但是插入 ghost 的相对位置,insertBefore 只能是当前孩子。
39
- * @param dom
40
- * @param descend
41
- */
42
- getChild(dom: HTMLElement, descend: HTMLElement): HTMLElement;
39
+ getChildren(region: HTMLElement): Array<HTMLElement>;
40
+ detectDropPosition(event: DragEvent, dropTarget: HTMLElement): 'top' | 'bottom' | 'left' | 'right';
41
+ reductionPosition(position: 'top' | 'bottom' | 'left' | 'right', isHorizontal?: boolean): "left" | "right" | "bottom" | "top";
42
+ updateIndicator(ghost: HTMLElement, target: HTMLElement, dropPosition: 'top' | 'bottom' | 'left' | 'right' | 'center' | 'middle'): void;
43
43
  /**
44
44
  * 销毁
45
45
  */
46
46
  dispose(): void;
47
47
  }
48
+ interface LayoutInfo {
49
+ type: 'flex' | 'grid' | 'block';
50
+ isHorizontal?: boolean;
51
+ isWrapped?: boolean;
52
+ hasColumns?: boolean;
53
+ }
54
+ export {};
@@ -27,6 +27,10 @@ export declare class EditorDNDManager {
27
27
  * 拖拽跟随元素
28
28
  */
29
29
  dragImage?: HTMLElement;
30
+ /**
31
+ * 是否锁定自动切换
32
+ */
33
+ lockAutoSwitch: boolean;
30
34
  /**
31
35
  * 记录上次鼠标位置信息,协助拖拽计算的。
32
36
  */
@@ -52,7 +56,7 @@ export declare class EditorDNDManager {
52
56
  * @param id
53
57
  * @param region
54
58
  */
55
- switchToRegion(e: DragEvent, id: string, region: string): boolean;
59
+ switchToRegion(e: DragEvent, id: string, region: string, lockAutoSwitch?: boolean): boolean;
56
60
  /**
57
61
  * 根据区域的配置,创建拖拽模式实例。
58
62
  * 比如 table 列区域的拖拽就是放根线表示拖入的位置。
@@ -104,6 +108,7 @@ export declare class EditorDNDManager {
104
108
  id: string;
105
109
  region: string;
106
110
  }): void;
111
+ isInEdgeRegion(e: DragEvent, target: HTMLElement): boolean;
107
112
  /**
108
113
  * 销毁函数。
109
114
  */
@@ -1,7 +1,22 @@
1
- import { DefaultDNDMode } from './default';
2
1
  import { DNDModeInterface } from './interface';
3
- export declare class PositionHDNDMode extends DefaultDNDMode implements DNDModeInterface {
2
+ import { EditorNodeType } from '../store/node';
3
+ import { EditorDNDManager } from './index';
4
+ export declare class PositionHDNDMode implements DNDModeInterface {
5
+ readonly dnd: EditorDNDManager;
6
+ readonly region: EditorNodeType;
7
+ readonly dndContainer: HTMLElement;
8
+ dropBeforeId?: string;
9
+ constructor(dnd: EditorDNDManager, region: EditorNodeType);
4
10
  enter(e: DragEvent, ghost: HTMLElement): void;
5
11
  leave(e: DragEvent, ghost: HTMLElement): void;
6
12
  over(e: DragEvent, ghost: HTMLElement): void;
13
+ /**
14
+ * 获取当时拖动到了哪个节点上面。
15
+ */
16
+ getTarget(e: DragEvent): HTMLElement | null;
17
+ getDropBeforeId(): string | undefined;
18
+ /**
19
+ * 销毁
20
+ */
21
+ dispose(): void;
7
22
  }