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