@whitesev/pops 1.8.7 → 1.8.8
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 -12
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +33 -12
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +33 -12
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +33 -12
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +33 -12
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +33 -12
- package/dist/index.umd.js.map +1 -1
- package/dist/types/src/components/tooltip/index.d.ts +13 -4
- package/package.json +1 -1
- package/src/components/tooltip/index.ts +38 -12
package/dist/index.iife.js
CHANGED
|
@@ -9461,8 +9461,8 @@ var pops = (function () {
|
|
|
9461
9461
|
$data = {
|
|
9462
9462
|
config: null,
|
|
9463
9463
|
guid: null,
|
|
9464
|
-
|
|
9465
|
-
|
|
9464
|
+
timeId_close_TouchEvent: [],
|
|
9465
|
+
timeId_close_MouseEvent: [],
|
|
9466
9466
|
};
|
|
9467
9467
|
constructor(config, guid, ShadowInfo) {
|
|
9468
9468
|
this.$data.config = config;
|
|
@@ -9638,23 +9638,40 @@ var pops = (function () {
|
|
|
9638
9638
|
this.offMouseEnterEvent();
|
|
9639
9639
|
this.offMouseLeaveEvent();
|
|
9640
9640
|
}
|
|
9641
|
+
/**
|
|
9642
|
+
* 添加关闭的timeId
|
|
9643
|
+
* @param type
|
|
9644
|
+
* @param timeId
|
|
9645
|
+
*/
|
|
9646
|
+
addCloseTimeoutId(type, timeId) {
|
|
9647
|
+
if (type === "MouseEvent") {
|
|
9648
|
+
this.$data.timeId_close_MouseEvent.push(timeId);
|
|
9649
|
+
}
|
|
9650
|
+
else {
|
|
9651
|
+
this.$data.timeId_close_TouchEvent.push(timeId);
|
|
9652
|
+
}
|
|
9653
|
+
}
|
|
9641
9654
|
/**
|
|
9642
9655
|
* 清除延迟的timeId
|
|
9656
|
+
* @param type 事件类型
|
|
9643
9657
|
*/
|
|
9644
|
-
clearCloseTimeoutId(timeId) {
|
|
9645
|
-
|
|
9646
|
-
|
|
9658
|
+
clearCloseTimeoutId(type, timeId) {
|
|
9659
|
+
let timeIdList = type === "MouseEvent"
|
|
9660
|
+
? this.$data.timeId_close_MouseEvent
|
|
9661
|
+
: this.$data.timeId_close_TouchEvent;
|
|
9662
|
+
for (let index = 0; index < timeIdList.length; index++) {
|
|
9663
|
+
const currentTimeId = timeIdList[index];
|
|
9647
9664
|
if (typeof timeId === "number") {
|
|
9648
9665
|
// 只清除一个
|
|
9649
9666
|
if (timeId == currentTimeId) {
|
|
9650
9667
|
clearTimeout(timeId);
|
|
9651
|
-
|
|
9668
|
+
timeIdList.splice(index, 1);
|
|
9652
9669
|
break;
|
|
9653
9670
|
}
|
|
9654
9671
|
}
|
|
9655
9672
|
else {
|
|
9656
9673
|
clearTimeout(currentTimeId);
|
|
9657
|
-
|
|
9674
|
+
timeIdList.splice(index, 1);
|
|
9658
9675
|
index--;
|
|
9659
9676
|
}
|
|
9660
9677
|
}
|
|
@@ -9662,14 +9679,16 @@ var pops = (function () {
|
|
|
9662
9679
|
/**
|
|
9663
9680
|
* 显示提示框
|
|
9664
9681
|
*/
|
|
9665
|
-
show() {
|
|
9682
|
+
show(...args) {
|
|
9683
|
+
let event = args[0];
|
|
9684
|
+
let eventType = event instanceof MouseEvent ? "MouseEvent" : "TouchEvent";
|
|
9685
|
+
this.clearCloseTimeoutId(eventType);
|
|
9666
9686
|
if (typeof this.$data.config.showBeforeCallBack === "function") {
|
|
9667
9687
|
let result = this.$data.config.showBeforeCallBack(this.$el.$toolTip);
|
|
9668
9688
|
if (typeof result === "boolean" && !result) {
|
|
9669
9689
|
return;
|
|
9670
9690
|
}
|
|
9671
9691
|
}
|
|
9672
|
-
this.clearCloseTimeoutId();
|
|
9673
9692
|
if (!popsUtils.contains(this.$el.$shadowRoot, this.$el.$toolTip)) {
|
|
9674
9693
|
// 不在容器中,添加
|
|
9675
9694
|
this.init();
|
|
@@ -9709,6 +9728,7 @@ var pops = (function () {
|
|
|
9709
9728
|
*/
|
|
9710
9729
|
close(...args) {
|
|
9711
9730
|
let event = args[0];
|
|
9731
|
+
let eventType = event instanceof MouseEvent ? "MouseEvent" : "TouchEvent";
|
|
9712
9732
|
// 只判断鼠标事件
|
|
9713
9733
|
// 其它的如Touch事件不做处理
|
|
9714
9734
|
if (event && event instanceof MouseEvent) {
|
|
@@ -9731,12 +9751,12 @@ var pops = (function () {
|
|
|
9731
9751
|
}
|
|
9732
9752
|
let timeId = setTimeout(() => {
|
|
9733
9753
|
// 设置属性触发关闭动画
|
|
9734
|
-
this.clearCloseTimeoutId(timeId);
|
|
9754
|
+
this.clearCloseTimeoutId(eventType, timeId);
|
|
9735
9755
|
this.$el.$toolTip.setAttribute("data-motion", this.$el.$toolTip
|
|
9736
9756
|
.getAttribute("data-motion")
|
|
9737
9757
|
.replace("fadeIn", "fadeOut"));
|
|
9738
9758
|
}, this.$data.config.delayCloseTime);
|
|
9739
|
-
this
|
|
9759
|
+
this.addCloseTimeoutId(eventType, timeId);
|
|
9740
9760
|
if (typeof this.$data.config.closeAfterCallBack === "function") {
|
|
9741
9761
|
this.$data.config.closeAfterCallBack(this.$el.$toolTip);
|
|
9742
9762
|
}
|
|
@@ -9806,7 +9826,8 @@ var pops = (function () {
|
|
|
9806
9826
|
* 监听鼠标|触摸事件
|
|
9807
9827
|
*/
|
|
9808
9828
|
onMouseEnterEvent() {
|
|
9809
|
-
this.clearCloseTimeoutId();
|
|
9829
|
+
this.clearCloseTimeoutId("MouseEvent");
|
|
9830
|
+
this.clearCloseTimeoutId("TouchEvent");
|
|
9810
9831
|
popsDOMUtils.on(this.$el.$toolTip, "mouseenter touchstart", this.mouseEnterEvent.bind(this), this.$data.config.eventOption);
|
|
9811
9832
|
}
|
|
9812
9833
|
/**
|