@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.umd.js CHANGED
@@ -3709,6 +3709,49 @@
3709
3709
 
3710
3710
  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";
3711
3711
 
3712
+ const GlobalConfig = {
3713
+ config: {},
3714
+ /**
3715
+ * 为所有弹窗设置全局属性
3716
+ */
3717
+ setGlobalConfig(config) {
3718
+ Reflect.ownKeys(config).forEach((keyName) => {
3719
+ Reflect.set(GlobalConfig.config, keyName, Reflect.get(config, keyName));
3720
+ });
3721
+ },
3722
+ /**
3723
+ * 获取全局配置
3724
+ */
3725
+ getGlobalConfig() {
3726
+ let result = {};
3727
+ let style = GlobalConfig.config.style == null
3728
+ ? ""
3729
+ : typeof GlobalConfig.config.style === "function"
3730
+ ? GlobalConfig.config.style()
3731
+ : GlobalConfig.config.style;
3732
+ if (typeof style === "string") {
3733
+ result.style = style;
3734
+ }
3735
+ let zIndex = GlobalConfig.config.zIndex == null
3736
+ ? ""
3737
+ : typeof GlobalConfig.config.zIndex === "function"
3738
+ ? GlobalConfig.config.zIndex()
3739
+ : GlobalConfig.config.zIndex;
3740
+ if (typeof zIndex === "string") {
3741
+ let newIndex = (zIndex = parseInt(zIndex));
3742
+ if (!isNaN(newIndex)) {
3743
+ result.zIndex = newIndex;
3744
+ }
3745
+ }
3746
+ else {
3747
+ if (!isNaN(zIndex)) {
3748
+ result.zIndex = zIndex;
3749
+ }
3750
+ }
3751
+ return result;
3752
+ },
3753
+ };
3754
+
3712
3755
  const PopsElementHandler = {
3713
3756
  /**
3714
3757
  * 获取遮罩层HTML
@@ -4515,6 +4558,7 @@
4515
4558
  pops.config.cssText.alertCSS,
4516
4559
  ]);
4517
4560
  let config = PopsAlertConfig();
4561
+ config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
4518
4562
  config = popsUtils.assign(config, details);
4519
4563
  let guid = popsUtils.getRandomGUID();
4520
4564
  // 设置当前类型
@@ -4704,6 +4748,7 @@
4704
4748
  pops.config.cssText.confirmCSS,
4705
4749
  ]);
4706
4750
  let config = PopsConfirmConfig();
4751
+ config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
4707
4752
  config = popsUtils.assign(config, details);
4708
4753
  let guid = popsUtils.getRandomGUID();
4709
4754
  // 设置当前类型
@@ -4903,6 +4948,7 @@
4903
4948
  pops.config.cssText.promptCSS,
4904
4949
  ]);
4905
4950
  let config = PopsPromptConfig();
4951
+ config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
4906
4952
  config = popsUtils.assign(config, details);
4907
4953
  let guid = popsUtils.getRandomGUID();
4908
4954
  const PopsType = "prompt";
@@ -5035,6 +5081,7 @@
5035
5081
  class PopsLoading {
5036
5082
  constructor(details) {
5037
5083
  let config = PopsLoadingConfig();
5084
+ config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
5038
5085
  config = popsUtils.assign(config, details);
5039
5086
  let guid = popsUtils.getRandomGUID();
5040
5087
  const PopsType = "loading";
@@ -5169,6 +5216,7 @@
5169
5216
  pops.config.cssText.iframeCSS,
5170
5217
  ]);
5171
5218
  let config = PopsIframeConfig();
5219
+ config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
5172
5220
  config = popsUtils.assign(config, details);
5173
5221
  if (config.url == null) {
5174
5222
  throw "config.url不能为空";
@@ -5421,6 +5469,7 @@
5421
5469
  pops.config.cssText.tooltipCSS,
5422
5470
  ]);
5423
5471
  let config = PopsTooltipConfig();
5472
+ config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
5424
5473
  config = popsUtils.assign(config, details);
5425
5474
  if (!(config.target instanceof HTMLElement)) {
5426
5475
  throw "config.target 必须是HTMLElement类型";
@@ -5761,6 +5810,7 @@
5761
5810
  pops.config.cssText.drawerCSS,
5762
5811
  ]);
5763
5812
  let config = PopsDrawerConfig();
5813
+ config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
5764
5814
  config = popsUtils.assign(config, details);
5765
5815
  let guid = popsUtils.getRandomGUID();
5766
5816
  const PopsType = "drawer";
@@ -6099,6 +6149,8 @@
6099
6149
  pops.config.cssText.folderCSS,
6100
6150
  ]);
6101
6151
  let config = PopsFolderConfig();
6152
+ config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
6153
+ config = popsUtils.assign(config, details);
6102
6154
  /* 办公几件套 */
6103
6155
  Folder_ICON.docx = Folder_ICON.doc;
6104
6156
  Folder_ICON.rtf = Folder_ICON.doc;
@@ -6152,7 +6204,6 @@
6152
6204
  androidIconList.forEach((keyName) => {
6153
6205
  Folder_ICON[keyName] = Folder_ICON.apk;
6154
6206
  });
6155
- config = popsUtils.assign(config, details);
6156
6207
  if (details?.folder) {
6157
6208
  config.folder = details.folder;
6158
6209
  }
@@ -9635,6 +9686,7 @@
9635
9686
  pops.config.cssText.panelCSS,
9636
9687
  ]);
9637
9688
  let config = PopsPanelConfig();
9689
+ config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
9638
9690
  config = popsUtils.assign(config, details);
9639
9691
  if (details && Array.isArray(details.content)) {
9640
9692
  config.content = details.content;
@@ -9872,6 +9924,7 @@
9872
9924
  pops.config.cssText.rightClickMenu,
9873
9925
  ]);
9874
9926
  let config = rightClickMenuConfig();
9927
+ config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
9875
9928
  config = popsUtils.assign(config, details);
9876
9929
  if (config.target == null) {
9877
9930
  throw "config.target 不能为空";
@@ -10349,6 +10402,7 @@
10349
10402
  pops.config.cssText.common,
10350
10403
  ]);
10351
10404
  let config = searchSuggestionConfig();
10405
+ config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
10352
10406
  config = popsUtils.assign(config, details);
10353
10407
  if (config.target == null) {
10354
10408
  throw new TypeError("config.target 不能为空");
@@ -11025,6 +11079,10 @@
11025
11079
  isPhone(userAgent = PopsCore.globalThis.navigator.userAgent) {
11026
11080
  return Boolean(/(iPhone|iPad|iPod|iOS|Android)/i.test(userAgent));
11027
11081
  }
11082
+ /**
11083
+ * 为所有弹窗设置全局属性
11084
+ */
11085
+ GlobalConfig = GlobalConfig;
11028
11086
  /**
11029
11087
  * 普通信息框
11030
11088
  * @param details 配置