@whitesev/pops 1.8.6 → 1.8.7
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 +62 -24
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +62 -24
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +62 -24
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +62 -24
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +62 -24
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +62 -24
- package/dist/index.umd.js.map +1 -1
- package/dist/types/src/components/tooltip/index.d.ts +22 -2
- package/package.json +1 -1
- package/src/components/tooltip/index.ts +71 -24
package/dist/index.iife.js
CHANGED
|
@@ -9480,6 +9480,7 @@ var pops = (function () {
|
|
|
9480
9480
|
this.changeZIndex();
|
|
9481
9481
|
this.changePosition();
|
|
9482
9482
|
if (!this.$data.config.alwaysShow) {
|
|
9483
|
+
this.offEvent();
|
|
9483
9484
|
this.onEvent();
|
|
9484
9485
|
}
|
|
9485
9486
|
}
|
|
@@ -9634,6 +9635,29 @@ var pops = (function () {
|
|
|
9634
9635
|
this.offAnimationFinishEvent();
|
|
9635
9636
|
this.offShowEvent();
|
|
9636
9637
|
this.offCloseEvent();
|
|
9638
|
+
this.offMouseEnterEvent();
|
|
9639
|
+
this.offMouseLeaveEvent();
|
|
9640
|
+
}
|
|
9641
|
+
/**
|
|
9642
|
+
* 清除延迟的timeId
|
|
9643
|
+
*/
|
|
9644
|
+
clearCloseTimeoutId(timeId) {
|
|
9645
|
+
for (let index = 0; index < this.$data.timeId_close.length; index++) {
|
|
9646
|
+
const currentTimeId = this.$data.timeId_close[index];
|
|
9647
|
+
if (typeof timeId === "number") {
|
|
9648
|
+
// 只清除一个
|
|
9649
|
+
if (timeId == currentTimeId) {
|
|
9650
|
+
clearTimeout(timeId);
|
|
9651
|
+
this.$data.timeId_close.splice(index, 1);
|
|
9652
|
+
break;
|
|
9653
|
+
}
|
|
9654
|
+
}
|
|
9655
|
+
else {
|
|
9656
|
+
clearTimeout(currentTimeId);
|
|
9657
|
+
this.$data.timeId_close.splice(index, 1);
|
|
9658
|
+
index--;
|
|
9659
|
+
}
|
|
9660
|
+
}
|
|
9637
9661
|
}
|
|
9638
9662
|
/**
|
|
9639
9663
|
* 显示提示框
|
|
@@ -9645,12 +9669,7 @@ var pops = (function () {
|
|
|
9645
9669
|
return;
|
|
9646
9670
|
}
|
|
9647
9671
|
}
|
|
9648
|
-
|
|
9649
|
-
let timeId = this.$data.timeId_close[index];
|
|
9650
|
-
clearTimeout(timeId);
|
|
9651
|
-
this.$data.timeId_close.splice(index, 1);
|
|
9652
|
-
index--;
|
|
9653
|
-
}
|
|
9672
|
+
this.clearCloseTimeoutId();
|
|
9654
9673
|
if (!popsUtils.contains(this.$el.$shadowRoot, this.$el.$toolTip)) {
|
|
9655
9674
|
// 不在容器中,添加
|
|
9656
9675
|
this.init();
|
|
@@ -9690,7 +9709,9 @@ var pops = (function () {
|
|
|
9690
9709
|
*/
|
|
9691
9710
|
close(...args) {
|
|
9692
9711
|
let event = args[0];
|
|
9693
|
-
|
|
9712
|
+
// 只判断鼠标事件
|
|
9713
|
+
// 其它的如Touch事件不做处理
|
|
9714
|
+
if (event && event instanceof MouseEvent) {
|
|
9694
9715
|
let $target = event.composedPath()[0];
|
|
9695
9716
|
// 如果是子元素触发的话,忽视
|
|
9696
9717
|
if ($target != this.$data.config.target) {
|
|
@@ -9709,6 +9730,8 @@ var pops = (function () {
|
|
|
9709
9730
|
this.$data.config.delayCloseTime = 100;
|
|
9710
9731
|
}
|
|
9711
9732
|
let timeId = setTimeout(() => {
|
|
9733
|
+
// 设置属性触发关闭动画
|
|
9734
|
+
this.clearCloseTimeoutId(timeId);
|
|
9712
9735
|
this.$el.$toolTip.setAttribute("data-motion", this.$el.$toolTip
|
|
9713
9736
|
.getAttribute("data-motion")
|
|
9714
9737
|
.replace("fadeIn", "fadeOut"));
|
|
@@ -9771,29 +9794,44 @@ var pops = (function () {
|
|
|
9771
9794
|
popsDOMUtils.off(this.$el.$toolTip, popsDOMUtils.getAnimationEndNameList(), this.animationFinishEvent.bind(this));
|
|
9772
9795
|
}
|
|
9773
9796
|
/**
|
|
9774
|
-
*
|
|
9797
|
+
* 鼠标|触摸进入事件
|
|
9798
|
+
*/
|
|
9799
|
+
mouseEnterEvent() {
|
|
9800
|
+
this.$el.$toolTip.style.animationPlayState = "paused";
|
|
9801
|
+
// if (parseInt(getComputedStyle(toolTipElement)) > 0.5) {
|
|
9802
|
+
// toolTipElement.style.animationPlayState = "paused";
|
|
9803
|
+
// }
|
|
9804
|
+
}
|
|
9805
|
+
/**
|
|
9806
|
+
* 监听鼠标|触摸事件
|
|
9775
9807
|
*/
|
|
9776
9808
|
onMouseEnterEvent() {
|
|
9777
|
-
|
|
9778
|
-
|
|
9779
|
-
|
|
9780
|
-
|
|
9781
|
-
|
|
9782
|
-
|
|
9783
|
-
|
|
9784
|
-
|
|
9785
|
-
// if (parseInt(getComputedStyle(toolTipElement)) > 0.5) {
|
|
9786
|
-
// toolTipElement.style.animationPlayState = "paused";
|
|
9787
|
-
// }
|
|
9788
|
-
}, this.$data.config.eventOption);
|
|
9809
|
+
this.clearCloseTimeoutId();
|
|
9810
|
+
popsDOMUtils.on(this.$el.$toolTip, "mouseenter touchstart", this.mouseEnterEvent.bind(this), this.$data.config.eventOption);
|
|
9811
|
+
}
|
|
9812
|
+
/**
|
|
9813
|
+
* 取消监听鼠标|触摸事件
|
|
9814
|
+
*/
|
|
9815
|
+
offMouseEnterEvent() {
|
|
9816
|
+
popsDOMUtils.off(this.$el.$toolTip, "mouseenter touchstart", this.mouseEnterEvent.bind(this), this.$data.config.eventOption);
|
|
9789
9817
|
}
|
|
9790
9818
|
/**
|
|
9791
|
-
*
|
|
9819
|
+
* 鼠标|触摸离开事件
|
|
9820
|
+
*/
|
|
9821
|
+
mouseLeaveEvent() {
|
|
9822
|
+
this.$el.$toolTip.style.animationPlayState = "running";
|
|
9823
|
+
}
|
|
9824
|
+
/**
|
|
9825
|
+
* 监听鼠标|触摸离开事件
|
|
9792
9826
|
*/
|
|
9793
9827
|
onMouseLeaveEvent() {
|
|
9794
|
-
popsDOMUtils.on(this.$el.$toolTip, "mouseleave touchend", ()
|
|
9795
|
-
|
|
9796
|
-
|
|
9828
|
+
popsDOMUtils.on(this.$el.$toolTip, "mouseleave touchend", this.mouseLeaveEvent.bind(this), this.$data.config.eventOption);
|
|
9829
|
+
}
|
|
9830
|
+
/**
|
|
9831
|
+
* 取消监听鼠标|触摸离开事件
|
|
9832
|
+
*/
|
|
9833
|
+
offMouseLeaveEvent() {
|
|
9834
|
+
popsDOMUtils.off(this.$el.$toolTip, "mouseleave touchend", this.mouseLeaveEvent.bind(this), this.$data.config.eventOption);
|
|
9797
9835
|
}
|
|
9798
9836
|
}
|
|
9799
9837
|
class PopsTooltip {
|