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