@whitesev/pops 2.6.0 → 3.0.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 +1233 -1092
- 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 +1233 -1092
- 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 +1233 -1092
- 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 +1233 -1092
- 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 +1233 -1092
- 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 +1233 -1092
- 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/eslint.config.d.mts +2 -0
- package/dist/types/src/Pops.d.ts +98 -103
- package/dist/types/src/PopsInst.d.ts +2 -2
- package/dist/types/src/components/alert/defaultConfig.d.ts +2 -0
- package/dist/types/src/components/alert/index.d.ts +2 -2
- package/dist/types/src/components/alert/types/index.d.ts +4 -4
- package/dist/types/src/components/confirm/defaultConfig.d.ts +2 -0
- package/dist/types/src/components/confirm/index.d.ts +2 -2
- package/dist/types/src/components/confirm/types/index.d.ts +2 -2
- package/dist/types/src/components/drawer/defaultConfig.d.ts +2 -0
- package/dist/types/src/components/drawer/index.d.ts +2 -2
- package/dist/types/src/components/drawer/types/index.d.ts +2 -2
- package/dist/types/src/components/folder/defaultConfig.d.ts +2 -0
- package/dist/types/src/components/folder/index.d.ts +2 -2
- package/dist/types/src/components/folder/types/index.d.ts +31 -7
- package/dist/types/src/components/iframe/defaultConfig.d.ts +2 -0
- package/dist/types/src/components/iframe/index.d.ts +2 -5
- package/dist/types/src/components/iframe/types/index.d.ts +13 -42
- package/dist/types/src/components/loading/defaultConfig.d.ts +2 -0
- package/dist/types/src/components/loading/index.d.ts +2 -2
- package/dist/types/src/components/loading/types/index.d.ts +4 -4
- package/dist/types/src/components/panel/defaultConfig.d.ts +2 -0
- package/dist/types/src/components/panel/handlerComponents.d.ts +47 -43
- package/dist/types/src/components/panel/index.d.ts +3 -3
- package/dist/types/src/components/panel/types/components-button.d.ts +7 -6
- package/dist/types/src/components/panel/types/components-common.d.ts +7 -7
- package/dist/types/src/components/panel/types/components-container.d.ts +24 -0
- package/dist/types/src/components/panel/types/components-deepMenu.d.ts +13 -13
- package/dist/types/src/components/panel/types/components-input.d.ts +6 -6
- package/dist/types/src/components/panel/types/components-own.d.ts +2 -2
- package/dist/types/src/components/panel/types/components-select.d.ts +9 -9
- package/dist/types/src/components/panel/types/components-selectMultiple.d.ts +8 -8
- package/dist/types/src/components/panel/types/components-slider.d.ts +7 -7
- package/dist/types/src/components/panel/types/components-switch.d.ts +6 -6
- package/dist/types/src/components/panel/types/components-textarea.d.ts +6 -6
- package/dist/types/src/components/panel/types/index.d.ts +36 -28
- package/dist/types/src/components/prompt/defaultConfig.d.ts +2 -0
- package/dist/types/src/components/prompt/index.d.ts +2 -2
- package/dist/types/src/components/prompt/types/index.d.ts +4 -3
- package/dist/types/src/components/rightClickMenu/defaultConfig.d.ts +2 -0
- package/dist/types/src/components/rightClickMenu/index.d.ts +29 -27
- package/dist/types/src/components/rightClickMenu/types/index.d.ts +32 -11
- package/dist/types/src/components/searchSuggestion/defaultConfig.d.ts +2 -0
- package/dist/types/src/components/searchSuggestion/index.d.ts +21 -6
- package/dist/types/src/components/searchSuggestion/types/index.d.ts +15 -13
- package/dist/types/src/components/tooltip/defaultConfig.d.ts +2 -0
- package/dist/types/src/components/tooltip/index.d.ts +6 -21
- package/dist/types/src/components/tooltip/types/index.d.ts +8 -6
- package/dist/types/src/config/GlobalConfig.d.ts +3 -3
- package/dist/types/src/handler/PopsElementHandler.d.ts +6 -6
- package/dist/types/src/handler/PopsHandler.d.ts +18 -18
- package/dist/types/src/types/button.d.ts +4 -97
- package/dist/types/src/types/components.d.ts +8 -8
- package/dist/types/src/types/event.d.ts +0 -30
- package/dist/types/src/types/global.d.ts +2 -0
- package/dist/types/src/types/inst.d.ts +5 -5
- package/dist/types/src/types/main.d.ts +35 -80
- package/dist/types/src/types/mask.d.ts +18 -15
- package/dist/types/src/utils/PopsInstanceUtils.d.ts +15 -15
- package/dist/types/src/utils/PopsUtils.d.ts +4 -0
- package/package.json +10 -10
- package/src/Pops.ts +44 -44
- package/src/PopsAnimation.ts +1 -1
- package/src/PopsInst.ts +2 -2
- package/src/components/alert/{config.ts → defaultConfig.ts} +7 -7
- package/src/components/alert/index.ts +16 -18
- package/src/components/alert/types/index.ts +4 -4
- package/src/components/confirm/{config.ts → defaultConfig.ts} +11 -11
- package/src/components/confirm/index.ts +11 -13
- package/src/components/confirm/types/index.ts +3 -3
- package/src/components/drawer/{config.ts → defaultConfig.ts} +10 -10
- package/src/components/drawer/index.ts +18 -17
- package/src/components/drawer/types/index.ts +3 -3
- package/src/components/folder/{config.ts → defaultConfig.ts} +22 -18
- package/src/components/folder/index.ts +61 -60
- package/src/components/folder/types/index.ts +31 -18
- package/src/components/iframe/{config.ts → defaultConfig.ts} +2 -2
- package/src/components/iframe/index.ts +24 -29
- package/src/components/iframe/types/index.ts +13 -56
- package/src/components/loading/{config.ts → defaultConfig.ts} +3 -3
- package/src/components/loading/index.ts +13 -11
- package/src/components/loading/types/index.ts +5 -5
- package/src/components/panel/{config.ts → defaultConfig.ts} +115 -37
- package/src/components/panel/handlerComponents.ts +446 -428
- package/src/components/panel/index.css +11 -3
- package/src/components/panel/index.ts +15 -28
- package/src/components/panel/types/components-button.ts +7 -6
- package/src/components/panel/types/components-common.ts +7 -7
- package/src/components/panel/types/components-container.ts +25 -0
- package/src/components/panel/types/components-deepMenu.ts +13 -13
- package/src/components/panel/types/components-input.ts +6 -6
- package/src/components/panel/types/components-own.ts +2 -2
- package/src/components/panel/types/components-select.ts +11 -11
- package/src/components/panel/types/components-selectMultiple.ts +8 -9
- package/src/components/panel/types/components-slider.ts +7 -7
- package/src/components/panel/types/components-switch.ts +6 -6
- package/src/components/panel/types/components-textarea.ts +6 -6
- package/src/components/panel/types/index.ts +45 -38
- package/src/components/prompt/{config.ts → defaultConfig.ts} +10 -10
- package/src/components/prompt/index.ts +13 -15
- package/src/components/prompt/types/index.ts +4 -3
- package/src/components/rightClickMenu/{config.ts → defaultConfig.ts} +20 -19
- package/src/components/rightClickMenu/index.ts +125 -108
- package/src/components/rightClickMenu/types/index.ts +36 -14
- package/src/components/searchSuggestion/{config.ts → defaultConfig.ts} +18 -11
- package/src/components/searchSuggestion/index.ts +116 -96
- package/src/components/searchSuggestion/types/index.ts +17 -15
- package/src/components/tooltip/{config.ts → defaultConfig.ts} +5 -6
- package/src/components/tooltip/index.ts +21 -21
- package/src/components/tooltip/types/index.ts +9 -7
- package/src/config/GlobalConfig.ts +2 -2
- package/src/css/common.css +6 -0
- package/src/handler/PopsElementHandler.ts +29 -30
- package/src/handler/PopsHandler.ts +43 -43
- package/src/svg/cpu.svg +7 -7
- package/src/svg/delete.svg +4 -4
- package/src/svg/documentCopy.svg +4 -4
- package/src/svg/edit.svg +7 -7
- package/src/svg/eleme.svg +4 -4
- package/src/svg/elemePlus.svg +4 -4
- package/src/svg/headset.svg +4 -4
- package/src/svg/hide.svg +7 -7
- package/src/svg/keyboard.svg +7 -7
- package/src/svg/loading.svg +4 -4
- package/src/svg/max.svg +4 -4
- package/src/svg/min.svg +2 -4
- package/src/svg/mise.svg +4 -4
- package/src/svg/monitor.svg +4 -4
- package/src/svg/next.svg +4 -4
- package/src/svg/picture.svg +7 -7
- package/src/svg/prev.svg +4 -4
- package/src/svg/search.svg +4 -4
- package/src/svg/share.svg +4 -4
- package/src/svg/upload.svg +4 -4
- package/src/svg/videoPause.svg +4 -4
- package/src/svg/videoPlay.svg +4 -4
- package/src/svg/view.svg +4 -4
- package/src/types/button.d.ts +4 -97
- package/src/types/components.d.ts +8 -8
- package/src/types/event.d.ts +0 -30
- package/src/types/global.d.ts +2 -0
- package/src/types/inst.d.ts +5 -5
- package/src/types/main.d.ts +35 -80
- package/src/types/mask.d.ts +18 -15
- package/src/utils/PopsDOMUtils.ts +34 -34
- package/src/utils/PopsInstanceUtils.ts +129 -139
- package/src/utils/PopsUtils.ts +60 -45
- package/dist/types/src/components/alert/config.d.ts +0 -2
- package/dist/types/src/components/confirm/config.d.ts +0 -2
- package/dist/types/src/components/drawer/config.d.ts +0 -2
- package/dist/types/src/components/folder/config.d.ts +0 -2
- package/dist/types/src/components/iframe/config.d.ts +0 -2
- package/dist/types/src/components/loading/config.d.ts +0 -2
- package/dist/types/src/components/panel/config.d.ts +0 -2
- package/dist/types/src/components/panel/types/components-forms.d.ts +0 -23
- package/dist/types/src/components/prompt/config.d.ts +0 -2
- package/dist/types/src/components/rightClickMenu/config.d.ts +0 -2
- package/dist/types/src/components/searchSuggestion/config.d.ts +0 -2
- package/dist/types/src/components/tooltip/config.d.ts +0 -2
- package/src/components/panel/types/components-forms.ts +0 -24
package/src/types/mask.d.ts
CHANGED
|
@@ -1,20 +1,23 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
1
|
+
import type { PopsAlertConfig } from "../components/alert/types";
|
|
2
|
+
import type { PopsDrawerConfig } from "../components/drawer/types";
|
|
3
|
+
import type { PopsFolderConfig } from "../components/folder/types";
|
|
4
|
+
import type { PopsIframeConfig } from "../components/iframe/types";
|
|
5
|
+
import type { PopsLoadingConfig } from "../components/loading/types";
|
|
6
|
+
import type { PopsPanelConfig } from "../components/panel/types";
|
|
7
|
+
import type { PopsPromptConfig } from "../components/prompt/types/index";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* 遮罩层配置
|
|
11
11
|
*/
|
|
12
|
-
export interface
|
|
12
|
+
export interface PopsMaskConfig {
|
|
13
13
|
/**
|
|
14
14
|
* 是否启用遮罩层,默认false
|
|
15
15
|
* @default false
|
|
16
16
|
*/
|
|
17
17
|
enable?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* 点击事件
|
|
20
|
+
*/
|
|
18
21
|
clickEvent?: {
|
|
19
22
|
/**
|
|
20
23
|
* 点击遮罩层是否触发关闭事件
|
|
@@ -36,13 +39,13 @@ export interface PopsMaskDetails {
|
|
|
36
39
|
| ((
|
|
37
40
|
originalRun: () => void | Promise<void>,
|
|
38
41
|
config:
|
|
39
|
-
|
|
|
40
|
-
|
|
|
41
|
-
|
|
|
42
|
-
|
|
|
43
|
-
|
|
|
44
|
-
|
|
|
45
|
-
|
|
|
42
|
+
| PopsAlertConfig
|
|
43
|
+
| PopsDrawerConfig
|
|
44
|
+
| PopsIframeConfig
|
|
45
|
+
| PopsPromptConfig
|
|
46
|
+
| PopsFolderConfig
|
|
47
|
+
| PopsLoadingConfig
|
|
48
|
+
| PopsPanelConfig
|
|
46
49
|
) => void)
|
|
47
50
|
| undefined
|
|
48
51
|
| null;
|
|
@@ -237,7 +237,7 @@ class PopsDOMUtilsEvent {
|
|
|
237
237
|
*/
|
|
238
238
|
function domUtilsEventCallBack(event: Event) {
|
|
239
239
|
if (selectorList.length) {
|
|
240
|
-
|
|
240
|
+
// 存在子元素选择器
|
|
241
241
|
// 这时候的this和target都是子元素选择器的元素
|
|
242
242
|
let eventTarget = listenerOption.isComposedPath
|
|
243
243
|
? (event.composedPath()[0] as HTMLElement)
|
|
@@ -251,10 +251,10 @@ class PopsDOMUtilsEvent {
|
|
|
251
251
|
const findValue = selectorList.find((selectorItem) => {
|
|
252
252
|
// 判断目标元素是否匹配选择器
|
|
253
253
|
if (DOMUtilsContext.matches(eventTarget, selectorItem)) {
|
|
254
|
-
|
|
254
|
+
// 当前目标可以被selector所匹配到
|
|
255
255
|
return true;
|
|
256
256
|
}
|
|
257
|
-
|
|
257
|
+
// 在上层与主元素之间寻找可以被selector所匹配到的
|
|
258
258
|
const $closestMatches = DOMUtilsContext.closest<HTMLElement>(eventTarget, selectorItem);
|
|
259
259
|
if ($closestMatches && totalParent?.contains($closestMatches)) {
|
|
260
260
|
eventTarget = $closestMatches;
|
|
@@ -283,14 +283,14 @@ class PopsDOMUtilsEvent {
|
|
|
283
283
|
}
|
|
284
284
|
}
|
|
285
285
|
|
|
286
|
-
|
|
286
|
+
// 遍历事件名设置元素事件
|
|
287
287
|
eventTypeList.forEach((eventName) => {
|
|
288
288
|
elementItem.addEventListener(eventName, domUtilsEventCallBack, listenerOption);
|
|
289
|
-
|
|
289
|
+
// 获取对象上的事件
|
|
290
290
|
const elementEvents: {
|
|
291
291
|
[k: string]: PopsDOMUtilsEventListenerOptionsAttribute[];
|
|
292
292
|
} = Reflect.get(elementItem, SymbolEvents) || {};
|
|
293
|
-
|
|
293
|
+
// 初始化对象上的xx事件
|
|
294
294
|
elementEvents[eventName] = elementEvents[eventName] || [];
|
|
295
295
|
elementEvents[eventName].push({
|
|
296
296
|
selector: selectorList,
|
|
@@ -298,7 +298,7 @@ class PopsDOMUtilsEvent {
|
|
|
298
298
|
callback: domUtilsEventCallBack,
|
|
299
299
|
originCallBack: listenerCallBack,
|
|
300
300
|
});
|
|
301
|
-
|
|
301
|
+
// 覆盖事件
|
|
302
302
|
Reflect.set(elementItem, SymbolEvents, elementEvents);
|
|
303
303
|
});
|
|
304
304
|
});
|
|
@@ -513,7 +513,7 @@ class PopsDOMUtilsEvent {
|
|
|
513
513
|
) => boolean;
|
|
514
514
|
}
|
|
515
515
|
elementList.forEach((elementItem) => {
|
|
516
|
-
|
|
516
|
+
// 获取对象上的事件
|
|
517
517
|
const elementEvents: {
|
|
518
518
|
[key: string]: PopsDOMUtilsEventListenerOptionsAttribute[];
|
|
519
519
|
} = Reflect.get(elementItem, SymbolEvents) || {};
|
|
@@ -550,7 +550,7 @@ class PopsDOMUtilsEvent {
|
|
|
550
550
|
}
|
|
551
551
|
}
|
|
552
552
|
if (handlers.length === 0) {
|
|
553
|
-
|
|
553
|
+
// 如果没有任意的handler,那么删除该属性
|
|
554
554
|
popsUtils.delete(elementEvents, eventType);
|
|
555
555
|
}
|
|
556
556
|
});
|
|
@@ -689,10 +689,10 @@ class PopsDOMUtilsEvent {
|
|
|
689
689
|
}
|
|
690
690
|
}
|
|
691
691
|
if (checkDOMReadyState()) {
|
|
692
|
-
|
|
692
|
+
// 检查document状态
|
|
693
693
|
popsUtils.setTimeout(callback, 0);
|
|
694
694
|
} else {
|
|
695
|
-
|
|
695
|
+
// 添加监听
|
|
696
696
|
addDomReadyListener();
|
|
697
697
|
}
|
|
698
698
|
}
|
|
@@ -777,7 +777,7 @@ class PopsDOMUtilsEvent {
|
|
|
777
777
|
}
|
|
778
778
|
|
|
779
779
|
elementList.forEach((elementItem) => {
|
|
780
|
-
|
|
780
|
+
// 获取对象上的事件
|
|
781
781
|
const events = elementItem[SymbolEvents] || {};
|
|
782
782
|
eventTypeList.forEach((_eventType_) => {
|
|
783
783
|
let event: Event = null as any;
|
|
@@ -1046,20 +1046,20 @@ class PopsDOMUtilsEvent {
|
|
|
1046
1046
|
capture?: boolean
|
|
1047
1047
|
): boolean | undefined {
|
|
1048
1048
|
function stopEvent(event: Event) {
|
|
1049
|
-
|
|
1049
|
+
// 阻止事件的默认行为发生。例如,当点击一个链接时,浏览器会默认打开链接的URL
|
|
1050
1050
|
event?.preventDefault();
|
|
1051
|
-
|
|
1051
|
+
// 停止事件的传播,阻止它继续向更上层的元素冒泡,事件将不会再传播给其他的元素
|
|
1052
1052
|
event?.stopPropagation();
|
|
1053
|
-
|
|
1053
|
+
// 阻止事件传播,并且还能阻止元素上的其他事件处理程序被触发
|
|
1054
1054
|
event?.stopImmediatePropagation();
|
|
1055
1055
|
return false;
|
|
1056
1056
|
}
|
|
1057
1057
|
if (arguments.length === 1) {
|
|
1058
|
-
|
|
1058
|
+
// 直接阻止事件
|
|
1059
1059
|
// eslint-disable-next-line prefer-rest-params
|
|
1060
1060
|
return stopEvent(arguments[0]);
|
|
1061
1061
|
} else {
|
|
1062
|
-
|
|
1062
|
+
// 添加对应的事件来阻止触发
|
|
1063
1063
|
if (typeof eventNameList === "string") {
|
|
1064
1064
|
eventNameList = [eventNameList];
|
|
1065
1065
|
}
|
|
@@ -1354,7 +1354,7 @@ class PopsDOMUtils extends PopsDOMUtilsEvent {
|
|
|
1354
1354
|
return PopsCore.window.document.documentElement.clientWidth;
|
|
1355
1355
|
}
|
|
1356
1356
|
if ((element as HTMLElement).nodeType === 9) {
|
|
1357
|
-
|
|
1357
|
+
// Document文档节点
|
|
1358
1358
|
element = element as Document;
|
|
1359
1359
|
return Math.max(
|
|
1360
1360
|
element.body.scrollWidth,
|
|
@@ -1365,15 +1365,15 @@ class PopsDOMUtils extends PopsDOMUtilsEvent {
|
|
|
1365
1365
|
);
|
|
1366
1366
|
}
|
|
1367
1367
|
if (isShow || (!isShow && popsDOMUtils.isShow(element as HTMLElement))) {
|
|
1368
|
-
|
|
1369
|
-
|
|
1368
|
+
// 已显示
|
|
1369
|
+
// 不从style中获取对应的宽度,因为可能使用了class定义了width !important
|
|
1370
1370
|
element = element as HTMLElement;
|
|
1371
|
-
|
|
1371
|
+
// 如果element.style.width为空 则从css里面获取是否定义了width信息如果定义了 则读取css里面定义的宽度width
|
|
1372
1372
|
if (parseFloat(popsDOMUtils.getStyleValue(element, "width").toString()) > 0) {
|
|
1373
1373
|
return parseFloat(popsDOMUtils.getStyleValue(element, "width").toString());
|
|
1374
1374
|
}
|
|
1375
1375
|
|
|
1376
|
-
|
|
1376
|
+
// 如果从css里获取到的值不是大于0 可能是auto 则通过offsetWidth来进行计算
|
|
1377
1377
|
if (element.offsetWidth > 0) {
|
|
1378
1378
|
const borderLeftWidth = popsDOMUtils.getStyleValue(element, "borderLeftWidth");
|
|
1379
1379
|
const borderRightWidth = popsDOMUtils.getStyleValue(element, "borderRightWidth");
|
|
@@ -1389,7 +1389,7 @@ class PopsDOMUtils extends PopsDOMUtilsEvent {
|
|
|
1389
1389
|
}
|
|
1390
1390
|
return 0;
|
|
1391
1391
|
} else {
|
|
1392
|
-
|
|
1392
|
+
// 未显示
|
|
1393
1393
|
element = element as HTMLElement;
|
|
1394
1394
|
const { cloneNode, recovery } = popsDOMUtils.showElement(element, parent);
|
|
1395
1395
|
const width = DOMUtilsContext.width(cloneNode, true, parent);
|
|
@@ -1439,7 +1439,7 @@ class PopsDOMUtils extends PopsDOMUtilsEvent {
|
|
|
1439
1439
|
}
|
|
1440
1440
|
if ((element as Document).nodeType === 9) {
|
|
1441
1441
|
element = element as Document;
|
|
1442
|
-
|
|
1442
|
+
// Document文档节点
|
|
1443
1443
|
return Math.max(
|
|
1444
1444
|
element.body.scrollHeight,
|
|
1445
1445
|
element.documentElement.scrollHeight,
|
|
@@ -1450,14 +1450,14 @@ class PopsDOMUtils extends PopsDOMUtilsEvent {
|
|
|
1450
1450
|
}
|
|
1451
1451
|
if (isShow || (!isShow && popsDOMUtils.isShow(element as HTMLElement))) {
|
|
1452
1452
|
element = element as HTMLElement;
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1453
|
+
// 已显示
|
|
1454
|
+
// 从style中获取对应的高度,因为可能使用了class定义了width !important
|
|
1455
|
+
// 如果element.style.height为空 则从css里面获取是否定义了height信息如果定义了 则读取css里面定义的高度height
|
|
1456
1456
|
if (parseFloat(popsDOMUtils.getStyleValue(element, "height").toString()) > 0) {
|
|
1457
1457
|
return parseFloat(popsDOMUtils.getStyleValue(element, "height").toString());
|
|
1458
1458
|
}
|
|
1459
1459
|
|
|
1460
|
-
|
|
1460
|
+
// 如果从css里获取到的值不是大于0 可能是auto 则通过offsetHeight来进行计算
|
|
1461
1461
|
if (element.offsetHeight > 0) {
|
|
1462
1462
|
const borderTopWidth = popsDOMUtils.getStyleValue(element, "borderTopWidth");
|
|
1463
1463
|
const borderBottomWidth = popsDOMUtils.getStyleValue(element, "borderBottomWidth");
|
|
@@ -1473,7 +1473,7 @@ class PopsDOMUtils extends PopsDOMUtilsEvent {
|
|
|
1473
1473
|
}
|
|
1474
1474
|
return 0;
|
|
1475
1475
|
} else {
|
|
1476
|
-
|
|
1476
|
+
// 未显示
|
|
1477
1477
|
element = element as HTMLElement;
|
|
1478
1478
|
const { cloneNode, recovery } = popsDOMUtils.showElement(element, parent);
|
|
1479
1479
|
const height = DOMUtilsContext.height(cloneNode, true, parent);
|
|
@@ -1809,10 +1809,10 @@ class PopsDOMUtils extends PopsDOMUtilsEvent {
|
|
|
1809
1809
|
Object.keys(attributes).forEach((key) => {
|
|
1810
1810
|
let value = attributes[key];
|
|
1811
1811
|
if (typeof value === "object") {
|
|
1812
|
-
|
|
1812
|
+
// object转字符串
|
|
1813
1813
|
value = JSON.stringify(value);
|
|
1814
1814
|
} else if (typeof value === "function") {
|
|
1815
|
-
|
|
1815
|
+
// function转字符串
|
|
1816
1816
|
value = value.toString();
|
|
1817
1817
|
}
|
|
1818
1818
|
$temp.setAttribute(key, value);
|
|
@@ -1825,7 +1825,7 @@ class PopsDOMUtils extends PopsDOMUtilsEvent {
|
|
|
1825
1825
|
* @returns
|
|
1826
1826
|
*/
|
|
1827
1827
|
parseTextToDOM<R extends HTMLElement>(elementString: string): R {
|
|
1828
|
-
|
|
1828
|
+
// 去除前后的换行和空格
|
|
1829
1829
|
elementString = elementString.replace(/^[\n|\s]*/g, "").replace(/[\n|\s]*$/g, "");
|
|
1830
1830
|
const targetElement = this.createElement("div", {
|
|
1831
1831
|
innerHTML: elementString,
|
|
@@ -2087,7 +2087,7 @@ class PopsDOMUtils extends PopsDOMUtilsEvent {
|
|
|
2087
2087
|
}
|
|
2088
2088
|
}
|
|
2089
2089
|
if (Array.isArray(content) || content instanceof NodeList) {
|
|
2090
|
-
|
|
2090
|
+
// 数组
|
|
2091
2091
|
const fragment = PopsCore.document.createDocumentFragment();
|
|
2092
2092
|
content.forEach((ele) => {
|
|
2093
2093
|
if (typeof ele === "string") {
|
|
@@ -2176,7 +2176,7 @@ class PopsDOMUtils extends PopsDOMUtilsEvent {
|
|
|
2176
2176
|
let view = null;
|
|
2177
2177
|
let styles = null;
|
|
2178
2178
|
if (element instanceof CSSStyleDeclaration) {
|
|
2179
|
-
|
|
2179
|
+
// 直接就获取了style属性
|
|
2180
2180
|
styles = element;
|
|
2181
2181
|
} else {
|
|
2182
2182
|
view = element.ownerDocument.defaultView;
|