nhanh-pure-function 1.2.3 → 1.2.4
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/lib/User.js +21 -22
- package/package.json +1 -1
package/lib/User.js
CHANGED
|
@@ -395,16 +395,32 @@ export class _LoadingController {
|
|
|
395
395
|
* @param options.isClickAllowed 是否允许该点击 ( 如果不确定可以返回 undefined )
|
|
396
396
|
*/
|
|
397
397
|
export function _CloseOnOutsideClick(querySelector, callback, options) {
|
|
398
|
+
const { isClickAllowed, uiLibrary = ["naiveUI", "ElementPlus", "Element"] } =
|
|
399
|
+
options || {};
|
|
400
|
+
|
|
401
|
+
const UI = (function (obj) {
|
|
402
|
+
const arr = [];
|
|
403
|
+
for (const key in obj) {
|
|
404
|
+
if (Object.hasOwnProperty.call(obj, key)) {
|
|
405
|
+
if (uiLibrary.includes(key)) arr.push(...obj[key]);
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
return arr;
|
|
409
|
+
})({
|
|
410
|
+
naiveUI: [
|
|
411
|
+
".v-binder-follower-container",
|
|
412
|
+
".n-image-preview-container",
|
|
413
|
+
".n-modal-container",
|
|
414
|
+
],
|
|
415
|
+
ElementPlus: [".el-popper"],
|
|
416
|
+
Element: [".el-popper"],
|
|
417
|
+
});
|
|
418
|
+
|
|
398
419
|
function end() {
|
|
399
420
|
callback();
|
|
400
421
|
document.removeEventListener("mousedown", mousedown);
|
|
401
422
|
}
|
|
402
423
|
function mousedown(event) {
|
|
403
|
-
const {
|
|
404
|
-
isClickAllowed,
|
|
405
|
-
uiLibrary = ["naiveUI", "ElementPlus", "Element"],
|
|
406
|
-
} = options || {};
|
|
407
|
-
|
|
408
424
|
if (isClickAllowed) {
|
|
409
425
|
const bool = isClickAllowed(event);
|
|
410
426
|
if (bool) return;
|
|
@@ -416,23 +432,6 @@ export function _CloseOnOutsideClick(querySelector, callback, options) {
|
|
|
416
432
|
/** 元素这时可能已经被删除了 */
|
|
417
433
|
if (!target?.closest("body")) return;
|
|
418
434
|
|
|
419
|
-
const UI = (function (obj) {
|
|
420
|
-
const arr = [];
|
|
421
|
-
for (const key in obj) {
|
|
422
|
-
if (Object.hasOwnProperty.call(obj, key)) {
|
|
423
|
-
if (uiLibrary.includes(key)) arr.concat(obj[key]);
|
|
424
|
-
}
|
|
425
|
-
}
|
|
426
|
-
return arr;
|
|
427
|
-
})({
|
|
428
|
-
naiveUI: [
|
|
429
|
-
".v-binder-follower-container",
|
|
430
|
-
".n-image-preview-container",
|
|
431
|
-
".n-modal-container",
|
|
432
|
-
],
|
|
433
|
-
ElementPlus: ["el-popper"],
|
|
434
|
-
Element: ["el-popper"],
|
|
435
|
-
});
|
|
436
435
|
const isClickable = querySelector
|
|
437
436
|
.concat(UI)
|
|
438
437
|
.some((className) => Boolean(target?.closest(className)));
|