@whitesev/pops 1.0.1 → 1.2.0
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/index.amd.js +44 -34
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +44 -34
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +44 -34
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +44 -34
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +44 -34
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +44 -34
- package/dist/index.umd.js.map +1 -1
- package/dist/types/src/Pops.d.ts +29 -0
- package/dist/types/src/utils/PopsDOMUtils.d.ts +333 -1
- package/dist/types/src/utils/{PopsUIUtils.d.ts → PopsInstanceUtils.d.ts} +3 -3
- package/package.json +41 -41
- package/dist/types/src/utils/PopsDOMUtilsEvent.d.ts +0 -334
package/dist/types/src/Pops.d.ts
CHANGED
|
@@ -138,6 +138,35 @@ declare class Pops {
|
|
|
138
138
|
preventEvent(event: Event): boolean;
|
|
139
139
|
preventEvent(element: HTMLElement, eventNameList?: string | string[], capture?: boolean): boolean;
|
|
140
140
|
};
|
|
141
|
+
/** pops创建的实例使用的工具类 */
|
|
142
|
+
InstanceUtils: {
|
|
143
|
+
getPopsMaxZIndex(defaultValue: number): {
|
|
144
|
+
zIndex: number;
|
|
145
|
+
animElement: HTMLDivElement;
|
|
146
|
+
};
|
|
147
|
+
getKeyFrames(sheet: CSSStyleSheet): {};
|
|
148
|
+
removeInstance(moreLayerConfigList: PopsLayerCommonConfig[][], guid: string, isAll?: boolean): PopsLayerCommonConfig[][];
|
|
149
|
+
hide(popsType: PopsLayerMode, layerConfigList: PopsLayerCommonConfig[], guid: string, config: PopsAlertDetails | PopsDrawerDetails | PopsPromptDetails | PopsConfirmDetails | PopsIframeDetails | PopsLoadingDetails | PopsPanelDetails | PopsFolderDetails, animElement: HTMLElement, maskElement: HTMLElement): void;
|
|
150
|
+
show(popsType: PopsLayerMode, layerConfigList: PopsLayerCommonConfig[], guid: string, config: PopsAlertDetails | PopsDrawerDetails | PopsPromptDetails | PopsConfirmDetails | PopsIframeDetails | PopsLoadingDetails | PopsPanelDetails | PopsFolderDetails, animElement: HTMLElement, maskElement: HTMLElement): void;
|
|
151
|
+
close(popsType: string, layerConfigList: PopsLayerCommonConfig[], guid: string, config: PopsAlertDetails | PopsDrawerDetails | PopsPromptDetails | PopsConfirmDetails | PopsIframeDetails | PopsLoadingDetails | PopsPanelDetails | PopsFolderDetails, animElement: HTMLElement): void;
|
|
152
|
+
drag(moveElement: HTMLElement, options: {
|
|
153
|
+
dragElement: HTMLElement;
|
|
154
|
+
limit: boolean;
|
|
155
|
+
extraDistance: number;
|
|
156
|
+
container?: Window | typeof globalThis | HTMLElement;
|
|
157
|
+
moveCallBack?: (moveElement: HTMLElement, left: number, top: number) => void;
|
|
158
|
+
endCallBack?: (moveElement: HTMLElement, left: number, top: number) => void;
|
|
159
|
+
preventEvent?: (event: TouchEvent | PointerEvent) => boolean;
|
|
160
|
+
}): void;
|
|
161
|
+
sortElementListByProperty<T extends unknown, R>(getBeforeValueFun: (value: T) => R, getAfterValueFun: (value: T) => R, sortByDesc?: boolean): (after_obj: T, before_obj: T) => 1 | 0 | -1;
|
|
162
|
+
};
|
|
163
|
+
/** pops处理float类型使用的工具类 */
|
|
164
|
+
MathFloatUtils: {
|
|
165
|
+
isFloat(num: number): boolean;
|
|
166
|
+
add(number1: number, number2: number): number;
|
|
167
|
+
sub(number1: number, number2: number): string;
|
|
168
|
+
division(number1: number, number2: number): number;
|
|
169
|
+
};
|
|
141
170
|
};
|
|
142
171
|
constructor();
|
|
143
172
|
init(): void;
|
|
@@ -1,5 +1,337 @@
|
|
|
1
1
|
import type { ParseHTMLReturnType, PopsDOMUtilsCreateElementAttributesMap } from "../types/PopsDOMUtilsEventType";
|
|
2
|
-
import {
|
|
2
|
+
import type { PopsDOMUtils_Event, PopsDOMUtils_EventType, PopsDOMUtilsElementEventType, PopsDOMUtilsEventListenerOptionsAttribute } from "../types/PopsDOMUtilsEventType";
|
|
3
|
+
declare class PopsDOMUtilsEvent {
|
|
4
|
+
/**
|
|
5
|
+
* 绑定事件
|
|
6
|
+
* @param element 需要绑定的元素|元素数组|window
|
|
7
|
+
* @param eventType 需要监听的事件
|
|
8
|
+
* @param callback 绑定事件触发的回调函数
|
|
9
|
+
* @param option
|
|
10
|
+
* + capture 表示事件是否在捕获阶段触发。默认为false,即在冒泡阶段触发
|
|
11
|
+
* + once 表示事件是否只触发一次。默认为false
|
|
12
|
+
* + passive 表示事件监听器是否不会调用preventDefault()。默认为false
|
|
13
|
+
* @example
|
|
14
|
+
* // 监听元素a.xx的click事件
|
|
15
|
+
* DOMUtils.on(document.querySelector("a.xx"),"click",(event)=>{
|
|
16
|
+
* console.log("事件触发",event)
|
|
17
|
+
* })
|
|
18
|
+
* DOMUtils.on("a.xx","click",(event)=>{
|
|
19
|
+
* console.log("事件触发",event)
|
|
20
|
+
* })
|
|
21
|
+
*/
|
|
22
|
+
on(element: PopsDOMUtilsElementEventType, eventType: string | string[], callback: (event: Event) => void, option?: boolean | AddEventListenerOptions): void;
|
|
23
|
+
on<T extends PopsDOMUtils_EventType>(element: PopsDOMUtilsElementEventType, eventType: T | T[], callback: (event: PopsDOMUtils_Event[T]) => void, option?: boolean | AddEventListenerOptions): void;
|
|
24
|
+
/**
|
|
25
|
+
* 绑定事件
|
|
26
|
+
* @param element 需要绑定的元素|元素数组|window
|
|
27
|
+
* @param eventType 需要监听的事件
|
|
28
|
+
* @param callback 绑定事件触发的回调函数
|
|
29
|
+
* @param option
|
|
30
|
+
* + capture 表示事件是否在捕获阶段触发。默认为false,即在冒泡阶段触发
|
|
31
|
+
* + once 表示事件是否只触发一次。默认为false
|
|
32
|
+
* + passive 表示事件监听器是否不会调用preventDefault()。默认为false
|
|
33
|
+
* @example
|
|
34
|
+
* // 监听元素a.xx的click事件
|
|
35
|
+
* DOMUtils.on(document.querySelector("a.xx"),"click",(event)=>{
|
|
36
|
+
* console.log("事件触发",event)
|
|
37
|
+
* })
|
|
38
|
+
* DOMUtils.on("a.xx","click",(event)=>{
|
|
39
|
+
* console.log("事件触发",event)
|
|
40
|
+
* })
|
|
41
|
+
*/
|
|
42
|
+
on<T extends Event>(element: PopsDOMUtilsElementEventType, eventType: string, callback: (event: T) => void, option?: boolean | AddEventListenerOptions): void;
|
|
43
|
+
/**
|
|
44
|
+
* 绑定事件
|
|
45
|
+
* @param element 需要绑定的元素|元素数组|window
|
|
46
|
+
* @param eventType 需要监听的事件
|
|
47
|
+
* @param selector 子元素选择器
|
|
48
|
+
* @param callback 绑定事件触发的回调函数
|
|
49
|
+
* @param option
|
|
50
|
+
* + capture 表示事件是否在捕获阶段触发。默认为false,即在冒泡阶段触发
|
|
51
|
+
* + once 表示事件是否只触发一次。默认为false
|
|
52
|
+
* + passive 表示事件监听器是否不会调用preventDefault()。默认为false
|
|
53
|
+
* @example
|
|
54
|
+
* // 监听元素a.xx的click、tap、hover事件
|
|
55
|
+
* DOMUtils.on(document.querySelector("a.xx"),"click tap hover",(event)=>{
|
|
56
|
+
* console.log("事件触发",event)
|
|
57
|
+
* })
|
|
58
|
+
* DOMUtils.on("a.xx",["click","tap","hover"],(event)=>{
|
|
59
|
+
* console.log("事件触发",event)
|
|
60
|
+
* })
|
|
61
|
+
* @example
|
|
62
|
+
* // 监听全局document下的子元素a.xx的click事件
|
|
63
|
+
* DOMUtils.on(document,"click tap hover","a.xx",(event)=>{
|
|
64
|
+
* console.log("事件触发",event)
|
|
65
|
+
* })
|
|
66
|
+
*/
|
|
67
|
+
on<T extends PopsDOMUtils_EventType>(element: PopsDOMUtilsElementEventType, eventType: T | T[], selector: string | undefined | null, callback: (event: PopsDOMUtils_Event[T]) => void, option?: boolean | AddEventListenerOptions): void;
|
|
68
|
+
on<T extends Event>(element: PopsDOMUtilsElementEventType, eventType: string | string[], selector: string | undefined | null, callback: (event: T) => void, option?: boolean | AddEventListenerOptions): void;
|
|
69
|
+
/**
|
|
70
|
+
* 绑定事件
|
|
71
|
+
* @param element 需要绑定的元素|元素数组|window
|
|
72
|
+
* @param eventType 需要监听的事件
|
|
73
|
+
* @param selector 子元素选择器
|
|
74
|
+
* @param callback 绑定事件触发的回调函数
|
|
75
|
+
* @param option
|
|
76
|
+
* + capture 表示事件是否在捕获阶段触发。默认为false,即在冒泡阶段触发
|
|
77
|
+
* + once 表示事件是否只触发一次。默认为false
|
|
78
|
+
* + passive 表示事件监听器是否不会调用preventDefault()。默认为false
|
|
79
|
+
* @example
|
|
80
|
+
* // 监听元素a.xx的click、tap、hover事件
|
|
81
|
+
* DOMUtils.on(document.querySelector("a.xx"),"click tap hover",(event)=>{
|
|
82
|
+
* console.log("事件触发",event)
|
|
83
|
+
* })
|
|
84
|
+
* DOMUtils.on("a.xx",["click","tap","hover"],(event)=>{
|
|
85
|
+
* console.log("事件触发",event)
|
|
86
|
+
* })
|
|
87
|
+
* @example
|
|
88
|
+
* // 监听全局document下的子元素a.xx的click事件
|
|
89
|
+
* DOMUtils.on(document,"click tap hover","a.xx",(event)=>{
|
|
90
|
+
* console.log("事件触发",event)
|
|
91
|
+
* })
|
|
92
|
+
*/
|
|
93
|
+
on<T extends Event>(element: PopsDOMUtilsElementEventType, eventType: string, selector: string | undefined | null, callback: (event: T) => void, option?: boolean | AddEventListenerOptions): void;
|
|
94
|
+
/**
|
|
95
|
+
* 取消绑定事件
|
|
96
|
+
* @param element 需要取消绑定的元素|元素数组
|
|
97
|
+
* @param eventType 需要取消监听的事件
|
|
98
|
+
* @param callback 通过DOMUtils.on绑定的事件函数
|
|
99
|
+
* @param option
|
|
100
|
+
* + capture 如果在添加事件监听器时指定了useCapture为true,则在移除事件监听器时也必须指定为true
|
|
101
|
+
* @param filter (可选)过滤函数,对元素属性上的事件进行过滤出想要删除的事件
|
|
102
|
+
* @example
|
|
103
|
+
* // 取消监听元素a.xx的click事件
|
|
104
|
+
* DOMUtils.off(document.querySelector("a.xx"),"click")
|
|
105
|
+
* DOMUtils.off("a.xx","click")
|
|
106
|
+
*/
|
|
107
|
+
off(element: PopsDOMUtilsElementEventType, eventType: string | string[], callback?: (event: Event) => void, option?: boolean | AddEventListenerOptions, filter?: (value: PopsDOMUtilsEventListenerOptionsAttribute, index: number, array: PopsDOMUtilsEventListenerOptionsAttribute[]) => boolean): void;
|
|
108
|
+
off<T extends PopsDOMUtils_EventType>(element: PopsDOMUtilsElementEventType, eventType: T | T[], callback?: (event: PopsDOMUtils_Event[T]) => void, option?: boolean | AddEventListenerOptions, filter?: (value: PopsDOMUtilsEventListenerOptionsAttribute, index: number, array: PopsDOMUtilsEventListenerOptionsAttribute[]) => boolean): void;
|
|
109
|
+
/**
|
|
110
|
+
* 取消绑定事件
|
|
111
|
+
* @param element 需要取消绑定的元素|元素数组
|
|
112
|
+
* @param eventType 需要取消监听的事件
|
|
113
|
+
* @param callback 通过DOMUtils.on绑定的事件函数
|
|
114
|
+
* @param option
|
|
115
|
+
* + capture 如果在添加事件监听器时指定了useCapture为true,则在移除事件监听器时也必须指定为true
|
|
116
|
+
* @param filter (可选)过滤函数,对元素属性上的事件进行过滤出想要删除的事件
|
|
117
|
+
* @example
|
|
118
|
+
* // 取消监听元素a.xx的click事件
|
|
119
|
+
* DOMUtils.off(document.querySelector("a.xx"),"click")
|
|
120
|
+
* DOMUtils.off("a.xx","click")
|
|
121
|
+
*/
|
|
122
|
+
off<T extends Event>(element: PopsDOMUtilsElementEventType, eventType: string, callback?: (event: T) => void, option?: boolean | AddEventListenerOptions, filter?: (value: PopsDOMUtilsEventListenerOptionsAttribute, index: number, array: PopsDOMUtilsEventListenerOptionsAttribute[]) => boolean): void;
|
|
123
|
+
/**
|
|
124
|
+
* 取消绑定事件
|
|
125
|
+
* @param element 需要取消绑定的元素|元素数组
|
|
126
|
+
* @param eventType 需要取消监听的事件
|
|
127
|
+
* @param selector 子元素选择器
|
|
128
|
+
* @param callback 通过DOMUtils.on绑定的事件函数
|
|
129
|
+
* @param option
|
|
130
|
+
* + capture 如果在添加事件监听器时指定了useCapture为true,则在移除事件监听器时也必须指定为true
|
|
131
|
+
* @param filter (可选)过滤函数,对元素属性上的事件进行过滤出想要删除的事件
|
|
132
|
+
* @example
|
|
133
|
+
* // 取消监听元素a.xx的click、tap、hover事件
|
|
134
|
+
* DOMUtils.off(document.querySelector("a.xx"),"click tap hover")
|
|
135
|
+
* DOMUtils.off("a.xx",["click","tap","hover"])
|
|
136
|
+
*/
|
|
137
|
+
off<T extends PopsDOMUtils_EventType>(element: PopsDOMUtilsElementEventType, eventType: T | T[], selector?: string | undefined, callback?: (event: PopsDOMUtils_Event[T]) => void, option?: boolean | AddEventListenerOptions, filter?: (value: PopsDOMUtilsEventListenerOptionsAttribute, index: number, array: PopsDOMUtilsEventListenerOptionsAttribute[]) => boolean): void;
|
|
138
|
+
/**
|
|
139
|
+
* 取消绑定事件
|
|
140
|
+
* @param element 需要取消绑定的元素|元素数组
|
|
141
|
+
* @param eventType 需要取消监听的事件
|
|
142
|
+
* @param selector 子元素选择器
|
|
143
|
+
* @param callback 通过DOMUtils.on绑定的事件函数
|
|
144
|
+
* @param option
|
|
145
|
+
* + capture 如果在添加事件监听器时指定了useCapture为true,则在移除事件监听器时也必须指定为true
|
|
146
|
+
* @param filter (可选)过滤函数,对元素属性上的事件进行过滤出想要删除的事件
|
|
147
|
+
* @example
|
|
148
|
+
* // 取消监听元素a.xx的click、tap、hover事件
|
|
149
|
+
* DOMUtils.off(document.querySelector("a.xx"),"click tap hover")
|
|
150
|
+
* DOMUtils.off("a.xx",["click","tap","hover"])
|
|
151
|
+
*/
|
|
152
|
+
off<T extends Event>(element: PopsDOMUtilsElementEventType, eventType: string | string[], selector?: string | undefined, callback?: (event: T) => void, option?: boolean | AddEventListenerOptions, filter?: (value: PopsDOMUtilsEventListenerOptionsAttribute, index: number, array: PopsDOMUtilsEventListenerOptionsAttribute[]) => boolean): void;
|
|
153
|
+
/**
|
|
154
|
+
* 取消绑定所有的事件
|
|
155
|
+
* @param element 需要取消绑定的元素|元素数组
|
|
156
|
+
* @param eventType (可选)需要取消监听的事件
|
|
157
|
+
*/
|
|
158
|
+
offAll(element: PopsDOMUtilsElementEventType, eventType?: string): void;
|
|
159
|
+
/**
|
|
160
|
+
* 取消绑定所有的事件
|
|
161
|
+
* @param element 需要取消绑定的元素|元素数组
|
|
162
|
+
* @param eventType (可选)需要取消监听的事件
|
|
163
|
+
*/
|
|
164
|
+
offAll(element: PopsDOMUtilsElementEventType, eventType?: PopsDOMUtils_EventType | PopsDOMUtils_EventType[]): void;
|
|
165
|
+
/**
|
|
166
|
+
* 等待文档加载完成后执行指定的函数
|
|
167
|
+
* @param callback 需要执行的函数
|
|
168
|
+
* @example
|
|
169
|
+
* DOMUtils.ready(function(){
|
|
170
|
+
* console.log("文档加载完毕")
|
|
171
|
+
* })
|
|
172
|
+
*/
|
|
173
|
+
ready<T extends Function>(callback: T): void;
|
|
174
|
+
/**
|
|
175
|
+
* 主动触发事件
|
|
176
|
+
* @param element 需要触发的元素|元素数组|window
|
|
177
|
+
* @param eventType 需要触发的事件
|
|
178
|
+
* @param details 赋予触发的Event的额外属性,如果是Event类型,那么将自动代替默认new的Event对象
|
|
179
|
+
* @param useDispatchToTriggerEvent 是否使用dispatchEvent来触发事件,默认true
|
|
180
|
+
* @example
|
|
181
|
+
* // 触发元素a.xx的click事件
|
|
182
|
+
* DOMUtils.trigger(document.querySelector("a.xx"),"click")
|
|
183
|
+
* DOMUtils.trigger("a.xx","click")
|
|
184
|
+
* // 触发元素a.xx的click、tap、hover事件
|
|
185
|
+
* DOMUtils.trigger(document.querySelector("a.xx"),"click tap hover")
|
|
186
|
+
* DOMUtils.trigger("a.xx",["click","tap","hover"])
|
|
187
|
+
*/
|
|
188
|
+
trigger(element: HTMLElement | string | NodeList | any[] | Window | Document, eventType: string | string[], details?: object, useDispatchToTriggerEvent?: boolean): void;
|
|
189
|
+
/**
|
|
190
|
+
* 主动触发事件
|
|
191
|
+
* @param element 需要触发的元素|元素数组|window
|
|
192
|
+
* @param eventType 需要触发的事件
|
|
193
|
+
* @param details 赋予触发的Event的额外属性,如果是Event类型,那么将自动代替默认new的Event对象
|
|
194
|
+
* @param useDispatchToTriggerEvent 是否使用dispatchEvent来触发事件,默认true
|
|
195
|
+
* @example
|
|
196
|
+
* // 触发元素a.xx的click事件
|
|
197
|
+
* DOMUtils.trigger(document.querySelector("a.xx"),"click")
|
|
198
|
+
* DOMUtils.trigger("a.xx","click")
|
|
199
|
+
* // 触发元素a.xx的click、tap、hover事件
|
|
200
|
+
* DOMUtils.trigger(document.querySelector("a.xx"),"click tap hover")
|
|
201
|
+
* DOMUtils.trigger("a.xx",["click","tap","hover"])
|
|
202
|
+
*/
|
|
203
|
+
trigger(element: HTMLElement | string | NodeList | any[] | Window | Document, eventType: PopsDOMUtils_EventType | PopsDOMUtils_EventType[], details?: object, useDispatchToTriggerEvent?: boolean): void;
|
|
204
|
+
/**
|
|
205
|
+
* 绑定或触发元素的click事件
|
|
206
|
+
* @param element 目标元素
|
|
207
|
+
* @param handler (可选)事件处理函数
|
|
208
|
+
* @param details (可选)赋予触发的Event的额外属性
|
|
209
|
+
* @param useDispatchToTriggerEvent (可选)是否使用dispatchEvent来触发事件,默认true
|
|
210
|
+
* @example
|
|
211
|
+
* // 触发元素a.xx的click事件
|
|
212
|
+
* DOMUtils.click(document.querySelector("a.xx"))
|
|
213
|
+
* DOMUtils.click("a.xx")
|
|
214
|
+
* DOMUtils.click("a.xx",function(){
|
|
215
|
+
* console.log("触发click事件成功")
|
|
216
|
+
* })
|
|
217
|
+
* */
|
|
218
|
+
click(element: HTMLElement | string | Window, handler?: (event: PopsDOMUtils_Event["click"]) => void, details?: any, useDispatchToTriggerEvent?: boolean): void;
|
|
219
|
+
/**
|
|
220
|
+
* 绑定或触发元素的blur事件
|
|
221
|
+
* @param element 目标元素
|
|
222
|
+
* @param handler (可选)事件处理函数
|
|
223
|
+
* @param details (可选)赋予触发的Event的额外属性
|
|
224
|
+
* @param useDispatchToTriggerEvent (可选)是否使用dispatchEvent来触发事件,默认true
|
|
225
|
+
* @example
|
|
226
|
+
* // 触发元素a.xx的blur事件
|
|
227
|
+
* DOMUtils.blur(document.querySelector("a.xx"))
|
|
228
|
+
* DOMUtils.blur("a.xx")
|
|
229
|
+
* DOMUtils.blur("a.xx",function(){
|
|
230
|
+
* console.log("触发blur事件成功")
|
|
231
|
+
* })
|
|
232
|
+
* */
|
|
233
|
+
blur(element: HTMLElement | string | Window, handler?: (event: PopsDOMUtils_Event["blur"]) => void, details?: object, useDispatchToTriggerEvent?: boolean): void;
|
|
234
|
+
/**
|
|
235
|
+
* 绑定或触发元素的focus事件
|
|
236
|
+
* @param element 目标元素
|
|
237
|
+
* @param handler (可选)事件处理函数
|
|
238
|
+
* @param details (可选)赋予触发的Event的额外属性
|
|
239
|
+
* @param useDispatchToTriggerEvent (可选)是否使用dispatchEvent来触发事件,默认true
|
|
240
|
+
* @example
|
|
241
|
+
* // 触发元素a.xx的focus事件
|
|
242
|
+
* DOMUtils.focus(document.querySelector("a.xx"))
|
|
243
|
+
* DOMUtils.focus("a.xx")
|
|
244
|
+
* DOMUtils.focus("a.xx",function(){
|
|
245
|
+
* console.log("触发focus事件成功")
|
|
246
|
+
* })
|
|
247
|
+
* */
|
|
248
|
+
focus(element: HTMLElement | string | Window, handler?: (event: PopsDOMUtils_Event["focus"]) => void, details?: object, useDispatchToTriggerEvent?: boolean): void;
|
|
249
|
+
/**
|
|
250
|
+
* 当鼠标移入或移出元素时触发事件
|
|
251
|
+
* @param element 当前元素
|
|
252
|
+
* @param handler 事件处理函数
|
|
253
|
+
* @param option 配置
|
|
254
|
+
* @example
|
|
255
|
+
* // 监听a.xx元素的移入或移出
|
|
256
|
+
* DOMUtils.hover(document.querySelector("a.xx"),()=>{
|
|
257
|
+
* console.log("移入/移除");
|
|
258
|
+
* })
|
|
259
|
+
* DOMUtils.hover("a.xx",()=>{
|
|
260
|
+
* console.log("移入/移除");
|
|
261
|
+
* })
|
|
262
|
+
*/
|
|
263
|
+
hover(element: HTMLElement | string, handler: (event: PopsDOMUtils_Event["hover"]) => void, option?: boolean | AddEventListenerOptions): void;
|
|
264
|
+
/**
|
|
265
|
+
* 当按键松开时触发事件
|
|
266
|
+
* keydown - > keypress - > keyup
|
|
267
|
+
* @param target 当前元素
|
|
268
|
+
* @param handler 事件处理函数
|
|
269
|
+
* @param option 配置
|
|
270
|
+
* @example
|
|
271
|
+
* // 监听a.xx元素的按键松开
|
|
272
|
+
* DOMUtils.keyup(document.querySelector("a.xx"),()=>{
|
|
273
|
+
* console.log("按键松开");
|
|
274
|
+
* })
|
|
275
|
+
* DOMUtils.keyup("a.xx",()=>{
|
|
276
|
+
* console.log("按键松开");
|
|
277
|
+
* })
|
|
278
|
+
*/
|
|
279
|
+
keyup(target: HTMLElement | string | Window | typeof globalThis, handler: (event: PopsDOMUtils_Event["keyup"]) => void, option?: boolean | AddEventListenerOptions): void;
|
|
280
|
+
/**
|
|
281
|
+
* 当按键按下时触发事件
|
|
282
|
+
* keydown - > keypress - > keyup
|
|
283
|
+
* @param target 目标
|
|
284
|
+
* @param handler 事件处理函数
|
|
285
|
+
* @param option 配置
|
|
286
|
+
* @example
|
|
287
|
+
* // 监听a.xx元素的按键按下
|
|
288
|
+
* DOMUtils.keydown(document.querySelector("a.xx"),()=>{
|
|
289
|
+
* console.log("按键按下");
|
|
290
|
+
* })
|
|
291
|
+
* DOMUtils.keydown("a.xx",()=>{
|
|
292
|
+
* console.log("按键按下");
|
|
293
|
+
* })
|
|
294
|
+
*/
|
|
295
|
+
keydown(target: HTMLElement | Window | typeof globalThis | string, handler: (event: PopsDOMUtils_Event["keydown"]) => void, option?: boolean | AddEventListenerOptions): void;
|
|
296
|
+
/**
|
|
297
|
+
* 当按键按下时触发事件
|
|
298
|
+
* keydown - > keypress - > keyup
|
|
299
|
+
* @param target 目标
|
|
300
|
+
* @param handler 事件处理函数
|
|
301
|
+
* @param option 配置
|
|
302
|
+
* @example
|
|
303
|
+
* // 监听a.xx元素的按键按下
|
|
304
|
+
* DOMUtils.keypress(document.querySelector("a.xx"),()=>{
|
|
305
|
+
* console.log("按键按下");
|
|
306
|
+
* })
|
|
307
|
+
* DOMUtils.keypress("a.xx",()=>{
|
|
308
|
+
* console.log("按键按下");
|
|
309
|
+
* })
|
|
310
|
+
*/
|
|
311
|
+
keypress(target: HTMLElement | Window | typeof globalThis | string, handler: (event: PopsDOMUtils_Event["keypress"]) => void, option?: boolean | AddEventListenerOptions): void;
|
|
312
|
+
/**
|
|
313
|
+
* 阻止事件传递
|
|
314
|
+
* @param element 要进行处理的元素
|
|
315
|
+
* @param eventNameList (可选)要阻止的事件名|列表
|
|
316
|
+
* @param capture (可选)是否捕获,默认false
|
|
317
|
+
* @example
|
|
318
|
+
* Utils.preventEvent(document.querySelector("a"),"click")
|
|
319
|
+
* @example
|
|
320
|
+
* Utils.preventEvent(event);
|
|
321
|
+
*/
|
|
322
|
+
preventEvent(event: Event): boolean;
|
|
323
|
+
/**
|
|
324
|
+
* 阻止事件传递
|
|
325
|
+
* @param element 要进行处理的元素
|
|
326
|
+
* @param eventNameList (可选)要阻止的事件名|列表
|
|
327
|
+
* @param capture (可选)是否捕获,默认false
|
|
328
|
+
* @example
|
|
329
|
+
* Utils.preventEvent(document.querySelector("a"),"click")
|
|
330
|
+
* @example
|
|
331
|
+
* Utils.preventEvent(event);
|
|
332
|
+
*/
|
|
333
|
+
preventEvent(element: HTMLElement, eventNameList?: string | string[], capture?: boolean): boolean;
|
|
334
|
+
}
|
|
3
335
|
declare class PopsDOMUtils extends PopsDOMUtilsEvent {
|
|
4
336
|
/** 获取 animationend 在各个浏览器的兼容名 */
|
|
5
337
|
getAnimationEndNameList(): string[];
|
|
@@ -8,7 +8,7 @@ import type { PopsPanelDetails } from "../components/panel/indexType";
|
|
|
8
8
|
import type { PopsPromptDetails } from "../components/prompt/indexType";
|
|
9
9
|
import type { PopsLayerCommonConfig } from "../types/layer";
|
|
10
10
|
import type { PopsLayerMode } from "../types/main";
|
|
11
|
-
export declare const
|
|
11
|
+
export declare const PopsInstanceUtils: {
|
|
12
12
|
/**
|
|
13
13
|
* 获取所有弹窗中的最大的z-index
|
|
14
14
|
* @param defaultValue
|
|
@@ -27,9 +27,9 @@ export declare const PopsUIUtils: {
|
|
|
27
27
|
* 删除配置中对应的对象
|
|
28
28
|
* @param moreLayerConfigList 配置实例列表
|
|
29
29
|
* @param guid 唯一标识
|
|
30
|
-
* @param
|
|
30
|
+
* @param isAll 是否全部删除
|
|
31
31
|
*/
|
|
32
|
-
|
|
32
|
+
removeInstance(moreLayerConfigList: PopsLayerCommonConfig[][], guid: string, isAll?: boolean): PopsLayerCommonConfig[][];
|
|
33
33
|
/**
|
|
34
34
|
* 隐藏
|
|
35
35
|
* @param popsType
|
package/package.json
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@whitesev/pops",
|
|
3
|
-
"version": "1.0
|
|
4
|
-
"description": "弹窗库",
|
|
5
|
-
"main": "dist/index.cjs.js",
|
|
6
|
-
"module": "dist/node/index.esm.js",
|
|
7
|
-
"types": "dist/types/index.d.ts",
|
|
8
|
-
"jsdelivr": "dist/index.umd.js",
|
|
9
|
-
"exports": {
|
|
10
|
-
"./package.json": "./package.json",
|
|
11
|
-
".": {
|
|
12
|
-
"import": "./dist/index.esm.js",
|
|
13
|
-
"require": "./dist/index.cjs.js",
|
|
14
|
-
"types": "./dist/types/index.d.ts"
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
"files": [
|
|
18
|
-
"dist"
|
|
19
|
-
],
|
|
20
|
-
"scripts": {
|
|
21
|
-
"build": "rollup --config"
|
|
22
|
-
},
|
|
23
|
-
"keywords": [
|
|
24
|
-
"typescript",
|
|
25
|
-
"pops",
|
|
26
|
-
"dialog"
|
|
27
|
-
],
|
|
28
|
-
"author": "WhiteSev",
|
|
29
|
-
"license": "MIT",
|
|
30
|
-
"dependencies": {
|
|
31
|
-
"@rollup/plugin-commonjs": "^25.0.8",
|
|
32
|
-
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
33
|
-
"@rollup/plugin-typescript": "^11.1.6",
|
|
34
|
-
"rollup-plugin-clear": "^2.0.7",
|
|
35
|
-
"tslib": "^2.6.2"
|
|
36
|
-
},
|
|
37
|
-
"devDependencies": {
|
|
38
|
-
"rollup-plugin-import-css": "^3.5.0",
|
|
39
|
-
"typescript": "^5.4.5"
|
|
40
|
-
}
|
|
41
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@whitesev/pops",
|
|
3
|
+
"version": "1.2.0",
|
|
4
|
+
"description": "弹窗库",
|
|
5
|
+
"main": "dist/index.cjs.js",
|
|
6
|
+
"module": "dist/node/index.esm.js",
|
|
7
|
+
"types": "dist/types/index.d.ts",
|
|
8
|
+
"jsdelivr": "dist/index.umd.js",
|
|
9
|
+
"exports": {
|
|
10
|
+
"./package.json": "./package.json",
|
|
11
|
+
".": {
|
|
12
|
+
"import": "./dist/index.esm.js",
|
|
13
|
+
"require": "./dist/index.cjs.js",
|
|
14
|
+
"types": "./dist/types/index.d.ts"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "rollup --config"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"typescript",
|
|
25
|
+
"pops",
|
|
26
|
+
"dialog"
|
|
27
|
+
],
|
|
28
|
+
"author": "WhiteSev",
|
|
29
|
+
"license": "MIT",
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@rollup/plugin-commonjs": "^25.0.8",
|
|
32
|
+
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
33
|
+
"@rollup/plugin-typescript": "^11.1.6",
|
|
34
|
+
"rollup-plugin-clear": "^2.0.7",
|
|
35
|
+
"tslib": "^2.6.2"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"rollup-plugin-import-css": "^3.5.0",
|
|
39
|
+
"typescript": "^5.4.5"
|
|
40
|
+
}
|
|
41
|
+
}
|