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