@whitesev/pops 2.5.0 → 2.5.2
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 +319 -159
- 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 +319 -159
- 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 +319 -159
- 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 +319 -159
- 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 +319 -159
- 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 +319 -159
- 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 +23 -19
- package/dist/types/src/components/panel/handlerComponents.d.ts +40 -21
- package/dist/types/src/components/panel/types/components-button.d.ts +8 -19
- package/dist/types/src/components/panel/types/components-common.d.ts +23 -0
- package/dist/types/src/components/panel/types/components-deepMenu.d.ts +0 -18
- package/dist/types/src/components/panel/types/components-forms.d.ts +0 -18
- package/dist/types/src/components/panel/types/components-input.d.ts +0 -21
- package/dist/types/src/components/panel/types/components-own.d.ts +0 -14
- package/dist/types/src/components/panel/types/components-select.d.ts +0 -21
- package/dist/types/src/components/panel/types/components-selectMultiple.d.ts +0 -18
- package/dist/types/src/components/panel/types/components-slider.d.ts +0 -19
- package/dist/types/src/components/panel/types/components-switch.d.ts +0 -21
- package/dist/types/src/components/panel/types/components-textarea.d.ts +0 -21
- package/dist/types/src/components/panel/types/index.d.ts +76 -11
- package/dist/types/src/components/rightClickMenu/index.d.ts +2 -8
- package/dist/types/src/handler/PopsHandler.d.ts +44 -28
- package/dist/types/src/types/global.d.ts +11 -9
- package/dist/types/src/utils/PopsDOMUtils.d.ts +1 -1
- package/package.json +1 -1
- package/src/PopsAnimation.ts +6 -6
- package/src/components/alert/index.ts +4 -4
- package/src/components/confirm/index.ts +6 -6
- package/src/components/drawer/index.ts +7 -2
- package/src/components/folder/index.ts +22 -22
- package/src/components/iframe/index.ts +13 -12
- package/src/components/loading/index.ts +1 -1
- package/src/components/panel/config.ts +58 -5
- package/src/components/panel/handlerComponents.ts +161 -74
- package/src/components/panel/index.css +30 -6
- package/src/components/panel/index.ts +30 -15
- package/src/components/panel/types/components-button.ts +8 -21
- package/src/components/panel/types/components-common.ts +27 -0
- package/src/components/panel/types/components-deepMenu.ts +0 -20
- package/src/components/panel/types/components-forms.ts +0 -20
- package/src/components/panel/types/components-input.ts +0 -23
- package/src/components/panel/types/components-own.ts +0 -14
- package/src/components/panel/types/components-select.ts +0 -23
- package/src/components/panel/types/components-selectMultiple.ts +0 -20
- package/src/components/panel/types/components-slider.ts +0 -21
- package/src/components/panel/types/components-switch.ts +0 -23
- package/src/components/panel/types/components-textarea.ts +0 -23
- package/src/components/panel/types/index.ts +81 -13
- package/src/components/prompt/index.ts +7 -7
- package/src/components/searchSuggestion/index.ts +5 -11
- package/src/handler/PopsHandler.ts +47 -30
- package/src/types/global.d.ts +11 -9
- package/src/utils/PopsDOMUtils.ts +14 -14
|
@@ -22,8 +22,9 @@ export const PopsHandler = {
|
|
|
22
22
|
* 创建shadow
|
|
23
23
|
*/
|
|
24
24
|
handlerShadow(config: Pick<PopsCommonConfig, "useShadowRoot">) {
|
|
25
|
-
const $shadowContainer =
|
|
26
|
-
|
|
25
|
+
const $shadowContainer = popsDOMUtils.createElement("div", {
|
|
26
|
+
className: "pops-shadow-container",
|
|
27
|
+
});
|
|
27
28
|
if (config.useShadowRoot) {
|
|
28
29
|
const $shadowRoot = $shadowContainer.attachShadow({ mode: "open" });
|
|
29
30
|
return {
|
|
@@ -200,123 +201,139 @@ export const PopsHandler = {
|
|
|
200
201
|
/**
|
|
201
202
|
* 主元素
|
|
202
203
|
*/
|
|
203
|
-
|
|
204
|
+
$pops: animElement.querySelector<HTMLDivElement>(".pops[type-value")!,
|
|
204
205
|
/**
|
|
205
206
|
* 确认按钮
|
|
206
207
|
*/
|
|
207
|
-
|
|
208
|
+
$btnOk: animElement.querySelector<HTMLDivElement>(`.pops-${type}-btn-ok`)!,
|
|
208
209
|
/**
|
|
209
210
|
* 取消按钮
|
|
210
211
|
*/
|
|
211
|
-
|
|
212
|
+
$btnCancel: animElement.querySelector<HTMLDivElement>(`.pops-${type}-btn-cancel`)!,
|
|
212
213
|
/**
|
|
213
214
|
* 其它按钮
|
|
214
215
|
*/
|
|
215
|
-
|
|
216
|
+
$btnOther: animElement.querySelector<HTMLDivElement>(`.pops-${type}-btn-other`)!,
|
|
216
217
|
/**
|
|
217
218
|
* 标题元素
|
|
218
219
|
*/
|
|
219
|
-
|
|
220
|
+
$title: animElement.querySelector<HTMLDivElement>(`.pops-${type}-title`)!,
|
|
220
221
|
/**
|
|
221
222
|
* 输入框元素
|
|
222
223
|
*/
|
|
223
|
-
|
|
224
|
+
$input: animElement.querySelector<HTMLTextAreaElement>(`.pops-${type}-content textarea[pops]`)
|
|
224
225
|
? animElement.querySelector<HTMLTextAreaElement>(`.pops-${type}-content textarea[pops]`)!
|
|
225
226
|
: animElement.querySelector<HTMLInputElement>(`.pops-${type}-content input[pops]`)!,
|
|
226
227
|
/**
|
|
227
228
|
* 顶部按钮控制层元素
|
|
228
229
|
*/
|
|
229
|
-
|
|
230
|
+
$headerControls: animElement.querySelector<HTMLDivElement>(".pops-header-controls")!,
|
|
230
231
|
/**
|
|
231
232
|
* iframe元素
|
|
232
233
|
*/
|
|
233
|
-
|
|
234
|
+
$iframe: animElement.querySelector<HTMLIFrameElement>("iframe[pops]")!,
|
|
234
235
|
/**
|
|
235
236
|
* 加载中元素
|
|
236
237
|
*/
|
|
237
|
-
|
|
238
|
+
$loading: animElement.querySelector<HTMLDivElement>(".pops-loading")!,
|
|
238
239
|
/**
|
|
239
240
|
* 内容元素
|
|
240
241
|
*/
|
|
241
|
-
|
|
242
|
+
$content: animElement.querySelector<HTMLDivElement>(`.pops-${type}-content`)!,
|
|
242
243
|
/**
|
|
243
244
|
* panel的右侧容器元素
|
|
244
245
|
*/
|
|
245
|
-
|
|
246
|
+
$panelRightSectionWrapper: animElement.querySelector<HTMLDivElement>(`.pops-${type}-section-wrapper`)!,
|
|
246
247
|
/**
|
|
247
|
-
*
|
|
248
|
+
* panel侧边栏容器元素
|
|
248
249
|
*/
|
|
249
|
-
|
|
250
|
+
$panelLeftAside: animElement.querySelector<HTMLDivElement>(`.pops-${type}-content aside.pops-${type}-aside`)!,
|
|
250
251
|
/**
|
|
251
|
-
*
|
|
252
|
+
* panel主要区域容器元素
|
|
252
253
|
*/
|
|
253
|
-
|
|
254
|
+
$panelContentSectionContainer: animElement.querySelector<HTMLDivElement>(
|
|
254
255
|
`.pops-${type}-content section.pops-${type}-container`
|
|
255
256
|
)!,
|
|
257
|
+
/**
|
|
258
|
+
* panel底部区域
|
|
259
|
+
*/
|
|
260
|
+
$panelBottomWrapper: animElement.querySelector<HTMLElement>(`.pops-${type}-bottom-wrapper`)!,
|
|
261
|
+
/**
|
|
262
|
+
* panel底部区域容器
|
|
263
|
+
*/
|
|
264
|
+
$panelBottomContainer: animElement.querySelector<HTMLElement>(`.pops-${type}-bottom-container`)!,
|
|
265
|
+
/**
|
|
266
|
+
* panel底部区域左侧容器
|
|
267
|
+
*/
|
|
268
|
+
$panelBottomLeftContainer: animElement.querySelector<HTMLElement>(`.pops-${type}-bottom-left-container`)!,
|
|
269
|
+
/**
|
|
270
|
+
* panel底部区域右侧容器
|
|
271
|
+
*/
|
|
272
|
+
$panelBottomRightContainer: animElement.querySelector<HTMLElement>(`.pops-${type}-bottom-right-container`)!,
|
|
256
273
|
/**
|
|
257
274
|
* 内容加载中元素
|
|
258
275
|
*/
|
|
259
|
-
|
|
276
|
+
$contentLoading: animElement.querySelector<HTMLDivElement>(`.pops-${type}-content-global-loading`)!,
|
|
260
277
|
/**
|
|
261
278
|
* 顶部缩小按钮
|
|
262
279
|
*/
|
|
263
|
-
|
|
280
|
+
$headerBtnMin: animElement.querySelector<HTMLDivElement>(".pops-header-control[data-type='min']")!,
|
|
264
281
|
/**
|
|
265
282
|
* 顶部放大按钮
|
|
266
283
|
*/
|
|
267
|
-
|
|
284
|
+
$headerBtnMax: animElement.querySelector<HTMLDivElement>(".pops-header-control[data-type='max']")!,
|
|
268
285
|
/**
|
|
269
286
|
* 顶部恢复原样按钮
|
|
270
287
|
*/
|
|
271
|
-
|
|
288
|
+
$headerBtnMise: animElement.querySelector<HTMLDivElement>(".pops-header-control[data-type='mise']")!,
|
|
272
289
|
/**
|
|
273
290
|
* 顶部关闭按钮
|
|
274
291
|
*/
|
|
275
|
-
|
|
292
|
+
$headerBtnClose: animElement.querySelector<HTMLDivElement>(".pops-header-control[data-type='close']")!,
|
|
276
293
|
/**
|
|
277
294
|
* 文件夹列表元素
|
|
278
295
|
*/
|
|
279
|
-
|
|
296
|
+
$folderList: animElement.querySelector<HTMLDivElement>(".pops-folder-list")!,
|
|
280
297
|
/**
|
|
281
298
|
* 文件夹列表顶部元素
|
|
282
299
|
*/
|
|
283
|
-
|
|
300
|
+
$folderHeaderNav: animElement.querySelector<HTMLDivElement>(
|
|
284
301
|
".pops-folder-list .pops-folder-list-table__header-div"
|
|
285
302
|
)!,
|
|
286
303
|
/**
|
|
287
304
|
* 文件夹列表行元素
|
|
288
305
|
*/
|
|
289
|
-
|
|
306
|
+
$folderHeaderRow: animElement.querySelector<HTMLTableRowElement>(
|
|
290
307
|
".pops-folder-list .pops-folder-list-table__header-div .pops-folder-list-table__header-row"
|
|
291
308
|
)!,
|
|
292
309
|
/**
|
|
293
310
|
* 文件夹列表tbody元素
|
|
294
311
|
*/
|
|
295
|
-
|
|
312
|
+
$folderTbody: animElement.querySelector<HTMLTableElement>(
|
|
296
313
|
".pops-folder-list .pops-folder-list-table__body-div tbody"
|
|
297
314
|
)!,
|
|
298
315
|
/**
|
|
299
316
|
* 文件夹列表primary元素
|
|
300
317
|
*/
|
|
301
|
-
|
|
318
|
+
$folderHeaderBreadcrumbPrimary: animElement.querySelector<HTMLDivElement>(
|
|
302
319
|
".pops-folder-list .pops-folder-file-list-breadcrumb-primary"
|
|
303
320
|
)!,
|
|
304
321
|
/**
|
|
305
322
|
* 文件夹排序按钮-文件名
|
|
306
323
|
*/
|
|
307
|
-
|
|
324
|
+
$folderSortFileName: animElement.querySelector<HTMLDivElement>(
|
|
308
325
|
'.pops-folder-list-table__sort[data-sort="fileName"]'
|
|
309
326
|
)!,
|
|
310
327
|
/**
|
|
311
328
|
* 文件夹排序按钮-修改时间
|
|
312
329
|
*/
|
|
313
|
-
|
|
330
|
+
$folderSortLatestTime: animElement.querySelector<HTMLDivElement>(
|
|
314
331
|
'.pops-folder-list-table__sort[data-sort="latestTime"]'
|
|
315
332
|
)!,
|
|
316
333
|
/**
|
|
317
334
|
* 文件夹排序按钮-文件大小
|
|
318
335
|
*/
|
|
319
|
-
|
|
336
|
+
$folderSortFileSize: animElement.querySelector<HTMLDivElement>(
|
|
320
337
|
'.pops-folder-list-table__sort[data-sort="fileSize"]'
|
|
321
338
|
)!,
|
|
322
339
|
};
|
package/src/types/global.d.ts
CHANGED
|
@@ -13,13 +13,15 @@ declare interface Window {
|
|
|
13
13
|
trustedTypes: any;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
declare type DeepRequired<T> = T extends Function
|
|
16
|
+
declare type DeepRequired<T> = T extends any[]
|
|
18
17
|
? T
|
|
19
|
-
:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
18
|
+
: // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
|
19
|
+
T extends Function
|
|
20
|
+
? T
|
|
21
|
+
: T extends object
|
|
22
|
+
? T extends Node
|
|
23
|
+
? T
|
|
24
|
+
: {
|
|
25
|
+
[K in keyof T]-?: DeepRequired<T[K]>;
|
|
26
|
+
}
|
|
27
|
+
: T;
|
|
@@ -1774,10 +1774,10 @@ class PopsDOMUtils extends PopsDOMUtilsEvent {
|
|
|
1774
1774
|
/** 自定义属性 */
|
|
1775
1775
|
attributes?: PopsDOMUtilsCreateElementAttributesMap
|
|
1776
1776
|
): HTMLElementTagNameMap[K] {
|
|
1777
|
-
const
|
|
1777
|
+
const $temp = PopsCore.document.createElement(tagName);
|
|
1778
1778
|
if (typeof property === "string") {
|
|
1779
|
-
PopsSafeUtils.setSafeHTML(
|
|
1780
|
-
return
|
|
1779
|
+
PopsSafeUtils.setSafeHTML($temp, property);
|
|
1780
|
+
return $temp;
|
|
1781
1781
|
}
|
|
1782
1782
|
if (property == null) {
|
|
1783
1783
|
property = {};
|
|
@@ -1788,10 +1788,10 @@ class PopsDOMUtils extends PopsDOMUtilsEvent {
|
|
|
1788
1788
|
Object.keys(property).forEach((key) => {
|
|
1789
1789
|
const value = property[key];
|
|
1790
1790
|
if (key === "innerHTML") {
|
|
1791
|
-
PopsSafeUtils.setSafeHTML(
|
|
1791
|
+
PopsSafeUtils.setSafeHTML($temp, value);
|
|
1792
1792
|
return;
|
|
1793
1793
|
}
|
|
1794
|
-
Reflect.set(
|
|
1794
|
+
Reflect.set($temp, key, value);
|
|
1795
1795
|
});
|
|
1796
1796
|
Object.keys(attributes).forEach((key) => {
|
|
1797
1797
|
let value = attributes[key];
|
|
@@ -1802,9 +1802,9 @@ class PopsDOMUtils extends PopsDOMUtilsEvent {
|
|
|
1802
1802
|
/* function转字符串 */
|
|
1803
1803
|
value = value.toString();
|
|
1804
1804
|
}
|
|
1805
|
-
|
|
1805
|
+
$temp.setAttribute(key, value);
|
|
1806
1806
|
});
|
|
1807
|
-
return
|
|
1807
|
+
return $temp;
|
|
1808
1808
|
}
|
|
1809
1809
|
/**
|
|
1810
1810
|
* 字符串转HTMLElement
|
|
@@ -2017,12 +2017,12 @@ class PopsDOMUtils extends PopsDOMUtilsEvent {
|
|
|
2017
2017
|
* DOMUtils.parseHTML("<a href='xxxx'></a><a href='xxxx'></a>",true, true)
|
|
2018
2018
|
* > #document
|
|
2019
2019
|
*/
|
|
2020
|
-
|
|
2020
|
+
toElement<T1 extends boolean, T2 extends boolean>(
|
|
2021
2021
|
html: string,
|
|
2022
2022
|
useParser?: T1,
|
|
2023
2023
|
isComplete?: T2
|
|
2024
2024
|
): ParseHTMLReturnType<T1, T2>;
|
|
2025
|
-
|
|
2025
|
+
toElement(html: string, useParser = false, isComplete = false) {
|
|
2026
2026
|
function parseHTMLByDOMParser() {
|
|
2027
2027
|
const parser = new DOMParser();
|
|
2028
2028
|
if (isComplete) {
|
|
@@ -2032,12 +2032,12 @@ class PopsDOMUtils extends PopsDOMUtilsEvent {
|
|
|
2032
2032
|
}
|
|
2033
2033
|
}
|
|
2034
2034
|
function parseHTMLByCreateDom() {
|
|
2035
|
-
const
|
|
2036
|
-
PopsSafeUtils.setSafeHTML(
|
|
2035
|
+
const $temp = PopsCore.document.createElement("div");
|
|
2036
|
+
PopsSafeUtils.setSafeHTML($temp, html);
|
|
2037
2037
|
if (isComplete) {
|
|
2038
|
-
return
|
|
2038
|
+
return $temp;
|
|
2039
2039
|
} else {
|
|
2040
|
-
return
|
|
2040
|
+
return $temp.firstChild;
|
|
2041
2041
|
}
|
|
2042
2042
|
}
|
|
2043
2043
|
if (useParser) {
|
|
@@ -2078,7 +2078,7 @@ class PopsDOMUtils extends PopsDOMUtilsEvent {
|
|
|
2078
2078
|
const fragment = PopsCore.document.createDocumentFragment();
|
|
2079
2079
|
content.forEach((ele) => {
|
|
2080
2080
|
if (typeof ele === "string") {
|
|
2081
|
-
ele = this.
|
|
2081
|
+
ele = this.toElement(ele, true, false);
|
|
2082
2082
|
}
|
|
2083
2083
|
fragment.appendChild(ele);
|
|
2084
2084
|
});
|