@whitesev/pops 1.0.1 → 1.1.0
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 +33 -31
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +33 -31
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +33 -31
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +33 -31
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +33 -31
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +33 -31
- package/dist/index.umd.js.map +1 -1
- package/dist/types/src/Pops.d.ts +29 -0
- package/dist/types/src/utils/PopsDOMUtils.d.ts +333 -1
- package/dist/types/src/utils/{PopsUIUtils.d.ts → PopsInstanceUtils.d.ts} +3 -3
- package/package.json +1 -1
- package/dist/types/src/utils/PopsDOMUtilsEvent.d.ts +0 -334
package/dist/index.iife.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
var pops = (function () {
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
+
const SymbolEvents = Symbol("events_" + (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1));
|
|
5
|
+
|
|
4
6
|
const PopsCoreDefaultEnv = {
|
|
5
7
|
document: document,
|
|
6
8
|
window: window,
|
|
@@ -39,8 +41,6 @@ var pops = (function () {
|
|
|
39
41
|
},
|
|
40
42
|
};
|
|
41
43
|
|
|
42
|
-
const SymbolEvents = Symbol("events_" + (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1));
|
|
43
|
-
|
|
44
44
|
// @ts-nocheck
|
|
45
45
|
|
|
46
46
|
const AnyTouch = function () {
|
|
@@ -2292,7 +2292,6 @@ var pops = (function () {
|
|
|
2292
2292
|
}
|
|
2293
2293
|
}
|
|
2294
2294
|
}
|
|
2295
|
-
|
|
2296
2295
|
class PopsDOMUtils extends PopsDOMUtilsEvent {
|
|
2297
2296
|
/** 获取 animationend 在各个浏览器的兼容名 */
|
|
2298
2297
|
getAnimationEndNameList() {
|
|
@@ -2942,7 +2941,7 @@ var pops = (function () {
|
|
|
2942
2941
|
}
|
|
2943
2942
|
const popsDOMUtils = new PopsDOMUtils();
|
|
2944
2943
|
|
|
2945
|
-
const
|
|
2944
|
+
const PopsInstanceUtils = {
|
|
2946
2945
|
/**
|
|
2947
2946
|
* 获取所有弹窗中的最大的z-index
|
|
2948
2947
|
* @param defaultValue
|
|
@@ -2981,10 +2980,9 @@ var pops = (function () {
|
|
|
2981
2980
|
* 删除配置中对应的对象
|
|
2982
2981
|
* @param moreLayerConfigList 配置实例列表
|
|
2983
2982
|
* @param guid 唯一标识
|
|
2984
|
-
* @param
|
|
2983
|
+
* @param isAll 是否全部删除
|
|
2985
2984
|
*/
|
|
2986
|
-
|
|
2987
|
-
/** @param item */
|
|
2985
|
+
removeInstance(moreLayerConfigList, guid, isAll = false) {
|
|
2988
2986
|
function removeItem(item) {
|
|
2989
2987
|
item?.animElement?.remove();
|
|
2990
2988
|
item?.popsElement?.remove();
|
|
@@ -2995,7 +2993,7 @@ var pops = (function () {
|
|
|
2995
2993
|
moreLayerConfigList.forEach((layerConfigList) => {
|
|
2996
2994
|
// layer[]
|
|
2997
2995
|
layerConfigList.forEach((layerConfigItem, index) => {
|
|
2998
|
-
if (
|
|
2996
|
+
if (isAll || layerConfigItem["guid"] === guid) {
|
|
2999
2997
|
if (pops.config.animation.hasOwnProperty(layerConfigItem.animElement.getAttribute("anim"))) {
|
|
3000
2998
|
layerConfigItem.animElement.style.width = "100%";
|
|
3001
2999
|
layerConfigItem.animElement.style.height = "100%";
|
|
@@ -3162,7 +3160,7 @@ var pops = (function () {
|
|
|
3162
3160
|
return;
|
|
3163
3161
|
}
|
|
3164
3162
|
popsDOMUtils.off(popsElement, popsDOMUtils.getTransitionEndNameList(), void 0, closeCallBack);
|
|
3165
|
-
|
|
3163
|
+
PopsInstanceUtils.removeInstance([layerConfigList], guid);
|
|
3166
3164
|
}
|
|
3167
3165
|
/* 监听过渡结束 */
|
|
3168
3166
|
popsDOMUtils.on(popsElement, popsDOMUtils.getTransitionEndNameList(), closeCallBack);
|
|
@@ -3193,7 +3191,7 @@ var pops = (function () {
|
|
|
3193
3191
|
}, drawerConfig.closeDelay);
|
|
3194
3192
|
}
|
|
3195
3193
|
else {
|
|
3196
|
-
|
|
3194
|
+
PopsInstanceUtils.removeInstance([layerConfigList], guid);
|
|
3197
3195
|
}
|
|
3198
3196
|
},
|
|
3199
3197
|
/**
|
|
@@ -3881,11 +3879,11 @@ var pops = (function () {
|
|
|
3881
3879
|
function originalRun() {
|
|
3882
3880
|
if (details.config.mask.clickEvent.toClose) {
|
|
3883
3881
|
/* 关闭 */
|
|
3884
|
-
|
|
3882
|
+
PopsInstanceUtils.close(details.type, targetLayer, details.guid, details.config, details.animElement);
|
|
3885
3883
|
}
|
|
3886
3884
|
else if (details.config.mask.clickEvent.toHide) {
|
|
3887
3885
|
/* 隐藏 */
|
|
3888
|
-
|
|
3886
|
+
PopsInstanceUtils.hide(details.type, targetLayer, details.guid, details.config, details.animElement, result.maskElement);
|
|
3889
3887
|
}
|
|
3890
3888
|
}
|
|
3891
3889
|
if (typeof details.config.mask.clickCallBack === "function") {
|
|
@@ -4057,13 +4055,13 @@ var pops = (function () {
|
|
|
4057
4055
|
mode: mode,
|
|
4058
4056
|
guid: guid,
|
|
4059
4057
|
close() {
|
|
4060
|
-
|
|
4058
|
+
PopsInstanceUtils.close(mode, pops.config.layer[mode], guid, config, animElement);
|
|
4061
4059
|
},
|
|
4062
4060
|
hide() {
|
|
4063
|
-
|
|
4061
|
+
PopsInstanceUtils.hide(mode, pops.config.layer[mode], guid, config, animElement, maskElement);
|
|
4064
4062
|
},
|
|
4065
4063
|
show() {
|
|
4066
|
-
|
|
4064
|
+
PopsInstanceUtils.show(mode, pops.config.layer[mode], guid, config, animElement, maskElement);
|
|
4067
4065
|
},
|
|
4068
4066
|
};
|
|
4069
4067
|
},
|
|
@@ -4085,13 +4083,13 @@ var pops = (function () {
|
|
|
4085
4083
|
mode: mode,
|
|
4086
4084
|
guid: guid,
|
|
4087
4085
|
close() {
|
|
4088
|
-
|
|
4086
|
+
PopsInstanceUtils.close(mode, pops.config.layer[mode], guid, config, animElement);
|
|
4089
4087
|
},
|
|
4090
4088
|
hide() {
|
|
4091
|
-
|
|
4089
|
+
PopsInstanceUtils.hide(mode, pops.config.layer[mode], guid, config, animElement, maskElement);
|
|
4092
4090
|
},
|
|
4093
4091
|
show() {
|
|
4094
|
-
|
|
4092
|
+
PopsInstanceUtils.show(mode, pops.config.layer[mode], guid, config, animElement, maskElement);
|
|
4095
4093
|
},
|
|
4096
4094
|
};
|
|
4097
4095
|
},
|
|
@@ -4191,10 +4189,10 @@ var pops = (function () {
|
|
|
4191
4189
|
if (type === "loading" ||
|
|
4192
4190
|
type === "tooltip" ||
|
|
4193
4191
|
type === "rightClickMenu") {
|
|
4194
|
-
|
|
4192
|
+
PopsInstanceUtils.removeInstance([pops.config.layer[type]], "", true);
|
|
4195
4193
|
}
|
|
4196
4194
|
else {
|
|
4197
|
-
|
|
4195
|
+
PopsInstanceUtils.removeInstance([
|
|
4198
4196
|
pops.config.layer.alert,
|
|
4199
4197
|
pops.config.layer.confirm,
|
|
4200
4198
|
pops.config.layer.prompt,
|
|
@@ -4207,7 +4205,7 @@ var pops = (function () {
|
|
|
4207
4205
|
}
|
|
4208
4206
|
else {
|
|
4209
4207
|
config.zIndex =
|
|
4210
|
-
|
|
4208
|
+
PopsInstanceUtils.getPopsMaxZIndex(config.zIndex)["zIndex"] * 2;
|
|
4211
4209
|
}
|
|
4212
4210
|
return config;
|
|
4213
4211
|
},
|
|
@@ -4364,7 +4362,7 @@ var pops = (function () {
|
|
|
4364
4362
|
});
|
|
4365
4363
|
/* 拖拽 */
|
|
4366
4364
|
if (config.drag) {
|
|
4367
|
-
|
|
4365
|
+
PopsInstanceUtils.drag($pops, {
|
|
4368
4366
|
dragElement: $title,
|
|
4369
4367
|
limit: config.dragLimit,
|
|
4370
4368
|
extraDistance: config.dragExtraDistance,
|
|
@@ -4546,7 +4544,7 @@ var pops = (function () {
|
|
|
4546
4544
|
});
|
|
4547
4545
|
/* 拖拽 */
|
|
4548
4546
|
if (config.drag) {
|
|
4549
|
-
|
|
4547
|
+
PopsInstanceUtils.drag($pops, {
|
|
4550
4548
|
dragElement: $title,
|
|
4551
4549
|
limit: config.dragLimit,
|
|
4552
4550
|
extraDistance: config.dragExtraDistance,
|
|
@@ -4741,7 +4739,7 @@ var pops = (function () {
|
|
|
4741
4739
|
});
|
|
4742
4740
|
/* 拖拽 */
|
|
4743
4741
|
if (config.drag) {
|
|
4744
|
-
|
|
4742
|
+
PopsInstanceUtils.drag($pops, {
|
|
4745
4743
|
dragElement: $title,
|
|
4746
4744
|
limit: config.dragLimit,
|
|
4747
4745
|
extraDistance: config.dragExtraDistance,
|
|
@@ -5003,7 +5001,7 @@ var pops = (function () {
|
|
|
5003
5001
|
}
|
|
5004
5002
|
/* 拖拽 */
|
|
5005
5003
|
if (config.drag) {
|
|
5006
|
-
|
|
5004
|
+
PopsInstanceUtils.drag($pops, {
|
|
5007
5005
|
dragElement: $title,
|
|
5008
5006
|
limit: config.dragLimit,
|
|
5009
5007
|
extraDistance: config.dragExtraDistance,
|
|
@@ -5069,7 +5067,7 @@ var pops = (function () {
|
|
|
5069
5067
|
allMinElementList.push(item.popsElement);
|
|
5070
5068
|
}
|
|
5071
5069
|
});
|
|
5072
|
-
allMinElementList.sort(
|
|
5070
|
+
allMinElementList.sort(PopsInstanceUtils.sortElementListByProperty((obj) => {
|
|
5073
5071
|
return parseInt(getComputedStyle(obj).left);
|
|
5074
5072
|
}, (obj) => {
|
|
5075
5073
|
return parseInt(getComputedStyle(obj).left);
|
|
@@ -5085,7 +5083,7 @@ var pops = (function () {
|
|
|
5085
5083
|
});
|
|
5086
5084
|
/* 关闭按钮点击事件 */
|
|
5087
5085
|
popsDOMUtils.on(headerCloseBtnElement, "click", (event) => {
|
|
5088
|
-
|
|
5086
|
+
PopsInstanceUtils.removeInstance([pops.config.layer.iframe], guid, false);
|
|
5089
5087
|
setTimeout(() => {
|
|
5090
5088
|
let allIsMinElementList = [];
|
|
5091
5089
|
pops.config.layer.iframe.forEach((item) => {
|
|
@@ -5094,7 +5092,7 @@ var pops = (function () {
|
|
|
5094
5092
|
allIsMinElementList.push(item.popsElement);
|
|
5095
5093
|
}
|
|
5096
5094
|
});
|
|
5097
|
-
allIsMinElementList.sort(
|
|
5095
|
+
allIsMinElementList.sort(PopsInstanceUtils.sortElementListByProperty((obj) => {
|
|
5098
5096
|
return parseInt(getComputedStyle(obj).left);
|
|
5099
5097
|
}, (obj) => {
|
|
5100
5098
|
return parseInt(getComputedStyle(obj).left);
|
|
@@ -6529,7 +6527,7 @@ var pops = (function () {
|
|
|
6529
6527
|
}
|
|
6530
6528
|
/* 拖拽 */
|
|
6531
6529
|
if (config.drag) {
|
|
6532
|
-
|
|
6530
|
+
PopsInstanceUtils.drag($pops, {
|
|
6533
6531
|
dragElement: $title,
|
|
6534
6532
|
limit: config.dragLimit,
|
|
6535
6533
|
extraDistance: config.dragExtraDistance,
|
|
@@ -8763,7 +8761,7 @@ var pops = (function () {
|
|
|
8763
8761
|
});
|
|
8764
8762
|
/* 拖拽 */
|
|
8765
8763
|
if (config.drag) {
|
|
8766
|
-
|
|
8764
|
+
PopsInstanceUtils.drag($pops, {
|
|
8767
8765
|
dragElement: $title,
|
|
8768
8766
|
limit: config.dragLimit,
|
|
8769
8767
|
extraDistance: config.dragExtraDistance,
|
|
@@ -10010,6 +10008,10 @@ var pops = (function () {
|
|
|
10010
10008
|
Utils: popsUtils,
|
|
10011
10009
|
/** pops使用的DOM工具类 */
|
|
10012
10010
|
DOMUtils: popsDOMUtils,
|
|
10011
|
+
/** pops创建的实例使用的工具类 */
|
|
10012
|
+
InstanceUtils: PopsInstanceUtils,
|
|
10013
|
+
/** pops处理float类型使用的工具类 */
|
|
10014
|
+
MathFloatUtils: PopsMathFloatUtils,
|
|
10013
10015
|
};
|
|
10014
10016
|
constructor() { }
|
|
10015
10017
|
init() {
|
|
@@ -10020,7 +10022,7 @@ var pops = (function () {
|
|
|
10020
10022
|
animationStyle.innerHTML = this.config.cssText.anim;
|
|
10021
10023
|
popsDOMUtils.appendHead(animationStyle);
|
|
10022
10024
|
this.config.animation = null;
|
|
10023
|
-
this.config.animation =
|
|
10025
|
+
this.config.animation = PopsInstanceUtils.getKeyFrames(animationStyle.sheet);
|
|
10024
10026
|
setTimeout(() => {
|
|
10025
10027
|
animationStyle.remove();
|
|
10026
10028
|
}, 50);
|