@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 CHANGED
@@ -3705,6 +3705,49 @@ define((function () { 'use strict';
3705
3705
 
3706
3706
  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";
3707
3707
 
3708
+ const GlobalConfig = {
3709
+ config: {},
3710
+ /**
3711
+ * 为所有弹窗设置全局属性
3712
+ */
3713
+ setGlobalConfig(config) {
3714
+ Reflect.ownKeys(config).forEach((keyName) => {
3715
+ Reflect.set(GlobalConfig.config, keyName, Reflect.get(config, keyName));
3716
+ });
3717
+ },
3718
+ /**
3719
+ * 获取全局配置
3720
+ */
3721
+ getGlobalConfig() {
3722
+ let result = {};
3723
+ let style = GlobalConfig.config.style == null
3724
+ ? ""
3725
+ : typeof GlobalConfig.config.style === "function"
3726
+ ? GlobalConfig.config.style()
3727
+ : GlobalConfig.config.style;
3728
+ if (typeof style === "string") {
3729
+ result.style = style;
3730
+ }
3731
+ let zIndex = GlobalConfig.config.zIndex == null
3732
+ ? ""
3733
+ : typeof GlobalConfig.config.zIndex === "function"
3734
+ ? GlobalConfig.config.zIndex()
3735
+ : GlobalConfig.config.zIndex;
3736
+ if (typeof zIndex === "string") {
3737
+ let newIndex = (zIndex = parseInt(zIndex));
3738
+ if (!isNaN(newIndex)) {
3739
+ result.zIndex = newIndex;
3740
+ }
3741
+ }
3742
+ else {
3743
+ if (!isNaN(zIndex)) {
3744
+ result.zIndex = zIndex;
3745
+ }
3746
+ }
3747
+ return result;
3748
+ },
3749
+ };
3750
+
3708
3751
  const PopsElementHandler = {
3709
3752
  /**
3710
3753
  * 获取遮罩层HTML
@@ -4511,6 +4554,7 @@ define((function () { 'use strict';
4511
4554
  pops.config.cssText.alertCSS,
4512
4555
  ]);
4513
4556
  let config = PopsAlertConfig();
4557
+ config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
4514
4558
  config = popsUtils.assign(config, details);
4515
4559
  let guid = popsUtils.getRandomGUID();
4516
4560
  // 设置当前类型
@@ -4700,6 +4744,7 @@ define((function () { 'use strict';
4700
4744
  pops.config.cssText.confirmCSS,
4701
4745
  ]);
4702
4746
  let config = PopsConfirmConfig();
4747
+ config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
4703
4748
  config = popsUtils.assign(config, details);
4704
4749
  let guid = popsUtils.getRandomGUID();
4705
4750
  // 设置当前类型
@@ -4899,6 +4944,7 @@ define((function () { 'use strict';
4899
4944
  pops.config.cssText.promptCSS,
4900
4945
  ]);
4901
4946
  let config = PopsPromptConfig();
4947
+ config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
4902
4948
  config = popsUtils.assign(config, details);
4903
4949
  let guid = popsUtils.getRandomGUID();
4904
4950
  const PopsType = "prompt";
@@ -5031,6 +5077,7 @@ define((function () { 'use strict';
5031
5077
  class PopsLoading {
5032
5078
  constructor(details) {
5033
5079
  let config = PopsLoadingConfig();
5080
+ config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
5034
5081
  config = popsUtils.assign(config, details);
5035
5082
  let guid = popsUtils.getRandomGUID();
5036
5083
  const PopsType = "loading";
@@ -5165,6 +5212,7 @@ define((function () { 'use strict';
5165
5212
  pops.config.cssText.iframeCSS,
5166
5213
  ]);
5167
5214
  let config = PopsIframeConfig();
5215
+ config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
5168
5216
  config = popsUtils.assign(config, details);
5169
5217
  if (config.url == null) {
5170
5218
  throw "config.url不能为空";
@@ -5417,6 +5465,7 @@ define((function () { 'use strict';
5417
5465
  pops.config.cssText.tooltipCSS,
5418
5466
  ]);
5419
5467
  let config = PopsTooltipConfig();
5468
+ config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
5420
5469
  config = popsUtils.assign(config, details);
5421
5470
  if (!(config.target instanceof HTMLElement)) {
5422
5471
  throw "config.target 必须是HTMLElement类型";
@@ -5757,6 +5806,7 @@ define((function () { 'use strict';
5757
5806
  pops.config.cssText.drawerCSS,
5758
5807
  ]);
5759
5808
  let config = PopsDrawerConfig();
5809
+ config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
5760
5810
  config = popsUtils.assign(config, details);
5761
5811
  let guid = popsUtils.getRandomGUID();
5762
5812
  const PopsType = "drawer";
@@ -6095,6 +6145,8 @@ define((function () { 'use strict';
6095
6145
  pops.config.cssText.folderCSS,
6096
6146
  ]);
6097
6147
  let config = PopsFolderConfig();
6148
+ config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
6149
+ config = popsUtils.assign(config, details);
6098
6150
  /* 办公几件套 */
6099
6151
  Folder_ICON.docx = Folder_ICON.doc;
6100
6152
  Folder_ICON.rtf = Folder_ICON.doc;
@@ -6148,7 +6200,6 @@ define((function () { 'use strict';
6148
6200
  androidIconList.forEach((keyName) => {
6149
6201
  Folder_ICON[keyName] = Folder_ICON.apk;
6150
6202
  });
6151
- config = popsUtils.assign(config, details);
6152
6203
  if (details?.folder) {
6153
6204
  config.folder = details.folder;
6154
6205
  }
@@ -9631,6 +9682,7 @@ define((function () { 'use strict';
9631
9682
  pops.config.cssText.panelCSS,
9632
9683
  ]);
9633
9684
  let config = PopsPanelConfig();
9685
+ config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
9634
9686
  config = popsUtils.assign(config, details);
9635
9687
  if (details && Array.isArray(details.content)) {
9636
9688
  config.content = details.content;
@@ -9868,6 +9920,7 @@ define((function () { 'use strict';
9868
9920
  pops.config.cssText.rightClickMenu,
9869
9921
  ]);
9870
9922
  let config = rightClickMenuConfig();
9923
+ config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
9871
9924
  config = popsUtils.assign(config, details);
9872
9925
  if (config.target == null) {
9873
9926
  throw "config.target 不能为空";
@@ -10345,6 +10398,7 @@ define((function () { 'use strict';
10345
10398
  pops.config.cssText.common,
10346
10399
  ]);
10347
10400
  let config = searchSuggestionConfig();
10401
+ config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
10348
10402
  config = popsUtils.assign(config, details);
10349
10403
  if (config.target == null) {
10350
10404
  throw new TypeError("config.target 不能为空");
@@ -11021,6 +11075,10 @@ define((function () { 'use strict';
11021
11075
  isPhone(userAgent = PopsCore.globalThis.navigator.userAgent) {
11022
11076
  return Boolean(/(iPhone|iPad|iPod|iOS|Android)/i.test(userAgent));
11023
11077
  }
11078
+ /**
11079
+ * 为所有弹窗设置全局属性
11080
+ */
11081
+ GlobalConfig = GlobalConfig;
11024
11082
  /**
11025
11083
  * 普通信息框
11026
11084
  * @param details 配置