@whitesev/pops 4.0.2 → 4.1.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 +227 -141
- 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 +227 -141
- 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 +227 -141
- 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 +227 -141
- 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 +227 -141
- 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 +227 -141
- 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/Pops.d.ts +109 -10
- package/dist/types/src/components/loading/types/index.d.ts +1 -1
- package/dist/types/src/components/panel/index.d.ts +3 -2
- package/dist/types/src/components/rightClickMenu/types/index.d.ts +1 -1
- package/dist/types/src/components/searchSuggestion/types/index.d.ts +1 -1
- package/dist/types/src/components/tooltip/index.d.ts +82 -1
- package/dist/types/src/components/tooltip/types/index.d.ts +1 -1
- package/dist/types/src/config/GlobalConfig.d.ts +3 -3
- package/dist/types/src/event/EventEmiter.d.ts +7 -1
- package/dist/types/src/handler/PopsInstHandler.d.ts +4 -4
- package/dist/types/src/types/EventEmitter.d.ts +21 -0
- package/dist/types/src/types/PopsDOMUtilsEventType.d.ts +1 -1
- package/dist/types/src/types/components.d.ts +15 -18
- package/dist/types/src/types/global.d.ts +2 -0
- package/dist/types/src/utils/PopsDOMUtils.d.ts +14 -2
- package/dist/types/src/utils/PopsUtils.d.ts +20 -15
- package/package.json +1 -1
- package/src/Pops.ts +3 -0
- package/src/components/alert/defaultConfig.ts +1 -1
- package/src/components/alert/index.ts +1 -1
- package/src/components/confirm/defaultConfig.ts +1 -1
- package/src/components/confirm/index.ts +1 -1
- package/src/components/drawer/defaultConfig.ts +1 -1
- package/src/components/drawer/index.ts +2 -1
- package/src/components/folder/defaultConfig.ts +1 -1
- package/src/components/folder/index.ts +1 -1
- package/src/components/iframe/defaultConfig.ts +1 -1
- package/src/components/iframe/index.ts +10 -6
- package/src/components/loading/defaultConfig.ts +1 -0
- package/src/components/loading/index.ts +10 -10
- package/src/components/loading/types/index.ts +1 -4
- package/src/components/panel/defaultConfig.ts +1 -1
- package/src/components/panel/index.ts +3 -2
- package/src/components/prompt/defaultConfig.ts +1 -1
- package/src/components/prompt/index.ts +1 -1
- package/src/components/rightClickMenu/defaultConfig.ts +1 -1
- package/src/components/rightClickMenu/index.ts +1 -1
- package/src/components/rightClickMenu/types/index.ts +1 -1
- package/src/components/searchSuggestion/defaultConfig.ts +1 -0
- package/src/components/searchSuggestion/index.ts +1 -1
- package/src/components/searchSuggestion/types/index.ts +1 -1
- package/src/components/tooltip/defaultConfig.ts +1 -1
- package/src/components/tooltip/index.ts +1 -1
- package/src/components/tooltip/types/index.ts +1 -1
- package/src/event/EventEmiter.ts +15 -14
- package/src/handler/PopsInstHandler.ts +64 -47
- package/src/types/EventEmitter.d.ts +21 -0
- package/src/types/PopsDOMUtilsEventType.d.ts +1 -1
- package/src/types/components.d.ts +15 -18
- package/src/types/global.d.ts +2 -0
- package/src/utils/PopsDOMUtils.ts +32 -2
- package/src/utils/PopsUtils.ts +94 -67
|
@@ -83,7 +83,7 @@ export const PopsInstHandler = {
|
|
|
83
83
|
return totalInstConfigList;
|
|
84
84
|
},
|
|
85
85
|
/**
|
|
86
|
-
*
|
|
86
|
+
* 显示
|
|
87
87
|
* @param popsType
|
|
88
88
|
* @param instConfigList
|
|
89
89
|
* @param guid
|
|
@@ -91,7 +91,7 @@ export const PopsInstHandler = {
|
|
|
91
91
|
* @param $anim
|
|
92
92
|
* @param $mask
|
|
93
93
|
*/
|
|
94
|
-
|
|
94
|
+
show(
|
|
95
95
|
config:
|
|
96
96
|
| PopsAlertConfig
|
|
97
97
|
| PopsDrawerConfig
|
|
@@ -110,48 +110,54 @@ export const PopsInstHandler = {
|
|
|
110
110
|
// oxlint-disable-next-line no-async-promise-executor
|
|
111
111
|
return new Promise<void>(async (resolve) => {
|
|
112
112
|
const $pops = $anim.querySelector<HTMLDivElement>(".pops[type-value]")!;
|
|
113
|
+
|
|
113
114
|
const fintInst = instConfigList.find((instConfigItem) => instConfigItem.guid === guid);
|
|
114
115
|
if (fintInst) {
|
|
115
|
-
//
|
|
116
|
+
// 由于是隐蔽状态
|
|
117
|
+
// 先设置好动画状态
|
|
118
|
+
// 再显示,会自执行动画
|
|
119
|
+
const checkVisible = () => {
|
|
120
|
+
if (!popsDOMUtils.isHide($anim)) {
|
|
121
|
+
return true;
|
|
122
|
+
} else {
|
|
123
|
+
return false;
|
|
124
|
+
}
|
|
125
|
+
};
|
|
116
126
|
const startAnim = async () => {
|
|
117
127
|
if (popsType === "drawer") {
|
|
118
128
|
// drawer是抽屉
|
|
119
129
|
// 单独处理动画
|
|
120
130
|
const drawerConfig = config as Required<PopsDrawerConfig>;
|
|
121
|
-
await popsUtils.sleep(drawerConfig.
|
|
131
|
+
await popsUtils.sleep(drawerConfig.openDelay ?? 0);
|
|
122
132
|
if ($mask) {
|
|
123
|
-
popsDOMUtils.css($mask, "display", "
|
|
133
|
+
popsDOMUtils.css($mask, "display", "");
|
|
124
134
|
}
|
|
125
135
|
const direction = drawerConfig.direction!;
|
|
126
|
-
const size =
|
|
136
|
+
const size = drawerConfig.size!.toString();
|
|
127
137
|
if (["top", "bottom"].includes(direction)) {
|
|
128
138
|
$pops.style.setProperty("height", size);
|
|
129
139
|
} else if (["left", "right"].includes(direction)) {
|
|
130
140
|
$pops.style.setProperty("width", size);
|
|
131
141
|
} else {
|
|
132
|
-
console.error("未知direction
|
|
142
|
+
console.error("未知direction:", direction);
|
|
133
143
|
}
|
|
134
144
|
} else {
|
|
135
|
-
instConfigItem.$anim.style.width = "
|
|
136
|
-
instConfigItem.$anim.style.height = "
|
|
137
|
-
Reflect.set(
|
|
138
|
-
instConfigItem.$anim.style,
|
|
139
|
-
"animation-name",
|
|
140
|
-
instConfigItem.$anim.getAttribute("anim") + "-reverse"
|
|
141
|
-
);
|
|
145
|
+
instConfigItem.$anim.style.width = "";
|
|
146
|
+
instConfigItem.$anim.style.height = "";
|
|
147
|
+
Reflect.set(instConfigItem.$anim.style, "animation-name", animName);
|
|
142
148
|
}
|
|
143
|
-
|
|
144
|
-
const endCallback = () => {
|
|
145
|
-
instConfigItem.$anim.style.display = "none";
|
|
149
|
+
instConfigItem.$anim.style.display = "";
|
|
146
150
|
if (instConfigItem.$mask) {
|
|
147
|
-
instConfigItem.$mask.style.display = "
|
|
151
|
+
instConfigItem.$mask.style.display = "";
|
|
148
152
|
}
|
|
149
|
-
|
|
153
|
+
};
|
|
154
|
+
const endCallback = () => {
|
|
155
|
+
fintInst.emitter.emit("pops:show", instConfigItem);
|
|
150
156
|
};
|
|
151
157
|
const instConfigItem = fintInst;
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
if (PopsAnimation.hasAnim(
|
|
158
|
+
const animName = instConfigItem.$anim!.getAttribute("anim")!.replace("-reverse", "");
|
|
159
|
+
fintInst.emitter.emit("pops:before-show", instConfigItem);
|
|
160
|
+
if (checkVisible() && PopsAnimation.hasAnim(animName)) {
|
|
155
161
|
/**
|
|
156
162
|
* 动画结束的回调
|
|
157
163
|
*/
|
|
@@ -166,21 +172,22 @@ export const PopsInstHandler = {
|
|
|
166
172
|
animationendCallBack,
|
|
167
173
|
{
|
|
168
174
|
capture: true,
|
|
169
|
-
once: true,
|
|
170
175
|
}
|
|
171
176
|
);
|
|
177
|
+
await startAnim();
|
|
172
178
|
} else {
|
|
179
|
+
await startAnim();
|
|
173
180
|
endCallback();
|
|
174
181
|
resolve();
|
|
175
182
|
}
|
|
176
183
|
} else {
|
|
177
|
-
console.error("
|
|
184
|
+
console.error("show-error: 该实例未存储");
|
|
178
185
|
resolve();
|
|
179
186
|
}
|
|
180
187
|
});
|
|
181
188
|
},
|
|
182
189
|
/**
|
|
183
|
-
*
|
|
190
|
+
* 隐藏
|
|
184
191
|
* @param popsType
|
|
185
192
|
* @param instConfigList
|
|
186
193
|
* @param guid
|
|
@@ -188,7 +195,7 @@ export const PopsInstHandler = {
|
|
|
188
195
|
* @param $anim
|
|
189
196
|
* @param $mask
|
|
190
197
|
*/
|
|
191
|
-
|
|
198
|
+
hide(
|
|
192
199
|
config:
|
|
193
200
|
| PopsAlertConfig
|
|
194
201
|
| PopsDrawerConfig
|
|
@@ -207,48 +214,55 @@ export const PopsInstHandler = {
|
|
|
207
214
|
// oxlint-disable-next-line no-async-promise-executor
|
|
208
215
|
return new Promise<void>(async (resolve) => {
|
|
209
216
|
const $pops = $anim.querySelector<HTMLDivElement>(".pops[type-value]")!;
|
|
210
|
-
|
|
211
217
|
const fintInst = instConfigList.find((instConfigItem) => instConfigItem.guid === guid);
|
|
212
218
|
if (fintInst) {
|
|
219
|
+
// 由于是已显示状态
|
|
220
|
+
// 先执行动画
|
|
221
|
+
// 再隐藏
|
|
222
|
+
// 存在实例
|
|
223
|
+
const checkVisible = () => {
|
|
224
|
+
if (!popsDOMUtils.isHide($anim)) {
|
|
225
|
+
return true;
|
|
226
|
+
} else {
|
|
227
|
+
return false;
|
|
228
|
+
}
|
|
229
|
+
};
|
|
213
230
|
const startAnim = async () => {
|
|
214
231
|
if (popsType === "drawer") {
|
|
215
232
|
// drawer是抽屉
|
|
216
233
|
// 单独处理动画
|
|
217
234
|
const drawerConfig = config as Required<PopsDrawerConfig>;
|
|
218
|
-
await popsUtils.sleep(drawerConfig.
|
|
235
|
+
await popsUtils.sleep(drawerConfig.closeDelay ?? 0);
|
|
219
236
|
if ($mask) {
|
|
220
|
-
popsDOMUtils.css($mask, "display", "");
|
|
237
|
+
popsDOMUtils.css($mask, "display", "none");
|
|
221
238
|
}
|
|
222
239
|
const direction = drawerConfig.direction!;
|
|
223
|
-
const size =
|
|
240
|
+
const size = "0";
|
|
224
241
|
if (["top", "bottom"].includes(direction)) {
|
|
225
242
|
$pops.style.setProperty("height", size);
|
|
226
243
|
} else if (["left", "right"].includes(direction)) {
|
|
227
244
|
$pops.style.setProperty("width", size);
|
|
228
245
|
} else {
|
|
229
|
-
console.error("未知direction
|
|
246
|
+
console.error("未知direction: ", direction);
|
|
230
247
|
}
|
|
231
248
|
} else {
|
|
232
|
-
instConfigItem.$anim.style.width = "";
|
|
233
|
-
instConfigItem.$anim.style.height = "";
|
|
234
|
-
Reflect.set(
|
|
235
|
-
instConfigItem.$anim.style,
|
|
236
|
-
"animation-name",
|
|
237
|
-
instConfigItem.$anim!.getAttribute("anim")!.replace("-reverse", "")
|
|
238
|
-
);
|
|
249
|
+
instConfigItem.$anim.style.width = "100%";
|
|
250
|
+
instConfigItem.$anim.style.height = "100%";
|
|
251
|
+
Reflect.set(instConfigItem.$anim.style, "animation-name", reverseAnimName);
|
|
239
252
|
}
|
|
240
253
|
};
|
|
241
254
|
const endCallback = () => {
|
|
242
|
-
instConfigItem.$anim.style.display = "";
|
|
255
|
+
instConfigItem.$anim.style.display = "none";
|
|
243
256
|
if (instConfigItem.$mask) {
|
|
244
|
-
instConfigItem.$mask.style.display = "";
|
|
257
|
+
instConfigItem.$mask.style.display = "none";
|
|
245
258
|
}
|
|
246
|
-
fintInst.emitter.emit("pops:
|
|
259
|
+
fintInst.emitter.emit("pops:hide", instConfigItem);
|
|
247
260
|
};
|
|
248
261
|
const instConfigItem = fintInst;
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
262
|
+
const animName = instConfigItem.$anim!.getAttribute("anim")!.replace("-reverse", "");
|
|
263
|
+
const reverseAnimName = animName + "-reverse";
|
|
264
|
+
fintInst.emitter.emit("pops:before-hide", instConfigItem);
|
|
265
|
+
if (!checkVisible() && PopsAnimation.hasAnim(reverseAnimName)) {
|
|
252
266
|
/**
|
|
253
267
|
* 动画结束的回调
|
|
254
268
|
*/
|
|
@@ -263,14 +277,17 @@ export const PopsInstHandler = {
|
|
|
263
277
|
animationendCallBack,
|
|
264
278
|
{
|
|
265
279
|
capture: true,
|
|
280
|
+
once: true,
|
|
266
281
|
}
|
|
267
282
|
);
|
|
283
|
+
await startAnim();
|
|
268
284
|
} else {
|
|
285
|
+
await startAnim();
|
|
269
286
|
endCallback();
|
|
270
287
|
resolve();
|
|
271
288
|
}
|
|
272
289
|
} else {
|
|
273
|
-
console.error("
|
|
290
|
+
console.error("hide-error: 该实例未存储");
|
|
274
291
|
resolve();
|
|
275
292
|
}
|
|
276
293
|
});
|
|
@@ -324,7 +341,7 @@ export const PopsInstHandler = {
|
|
|
324
341
|
await new Promise<void>(async (resolve) => {
|
|
325
342
|
const $pops = $anim.querySelector<HTMLDivElement>(".pops[type-value]")!;
|
|
326
343
|
const drawerConfig = config as Required<PopsDrawerConfig>;
|
|
327
|
-
const
|
|
344
|
+
const startAnim = () => {
|
|
328
345
|
/**
|
|
329
346
|
* 弹窗已关闭的回调
|
|
330
347
|
*/
|
|
@@ -361,7 +378,7 @@ export const PopsInstHandler = {
|
|
|
361
378
|
};
|
|
362
379
|
if (popsType === "drawer") {
|
|
363
380
|
await popsUtils.sleep(drawerConfig.closeDelay ?? 0);
|
|
364
|
-
|
|
381
|
+
startAnim();
|
|
365
382
|
} else {
|
|
366
383
|
await PopsInstHandler.removeInstance([instConfigList], guid);
|
|
367
384
|
resolve();
|
|
@@ -1,12 +1,33 @@
|
|
|
1
1
|
import type { PopsInstGeneralConfig } from "./inst";
|
|
2
2
|
|
|
3
3
|
export type EventMap = {
|
|
4
|
+
/**
|
|
5
|
+
* 调用`.show`时触发
|
|
6
|
+
*/
|
|
4
7
|
"pops:before-show": (config: PopsInstGeneralConfig) => IPromise<void>;
|
|
8
|
+
/**
|
|
9
|
+
* 调用`.show`时触发
|
|
10
|
+
*/
|
|
5
11
|
"pops:show": (config: PopsInstGeneralConfig) => IPromise<void>;
|
|
12
|
+
/**
|
|
13
|
+
* 调用`.hide`时触发
|
|
14
|
+
*/
|
|
6
15
|
"pops:before-hide": (config: PopsInstGeneralConfig) => IPromise<void>;
|
|
16
|
+
/**
|
|
17
|
+
* 调用`.hide`时触发
|
|
18
|
+
*/
|
|
7
19
|
"pops:hide": (config: PopsInstGeneralConfig) => IPromise<void>;
|
|
20
|
+
/**
|
|
21
|
+
* 调用`.close`时触发
|
|
22
|
+
*/
|
|
8
23
|
"pops:before-destory": (config: PopsInstGeneralConfig) => IPromise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* 调用`.close`时触发
|
|
26
|
+
*/
|
|
9
27
|
"pops:destory": () => IPromise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* 插入到页面中时触发,但是需要传入`EventEmitter`来监听该事件,否则不触发
|
|
30
|
+
*/
|
|
10
31
|
"pops:before-append-to-page": (
|
|
11
32
|
$shadowRoot: ShadowRoot | HTMLElement,
|
|
12
33
|
$shadowContainer: HTMLDivElement
|
|
@@ -277,7 +277,7 @@ export declare type PopsDOMUtilsEventListenerOption = AddEventListenerOptions &
|
|
|
277
277
|
isComposedPath?: boolean;
|
|
278
278
|
};
|
|
279
279
|
|
|
280
|
-
export type PopsDOMUtilsTargetElementType = HTMLElement | string | NodeList
|
|
280
|
+
export type PopsDOMUtilsTargetElementType = IArray<HTMLElement> | string | NodeList;
|
|
281
281
|
|
|
282
282
|
/**
|
|
283
283
|
* 属性转驼峰
|
|
@@ -2,6 +2,8 @@ import type { PopsAnimation } from "./animation";
|
|
|
2
2
|
import type { PopsPosition, PopsTextAlign, PopsJustifyContent } from "./position";
|
|
3
3
|
import type { PopsGlobalButtonConfig, PopsButtonConfigAnyType, PopsHeaderCloseButtonConfig } from "./button";
|
|
4
4
|
import type { PopsMaskConfig } from "./mask";
|
|
5
|
+
import type { EventEmiter } from "../event/EventEmiter";
|
|
6
|
+
import type { EventMap } from "./EventEmitter";
|
|
5
7
|
|
|
6
8
|
/**
|
|
7
9
|
* 标题配置
|
|
@@ -139,49 +141,41 @@ export interface PopsDragConfig {
|
|
|
139
141
|
export interface PopsGeneralConfig {
|
|
140
142
|
/**
|
|
141
143
|
* 是否使用shadowRoot
|
|
142
|
-
*
|
|
143
144
|
* @default true
|
|
144
145
|
*/
|
|
145
146
|
useShadowRoot?: boolean;
|
|
146
147
|
/**
|
|
147
148
|
* 自定义的className
|
|
148
|
-
*
|
|
149
149
|
* @default ""
|
|
150
150
|
*/
|
|
151
151
|
class?: string;
|
|
152
152
|
/**
|
|
153
153
|
* 是否是唯一的
|
|
154
|
-
*
|
|
155
154
|
* @default false
|
|
156
155
|
*/
|
|
157
156
|
only?: boolean;
|
|
158
157
|
/**
|
|
159
158
|
* 宽度
|
|
160
|
-
*
|
|
161
159
|
* @default "350px"
|
|
162
160
|
*/
|
|
163
161
|
width: string;
|
|
164
162
|
/**
|
|
165
163
|
* 高度
|
|
166
|
-
*
|
|
167
164
|
* @default "200px"
|
|
168
165
|
*/
|
|
169
166
|
height: string;
|
|
170
167
|
/**
|
|
171
168
|
* 位置
|
|
172
|
-
*
|
|
173
169
|
* @default "center"
|
|
174
170
|
*/
|
|
175
171
|
position?: PopsPosition;
|
|
176
172
|
/**
|
|
177
173
|
* 动画
|
|
178
|
-
*
|
|
179
174
|
* @default "pops-anim-fadein-zoom"
|
|
180
175
|
*/
|
|
181
|
-
animation?: PopsAnimation;
|
|
176
|
+
animation?: PopsAnimation | false;
|
|
182
177
|
/**
|
|
183
178
|
* z-index显示层级
|
|
184
|
-
*
|
|
185
179
|
* @default 10000
|
|
186
180
|
*/
|
|
187
181
|
zIndex?: IFunction<number>;
|
|
@@ -193,38 +187,41 @@ export interface PopsGeneralConfig {
|
|
|
193
187
|
* 是否禁用页面滚动
|
|
194
188
|
*
|
|
195
189
|
* 暂时不会生效
|
|
196
|
-
*
|
|
197
190
|
* @default false
|
|
198
191
|
*/
|
|
199
192
|
forbiddenScroll?: boolean;
|
|
200
193
|
/**
|
|
201
194
|
* (可选)自定义style
|
|
202
|
-
* @default
|
|
195
|
+
* @default null
|
|
203
196
|
*/
|
|
204
197
|
style?: string | null;
|
|
205
198
|
/**
|
|
206
199
|
* (可选)自定义浅色模式的style
|
|
207
200
|
*
|
|
208
|
-
*
|
|
201
|
+
* css都在`@media (prefers-color-scheme: light)`内
|
|
202
|
+
* @default null
|
|
209
203
|
*/
|
|
210
204
|
lightStyle?: string | null;
|
|
211
205
|
/**
|
|
212
206
|
* (可选)自定义深色模式的style
|
|
213
207
|
*
|
|
214
|
-
*
|
|
208
|
+
* css都在`@media (prefers-color-scheme: dark)`内
|
|
209
|
+
* @default null
|
|
215
210
|
*/
|
|
216
211
|
darkStyle?: string | null;
|
|
217
212
|
/**
|
|
218
213
|
* (可选)是否阻止`keydown`事件传播
|
|
219
214
|
*
|
|
220
215
|
* 主要是阻止当`keydown`触发来源为输入框时,即在输入框内按下按键不会触发页面的快捷键
|
|
221
|
-
* @default true
|
|
216
|
+
* @default true 阻止
|
|
222
217
|
*/
|
|
223
218
|
stopKeyDownEventPropagation?: boolean;
|
|
224
219
|
/**
|
|
225
|
-
*
|
|
226
|
-
*
|
|
227
|
-
*
|
|
220
|
+
* 可传入自定义事件监听器代替内部的eventEmitter
|
|
221
|
+
*
|
|
222
|
+
* 一般用于监听内部处理的事件
|
|
223
|
+
*
|
|
224
|
+
* 某些事件如:`pops:before-append-to-page`会提前触发,那么就需要自定义的监听器来监听
|
|
228
225
|
*/
|
|
229
|
-
|
|
226
|
+
emitter?: EventEmiter | null | undefined;
|
|
230
227
|
}
|
package/src/types/global.d.ts
CHANGED
|
@@ -1417,6 +1417,36 @@ class PopsDOMUtils extends PopsDOMUtilsEvent {
|
|
|
1417
1417
|
getTransitionEndNameList() {
|
|
1418
1418
|
return ["webkitTransitionEnd", "mozTransitionEnd", "MSTransitionEnd", "otransitionend", "transitionend"];
|
|
1419
1419
|
}
|
|
1420
|
+
/**
|
|
1421
|
+
* 是否是隐藏状态
|
|
1422
|
+
*
|
|
1423
|
+
* 检测以下项:
|
|
1424
|
+
*
|
|
1425
|
+
* + `display`: none
|
|
1426
|
+
* + `visibility`: hidden
|
|
1427
|
+
* + `opacity`: 0
|
|
1428
|
+
* + `使用了pops的自定义的隐藏class类`
|
|
1429
|
+
* @param $el 需要检测的元素
|
|
1430
|
+
*/
|
|
1431
|
+
isHide($el: Element) {
|
|
1432
|
+
let flag = false;
|
|
1433
|
+
if (
|
|
1434
|
+
this.containsClassName($el, PopsCommonCSSClassName.hide) ||
|
|
1435
|
+
this.containsClassName($el, PopsCommonCSSClassName.hideImportant)
|
|
1436
|
+
) {
|
|
1437
|
+
flag = true;
|
|
1438
|
+
} else {
|
|
1439
|
+
if ($el instanceof HTMLElement) {
|
|
1440
|
+
const style = $el.style;
|
|
1441
|
+
flag = style.display.includes("none") || style.visibility.includes("hidden") || style.opacity !== "0";
|
|
1442
|
+
}
|
|
1443
|
+
if (!flag) {
|
|
1444
|
+
const style = globalThis.getComputedStyle($el);
|
|
1445
|
+
flag = style.display.includes("none") || style.visibility.includes("hidden") || style.opacity !== "0";
|
|
1446
|
+
}
|
|
1447
|
+
}
|
|
1448
|
+
return flag;
|
|
1449
|
+
}
|
|
1420
1450
|
/**
|
|
1421
1451
|
* 实现jQuery中的$().offset();
|
|
1422
1452
|
* @param element
|
|
@@ -1695,7 +1725,7 @@ class PopsDOMUtils extends PopsDOMUtilsEvent {
|
|
|
1695
1725
|
* @param className className属性
|
|
1696
1726
|
*/
|
|
1697
1727
|
addClassName(
|
|
1698
|
-
$el: Element | undefined | null
|
|
1728
|
+
$el: Element | undefined | null,
|
|
1699
1729
|
className: string | string[] | (() => string | string[]) | undefined | null
|
|
1700
1730
|
) {
|
|
1701
1731
|
if ($el == null) return;
|
|
@@ -1743,7 +1773,7 @@ class PopsDOMUtils extends PopsDOMUtilsEvent {
|
|
|
1743
1773
|
* @param $el 目标元素
|
|
1744
1774
|
* @param className className属性
|
|
1745
1775
|
*/
|
|
1746
|
-
containsClassName($el:
|
|
1776
|
+
containsClassName($el: Element | undefined | null, className: string): boolean {
|
|
1747
1777
|
if ($el == null) {
|
|
1748
1778
|
return false;
|
|
1749
1779
|
}
|