@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.umd.js
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.pops = factory());
|
|
5
5
|
})(this, (function () { 'use strict';
|
|
6
6
|
|
|
7
|
+
const SymbolEvents = Symbol("events_" + (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1));
|
|
8
|
+
|
|
7
9
|
const PopsCoreDefaultEnv = {
|
|
8
10
|
document: document,
|
|
9
11
|
window: window,
|
|
@@ -42,8 +44,6 @@
|
|
|
42
44
|
},
|
|
43
45
|
};
|
|
44
46
|
|
|
45
|
-
const SymbolEvents = Symbol("events_" + (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1));
|
|
46
|
-
|
|
47
47
|
// @ts-nocheck
|
|
48
48
|
|
|
49
49
|
const AnyTouch = function () {
|
|
@@ -1495,6 +1495,12 @@
|
|
|
1495
1495
|
}
|
|
1496
1496
|
assign(target = {}, source = {}, isAdd = false) {
|
|
1497
1497
|
let UtilsContext = this;
|
|
1498
|
+
if (source == null) {
|
|
1499
|
+
return target;
|
|
1500
|
+
}
|
|
1501
|
+
if (target == null) {
|
|
1502
|
+
target = {};
|
|
1503
|
+
}
|
|
1498
1504
|
if (Array.isArray(source)) {
|
|
1499
1505
|
let canTraverse = source.filter((item) => {
|
|
1500
1506
|
return typeof item === "object";
|
|
@@ -1508,8 +1514,9 @@
|
|
|
1508
1514
|
const targetKeyName = sourceKeyName;
|
|
1509
1515
|
let targetValue = target[targetKeyName];
|
|
1510
1516
|
let sourceValue = source[sourceKeyName];
|
|
1511
|
-
if (
|
|
1512
|
-
|
|
1517
|
+
if (typeof sourceValue === "object" &&
|
|
1518
|
+
sourceValue != null &&
|
|
1519
|
+
sourceKeyName in target &&
|
|
1513
1520
|
!UtilsContext.isDOM(sourceValue)) {
|
|
1514
1521
|
/* 源端的值是object类型,且不是元素节点 */
|
|
1515
1522
|
target[sourceKeyName] = UtilsContext.assign(targetValue, sourceValue, isAdd);
|
|
@@ -1524,6 +1531,7 @@
|
|
|
1524
1531
|
let targetValue = target[targetKeyName];
|
|
1525
1532
|
let sourceValue = source[targetKeyName];
|
|
1526
1533
|
if (typeof sourceValue === "object" &&
|
|
1534
|
+
sourceValue != null &&
|
|
1527
1535
|
!UtilsContext.isDOM(sourceValue) &&
|
|
1528
1536
|
Object.keys(sourceValue).length) {
|
|
1529
1537
|
/* 源端的值是object类型,且不是元素节点 */
|
|
@@ -2295,7 +2303,6 @@
|
|
|
2295
2303
|
}
|
|
2296
2304
|
}
|
|
2297
2305
|
}
|
|
2298
|
-
|
|
2299
2306
|
class PopsDOMUtils extends PopsDOMUtilsEvent {
|
|
2300
2307
|
/** 获取 animationend 在各个浏览器的兼容名 */
|
|
2301
2308
|
getAnimationEndNameList() {
|
|
@@ -2945,7 +2952,7 @@
|
|
|
2945
2952
|
}
|
|
2946
2953
|
const popsDOMUtils = new PopsDOMUtils();
|
|
2947
2954
|
|
|
2948
|
-
const
|
|
2955
|
+
const PopsInstanceUtils = {
|
|
2949
2956
|
/**
|
|
2950
2957
|
* 获取所有弹窗中的最大的z-index
|
|
2951
2958
|
* @param defaultValue
|
|
@@ -2984,10 +2991,9 @@
|
|
|
2984
2991
|
* 删除配置中对应的对象
|
|
2985
2992
|
* @param moreLayerConfigList 配置实例列表
|
|
2986
2993
|
* @param guid 唯一标识
|
|
2987
|
-
* @param
|
|
2994
|
+
* @param isAll 是否全部删除
|
|
2988
2995
|
*/
|
|
2989
|
-
|
|
2990
|
-
/** @param item */
|
|
2996
|
+
removeInstance(moreLayerConfigList, guid, isAll = false) {
|
|
2991
2997
|
function removeItem(item) {
|
|
2992
2998
|
item?.animElement?.remove();
|
|
2993
2999
|
item?.popsElement?.remove();
|
|
@@ -2998,7 +3004,7 @@
|
|
|
2998
3004
|
moreLayerConfigList.forEach((layerConfigList) => {
|
|
2999
3005
|
// layer[]
|
|
3000
3006
|
layerConfigList.forEach((layerConfigItem, index) => {
|
|
3001
|
-
if (
|
|
3007
|
+
if (isAll || layerConfigItem["guid"] === guid) {
|
|
3002
3008
|
if (pops.config.animation.hasOwnProperty(layerConfigItem.animElement.getAttribute("anim"))) {
|
|
3003
3009
|
layerConfigItem.animElement.style.width = "100%";
|
|
3004
3010
|
layerConfigItem.animElement.style.height = "100%";
|
|
@@ -3165,7 +3171,7 @@
|
|
|
3165
3171
|
return;
|
|
3166
3172
|
}
|
|
3167
3173
|
popsDOMUtils.off(popsElement, popsDOMUtils.getTransitionEndNameList(), void 0, closeCallBack);
|
|
3168
|
-
|
|
3174
|
+
PopsInstanceUtils.removeInstance([layerConfigList], guid);
|
|
3169
3175
|
}
|
|
3170
3176
|
/* 监听过渡结束 */
|
|
3171
3177
|
popsDOMUtils.on(popsElement, popsDOMUtils.getTransitionEndNameList(), closeCallBack);
|
|
@@ -3196,7 +3202,7 @@
|
|
|
3196
3202
|
}, drawerConfig.closeDelay);
|
|
3197
3203
|
}
|
|
3198
3204
|
else {
|
|
3199
|
-
|
|
3205
|
+
PopsInstanceUtils.removeInstance([layerConfigList], guid);
|
|
3200
3206
|
}
|
|
3201
3207
|
},
|
|
3202
3208
|
/**
|
|
@@ -3884,11 +3890,11 @@
|
|
|
3884
3890
|
function originalRun() {
|
|
3885
3891
|
if (details.config.mask.clickEvent.toClose) {
|
|
3886
3892
|
/* 关闭 */
|
|
3887
|
-
|
|
3893
|
+
PopsInstanceUtils.close(details.type, targetLayer, details.guid, details.config, details.animElement);
|
|
3888
3894
|
}
|
|
3889
3895
|
else if (details.config.mask.clickEvent.toHide) {
|
|
3890
3896
|
/* 隐藏 */
|
|
3891
|
-
|
|
3897
|
+
PopsInstanceUtils.hide(details.type, targetLayer, details.guid, details.config, details.animElement, result.maskElement);
|
|
3892
3898
|
}
|
|
3893
3899
|
}
|
|
3894
3900
|
if (typeof details.config.mask.clickCallBack === "function") {
|
|
@@ -4060,13 +4066,13 @@
|
|
|
4060
4066
|
mode: mode,
|
|
4061
4067
|
guid: guid,
|
|
4062
4068
|
close() {
|
|
4063
|
-
|
|
4069
|
+
PopsInstanceUtils.close(mode, pops.config.layer[mode], guid, config, animElement);
|
|
4064
4070
|
},
|
|
4065
4071
|
hide() {
|
|
4066
|
-
|
|
4072
|
+
PopsInstanceUtils.hide(mode, pops.config.layer[mode], guid, config, animElement, maskElement);
|
|
4067
4073
|
},
|
|
4068
4074
|
show() {
|
|
4069
|
-
|
|
4075
|
+
PopsInstanceUtils.show(mode, pops.config.layer[mode], guid, config, animElement, maskElement);
|
|
4070
4076
|
},
|
|
4071
4077
|
};
|
|
4072
4078
|
},
|
|
@@ -4088,13 +4094,13 @@
|
|
|
4088
4094
|
mode: mode,
|
|
4089
4095
|
guid: guid,
|
|
4090
4096
|
close() {
|
|
4091
|
-
|
|
4097
|
+
PopsInstanceUtils.close(mode, pops.config.layer[mode], guid, config, animElement);
|
|
4092
4098
|
},
|
|
4093
4099
|
hide() {
|
|
4094
|
-
|
|
4100
|
+
PopsInstanceUtils.hide(mode, pops.config.layer[mode], guid, config, animElement, maskElement);
|
|
4095
4101
|
},
|
|
4096
4102
|
show() {
|
|
4097
|
-
|
|
4103
|
+
PopsInstanceUtils.show(mode, pops.config.layer[mode], guid, config, animElement, maskElement);
|
|
4098
4104
|
},
|
|
4099
4105
|
};
|
|
4100
4106
|
},
|
|
@@ -4194,10 +4200,10 @@
|
|
|
4194
4200
|
if (type === "loading" ||
|
|
4195
4201
|
type === "tooltip" ||
|
|
4196
4202
|
type === "rightClickMenu") {
|
|
4197
|
-
|
|
4203
|
+
PopsInstanceUtils.removeInstance([pops.config.layer[type]], "", true);
|
|
4198
4204
|
}
|
|
4199
4205
|
else {
|
|
4200
|
-
|
|
4206
|
+
PopsInstanceUtils.removeInstance([
|
|
4201
4207
|
pops.config.layer.alert,
|
|
4202
4208
|
pops.config.layer.confirm,
|
|
4203
4209
|
pops.config.layer.prompt,
|
|
@@ -4210,7 +4216,7 @@
|
|
|
4210
4216
|
}
|
|
4211
4217
|
else {
|
|
4212
4218
|
config.zIndex =
|
|
4213
|
-
|
|
4219
|
+
PopsInstanceUtils.getPopsMaxZIndex(config.zIndex)["zIndex"] * 2;
|
|
4214
4220
|
}
|
|
4215
4221
|
return config;
|
|
4216
4222
|
},
|
|
@@ -4367,7 +4373,7 @@
|
|
|
4367
4373
|
});
|
|
4368
4374
|
/* 拖拽 */
|
|
4369
4375
|
if (config.drag) {
|
|
4370
|
-
|
|
4376
|
+
PopsInstanceUtils.drag($pops, {
|
|
4371
4377
|
dragElement: $title,
|
|
4372
4378
|
limit: config.dragLimit,
|
|
4373
4379
|
extraDistance: config.dragExtraDistance,
|
|
@@ -4549,7 +4555,7 @@
|
|
|
4549
4555
|
});
|
|
4550
4556
|
/* 拖拽 */
|
|
4551
4557
|
if (config.drag) {
|
|
4552
|
-
|
|
4558
|
+
PopsInstanceUtils.drag($pops, {
|
|
4553
4559
|
dragElement: $title,
|
|
4554
4560
|
limit: config.dragLimit,
|
|
4555
4561
|
extraDistance: config.dragExtraDistance,
|
|
@@ -4744,7 +4750,7 @@
|
|
|
4744
4750
|
});
|
|
4745
4751
|
/* 拖拽 */
|
|
4746
4752
|
if (config.drag) {
|
|
4747
|
-
|
|
4753
|
+
PopsInstanceUtils.drag($pops, {
|
|
4748
4754
|
dragElement: $title,
|
|
4749
4755
|
limit: config.dragLimit,
|
|
4750
4756
|
extraDistance: config.dragExtraDistance,
|
|
@@ -5006,7 +5012,7 @@
|
|
|
5006
5012
|
}
|
|
5007
5013
|
/* 拖拽 */
|
|
5008
5014
|
if (config.drag) {
|
|
5009
|
-
|
|
5015
|
+
PopsInstanceUtils.drag($pops, {
|
|
5010
5016
|
dragElement: $title,
|
|
5011
5017
|
limit: config.dragLimit,
|
|
5012
5018
|
extraDistance: config.dragExtraDistance,
|
|
@@ -5072,7 +5078,7 @@
|
|
|
5072
5078
|
allMinElementList.push(item.popsElement);
|
|
5073
5079
|
}
|
|
5074
5080
|
});
|
|
5075
|
-
allMinElementList.sort(
|
|
5081
|
+
allMinElementList.sort(PopsInstanceUtils.sortElementListByProperty((obj) => {
|
|
5076
5082
|
return parseInt(getComputedStyle(obj).left);
|
|
5077
5083
|
}, (obj) => {
|
|
5078
5084
|
return parseInt(getComputedStyle(obj).left);
|
|
@@ -5088,7 +5094,7 @@
|
|
|
5088
5094
|
});
|
|
5089
5095
|
/* 关闭按钮点击事件 */
|
|
5090
5096
|
popsDOMUtils.on(headerCloseBtnElement, "click", (event) => {
|
|
5091
|
-
|
|
5097
|
+
PopsInstanceUtils.removeInstance([pops.config.layer.iframe], guid, false);
|
|
5092
5098
|
setTimeout(() => {
|
|
5093
5099
|
let allIsMinElementList = [];
|
|
5094
5100
|
pops.config.layer.iframe.forEach((item) => {
|
|
@@ -5097,7 +5103,7 @@
|
|
|
5097
5103
|
allIsMinElementList.push(item.popsElement);
|
|
5098
5104
|
}
|
|
5099
5105
|
});
|
|
5100
|
-
allIsMinElementList.sort(
|
|
5106
|
+
allIsMinElementList.sort(PopsInstanceUtils.sortElementListByProperty((obj) => {
|
|
5101
5107
|
return parseInt(getComputedStyle(obj).left);
|
|
5102
5108
|
}, (obj) => {
|
|
5103
5109
|
return parseInt(getComputedStyle(obj).left);
|
|
@@ -6532,7 +6538,7 @@
|
|
|
6532
6538
|
}
|
|
6533
6539
|
/* 拖拽 */
|
|
6534
6540
|
if (config.drag) {
|
|
6535
|
-
|
|
6541
|
+
PopsInstanceUtils.drag($pops, {
|
|
6536
6542
|
dragElement: $title,
|
|
6537
6543
|
limit: config.dragLimit,
|
|
6538
6544
|
extraDistance: config.dragExtraDistance,
|
|
@@ -8766,7 +8772,7 @@
|
|
|
8766
8772
|
});
|
|
8767
8773
|
/* 拖拽 */
|
|
8768
8774
|
if (config.drag) {
|
|
8769
|
-
|
|
8775
|
+
PopsInstanceUtils.drag($pops, {
|
|
8770
8776
|
dragElement: $title,
|
|
8771
8777
|
limit: config.dragLimit,
|
|
8772
8778
|
extraDistance: config.dragExtraDistance,
|
|
@@ -9923,7 +9929,7 @@
|
|
|
9923
9929
|
/** 配置 */
|
|
9924
9930
|
config = {
|
|
9925
9931
|
/** 版本号 */
|
|
9926
|
-
version: "2024.7.
|
|
9932
|
+
version: "2024.7.14",
|
|
9927
9933
|
cssText: {
|
|
9928
9934
|
/** 主CSS */
|
|
9929
9935
|
index: indexCSS,
|
|
@@ -10013,6 +10019,10 @@
|
|
|
10013
10019
|
Utils: popsUtils,
|
|
10014
10020
|
/** pops使用的DOM工具类 */
|
|
10015
10021
|
DOMUtils: popsDOMUtils,
|
|
10022
|
+
/** pops创建的实例使用的工具类 */
|
|
10023
|
+
InstanceUtils: PopsInstanceUtils,
|
|
10024
|
+
/** pops处理float类型使用的工具类 */
|
|
10025
|
+
MathFloatUtils: PopsMathFloatUtils,
|
|
10016
10026
|
};
|
|
10017
10027
|
constructor() { }
|
|
10018
10028
|
init() {
|
|
@@ -10023,7 +10033,7 @@
|
|
|
10023
10033
|
animationStyle.innerHTML = this.config.cssText.anim;
|
|
10024
10034
|
popsDOMUtils.appendHead(animationStyle);
|
|
10025
10035
|
this.config.animation = null;
|
|
10026
|
-
this.config.animation =
|
|
10036
|
+
this.config.animation = PopsInstanceUtils.getKeyFrames(animationStyle.sheet);
|
|
10027
10037
|
setTimeout(() => {
|
|
10028
10038
|
animationStyle.remove();
|
|
10029
10039
|
}, 50);
|