@whitesev/pops 1.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.
Files changed (46) hide show
  1. package/dist/index.amd.js +4651 -0
  2. package/dist/index.amd.js.map +1 -0
  3. package/dist/index.cjs.js +4649 -0
  4. package/dist/index.cjs.js.map +1 -0
  5. package/dist/index.esm.js +4647 -0
  6. package/dist/index.esm.js.map +1 -0
  7. package/dist/index.iife.js +4652 -0
  8. package/dist/index.iife.js.map +1 -0
  9. package/dist/index.system.js +4654 -0
  10. package/dist/index.system.js.map +1 -0
  11. package/dist/index.umd.js +4655 -0
  12. package/dist/index.umd.js.map +1 -0
  13. package/dist/types/index.d.ts +2 -0
  14. package/dist/types/src/Config.d.ts +1 -0
  15. package/dist/types/src/Core.d.ts +18 -0
  16. package/dist/types/src/Pops.d.ts +171 -0
  17. package/dist/types/src/components/alert/index.d.ts +4 -0
  18. package/dist/types/src/components/confirm/index.d.ts +4 -0
  19. package/dist/types/src/components/drawer/index.d.ts +2 -0
  20. package/dist/types/src/components/folder/index.d.ts +2 -0
  21. package/dist/types/src/components/iframe/index.d.ts +2 -0
  22. package/dist/types/src/components/loading/index.d.ts +2 -0
  23. package/dist/types/src/components/panel/index.d.ts +2 -0
  24. package/dist/types/src/components/prompt/index.d.ts +2 -0
  25. package/dist/types/src/components/rightClickMenu/index.d.ts +2 -0
  26. package/dist/types/src/components/tooltip/index.d.ts +2 -0
  27. package/dist/types/src/handler/PopsElementHandler.d.ts +54 -0
  28. package/dist/types/src/handler/PopsHandler.d.ts +210 -0
  29. package/dist/types/src/utils/AnyTouch.d.ts +17 -0
  30. package/dist/types/src/utils/PopsDOMUtils.d.ts +278 -0
  31. package/dist/types/src/utils/PopsDOMUtilsEvent.d.ts +332 -0
  32. package/dist/types/src/utils/PopsMathUtils.d.ts +25 -0
  33. package/dist/types/src/utils/PopsUIUtils.d.ts +85 -0
  34. package/dist/types/src/utils/PopsUtils.d.ts +123 -0
  35. package/package.json +42 -0
  36. package/src/types/PopsDOMUtilsEventType.d.ts +248 -0
  37. package/src/types/animation.d.ts +19 -0
  38. package/src/types/button.d.ts +216 -0
  39. package/src/types/components.d.ts +197 -0
  40. package/src/types/event.d.ts +60 -0
  41. package/src/types/global.d.ts +11 -0
  42. package/src/types/icon.d.ts +30 -0
  43. package/src/types/layer.d.ts +20 -0
  44. package/src/types/main.d.ts +89 -0
  45. package/src/types/mask.d.ts +35 -0
  46. package/src/types/position.d.ts +60 -0
