clickgo 4.0.0 → 4.0.2
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/dist/app/demo.cga +0 -0
- package/dist/app/task.cga +0 -0
- package/dist/clickgo.d.ts +128 -0
- package/dist/control/arteditor.cgc +0 -0
- package/dist/control/box.cgc +0 -0
- package/dist/control/captcha.cgc +0 -0
- package/dist/control/common.cgc +0 -0
- package/dist/control/desc.cgc +0 -0
- package/dist/control/drawer.cgc +0 -0
- package/dist/control/echarts.cgc +0 -0
- package/dist/control/form.cgc +0 -0
- package/dist/control/iconview.cgc +0 -0
- package/dist/control/jodit.cgc +0 -0
- package/dist/control/map.cgc +0 -0
- package/dist/control/monaco.cgc +0 -0
- package/dist/control/mpegts.cgc +0 -0
- package/dist/control/nav.cgc +0 -0
- package/dist/control/novnc.cgc +0 -0
- package/dist/control/page.cgc +0 -0
- package/dist/control/pdf.cgc +0 -0
- package/dist/control/property.cgc +0 -0
- package/dist/control/qrcode.cgc +0 -0
- package/dist/control/table.cgc +0 -0
- package/dist/control/task.cgc +0 -0
- package/dist/control/tplink.cgc +0 -0
- package/dist/control/tuieditor.cgc +0 -0
- package/dist/control/tuiviewer.cgc +0 -0
- package/dist/control/tums.cgc +0 -0
- package/dist/control/xterm.cgc +0 -0
- package/dist/index.js +1 -1
- package/dist/lib/control.d.ts +662 -0
- package/dist/lib/core.d.ts +337 -0
- package/dist/lib/dom.d.ts +491 -0
- package/dist/lib/form.d.ts +720 -0
- package/dist/lib/fs.d.ts +186 -0
- package/dist/lib/native.d.ts +134 -0
- package/dist/lib/storage.d.ts +39 -0
- package/dist/lib/task.d.ts +244 -0
- package/dist/lib/theme.d.ts +63 -0
- package/dist/lib/tool.d.ts +504 -0
- package/dist/lib/zip.d.ts +128 -0
- package/dist/theme/dark.cgt +0 -0
- package/dist/theme/light.cgt +0 -0
- package/package.json +1 -1
|
@@ -0,0 +1,491 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2007-2025 MAIYUN.NET
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import * as clickgo from '../clickgo';
|
|
17
|
+
import * as lCore from './core';
|
|
18
|
+
/**
|
|
19
|
+
* --- 初始化系统级 ID,仅能设置一次 ---
|
|
20
|
+
* @param id 系统级 ID
|
|
21
|
+
*/
|
|
22
|
+
export declare function initSysId(id: string): void;
|
|
23
|
+
/**
|
|
24
|
+
* --- 判断一个元素是否还存在于页面当中 ---
|
|
25
|
+
* @param el 要判断的元素
|
|
26
|
+
*/
|
|
27
|
+
export declare function inPage(el: HTMLElement): boolean;
|
|
28
|
+
export declare const dpi: number;
|
|
29
|
+
/**
|
|
30
|
+
* --- 设置全局鼠标样式 ---
|
|
31
|
+
* @param type 样式或留空,留空代表取消
|
|
32
|
+
*/
|
|
33
|
+
export declare function setGlobalCursor(type?: string): void;
|
|
34
|
+
/**
|
|
35
|
+
* --- 判断当前的事件是否是含有 touch 的设备触发的,如果当前就是 touch 则直接返回 false(false 代表 OK,true 代表 touch 设备却触发了 mouse 事件) ---
|
|
36
|
+
*/
|
|
37
|
+
export declare function hasTouchButMouse(e: MouseEvent | TouchEvent | PointerEvent): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* --- 创建任务时连同一起创建的 style 标签 ---
|
|
40
|
+
* @param taskId 任务 id
|
|
41
|
+
*/
|
|
42
|
+
export declare function createToStyleList(taskId: string): void;
|
|
43
|
+
/**
|
|
44
|
+
* --- 任务结束时需要移除 task 的所有 style ---
|
|
45
|
+
* @param taskId 任务 id
|
|
46
|
+
*/
|
|
47
|
+
export declare function removeFromStyleList(taskId: string): void;
|
|
48
|
+
/**
|
|
49
|
+
* --- 将 style 内容写入 dom ---
|
|
50
|
+
* @param taskId 当前任务 ID
|
|
51
|
+
* @param style 样式内容
|
|
52
|
+
* @param type 插入的类型
|
|
53
|
+
* @param formId 当前窗体 ID(global 下可空,theme 下为主题唯一标识符,control 下为控件名)
|
|
54
|
+
* @param panelId 若是 panel 中创建的则需要指定 panelId,仅 type 为 form 有效
|
|
55
|
+
*/
|
|
56
|
+
export declare function pushStyle(taskId: string, style: string, type?: 'global' | 'theme' | 'control' | 'form', formId?: string, panelId?: string): void;
|
|
57
|
+
/**
|
|
58
|
+
* --- 移除 style 样式 dom ---
|
|
59
|
+
* @param taskId 要移除的任务 ID
|
|
60
|
+
* @param type 移除的类型
|
|
61
|
+
* @param formId 要移除的窗体 ID
|
|
62
|
+
* @param panelId type 为 form 模式下若不指定则当前 form 包含 panel 的样式都会被移除
|
|
63
|
+
*/
|
|
64
|
+
export declare function removeStyle(taskId: string, type?: 'global' | 'theme' | 'control' | 'form', formId?: string, panelId?: string): void;
|
|
65
|
+
/**
|
|
66
|
+
* --- 获取任务中子类有几个子元素 ---
|
|
67
|
+
* @param taskId 任务 ID
|
|
68
|
+
* @param type 类型
|
|
69
|
+
*/
|
|
70
|
+
export declare function getStyleCount(taskId: clickgo.core.TCurrent, type: 'theme' | 'control' | 'form'): number;
|
|
71
|
+
/**
|
|
72
|
+
* --- 添加监视 Element 对象位置,元素移除后自动停止监视,已经监视中的不会再次监视,请短时间使用(虽然本方法也可以监听 element 的大小改变,但这是监听位置改变的副产品,如果仅仅监听大小改变请使用效率更高的 watch size) ---
|
|
73
|
+
* @param el 要监视的大小
|
|
74
|
+
* @param cb 回调函数
|
|
75
|
+
* @param immediate 立刻先执行一次回调
|
|
76
|
+
*/
|
|
77
|
+
export declare function watchPosition(el: HTMLElement, cb: (state: {
|
|
78
|
+
'position': boolean;
|
|
79
|
+
'size': boolean;
|
|
80
|
+
}) => void | Promise<void>, immediate?: boolean): boolean;
|
|
81
|
+
/**
|
|
82
|
+
* --- 移除监视 Element 对象位置 ---
|
|
83
|
+
* @param el 要移除监视
|
|
84
|
+
*/
|
|
85
|
+
export declare function unwatchPosition(el: HTMLElement): void;
|
|
86
|
+
/**
|
|
87
|
+
* --- 检测一个标签是否正在被 watchSize ---
|
|
88
|
+
* @param el 要检测的标签
|
|
89
|
+
*/
|
|
90
|
+
export declare function isWatchPosition(el: HTMLElement): boolean;
|
|
91
|
+
/**
|
|
92
|
+
* --- 清除某个窗体的所有 watch position 监视,虽然窗体结束后相关监视永远不会再被执行,但是会形成冗余 ---
|
|
93
|
+
* @param formId 窗体 id
|
|
94
|
+
* @param panelId 若指定则只清除当前窗体的某个 panel 的 watch
|
|
95
|
+
*/
|
|
96
|
+
export declare function clearWatchPosition(formId: string, panelId?: string): void;
|
|
97
|
+
/**
|
|
98
|
+
* --- 获取当前 watch size 中的元素总数 ---
|
|
99
|
+
* @param taskId 留空则获取全部总数 ---
|
|
100
|
+
*/
|
|
101
|
+
export declare function getWatchSizeCount(taskId?: lCore.TCurrent): number;
|
|
102
|
+
/**
|
|
103
|
+
* --- 添加监视 Element 对象大小,元素移除后自动停止监视(浏览器原生效果),已经监视中的不会再次监视 ---
|
|
104
|
+
* @param current 当前执行的任务
|
|
105
|
+
* @param el 要监视的大小
|
|
106
|
+
* @param cb 回调函数
|
|
107
|
+
* @param immediate 立刻先执行一次回调
|
|
108
|
+
*/
|
|
109
|
+
export declare function watchSize(current: lCore.TCurrent, el: HTMLElement, cb: () => void | Promise<void>, immediate?: boolean): boolean;
|
|
110
|
+
/**
|
|
111
|
+
* --- 移除监视 Element 对象大小 ---
|
|
112
|
+
* @param el 要移除监视
|
|
113
|
+
*/
|
|
114
|
+
export declare function unwatchSize(el: HTMLElement): void;
|
|
115
|
+
/**
|
|
116
|
+
* --- 检测一个标签是否正在被 watchSize ---
|
|
117
|
+
* @param el 要检测的标签
|
|
118
|
+
*/
|
|
119
|
+
export declare function isWatchSize(el: HTMLElement): boolean;
|
|
120
|
+
/**
|
|
121
|
+
* --- 清除某个任务的所有 watch size 监视 ---
|
|
122
|
+
* @param taskId 任务 id
|
|
123
|
+
*/
|
|
124
|
+
export declare function clearWatchSize(taskId: lCore.TCurrent): void;
|
|
125
|
+
/**
|
|
126
|
+
* --- 获取当前 watch 中的元素总数 ---
|
|
127
|
+
* @param taskId 留空则获取全部总数 ---
|
|
128
|
+
*/
|
|
129
|
+
export declare function getWatchCount(taskId?: string): number;
|
|
130
|
+
/**
|
|
131
|
+
* --- 添加 DOM 内容变化监视 ---
|
|
132
|
+
* @param current 当前任务 id
|
|
133
|
+
* @param el dom 对象
|
|
134
|
+
* @param cb 回调
|
|
135
|
+
* @param mode 监听模式
|
|
136
|
+
*/
|
|
137
|
+
export declare function watch(current: lCore.TCurrent, el: HTMLElement, cb: (mutations: MutationRecord[]) => void | Promise<void>, mode?: 'child' | 'childsub' | 'style' | 'text' | 'default', immediate?: boolean): boolean;
|
|
138
|
+
/**
|
|
139
|
+
* --- 移除监视 Element 对象变动 ---
|
|
140
|
+
* @param taskId 任务 id
|
|
141
|
+
* @param el 要移除监视
|
|
142
|
+
*/
|
|
143
|
+
export declare function unwatch(taskId: lCore.TCurrent, el: HTMLElement): void;
|
|
144
|
+
/**
|
|
145
|
+
* --- 检测一个标签是否正在被 watchSize ---
|
|
146
|
+
* @param el 要检测的标签
|
|
147
|
+
*/
|
|
148
|
+
export declare function isWatch(el: HTMLElement): boolean;
|
|
149
|
+
/**
|
|
150
|
+
* --- 清除某个任务下面的所有 watch 监视 ---
|
|
151
|
+
* @param taskId 任务 id
|
|
152
|
+
*/
|
|
153
|
+
export declare function clearWatch(taskId: lCore.TCurrent): void;
|
|
154
|
+
/**
|
|
155
|
+
* --- 监听一个标签的计算后样式的变化 ---
|
|
156
|
+
* @param el 对象
|
|
157
|
+
* @param name 样式名
|
|
158
|
+
* @param cb 变更回调
|
|
159
|
+
* @param immediate 是否立刻执行一次
|
|
160
|
+
*/
|
|
161
|
+
export declare function watchStyle(el: HTMLElement, name: string | string[], cb: (name: string, value: string, old: string) => void | Promise<void>, immediate?: boolean): void;
|
|
162
|
+
/**
|
|
163
|
+
* --- 检测一个标签是否正在被 watchStyle ---
|
|
164
|
+
* @param el 要检测的标签
|
|
165
|
+
*/
|
|
166
|
+
export declare function isWatchStyle(el: HTMLElement): boolean;
|
|
167
|
+
/**
|
|
168
|
+
* --- 清除某个窗体的所有 watch style 监视 ---
|
|
169
|
+
* @param formId 窗体 id
|
|
170
|
+
* @param panelId 若指定则只清除当前窗体的某个 panel 的 watch
|
|
171
|
+
*/
|
|
172
|
+
export declare function clearWatchStyle(formId: string, panelId?: string): void;
|
|
173
|
+
/**
|
|
174
|
+
* --- 监听一个对象的属性变化 ---
|
|
175
|
+
* @param el 对象
|
|
176
|
+
* @param name 属性名
|
|
177
|
+
* @param cb 回调函数
|
|
178
|
+
* @param immediate 是否立即执行一次
|
|
179
|
+
*/
|
|
180
|
+
export declare function watchProperty(el: HTMLElement, name: string | string[], cb: (name: string, value: any) => void | Promise<void>, immediate?: boolean): void;
|
|
181
|
+
/**
|
|
182
|
+
* --- 检测一个标签是否正在被 watchProperty ---
|
|
183
|
+
* @param el 要检测的标签
|
|
184
|
+
*/
|
|
185
|
+
export declare function isWatchProperty(el: HTMLElement): boolean;
|
|
186
|
+
/**
|
|
187
|
+
* --- 清除某个窗体的所有 watch property 监视,虽然窗体结束后相关监视永远不会再被执行,但是会形成冗余 ---
|
|
188
|
+
* @param formId 窗体 id
|
|
189
|
+
* @param panelId 若指定则只清除当前窗体的某个 panel 的 watch
|
|
190
|
+
*/
|
|
191
|
+
export declare function clearWatchProperty(formId: string, panelId?: string): void;
|
|
192
|
+
export declare function getWatchInfo(): IGetWatchInfoResult;
|
|
193
|
+
/**
|
|
194
|
+
* --- 鼠标/手指没移动时,click 才生效 ---
|
|
195
|
+
* @param e 事件对象
|
|
196
|
+
* @param handler 回调
|
|
197
|
+
*/
|
|
198
|
+
export declare function bindClick(e: MouseEvent | TouchEvent, handler: (e: MouseEvent | TouchEvent, x: number, y: number) => void | Promise<void>): void;
|
|
199
|
+
/**
|
|
200
|
+
* --- 相当于鼠标/手指两次 click 的效果,并且两次位置差别不太大,dblclick 才生效 ---
|
|
201
|
+
* @param e 事件对象
|
|
202
|
+
* @param handler 回调
|
|
203
|
+
*/
|
|
204
|
+
export declare function bindDblClick(e: MouseEvent | TouchEvent, handler: (e: MouseEvent | TouchEvent, x: number, y: number) => void | Promise<void>): void;
|
|
205
|
+
/**
|
|
206
|
+
* --- 绑定按下以及弹起事件,touch 和 mouse 只会绑定一个 ---
|
|
207
|
+
* @param oe MouseEvent | TouchEvent
|
|
208
|
+
* @param opt 回调选项
|
|
209
|
+
*/
|
|
210
|
+
export declare function bindDown<T extends MouseEvent | TouchEvent>(oe: T, opt: IBindDownOptions<T>): void;
|
|
211
|
+
/**
|
|
212
|
+
* --- 绑定缩放,要绑定到 mousedown、touchstart、touchmove、touchend、wheel 上 ---
|
|
213
|
+
* @param oe 触发的时间
|
|
214
|
+
* @param handler 回调函数
|
|
215
|
+
*/
|
|
216
|
+
export declare function bindScale(oe: MouseEvent | TouchEvent | WheelEvent, handler: (e: MouseEvent | TouchEvent | WheelEvent, scale: number, cpos: {
|
|
217
|
+
'x': number;
|
|
218
|
+
'y': number;
|
|
219
|
+
}) => void | Promise<void>): void;
|
|
220
|
+
/**
|
|
221
|
+
* --- 绑定上拉、下拉、左拉、右拉 ---
|
|
222
|
+
* @param oe 响应事件
|
|
223
|
+
* @param before before 事件,返回 1 则显示 gesture,0 则不处理(可能会向上传递事件),-1 则 stopPropagation(本层可拖动,若实际不可拖动则可能导致浏览器页面滚动)
|
|
224
|
+
* @param handler 执行完毕的话才会回调
|
|
225
|
+
*/
|
|
226
|
+
export declare function bindGesture(oe: MouseEvent | TouchEvent | WheelEvent, before: (e: MouseEvent | TouchEvent | WheelEvent, dir: 'top' | 'right' | 'bottom' | 'left') => number, handler?: (dir: 'top' | 'right' | 'bottom' | 'left') => void | Promise<void>): void;
|
|
227
|
+
export declare function allowEvent(e: MouseEvent | TouchEvent | KeyboardEvent): boolean;
|
|
228
|
+
/**
|
|
229
|
+
* --- 绑定长按事件 ---
|
|
230
|
+
* @param e 事件原型
|
|
231
|
+
* @param long 回调
|
|
232
|
+
*/
|
|
233
|
+
export declare function bindLong(e: MouseEvent | TouchEvent, long: (e: MouseEvent | TouchEvent) => void | Promise<void>): void;
|
|
234
|
+
/**
|
|
235
|
+
* --- 重新绑定 drag 数据 ---
|
|
236
|
+
* @param data 要绑定的数据
|
|
237
|
+
*/
|
|
238
|
+
export declare function setDragData(data?: string | number | boolean | Record<string, any>): void;
|
|
239
|
+
/**
|
|
240
|
+
* --- 绑定拖动 ---
|
|
241
|
+
* @param e 鼠标事件
|
|
242
|
+
* @param opt 参数
|
|
243
|
+
*/
|
|
244
|
+
export declare function bindDrag(e: MouseEvent | TouchEvent, opt: {
|
|
245
|
+
'el': HTMLElement;
|
|
246
|
+
'data'?: any;
|
|
247
|
+
'start'?: (x: number, y: number) => any;
|
|
248
|
+
'move'?: (e: MouseEvent | TouchEvent, opt: IBindMoveMoveOptions) => void;
|
|
249
|
+
'end'?: (moveTimes: Array<{
|
|
250
|
+
'time': number;
|
|
251
|
+
'ox': number;
|
|
252
|
+
'oy': number;
|
|
253
|
+
}>, e: MouseEvent | TouchEvent) => void;
|
|
254
|
+
}): void;
|
|
255
|
+
/** --- 目前是否已绑定了 bindMove --- */
|
|
256
|
+
export declare let is: {
|
|
257
|
+
'move': boolean;
|
|
258
|
+
'shift': boolean;
|
|
259
|
+
'ctrl': boolean;
|
|
260
|
+
'meta': boolean;
|
|
261
|
+
'full': boolean;
|
|
262
|
+
'dark': boolean;
|
|
263
|
+
};
|
|
264
|
+
/**
|
|
265
|
+
* --- 绑定拖动事件 ---
|
|
266
|
+
* @param e mousedown 或 touchstart 的 event
|
|
267
|
+
* @param opt 回调选项
|
|
268
|
+
*/
|
|
269
|
+
export declare function bindMove(e: MouseEvent | TouchEvent, opt: IBindMoveOptions): IBindMoveResult;
|
|
270
|
+
/**
|
|
271
|
+
* --- 绑定拖动改变大小事件 ---
|
|
272
|
+
* @param e mousedown 或 touchstart 的 event
|
|
273
|
+
* @param opt 选项,width, height 当前对象宽高
|
|
274
|
+
*/
|
|
275
|
+
export declare function bindResize(e: MouseEvent | TouchEvent, opt: IBindResizeOptions): void;
|
|
276
|
+
/**
|
|
277
|
+
* --- 通过 data 名查找上层所有标签是否存在 ---
|
|
278
|
+
* @param el 当前标签
|
|
279
|
+
* @param name 要查找的 data 名
|
|
280
|
+
* @param value data 对应的值,留空则代表只要匹配了名就可以
|
|
281
|
+
*/
|
|
282
|
+
export declare function findParentByData(el: HTMLElement, name: string, value?: string): HTMLElement | null;
|
|
283
|
+
/**
|
|
284
|
+
* --- 通过 class 名查找上层所有标签是否存在 ---
|
|
285
|
+
* @param el 当前标签
|
|
286
|
+
* @param name 要查找的 class 名
|
|
287
|
+
*/
|
|
288
|
+
export declare function findParentByClass(el: HTMLElement, name: string): HTMLElement | null;
|
|
289
|
+
/**
|
|
290
|
+
* --- 通过 tagname 查找上层所有标签是否存在 ---
|
|
291
|
+
* @param el 当前标签
|
|
292
|
+
* @param name 要查找的 tagname 名,小写,如 table
|
|
293
|
+
*/
|
|
294
|
+
export declare function findParentByTag(el: HTMLElement, name: string): HTMLElement | null;
|
|
295
|
+
/**
|
|
296
|
+
* --- 判断一个元素是当前同级的第几位 ---
|
|
297
|
+
* @param el 要判断的元素
|
|
298
|
+
*/
|
|
299
|
+
export declare function index(el: HTMLElement): number;
|
|
300
|
+
/**
|
|
301
|
+
* --- 查找指定 el 的同级所有元素 ---
|
|
302
|
+
* @param el 基准
|
|
303
|
+
* @returns HTMLElement[]
|
|
304
|
+
*/
|
|
305
|
+
export declare function siblings(el: HTMLElement): HTMLElement[];
|
|
306
|
+
/**
|
|
307
|
+
* --- 查找指定 el 的同级的存在 data 的元素 ---
|
|
308
|
+
* @param el 基准
|
|
309
|
+
* @param name data 名,不含 data-
|
|
310
|
+
* @returns HTMLElement[]
|
|
311
|
+
*/
|
|
312
|
+
export declare function siblingsData(el: HTMLElement, name: string): HTMLElement[];
|
|
313
|
+
/**
|
|
314
|
+
* --- 全屏 ---
|
|
315
|
+
*/
|
|
316
|
+
export declare function fullscreen(): Promise<boolean>;
|
|
317
|
+
/**
|
|
318
|
+
* --- 退出全屏 ---
|
|
319
|
+
*/
|
|
320
|
+
export declare function exitFullscreen(): Promise<boolean>;
|
|
321
|
+
/**
|
|
322
|
+
* --- 创建 element ---
|
|
323
|
+
* @param tagName 标签名
|
|
324
|
+
*/
|
|
325
|
+
export declare function createElement<T extends keyof HTMLElementTagNameMap>(tagName: T): HTMLElementTagNameMap[T];
|
|
326
|
+
export declare function init(): void;
|
|
327
|
+
/** --- 方向类型,从左上开始 --- */
|
|
328
|
+
export type TDomBorder = 'lt' | 't' | 'tr' | 'r' | 'rb' | 'b' | 'bl' | 'l' | '';
|
|
329
|
+
export type TDomBorderCustom = TDomBorder | {
|
|
330
|
+
'left': number;
|
|
331
|
+
'top'?: number;
|
|
332
|
+
'width': number;
|
|
333
|
+
'height'?: number;
|
|
334
|
+
};
|
|
335
|
+
/** --- Element 的大小 --- */
|
|
336
|
+
export interface IDomSize {
|
|
337
|
+
'top': number;
|
|
338
|
+
'right': number;
|
|
339
|
+
'bottom': number;
|
|
340
|
+
'left': number;
|
|
341
|
+
'width': number;
|
|
342
|
+
'height': number;
|
|
343
|
+
'padding': {
|
|
344
|
+
'top': number;
|
|
345
|
+
'right': number;
|
|
346
|
+
'bottom': number;
|
|
347
|
+
'left': number;
|
|
348
|
+
};
|
|
349
|
+
'border': {
|
|
350
|
+
'top': number;
|
|
351
|
+
'right': number;
|
|
352
|
+
'bottom': number;
|
|
353
|
+
'left': number;
|
|
354
|
+
};
|
|
355
|
+
'clientHeight': number;
|
|
356
|
+
'clientWidth': number;
|
|
357
|
+
'innerWidth': number;
|
|
358
|
+
'innerHeight': number;
|
|
359
|
+
'scrollWidth': number;
|
|
360
|
+
'scrollHeight': number;
|
|
361
|
+
}
|
|
362
|
+
/** --- 绑定鼠标事件选项 --- */
|
|
363
|
+
export interface IBindDownOptions<T extends MouseEvent | TouchEvent> {
|
|
364
|
+
'down'?: (e: T) => void;
|
|
365
|
+
'start'?: (e: T) => any;
|
|
366
|
+
'move'?: (e: T, dir: 'top' | 'right' | 'bottom' | 'left') => any;
|
|
367
|
+
'up'?: (e: T) => void | Promise<void>;
|
|
368
|
+
'end'?: (e: T) => void | Promise<void>;
|
|
369
|
+
}
|
|
370
|
+
/** --- 绑定拖动选项 move 回调的回调参数 --- */
|
|
371
|
+
export interface IBindMoveMoveOptions {
|
|
372
|
+
'ox': number;
|
|
373
|
+
'oy': number;
|
|
374
|
+
'x': number;
|
|
375
|
+
'y': number;
|
|
376
|
+
'border': TDomBorder;
|
|
377
|
+
'inBorder': {
|
|
378
|
+
'top': boolean;
|
|
379
|
+
'right': boolean;
|
|
380
|
+
'bottom': boolean;
|
|
381
|
+
'left': boolean;
|
|
382
|
+
};
|
|
383
|
+
'dir': 'top' | 'right' | 'bottom' | 'left';
|
|
384
|
+
}
|
|
385
|
+
/** --- 绑定拖动选项 --- */
|
|
386
|
+
export interface IBindMoveOptions {
|
|
387
|
+
'areaObject'?: HTMLElement | lCore.IVue;
|
|
388
|
+
'left'?: number;
|
|
389
|
+
'top'?: number;
|
|
390
|
+
'right'?: number;
|
|
391
|
+
'bottom'?: number;
|
|
392
|
+
'offsetLeft'?: number;
|
|
393
|
+
'offsetTop'?: number;
|
|
394
|
+
'offsetRight'?: number;
|
|
395
|
+
'offsetBottom'?: number;
|
|
396
|
+
'objectLeft'?: number;
|
|
397
|
+
'objectTop'?: number;
|
|
398
|
+
'objectWidth'?: number;
|
|
399
|
+
'objectHeight'?: number;
|
|
400
|
+
'object'?: HTMLElement | lCore.IVue;
|
|
401
|
+
'showRect'?: boolean;
|
|
402
|
+
'cursor'?: string;
|
|
403
|
+
'start'?: (x: number, y: number) => any;
|
|
404
|
+
'move'?: (e: MouseEvent | TouchEvent, opt: IBindMoveMoveOptions) => void;
|
|
405
|
+
'up'?: (moveTimes: Array<{
|
|
406
|
+
'time': number;
|
|
407
|
+
'ox': number;
|
|
408
|
+
'oy': number;
|
|
409
|
+
}>, e: MouseEvent | TouchEvent) => void;
|
|
410
|
+
'end'?: (moveTimes: Array<{
|
|
411
|
+
'time': number;
|
|
412
|
+
'ox': number;
|
|
413
|
+
'oy': number;
|
|
414
|
+
}>, e: MouseEvent | TouchEvent) => void;
|
|
415
|
+
'borderIn'?: (x: number, y: number, border: TDomBorder, e: MouseEvent | TouchEvent) => void;
|
|
416
|
+
'borderOut'?: () => void;
|
|
417
|
+
}
|
|
418
|
+
/** --- 绑定拖动返回值 --- */
|
|
419
|
+
export interface IBindMoveResult {
|
|
420
|
+
'left': number;
|
|
421
|
+
'top': number;
|
|
422
|
+
'right': number;
|
|
423
|
+
'bottom': number;
|
|
424
|
+
}
|
|
425
|
+
/** --- 绑定改变大小选项 --- */
|
|
426
|
+
export interface IBindResizeOptions {
|
|
427
|
+
'objectLeft'?: number;
|
|
428
|
+
'objectTop'?: number;
|
|
429
|
+
'objectWidth'?: number;
|
|
430
|
+
'objectHeight'?: number;
|
|
431
|
+
'object'?: HTMLElement | lCore.IVue;
|
|
432
|
+
'minWidth'?: number;
|
|
433
|
+
'minHeight'?: number;
|
|
434
|
+
'maxWidth'?: number;
|
|
435
|
+
'maxHeight'?: number;
|
|
436
|
+
'border': TDomBorder;
|
|
437
|
+
'start'?: (x: number, y: number) => any;
|
|
438
|
+
'move'?: (left: number, top: number, width: number, height: number, x: number, y: number, border: TDomBorder) => void;
|
|
439
|
+
'end'?: () => void;
|
|
440
|
+
}
|
|
441
|
+
/** --- 监视位置中的元素 --- */
|
|
442
|
+
export interface IWatchPositionItem {
|
|
443
|
+
'el': HTMLElement;
|
|
444
|
+
'rect': DOMRect;
|
|
445
|
+
'handler': (state: {
|
|
446
|
+
'position': boolean;
|
|
447
|
+
'size': boolean;
|
|
448
|
+
}) => void | Promise<void>;
|
|
449
|
+
}
|
|
450
|
+
/** --- 监视大小中的元素 --- */
|
|
451
|
+
export interface IWatchSizeItem {
|
|
452
|
+
'el': HTMLElement;
|
|
453
|
+
'handler': () => void | Promise<void>;
|
|
454
|
+
'taskId': string | null;
|
|
455
|
+
}
|
|
456
|
+
/** --- 监视变化中的元素 --- */
|
|
457
|
+
export interface IWatchItem {
|
|
458
|
+
'el': HTMLElement;
|
|
459
|
+
'mo': MutationObserver;
|
|
460
|
+
'taskId'?: string;
|
|
461
|
+
}
|
|
462
|
+
/** --- 获取当前正在监视中的 property、style 和 position 的元素信息 --- */
|
|
463
|
+
export interface IGetWatchInfoResult {
|
|
464
|
+
'formId': string;
|
|
465
|
+
'default': Record<string, {
|
|
466
|
+
'style': {
|
|
467
|
+
'list': string[];
|
|
468
|
+
'count': number;
|
|
469
|
+
};
|
|
470
|
+
'property': {
|
|
471
|
+
'list': string[];
|
|
472
|
+
'count': number;
|
|
473
|
+
};
|
|
474
|
+
'position': {
|
|
475
|
+
'count': number;
|
|
476
|
+
};
|
|
477
|
+
}>;
|
|
478
|
+
'panels': Record<string, Record<string, {
|
|
479
|
+
'style': {
|
|
480
|
+
'list': string[];
|
|
481
|
+
'count': number;
|
|
482
|
+
};
|
|
483
|
+
'property': {
|
|
484
|
+
'list': string[];
|
|
485
|
+
'count': number;
|
|
486
|
+
};
|
|
487
|
+
'position': {
|
|
488
|
+
'count': number;
|
|
489
|
+
};
|
|
490
|
+
}>>;
|
|
491
|
+
}
|