uiik 1.1.0 → 1.3.0-alpha
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/CHANGELOG.md +14 -0
- package/README.md +1 -0
- package/detector.d.ts +0 -19
- package/draggable.d.ts +1 -18
- package/droppable.d.ts +0 -21
- package/index.d.ts +2 -0
- package/index.esm.js +2582 -2
- package/index.js +2625 -2
- package/package.json +4 -7
- package/resizable.d.ts +3 -15
- package/rotatable.d.ts +3 -16
- package/selectable.d.ts +0 -20
- package/sortable.d.ts +0 -24
- package/splittable.d.ts +0 -17
- package/transform.d.ts +19 -0
- package/types.d.ts +39 -307
- package/utils.d.ts +41 -12
- package/detector.js +0 -128
- package/draggable.js +0 -530
- package/droppable.js +0 -160
- package/resizable.js +0 -308
- package/rotatable.js +0 -137
- package/selectable.js +0 -281
- package/sortable.js +0 -441
- package/splittable.js +0 -340
- package/types.js +0 -116
- package/utils.js +0 -58
package/types.d.ts
CHANGED
|
@@ -1,94 +1,33 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A Base class for all Uii classes
|
|
3
|
-
*/
|
|
4
1
|
export declare abstract class Uii {
|
|
5
2
|
#private;
|
|
6
|
-
/**
|
|
7
|
-
* 处理过的dom元素数组
|
|
8
|
-
*/
|
|
9
3
|
protected ele: Array<HTMLElement>;
|
|
10
|
-
|
|
11
|
-
* 当前uii对象的选项
|
|
12
|
-
*/
|
|
13
|
-
protected opts: Record<string, any>;
|
|
4
|
+
opts: Record<string, any>;
|
|
14
5
|
protected enabled: boolean;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
* 销毁uii对象,包括卸载事件、清空元素等
|
|
18
|
-
*/
|
|
6
|
+
protected eleString: string;
|
|
7
|
+
constructor(ele: string | Element | NodeList | HTMLCollection | Array<string | Element>, opts?: Record<string, any>);
|
|
19
8
|
destroy(): void;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
* @param useCapture 默认false
|
|
26
|
-
*/
|
|
27
|
-
protected registerEvent(el: HTMLElement, event: string, hook: Function, useCapture?: boolean): void;
|
|
28
|
-
/**
|
|
29
|
-
* 禁用uii实例,禁用后的dom不会响应事件
|
|
30
|
-
*/
|
|
9
|
+
addPointerDown(el: Element, pointerDown: (args: Record<string, any>) => void, opts: {
|
|
10
|
+
threshold?: number;
|
|
11
|
+
lockPage?: boolean;
|
|
12
|
+
}): void;
|
|
13
|
+
registerEvent(el: Element, event: string, hook: Function, useCapture?: boolean): void;
|
|
31
14
|
disable(): void;
|
|
32
|
-
/**
|
|
33
|
-
* 启用uii实例
|
|
34
|
-
*/
|
|
35
15
|
enable(): void;
|
|
36
|
-
/**
|
|
37
|
-
* 获取uii实例选项对象
|
|
38
|
-
*/
|
|
39
16
|
getOptions(): Record<string, any>;
|
|
40
|
-
/**
|
|
41
|
-
* 获取指定名称的选项值
|
|
42
|
-
* @param name
|
|
43
|
-
* @returns
|
|
44
|
-
*/
|
|
45
17
|
getOption(name: string): any;
|
|
46
|
-
/**
|
|
47
|
-
* 设置多个选项值。触发`onOptionChanged`
|
|
48
|
-
* @param options
|
|
49
|
-
*/
|
|
50
18
|
setOptions(options?: Record<string, any>): void;
|
|
51
|
-
/**
|
|
52
|
-
* 设置指定name的选项值。触发`onOptionChanged`
|
|
53
|
-
* @param name
|
|
54
|
-
* @param value
|
|
55
|
-
*/
|
|
56
19
|
setOption(name: string, value: any): void;
|
|
57
|
-
/**
|
|
58
|
-
* @internal
|
|
59
|
-
*/
|
|
60
20
|
protected onOptionChanged(opts?: Record<string, any>): void;
|
|
61
21
|
}
|
|
62
22
|
export type ResizableOptions = {
|
|
63
|
-
|
|
64
|
-
* handle的宽高,默认8
|
|
65
|
-
*/
|
|
66
|
-
handleSize?: number;
|
|
67
|
-
/**
|
|
68
|
-
* 拖动元素的最小size,如果是数组,表示 [width,height]
|
|
69
|
-
*/
|
|
23
|
+
handle?: ((target: HTMLElement | SVGGraphicsElement) => NodeList | HTMLCollection | HTMLElement[] | HTMLElement | SVGGraphicsElement) | string | NodeList | HTMLCollection | HTMLElement[] | HTMLElement | SVGGraphicsElement;
|
|
70
24
|
minSize?: number | Array<number>;
|
|
71
|
-
/**
|
|
72
|
-
* 拖动元素的最大size,如果是数组,表示 [width,height]
|
|
73
|
-
*/
|
|
74
25
|
maxSize?: number | Array<number>;
|
|
75
|
-
/**
|
|
76
|
-
* resizable方向,默认[n,s,e,w,ne,nw,se,sw]
|
|
77
|
-
*/
|
|
78
26
|
dir?: string[];
|
|
79
|
-
/**
|
|
80
|
-
* handle所在元素的位置偏移,负数向内,正数向外。默认0
|
|
81
|
-
*/
|
|
82
|
-
offset?: number;
|
|
83
|
-
/**
|
|
84
|
-
* 宽高比,小数
|
|
85
|
-
*/
|
|
86
27
|
aspectRatio?: number;
|
|
87
|
-
/**
|
|
88
|
-
* 开启ghost模式后,拖动元素时会自动创建元素副本并拖动副本,当拖动结束后,副本销毁并且元素移动到最后位置。默认false
|
|
89
|
-
*/
|
|
90
28
|
ghost?: boolean | Function;
|
|
91
29
|
ghostClass?: string;
|
|
30
|
+
onPointerDown?: (event: MouseEvent) => boolean;
|
|
92
31
|
onStart?: (data: {
|
|
93
32
|
w: number;
|
|
94
33
|
h: number;
|
|
@@ -96,6 +35,8 @@ export type ResizableOptions = {
|
|
|
96
35
|
onResize?: (data: {
|
|
97
36
|
w: number;
|
|
98
37
|
h: number;
|
|
38
|
+
ow: number;
|
|
39
|
+
oh: number;
|
|
99
40
|
}, event: MouseEvent) => void;
|
|
100
41
|
onEnd?: (data: {
|
|
101
42
|
w: number;
|
|
@@ -106,34 +47,13 @@ export type ResizableOptions = {
|
|
|
106
47
|
}, event: MouseEvent) => void;
|
|
107
48
|
};
|
|
108
49
|
export type SplittableOptions = {
|
|
109
|
-
/**
|
|
110
|
-
* handle宽/高,默认10
|
|
111
|
-
*/
|
|
112
50
|
handleSize?: number;
|
|
113
|
-
/**
|
|
114
|
-
* 最小区域,如果是数组可以按顺序定义分割区域,默认0
|
|
115
|
-
*/
|
|
116
51
|
minSize?: number | number[];
|
|
117
|
-
/**
|
|
118
|
-
* 单边模式,只修改单侧元素size,用于flex布局。可选值为 start/end
|
|
119
|
-
*/
|
|
120
52
|
oneSideMode?: "start" | "end";
|
|
121
|
-
/**
|
|
122
|
-
* 粘性吸附,如果是数组可以按顺序定义分割区域。设置minSize后生效
|
|
123
|
-
*/
|
|
124
53
|
sticky?: boolean | boolean[];
|
|
125
|
-
/**
|
|
126
|
-
* 自动创建的handle是否在元素内部插入,默认false
|
|
127
|
-
*/
|
|
128
54
|
inside?: boolean;
|
|
129
|
-
/**
|
|
130
|
-
* 开启ghost模式后,拖动元素时会自动创建元素副本并拖动副本,当拖动结束后,副本销毁且元素移动到最后位置。默认false
|
|
131
|
-
*/
|
|
132
55
|
ghost?: boolean;
|
|
133
56
|
ghostClass?: string;
|
|
134
|
-
/**
|
|
135
|
-
* 自定义handle选择器,多个使用空格分隔。handle元素可以是与分割元素平级或在分割元素内
|
|
136
|
-
*/
|
|
137
57
|
handle?: string;
|
|
138
58
|
onStart?: (data: {
|
|
139
59
|
size1: number;
|
|
@@ -157,145 +77,66 @@ export type SplittableOptions = {
|
|
|
157
77
|
}, event: MouseEvent) => void;
|
|
158
78
|
};
|
|
159
79
|
export type DraggableOptions = {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
*/
|
|
163
|
-
container?: boolean;
|
|
164
|
-
/**
|
|
165
|
-
* 拖动起始阈值,默认0
|
|
166
|
-
*/
|
|
80
|
+
containment?: boolean | HTMLElement | string;
|
|
81
|
+
watch?: boolean | string;
|
|
167
82
|
threshold?: number;
|
|
168
|
-
/**
|
|
169
|
-
* 实际响应拖动的元素选择器,字符串
|
|
170
|
-
*/
|
|
171
83
|
handle?: string;
|
|
172
|
-
/**
|
|
173
|
-
* 禁止触发元素的css选择器
|
|
174
|
-
*/
|
|
175
84
|
filter?: string;
|
|
176
|
-
/**
|
|
177
|
-
* 拖动目标,dom/selector数组,用于拖动交互事件
|
|
178
|
-
*/
|
|
179
85
|
droppable?: (() => NodeList | HTMLCollection | HTMLElement[]) | string | HTMLElement | HTMLElement[];
|
|
180
|
-
/**
|
|
181
|
-
* 开启ghost模式后,拖动元素时会自动创建元素副本并拖动副本,当拖动结束后,副本销毁并且元素移动到最后位置。默认false,支持函数返回副本元素
|
|
182
|
-
*/
|
|
183
86
|
ghost?: ((el: HTMLElement) => HTMLElement) | boolean;
|
|
184
87
|
ghostClass?: string;
|
|
185
|
-
/**
|
|
186
|
-
* 传递v/h可实现单向拖动。默认''
|
|
187
|
-
*/
|
|
188
88
|
direction?: "v" | "h";
|
|
189
|
-
/**
|
|
190
|
-
* 是否在鼠标到达容器边缘时自动滚动,默认true
|
|
191
|
-
*/
|
|
192
89
|
scroll?: boolean;
|
|
193
|
-
/**
|
|
194
|
-
* 滚动速度,默认10
|
|
195
|
-
*/
|
|
196
90
|
scrollSpeed?: number;
|
|
197
|
-
/**
|
|
198
|
-
* 拖动时元素的zIndex
|
|
199
|
-
*/
|
|
200
91
|
zIndex?: number;
|
|
201
|
-
/**
|
|
202
|
-
* 可将不同的拖动元素编为一组,拖动时会自动管理zIndex
|
|
203
|
-
*/
|
|
204
92
|
group?: string;
|
|
205
|
-
/**
|
|
206
|
-
* 拖动时应用的class样式,多个使用空格分开
|
|
207
|
-
*/
|
|
208
93
|
classes?: string;
|
|
209
|
-
/**
|
|
210
|
-
* 拖动元素可自动吸附的目标元素选择器。字符串
|
|
211
|
-
*/
|
|
212
94
|
snap?: string;
|
|
213
95
|
snapOptions?: {
|
|
214
|
-
/**
|
|
215
|
-
* 吸附元素的移动误差,默认10
|
|
216
|
-
*/
|
|
217
96
|
tolerance: number;
|
|
218
97
|
};
|
|
219
|
-
/**
|
|
220
|
-
* 拖动时元素左上角距离指针的距离,支持百分比及负数
|
|
221
|
-
*/
|
|
222
|
-
cursorAt?: {
|
|
223
|
-
left: number | string;
|
|
224
|
-
top: number | string;
|
|
225
|
-
};
|
|
226
|
-
/**
|
|
227
|
-
* 可定义拖动时不同状态下的指针,默认move
|
|
228
|
-
*/
|
|
229
98
|
cursor?: {
|
|
230
99
|
default?: string;
|
|
231
100
|
active?: string;
|
|
232
101
|
over?: string;
|
|
233
102
|
};
|
|
234
|
-
/**
|
|
235
|
-
* 网格拖动模式,每次移动指定的网格大小。数字或数字数组
|
|
236
|
-
*/
|
|
237
103
|
grid?: number | number[];
|
|
238
|
-
/**
|
|
239
|
-
* 拖动类型标识,用于droppable识别交互类型
|
|
240
|
-
*/
|
|
241
104
|
type?: string;
|
|
105
|
+
onPointerDown?: (data: {
|
|
106
|
+
draggable: HTMLElement | SVGGraphicsElement;
|
|
107
|
+
}, event: MouseEvent) => boolean;
|
|
242
108
|
onStart?: (data: {
|
|
243
|
-
draggable: HTMLElement;
|
|
109
|
+
draggable: HTMLElement | SVGGraphicsElement;
|
|
110
|
+
x: number;
|
|
111
|
+
y: number;
|
|
244
112
|
}, event: MouseEvent) => void;
|
|
245
|
-
/**
|
|
246
|
-
* 拖动中调用,返回false阻止dom移动
|
|
247
|
-
* @param dragDom
|
|
248
|
-
* @param ev
|
|
249
|
-
* @param offsetX
|
|
250
|
-
* @param offsetY
|
|
251
|
-
* @returns
|
|
252
|
-
*/
|
|
253
113
|
onDrag?: (data: {
|
|
254
|
-
draggable: HTMLElement;
|
|
114
|
+
draggable: HTMLElement | SVGGraphicsElement;
|
|
255
115
|
x: number;
|
|
256
116
|
y: number;
|
|
257
117
|
ox: number;
|
|
258
118
|
oy: number;
|
|
259
119
|
}, event: MouseEvent) => boolean | void;
|
|
260
|
-
/**
|
|
261
|
-
* 拖动结束后调用,返回false阻止ghost模式下的dom移动
|
|
262
|
-
* @param dragDom
|
|
263
|
-
* @param ev
|
|
264
|
-
* @returns
|
|
265
|
-
*/
|
|
266
120
|
onEnd?: (data: {
|
|
267
|
-
draggable: HTMLElement;
|
|
121
|
+
draggable: HTMLElement | SVGGraphicsElement;
|
|
122
|
+
x: number;
|
|
123
|
+
y: number;
|
|
268
124
|
}, event: MouseEvent) => boolean | void;
|
|
269
125
|
onClone?: (data: {
|
|
270
|
-
clone: HTMLElement;
|
|
126
|
+
clone: HTMLElement | SVGGraphicsElement;
|
|
271
127
|
}, event: MouseEvent) => void;
|
|
272
128
|
onSnap?: (data: {
|
|
273
|
-
el: HTMLElement;
|
|
274
|
-
targetH: HTMLElement;
|
|
275
|
-
targetV: HTMLElement;
|
|
129
|
+
el: HTMLElement | SVGGraphicsElement;
|
|
130
|
+
targetH: HTMLElement | SVGGraphicsElement;
|
|
131
|
+
targetV: HTMLElement | SVGGraphicsElement;
|
|
276
132
|
dirH: string;
|
|
277
133
|
dirV: string;
|
|
278
134
|
}, event: MouseEvent) => void;
|
|
279
135
|
};
|
|
280
136
|
export type DroppableOptions = {
|
|
281
|
-
/**
|
|
282
|
-
* 当accepts的draggable对象开始拖动时,自动设置该样式。多个样式使用空格分隔
|
|
283
|
-
*/
|
|
284
137
|
activeClass?: string;
|
|
285
|
-
/**
|
|
286
|
-
* 当accepts的draggable对象拖动到droppable元素上时,自动设置该样式。多个样式使用空格分隔
|
|
287
|
-
*/
|
|
288
138
|
hoverClass?: string;
|
|
289
|
-
/**
|
|
290
|
-
* 定义哪些draggable元素进行交互。如果是字符串,支持不同Draggable对象进行编组
|
|
291
|
-
*/
|
|
292
139
|
accepts?: ((ele: Array<HTMLElement>, draggable: HTMLElement) => boolean) | string;
|
|
293
|
-
/**
|
|
294
|
-
* 当accepts的draggable对象开始拖动时触发
|
|
295
|
-
* @param draggable
|
|
296
|
-
* @param ele
|
|
297
|
-
* @returns
|
|
298
|
-
*/
|
|
299
140
|
onActive?: (data: {
|
|
300
141
|
draggable: HTMLElement;
|
|
301
142
|
droppables: Array<HTMLElement>;
|
|
@@ -316,52 +157,42 @@ export type DroppableOptions = {
|
|
|
316
157
|
draggable: HTMLElement;
|
|
317
158
|
droppable: HTMLElement;
|
|
318
159
|
}, event: MouseEvent) => void;
|
|
319
|
-
/**
|
|
320
|
-
* 当accepts的draggable对象结束拖动时触发
|
|
321
|
-
* @param draggable
|
|
322
|
-
* @param ele
|
|
323
|
-
* @returns
|
|
324
|
-
*/
|
|
325
160
|
onDeactive?: (data: {
|
|
326
161
|
draggable: HTMLElement;
|
|
327
162
|
droppables: Array<HTMLElement>;
|
|
328
163
|
}) => void;
|
|
329
164
|
};
|
|
330
165
|
export type RotatableOptions = {
|
|
331
|
-
/**
|
|
332
|
-
* 可定义拖动时不同状态下的指针,默认crosshair
|
|
333
|
-
*/
|
|
334
166
|
cursor?: {
|
|
335
167
|
default?: string;
|
|
336
168
|
active?: string;
|
|
337
169
|
};
|
|
170
|
+
handle?: ((target: HTMLElement | SVGGraphicsElement) => NodeList | HTMLCollection | HTMLElement[] | HTMLElement | SVGGraphicsElement) | string | NodeList | HTMLCollection | HTMLElement[] | HTMLElement | SVGGraphicsElement;
|
|
171
|
+
onPointerDown?: (event: MouseEvent) => boolean;
|
|
338
172
|
onStart?: (data: {
|
|
339
173
|
deg: number;
|
|
174
|
+
cx: number;
|
|
175
|
+
cy: number;
|
|
340
176
|
}, event: MouseEvent) => {};
|
|
341
177
|
onRotate?: (data: {
|
|
342
178
|
deg: number;
|
|
179
|
+
cx: number;
|
|
180
|
+
cy: number;
|
|
343
181
|
}, event: MouseEvent) => {};
|
|
344
182
|
onEnd?: (data: {
|
|
345
183
|
deg: number;
|
|
346
184
|
}, event: MouseEvent) => {};
|
|
347
185
|
};
|
|
348
186
|
export type SelectableOptions = {
|
|
349
|
-
/**
|
|
350
|
-
* 选择器样式字符串,多个使用空格分隔
|
|
351
|
-
*/
|
|
352
187
|
class?: string;
|
|
353
|
-
/**
|
|
354
|
-
* 选择器拖动进行中,被选中元素应用的样式字符串,多个使用空格分隔
|
|
355
|
-
*/
|
|
356
188
|
selectingClass?: string;
|
|
357
|
-
/**
|
|
358
|
-
* 选择器拖动结束后,被选中元素应用的样式字符串,多个使用空格分隔
|
|
359
|
-
*/
|
|
360
189
|
selectedClass?: string;
|
|
361
|
-
/**
|
|
362
|
-
* 容器中可选择的元素。可以是选择器字符串或返回元素数组的函数
|
|
363
|
-
*/
|
|
364
190
|
targets?: (() => NodeList | HTMLCollection | HTMLElement[]) | string;
|
|
191
|
+
mode?: "overlap" | "inclusion";
|
|
192
|
+
scroll?: boolean;
|
|
193
|
+
scrollSpeed?: number;
|
|
194
|
+
filter?: ((el: HTMLElement) => boolean) | string;
|
|
195
|
+
onPointerDown?: (event: MouseEvent) => boolean;
|
|
365
196
|
onStart?: (data: {
|
|
366
197
|
selection: Array<HTMLElement>;
|
|
367
198
|
selectable: HTMLElement;
|
|
@@ -374,85 +205,22 @@ export type SelectableOptions = {
|
|
|
374
205
|
selection: Array<HTMLElement>;
|
|
375
206
|
selectable: HTMLElement;
|
|
376
207
|
}, event: MouseEvent) => void;
|
|
377
|
-
/**
|
|
378
|
-
* 选择模式,默认overlap
|
|
379
|
-
*/
|
|
380
|
-
mode?: "overlap" | "inclusion";
|
|
381
|
-
/**
|
|
382
|
-
* 是否在鼠标到达容器边缘时自动滚动,默认true
|
|
383
|
-
*/
|
|
384
|
-
scroll?: boolean;
|
|
385
|
-
/**
|
|
386
|
-
* 滚动速度,默认10
|
|
387
|
-
*/
|
|
388
|
-
scrollSpeed?: number;
|
|
389
|
-
/**
|
|
390
|
-
* 禁止触发元素的css选择器或校验函数,函数返回true表示需要过滤
|
|
391
|
-
*/
|
|
392
|
-
filter?: ((el: HTMLElement) => boolean) | string;
|
|
393
208
|
};
|
|
394
209
|
export type SortableOptions = {
|
|
395
|
-
/**
|
|
396
|
-
* 是否在鼠标到达容器边缘时自动滚动,默认true
|
|
397
|
-
*/
|
|
398
210
|
scroll?: boolean;
|
|
399
|
-
/**
|
|
400
|
-
* 滚动速度,默认10
|
|
401
|
-
*/
|
|
402
211
|
scrollSpeed?: number;
|
|
403
|
-
/**
|
|
404
|
-
* 禁止触发元素的css选择器
|
|
405
|
-
*/
|
|
406
212
|
filter?: string;
|
|
407
|
-
/**
|
|
408
|
-
* ghost元素插入的容器,默认document.body
|
|
409
|
-
*/
|
|
410
213
|
ghostContainer?: HTMLElement;
|
|
411
|
-
/**
|
|
412
|
-
* ghost元素样式
|
|
413
|
-
*/
|
|
414
214
|
ghostClass?: string;
|
|
415
|
-
/**
|
|
416
|
-
* 用于标识一组sortable容器。当newSortable容器是一组元素时即使该属性为空,也会自动创建匿名group
|
|
417
|
-
*/
|
|
418
215
|
group?: string;
|
|
419
|
-
/**
|
|
420
|
-
* 自定义handle选择器
|
|
421
|
-
*/
|
|
422
216
|
handle?: string;
|
|
423
|
-
/**
|
|
424
|
-
* 当相同group的sortable元素开始拖动时,自动为move.from为true的sortable容器设置该样式。多个样式使用空格分隔
|
|
425
|
-
*/
|
|
426
217
|
activeClass?: string;
|
|
427
|
-
/**
|
|
428
|
-
* 指定sortable元素的拖动策略
|
|
429
|
-
*/
|
|
430
218
|
move?: {
|
|
431
|
-
/**
|
|
432
|
-
* 表示元素从fromContainer的移出策略,默认true
|
|
433
|
-
*/
|
|
434
219
|
to?: ((item: HTMLElement, from: HTMLElement) => boolean) | boolean | 'copy';
|
|
435
|
-
/**
|
|
436
|
-
* 表示来自fromContainer的元素对toContainers的移入策略,默认true
|
|
437
|
-
*/
|
|
438
220
|
from?: ((item: HTMLElement, from: HTMLElement, to: HTMLElement) => boolean) | boolean;
|
|
439
221
|
};
|
|
440
|
-
/**
|
|
441
|
-
* 当ghost元素移出容器后列表元素的处理方式
|
|
442
|
-
* remove 删除列表元素
|
|
443
|
-
* revert 复原拖动前位置
|
|
444
|
-
*/
|
|
445
222
|
spill?: 'remove' | 'revert';
|
|
446
|
-
/**
|
|
447
|
-
* 是否可排序,默认true
|
|
448
|
-
*/
|
|
449
223
|
sort?: boolean;
|
|
450
|
-
/**
|
|
451
|
-
* 当一组中的任意sortable容器中的元素被拖动时,其他容器会触发激活事件
|
|
452
|
-
* @param data
|
|
453
|
-
* @param event
|
|
454
|
-
* @returns
|
|
455
|
-
*/
|
|
456
224
|
onActive?: (data: {
|
|
457
225
|
item: HTMLElement;
|
|
458
226
|
from: HTMLElement;
|
|
@@ -466,22 +234,11 @@ export type SortableOptions = {
|
|
|
466
234
|
from: HTMLElement;
|
|
467
235
|
index: number;
|
|
468
236
|
}, event: MouseEvent) => void;
|
|
469
|
-
/**
|
|
470
|
-
* 拖动结束后触发
|
|
471
|
-
* @param data
|
|
472
|
-
* @param event
|
|
473
|
-
* @returns
|
|
474
|
-
*/
|
|
475
237
|
onEnd?: (data: {
|
|
476
238
|
item: HTMLElement;
|
|
477
239
|
from: HTMLElement;
|
|
478
240
|
to: HTMLElement;
|
|
479
241
|
}, event: MouseEvent) => void;
|
|
480
|
-
/**
|
|
481
|
-
* 拖动中且排序发生变更时触发
|
|
482
|
-
* @param data
|
|
483
|
-
* @param event
|
|
484
|
-
*/
|
|
485
242
|
onChange?: (data: {
|
|
486
243
|
item: HTMLElement;
|
|
487
244
|
from: HTMLElement;
|
|
@@ -489,53 +246,28 @@ export type SortableOptions = {
|
|
|
489
246
|
fromIndex: number;
|
|
490
247
|
toIndex: number;
|
|
491
248
|
}, event: MouseEvent) => void;
|
|
492
|
-
/**
|
|
493
|
-
* 拖动结束后,如果列表排序发生变更时触发,包括顺序变更或新增节点或移除节点
|
|
494
|
-
* @param data
|
|
495
|
-
* @param event
|
|
496
|
-
*/
|
|
497
249
|
onUpdate?: (data: {
|
|
498
250
|
item: HTMLElement;
|
|
499
251
|
from: HTMLElement;
|
|
500
252
|
to: HTMLElement;
|
|
501
253
|
}, event: MouseEvent) => void;
|
|
502
|
-
/**
|
|
503
|
-
* 拖动中指针进入sortable容器时触发
|
|
504
|
-
* @param data
|
|
505
|
-
* @param event
|
|
506
|
-
*/
|
|
507
254
|
onEnter?: (data: {
|
|
508
255
|
item: HTMLElement;
|
|
509
256
|
from: HTMLElement;
|
|
510
257
|
to: HTMLElement;
|
|
511
258
|
dir: string;
|
|
512
259
|
}, event: MouseEvent) => void;
|
|
513
|
-
/**
|
|
514
|
-
* 拖动中指针离开sortable容器时触发
|
|
515
|
-
* @param data
|
|
516
|
-
* @param event
|
|
517
|
-
*/
|
|
518
260
|
onLeave?: (data: {
|
|
519
261
|
item: HTMLElement;
|
|
520
262
|
from: HTMLElement;
|
|
521
263
|
to: HTMLElement;
|
|
522
264
|
}, event: MouseEvent) => void;
|
|
523
|
-
/**
|
|
524
|
-
* 拖动元素插入到sortable容器中时触发
|
|
525
|
-
* @param data
|
|
526
|
-
* @param event
|
|
527
|
-
*/
|
|
528
265
|
onAdd?: (data: {
|
|
529
266
|
item: HTMLElement;
|
|
530
267
|
from: HTMLElement;
|
|
531
268
|
to: HTMLElement;
|
|
532
269
|
index: number;
|
|
533
270
|
}, event: MouseEvent) => void;
|
|
534
|
-
/**
|
|
535
|
-
* 拖动元素从sortable容器中删除时触发
|
|
536
|
-
* @param data
|
|
537
|
-
* @param event
|
|
538
|
-
*/
|
|
539
271
|
onRemove?: (data: {
|
|
540
272
|
item: HTMLElement;
|
|
541
273
|
from: HTMLElement;
|
package/utils.d.ts
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* 获取child相对于parent的offset信息。含border宽度
|
|
7
|
-
* @returns
|
|
8
|
-
*/
|
|
9
|
-
export declare function getOffset(child: HTMLElement, parent?: HTMLElement): {
|
|
1
|
+
export declare const ONE_ANG: number;
|
|
2
|
+
export declare const ONE_RAD: number;
|
|
3
|
+
export declare function getBox(child: Element, parent?: Element): {
|
|
10
4
|
x: number;
|
|
11
5
|
y: number;
|
|
6
|
+
w: number;
|
|
7
|
+
h: number;
|
|
12
8
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
export declare function getPointOffset(e: MouseEvent, pos: {
|
|
10
|
+
x: number;
|
|
11
|
+
y: number;
|
|
12
|
+
}): number[];
|
|
13
|
+
export declare function isSVGEl(el: Element): el is SVGElement;
|
|
16
14
|
export declare const EDGE_THRESHOLD = 5;
|
|
17
15
|
export declare const DRAGGING_RULE = "body * { pointer-events: none; }";
|
|
18
16
|
export declare function lockPage(): void;
|
|
@@ -20,3 +18,34 @@ export declare function unlockPage(): void;
|
|
|
20
18
|
export declare function saveCursor(): void;
|
|
21
19
|
export declare function setCursor(cursor: string): void;
|
|
22
20
|
export declare function restoreCursor(): void;
|
|
21
|
+
export declare function getStyleXy(el: HTMLElement | SVGGraphicsElement): {
|
|
22
|
+
x: number;
|
|
23
|
+
y: number;
|
|
24
|
+
};
|
|
25
|
+
export declare function getMatrixInfo(elCStyle: CSSStyleDeclaration | HTMLElement | SVGGraphicsElement): {
|
|
26
|
+
scale: number;
|
|
27
|
+
angle: number;
|
|
28
|
+
x: number;
|
|
29
|
+
y: number;
|
|
30
|
+
};
|
|
31
|
+
export declare function getPointInContainer(event: MouseEvent | PointerEvent, el: HTMLElement | SVGGraphicsElement, elRect?: DOMRect, elCStyle?: CSSStyleDeclaration, matrixInfo?: {
|
|
32
|
+
scale: number;
|
|
33
|
+
angle: number;
|
|
34
|
+
}): {
|
|
35
|
+
x: number;
|
|
36
|
+
y: number;
|
|
37
|
+
};
|
|
38
|
+
export declare function getRectInContainer(el: HTMLElement | SVGGraphicsElement, container: HTMLElement | SVGGraphicsElement): {
|
|
39
|
+
x: number;
|
|
40
|
+
y: number;
|
|
41
|
+
w: number;
|
|
42
|
+
h: number;
|
|
43
|
+
};
|
|
44
|
+
export declare function getCenterXy(el: HTMLElement | SVGGraphicsElement): {
|
|
45
|
+
sx: number;
|
|
46
|
+
sy: number;
|
|
47
|
+
x: number;
|
|
48
|
+
y: number;
|
|
49
|
+
ox: number;
|
|
50
|
+
oy: number;
|
|
51
|
+
};
|