@@ -0,0 +1,4 @@
1
+ import type { PopsConfirmDetails } from "./types";
2
+ export declare class PopsConfirm {
3
+ constructor(details: PopsConfirmDetails);
4
+ }
@@ -0,0 +1,2 @@
1
+ export declare class PopsDrawer {
2
+ }
@@ -0,0 +1,2 @@
1
+ export declare class PopsFolder {
2
+ }
@@ -0,0 +1,2 @@
1
+ export declare class PopsIframe {
2
+ }
@@ -0,0 +1,2 @@
1
+ export declare class PopsLoading {
2
+ }
@@ -0,0 +1,2 @@
1
+ export declare class PopsPanel {
2
+ }
@@ -0,0 +1,2 @@
1
+ export declare class PopsPrompt {
2
+ }
@@ -0,0 +1,2 @@
1
+ export declare class PopsRightClickMenu {
2
+ }
@@ -0,0 +1,2 @@
1
+ export declare class PopsTooltip {
2
+ }
@@ -0,0 +1,54 @@
1
+ import type { PopsSupportAnim, PopsSupportBottomBtn, PopsSupportContent, PopsSupportHeaderTitle, PopsTypeSupportAnim, PopsTypeSupportBottomBtn, PopsTypeSupportContent, PopsTypeSupportHeaderTitle } from "../types/main";
2
+ export declare const PopsElementHandler: {
3
+ /**
4
+ * 获取遮罩层HTML
5
+ * @param guid
6
+ * @param zIndex z-index
7
+ * @param style
8
+ */
9
+ getMaskHTML(guid: string, zIndex?: number, style?: string): string;
10
+ /**
11
+ * 获取动画层HTML
12
+ * @param guid
13
+ * @param type
14
+ * @param config
15
+ * @param html
16
+ * @param bottomBtnHTML
17
+ */
18
+ getAnimHTML(guid: string, type: PopsTypeSupportAnim, config: PopsSupportAnim[keyof PopsSupportAnim], html?: string, bottomBtnHTML?: string): string;
19
+ /**
20
+ * 获取顶部按钮层HTML
21
+ * @param type
22
+ * @param config
23
+ */
24
+ getHeaderBtnHTML(type: PopsTypeSupportHeaderTitle, config: PopsSupportHeaderTitle[keyof PopsSupportHeaderTitle]): string;
25
+ /**
26
+ * 获取底部按钮层HTML
27
+ * @param type
28
+ * @param config
29
+ */
30
+ getBottomBtnHTML(type: PopsTypeSupportBottomBtn, config: PopsSupportBottomBtn[keyof PopsSupportBottomBtn]): string;
31
+ /**
32
+ * 获取标题style
33
+ * @param type
34
+ * @param config
35
+ */
36
+ getHeaderStyle(type: PopsTypeSupportHeaderTitle, config: PopsSupportHeaderTitle[keyof PopsSupportHeaderTitle]): {
37
+ headerStyle: string;
38
+ headerPStyle: string;
39
+ };
40
+ /**
41
+ * 获取内容style
42
+ * @param type
43
+ * @param config
44
+ */
45
+ getContentStyle(type: PopsTypeSupportContent, config: PopsSupportContent[keyof PopsSupportContent]): {
46
+ contentStyle: string;
47
+ contentPStyle: string;
48
+ };
49
+ /**
50
+ * 将html转换成元素
51
+ * @param html
52
+ */
53
+ parseElement<T extends HTMLElement>(html: string): T;
54
+ };
@@ -0,0 +1,210 @@
1
+ import type { PopsAlertDetails } from "../components/alert/types";
2
+ import type { PopsConfirmDetails } from "../components/confirm/types";
3
+ import type { PopsDrawerDetails } from "../components/drawer/types";
4
+ import type { PopsFolderDetails } from "../components/folder/types";
5
+ import type { PopsIframeDetails } from "../components/iframe/types";
6
+ import type { PopsLoadingDetails } from "../components/loading/types";
7
+ import type { PopsPanelDetails } from "../components/panel/types";
8
+ import type { PopsPromptDetails } from "../components/prompt/types";
9
+ import type { PopsLayerMode, PopsMode, PopsType } from "../types/main";
10
+ export declare const PopsHandler: {
11
+ /**
12
+ * 创建shadow
13
+ */
14
+ handlerShadow(): {
15
+ $shadowContainer: HTMLDivElement;
16
+ $shadowRoot: ShadowRoot;
17
+ };
18
+ /**
19
+ * 处理初始化
20
+ * @param $shadowRoot 所在的shadowRoot
21
+ * @param cssText 添加进ShadowRoot的CSS
22
+ */
23
+ handleInit($shadowRoot: ShadowRoot, cssText: string | string[]): void;
24
+ /**
25
+ * 处理遮罩层
26
+ * @param details 传递的配置
27
+ */
28
+ handleMask(details?: {
29
+ type: "alert" | "confirm" | "prompt" | "loading" | "iframe" | "drawer" | "folder" | "panel";
30
+ guid: string;
31
+ config: Required<PopsAlertDetails>;
32
+ animElement: HTMLElement;
33
+ maskHTML: string;
34
+ }): {
35
+ maskElement: HTMLDivElement;
36
+ };
37
+ /**
38
+ * 处理获取元素
39
+ * @param {HTMLDivElement} animElement
40
+ * @param type
41
+ */
42
+ handleQueryElement(animElement: HTMLDivElement, type: PopsType): {
43
+ /**
44
+ * 主元素
45
+ */
46
+ popsElement: HTMLDivElement | null;
47
+ /**
48
+ * 确认按钮
49
+ */
50
+ btnOkElement: HTMLDivElement | null;
51
+ /**
52
+ * 取消按钮
53
+ */
54
+ btnCancelElement: HTMLDivElement | null;
55
+ /**
56
+ * 其它按钮
57
+ */
58
+ btnOtherElement: HTMLDivElement | null;
59
+ /**
60
+ * 标题元素
61
+ */
62
+ titleElement: HTMLDivElement | null;
63
+ /**
64
+ * 输入框元素
65
+ */
66
+ inputElement: HTMLInputElement | HTMLTextAreaElement | null;
67
+ /**
68
+ * 顶部按钮控制层元素
69
+ */
70
+ headerControlsElement: HTMLDivElement | null;
71
+ /**
72
+ * iframe元素
73
+ */
74
+ iframeElement: HTMLIFrameElement | null;
75
+ /**
76
+ * 加载中元素
77
+ */
78
+ loadingElement: HTMLDivElement | null;
79
+ /**
80
+ * 内容元素
81
+ */
82
+ contentElement: HTMLDivElement | null;
83
+ /**
84
+ * 内容侧边栏容器元素
85
+ */
86
+ contentAsideElement: HTMLDivElement | null;
87
+ /**
88
+ * 内容主要区域容器元素
89
+ */
90
+ contentSectionContainerElement: HTMLDivElement | null;
91
+ /**
92
+ * 内容加载中元素
93
+ */
94
+ contentLoadingElement: HTMLDivElement | null;
95
+ /**
96
+ * 顶部缩小按钮
97
+ */
98
+ headerMinBtnElement: HTMLDivElement | null;
99
+ /**
100
+ * 顶部放大按钮
101
+ */
102
+ headerMaxBtnElement: HTMLDivElement | null;
103
+ /**
104
+ * 顶部恢复原样按钮
105
+ */
106
+ headerMiseBtnElement: HTMLDivElement | null;
107
+ /**
108
+ * 顶部关闭按钮
109
+ */
110
+ headerCloseBtnElement: HTMLDivElement | null;
111
+ /**
112
+ * 文件夹列表元素
113
+ */
114
+ folderListElement: HTMLDivElement | null;
115
+ /**
116
+ * 文件夹列表顶部元素
117
+ */
118
+ folderListHeaderElement: HTMLDivElement | null;
119
+ /**
120
+ * 文件夹列表行元素
121
+ */
122
+ folderListHeaderRowElement: HTMLTableRowElement | null;
123
+ /**
124
+ * 文件夹列表tbody元素
125
+ */
126
+ folderListBodyElement: HTMLTableElement | null;
127
+ /**
128
+ * 文件夹列表primary元素
129
+ */
130
+ folderFileListBreadcrumbPrimaryElement: HTMLDivElement | null;
131
+ /**
132
+ * 文件夹排序按钮-文件名
133
+ */
134
+ folderListSortFileNameElement: HTMLDivElement | null;
135
+ /**
136
+ * 文件夹排序按钮-修改时间
137
+ */
138
+ folderListSortLatestTimeElement: HTMLDivElement | null;
139
+ /**
140
+ * 文件夹排序按钮-文件大小
141
+ */
142
+ folderListSortFileSizeElement: HTMLDivElement | null;
143
+ };
144
+ /**
145
+ * 获取事件配置
146
+ * @param guid
147
+ * @param $shadowContainer
148
+ * @param $shadowRoot
149
+ * @param mode 当前弹窗类型
150
+ * @param animElement 动画层
151
+ * @param popsElement 主元素
152
+ * @param maskElement 遮罩层
153
+ * @param config 当前配置
154
+ */
155
+ handleEventDetails(guid: string, $shadowContainer: HTMLDivElement, $shadowRoot: ShadowRoot, mode: PopsLayerMode, animElement: HTMLDivElement, popsElement: HTMLDivElement, maskElement: HTMLDivElement, config: PopsAlertDetails | PopsDrawerDetails | PopsPromptDetails | PopsConfirmDetails | PopsIframeDetails | PopsLoadingDetails | PopsPanelDetails | PopsFolderDetails): PopsEventDetails;
156
+ /**
157
+ * 处理返回的配置,针对popsHandler.handleEventDetails
158
+ */
159
+ handleResultDetails(details: any): {
160
+ $shadowContainer: HTMLDivElement;
161
+ $shadowRoot: ShadowRoot;
162
+ animElement: HTMLElement;
163
+ popsElement: HTMLElement;
164
+ maskElement: HTMLElement;
165
+ close: () => void;
166
+ hide: () => void;
167
+ show: () => void;
168
+ };
169
+ /**
170
+ * 处理点击事件
171
+ * @param type 当前按钮类型
172
+ * @param $btn 按钮元素
173
+ * @param eventDetails 事件配置,由popsHandler.handleEventDetails创建的
174
+ * @param callback 点击回调
175
+ */
176
+ handleClickEvent(type: "cancel" | "close" | "ok" | "other", $btn: HTMLElement, eventDetails: PopsEventDetails, callback: (details: PopsHandlerEventDetails, event: PointerEvent | MouseEvent) => void): void;
177
+ /**
178
+ * 全局监听键盘事件
179
+ * @param keyName 键名|键值
180
+ * @param otherKeyList 组合按键,数组类型,包含ctrl、shift、alt和meta(win键或mac的cmd键)
181
+ * @param callback 回调函数
182
+ */
183
+ handleKeyboardEvent(keyName: string | number, otherKeyList: string[] | undefined, callback: (event: KeyboardEvent) => void): {
184
+ removeKeyboardEvent(): void;
185
+ };
186
+ /**
187
+ * 处理prompt的点击事件
188
+ * @param inputElement 输入框
189
+ * @param $btn 按钮元素
190
+ * @param type 触发事件类型
191
+ * @param event 事件配置,由popsHandler.handleEventDetails创建的
192
+ * @param callback 点击回调
193
+ */
194
+ handlePromptClickEvent(inputElement: HTMLInputElement, $btn: HTMLElement, type: "ok" | "close", event: MouseEvent | PointerEvent, callback: (event: (MouseEvent | PointerEvent) & {
195
+ type: any;
196
+ text: string;
197
+ }) => void): void;
198
+ /**
199
+ * 处理config.only
200
+ * @param type 当前弹窗类型
201
+ * @param config 配置
202
+ */
203
+ handleOnly<T extends unknown>(type: PopsMode, config: T): T;
204
+ /**
205
+ * 处理把已创建的元素保存到内部环境中
206
+ * @param type 当前弹窗类型
207
+ * @param value
208
+ */
209
+ handlePush(type: PopsLayerMode, value: PopsLayerCommonConfig): void;
210
+ };
@@ -0,0 +1,17 @@
1
+ export function AnyTouch(): {
2
+ (el: any, options: any): this;
3
+ STATE_POSSIBLE: number;
4
+ STATE_START: number;
5
+ STATE_MOVE: number;
6
+ STATE_END: number;
7
+ STATE_CANCELLED: number;
8
+ STATE_FAILED: number;
9
+ STATE_RECOGNIZED: number;
10
+ tap: (at: any, options: any) => any;
11
+ pan: (at: any, options: any) => any;
12
+ swipe: (at: any, options: any) => any;
13
+ press: (at: any, options: any) => any;
14
+ rotate: (at: any, options: any) => any;
15
+ pinch: (at: any, options: any) => any;
16
+ doubletap: (at: any) => any;
17
+ };
@@ -0,0 +1,278 @@
1
+ import { PopsDOMUtilsEvent } from "./PopsDOMUtilsEvent";
2
+ declare class PopsDOMUtils extends PopsDOMUtilsEvent {
3
+ /** 获取 animationend 在各个浏览器的兼容名 */
4
+ getAnimationEndNameList(): string[];
5
+ /** 获取 transitionend 在各个浏览器的兼容名 */
6
+ getTransitionEndNameList(): string[];
7
+ /**
8
+ * 实现jQuery中的$().offset();
9
+ * @param {HTMLElement} element
10
+ * @returns
11
+ */
12
+ offset(element: HTMLElement): DOMRect;
13
+ /**
14
+ * 获取元素的宽度
15
+ * @param element 要获取宽度的元素
16
+ * @param isShow 是否已进行isShow,避免爆堆栈
17
+ * @returns 元素的宽度,单位为像素
18
+ * @example
19
+ * // 获取元素a.xx的宽度
20
+ * DOMUtils.width(document.querySelector("a.xx"))
21
+ * DOMUtils.width("a.xx")
22
+ * > 100
23
+ * // 获取window的宽度
24
+ * DOMUtils.width(window)
25
+ * > 400
26
+ * @example
27
+ * // 设置元素a.xx的宽度为200
28
+ * DOMUtils.width(document.querySelector("a.xx"),200)
29
+ * DOMUtils.width("a.xx",200)
30
+ */
31
+ width(element: HTMLElement | string | Window | Document | typeof globalThis, isShow?: boolean): number;
32
+ /**
33
+ * 获取元素的高度
34
+ * @param element 要获取高度的元素
35
+ * @param isShow 是否已进行isShow,避免爆堆栈
36
+ * @returns 元素的高度,单位为像素
37
+ * @example
38
+ * // 获取元素a.xx的高度
39
+ * DOMUtils.height(document.querySelector("a.xx"))
40
+ * DOMUtils.height("a.xx")
41
+ * > 100
42
+ * // 获取window的高度
43
+ * DOMUtils.height(window)
44
+ * > 700
45
+ * @example
46
+ * // 设置元素a.xx的高度为200
47
+ * DOMUtils.height(document.querySelector("a.xx"),200)
48
+ * DOMUtils.height("a.xx",200)
49
+ */
50
+ height(element: HTMLElement | string | Window | Document | typeof globalThis, isShow?: boolean): number;
51
+ /**
52
+ * 获取元素的外部宽度(包括边框和外边距)
53
+ * @param {HTMLElement|string} element 要获取外部宽度的元素
54
+ * @param {boolean} [isShow=false] 是否已进行isShow,避免爆堆栈
55
+ * @returns {number} 元素的外部宽度,单位为像素
56
+ * @example
57
+ * // 获取元素a.xx的外部宽度
58
+ * DOMUtils.outerWidth(document.querySelector("a.xx"))
59
+ * DOMUtils.outerWidth("a.xx")
60
+ * > 100
61
+ * // 获取window的外部宽度
62
+ * DOMUtils.outerWidth(window)
63
+ * > 400
64
+ */
65
+ outerWidth(element: HTMLElement | string | Window | Document, isShow?: boolean): number;
66
+ /**
67
+ * 获取元素的外部高度(包括边框和外边距)
68
+ * @param {HTMLElement|string} element 要获取外部高度的元素
69
+ * @param {boolean} [isShow=false] 是否已进行isShow,避免爆堆栈
70
+ * @returns {number} 元素的外部高度,单位为像素
71
+ * @example
72
+ * // 获取元素a.xx的外部高度
73
+ * DOMUtils.outerHeight(document.querySelector("a.xx"))
74
+ * DOMUtils.outerHeight("a.xx")
75
+ * > 100
76
+ * // 获取window的外部高度
77
+ * DOMUtils.outerHeight(window)
78
+ * > 700
79
+ */
80
+ outerHeight(element: HTMLElement | string | Window, isShow?: boolean): number;
81
+ /**
82
+ * 添加className
83
+ * @param element 目标元素
84
+ * @param className className属性
85
+ */
86
+ addClassName(element: HTMLElement, className: string): void;
87
+ /**
88
+ * 删除className
89
+ * @param element 目标元素
90
+ * @param className className属性
91
+ */
92
+ removeClassName(element: HTMLElement, className: string): void;
93
+ /**
94
+ * 判断元素是否包含某个className
95
+ * @param element 目标元素
96
+ * @param className className属性
97
+ */
98
+ containsClassName(element: HTMLElement, className: string): boolean;
99
+ /**
100
+ * 获取元素的样式属性值
101
+ * @param element 目标元素
102
+ * @param property 样式属性名或包含多个属性名和属性值的对象
103
+ * @example
104
+ * // 获取元素a.xx的CSS属性display
105
+ * DOMUtils.css(document.querySelector("a.xx"),"display");
106
+ * DOMUtils.css("a.xx","display");
107
+ * > "none"
108
+ * */
109
+ css(element: HTMLElement | string, property: keyof CSSStyleDeclaration): string;
110
+ /**
111
+ * 获取元素的样式属性值
112
+ * @param element 目标元素
113
+ * @param property 样式属性名或包含多个属性名和属性值的对象
114
+ * @example
115
+ * // 获取元素a.xx的CSS属性display
116
+ * DOMUtils.css(document.querySelector("a.xx"),"display");
117
+ * DOMUtils.css("a.xx","display");
118
+ * > "none"
119
+ * */
120
+ css(element: HTMLElement | string, property: string): string;
121
+ /**
122
+ * 设置元素的样式属性
123
+ * @param element 目标元素
124
+ * @param property 样式属性名或包含多个属性名和属性值的对象
125
+ * @param value 样式属性值
126
+ * @example
127
+ * // 设置元素a.xx的CSS属性display为block
128
+ * DOMUtils.css(document.querySelector("a.xx"),"display","block");
129
+ * DOMUtils.css(document.querySelector("a.xx"),"display","block !important");
130
+ * DOMUtils.css("a.xx","display","block");
131
+ * DOMUtils.css("a.xx","display","block !important");
132
+ * @example
133
+ * // 设置元素a.xx的CSS属性top为10px
134
+ * DOMUtils.css(document.querySelector("a.xx"),"top","10px");
135
+ * DOMUtils.css(document.querySelector("a.xx"),"top",10);
136
+ * */
137
+ css(element: HTMLElement | string, property: keyof CSSStyleDeclaration & string, value: string | number): string;
138
+ /**
139
+ * 设置元素的样式属性
140
+ * @param element 目标元素
141
+ * @param property 样式属性名或包含多个属性名和属性值的对象
142
+ * @param value 样式属性值
143
+ * @example
144
+ * // 设置元素a.xx的CSS属性display为block
145
+ * DOMUtils.css(document.querySelector("a.xx"),{ display: "block" }});
146
+ * DOMUtils.css(document.querySelector("a.xx"),{ display: "block !important" }});
147
+ * @example
148
+ * // 设置元素a.xx的CSS属性top为10px
149
+ * DOMUtils.css(document.querySelector("a.xx"),{ top: "10px" });
150
+ * DOMUtils.css(document.querySelector("a.xx"),{ top: 10 });
151
+ * */
152
+ css(element: HTMLElement | string, property: {
153
+ [P in keyof CSSStyleDeclaration]?: CSSStyleDeclaration[P];
154
+ } | {
155
+ [key: string]: string | number;
156
+ }): string;
157
+ /**
158
+ * 创建元素
159
+ * @param tagName 标签名
160
+ * @param property 属性
161
+ * @param attributes 元素上的自定义属性
162
+ * @example
163
+ * // 创建一个DIV元素,且属性class为xxx
164
+ * DOMUtils.createElement("div",undefined,{ class:"xxx" });
165
+ * > <div class="xxx"></div>
166
+ * @example
167
+ * // 创建一个DIV元素
168
+ * DOMUtils.createElement("div");
169
+ * > <div></div>
170
+ * @example
171
+ * // 创建一个DIV元素
172
+ * DOMUtils.createElement("div","测试");
173
+ * > <div>测试</div>
174
+ */
175
+ createElement<K extends keyof HTMLElementTagNameMap>(
176
+ /** 元素名 */
177
+ tagName: K,
178
+ /** 属性 */
179
+ property?: ({
180
+ [P in keyof HTMLElementTagNameMap[K]]?: HTMLElementTagNameMap[K][P];
181
+ } & {
182
+ [key: string]: any;
183
+ }) | string,
184
+ /** 自定义属性 */
185
+ attributes?: PopsDOMUtilsCreateElementAttributesMap): HTMLElementTagNameMap[K];
186
+ /**
187
+ * 获取文字的位置信息
188
+ * @param input 输入框
189
+ * @param selectionStart 起始位置
190
+ * @param selectionEnd 结束位置
191
+ * @param debug 是否是调试模式
192
+ * + true 不删除临时节点元素
193
+ * + false 删除临时节点元素
194
+ */
195
+ getTextBoundingRect(input: HTMLInputElement, selectionStart: number | string, selectionEnd: number | string, debug: boolean): DOMRect;
196
+ /**
197
+ * 使用className来隐藏元素
198
+ * @param ele
199
+ * @param isImportant 是否使用!important
200
+ */
201
+ cssHide(ele: Element | null, isImportant?: boolean): void;
202
+ /**
203
+ * cssHide的反向使用
204
+ * @param ele
205
+ */
206
+ cssShow(ele: Element | null): void;
207
+ /**
208
+ * 将字符串转为Element元素
209
+ * @param html
210
+ * @param useParser 是否使用DOMParser来生成元素,有些时候通过DOMParser生成的元素有点问题
211
+ * + true 使用DOMPraser来转换字符串
212
+ * + false (默认)创建一个div,里面放入字符串,然后提取firstChild
213
+ * @param isComplete 是否是完整的
214
+ * + true 如果useParser为true,那么返回整个使用DOMParser转换成的Document
215
+ * 如果useParser为false,返回一个DIV元素,DIV元素内包裹着需要转换的字符串
216
+ * + false (默认)如果useParser为true,那么返回整个使用DOMParser转换成的Document的body
217
+ * 如果useParser为false,返回一个DIV元素的firstChild
218
+ * @example
219
+ * // 将字符串转为Element元素
220
+ * DOMUtils.parseHTML("<a href='xxxx'></a>")
221
+ * > <a href="xxxx"></a>
222
+ * @example
223
+ * // 使用DOMParser将字符串转为Element元素
224
+ * DOMUtils.parseHTML("<a href='xxxx'></a>",true)
225
+ * > <a href="xxxx"></a>
226
+ * @example
227
+ * // 由于需要转换的元素是多个元素,将字符串转为完整的Element元素
228
+ * DOMUtils.parseHTML("<a href='xxxx'></a><a href='xxxx'></a>",false, true)
229
+ * > <div><a href="xxxx"></a><a href='xxxx'></a></div>
230
+ * @example
231
+ * // 由于需要转换的元素是多个元素,使用DOMParser将字符串转为完整的Element元素
232
+ * DOMUtils.parseHTML("<a href='xxxx'></a><a href='xxxx'></a>",true, true)
233
+ * > #document
234
+ */
235
+ parseHTML<T1 extends boolean, T2 extends boolean>(html: string, useParser?: T1, isComplete?: T2): ParseHTMLReturnType<T1, T2>;
236
+ /**
237
+ * 函数在元素内部末尾添加子元素或HTML字符串
238
+ * @param element 目标元素
239
+ * @param content 子元素或HTML字符串
240
+ * @example
241
+ * // 元素a.xx的内部末尾添加一个元素
242
+ * DOMUtils.append(document.querySelector("a.xx"),document.querySelector("b.xx"))
243
+ * DOMUtils.append("a.xx","'<b class="xx"></b>")
244
+ * */
245
+ append(element: Element | Node | ShadowRoot | HTMLElement | string, content: HTMLElement | string | (HTMLElement | string | Element)[] | NodeList): void;
246
+ /**
247
+ * 把元素标签添加到head内
248
+ */
249
+ appendHead($ele: HTMLElement): void;
250
+ /**
251
+ * 把元素添加进body内
252
+ * @param $ele
253
+ */
254
+ appendBody($ele: HTMLElement): void;
255
+ /**
256
+ * 判断元素是否已显示或已连接
257
+ * @param element
258
+ */
259
+ isShow(element: HTMLElement): boolean;
260
+ /**
261
+ * 用于显示元素并获取它的高度宽度等其它属性
262
+ * @param element
263
+ */
264
+ showElement(element: HTMLElement): {
265
+ /**
266
+ * 恢复修改的style
267
+ */
268
+ recovery(): void;
269
+ };
270
+ /**
271
+ * 获取元素上的Float格式的属性px
272
+ * @param element
273
+ * @param styleName style名
274
+ */
275
+ getStyleValue(element: HTMLElement | CSSStyleDeclaration, styleName: string): number;
276
+ }
277
+ declare const popsDOMUtils: PopsDOMUtils;
278
+ export { popsDOMUtils };