@whitesev/pops 3.2.0 → 3.2.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/README.md +249 -249
- package/dist/index.amd.js +702 -667
- package/dist/index.amd.js.map +1 -1
- package/dist/index.amd.min.js +1 -1
- package/dist/index.amd.min.js.map +1 -1
- package/dist/index.cjs.js +702 -667
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs.min.js +1 -1
- package/dist/index.cjs.min.js.map +1 -1
- package/dist/index.esm.js +702 -667
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm.min.js +1 -1
- package/dist/index.esm.min.js.map +1 -1
- package/dist/index.iife.js +702 -667
- package/dist/index.iife.js.map +1 -1
- package/dist/index.iife.min.js +1 -1
- package/dist/index.iife.min.js.map +1 -1
- package/dist/index.system.js +702 -667
- package/dist/index.system.js.map +1 -1
- package/dist/index.system.min.js +1 -1
- package/dist/index.system.min.js.map +1 -1
- package/dist/index.umd.js +702 -667
- package/dist/index.umd.js.map +1 -1
- package/dist/index.umd.min.js +1 -1
- package/dist/index.umd.min.js.map +1 -1
- package/dist/types/src/components/folder/types/index.d.ts +43 -13
- package/dist/types/src/types/PopsDOMUtilsEventType.d.ts +313 -313
- package/dist/types/src/types/animation.d.ts +19 -19
- package/dist/types/src/types/button.d.ts +94 -94
- package/dist/types/src/types/components.d.ts +211 -211
- package/dist/types/src/types/event.d.ts +43 -43
- package/dist/types/src/types/global.d.ts +31 -31
- package/dist/types/src/types/icon.d.ts +32 -32
- package/dist/types/src/types/inst.d.ts +28 -28
- package/dist/types/src/types/main.d.ts +66 -66
- package/dist/types/src/types/mask.d.ts +52 -52
- package/dist/types/src/types/position.d.ts +60 -60
- package/package.json +27 -25
- package/src/Pops.ts +206 -206
- package/src/PopsAnimation.ts +32 -32
- package/src/PopsCSS.ts +54 -54
- package/src/PopsCore.ts +37 -37
- package/src/PopsIcon.ts +95 -95
- package/src/PopsInst.ts +21 -21
- package/src/components/alert/defaultConfig.ts +62 -62
- package/src/components/alert/index.ts +163 -163
- package/src/components/alert/types/index.ts +23 -23
- package/src/components/confirm/defaultConfig.ts +90 -90
- package/src/components/confirm/index.ts +165 -165
- package/src/components/confirm/types/index.ts +13 -17
- package/src/components/drawer/defaultConfig.ts +89 -89
- package/src/components/drawer/index.css +37 -37
- package/src/components/drawer/index.ts +245 -245
- package/src/components/drawer/types/index.ts +62 -61
- package/src/components/folder/defaultConfig.ts +151 -151
- package/src/components/folder/folderIcon.ts +28 -28
- package/src/components/folder/index.css +303 -303
- package/src/components/folder/index.ts +953 -932
- package/src/components/folder/types/index.ts +143 -110
- package/src/components/iframe/defaultConfig.ts +60 -60
- package/src/components/iframe/index.css +76 -76
- package/src/components/iframe/index.ts +331 -331
- package/src/components/iframe/types/index.ts +96 -96
- package/src/components/loading/defaultConfig.ts +29 -29
- package/src/components/loading/index.css +66 -66
- package/src/components/loading/index.ts +101 -101
- package/src/components/loading/types/index.ts +36 -34
- package/src/components/panel/css/components-select.css +84 -84
- package/src/components/panel/defaultConfig.ts +868 -868
- package/src/components/panel/handlerComponents.ts +3993 -3993
- package/src/components/panel/index.css +1403 -1401
- package/src/components/panel/index.ts +221 -221
- package/src/components/panel/types/components-button.ts +56 -56
- package/src/components/panel/types/components-common.ts +73 -73
- package/src/components/panel/types/components-container.ts +25 -25
- package/src/components/panel/types/components-deepMenu.ts +64 -64
- package/src/components/panel/types/components-input.ts +90 -90
- package/src/components/panel/types/components-own.ts +16 -16
- package/src/components/panel/types/components-select.ts +169 -169
- package/src/components/panel/types/components-selectMultiple.ts +105 -104
- package/src/components/panel/types/components-slider.ts +55 -55
- package/src/components/panel/types/components-switch.ts +33 -33
- package/src/components/panel/types/components-textarea.ts +45 -45
- package/src/components/panel/types/index.ts +244 -244
- package/src/components/prompt/defaultConfig.ts +94 -94
- package/src/components/prompt/index.css +34 -34
- package/src/components/prompt/index.ts +187 -215
- package/src/components/prompt/types/index.ts +57 -56
- package/src/components/rightClickMenu/defaultConfig.ts +103 -103
- package/src/components/rightClickMenu/index.css +115 -115
- package/src/components/rightClickMenu/index.ts +662 -662
- package/src/components/rightClickMenu/types/index.ts +145 -143
- package/src/components/searchSuggestion/defaultConfig.ts +63 -63
- package/src/components/searchSuggestion/index.ts +813 -813
- package/src/components/searchSuggestion/types/index.ts +244 -242
- package/src/components/tooltip/defaultConfig.ts +33 -33
- package/src/components/tooltip/index.css +199 -199
- package/src/components/tooltip/index.ts +617 -617
- package/src/components/tooltip/types/index.ts +123 -121
- package/src/config/CommonCSSClassName.ts +17 -17
- package/src/config/GlobalConfig.ts +63 -63
- package/src/css/animation.css +987 -987
- package/src/css/button.css +551 -551
- package/src/css/common.css +54 -54
- package/src/css/index.css +253 -253
- package/src/css/ninePalaceGridPosition.css +50 -50
- package/src/css/scrollbar.css +22 -22
- package/src/handler/PopsElementHandler.ts +303 -303
- package/src/handler/PopsHandler.ts +611 -611
- package/src/types/PopsDOMUtilsEventType.d.ts +313 -313
- package/src/types/animation.d.ts +19 -19
- package/src/types/button.d.ts +94 -94
- package/src/types/components.d.ts +211 -211
- package/src/types/event.d.ts +43 -43
- package/src/types/global.d.ts +31 -31
- package/src/types/icon.d.ts +32 -32
- package/src/types/inst.d.ts +28 -28
- package/src/types/main.d.ts +66 -66
- package/src/types/mask.d.ts +52 -52
- package/src/types/position.d.ts +60 -60
- package/src/utils/PopsDOMUtils.ts +2483 -2483
- package/src/utils/PopsDOMUtilsEventsConfig.ts +4 -4
- package/src/utils/PopsInstanceUtils.ts +714 -714
- package/src/utils/PopsMathUtils.ts +71 -71
- package/src/utils/PopsSafeUtils.ts +22 -22
- package/src/utils/PopsUtils.ts +421 -421
|
@@ -1,313 +1,313 @@
|
|
|
1
|
-
export type PopsDOMUtilsEventObject<T extends Node> = Event & {
|
|
2
|
-
target: T;
|
|
3
|
-
};
|
|
4
|
-
|
|
5
|
-
export type PopsDOMUtilsCreateElementAttributesMap = {
|
|
6
|
-
style?: string;
|
|
7
|
-
id?: string;
|
|
8
|
-
class?: string;
|
|
9
|
-
"data-"?: string;
|
|
10
|
-
type?: string;
|
|
11
|
-
[key: string]: any;
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* 鼠标事件
|
|
15
|
-
* + https://blog.csdn.net/weixin_68658847/article/details/126939879
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
export interface PopsDOMUtils_MouseEvent {
|
|
19
|
-
click: MouseEvent | PointerEvent;
|
|
20
|
-
contextmenu: MouseEvent | PointerEvent;
|
|
21
|
-
dblclick: MouseEvent | PointerEvent;
|
|
22
|
-
mousedown: MouseEvent | PointerEvent;
|
|
23
|
-
mouseenter: MouseEvent | PointerEvent;
|
|
24
|
-
mouseleave: MouseEvent | PointerEvent;
|
|
25
|
-
mousemove: MouseEvent | PointerEvent;
|
|
26
|
-
mouseover: MouseEvent | PointerEvent;
|
|
27
|
-
mouseout: MouseEvent | PointerEvent;
|
|
28
|
-
mouseup: MouseEvent | PointerEvent;
|
|
29
|
-
hover: MouseEvent;
|
|
30
|
-
}
|
|
31
|
-
export type PopsDOMUtils_MouseEventType = keyof PopsDOMUtils_MouseEvent;
|
|
32
|
-
/**
|
|
33
|
-
* 鼠标事件
|
|
34
|
-
*/
|
|
35
|
-
export interface PopsDOMUtils_KeyboardEvent {
|
|
36
|
-
keydown: KeyboardEvent;
|
|
37
|
-
keypress: KeyboardEvent;
|
|
38
|
-
keyup: KeyboardEvent;
|
|
39
|
-
}
|
|
40
|
-
export type PopsDOMUtils_KeyboardEventType = keyof PopsDOMUtils_KeyboardEvent;
|
|
41
|
-
/**
|
|
42
|
-
* 框架/对象事件
|
|
43
|
-
*/
|
|
44
|
-
export interface PopsDOMUtils_Frame_Object_Event {
|
|
45
|
-
abort: Event;
|
|
46
|
-
beforeunload: Event;
|
|
47
|
-
error: Event;
|
|
48
|
-
hashchange: Event;
|
|
49
|
-
load: Event;
|
|
50
|
-
pageshow: Event;
|
|
51
|
-
pagehide: Event;
|
|
52
|
-
resize: Event;
|
|
53
|
-
scroll: Event;
|
|
54
|
-
unload: Event;
|
|
55
|
-
}
|
|
56
|
-
export type PopsDOMUtils_Frame_Object_EventType = keyof PopsDOMUtils_Frame_Object_Event;
|
|
57
|
-
/**
|
|
58
|
-
* 表单事件
|
|
59
|
-
*/
|
|
60
|
-
export interface PopsDOMUtils_FormEvent {
|
|
61
|
-
blur: Event;
|
|
62
|
-
change: Event;
|
|
63
|
-
focus: Event;
|
|
64
|
-
focusin: Event;
|
|
65
|
-
focusout: Event;
|
|
66
|
-
input: Event;
|
|
67
|
-
reset: Event;
|
|
68
|
-
search: Event;
|
|
69
|
-
}
|
|
70
|
-
export type PopsDOMUtils_FormEventType = keyof PopsDOMUtils_FormEvent;
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* 剪贴板事件
|
|
74
|
-
*/
|
|
75
|
-
export interface PopsDOMUtils_ClipboardEvent {
|
|
76
|
-
copy: ClipboardEvent;
|
|
77
|
-
cut: ClipboardEvent;
|
|
78
|
-
paste: ClipboardEvent;
|
|
79
|
-
}
|
|
80
|
-
export type PopsDOMUtils_ClipboardEventType = keyof PopsDOMUtils_ClipboardEvent;
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* 打印事件
|
|
84
|
-
*/
|
|
85
|
-
export interface PopsDOMUtils_PrintEvent {
|
|
86
|
-
afterprint: Event;
|
|
87
|
-
beforeprint: Event;
|
|
88
|
-
}
|
|
89
|
-
export type PopsDOMUtils_PrintEventType = keyof PopsDOMUtils_PrintEvent;
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* 拖动事件
|
|
93
|
-
*/
|
|
94
|
-
export interface PopsDOMUtils_DragEvent {
|
|
95
|
-
drag: DragEvent;
|
|
96
|
-
dragend: DragEvent;
|
|
97
|
-
dragenter: DragEvent;
|
|
98
|
-
dragleave: DragEvent;
|
|
99
|
-
dragover: DragEvent;
|
|
100
|
-
dragstart: DragEvent;
|
|
101
|
-
drop: DragEvent;
|
|
102
|
-
}
|
|
103
|
-
export type PopsDOMUtils_DragEventType = keyof PopsDOMUtils_DragEvent;
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* 多媒体(Media)事件
|
|
107
|
-
*/
|
|
108
|
-
export interface PopsDOMUtils_MediaEvent {
|
|
109
|
-
abort: Event;
|
|
110
|
-
canplay: Event;
|
|
111
|
-
canplaythrough: Event;
|
|
112
|
-
durationchange: Event;
|
|
113
|
-
emptied: Event;
|
|
114
|
-
ended: Event;
|
|
115
|
-
error: Event;
|
|
116
|
-
loadeddata: Event;
|
|
117
|
-
loadedmetadata: Event;
|
|
118
|
-
loadstart: Event;
|
|
119
|
-
pause: Event;
|
|
120
|
-
play: Event;
|
|
121
|
-
playing: Event;
|
|
122
|
-
progress: Event;
|
|
123
|
-
ratechange: Event;
|
|
124
|
-
seeked: Event;
|
|
125
|
-
seeking: Event;
|
|
126
|
-
stalled: Event;
|
|
127
|
-
suspend: Event;
|
|
128
|
-
timeupdate: Event;
|
|
129
|
-
volumechange: Event;
|
|
130
|
-
waiting: Event;
|
|
131
|
-
}
|
|
132
|
-
export type PopsDOMUtils_MediaEventType = keyof PopsDOMUtils_MediaEvent;
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* 动画事件
|
|
136
|
-
*/
|
|
137
|
-
export interface PopsDOMUtils_AnimationEvent {
|
|
138
|
-
animationend: AnimationEvent;
|
|
139
|
-
animationiteration: AnimationEvent;
|
|
140
|
-
animationstart: AnimationEvent;
|
|
141
|
-
}
|
|
142
|
-
export type PopsDOMUtils_AnimationEventType = keyof PopsDOMUtils_AnimationEvent;
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* 过渡事件
|
|
146
|
-
*/
|
|
147
|
-
export interface PopsDOMUtils_TransitionEvent {
|
|
148
|
-
transitionend: TransitionEvent;
|
|
149
|
-
}
|
|
150
|
-
export type PopsDOMUtils_TransitionEventType = keyof PopsDOMUtils_TransitionEvent;
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* 触摸事件
|
|
154
|
-
*/
|
|
155
|
-
export interface PopsDOMUtils_TouchEvent {
|
|
156
|
-
touchstart: TouchEvent;
|
|
157
|
-
touchmove: TouchEvent;
|
|
158
|
-
touchend: TouchEvent;
|
|
159
|
-
touchcancel: TouchEvent;
|
|
160
|
-
touchenter: TouchEvent;
|
|
161
|
-
touchleave: TouchEvent;
|
|
162
|
-
}
|
|
163
|
-
export type PopsDOMUtils_TouchEventType = keyof PopsDOMUtils_TouchEvent;
|
|
164
|
-
/**
|
|
165
|
-
* 其它事件
|
|
166
|
-
*/
|
|
167
|
-
export interface PopsDOMUtils_OtherEvent {
|
|
168
|
-
message: Event;
|
|
169
|
-
online: Event;
|
|
170
|
-
offline: Event;
|
|
171
|
-
popstate: Event;
|
|
172
|
-
show: Event;
|
|
173
|
-
storage: Event;
|
|
174
|
-
toggle: Event;
|
|
175
|
-
wheel: Event;
|
|
176
|
-
propertychange: Event;
|
|
177
|
-
fullscreenchange: Event;
|
|
178
|
-
DOMContentLoaded: Event;
|
|
179
|
-
}
|
|
180
|
-
export type PopsDOMUtils_OtherEventType = keyof PopsDOMUtils_OtherEvent;
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* 全部事件
|
|
184
|
-
*/
|
|
185
|
-
export type PopsDOMUtils_Event = PopsDOMUtils_MouseEvent &
|
|
186
|
-
PopsDOMUtils_KeyboardEvent &
|
|
187
|
-
PopsDOMUtils_Frame_Object_Event &
|
|
188
|
-
PopsDOMUtils_FormEvent &
|
|
189
|
-
PopsDOMUtils_ClipboardEvent &
|
|
190
|
-
PopsDOMUtils_PrintEvent &
|
|
191
|
-
PopsDOMUtils_DragEvent &
|
|
192
|
-
PopsDOMUtils_MediaEvent &
|
|
193
|
-
PopsDOMUtils_AnimationEvent &
|
|
194
|
-
PopsDOMUtils_TransitionEvent &
|
|
195
|
-
PopsDOMUtils_TouchEvent &
|
|
196
|
-
PopsDOMUtils_OtherEvent;
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
* 事件类型
|
|
200
|
-
*/
|
|
201
|
-
export type PopsDOMUtils_EventType = keyof PopsDOMUtils_Event;
|
|
202
|
-
|
|
203
|
-
/**
|
|
204
|
-
* 元素上的events属性
|
|
205
|
-
*/
|
|
206
|
-
export declare interface PopsDOMUtilsEventListenerOptionsAttribute {
|
|
207
|
-
/**
|
|
208
|
-
* DOMUtils的ownCallBack,元素上的监听事件就是它,移除事件时也需要传入这个函数
|
|
209
|
-
*/
|
|
210
|
-
callback: (event: Event) => void;
|
|
211
|
-
/**
|
|
212
|
-
* 属性配置
|
|
213
|
-
*/
|
|
214
|
-
option: PopsDOMUtilsEventListenerOption;
|
|
215
|
-
/**
|
|
216
|
-
* 用户添加的事件
|
|
217
|
-
*/
|
|
218
|
-
originCallBack: (event: Event, selectorTarget?: HTMLElement) => void;
|
|
219
|
-
/**
|
|
220
|
-
* 子元素选择器
|
|
221
|
-
*/
|
|
222
|
-
selector?: string[];
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
export type PopsDOMUtilsElementEventType =
|
|
226
|
-
| HTMLElement
|
|
227
|
-
| string
|
|
228
|
-
| NodeList
|
|
229
|
-
| (HTMLElement | Window | Document | Element | typeof globalThis)[]
|
|
230
|
-
| Window
|
|
231
|
-
| Document
|
|
232
|
-
| Element
|
|
233
|
-
| null
|
|
234
|
-
| typeof globalThis
|
|
235
|
-
| ShadowRoot
|
|
236
|
-
| EventTarget
|
|
237
|
-
| ChildNode
|
|
238
|
-
| Node;
|
|
239
|
-
|
|
240
|
-
/**
|
|
241
|
-
* 通过.on执行后的返回值
|
|
242
|
-
*/
|
|
243
|
-
export declare interface PopsDOMUtilsAddEventListenerResult {
|
|
244
|
-
/**
|
|
245
|
-
* 取消绑定的监听事件
|
|
246
|
-
* @param filter (可选)过滤函数,对元素属性上的事件进行过滤出想要删除的事件
|
|
247
|
-
*/
|
|
248
|
-
off(
|
|
249
|
-
filter?: (
|
|
250
|
-
value: PopsDOMUtilsEventListenerOptionsAttribute,
|
|
251
|
-
index: number,
|
|
252
|
-
array: PopsDOMUtilsEventListenerOptionsAttribute[]
|
|
253
|
-
) => boolean
|
|
254
|
-
): void;
|
|
255
|
-
/**
|
|
256
|
-
* 主动触发事件
|
|
257
|
-
* @param details 赋予触发的Event的额外属性,如果是Event类型,那么将自动代替默认new的Event对象
|
|
258
|
-
* @param useDispatchToEmit 是否使用dispatchEvent来触发事件,默认true,如果为false,则直接调用callback,但是这种会让使用了selectorTarget的没有值
|
|
259
|
-
*/
|
|
260
|
-
emit(details?: object, useDispatchToEmit?: boolean): void;
|
|
261
|
-
}
|
|
262
|
-
export type ParseHTMLReturnType<T1, T2> = T1 extends true ? (T2 extends true ? Document : HTMLElement) : HTMLElement;
|
|
263
|
-
|
|
264
|
-
/**
|
|
265
|
-
* 事件的额外配置
|
|
266
|
-
*/
|
|
267
|
-
export declare type PopsDOMUtilsEventListenerOption = AddEventListenerOptions & {
|
|
268
|
-
/**
|
|
269
|
-
* 是否使用 event.composedPath() 来代替 event.target
|
|
270
|
-
*
|
|
271
|
-
* 一般用于设置了selector参数
|
|
272
|
-
*/
|
|
273
|
-
isComposedPath?: boolean;
|
|
274
|
-
};
|
|
275
|
-
|
|
276
|
-
export type PopsDOMUtilsTargetElementType = HTMLElement | string | NodeList | HTMLElement[];
|
|
277
|
-
|
|
278
|
-
/**
|
|
279
|
-
* 属性转驼峰
|
|
280
|
-
*/
|
|
281
|
-
export type PopsDOMUtilsCamelToKebabCSSProperty<S extends string> = S extends `webkit${infer U}`
|
|
282
|
-
? `-${Lowercase<"webkit">}${U extends `${infer First}${infer Rest}`
|
|
283
|
-
? First extends Uppercase<First>
|
|
284
|
-
? `-${Uncapitalize<First>}${PopsDOMUtilsCamelToKebabCSSProperty<Rest>}`
|
|
285
|
-
: `${First}${PopsDOMUtilsCamelToKebabCSSProperty<Rest>}`
|
|
286
|
-
: U}`
|
|
287
|
-
: S extends `${infer T}${infer U}`
|
|
288
|
-
? U extends Uncapitalize<U>
|
|
289
|
-
? `${Uncapitalize<T>}${PopsDOMUtilsCamelToKebabCSSProperty<U>}`
|
|
290
|
-
: `${Uncapitalize<T>}-${PopsDOMUtilsCamelToKebabCSSProperty<U>}`
|
|
291
|
-
: S;
|
|
292
|
-
|
|
293
|
-
export type PopsDOMUtilsCSSPropertyType = PopsDOMUtilsCamelToKebabCSSProperty<
|
|
294
|
-
Extract<
|
|
295
|
-
keyof Omit<
|
|
296
|
-
CSSStyleDeclaration,
|
|
297
|
-
| "cssFloat"
|
|
298
|
-
| "cssText"
|
|
299
|
-
| "length"
|
|
300
|
-
| "parentRule"
|
|
301
|
-
| "getPropertyPriority"
|
|
302
|
-
| "getPropertyValue"
|
|
303
|
-
| "item"
|
|
304
|
-
| "removeProperty"
|
|
305
|
-
| "setProperty"
|
|
306
|
-
>,
|
|
307
|
-
string
|
|
308
|
-
>
|
|
309
|
-
>;
|
|
310
|
-
|
|
311
|
-
export type PopsDOMUtilsCSSProperty = {
|
|
312
|
-
[P in PopsDOMUtilsCSSPropertyType]: string | number;
|
|
313
|
-
};
|
|
1
|
+
export type PopsDOMUtilsEventObject<T extends Node> = Event & {
|
|
2
|
+
target: T;
|
|
3
|
+
};
|
|
4
|
+
|
|
5
|
+
export type PopsDOMUtilsCreateElementAttributesMap = {
|
|
6
|
+
style?: string;
|
|
7
|
+
id?: string;
|
|
8
|
+
class?: string;
|
|
9
|
+
"data-"?: string;
|
|
10
|
+
type?: string;
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* 鼠标事件
|
|
15
|
+
* + https://blog.csdn.net/weixin_68658847/article/details/126939879
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
export interface PopsDOMUtils_MouseEvent {
|
|
19
|
+
click: MouseEvent | PointerEvent;
|
|
20
|
+
contextmenu: MouseEvent | PointerEvent;
|
|
21
|
+
dblclick: MouseEvent | PointerEvent;
|
|
22
|
+
mousedown: MouseEvent | PointerEvent;
|
|
23
|
+
mouseenter: MouseEvent | PointerEvent;
|
|
24
|
+
mouseleave: MouseEvent | PointerEvent;
|
|
25
|
+
mousemove: MouseEvent | PointerEvent;
|
|
26
|
+
mouseover: MouseEvent | PointerEvent;
|
|
27
|
+
mouseout: MouseEvent | PointerEvent;
|
|
28
|
+
mouseup: MouseEvent | PointerEvent;
|
|
29
|
+
hover: MouseEvent;
|
|
30
|
+
}
|
|
31
|
+
export type PopsDOMUtils_MouseEventType = keyof PopsDOMUtils_MouseEvent;
|
|
32
|
+
/**
|
|
33
|
+
* 鼠标事件
|
|
34
|
+
*/
|
|
35
|
+
export interface PopsDOMUtils_KeyboardEvent {
|
|
36
|
+
keydown: KeyboardEvent;
|
|
37
|
+
keypress: KeyboardEvent;
|
|
38
|
+
keyup: KeyboardEvent;
|
|
39
|
+
}
|
|
40
|
+
export type PopsDOMUtils_KeyboardEventType = keyof PopsDOMUtils_KeyboardEvent;
|
|
41
|
+
/**
|
|
42
|
+
* 框架/对象事件
|
|
43
|
+
*/
|
|
44
|
+
export interface PopsDOMUtils_Frame_Object_Event {
|
|
45
|
+
abort: Event;
|
|
46
|
+
beforeunload: Event;
|
|
47
|
+
error: Event;
|
|
48
|
+
hashchange: Event;
|
|
49
|
+
load: Event;
|
|
50
|
+
pageshow: Event;
|
|
51
|
+
pagehide: Event;
|
|
52
|
+
resize: Event;
|
|
53
|
+
scroll: Event;
|
|
54
|
+
unload: Event;
|
|
55
|
+
}
|
|
56
|
+
export type PopsDOMUtils_Frame_Object_EventType = keyof PopsDOMUtils_Frame_Object_Event;
|
|
57
|
+
/**
|
|
58
|
+
* 表单事件
|
|
59
|
+
*/
|
|
60
|
+
export interface PopsDOMUtils_FormEvent {
|
|
61
|
+
blur: Event;
|
|
62
|
+
change: Event;
|
|
63
|
+
focus: Event;
|
|
64
|
+
focusin: Event;
|
|
65
|
+
focusout: Event;
|
|
66
|
+
input: Event;
|
|
67
|
+
reset: Event;
|
|
68
|
+
search: Event;
|
|
69
|
+
}
|
|
70
|
+
export type PopsDOMUtils_FormEventType = keyof PopsDOMUtils_FormEvent;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* 剪贴板事件
|
|
74
|
+
*/
|
|
75
|
+
export interface PopsDOMUtils_ClipboardEvent {
|
|
76
|
+
copy: ClipboardEvent;
|
|
77
|
+
cut: ClipboardEvent;
|
|
78
|
+
paste: ClipboardEvent;
|
|
79
|
+
}
|
|
80
|
+
export type PopsDOMUtils_ClipboardEventType = keyof PopsDOMUtils_ClipboardEvent;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* 打印事件
|
|
84
|
+
*/
|
|
85
|
+
export interface PopsDOMUtils_PrintEvent {
|
|
86
|
+
afterprint: Event;
|
|
87
|
+
beforeprint: Event;
|
|
88
|
+
}
|
|
89
|
+
export type PopsDOMUtils_PrintEventType = keyof PopsDOMUtils_PrintEvent;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* 拖动事件
|
|
93
|
+
*/
|
|
94
|
+
export interface PopsDOMUtils_DragEvent {
|
|
95
|
+
drag: DragEvent;
|
|
96
|
+
dragend: DragEvent;
|
|
97
|
+
dragenter: DragEvent;
|
|
98
|
+
dragleave: DragEvent;
|
|
99
|
+
dragover: DragEvent;
|
|
100
|
+
dragstart: DragEvent;
|
|
101
|
+
drop: DragEvent;
|
|
102
|
+
}
|
|
103
|
+
export type PopsDOMUtils_DragEventType = keyof PopsDOMUtils_DragEvent;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* 多媒体(Media)事件
|
|
107
|
+
*/
|
|
108
|
+
export interface PopsDOMUtils_MediaEvent {
|
|
109
|
+
abort: Event;
|
|
110
|
+
canplay: Event;
|
|
111
|
+
canplaythrough: Event;
|
|
112
|
+
durationchange: Event;
|
|
113
|
+
emptied: Event;
|
|
114
|
+
ended: Event;
|
|
115
|
+
error: Event;
|
|
116
|
+
loadeddata: Event;
|
|
117
|
+
loadedmetadata: Event;
|
|
118
|
+
loadstart: Event;
|
|
119
|
+
pause: Event;
|
|
120
|
+
play: Event;
|
|
121
|
+
playing: Event;
|
|
122
|
+
progress: Event;
|
|
123
|
+
ratechange: Event;
|
|
124
|
+
seeked: Event;
|
|
125
|
+
seeking: Event;
|
|
126
|
+
stalled: Event;
|
|
127
|
+
suspend: Event;
|
|
128
|
+
timeupdate: Event;
|
|
129
|
+
volumechange: Event;
|
|
130
|
+
waiting: Event;
|
|
131
|
+
}
|
|
132
|
+
export type PopsDOMUtils_MediaEventType = keyof PopsDOMUtils_MediaEvent;
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* 动画事件
|
|
136
|
+
*/
|
|
137
|
+
export interface PopsDOMUtils_AnimationEvent {
|
|
138
|
+
animationend: AnimationEvent;
|
|
139
|
+
animationiteration: AnimationEvent;
|
|
140
|
+
animationstart: AnimationEvent;
|
|
141
|
+
}
|
|
142
|
+
export type PopsDOMUtils_AnimationEventType = keyof PopsDOMUtils_AnimationEvent;
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* 过渡事件
|
|
146
|
+
*/
|
|
147
|
+
export interface PopsDOMUtils_TransitionEvent {
|
|
148
|
+
transitionend: TransitionEvent;
|
|
149
|
+
}
|
|
150
|
+
export type PopsDOMUtils_TransitionEventType = keyof PopsDOMUtils_TransitionEvent;
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* 触摸事件
|
|
154
|
+
*/
|
|
155
|
+
export interface PopsDOMUtils_TouchEvent {
|
|
156
|
+
touchstart: TouchEvent;
|
|
157
|
+
touchmove: TouchEvent;
|
|
158
|
+
touchend: TouchEvent;
|
|
159
|
+
touchcancel: TouchEvent;
|
|
160
|
+
touchenter: TouchEvent;
|
|
161
|
+
touchleave: TouchEvent;
|
|
162
|
+
}
|
|
163
|
+
export type PopsDOMUtils_TouchEventType = keyof PopsDOMUtils_TouchEvent;
|
|
164
|
+
/**
|
|
165
|
+
* 其它事件
|
|
166
|
+
*/
|
|
167
|
+
export interface PopsDOMUtils_OtherEvent {
|
|
168
|
+
message: Event;
|
|
169
|
+
online: Event;
|
|
170
|
+
offline: Event;
|
|
171
|
+
popstate: Event;
|
|
172
|
+
show: Event;
|
|
173
|
+
storage: Event;
|
|
174
|
+
toggle: Event;
|
|
175
|
+
wheel: Event;
|
|
176
|
+
propertychange: Event;
|
|
177
|
+
fullscreenchange: Event;
|
|
178
|
+
DOMContentLoaded: Event;
|
|
179
|
+
}
|
|
180
|
+
export type PopsDOMUtils_OtherEventType = keyof PopsDOMUtils_OtherEvent;
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* 全部事件
|
|
184
|
+
*/
|
|
185
|
+
export type PopsDOMUtils_Event = PopsDOMUtils_MouseEvent &
|
|
186
|
+
PopsDOMUtils_KeyboardEvent &
|
|
187
|
+
PopsDOMUtils_Frame_Object_Event &
|
|
188
|
+
PopsDOMUtils_FormEvent &
|
|
189
|
+
PopsDOMUtils_ClipboardEvent &
|
|
190
|
+
PopsDOMUtils_PrintEvent &
|
|
191
|
+
PopsDOMUtils_DragEvent &
|
|
192
|
+
PopsDOMUtils_MediaEvent &
|
|
193
|
+
PopsDOMUtils_AnimationEvent &
|
|
194
|
+
PopsDOMUtils_TransitionEvent &
|
|
195
|
+
PopsDOMUtils_TouchEvent &
|
|
196
|
+
PopsDOMUtils_OtherEvent;
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* 事件类型
|
|
200
|
+
*/
|
|
201
|
+
export type PopsDOMUtils_EventType = keyof PopsDOMUtils_Event;
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* 元素上的events属性
|
|
205
|
+
*/
|
|
206
|
+
export declare interface PopsDOMUtilsEventListenerOptionsAttribute {
|
|
207
|
+
/**
|
|
208
|
+
* DOMUtils的ownCallBack,元素上的监听事件就是它,移除事件时也需要传入这个函数
|
|
209
|
+
*/
|
|
210
|
+
callback: (event: Event) => void;
|
|
211
|
+
/**
|
|
212
|
+
* 属性配置
|
|
213
|
+
*/
|
|
214
|
+
option: PopsDOMUtilsEventListenerOption;
|
|
215
|
+
/**
|
|
216
|
+
* 用户添加的事件
|
|
217
|
+
*/
|
|
218
|
+
originCallBack: (event: Event, selectorTarget?: HTMLElement) => void;
|
|
219
|
+
/**
|
|
220
|
+
* 子元素选择器
|
|
221
|
+
*/
|
|
222
|
+
selector?: string[];
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
export type PopsDOMUtilsElementEventType =
|
|
226
|
+
| HTMLElement
|
|
227
|
+
| string
|
|
228
|
+
| NodeList
|
|
229
|
+
| (HTMLElement | Window | Document | Element | typeof globalThis)[]
|
|
230
|
+
| Window
|
|
231
|
+
| Document
|
|
232
|
+
| Element
|
|
233
|
+
| null
|
|
234
|
+
| typeof globalThis
|
|
235
|
+
| ShadowRoot
|
|
236
|
+
| EventTarget
|
|
237
|
+
| ChildNode
|
|
238
|
+
| Node;
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* 通过.on执行后的返回值
|
|
242
|
+
*/
|
|
243
|
+
export declare interface PopsDOMUtilsAddEventListenerResult {
|
|
244
|
+
/**
|
|
245
|
+
* 取消绑定的监听事件
|
|
246
|
+
* @param filter (可选)过滤函数,对元素属性上的事件进行过滤出想要删除的事件
|
|
247
|
+
*/
|
|
248
|
+
off(
|
|
249
|
+
filter?: (
|
|
250
|
+
value: PopsDOMUtilsEventListenerOptionsAttribute,
|
|
251
|
+
index: number,
|
|
252
|
+
array: PopsDOMUtilsEventListenerOptionsAttribute[]
|
|
253
|
+
) => boolean
|
|
254
|
+
): void;
|
|
255
|
+
/**
|
|
256
|
+
* 主动触发事件
|
|
257
|
+
* @param details 赋予触发的Event的额外属性,如果是Event类型,那么将自动代替默认new的Event对象
|
|
258
|
+
* @param useDispatchToEmit 是否使用dispatchEvent来触发事件,默认true,如果为false,则直接调用callback,但是这种会让使用了selectorTarget的没有值
|
|
259
|
+
*/
|
|
260
|
+
emit(details?: object, useDispatchToEmit?: boolean): void;
|
|
261
|
+
}
|
|
262
|
+
export type ParseHTMLReturnType<T1, T2> = T1 extends true ? (T2 extends true ? Document : HTMLElement) : HTMLElement;
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* 事件的额外配置
|
|
266
|
+
*/
|
|
267
|
+
export declare type PopsDOMUtilsEventListenerOption = AddEventListenerOptions & {
|
|
268
|
+
/**
|
|
269
|
+
* 是否使用 event.composedPath() 来代替 event.target
|
|
270
|
+
*
|
|
271
|
+
* 一般用于设置了selector参数
|
|
272
|
+
*/
|
|
273
|
+
isComposedPath?: boolean;
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
export type PopsDOMUtilsTargetElementType = HTMLElement | string | NodeList | HTMLElement[];
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* 属性转驼峰
|
|
280
|
+
*/
|
|
281
|
+
export type PopsDOMUtilsCamelToKebabCSSProperty<S extends string> = S extends `webkit${infer U}`
|
|
282
|
+
? `-${Lowercase<"webkit">}${U extends `${infer First}${infer Rest}`
|
|
283
|
+
? First extends Uppercase<First>
|
|
284
|
+
? `-${Uncapitalize<First>}${PopsDOMUtilsCamelToKebabCSSProperty<Rest>}`
|
|
285
|
+
: `${First}${PopsDOMUtilsCamelToKebabCSSProperty<Rest>}`
|
|
286
|
+
: U}`
|
|
287
|
+
: S extends `${infer T}${infer U}`
|
|
288
|
+
? U extends Uncapitalize<U>
|
|
289
|
+
? `${Uncapitalize<T>}${PopsDOMUtilsCamelToKebabCSSProperty<U>}`
|
|
290
|
+
: `${Uncapitalize<T>}-${PopsDOMUtilsCamelToKebabCSSProperty<U>}`
|
|
291
|
+
: S;
|
|
292
|
+
|
|
293
|
+
export type PopsDOMUtilsCSSPropertyType = PopsDOMUtilsCamelToKebabCSSProperty<
|
|
294
|
+
Extract<
|
|
295
|
+
keyof Omit<
|
|
296
|
+
CSSStyleDeclaration,
|
|
297
|
+
| "cssFloat"
|
|
298
|
+
| "cssText"
|
|
299
|
+
| "length"
|
|
300
|
+
| "parentRule"
|
|
301
|
+
| "getPropertyPriority"
|
|
302
|
+
| "getPropertyValue"
|
|
303
|
+
| "item"
|
|
304
|
+
| "removeProperty"
|
|
305
|
+
| "setProperty"
|
|
306
|
+
>,
|
|
307
|
+
string
|
|
308
|
+
>
|
|
309
|
+
>;
|
|
310
|
+
|
|
311
|
+
export type PopsDOMUtilsCSSProperty = {
|
|
312
|
+
[P in PopsDOMUtilsCSSPropertyType]: string | number;
|
|
313
|
+
};
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 动画
|
|
3
|
-
*/
|
|
4
|
-
export type PopsAnimation =
|
|
5
|
-
| "pops-anim-spread"
|
|
6
|
-
| "pops-anim-shake"
|
|
7
|
-
| "pops-anim-rolling-left"
|
|
8
|
-
| "pops-anim-rolling-right"
|
|
9
|
-
| "pops-anim-slide-top"
|
|
10
|
-
| "pops-anim-slide-bottom"
|
|
11
|
-
| "pops-anim-slide-left"
|
|
12
|
-
| "pops-anim-slide-right"
|
|
13
|
-
| "pops-anim-fadein"
|
|
14
|
-
| "pops-anim-fadein-zoom"
|
|
15
|
-
| "pops-anim-fadein-alert"
|
|
16
|
-
| "pops-anim-don"
|
|
17
|
-
| "pops-anim-roll"
|
|
18
|
-
| "pops-anim-sandra"
|
|
19
|
-
| "pops-anim-gather";
|
|
1
|
+
/**
|
|
2
|
+
* 动画
|
|
3
|
+
*/
|
|
4
|
+
export type PopsAnimation =
|
|
5
|
+
| "pops-anim-spread"
|
|
6
|
+
| "pops-anim-shake"
|
|
7
|
+
| "pops-anim-rolling-left"
|
|
8
|
+
| "pops-anim-rolling-right"
|
|
9
|
+
| "pops-anim-slide-top"
|
|
10
|
+
| "pops-anim-slide-bottom"
|
|
11
|
+
| "pops-anim-slide-left"
|
|
12
|
+
| "pops-anim-slide-right"
|
|
13
|
+
| "pops-anim-fadein"
|
|
14
|
+
| "pops-anim-fadein-zoom"
|
|
15
|
+
| "pops-anim-fadein-alert"
|
|
16
|
+
| "pops-anim-don"
|
|
17
|
+
| "pops-anim-roll"
|
|
18
|
+
| "pops-anim-sandra"
|
|
19
|
+
| "pops-anim-gather";
|