@tmagic/stage 1.2.6 → 1.2.8

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.
@@ -17,6 +17,7 @@ export default class StageDragResize extends MoveableOptionsManager {
17
17
  private markContainerEnd;
18
18
  private delayedMarkContainer;
19
19
  constructor(config: StageDragResizeConfig);
20
+ getTarget(): HTMLElement | undefined;
20
21
  /**
21
22
  * 将选中框渲染并覆盖到选中的组件Dom节点上方
22
23
  * 当选中的节点不是absolute时,会创建一个新的节点出来作为拖拽目标
@@ -11,6 +11,8 @@ export default class StageMultiDragResize extends MoveableOptionsManager {
11
11
  dragStatus: StageDragStatus;
12
12
  private dragResizeHelper;
13
13
  private getRenderDocument;
14
+ private delayedMarkContainer;
15
+ private markContainerEnd;
14
16
  constructor(config: StageMultiDragResizeConfig);
15
17
  /**
16
18
  * 多选
package/types/types.d.ts CHANGED
@@ -3,6 +3,7 @@ import type { MoveableOptions } from 'moveable';
3
3
  import Core from '@tmagic/core';
4
4
  import type { Id, MApp, MContainer, MNode } from '@tmagic/schema';
5
5
  import { GuidesType, ZIndex } from './const';
6
+ import DragResizeHelper from './DragResizeHelper';
6
7
  import StageCore from './StageCore';
7
8
  export declare type TargetElement = HTMLElement | SVGElement;
8
9
  export declare type CanSelect = (el: HTMLElement, event: MouseEvent, stop: () => boolean) => boolean | Promise<boolean>;
@@ -79,20 +80,22 @@ export interface StageMaskConfig {
79
80
  }
80
81
  export interface StageDragResizeConfig {
81
82
  container: HTMLElement;
83
+ dragResizeHelper: DragResizeHelper;
82
84
  moveableOptions?: CustomizeMoveableOptions;
83
85
  disabledDragStart?: boolean;
84
86
  getRootContainer: GetRootContainer;
85
87
  getRenderDocument: GetRenderDocument;
86
88
  markContainerEnd: MarkContainerEnd;
87
89
  delayedMarkContainer: DelayedMarkContainer;
88
- updateDragEl?: UpdateDragEl;
89
90
  }
90
91
  export interface StageMultiDragResizeConfig {
91
92
  container: HTMLElement;
93
+ dragResizeHelper: DragResizeHelper;
92
94
  multiMoveableOptions?: CustomizeMoveableOptions;
93
95
  getRootContainer: GetRootContainer;
94
96
  getRenderDocument: GetRenderDocument;
95
- updateDragEl?: UpdateDragEl;
97
+ markContainerEnd: MarkContainerEnd;
98
+ delayedMarkContainer: DelayedMarkContainer;
96
99
  }
97
100
  export interface DragResizeHelperConfig {
98
101
  container: HTMLElement;
@@ -147,6 +150,11 @@ export interface UpdateEventData {
147
150
  }[];
148
151
  parentEl: HTMLElement | null;
149
152
  }
153
+ export interface RemoveEventData {
154
+ data: {
155
+ el: HTMLElement;
156
+ }[];
157
+ }
150
158
  export interface SortEventData {
151
159
  src: Id;
152
160
  dist: Id;
@@ -193,3 +201,7 @@ export interface TargetShadowConfig {
193
201
  updateDragEl?: UpdateDragEl;
194
202
  idPrefix?: string;
195
203
  }
204
+ export declare enum AbleActionEventType {
205
+ SELECT_PARENT = "select-parent",
206
+ REMOVE = "remove"
207
+ }
@@ -1,76 +0,0 @@
1
- import { MoveableManagerInterface, Renderer } from 'moveable';
2
-
3
- export default (selectParentHandler: () => void) => ({
4
- name: 'select-parent',
5
- props: {},
6
- events: {},
7
- render(moveable: MoveableManagerInterface<any, any>, React: Renderer) {
8
- const rect = moveable.getRect();
9
- const { pos2 } = moveable.state;
10
-
11
- // use css for able
12
- const editableViewer = moveable.useCSS(
13
- 'div',
14
- `
15
- {
16
- position: absolute;
17
- left: 0px;
18
- top: 0px;
19
- will-change: transform;
20
- transform-origin: 0px 0px;
21
- display: flex;
22
- }
23
- .moveable-button {
24
- width: 20px;
25
- height: 20px;
26
- background: #4af;
27
- border-radius: 4px;
28
- appearance: none;
29
- border: 0;
30
- color: white;
31
- font-size: 12px;
32
- font-weight: bold;
33
- }
34
- `,
35
- );
36
- // Add key (required)
37
- // Add class prefix moveable-(required)
38
- return React.createElement(
39
- editableViewer,
40
- {
41
- className: 'moveable-editable',
42
- style: {
43
- transform: `translate(${pos2[0] - 25}px, ${pos2[1] - 30}px) rotate(${rect.rotation}deg) translate(10px)`,
44
- },
45
- },
46
- React.createElement(
47
- 'button',
48
- {
49
- className: 'moveable-button',
50
- title: '选中父组件',
51
- onClick: () => {
52
- selectParentHandler();
53
- },
54
- },
55
- React.createElement(
56
- 'svg',
57
- {
58
- width: '1em',
59
- height: '1em',
60
- viewBox: '0 0 16 16',
61
- fill: 'none',
62
- xmlns: 'http://www.w3.org/2000/svg',
63
- style: {
64
- transform: 'rotate(90deg)',
65
- },
66
- },
67
- React.createElement('path', {
68
- d: 'M13.0001 4V10H4.20718L5.85363 8.35355L5.14652 7.64645L2.64652 10.1464C2.45126 10.3417 2.45126 10.6583 2.64652 10.8536L5.14652 13.3536L5.85363 12.6464L4.20718 11H13.0001C13.5524 11 14.0001 10.5523 14.0001 10V4H13.0001Z',
69
- fill: 'currentColor',
70
- fillOpacity: '0.9',
71
- }),
72
- ),
73
- ),
74
- );
75
- },
76
- });