@whitesev/pops 1.8.7 → 1.8.9
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 +81 -49
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +81 -49
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +81 -49
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +81 -49
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +81 -49
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +81 -49
- package/dist/index.umd.js.map +1 -1
- package/dist/types/src/Pops.d.ts +2 -2
- package/dist/types/src/components/tooltip/index.d.ts +24 -15
- package/dist/types/src/components/tooltip/indexType.d.ts +6 -0
- package/dist/types/src/utils/PopsDOMUtils.d.ts +3 -3
- package/package.json +1 -1
- package/src/Pops.ts +1 -1
- package/src/components/panel/PanelHandleContentDetails.ts +1 -1
- package/src/components/tooltip/config.ts +1 -1
- package/src/components/tooltip/index.css +6 -1
- package/src/components/tooltip/index.ts +86 -47
- package/src/components/tooltip/indexType.ts +6 -0
- package/src/utils/PopsDOMUtils.ts +9 -5
package/dist/index.umd.js
CHANGED
|
@@ -967,13 +967,17 @@
|
|
|
967
967
|
}
|
|
968
968
|
/**
|
|
969
969
|
* 实现jQuery中的$().offset();
|
|
970
|
-
* @param
|
|
971
|
-
* @
|
|
970
|
+
* @param element
|
|
971
|
+
* @param calcScroll 计算滚动距离
|
|
972
972
|
*/
|
|
973
|
-
offset(element) {
|
|
973
|
+
offset(element, calcScroll = true) {
|
|
974
974
|
let rect = element.getBoundingClientRect();
|
|
975
975
|
let win = element.ownerDocument.defaultView;
|
|
976
|
-
let resultRect = new DOMRect(
|
|
976
|
+
let resultRect = new DOMRect(calcScroll
|
|
977
|
+
? parseFloat((rect.left + (win?.pageXOffset || 0)).toString())
|
|
978
|
+
: rect.left, calcScroll
|
|
979
|
+
? parseFloat((rect.top + (win?.pageYOffset || 0)).toString())
|
|
980
|
+
: rect.top, rect.width, rect.height);
|
|
977
981
|
return resultRect;
|
|
978
982
|
}
|
|
979
983
|
width(element, isShow = false, parent) {
|
|
@@ -2284,7 +2288,7 @@
|
|
|
2284
2288
|
|
|
2285
2289
|
var iframeCSS = ".pops[type-value=\"iframe\"] {\r\n\t--container-title-height: 55px;\r\n\ttransition: width 0.35s ease, height 0.35s ease;\r\n}\r\n.pops[type-value] .pops-iframe-title {\r\n\tdisplay: flex;\r\n\talign-items: center;\r\n\tjustify-content: space-between;\r\n}\r\n.pops[type-value=\"iframe\"] .pops-iframe-title {\r\n\twidth: calc(100% - 0px);\r\n\theight: var(--container-title-height);\r\n\tborder-bottom: 1px solid rgb(229, 229, 229, var(--pops-bd-opacity));\r\n}\r\n.pops[type-value=\"iframe\"] .pops-iframe-title p[pops] {\r\n\twidth: 100%;\r\n\toverflow: hidden;\r\n\tcolor: rgb(51, 51, 51);\r\n\ttext-indent: 15px;\r\n\ttext-overflow: ellipsis;\r\n\twhite-space: nowrap;\r\n\tfont-weight: 500;\r\n\tline-height: normal;\r\n\talign-content: center;\r\n}\r\n.pops[type-value=\"iframe\"] .pops-iframe-content {\r\n\twidth: 100%;\r\n\t/*height: calc(100% - var(--container-title-height));*/\r\n\tflex: 1;\r\n\toverflow: hidden;\r\n\tword-break: break-word;\r\n}\r\n.pops[type-value=\"iframe\"] .pops-iframe-content p[pops] {\r\n\tpadding: 5px 10px;\r\n\tcolor: #333;\r\n\ttext-indent: 15px;\r\n}\r\n.pops-loading {\r\n\tposition: absolute;\r\n\ttop: 40px;\r\n\tright: 0;\r\n\tbottom: 0;\r\n\tleft: 0;\r\n\tz-index: 5;\r\n\tbackground-color: rgb(255, 255, 255, var(--pops-bg-opacity));\r\n}\r\n.pops-loading:before {\r\n\tposition: absolute;\r\n\ttop: 50%;\r\n\tleft: 50%;\r\n\tz-index: 3;\r\n\tdisplay: block;\r\n\tmargin: -20px 0 0 -20px;\r\n\tpadding: 20px;\r\n\tborder: 4px solid rgb(221, 221, 221, var(--pops-bd-opacity));\r\n\tborder-radius: 50%;\r\n\tcontent: \"\";\r\n\tborder-top-color: transparent;\r\n\tanimation: pops-anim-wait-rotate 1.2s linear infinite;\r\n}\r\n.pops[type-value=\"iframe\"].pops[type-module=\"min\"] {\r\n\tbottom: 0;\r\n\tmax-width: 200px;\r\n\tmax-height: 53px;\r\n\tposition: unset;\r\n}\r\n.pops[type-value=\"iframe\"].pops[type-module=\"min\"]\r\n\t.pops-header-control[type=\"min\"] {\r\n\tdisplay: none;\r\n}\r\n.pops[type-value=\"iframe\"].pops-iframe-unset-top {\r\n\ttop: unset !important;\r\n}\r\n.pops[type-value=\"iframe\"].pops-iframe-unset-left {\r\n\tleft: unset !important;\r\n}\r\n.pops[type-value=\"iframe\"].pops-iframe-unset-transform {\r\n\ttransform: none !important;\r\n}\r\n.pops[type-value=\"iframe\"].pops-iframe-unset-transition {\r\n\ttransition: none !important;\r\n}\r\n.pops[type-value=\"iframe\"].pops[type-module=\"max\"] {\r\n\twidth: 100% !important;\r\n\theight: 100% !important;\r\n}\r\n.pops[type-value=\"iframe\"] iframe[pops] {\r\n\twidth: calc(100% - 4px);\r\n\theight: calc(100% - 4px);\r\n\tborder: 0;\r\n}\r\n.pops-iframe-content-global-loading {\r\n\tposition: absolute;\r\n\ttop: 0;\r\n\tleft: 0;\r\n\tz-index: 999999;\r\n\twidth: 0;\r\n\theight: 4px;\r\n\tbackground: linear-gradient(to right, #4995dd, #fff, rgb(202 224 246));\r\n\tanimation: iframeLoadingChange 2s forwards;\r\n}\r\n\r\n.pops-anim:has(.pops[type-value=\"iframe\"].pops[type-module=\"min\"]) {\r\n\tposition: unset;\r\n}\r\n";
|
|
2286
2290
|
|
|
2287
|
-
var tooltipCSS = ".pops-tip {\r\n\t--tooltip-color: #4e4e4e;\r\n\t--tooltip-bg-color: rgb(255, 255, 255, var(--pops-bg-opacity));\r\n\t--tooltip-bd-radius: 2px;\r\n\t--tooltip-font-size: 14px;\r\n\t--tooltip-padding-top: 13px;\r\n\t--tooltip-padding-right: 13px;\r\n\t--tooltip-padding-bottom: 13px;\r\n\t--tooltip-padding-left: 13px;\r\n\r\n\t--tooltip-arrow--after-color: rgb(78, 78, 78);\r\n\t--tooltip-arrow--after-bg-color: rgb(255, 255, 255, var(--pops-bg-opacity));\r\n\t--tooltip-arrow--after-width: 12px;\r\n\t--tooltip-arrow--after-height: 12px;\r\n\r\n\
|
|
2291
|
+
var tooltipCSS = ".pops-tip {\r\n\t--tooltip-color: #4e4e4e;\r\n\t--tooltip-bg-color: rgb(255, 255, 255, var(--pops-bg-opacity));\r\n\t--tooltip-bd-radius: 2px;\r\n\t--tooltip-font-size: 14px;\r\n\t--tooltip-padding-top: 13px;\r\n\t--tooltip-padding-right: 13px;\r\n\t--tooltip-padding-bottom: 13px;\r\n\t--tooltip-padding-left: 13px;\r\n\r\n\t--tooltip-arrow--after-color: rgb(78, 78, 78);\r\n\t--tooltip-arrow--after-bg-color: rgb(255, 255, 255, var(--pops-bg-opacity));\r\n\t--tooltip-arrow--after-width: 12px;\r\n\t--tooltip-arrow--after-height: 12px;\r\n\r\n\tpadding: var(--tooltip-padding-top) var(--tooltip-padding-right)\r\n\t\tvar(--tooltip-padding-bottom) var(--tooltip-padding-left);\r\n\tmax-width: 400px;\r\n\tmax-height: 300px;\r\n\tborder-radius: var(--tooltip-bd-radius);\r\n\tbackground-color: var(--tooltip-bg-color);\r\n\tbox-shadow: 0 1.5px 4px rgba(0, 0, 0, 0.24), 0 1.5px 6px rgba(0, 0, 0, 0.12);\r\n\tcolor: var(--tooltip-color);\r\n\tfont-size: var(--tooltip-font-size);\r\n}\r\n.pops-tip[data-position=\"absolute\"] {\r\n\tposition: absolute;\r\n}\r\n.pops-tip[data-position=\"fixed\"] {\r\n\tposition: fixed;\r\n}\r\n/* github的样式 */\r\n.pops-tip.github-tooltip {\r\n\t--tooltip-bg-opacity: 1;\r\n\t--tooltip-color: rgb(255, 255, 255);\r\n\t--tooltip-bg-color: rgb(36, 41, 47, var(--tooltip-bg-opacity));\r\n\t--tooltip-bd-radius: 6px;\r\n\t--tooltip-padding-top: 6px;\r\n\t--tooltip-padding-right: 8px;\r\n\t--tooltip-padding-bottom: 6px;\r\n\t--tooltip-padding-left: 8px;\r\n\r\n\t--tooltip-arrow--after-color: rgb(255, 255, 255);\r\n\t--tooltip-arrow--after-bg-color: rgb(36, 41, 47, var(--tooltip-bg-opacity));\r\n\t--tooltip-arrow--after-width: 8px;\r\n\t--tooltip-arrow--after-height: 8px;\r\n}\r\n.pops-tip .pops-tip-arrow {\r\n\tposition: absolute;\r\n\ttop: 100%;\r\n\tleft: 50%;\r\n\toverflow: hidden;\r\n\twidth: 100%;\r\n\theight: 12.5px;\r\n\ttransform: translateX(-50%);\r\n}\r\n\r\n.pops-tip .pops-tip-arrow::after {\r\n\tposition: absolute;\r\n\ttop: 0;\r\n\tleft: 50%;\r\n\twidth: var(--tooltip-arrow--after-width);\r\n\theight: var(--tooltip-arrow--after-height);\r\n\tbackground: var(--tooltip-arrow--after-bg-color);\r\n\tcolor: var(--tooltip-arrow--after-color);\r\n\tbox-shadow: 0 1px 7px rgba(0, 0, 0, 0.24), 0 1px 7px rgba(0, 0, 0, 0.12);\r\n\tcontent: \"\";\r\n\ttransform: translateX(-50%) translateY(-50%) rotate(45deg);\r\n}\r\n\r\n.pops-tip .pops-tip-arrow[data-position=\"bottom\"] {\r\n\tposition: absolute;\r\n\ttop: 100%;\r\n\tleft: 50%;\r\n\toverflow: hidden;\r\n\twidth: 100%;\r\n\theight: 12.5px;\r\n\ttransform: translateX(-50%);\r\n}\r\n\r\n.pops-tip .pops-tip-arrow[data-position=\"bottom\"]:after {\r\n\tposition: absolute;\r\n\ttop: 0;\r\n\tleft: 50%;\r\n\twidth: var(--tooltip-arrow--after-width);\r\n\theight: var(--tooltip-arrow--after-height);\r\n\tbackground: var(--tooltip-arrow--after-bg-color);\r\n\tbox-shadow: 0 1px 7px rgba(0, 0, 0, 0.24), 0 1px 7px rgba(0, 0, 0, 0.12);\r\n\tcontent: \"\";\r\n\ttransform: translateX(-50%) translateY(-50%) rotate(45deg);\r\n}\r\n\r\n.pops-tip .pops-tip-arrow[data-position=\"left\"] {\r\n\ttop: 50%;\r\n\tleft: -12.5px;\r\n\twidth: 12.5px;\r\n\theight: 50px;\r\n\ttransform: translateY(-50%);\r\n}\r\n\r\n.pops-tip .pops-tip-arrow[data-position=\"left\"]:after {\r\n\tposition: absolute;\r\n\ttop: 50%;\r\n\tleft: 100%;\r\n\tcontent: \"\";\r\n}\r\n\r\n.pops-tip .pops-tip-arrow[data-position=\"right\"] {\r\n\ttop: 50%;\r\n\tright: -12.5px;\r\n\tleft: auto;\r\n\twidth: 12.5px;\r\n\theight: 50px;\r\n\ttransform: translateY(-50%);\r\n}\r\n\r\n.pops-tip .pops-tip-arrow[data-position=\"right\"]:after {\r\n\tposition: absolute;\r\n\ttop: 50%;\r\n\tleft: 0;\r\n\tcontent: \"\";\r\n}\r\n\r\n.pops-tip .pops-tip-arrow[data-position=\"top\"] {\r\n\ttop: -12.5px;\r\n\tleft: 50%;\r\n\ttransform: translateX(-50%);\r\n}\r\n\r\n.pops-tip .pops-tip-arrow[data-position=\"top\"]:after {\r\n\tposition: absolute;\r\n\ttop: 100%;\r\n\tleft: 50%;\r\n\tcontent: \"\";\r\n}\r\n\r\n.pops-tip[data-motion] {\r\n\t-webkit-animation-duration: 0.25s;\r\n\tanimation-duration: 0.25s;\r\n\t-webkit-animation-fill-mode: forwards;\r\n\tanimation-fill-mode: forwards;\r\n}\r\n.pops-tip[data-motion=\"fadeOutRight\"] {\r\n\t-webkit-animation-name: pops-motion-fadeOutRight;\r\n\tanimation-name: pops-motion-fadeOutRight;\r\n}\r\n.pops-tip[data-motion=\"fadeInTop\"] {\r\n\t-webkit-animation-name: pops-motion-fadeInTop;\r\n\tanimation-name: pops-motion-fadeInTop;\r\n\tanimation-timing-function: cubic-bezier(0.49, 0.49, 0.13, 1.3);\r\n}\r\n.pops-tip[data-motion=\"fadeOutTop\"] {\r\n\t-webkit-animation-name: pops-motion-fadeOutTop;\r\n\tanimation-name: pops-motion-fadeOutTop;\r\n\tanimation-timing-function: cubic-bezier(0.32, 0.37, 0.06, 0.87);\r\n}\r\n.pops-tip[data-motion=\"fadeInBottom\"] {\r\n\t-webkit-animation-name: pops-motion-fadeInBottom;\r\n\tanimation-name: pops-motion-fadeInBottom;\r\n}\r\n.pops-tip[data-motion=\"fadeOutBottom\"] {\r\n\t-webkit-animation-name: pops-motion-fadeOutBottom;\r\n\tanimation-name: pops-motion-fadeOutBottom;\r\n}\r\n.pops-tip[data-motion=\"fadeInLeft\"] {\r\n\t-webkit-animation-name: pops-motion-fadeInLeft;\r\n\tanimation-name: pops-motion-fadeInLeft;\r\n}\r\n.pops-tip[data-motion=\"fadeOutLeft\"] {\r\n\t-webkit-animation-name: pops-motion-fadeOutLeft;\r\n\tanimation-name: pops-motion-fadeOutLeft;\r\n}\r\n.pops-tip[data-motion=\"fadeInRight\"] {\r\n\t-webkit-animation-name: pops-motion-fadeInRight;\r\n\tanimation-name: pops-motion-fadeInRight;\r\n}\r\n";
|
|
2288
2292
|
|
|
2289
2293
|
var drawerCSS = ".pops[type-value=\"drawer\"] {\r\n\tposition: fixed;\r\n\tbox-sizing: border-box;\r\n\tdisplay: flex;\r\n\tflex-direction: column;\r\n\tbox-shadow: 0px 16px 48px 16px rgba(0, 0, 0, 0.08),\r\n\t\t0px 12px 32px rgba(0, 0, 0, 0.12), 0px 8px 16px -8px rgba(0, 0, 0, 0.16);\r\n\toverflow: hidden;\r\n\ttransition: all 0.3s;\r\n}\r\n.pops[type-value] .pops-drawer-title {\r\n\tdisplay: flex;\r\n\talign-items: center;\r\n\tjustify-content: space-between;\r\n}\r\n.pops[type-value] .pops-drawer-title p[pops] {\r\n\tline-height: normal;\r\n\talign-content: center;\r\n}\r\n\r\n.pops-drawer-content {\r\n\tflex: 1;\r\n\toverflow: auto;\r\n}\r\n.pops[type-value=\"drawer\"] .pops-drawer-btn {\r\n\tpadding-top: 10px;\r\n\tpadding-bottom: 10px;\r\n}\r\n.pops[type-value=\"drawer\"][direction=\"top\"] {\r\n\twidth: 100%;\r\n\tleft: 0;\r\n\tright: 0;\r\n\ttop: 0;\r\n}\r\n.pops[type-value=\"drawer\"][direction=\"bottom\"] {\r\n\twidth: 100%;\r\n\tleft: 0;\r\n\tright: 0;\r\n\tbottom: 0;\r\n}\r\n.pops[type-value=\"drawer\"][direction=\"left\"] {\r\n\theight: 100%;\r\n\ttop: 0;\r\n\tbottom: 0;\r\n\tleft: 0;\r\n}\r\n.pops[type-value=\"drawer\"][direction=\"right\"] {\r\n\theight: 100%;\r\n\ttop: 0;\r\n\tbottom: 0;\r\n\tright: 0;\r\n}\r\n";
|
|
2290
2294
|
|
|
@@ -6633,6 +6637,7 @@
|
|
|
6633
6637
|
zIndex: () => {
|
|
6634
6638
|
return PopsInstanceUtils.getPopsMaxZIndex().zIndex;
|
|
6635
6639
|
},
|
|
6640
|
+
isFixed: true,
|
|
6636
6641
|
className: "github-tooltip",
|
|
6637
6642
|
only: false,
|
|
6638
6643
|
eventOption: {
|
|
@@ -6652,7 +6657,6 @@
|
|
|
6652
6657
|
}
|
|
6653
6658
|
},
|
|
6654
6659
|
alwaysShow: false,
|
|
6655
|
-
// only: false,
|
|
6656
6660
|
position: "top",
|
|
6657
6661
|
arrowDistance: 10,
|
|
6658
6662
|
});
|
|
@@ -9432,6 +9436,7 @@
|
|
|
9432
9436
|
content: "默认文字",
|
|
9433
9437
|
position: "top",
|
|
9434
9438
|
className: "",
|
|
9439
|
+
isFixed: false,
|
|
9435
9440
|
alwaysShow: false,
|
|
9436
9441
|
triggerShowEventName: "mouseenter touchstart",
|
|
9437
9442
|
triggerCloseEventName: "mouseleave touchend",
|
|
@@ -9464,8 +9469,8 @@
|
|
|
9464
9469
|
$data = {
|
|
9465
9470
|
config: null,
|
|
9466
9471
|
guid: null,
|
|
9467
|
-
|
|
9468
|
-
|
|
9472
|
+
timeId_close_TouchEvent: [],
|
|
9473
|
+
timeId_close_MouseEvent: [],
|
|
9469
9474
|
};
|
|
9470
9475
|
constructor(config, guid, ShadowInfo) {
|
|
9471
9476
|
this.$data.config = config;
|
|
@@ -9497,6 +9502,9 @@
|
|
|
9497
9502
|
<div class="pops-tip-content" style="text-align: center;"></div>
|
|
9498
9503
|
<div class="pops-tip-arrow"></div>
|
|
9499
9504
|
`,
|
|
9505
|
+
}, {
|
|
9506
|
+
"data-position": this.$data.config.isFixed ? "fixed" : "absolute",
|
|
9507
|
+
"data-guid": this.$data.guid,
|
|
9500
9508
|
});
|
|
9501
9509
|
/** 内容 */
|
|
9502
9510
|
let $toolTipContent = $toolTipContainer.querySelector(".pops-tip-content");
|
|
@@ -9507,8 +9515,6 @@
|
|
|
9507
9515
|
this.$data.config.className.trim() !== "") {
|
|
9508
9516
|
popsDOMUtils.addClassName($toolTipContainer, this.$data.config.className);
|
|
9509
9517
|
}
|
|
9510
|
-
// 添加attr
|
|
9511
|
-
$toolTipContainer.setAttribute("data-guid", this.$data.guid);
|
|
9512
9518
|
// 添加z-index
|
|
9513
9519
|
$toolTipContainer.style.zIndex = PopsHandler.handleZIndex(this.$data.config.zIndex).toString();
|
|
9514
9520
|
if (this.$data.config.style != null) {
|
|
@@ -9564,12 +9570,17 @@
|
|
|
9564
9570
|
* @param otherDistance 其它位置的偏移
|
|
9565
9571
|
*/
|
|
9566
9572
|
getPosition(targetElement, arrowDistance, otherDistance) {
|
|
9567
|
-
let
|
|
9568
|
-
|
|
9569
|
-
let
|
|
9570
|
-
//
|
|
9571
|
-
let
|
|
9572
|
-
//
|
|
9573
|
+
let offsetInfo = popsDOMUtils.offset(targetElement, !this.$data.config.isFixed);
|
|
9574
|
+
// 目标 宽
|
|
9575
|
+
let targetElement_width = offsetInfo.width;
|
|
9576
|
+
// 目标 高
|
|
9577
|
+
let targetElement_height = offsetInfo.height;
|
|
9578
|
+
// 目标 顶部距离
|
|
9579
|
+
let targetElement_top = offsetInfo.top;
|
|
9580
|
+
// let targetElement_bottom = offsetInfo.bottom;
|
|
9581
|
+
// 目标 左边距离
|
|
9582
|
+
let targetElement_left = offsetInfo.left;
|
|
9583
|
+
// let targetElement_right = offsetInfo.right;
|
|
9573
9584
|
let toolTipElement_width = popsDOMUtils.outerWidth(this.$el.$toolTip);
|
|
9574
9585
|
let toolTipElement_height = popsDOMUtils.outerHeight(this.$el.$toolTip);
|
|
9575
9586
|
/* 目标元素的x轴的中间位置 */
|
|
@@ -9625,39 +9636,56 @@
|
|
|
9625
9636
|
*/
|
|
9626
9637
|
onEvent() {
|
|
9627
9638
|
// 监听动画结束事件
|
|
9628
|
-
this.
|
|
9639
|
+
this.onToolTipAnimationFinishEvent();
|
|
9629
9640
|
this.onShowEvent();
|
|
9630
9641
|
this.onCloseEvent();
|
|
9631
|
-
this.
|
|
9632
|
-
this.
|
|
9642
|
+
this.onToolTipMouseEnterEvent();
|
|
9643
|
+
this.onToolTipMouseLeaveEvent();
|
|
9633
9644
|
}
|
|
9634
9645
|
/**
|
|
9635
9646
|
* 取消事件绑定
|
|
9636
9647
|
*/
|
|
9637
9648
|
offEvent() {
|
|
9638
|
-
this.
|
|
9649
|
+
this.offToolTipAnimationFinishEvent();
|
|
9639
9650
|
this.offShowEvent();
|
|
9640
9651
|
this.offCloseEvent();
|
|
9641
|
-
this.
|
|
9642
|
-
this.
|
|
9652
|
+
this.offToolTipMouseEnterEvent();
|
|
9653
|
+
this.offToolTipMouseLeaveEvent();
|
|
9654
|
+
}
|
|
9655
|
+
/**
|
|
9656
|
+
* 添加关闭的timeId
|
|
9657
|
+
* @param type
|
|
9658
|
+
* @param timeId
|
|
9659
|
+
*/
|
|
9660
|
+
addCloseTimeoutId(type, timeId) {
|
|
9661
|
+
if (type === "MouseEvent") {
|
|
9662
|
+
this.$data.timeId_close_MouseEvent.push(timeId);
|
|
9663
|
+
}
|
|
9664
|
+
else {
|
|
9665
|
+
this.$data.timeId_close_TouchEvent.push(timeId);
|
|
9666
|
+
}
|
|
9643
9667
|
}
|
|
9644
9668
|
/**
|
|
9645
9669
|
* 清除延迟的timeId
|
|
9670
|
+
* @param type 事件类型
|
|
9646
9671
|
*/
|
|
9647
|
-
clearCloseTimeoutId(timeId) {
|
|
9648
|
-
|
|
9649
|
-
|
|
9672
|
+
clearCloseTimeoutId(type, timeId) {
|
|
9673
|
+
let timeIdList = type === "MouseEvent"
|
|
9674
|
+
? this.$data.timeId_close_MouseEvent
|
|
9675
|
+
: this.$data.timeId_close_TouchEvent;
|
|
9676
|
+
for (let index = 0; index < timeIdList.length; index++) {
|
|
9677
|
+
const currentTimeId = timeIdList[index];
|
|
9650
9678
|
if (typeof timeId === "number") {
|
|
9651
9679
|
// 只清除一个
|
|
9652
9680
|
if (timeId == currentTimeId) {
|
|
9653
9681
|
clearTimeout(timeId);
|
|
9654
|
-
|
|
9682
|
+
timeIdList.splice(index, 1);
|
|
9655
9683
|
break;
|
|
9656
9684
|
}
|
|
9657
9685
|
}
|
|
9658
9686
|
else {
|
|
9659
9687
|
clearTimeout(currentTimeId);
|
|
9660
|
-
|
|
9688
|
+
timeIdList.splice(index, 1);
|
|
9661
9689
|
index--;
|
|
9662
9690
|
}
|
|
9663
9691
|
}
|
|
@@ -9665,14 +9693,16 @@
|
|
|
9665
9693
|
/**
|
|
9666
9694
|
* 显示提示框
|
|
9667
9695
|
*/
|
|
9668
|
-
show() {
|
|
9696
|
+
show(...args) {
|
|
9697
|
+
let event = args[0];
|
|
9698
|
+
let eventType = event instanceof MouseEvent ? "MouseEvent" : "TouchEvent";
|
|
9699
|
+
this.clearCloseTimeoutId(eventType);
|
|
9669
9700
|
if (typeof this.$data.config.showBeforeCallBack === "function") {
|
|
9670
9701
|
let result = this.$data.config.showBeforeCallBack(this.$el.$toolTip);
|
|
9671
9702
|
if (typeof result === "boolean" && !result) {
|
|
9672
9703
|
return;
|
|
9673
9704
|
}
|
|
9674
9705
|
}
|
|
9675
|
-
this.clearCloseTimeoutId();
|
|
9676
9706
|
if (!popsUtils.contains(this.$el.$shadowRoot, this.$el.$toolTip)) {
|
|
9677
9707
|
// 不在容器中,添加
|
|
9678
9708
|
this.init();
|
|
@@ -9712,6 +9742,7 @@
|
|
|
9712
9742
|
*/
|
|
9713
9743
|
close(...args) {
|
|
9714
9744
|
let event = args[0];
|
|
9745
|
+
let eventType = event instanceof MouseEvent ? "MouseEvent" : "TouchEvent";
|
|
9715
9746
|
// 只判断鼠标事件
|
|
9716
9747
|
// 其它的如Touch事件不做处理
|
|
9717
9748
|
if (event && event instanceof MouseEvent) {
|
|
@@ -9734,12 +9765,12 @@
|
|
|
9734
9765
|
}
|
|
9735
9766
|
let timeId = setTimeout(() => {
|
|
9736
9767
|
// 设置属性触发关闭动画
|
|
9737
|
-
this.clearCloseTimeoutId(timeId);
|
|
9768
|
+
this.clearCloseTimeoutId(eventType, timeId);
|
|
9738
9769
|
this.$el.$toolTip.setAttribute("data-motion", this.$el.$toolTip
|
|
9739
9770
|
.getAttribute("data-motion")
|
|
9740
9771
|
.replace("fadeIn", "fadeOut"));
|
|
9741
9772
|
}, this.$data.config.delayCloseTime);
|
|
9742
|
-
this
|
|
9773
|
+
this.addCloseTimeoutId(eventType, timeId);
|
|
9743
9774
|
if (typeof this.$data.config.closeAfterCallBack === "function") {
|
|
9744
9775
|
this.$data.config.closeAfterCallBack(this.$el.$toolTip);
|
|
9745
9776
|
}
|
|
@@ -9775,7 +9806,7 @@
|
|
|
9775
9806
|
/**
|
|
9776
9807
|
* 动画结束事件
|
|
9777
9808
|
*/
|
|
9778
|
-
|
|
9809
|
+
toolTipAnimationFinishEvent() {
|
|
9779
9810
|
if (!this.$el.$toolTip) {
|
|
9780
9811
|
return;
|
|
9781
9812
|
}
|
|
@@ -9785,21 +9816,21 @@
|
|
|
9785
9816
|
this.destory();
|
|
9786
9817
|
}
|
|
9787
9818
|
/**
|
|
9788
|
-
*
|
|
9819
|
+
* 监听tooltip的动画结束
|
|
9789
9820
|
*/
|
|
9790
|
-
|
|
9791
|
-
popsDOMUtils.on(this.$el.$toolTip, popsDOMUtils.getAnimationEndNameList(), this.
|
|
9821
|
+
onToolTipAnimationFinishEvent() {
|
|
9822
|
+
popsDOMUtils.on(this.$el.$toolTip, popsDOMUtils.getAnimationEndNameList(), this.toolTipAnimationFinishEvent.bind(this));
|
|
9792
9823
|
}
|
|
9793
9824
|
/**
|
|
9794
|
-
*
|
|
9825
|
+
* 取消tooltip监听动画结束
|
|
9795
9826
|
*/
|
|
9796
|
-
|
|
9797
|
-
popsDOMUtils.off(this.$el.$toolTip, popsDOMUtils.getAnimationEndNameList(), this.
|
|
9827
|
+
offToolTipAnimationFinishEvent() {
|
|
9828
|
+
popsDOMUtils.off(this.$el.$toolTip, popsDOMUtils.getAnimationEndNameList(), this.toolTipAnimationFinishEvent.bind(this));
|
|
9798
9829
|
}
|
|
9799
9830
|
/**
|
|
9800
9831
|
* 鼠标|触摸进入事件
|
|
9801
9832
|
*/
|
|
9802
|
-
|
|
9833
|
+
toolTipMouseEnterEvent() {
|
|
9803
9834
|
this.$el.$toolTip.style.animationPlayState = "paused";
|
|
9804
9835
|
// if (parseInt(getComputedStyle(toolTipElement)) > 0.5) {
|
|
9805
9836
|
// toolTipElement.style.animationPlayState = "paused";
|
|
@@ -9808,33 +9839,34 @@
|
|
|
9808
9839
|
/**
|
|
9809
9840
|
* 监听鼠标|触摸事件
|
|
9810
9841
|
*/
|
|
9811
|
-
|
|
9812
|
-
this.clearCloseTimeoutId();
|
|
9813
|
-
|
|
9842
|
+
onToolTipMouseEnterEvent() {
|
|
9843
|
+
this.clearCloseTimeoutId("MouseEvent");
|
|
9844
|
+
this.clearCloseTimeoutId("TouchEvent");
|
|
9845
|
+
popsDOMUtils.on(this.$el.$toolTip, "mouseenter touchstart", this.toolTipMouseEnterEvent.bind(this), this.$data.config.eventOption);
|
|
9814
9846
|
}
|
|
9815
9847
|
/**
|
|
9816
9848
|
* 取消监听鼠标|触摸事件
|
|
9817
9849
|
*/
|
|
9818
|
-
|
|
9819
|
-
popsDOMUtils.off(this.$el.$toolTip, "mouseenter touchstart", this.
|
|
9850
|
+
offToolTipMouseEnterEvent() {
|
|
9851
|
+
popsDOMUtils.off(this.$el.$toolTip, "mouseenter touchstart", this.toolTipMouseEnterEvent.bind(this), this.$data.config.eventOption);
|
|
9820
9852
|
}
|
|
9821
9853
|
/**
|
|
9822
9854
|
* 鼠标|触摸离开事件
|
|
9823
9855
|
*/
|
|
9824
|
-
|
|
9856
|
+
toolTipMouseLeaveEvent() {
|
|
9825
9857
|
this.$el.$toolTip.style.animationPlayState = "running";
|
|
9826
9858
|
}
|
|
9827
9859
|
/**
|
|
9828
9860
|
* 监听鼠标|触摸离开事件
|
|
9829
9861
|
*/
|
|
9830
|
-
|
|
9831
|
-
popsDOMUtils.on(this.$el.$toolTip, "mouseleave touchend", this.
|
|
9862
|
+
onToolTipMouseLeaveEvent() {
|
|
9863
|
+
popsDOMUtils.on(this.$el.$toolTip, "mouseleave touchend", this.toolTipMouseLeaveEvent.bind(this), this.$data.config.eventOption);
|
|
9832
9864
|
}
|
|
9833
9865
|
/**
|
|
9834
9866
|
* 取消监听鼠标|触摸离开事件
|
|
9835
9867
|
*/
|
|
9836
|
-
|
|
9837
|
-
popsDOMUtils.off(this.$el.$toolTip, "mouseleave touchend", this.
|
|
9868
|
+
offToolTipMouseLeaveEvent() {
|
|
9869
|
+
popsDOMUtils.off(this.$el.$toolTip, "mouseleave touchend", this.toolTipMouseLeaveEvent.bind(this), this.$data.config.eventOption);
|
|
9838
9870
|
}
|
|
9839
9871
|
}
|
|
9840
9872
|
class PopsTooltip {
|