@whitesev/pops 2.5.2 → 2.5.3
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 +62 -74
- 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 +62 -74
- 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 +62 -74
- 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 +62 -74
- 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 +62 -74
- 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 +62 -74
- 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 +4 -4
- package/dist/types/src/components/panel/handlerComponents.d.ts +2 -2
- package/dist/types/src/components/panel/types/components-common.d.ts +3 -5
- package/dist/types/src/components/panel/types/index.d.ts +5 -11
- package/dist/types/src/components/rightClickMenu/index.d.ts +1 -1
- package/dist/types/src/components/rightClickMenu/types/index.d.ts +3 -2
- package/dist/types/src/components/searchSuggestion/types/index.d.ts +3 -2
- package/dist/types/src/components/tooltip/index.d.ts +1 -1
- package/dist/types/src/components/tooltip/types/index.d.ts +2 -1
- package/dist/types/src/utils/PopsDOMUtils.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/panel/config.ts +36 -43
- package/src/components/panel/handlerComponents.ts +7 -22
- package/src/components/panel/types/components-common.ts +5 -9
- package/src/components/panel/types/index.ts +5 -13
- package/src/components/rightClickMenu/types/index.ts +3 -2
- package/src/components/searchSuggestion/types/index.ts +3 -2
- package/src/components/tooltip/index.ts +1 -3
- package/src/components/tooltip/types/index.ts +2 -1
- package/src/utils/PopsDOMUtils.ts +23 -10
|
@@ -1575,18 +1575,31 @@ class PopsDOMUtils extends PopsDOMUtilsEvent {
|
|
|
1575
1575
|
* @param $el 目标元素
|
|
1576
1576
|
* @param className className属性
|
|
1577
1577
|
*/
|
|
1578
|
-
addClassName(
|
|
1579
|
-
|
|
1580
|
-
|
|
1578
|
+
addClassName(
|
|
1579
|
+
$el: Element | undefined | null | undefined,
|
|
1580
|
+
className: string | string[] | (() => string | string[]) | undefined | null
|
|
1581
|
+
) {
|
|
1582
|
+
if ($el == null) return;
|
|
1583
|
+
if (className == null) return;
|
|
1584
|
+
|
|
1585
|
+
if (typeof className === "function") {
|
|
1586
|
+
className = className();
|
|
1581
1587
|
}
|
|
1582
|
-
if (
|
|
1583
|
-
|
|
1588
|
+
if (!Array.isArray(className)) {
|
|
1589
|
+
className = [className];
|
|
1584
1590
|
}
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1591
|
+
className.forEach((classNameStrItem) => {
|
|
1592
|
+
if (typeof classNameStrItem !== "string") {
|
|
1593
|
+
// 不是字符串
|
|
1594
|
+
return;
|
|
1595
|
+
}
|
|
1596
|
+
if (classNameStrItem.trim() === "") {
|
|
1597
|
+
// 空字符串
|
|
1598
|
+
return;
|
|
1599
|
+
}
|
|
1600
|
+
const classNameList = classNameStrItem.split(" ").filter((item) => item.trim() !== "");
|
|
1601
|
+
$el?.classList?.add?.(...classNameList);
|
|
1602
|
+
});
|
|
1590
1603
|
}
|
|
1591
1604
|
/**
|
|
1592
1605
|
* 删除className
|