@whitesev/pops 1.7.2 → 1.7.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 +59 -1
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +59 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +59 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +59 -1
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +59 -1
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +59 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/types/src/GlobalConfig.d.ts +20 -0
- package/dist/types/src/Pops.d.ts +17 -0
- package/package.json +1 -1
- package/src/GlobalConfig.ts +60 -0
- package/src/Pops.ts +6 -1
- package/src/components/alert/index.ts +2 -0
- package/src/components/confirm/index.ts +2 -0
- package/src/components/drawer/index.ts +2 -0
- package/src/components/folder/index.ts +3 -1
- package/src/components/iframe/index.ts +2 -0
- package/src/components/loading/index.ts +2 -0
- package/src/components/panel/index.ts +2 -0
- package/src/components/prompt/index.ts +2 -0
- package/src/components/rightClickMenu/index.ts +2 -0
- package/src/components/searchSuggestion/index.ts +2 -0
- package/src/components/tooltip/index.ts +2 -0
package/dist/index.iife.js
CHANGED
|
@@ -3706,6 +3706,49 @@ var pops = (function () {
|
|
|
3706
3706
|
|
|
3707
3707
|
var SVG_arrowLeft = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 1024 1024\">\r\n\t<path\r\n\t\td=\"M609.408 149.376 277.76 489.6a32 32 0 0 0 0 44.672l331.648 340.352a29.12 29.12 0 0 0 41.728 0 30.592 30.592 0 0 0 0-42.752L339.264 511.936l311.872-319.872a30.592 30.592 0 0 0 0-42.688 29.12 29.12 0 0 0-41.728 0z\"></path>\r\n</svg>\r\n";
|
|
3708
3708
|
|
|
3709
|
+
const GlobalConfig = {
|
|
3710
|
+
config: {},
|
|
3711
|
+
/**
|
|
3712
|
+
* 为所有弹窗设置全局属性
|
|
3713
|
+
*/
|
|
3714
|
+
setGlobalConfig(config) {
|
|
3715
|
+
Reflect.ownKeys(config).forEach((keyName) => {
|
|
3716
|
+
Reflect.set(GlobalConfig.config, keyName, Reflect.get(config, keyName));
|
|
3717
|
+
});
|
|
3718
|
+
},
|
|
3719
|
+
/**
|
|
3720
|
+
* 获取全局配置
|
|
3721
|
+
*/
|
|
3722
|
+
getGlobalConfig() {
|
|
3723
|
+
let result = {};
|
|
3724
|
+
let style = GlobalConfig.config.style == null
|
|
3725
|
+
? ""
|
|
3726
|
+
: typeof GlobalConfig.config.style === "function"
|
|
3727
|
+
? GlobalConfig.config.style()
|
|
3728
|
+
: GlobalConfig.config.style;
|
|
3729
|
+
if (typeof style === "string") {
|
|
3730
|
+
result.style = style;
|
|
3731
|
+
}
|
|
3732
|
+
let zIndex = GlobalConfig.config.zIndex == null
|
|
3733
|
+
? ""
|
|
3734
|
+
: typeof GlobalConfig.config.zIndex === "function"
|
|
3735
|
+
? GlobalConfig.config.zIndex()
|
|
3736
|
+
: GlobalConfig.config.zIndex;
|
|
3737
|
+
if (typeof zIndex === "string") {
|
|
3738
|
+
let newIndex = (zIndex = parseInt(zIndex));
|
|
3739
|
+
if (!isNaN(newIndex)) {
|
|
3740
|
+
result.zIndex = newIndex;
|
|
3741
|
+
}
|
|
3742
|
+
}
|
|
3743
|
+
else {
|
|
3744
|
+
if (!isNaN(zIndex)) {
|
|
3745
|
+
result.zIndex = zIndex;
|
|
3746
|
+
}
|
|
3747
|
+
}
|
|
3748
|
+
return result;
|
|
3749
|
+
},
|
|
3750
|
+
};
|
|
3751
|
+
|
|
3709
3752
|
const PopsElementHandler = {
|
|
3710
3753
|
/**
|
|
3711
3754
|
* 获取遮罩层HTML
|
|
@@ -4512,6 +4555,7 @@ var pops = (function () {
|
|
|
4512
4555
|
pops.config.cssText.alertCSS,
|
|
4513
4556
|
]);
|
|
4514
4557
|
let config = PopsAlertConfig();
|
|
4558
|
+
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
4515
4559
|
config = popsUtils.assign(config, details);
|
|
4516
4560
|
let guid = popsUtils.getRandomGUID();
|
|
4517
4561
|
// 设置当前类型
|
|
@@ -4701,6 +4745,7 @@ var pops = (function () {
|
|
|
4701
4745
|
pops.config.cssText.confirmCSS,
|
|
4702
4746
|
]);
|
|
4703
4747
|
let config = PopsConfirmConfig();
|
|
4748
|
+
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
4704
4749
|
config = popsUtils.assign(config, details);
|
|
4705
4750
|
let guid = popsUtils.getRandomGUID();
|
|
4706
4751
|
// 设置当前类型
|
|
@@ -4900,6 +4945,7 @@ var pops = (function () {
|
|
|
4900
4945
|
pops.config.cssText.promptCSS,
|
|
4901
4946
|
]);
|
|
4902
4947
|
let config = PopsPromptConfig();
|
|
4948
|
+
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
4903
4949
|
config = popsUtils.assign(config, details);
|
|
4904
4950
|
let guid = popsUtils.getRandomGUID();
|
|
4905
4951
|
const PopsType = "prompt";
|
|
@@ -5032,6 +5078,7 @@ var pops = (function () {
|
|
|
5032
5078
|
class PopsLoading {
|
|
5033
5079
|
constructor(details) {
|
|
5034
5080
|
let config = PopsLoadingConfig();
|
|
5081
|
+
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
5035
5082
|
config = popsUtils.assign(config, details);
|
|
5036
5083
|
let guid = popsUtils.getRandomGUID();
|
|
5037
5084
|
const PopsType = "loading";
|
|
@@ -5166,6 +5213,7 @@ var pops = (function () {
|
|
|
5166
5213
|
pops.config.cssText.iframeCSS,
|
|
5167
5214
|
]);
|
|
5168
5215
|
let config = PopsIframeConfig();
|
|
5216
|
+
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
5169
5217
|
config = popsUtils.assign(config, details);
|
|
5170
5218
|
if (config.url == null) {
|
|
5171
5219
|
throw "config.url不能为空";
|
|
@@ -5418,6 +5466,7 @@ var pops = (function () {
|
|
|
5418
5466
|
pops.config.cssText.tooltipCSS,
|
|
5419
5467
|
]);
|
|
5420
5468
|
let config = PopsTooltipConfig();
|
|
5469
|
+
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
5421
5470
|
config = popsUtils.assign(config, details);
|
|
5422
5471
|
if (!(config.target instanceof HTMLElement)) {
|
|
5423
5472
|
throw "config.target 必须是HTMLElement类型";
|
|
@@ -5758,6 +5807,7 @@ var pops = (function () {
|
|
|
5758
5807
|
pops.config.cssText.drawerCSS,
|
|
5759
5808
|
]);
|
|
5760
5809
|
let config = PopsDrawerConfig();
|
|
5810
|
+
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
5761
5811
|
config = popsUtils.assign(config, details);
|
|
5762
5812
|
let guid = popsUtils.getRandomGUID();
|
|
5763
5813
|
const PopsType = "drawer";
|
|
@@ -6096,6 +6146,8 @@ var pops = (function () {
|
|
|
6096
6146
|
pops.config.cssText.folderCSS,
|
|
6097
6147
|
]);
|
|
6098
6148
|
let config = PopsFolderConfig();
|
|
6149
|
+
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
6150
|
+
config = popsUtils.assign(config, details);
|
|
6099
6151
|
/* 办公几件套 */
|
|
6100
6152
|
Folder_ICON.docx = Folder_ICON.doc;
|
|
6101
6153
|
Folder_ICON.rtf = Folder_ICON.doc;
|
|
@@ -6149,7 +6201,6 @@ var pops = (function () {
|
|
|
6149
6201
|
androidIconList.forEach((keyName) => {
|
|
6150
6202
|
Folder_ICON[keyName] = Folder_ICON.apk;
|
|
6151
6203
|
});
|
|
6152
|
-
config = popsUtils.assign(config, details);
|
|
6153
6204
|
if (details?.folder) {
|
|
6154
6205
|
config.folder = details.folder;
|
|
6155
6206
|
}
|
|
@@ -9632,6 +9683,7 @@ var pops = (function () {
|
|
|
9632
9683
|
pops.config.cssText.panelCSS,
|
|
9633
9684
|
]);
|
|
9634
9685
|
let config = PopsPanelConfig();
|
|
9686
|
+
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
9635
9687
|
config = popsUtils.assign(config, details);
|
|
9636
9688
|
if (details && Array.isArray(details.content)) {
|
|
9637
9689
|
config.content = details.content;
|
|
@@ -9869,6 +9921,7 @@ var pops = (function () {
|
|
|
9869
9921
|
pops.config.cssText.rightClickMenu,
|
|
9870
9922
|
]);
|
|
9871
9923
|
let config = rightClickMenuConfig();
|
|
9924
|
+
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
9872
9925
|
config = popsUtils.assign(config, details);
|
|
9873
9926
|
if (config.target == null) {
|
|
9874
9927
|
throw "config.target 不能为空";
|
|
@@ -10346,6 +10399,7 @@ var pops = (function () {
|
|
|
10346
10399
|
pops.config.cssText.common,
|
|
10347
10400
|
]);
|
|
10348
10401
|
let config = searchSuggestionConfig();
|
|
10402
|
+
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
10349
10403
|
config = popsUtils.assign(config, details);
|
|
10350
10404
|
if (config.target == null) {
|
|
10351
10405
|
throw new TypeError("config.target 不能为空");
|
|
@@ -11022,6 +11076,10 @@ var pops = (function () {
|
|
|
11022
11076
|
isPhone(userAgent = PopsCore.globalThis.navigator.userAgent) {
|
|
11023
11077
|
return Boolean(/(iPhone|iPad|iPod|iOS|Android)/i.test(userAgent));
|
|
11024
11078
|
}
|
|
11079
|
+
/**
|
|
11080
|
+
* 为所有弹窗设置全局属性
|
|
11081
|
+
*/
|
|
11082
|
+
GlobalConfig = GlobalConfig;
|
|
11025
11083
|
/**
|
|
11026
11084
|
* 普通信息框
|
|
11027
11085
|
* @param details 配置
|