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