@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.esm.js
CHANGED
|
@@ -3703,6 +3703,49 @@ var SVG_arrowRight = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 10
|
|
|
3703
3703
|
|
|
3704
3704
|
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";
|
|
3705
3705
|
|
|
3706
|
+
const GlobalConfig = {
|
|
3707
|
+
config: {},
|
|
3708
|
+
/**
|
|
3709
|
+
* 为所有弹窗设置全局属性
|
|
3710
|
+
*/
|
|
3711
|
+
setGlobalConfig(config) {
|
|
3712
|
+
Reflect.ownKeys(config).forEach((keyName) => {
|
|
3713
|
+
Reflect.set(GlobalConfig.config, keyName, Reflect.get(config, keyName));
|
|
3714
|
+
});
|
|
3715
|
+
},
|
|
3716
|
+
/**
|
|
3717
|
+
* 获取全局配置
|
|
3718
|
+
*/
|
|
3719
|
+
getGlobalConfig() {
|
|
3720
|
+
let result = {};
|
|
3721
|
+
let style = GlobalConfig.config.style == null
|
|
3722
|
+
? ""
|
|
3723
|
+
: typeof GlobalConfig.config.style === "function"
|
|
3724
|
+
? GlobalConfig.config.style()
|
|
3725
|
+
: GlobalConfig.config.style;
|
|
3726
|
+
if (typeof style === "string") {
|
|
3727
|
+
result.style = style;
|
|
3728
|
+
}
|
|
3729
|
+
let zIndex = GlobalConfig.config.zIndex == null
|
|
3730
|
+
? ""
|
|
3731
|
+
: typeof GlobalConfig.config.zIndex === "function"
|
|
3732
|
+
? GlobalConfig.config.zIndex()
|
|
3733
|
+
: GlobalConfig.config.zIndex;
|
|
3734
|
+
if (typeof zIndex === "string") {
|
|
3735
|
+
let newIndex = (zIndex = parseInt(zIndex));
|
|
3736
|
+
if (!isNaN(newIndex)) {
|
|
3737
|
+
result.zIndex = newIndex;
|
|
3738
|
+
}
|
|
3739
|
+
}
|
|
3740
|
+
else {
|
|
3741
|
+
if (!isNaN(zIndex)) {
|
|
3742
|
+
result.zIndex = zIndex;
|
|
3743
|
+
}
|
|
3744
|
+
}
|
|
3745
|
+
return result;
|
|
3746
|
+
},
|
|
3747
|
+
};
|
|
3748
|
+
|
|
3706
3749
|
const PopsElementHandler = {
|
|
3707
3750
|
/**
|
|
3708
3751
|
* 获取遮罩层HTML
|
|
@@ -4509,6 +4552,7 @@ class PopsAlert {
|
|
|
4509
4552
|
pops.config.cssText.alertCSS,
|
|
4510
4553
|
]);
|
|
4511
4554
|
let config = PopsAlertConfig();
|
|
4555
|
+
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
4512
4556
|
config = popsUtils.assign(config, details);
|
|
4513
4557
|
let guid = popsUtils.getRandomGUID();
|
|
4514
4558
|
// 设置当前类型
|
|
@@ -4698,6 +4742,7 @@ class PopsConfirm {
|
|
|
4698
4742
|
pops.config.cssText.confirmCSS,
|
|
4699
4743
|
]);
|
|
4700
4744
|
let config = PopsConfirmConfig();
|
|
4745
|
+
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
4701
4746
|
config = popsUtils.assign(config, details);
|
|
4702
4747
|
let guid = popsUtils.getRandomGUID();
|
|
4703
4748
|
// 设置当前类型
|
|
@@ -4897,6 +4942,7 @@ class PopsPrompt {
|
|
|
4897
4942
|
pops.config.cssText.promptCSS,
|
|
4898
4943
|
]);
|
|
4899
4944
|
let config = PopsPromptConfig();
|
|
4945
|
+
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
4900
4946
|
config = popsUtils.assign(config, details);
|
|
4901
4947
|
let guid = popsUtils.getRandomGUID();
|
|
4902
4948
|
const PopsType = "prompt";
|
|
@@ -5029,6 +5075,7 @@ const PopsLoadingConfig = () => {
|
|
|
5029
5075
|
class PopsLoading {
|
|
5030
5076
|
constructor(details) {
|
|
5031
5077
|
let config = PopsLoadingConfig();
|
|
5078
|
+
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
5032
5079
|
config = popsUtils.assign(config, details);
|
|
5033
5080
|
let guid = popsUtils.getRandomGUID();
|
|
5034
5081
|
const PopsType = "loading";
|
|
@@ -5163,6 +5210,7 @@ class PopsIframe {
|
|
|
5163
5210
|
pops.config.cssText.iframeCSS,
|
|
5164
5211
|
]);
|
|
5165
5212
|
let config = PopsIframeConfig();
|
|
5213
|
+
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
5166
5214
|
config = popsUtils.assign(config, details);
|
|
5167
5215
|
if (config.url == null) {
|
|
5168
5216
|
throw "config.url不能为空";
|
|
@@ -5415,6 +5463,7 @@ class PopsTooltip {
|
|
|
5415
5463
|
pops.config.cssText.tooltipCSS,
|
|
5416
5464
|
]);
|
|
5417
5465
|
let config = PopsTooltipConfig();
|
|
5466
|
+
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
5418
5467
|
config = popsUtils.assign(config, details);
|
|
5419
5468
|
if (!(config.target instanceof HTMLElement)) {
|
|
5420
5469
|
throw "config.target 必须是HTMLElement类型";
|
|
@@ -5755,6 +5804,7 @@ class PopsDrawer {
|
|
|
5755
5804
|
pops.config.cssText.drawerCSS,
|
|
5756
5805
|
]);
|
|
5757
5806
|
let config = PopsDrawerConfig();
|
|
5807
|
+
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
5758
5808
|
config = popsUtils.assign(config, details);
|
|
5759
5809
|
let guid = popsUtils.getRandomGUID();
|
|
5760
5810
|
const PopsType = "drawer";
|
|
@@ -6093,6 +6143,8 @@ class PopsFolder {
|
|
|
6093
6143
|
pops.config.cssText.folderCSS,
|
|
6094
6144
|
]);
|
|
6095
6145
|
let config = PopsFolderConfig();
|
|
6146
|
+
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
6147
|
+
config = popsUtils.assign(config, details);
|
|
6096
6148
|
/* 办公几件套 */
|
|
6097
6149
|
Folder_ICON.docx = Folder_ICON.doc;
|
|
6098
6150
|
Folder_ICON.rtf = Folder_ICON.doc;
|
|
@@ -6146,7 +6198,6 @@ class PopsFolder {
|
|
|
6146
6198
|
androidIconList.forEach((keyName) => {
|
|
6147
6199
|
Folder_ICON[keyName] = Folder_ICON.apk;
|
|
6148
6200
|
});
|
|
6149
|
-
config = popsUtils.assign(config, details);
|
|
6150
6201
|
if (details?.folder) {
|
|
6151
6202
|
config.folder = details.folder;
|
|
6152
6203
|
}
|
|
@@ -9629,6 +9680,7 @@ class PopsPanel {
|
|
|
9629
9680
|
pops.config.cssText.panelCSS,
|
|
9630
9681
|
]);
|
|
9631
9682
|
let config = PopsPanelConfig();
|
|
9683
|
+
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
9632
9684
|
config = popsUtils.assign(config, details);
|
|
9633
9685
|
if (details && Array.isArray(details.content)) {
|
|
9634
9686
|
config.content = details.content;
|
|
@@ -9866,6 +9918,7 @@ class PopsRightClickMenu {
|
|
|
9866
9918
|
pops.config.cssText.rightClickMenu,
|
|
9867
9919
|
]);
|
|
9868
9920
|
let config = rightClickMenuConfig();
|
|
9921
|
+
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
9869
9922
|
config = popsUtils.assign(config, details);
|
|
9870
9923
|
if (config.target == null) {
|
|
9871
9924
|
throw "config.target 不能为空";
|
|
@@ -10343,6 +10396,7 @@ class PopsSearchSuggestion {
|
|
|
10343
10396
|
pops.config.cssText.common,
|
|
10344
10397
|
]);
|
|
10345
10398
|
let config = searchSuggestionConfig();
|
|
10399
|
+
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
10346
10400
|
config = popsUtils.assign(config, details);
|
|
10347
10401
|
if (config.target == null) {
|
|
10348
10402
|
throw new TypeError("config.target 不能为空");
|
|
@@ -11019,6 +11073,10 @@ class Pops {
|
|
|
11019
11073
|
isPhone(userAgent = PopsCore.globalThis.navigator.userAgent) {
|
|
11020
11074
|
return Boolean(/(iPhone|iPad|iPod|iOS|Android)/i.test(userAgent));
|
|
11021
11075
|
}
|
|
11076
|
+
/**
|
|
11077
|
+
* 为所有弹窗设置全局属性
|
|
11078
|
+
*/
|
|
11079
|
+
GlobalConfig = GlobalConfig;
|
|
11022
11080
|
/**
|
|
11023
11081
|
* 普通信息框
|
|
11024
11082
|
* @param details 配置
|