@whitesev/pops 1.0.1 → 1.2.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 +44 -34
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +44 -34
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +44 -34
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +44 -34
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +44 -34
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +44 -34
- 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 +41 -41
- 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 () {
|
|
@@ -1491,6 +1491,12 @@ define((function () { 'use strict';
|
|
|
1491
1491
|
}
|
|
1492
1492
|
assign(target = {}, source = {}, isAdd = false) {
|
|
1493
1493
|
let UtilsContext = this;
|
|
1494
|
+
if (source == null) {
|
|
1495
|
+
return target;
|
|
1496
|
+
}
|
|
1497
|
+
if (target == null) {
|
|
1498
|
+
target = {};
|
|
1499
|
+
}
|
|
1494
1500
|
if (Array.isArray(source)) {
|
|
1495
1501
|
let canTraverse = source.filter((item) => {
|
|
1496
1502
|
return typeof item === "object";
|
|
@@ -1504,8 +1510,9 @@ define((function () { 'use strict';
|
|
|
1504
1510
|
const targetKeyName = sourceKeyName;
|
|
1505
1511
|
let targetValue = target[targetKeyName];
|
|
1506
1512
|
let sourceValue = source[sourceKeyName];
|
|
1507
|
-
if (
|
|
1508
|
-
|
|
1513
|
+
if (typeof sourceValue === "object" &&
|
|
1514
|
+
sourceValue != null &&
|
|
1515
|
+
sourceKeyName in target &&
|
|
1509
1516
|
!UtilsContext.isDOM(sourceValue)) {
|
|
1510
1517
|
/* 源端的值是object类型,且不是元素节点 */
|
|
1511
1518
|
target[sourceKeyName] = UtilsContext.assign(targetValue, sourceValue, isAdd);
|
|
@@ -1520,6 +1527,7 @@ define((function () { 'use strict';
|
|
|
1520
1527
|
let targetValue = target[targetKeyName];
|
|
1521
1528
|
let sourceValue = source[targetKeyName];
|
|
1522
1529
|
if (typeof sourceValue === "object" &&
|
|
1530
|
+
sourceValue != null &&
|
|
1523
1531
|
!UtilsContext.isDOM(sourceValue) &&
|
|
1524
1532
|
Object.keys(sourceValue).length) {
|
|
1525
1533
|
/* 源端的值是object类型,且不是元素节点 */
|
|
@@ -2291,7 +2299,6 @@ define((function () { 'use strict';
|
|
|
2291
2299
|
}
|
|
2292
2300
|
}
|
|
2293
2301
|
}
|
|
2294
|
-
|
|
2295
2302
|
class PopsDOMUtils extends PopsDOMUtilsEvent {
|
|
2296
2303
|
/** 获取 animationend 在各个浏览器的兼容名 */
|
|
2297
2304
|
getAnimationEndNameList() {
|
|
@@ -2941,7 +2948,7 @@ define((function () { 'use strict';
|
|
|
2941
2948
|
}
|
|
2942
2949
|
const popsDOMUtils = new PopsDOMUtils();
|
|
2943
2950
|
|
|
2944
|
-
const
|
|
2951
|
+
const PopsInstanceUtils = {
|
|
2945
2952
|
/**
|
|
2946
2953
|
* 获取所有弹窗中的最大的z-index
|
|
2947
2954
|
* @param defaultValue
|
|
@@ -2980,10 +2987,9 @@ define((function () { 'use strict';
|
|
|
2980
2987
|
* 删除配置中对应的对象
|
|
2981
2988
|
* @param moreLayerConfigList 配置实例列表
|
|
2982
2989
|
* @param guid 唯一标识
|
|
2983
|
-
* @param
|
|
2990
|
+
* @param isAll 是否全部删除
|
|
2984
2991
|
*/
|
|
2985
|
-
|
|
2986
|
-
/** @param item */
|
|
2992
|
+
removeInstance(moreLayerConfigList, guid, isAll = false) {
|
|
2987
2993
|
function removeItem(item) {
|
|
2988
2994
|
item?.animElement?.remove();
|
|
2989
2995
|
item?.popsElement?.remove();
|
|
@@ -2994,7 +3000,7 @@ define((function () { 'use strict';
|
|
|
2994
3000
|
moreLayerConfigList.forEach((layerConfigList) => {
|
|
2995
3001
|
// layer[]
|
|
2996
3002
|
layerConfigList.forEach((layerConfigItem, index) => {
|
|
2997
|
-
if (
|
|
3003
|
+
if (isAll || layerConfigItem["guid"] === guid) {
|
|
2998
3004
|
if (pops.config.animation.hasOwnProperty(layerConfigItem.animElement.getAttribute("anim"))) {
|
|
2999
3005
|
layerConfigItem.animElement.style.width = "100%";
|
|
3000
3006
|
layerConfigItem.animElement.style.height = "100%";
|
|
@@ -3161,7 +3167,7 @@ define((function () { 'use strict';
|
|
|
3161
3167
|
return;
|
|
3162
3168
|
}
|
|
3163
3169
|
popsDOMUtils.off(popsElement, popsDOMUtils.getTransitionEndNameList(), void 0, closeCallBack);
|
|
3164
|
-
|
|
3170
|
+
PopsInstanceUtils.removeInstance([layerConfigList], guid);
|
|
3165
3171
|
}
|
|
3166
3172
|
/* 监听过渡结束 */
|
|
3167
3173
|
popsDOMUtils.on(popsElement, popsDOMUtils.getTransitionEndNameList(), closeCallBack);
|
|
@@ -3192,7 +3198,7 @@ define((function () { 'use strict';
|
|
|
3192
3198
|
}, drawerConfig.closeDelay);
|
|
3193
3199
|
}
|
|
3194
3200
|
else {
|
|
3195
|
-
|
|
3201
|
+
PopsInstanceUtils.removeInstance([layerConfigList], guid);
|
|
3196
3202
|
}
|
|
3197
3203
|
},
|
|
3198
3204
|
/**
|
|
@@ -3880,11 +3886,11 @@ define((function () { 'use strict';
|
|
|
3880
3886
|
function originalRun() {
|
|
3881
3887
|
if (details.config.mask.clickEvent.toClose) {
|
|
3882
3888
|
/* 关闭 */
|
|
3883
|
-
|
|
3889
|
+
PopsInstanceUtils.close(details.type, targetLayer, details.guid, details.config, details.animElement);
|
|
3884
3890
|
}
|
|
3885
3891
|
else if (details.config.mask.clickEvent.toHide) {
|
|
3886
3892
|
/* 隐藏 */
|
|
3887
|
-
|
|
3893
|
+
PopsInstanceUtils.hide(details.type, targetLayer, details.guid, details.config, details.animElement, result.maskElement);
|
|
3888
3894
|
}
|
|
3889
3895
|
}
|
|
3890
3896
|
if (typeof details.config.mask.clickCallBack === "function") {
|
|
@@ -4056,13 +4062,13 @@ define((function () { 'use strict';
|
|
|
4056
4062
|
mode: mode,
|
|
4057
4063
|
guid: guid,
|
|
4058
4064
|
close() {
|
|
4059
|
-
|
|
4065
|
+
PopsInstanceUtils.close(mode, pops.config.layer[mode], guid, config, animElement);
|
|
4060
4066
|
},
|
|
4061
4067
|
hide() {
|
|
4062
|
-
|
|
4068
|
+
PopsInstanceUtils.hide(mode, pops.config.layer[mode], guid, config, animElement, maskElement);
|
|
4063
4069
|
},
|
|
4064
4070
|
show() {
|
|
4065
|
-
|
|
4071
|
+
PopsInstanceUtils.show(mode, pops.config.layer[mode], guid, config, animElement, maskElement);
|
|
4066
4072
|
},
|
|
4067
4073
|
};
|
|
4068
4074
|
},
|
|
@@ -4084,13 +4090,13 @@ define((function () { 'use strict';
|
|
|
4084
4090
|
mode: mode,
|
|
4085
4091
|
guid: guid,
|
|
4086
4092
|
close() {
|
|
4087
|
-
|
|
4093
|
+
PopsInstanceUtils.close(mode, pops.config.layer[mode], guid, config, animElement);
|
|
4088
4094
|
},
|
|
4089
4095
|
hide() {
|
|
4090
|
-
|
|
4096
|
+
PopsInstanceUtils.hide(mode, pops.config.layer[mode], guid, config, animElement, maskElement);
|
|
4091
4097
|
},
|
|
4092
4098
|
show() {
|
|
4093
|
-
|
|
4099
|
+
PopsInstanceUtils.show(mode, pops.config.layer[mode], guid, config, animElement, maskElement);
|
|
4094
4100
|
},
|
|
4095
4101
|
};
|
|
4096
4102
|
},
|
|
@@ -4190,10 +4196,10 @@ define((function () { 'use strict';
|
|
|
4190
4196
|
if (type === "loading" ||
|
|
4191
4197
|
type === "tooltip" ||
|
|
4192
4198
|
type === "rightClickMenu") {
|
|
4193
|
-
|
|
4199
|
+
PopsInstanceUtils.removeInstance([pops.config.layer[type]], "", true);
|
|
4194
4200
|
}
|
|
4195
4201
|
else {
|
|
4196
|
-
|
|
4202
|
+
PopsInstanceUtils.removeInstance([
|
|
4197
4203
|
pops.config.layer.alert,
|
|
4198
4204
|
pops.config.layer.confirm,
|
|
4199
4205
|
pops.config.layer.prompt,
|
|
@@ -4206,7 +4212,7 @@ define((function () { 'use strict';
|
|
|
4206
4212
|
}
|
|
4207
4213
|
else {
|
|
4208
4214
|
config.zIndex =
|
|
4209
|
-
|
|
4215
|
+
PopsInstanceUtils.getPopsMaxZIndex(config.zIndex)["zIndex"] * 2;
|
|
4210
4216
|
}
|
|
4211
4217
|
return config;
|
|
4212
4218
|
},
|
|
@@ -4363,7 +4369,7 @@ define((function () { 'use strict';
|
|
|
4363
4369
|
});
|
|
4364
4370
|
/* 拖拽 */
|
|
4365
4371
|
if (config.drag) {
|
|
4366
|
-
|
|
4372
|
+
PopsInstanceUtils.drag($pops, {
|
|
4367
4373
|
dragElement: $title,
|
|
4368
4374
|
limit: config.dragLimit,
|
|
4369
4375
|
extraDistance: config.dragExtraDistance,
|
|
@@ -4545,7 +4551,7 @@ define((function () { 'use strict';
|
|
|
4545
4551
|
});
|
|
4546
4552
|
/* 拖拽 */
|
|
4547
4553
|
if (config.drag) {
|
|
4548
|
-
|
|
4554
|
+
PopsInstanceUtils.drag($pops, {
|
|
4549
4555
|
dragElement: $title,
|
|
4550
4556
|
limit: config.dragLimit,
|
|
4551
4557
|
extraDistance: config.dragExtraDistance,
|
|
@@ -4740,7 +4746,7 @@ define((function () { 'use strict';
|
|
|
4740
4746
|
});
|
|
4741
4747
|
/* 拖拽 */
|
|
4742
4748
|
if (config.drag) {
|
|
4743
|
-
|
|
4749
|
+
PopsInstanceUtils.drag($pops, {
|
|
4744
4750
|
dragElement: $title,
|
|
4745
4751
|
limit: config.dragLimit,
|
|
4746
4752
|
extraDistance: config.dragExtraDistance,
|
|
@@ -5002,7 +5008,7 @@ define((function () { 'use strict';
|
|
|
5002
5008
|
}
|
|
5003
5009
|
/* 拖拽 */
|
|
5004
5010
|
if (config.drag) {
|
|
5005
|
-
|
|
5011
|
+
PopsInstanceUtils.drag($pops, {
|
|
5006
5012
|
dragElement: $title,
|
|
5007
5013
|
limit: config.dragLimit,
|
|
5008
5014
|
extraDistance: config.dragExtraDistance,
|
|
@@ -5068,7 +5074,7 @@ define((function () { 'use strict';
|
|
|
5068
5074
|
allMinElementList.push(item.popsElement);
|
|
5069
5075
|
}
|
|
5070
5076
|
});
|
|
5071
|
-
allMinElementList.sort(
|
|
5077
|
+
allMinElementList.sort(PopsInstanceUtils.sortElementListByProperty((obj) => {
|
|
5072
5078
|
return parseInt(getComputedStyle(obj).left);
|
|
5073
5079
|
}, (obj) => {
|
|
5074
5080
|
return parseInt(getComputedStyle(obj).left);
|
|
@@ -5084,7 +5090,7 @@ define((function () { 'use strict';
|
|
|
5084
5090
|
});
|
|
5085
5091
|
/* 关闭按钮点击事件 */
|
|
5086
5092
|
popsDOMUtils.on(headerCloseBtnElement, "click", (event) => {
|
|
5087
|
-
|
|
5093
|
+
PopsInstanceUtils.removeInstance([pops.config.layer.iframe], guid, false);
|
|
5088
5094
|
setTimeout(() => {
|
|
5089
5095
|
let allIsMinElementList = [];
|
|
5090
5096
|
pops.config.layer.iframe.forEach((item) => {
|
|
@@ -5093,7 +5099,7 @@ define((function () { 'use strict';
|
|
|
5093
5099
|
allIsMinElementList.push(item.popsElement);
|
|
5094
5100
|
}
|
|
5095
5101
|
});
|
|
5096
|
-
allIsMinElementList.sort(
|
|
5102
|
+
allIsMinElementList.sort(PopsInstanceUtils.sortElementListByProperty((obj) => {
|
|
5097
5103
|
return parseInt(getComputedStyle(obj).left);
|
|
5098
5104
|
}, (obj) => {
|
|
5099
5105
|
return parseInt(getComputedStyle(obj).left);
|
|
@@ -6528,7 +6534,7 @@ define((function () { 'use strict';
|
|
|
6528
6534
|
}
|
|
6529
6535
|
/* 拖拽 */
|
|
6530
6536
|
if (config.drag) {
|
|
6531
|
-
|
|
6537
|
+
PopsInstanceUtils.drag($pops, {
|
|
6532
6538
|
dragElement: $title,
|
|
6533
6539
|
limit: config.dragLimit,
|
|
6534
6540
|
extraDistance: config.dragExtraDistance,
|
|
@@ -8762,7 +8768,7 @@ define((function () { 'use strict';
|
|
|
8762
8768
|
});
|
|
8763
8769
|
/* 拖拽 */
|
|
8764
8770
|
if (config.drag) {
|
|
8765
|
-
|
|
8771
|
+
PopsInstanceUtils.drag($pops, {
|
|
8766
8772
|
dragElement: $title,
|
|
8767
8773
|
limit: config.dragLimit,
|
|
8768
8774
|
extraDistance: config.dragExtraDistance,
|
|
@@ -9919,7 +9925,7 @@ define((function () { 'use strict';
|
|
|
9919
9925
|
/** 配置 */
|
|
9920
9926
|
config = {
|
|
9921
9927
|
/** 版本号 */
|
|
9922
|
-
version: "2024.7.
|
|
9928
|
+
version: "2024.7.14",
|
|
9923
9929
|
cssText: {
|
|
9924
9930
|
/** 主CSS */
|
|
9925
9931
|
index: indexCSS,
|
|
@@ -10009,6 +10015,10 @@ define((function () { 'use strict';
|
|
|
10009
10015
|
Utils: popsUtils,
|
|
10010
10016
|
/** pops使用的DOM工具类 */
|
|
10011
10017
|
DOMUtils: popsDOMUtils,
|
|
10018
|
+
/** pops创建的实例使用的工具类 */
|
|
10019
|
+
InstanceUtils: PopsInstanceUtils,
|
|
10020
|
+
/** pops处理float类型使用的工具类 */
|
|
10021
|
+
MathFloatUtils: PopsMathFloatUtils,
|
|
10012
10022
|
};
|
|
10013
10023
|
constructor() { }
|
|
10014
10024
|
init() {
|
|
@@ -10019,7 +10029,7 @@ define((function () { 'use strict';
|
|
|
10019
10029
|
animationStyle.innerHTML = this.config.cssText.anim;
|
|
10020
10030
|
popsDOMUtils.appendHead(animationStyle);
|
|
10021
10031
|
this.config.animation = null;
|
|
10022
|
-
this.config.animation =
|
|
10032
|
+
this.config.animation = PopsInstanceUtils.getKeyFrames(animationStyle.sheet);
|
|
10023
10033
|
setTimeout(() => {
|
|
10024
10034
|
animationStyle.remove();
|
|
10025
10035
|
}, 50);
|