@whitesev/pops 4.0.0 → 4.0.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.
@@ -3,7 +3,7 @@ System.register('pops', [], (function (exports) {
3
3
  return {
4
4
  execute: (function () {
5
5
 
6
- const version = "4.0.0";
6
+ const version = "4.0.2";
7
7
 
8
8
  const GlobalConfig = {
9
9
  config: {},
@@ -31,18 +31,21 @@ System.register('pops', [], (function (exports) {
31
31
  }
32
32
  else if (keyName === "zIndex") {
33
33
  // 设置zIndex属性
34
- let zIndex = configValue == null ? "" : typeof configValue === "function" ? configValue() : configValue;
35
- if (typeof zIndex === "string") {
36
- const newIndex = (zIndex = Number(zIndex));
37
- if (!isNaN(newIndex)) {
38
- result.zIndex = newIndex;
34
+ result.zIndex = () => {
35
+ let zIndex = configValue == null ? "" : typeof configValue === "function" ? configValue() : configValue;
36
+ if (typeof zIndex === "string") {
37
+ const newIndex = (zIndex = Number(zIndex));
38
+ if (!Number.isNaN(newIndex)) {
39
+ return newIndex;
40
+ }
39
41
  }
40
- }
41
- else {
42
- if (!isNaN(zIndex)) {
43
- result.zIndex = zIndex;
42
+ else {
43
+ if (!Number.isNaN(zIndex)) {
44
+ return zIndex;
45
+ }
44
46
  }
45
- }
47
+ return 0;
48
+ };
46
49
  }
47
50
  else if (keyName === "mask") {
48
51
  const mask = GlobalConfig.config.mask == null ? {} : GlobalConfig.config.mask;
@@ -2884,7 +2887,7 @@ System.register('pops', [], (function (exports) {
2884
2887
  addLightStyle($parent, style) {
2885
2888
  const darkCSS = /*css*/ `
2886
2889
  @media (prefers-color-scheme: light) {
2887
- ${style}
2890
+ ${style ?? ""}
2888
2891
  }
2889
2892
  `;
2890
2893
  const $css = this.addStyle($parent, darkCSS);
@@ -2900,7 +2903,7 @@ System.register('pops', [], (function (exports) {
2900
2903
  addDarkStyle($parent, style) {
2901
2904
  const darkCSS = /*css*/ `
2902
2905
  @media (prefers-color-scheme: dark) {
2903
- ${style}
2906
+ ${style ?? ""}
2904
2907
  }
2905
2908
  `;
2906
2909
  const $css = this.addStyle($parent, darkCSS);
@@ -2912,7 +2915,7 @@ System.register('pops', [], (function (exports) {
2912
2915
  },
2913
2916
  };
2914
2917
 
2915
- var indexCSS = "@charset \"utf-8\";\n.pops * {\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n /* 代替::-webkit-scrollbar */\n scrollbar-width: thin;\n}\n.pops {\n --pops-bg-opacity: 1;\n --pops-bd-opacity: 1;\n --pops-font-size: 16px;\n interpolate-size: allow-keywords;\n --pops-color: #000000;\n --pops-bg-color: rgb(255, 255, 255, var(--pops-bg-opacity));\n --pops-bd-color: rgb(235, 238, 245, var(--pops-bd-opacity));\n --pops-box-shadow-color: rgba(0, 0, 0, 0.12);\n --pops-title-color: #000000;\n --pops-title-border-color: var(--pops-bd-color);\n --pops-content-color: #000000;\n --pops-bottom-btn-controls-border-color: var(--pops-bd-color);\n --pops-components-is-disabled-text-color: #a8abb2;\n --pops-components-is-disabled-bg-color: #f5f7fa;\n}\n@media (prefers-color-scheme: dark) {\n .pops {\n --pops-mask-bg-opacity: 0.8;\n --pops-color: #ffffff;\n --pops-dark-color: #262626;\n --pops-bg-color: rgb(17, 17, 17, var(--pops-bg-opacity));\n --pops-bd-color: rgb(55, 55, 55, var(--pops-bd-opacity));\n --pops-box-shadow-color: rgba(81, 81, 81, 0.12);\n --pops-title-color: #e8e8e8;\n --pops-title-border-color: var(--pops-bd-color);\n --pops-content-color: #e5e5e5;\n --pops-components-is-disabled-text-color: #a8abb2;\n --pops-components-is-disabled-bg-color: #262727;\n }\n}\n.pops {\n color: var(--pops-color);\n background-color: var(--pops-bg-color);\n border: 1px solid var(--pops-bd-color);\n border-radius: 4px;\n font-size: var(--pops-font-size);\n line-height: normal;\n box-shadow: 0 0 12px var(--pops-box-shadow-color);\n box-sizing: border-box;\n overflow: hidden;\n transition: all 0.35s;\n display: flex;\n flex-direction: column;\n}\n.pops-anim {\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n width: 100%;\n height: 100%;\n}\n.pops-anim[anim=\"\"] {\n top: unset;\n right: unset;\n bottom: unset;\n left: unset;\n width: unset;\n height: unset;\n transition: none;\n}\n/* 底部图标动画和样式 */\n.pops i.pops-bottom-icon[is-loading=\"true\"] {\n animation: rotating 2s linear infinite;\n}\n.pops i.pops-bottom-icon {\n height: 1em;\n width: 1em;\n line-height: normal;\n display: inline-flex;\n justify-content: center;\n align-items: center;\n position: relative;\n fill: currentColor;\n color: inherit;\n font-size: inherit;\n}\n\n/* 遮罩层样式 */\n.pops-mask {\n --pops-mask-bg-opacity: 0.4;\n --pops-mask-bg-color: rgba(0, 0, 0, var(--pops-mask-bg-opacity));\n}\n.pops-mask {\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n width: 100%;\n height: 100%;\n border: 0;\n border-radius: 0;\n background-color: var(--pops-mask-bg-color);\n box-shadow: none;\n transition: none;\n}\n\n.pops-header-controls button.pops-header-control[type][data-header] {\n float: right;\n margin: 0 0;\n outline: 0;\n border: 0;\n border-color: rgb(136, 136, 136, var(--pops-bd-opacity));\n background-color: transparent;\n color: #888;\n cursor: pointer;\n}\n.pops-header-controls button.pops-header-control[data-type=\"max\"],\n.pops-header-controls button.pops-header-control[data-type=\"mise\"],\n.pops-header-controls button.pops-header-control[data-type=\"min\"] {\n outline: 0 !important;\n border: 0;\n border-color: rgb(136, 136, 136, var(--pops-bd-opacity));\n background-color: transparent;\n color: rgb(136, 136, 136);\n cursor: pointer;\n transition: all 0.3s ease-in-out;\n}\nbutton.pops-header-control i {\n color: rgb(144, 147, 153);\n font-size: inherit;\n display: inline-flex;\n justify-content: center;\n align-items: center;\n position: relative;\n fill: currentColor;\n}\nbutton.pops-header-control svg {\n height: 1.25em;\n width: 1.25em;\n}\nbutton.pops-header-control {\n right: 15px;\n padding: 0;\n border: none;\n outline: 0;\n background: 0 0;\n cursor: pointer;\n position: unset;\n line-height: normal;\n}\nbutton.pops-header-control i:hover {\n color: rgb(64, 158, 255);\n}\n.pops-header-controls[data-margin] button.pops-header-control {\n margin: 0 6px;\n display: flex;\n align-items: center;\n}\n.pops[type-value] .pops-header-controls {\n display: flex;\n gap: 6px;\n}\n\n/* 代码块 <code> */\n.pops code {\n font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace;\n font-size: 0.85em;\n color: #000;\n background-color: #f0f0f0;\n border-radius: 3px;\n border: 0;\n padding: 0.2em 0;\n white-space: normal;\n background: #f5f5f5;\n text-wrap: wrap;\n text-align: left;\n word-spacing: normal;\n word-break: normal;\n word-wrap: normal;\n line-height: 1.4;\n -moz-tab-size: 8;\n -o-tab-size: 8;\n tab-size: 8;\n -webkit-hyphens: none;\n -moz-hyphens: none;\n -ms-hyphens: none;\n hyphens: none;\n direction: ltr;\n}\n\n.pops code::before,\n.pops code::after {\n letter-spacing: -0.2em;\n content: \"\\00a0\";\n}\n\n/* 标题 */\n.pops .pops-title {\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n display: flex;\n align-items: center;\n justify-content: space-between;\n border-bottom: 1px solid var(--pops-title-border-color);\n width: 100%;\n height: var(--container-title-height);\n}\n/* 标题-普通文本 */\n.pops .pops-title p[pops] {\n color: var(--pops-title-color);\n width: 100%;\n overflow: hidden;\n text-indent: 15px;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-weight: 500;\n line-height: normal;\n}\n\n/* 内容 */\n.pops .pops-content {\n width: 100%;\n /*height: calc(\n\t\t100% - var(--container-title-height) - var(--container-bottom-btn-height)\n\t);*/\n flex: 1;\n overflow: auto;\n word-break: break-word;\n}\n/* 内容-普通文本 */\n.pops .pops-content p[pops] {\n color: var(--pops-content-color);\n padding: 5px 10px;\n text-indent: 15px;\n}\n\n/* 底部-按钮组 */\n.pops .pops-botttom-btn-controls {\n display: flex;\n padding: 10px 10px 10px 10px;\n width: 100%;\n height: var(--container-bottom-btn-height);\n max-height: var(--container-bottom-btn-height);\n line-height: normal;\n border-top: 1px solid var(--pops-bottom-btn-controls-border-color);\n text-align: right;\n align-items: center;\n}\n";
2918
+ var indexCSS = "@charset \"utf-8\";\n.pops * {\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n /* 代替::-webkit-scrollbar */\n scrollbar-width: thin;\n}\n.pops {\n --pops-bg-opacity: 1;\n --pops-bd-opacity: 1;\n --pops-font-size: 16px;\n interpolate-size: allow-keywords;\n --pops-color: #000000;\n --pops-bg-color: rgb(255, 255, 255, var(--pops-bg-opacity));\n --pops-bd-color: rgb(235, 238, 245, var(--pops-bd-opacity));\n --pops-box-shadow-color: rgba(0, 0, 0, 0.12);\n --pops-title-color: #000000;\n --pops-title-border-color: var(--pops-bd-color);\n --pops-content-color: #000000;\n --pops-bottom-btn-controls-border-color: var(--pops-bd-color);\n --pops-components-is-disabled-text-color: #a8abb2;\n --pops-components-is-disabled-bg-color: #f5f7fa;\n}\n@media (prefers-color-scheme: dark) {\n .pops {\n --pops-mask-bg-opacity: 0.8;\n --pops-color: #ffffff;\n --pops-dark-color: #262626;\n --pops-bg-color: rgb(17, 17, 17, var(--pops-bg-opacity));\n --pops-bd-color: rgb(55, 55, 55, var(--pops-bd-opacity));\n --pops-box-shadow-color: rgba(81, 81, 81, 0.12);\n --pops-title-color: #e8e8e8;\n --pops-title-border-color: var(--pops-bd-color);\n --pops-content-color: #e5e5e5;\n --pops-components-is-disabled-text-color: #a8abb2;\n --pops-components-is-disabled-bg-color: #262727;\n }\n}\n.pops {\n color: var(--pops-color);\n background-color: var(--pops-bg-color);\n border: 1px solid var(--pops-bd-color);\n border-radius: 4px;\n font-size: var(--pops-font-size);\n line-height: normal;\n box-shadow: 0 0 12px var(--pops-box-shadow-color);\n box-sizing: border-box;\n overflow: hidden;\n transition: all 0.35s;\n display: flex;\n flex-direction: column;\n}\n.pops-anim {\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n width: 100%;\n height: 100%;\n}\n.pops-anim[anim=\"\"] {\n top: unset;\n right: unset;\n bottom: unset;\n left: unset;\n width: unset;\n height: unset;\n transition: none;\n}\n/* 底部图标动画和样式 */\n.pops i.pops-bottom-icon[is-loading=\"true\"] {\n animation: rotating 2s linear infinite;\n}\n.pops i.pops-bottom-icon {\n height: 1em;\n width: 1em;\n line-height: normal;\n display: inline-flex;\n justify-content: center;\n align-items: center;\n position: relative;\n fill: currentColor;\n color: inherit;\n font-size: inherit;\n}\n\n/* 遮罩层样式 */\n.pops-mask {\n --pops-mask-bg-opacity: 0.4;\n --pops-mask-bg-color: rgba(0, 0, 0, var(--pops-mask-bg-opacity));\n}\n.pops-mask {\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n width: 100%;\n height: 100%;\n border: 0;\n border-radius: 0;\n background-color: var(--pops-mask-bg-color);\n box-shadow: none;\n transition: none;\n}\n\n.pops-header-controls button.pops-header-control[type][data-header] {\n float: right;\n margin: 0 0;\n outline: 0;\n border: 0;\n border-color: rgb(136, 136, 136, var(--pops-bd-opacity));\n background-color: transparent;\n color: #888;\n cursor: pointer;\n}\n.pops-header-controls button.pops-header-control[data-type=\"max\"],\n.pops-header-controls button.pops-header-control[data-type=\"mise\"],\n.pops-header-controls button.pops-header-control[data-type=\"min\"] {\n outline: 0 !important;\n border: 0;\n border-color: rgb(136, 136, 136, var(--pops-bd-opacity));\n background-color: transparent;\n color: rgb(136, 136, 136);\n cursor: pointer;\n transition: all 0.3s ease-in-out;\n}\nbutton.pops-header-control i {\n color: rgb(144, 147, 153);\n font-size: inherit;\n display: inline-flex;\n justify-content: center;\n align-items: center;\n position: relative;\n fill: currentColor;\n}\nbutton.pops-header-control svg {\n height: 1.25em;\n width: 1.25em;\n}\nbutton.pops-header-control {\n right: 15px;\n padding: 0;\n border: none;\n outline: 0;\n background: 0 0;\n cursor: pointer;\n position: unset;\n line-height: normal;\n}\nbutton.pops-header-control i:hover {\n color: rgb(64, 158, 255);\n}\n.pops-header-controls[data-margin] button.pops-header-control {\n margin: 0 6px;\n display: flex;\n align-items: center;\n}\n.pops[type-value] .pops-header-controls {\n display: flex;\n gap: 6px;\n}\n\n/* 代码块 <code> */\n.pops code {\n font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace;\n font-size: 0.85em;\n color: #000;\n background-color: #f0f0f0;\n border-radius: 3px;\n border: 0;\n padding: 0.2em 0;\n white-space: normal;\n background: #f5f5f5;\n text-wrap: wrap;\n text-align: left;\n word-spacing: normal;\n word-break: normal;\n word-wrap: normal;\n line-height: 1.4;\n -moz-tab-size: 8;\n -o-tab-size: 8;\n tab-size: 8;\n -webkit-hyphens: none;\n -moz-hyphens: none;\n -ms-hyphens: none;\n hyphens: none;\n direction: ltr;\n}\n\n.pops code::before,\n.pops code::after {\n letter-spacing: -0.2em;\n content: \"\\00a0\";\n}\n\n/* 标题 */\n.pops .pops-title {\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n display: flex;\n align-items: center;\n justify-content: space-between;\n border-bottom: 1px solid var(--pops-title-border-color);\n width: 100%;\n height: var(--container-title-height);\n}\n/* 标题-普通文本 */\n.pops .pops-title p[pops] {\n color: var(--pops-title-color);\n width: 100%;\n height: 100%;\n align-content: center;\n overflow: hidden;\n text-indent: 15px;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-weight: 500;\n line-height: normal;\n}\n\n/* 内容 */\n.pops .pops-content {\n width: 100%;\n /*height: calc(\n\t\t100% - var(--container-title-height) - var(--container-bottom-btn-height)\n\t);*/\n flex: 1;\n overflow: auto;\n word-break: break-word;\n}\n/* 内容-普通文本 */\n.pops .pops-content p[pops] {\n color: var(--pops-content-color);\n padding: 5px 10px;\n text-indent: 15px;\n}\n\n/* 底部-按钮组 */\n.pops .pops-botttom-btn-controls {\n display: flex;\n padding: 10px 10px 10px 10px;\n width: 100%;\n height: var(--container-bottom-btn-height);\n max-height: var(--container-bottom-btn-height);\n line-height: normal;\n border-top: 1px solid var(--pops-bottom-btn-controls-border-color);\n text-align: right;\n align-items: center;\n}\n";
2916
2919
 
2917
2920
  var ninePalaceGridPositionCSS = ".pops[position=\"top_left\"] {\n position: fixed;\n top: 0;\n left: 0;\n}\n.pops[position=\"top\"] {\n position: fixed;\n top: 0;\n left: 50%;\n transform: translateX(-50%);\n}\n.pops[position=\"top_right\"] {\n position: fixed;\n top: 0;\n right: 0;\n}\n.pops[position=\"center_left\"] {\n position: fixed;\n top: 50%;\n left: 0;\n transform: translateY(-50%);\n}\n.pops[position=\"center\"] {\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n}\n.pops[position=\"center_right\"] {\n position: fixed;\n top: 50%;\n right: 0;\n transform: translateY(-50%);\n}\n.pops[position=\"bottom_left\"] {\n position: fixed;\n bottom: 0;\n left: 0;\n}\n.pops[position=\"bottom\"] {\n position: fixed;\n bottom: 0;\n left: 50%;\n transform: translate(-50%, 0);\n}\n.pops[position=\"bottom_right\"] {\n position: fixed;\n right: 0;\n bottom: 0;\n}\n";
2918
2921
 
@@ -4076,7 +4079,10 @@ System.register('pops', [], (function (exports) {
4076
4079
  ], "", true);
4077
4080
  }
4078
4081
  }
4079
- config = this.handleZIndex(config);
4082
+ if (type !== "rightClickMenu") {
4083
+ // rightClickMenu在配置处理时就处理了一次,这里不需要重复处理
4084
+ config = this.handleZIndex(config);
4085
+ }
4080
4086
  return config;
4081
4087
  },
4082
4088
  /**
@@ -4089,15 +4095,11 @@ System.register('pops', [], (function (exports) {
4089
4095
  const originZIndex = config.zIndex;
4090
4096
  const handler = () => {
4091
4097
  let deviation = 100;
4092
- if (originZIndex.toString() !== handler.toString()) {
4093
- // 避免叠加覆盖
4094
- deviation += PopsHandler.getTargerOrFunctionValue(originZIndex) ?? 0;
4095
- }
4098
+ deviation += PopsHandler.getTargerOrFunctionValue(originZIndex) ?? 0;
4096
4099
  let maxZIndex = deviation;
4097
- const pointZIndexInfoList = popsUtils.getMaxZIndexNodeInfoFromPoint(deviation);
4098
- const pointZIndexInfo = pointZIndexInfoList[0];
4099
- maxZIndex = Math.max(maxZIndex, pointZIndexInfo?.zIndex ?? deviation);
4100
- return maxZIndex;
4100
+ const pointZIndex = popsUtils.getMaxZIndexNodeInfoFromPoint(deviation)[0]?.zIndex ?? 0;
4101
+ maxZIndex = Math.max(maxZIndex, pointZIndex);
4102
+ return maxZIndex === deviation ? maxZIndex : maxZIndex + deviation;
4101
4103
  };
4102
4104
  config.zIndex = handler;
4103
4105
  return config;
@@ -13524,42 +13526,19 @@ System.register('pops', [], (function (exports) {
13524
13526
  let zIndex = 0;
13525
13527
  // 当前的最大z-index的元素,调试使用
13526
13528
  let maxZIndexNode = null;
13527
- /**
13528
- * 元素是否可见
13529
- * @param $el
13530
- * @param $css
13531
- */
13532
- function isVisibleNode($el, $css) {
13533
- let flag = true;
13534
- if (typeof $el.checkVisibility === "function") {
13535
- flag = $el.checkVisibility();
13536
- }
13537
- else {
13538
- flag =
13539
- $css.position !== "static" && $css.display !== "none" && $css.visibility !== "hidden" && $css.opacity !== "0";
13540
- }
13541
- if (flag) {
13542
- // css样式上可见
13543
- // 再判断宽高
13544
- const rect = $el.getBoundingClientRect();
13545
- // 确保该元素的中心点在屏幕内
13546
- flag = rect.width > 0 && rect.height > 0 && rect.x > 0 && rect.y > 0;
13547
- }
13548
- return flag;
13549
- }
13550
13529
  Object.keys(PopsInstData).forEach((instKeyName) => {
13551
13530
  const instData = PopsInstData[instKeyName];
13552
13531
  for (let index = 0; index < instData.length; index++) {
13553
13532
  const inst = instData[index];
13554
- const nodeStyle = window.getComputedStyle(inst.$anim);
13555
13533
  // 不对position为static和display为none的元素进行获取它们的z-index
13556
- if (isVisibleNode(inst.$anim, nodeStyle)) {
13557
- const nodeZIndex = parseInt(nodeStyle.zIndex);
13558
- if (!isNaN(nodeZIndex)) {
13559
- if (nodeZIndex > zIndex) {
13560
- zIndex = nodeZIndex;
13561
- maxZIndexNode = inst.$anim;
13562
- }
13534
+ const $elList = [inst.$anim, inst.$pops, inst.$mask].filter((it) => it instanceof HTMLElement);
13535
+ const nodeZIndexInfoList = popsUtils.getMaxZIndexNodeInfoFromPoint($elList);
13536
+ const maxNodeZIndexInfo = nodeZIndexInfoList[0];
13537
+ if (maxNodeZIndexInfo) {
13538
+ const nodeZIndex = maxNodeZIndexInfo.zIndex;
13539
+ if (nodeZIndex > zIndex) {
13540
+ zIndex = nodeZIndex;
13541
+ maxZIndexNode = maxNodeZIndexInfo.node || maxNodeZIndexInfo.positionNode;
13563
13542
  }
13564
13543
  }
13565
13544
  }
@@ -13640,6 +13619,8 @@ System.register('pops', [], (function (exports) {
13640
13619
  InstanceUtils: PopsInstanceUtils,
13641
13620
  /** pops处理float类型使用的工具类 */
13642
13621
  MathFloatUtils: PopsMathFloatUtils,
13622
+ /** 实例处理函数 */
13623
+ PopsInstHandler,
13643
13624
  /** pops.panel中用于处理各个类型的工具 */
13644
13625
  PanelHandlerComponents,
13645
13626
  /** pops.panel中的动画 */