@progress/kendo-vue-tooltip 5.3.0-dev.202410141143 → 5.3.0-develop.2
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/README.md +24 -29
- package/Tooltip.js +8 -0
- package/Tooltip.mjs +271 -0
- package/dist/cdn/js/kendo-vue-tooltip.js +8 -1
- package/index.d.mts +304 -0
- package/index.d.ts +304 -0
- package/index.js +8 -0
- package/index.mjs +11 -0
- package/package-metadata.js +8 -0
- package/package-metadata.mjs +18 -0
- package/package.json +22 -39
- package/utils.js +8 -0
- package/utils.mjs +52 -0
- package/dist/es/Tooltip.d.ts +0 -52
- package/dist/es/Tooltip.js +0 -420
- package/dist/es/TooltipProps.d.ts +0 -100
- package/dist/es/TooltipProps.js +0 -2
- package/dist/es/additionalTypes.ts +0 -21
- package/dist/es/events.d.ts +0 -34
- package/dist/es/events.js +0 -1
- package/dist/es/main.d.ts +0 -5
- package/dist/es/main.js +0 -2
- package/dist/es/package-metadata.d.ts +0 -5
- package/dist/es/package-metadata.js +0 -11
- package/dist/es/utils.d.ts +0 -24
- package/dist/es/utils.js +0 -76
- package/dist/esm/Tooltip.d.ts +0 -52
- package/dist/esm/Tooltip.js +0 -420
- package/dist/esm/TooltipProps.d.ts +0 -100
- package/dist/esm/TooltipProps.js +0 -2
- package/dist/esm/additionalTypes.ts +0 -21
- package/dist/esm/events.d.ts +0 -34
- package/dist/esm/events.js +0 -1
- package/dist/esm/main.d.ts +0 -5
- package/dist/esm/main.js +0 -2
- package/dist/esm/package-metadata.d.ts +0 -5
- package/dist/esm/package-metadata.js +0 -11
- package/dist/esm/package.json +0 -3
- package/dist/esm/utils.d.ts +0 -24
- package/dist/esm/utils.js +0 -76
- package/dist/npm/Tooltip.d.ts +0 -52
- package/dist/npm/Tooltip.js +0 -427
- package/dist/npm/TooltipProps.d.ts +0 -100
- package/dist/npm/TooltipProps.js +0 -3
- package/dist/npm/additionalTypes.ts +0 -21
- package/dist/npm/events.d.ts +0 -34
- package/dist/npm/events.js +0 -2
- package/dist/npm/main.d.ts +0 -5
- package/dist/npm/main.js +0 -6
- package/dist/npm/package-metadata.d.ts +0 -5
- package/dist/npm/package-metadata.js +0 -14
- package/dist/npm/utils.d.ts +0 -24
- package/dist/npm/utils.js +0 -86
package/package.json
CHANGED
|
@@ -1,61 +1,44 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@progress/kendo-vue-tooltip",
|
|
3
|
-
"version": "5.3.0-
|
|
4
|
-
"description": "
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"
|
|
10
|
-
"types": "dist/npm/main.d.ts",
|
|
11
|
-
"module": "dist/es/main.js",
|
|
12
|
-
"jsnext:main": "dist/es/main.js",
|
|
3
|
+
"version": "5.3.0-develop.2",
|
|
4
|
+
"description": "TODO",
|
|
5
|
+
"author": "Progress",
|
|
6
|
+
"license": "SEE LICENSE IN LICENSE.md",
|
|
7
|
+
"homepage": "https://www.telerik.com/kendo-vue-ui",
|
|
8
|
+
"main": "./index.js",
|
|
9
|
+
"types": "./index.d.ts",
|
|
13
10
|
"exports": {
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
".": {
|
|
12
|
+
"import": "./index.mjs",
|
|
13
|
+
"require": "./index.js"
|
|
14
|
+
}
|
|
18
15
|
},
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
16
|
+
"sideEffects": false,
|
|
17
|
+
"peerDependencies": {
|
|
18
|
+
"@progress/kendo-licensing": "^1.3.4",
|
|
19
|
+
"@progress/kendo-vue-common": "5.3.0-develop.2",
|
|
20
|
+
"vue": "^3.0.2"
|
|
24
21
|
},
|
|
25
|
-
"
|
|
22
|
+
"dependencies": {},
|
|
26
23
|
"keywords": [
|
|
27
24
|
"Kendo UI",
|
|
28
25
|
"Vue",
|
|
29
26
|
"Progress",
|
|
30
27
|
"Tooltip",
|
|
31
|
-
"Kendo UI for Vue",
|
|
32
|
-
"vuejs",
|
|
33
28
|
"UI",
|
|
34
29
|
"components",
|
|
35
30
|
"Vue component",
|
|
36
31
|
"Telerik"
|
|
37
32
|
],
|
|
38
|
-
"peerDependencies": {
|
|
39
|
-
"@progress/kendo-licensing": "^1.3.0",
|
|
40
|
-
"vue": "^2.6.12 || ^3.0.2"
|
|
41
|
-
},
|
|
42
|
-
"dependencies": {
|
|
43
|
-
"@progress/kendo-vue-common": "5.3.0-dev.202410141143"
|
|
44
|
-
},
|
|
45
|
-
"devDependencies": {
|
|
46
|
-
"@progress/kendo-licensing": "^1.3.0",
|
|
47
|
-
"@progress/kendo-vue-buttons": "5.3.0-dev.202410141143",
|
|
48
|
-
"@progress/kendo-vue-dialogs": "5.3.0-dev.202410141143",
|
|
49
|
-
"@progress/kendo-vue-grid": "5.3.0-dev.202410141143",
|
|
50
|
-
"@progress/kendo-vue-intl": "5.3.0-dev.202410141143"
|
|
51
|
-
},
|
|
52
33
|
"@progress": {
|
|
53
34
|
"friendlyName": "Tooltip",
|
|
54
35
|
"framework": "Kendo UI for Vue"
|
|
55
36
|
},
|
|
56
|
-
"author": "Progress",
|
|
57
|
-
"license": "SEE LICENSE IN LICENSE.md",
|
|
58
37
|
"publishConfig": {
|
|
59
38
|
"access": "public"
|
|
39
|
+
},
|
|
40
|
+
"repository": {
|
|
41
|
+
"type": "git",
|
|
42
|
+
"url": "git+https://github.com/telerik/kendo-react.git"
|
|
60
43
|
}
|
|
61
|
-
}
|
|
44
|
+
}
|
package/utils.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("@progress/kendo-vue-common"),t=10,n=10,w=(i,o,s,r,u)=>{switch(u){case"bottom":return r==="pointer"?i-o/2:s.left-o/2+s.width/2;case"left":return r==="pointer"?i-o-t:s.left-o-t;case"right":return r==="pointer"?i+t:s.right+t;case"top":return r==="pointer"?i-o/2:s.left-o/2+s.width/2;default:return r==="pointer"?c.canUseDOM&&i<window.screen.availWidth/2?i-t:i-o+t:c.canUseDOM&&i<window.screen.availWidth/2?s.left:s.right-o}},d=(i,o,s,r,u)=>{switch(u){case"bottom":return r==="pointer"?i+n:o.bottom+n;case"left":return r==="pointer"?i-s/2:o.top-s/2+o.height/2;case"right":return r==="pointer"?i-s/2:o.top-s/2+o.height/2;case"top":return r==="pointer"?i-s-n:o.top-s-n;default:return r==="pointer"?c.canUseDOM&&i<window.innerHeight/2?i+t:i-s-t:c.canUseDOM&&i<window.innerHeight/2?o.bottom+n:o.top-s-n}},a=i=>i!==null?i.getBoundingClientRect():document.body.getBoundingClientRect(),p=["k-tooltip-content","k-animation-container","k-tooltip","k-tooltip-title","k-tooltip k-tooltip-closable","k-icon k-i-x","k-svg-icon k-svg-i-x"],f=i=>{if(i===null)return!1;let o=i;for(;o;){if(o!==null&&o.classList&&o.classList.contains("k-tooltip"))return!0;o.parentNode!==null?o=o.parentNode:o=!1}return p.filter(s=>s===i.className).length>0};exports.getDomRect=a;exports.getLeftPosition=w;exports.getTopPosition=d;exports.isTooltipElement=f;exports.toolTipSelectors=p;
|
package/utils.mjs
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
import { canUseDOM as c } from "@progress/kendo-vue-common";
|
|
9
|
+
const n = 10, u = 10, d = (i, o, r, s, t) => {
|
|
10
|
+
switch (t) {
|
|
11
|
+
case "bottom":
|
|
12
|
+
return s === "pointer" ? i - o / 2 : r.left - o / 2 + r.width / 2;
|
|
13
|
+
case "left":
|
|
14
|
+
return s === "pointer" ? i - o - n : r.left - o - n;
|
|
15
|
+
case "right":
|
|
16
|
+
return s === "pointer" ? i + n : r.right + n;
|
|
17
|
+
case "top":
|
|
18
|
+
return s === "pointer" ? i - o / 2 : r.left - o / 2 + r.width / 2;
|
|
19
|
+
default:
|
|
20
|
+
return s === "pointer" ? c && i < window.screen.availWidth / 2 ? i - n : i - o + n : c && i < window.screen.availWidth / 2 ? r.left : r.right - o;
|
|
21
|
+
}
|
|
22
|
+
}, f = (i, o, r, s, t) => {
|
|
23
|
+
switch (t) {
|
|
24
|
+
case "bottom":
|
|
25
|
+
return s === "pointer" ? i + u : o.bottom + u;
|
|
26
|
+
case "left":
|
|
27
|
+
return s === "pointer" ? i - r / 2 : o.top - r / 2 + o.height / 2;
|
|
28
|
+
case "right":
|
|
29
|
+
return s === "pointer" ? i - r / 2 : o.top - r / 2 + o.height / 2;
|
|
30
|
+
case "top":
|
|
31
|
+
return s === "pointer" ? i - r - u : o.top - r - u;
|
|
32
|
+
default:
|
|
33
|
+
return s === "pointer" ? c && i < window.innerHeight / 2 ? i + n : i - r - n : c && i < window.innerHeight / 2 ? o.bottom + u : o.top - r - u;
|
|
34
|
+
}
|
|
35
|
+
}, k = (i) => i !== null ? i.getBoundingClientRect() : document.body.getBoundingClientRect(), p = ["k-tooltip-content", "k-animation-container", "k-tooltip", "k-tooltip-title", "k-tooltip k-tooltip-closable", "k-icon k-i-x", "k-svg-icon k-svg-i-x"], a = (i) => {
|
|
36
|
+
if (i === null)
|
|
37
|
+
return !1;
|
|
38
|
+
let o = i;
|
|
39
|
+
for (; o; ) {
|
|
40
|
+
if (o !== null && o.classList && o.classList.contains("k-tooltip"))
|
|
41
|
+
return !0;
|
|
42
|
+
o.parentNode !== null ? o = o.parentNode : o = !1;
|
|
43
|
+
}
|
|
44
|
+
return p.filter((r) => r === i.className).length > 0;
|
|
45
|
+
};
|
|
46
|
+
export {
|
|
47
|
+
k as getDomRect,
|
|
48
|
+
d as getLeftPosition,
|
|
49
|
+
f as getTopPosition,
|
|
50
|
+
a as isTooltipElement,
|
|
51
|
+
p as toolTipSelectors
|
|
52
|
+
};
|
package/dist/es/Tooltip.d.ts
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { DefineComponent, RecordPropsDefinition, ComponentOptions, Vue2type } from './additionalTypes';
|
|
2
|
-
declare type DefaultData<V> = object | ((this: V) => {});
|
|
3
|
-
declare type DefaultMethods<V> = {
|
|
4
|
-
[key: string]: (this: V, ...args: any[]) => any;
|
|
5
|
-
};
|
|
6
|
-
import { TooltipProps } from './TooltipProps';
|
|
7
|
-
/**
|
|
8
|
-
* @hidden
|
|
9
|
-
*/
|
|
10
|
-
interface TooltipData {
|
|
11
|
-
targetElement: HTMLElement | null;
|
|
12
|
-
open: boolean;
|
|
13
|
-
title: string;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* @hidden
|
|
17
|
-
*/
|
|
18
|
-
export interface TooltipComputed {
|
|
19
|
-
[key: string]: any;
|
|
20
|
-
computedTarget: any;
|
|
21
|
-
computedOpen: any;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* @hidden
|
|
25
|
-
*/
|
|
26
|
-
export interface TooltipMethods {
|
|
27
|
-
[key: string]: any;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* @hidden
|
|
31
|
-
*/
|
|
32
|
-
export interface TooltipState {
|
|
33
|
-
top: number;
|
|
34
|
-
left: number;
|
|
35
|
-
openTimeoutId?: any;
|
|
36
|
-
updateIntervalId?: any;
|
|
37
|
-
willOpen: boolean;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* @hidden
|
|
41
|
-
*/
|
|
42
|
-
export interface TooltipAll extends Vue2type, TooltipMethods, TooltipData, TooltipComputed, TooltipState {
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* @hidden
|
|
46
|
-
*/
|
|
47
|
-
declare let TooltipVue2: ComponentOptions<TooltipAll, DefaultData<TooltipData>, DefaultMethods<TooltipAll>, TooltipComputed, RecordPropsDefinition<TooltipProps>>;
|
|
48
|
-
/**
|
|
49
|
-
* @hidden
|
|
50
|
-
*/
|
|
51
|
-
declare const Tooltip: DefineComponent<TooltipProps, any, TooltipData, TooltipComputed, TooltipMethods, {}, {}, {}, string, TooltipProps, TooltipProps, {}>;
|
|
52
|
-
export { Tooltip, TooltipVue2 };
|
package/dist/es/Tooltip.js
DELETED
|
@@ -1,420 +0,0 @@
|
|
|
1
|
-
var __assign = this && this.__assign || function () {
|
|
2
|
-
__assign = Object.assign || function (t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) {
|
|
6
|
-
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
// @ts-ignore
|
|
14
|
-
import * as Vue from 'vue';
|
|
15
|
-
var allVue = Vue;
|
|
16
|
-
var gh = allVue.h;
|
|
17
|
-
var isV3 = allVue.version && allVue.version[0] === '3';
|
|
18
|
-
import { classNames, validatePackage, getDefaultSlots, getListeners, templateRendering, getTemplate, setRef, getRef, canUseDOM, guid } from '@progress/kendo-vue-common';
|
|
19
|
-
import { getLeftPosition, getTopPosition, getDomRect, isTooltipElement } from './utils';
|
|
20
|
-
import { packageMetadata } from './package-metadata';
|
|
21
|
-
var DEFAULT_TOOLTIP_ZINDEX = 100;
|
|
22
|
-
var ARIAIDSUFFIX = '_tb_active';
|
|
23
|
-
/**
|
|
24
|
-
* @hidden
|
|
25
|
-
*/
|
|
26
|
-
var TooltipVue2 = {
|
|
27
|
-
name: 'KendoTooltip',
|
|
28
|
-
inheritAttrs: false,
|
|
29
|
-
props: {
|
|
30
|
-
showCallout: {
|
|
31
|
-
type: Boolean,
|
|
32
|
-
default: true
|
|
33
|
-
},
|
|
34
|
-
setCalloutOnPositionAuto: {
|
|
35
|
-
type: String,
|
|
36
|
-
default: undefined
|
|
37
|
-
},
|
|
38
|
-
anchorElement: {
|
|
39
|
-
type: String,
|
|
40
|
-
default: 'pointer',
|
|
41
|
-
validator: function validator(value) {
|
|
42
|
-
return ['pointer', 'target'].includes(value);
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
content: [String, Object, Function],
|
|
46
|
-
filter: Function,
|
|
47
|
-
openDelay: {
|
|
48
|
-
type: Number,
|
|
49
|
-
default: 400
|
|
50
|
-
},
|
|
51
|
-
open: {
|
|
52
|
-
type: Boolean,
|
|
53
|
-
default: undefined
|
|
54
|
-
},
|
|
55
|
-
position: {
|
|
56
|
-
type: String,
|
|
57
|
-
default: 'auto',
|
|
58
|
-
validator: function validator(value) {
|
|
59
|
-
return ['right', 'left', 'top', 'bottom', 'auto'].includes(value);
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
updatePosition: {
|
|
63
|
-
type: Function,
|
|
64
|
-
default: undefined
|
|
65
|
-
},
|
|
66
|
-
updateInterval: Number,
|
|
67
|
-
className: String,
|
|
68
|
-
wrapperStyle: Object,
|
|
69
|
-
tooltipClassName: String,
|
|
70
|
-
tooltipStyle: Object,
|
|
71
|
-
targetElement: {
|
|
72
|
-
type: undefined
|
|
73
|
-
},
|
|
74
|
-
parentTitle: {
|
|
75
|
-
type: Boolean,
|
|
76
|
-
default: false
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
data: function data() {
|
|
80
|
-
return {
|
|
81
|
-
top: 0,
|
|
82
|
-
left: 0,
|
|
83
|
-
currentTargetElement: null,
|
|
84
|
-
currentOpen: false,
|
|
85
|
-
title: ''
|
|
86
|
-
};
|
|
87
|
-
},
|
|
88
|
-
computed: {
|
|
89
|
-
wrapperClass: function wrapperClass() {
|
|
90
|
-
var _a;
|
|
91
|
-
return _a = {
|
|
92
|
-
'k-animation-container': true,
|
|
93
|
-
'k-animation-container-fixed': true,
|
|
94
|
-
'k-animation-container-shown': true
|
|
95
|
-
}, _a[this.$props.className] = true, _a;
|
|
96
|
-
},
|
|
97
|
-
computedTarget: function computedTarget() {
|
|
98
|
-
return this.targetElement !== undefined ? this.targetElement : this.currentTargetElement;
|
|
99
|
-
},
|
|
100
|
-
computedOpen: function computedOpen() {
|
|
101
|
-
return this.open !== undefined ? this.open : this.currentOpen;
|
|
102
|
-
}
|
|
103
|
-
},
|
|
104
|
-
inject: {
|
|
105
|
-
kCurrentZIndex: {
|
|
106
|
-
default: null
|
|
107
|
-
}
|
|
108
|
-
},
|
|
109
|
-
created: function created() {
|
|
110
|
-
validatePackage(packageMetadata);
|
|
111
|
-
this.top = 0;
|
|
112
|
-
this.left = 0;
|
|
113
|
-
this.willOpen = false;
|
|
114
|
-
},
|
|
115
|
-
mounted: function mounted() {
|
|
116
|
-
this.element = getRef(this, 'element');
|
|
117
|
-
if (document) {
|
|
118
|
-
document.body.addEventListener('mousemove', this.handleBodyMousemove);
|
|
119
|
-
}
|
|
120
|
-
},
|
|
121
|
-
destroyed: !!isV3 ? undefined : function () {
|
|
122
|
-
this.destroyElement();
|
|
123
|
-
},
|
|
124
|
-
// @ts-ignore
|
|
125
|
-
unmounted: function unmounted() {
|
|
126
|
-
this.destroyElement();
|
|
127
|
-
},
|
|
128
|
-
updated: function updated() {
|
|
129
|
-
if (this.$props.open && this.$props.targetElement) {
|
|
130
|
-
this.showToolTip({
|
|
131
|
-
target: this.$props.targetElement
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
this.element = getRef(this, 'element');
|
|
135
|
-
if (!this.element) {
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
this.resetPosition();
|
|
139
|
-
if (this.computedTarget) {
|
|
140
|
-
var appendToElement = this.$props.appendTo ? this.$props.appendTo : this.computedTarget.ownerDocument.body;
|
|
141
|
-
if (this.element.parentElement !== appendToElement) {
|
|
142
|
-
this.computedTarget.ownerDocument.body.append(this.element);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
this.callout = this.v3 ? this.calloutRef : this.$refs.callout;
|
|
146
|
-
if (!this.callout) {
|
|
147
|
-
return;
|
|
148
|
-
}
|
|
149
|
-
this.callout.className = this.calloutClassName();
|
|
150
|
-
if (this.$props.position === 'auto' && canUseDOM) {
|
|
151
|
-
this.left < window.screen.availWidth / 2 ? this.callout.style.left = this.$props.setCalloutOnPositionAuto || '25%' : this.callout.style.left = this.$props.setCalloutOnPositionAuto || '75%';
|
|
152
|
-
}
|
|
153
|
-
},
|
|
154
|
-
// @ts-ignore
|
|
155
|
-
setup: !isV3 ? undefined : function () {
|
|
156
|
-
var v3 = !!isV3;
|
|
157
|
-
return {
|
|
158
|
-
v3: v3
|
|
159
|
-
};
|
|
160
|
-
},
|
|
161
|
-
// @ts-ignore
|
|
162
|
-
render: function render(createElement) {
|
|
163
|
-
var h = gh || createElement;
|
|
164
|
-
var defaultSlot = getDefaultSlots(this);
|
|
165
|
-
var currentZIndex = this.getCurrentZIndex();
|
|
166
|
-
var content = this.$props.content ? templateRendering.call(this, this.$props.content, getListeners.call(this)) : undefined;
|
|
167
|
-
var contentDefaultRendering = this.title;
|
|
168
|
-
var ariaId = guid() + ARIAIDSUFFIX;
|
|
169
|
-
if (this.computedTarget) {
|
|
170
|
-
if (this.computedTarget.hasAttribute('id')) {
|
|
171
|
-
ariaId = this.computedTarget.getAttribute('id') + ARIAIDSUFFIX;
|
|
172
|
-
}
|
|
173
|
-
this.computedTarget.setAttribute('aria-describedby', ariaId);
|
|
174
|
-
}
|
|
175
|
-
var contentRendering = getTemplate.call(this, {
|
|
176
|
-
h: h,
|
|
177
|
-
template: content,
|
|
178
|
-
defaultRendering: contentDefaultRendering,
|
|
179
|
-
additionalProps: {
|
|
180
|
-
title: this.title,
|
|
181
|
-
target: this.computedTarget
|
|
182
|
-
}
|
|
183
|
-
});
|
|
184
|
-
var innerToolTip = this.computedOpen && h("div", {
|
|
185
|
-
"class": classNames('k-tooltip', this.$props.tooltipClassName),
|
|
186
|
-
role: 'tooltip',
|
|
187
|
-
attrs: this.v3 ? undefined : {
|
|
188
|
-
role: 'tooltip',
|
|
189
|
-
id: ariaId
|
|
190
|
-
},
|
|
191
|
-
id: ariaId,
|
|
192
|
-
style: __assign({
|
|
193
|
-
position: 'relative'
|
|
194
|
-
}, this.$props.tooltipStyle)
|
|
195
|
-
}, [h("div", {
|
|
196
|
-
"class": "k-tooltip-content"
|
|
197
|
-
}, [contentRendering]), this.$props.showCallout && h("div", {
|
|
198
|
-
ref: setRef(this, 'callout')
|
|
199
|
-
})]);
|
|
200
|
-
var tooltip = this.computedTarget && this.title && this.computedTarget.ownerDocument && h("div", {
|
|
201
|
-
ref: setRef(this, 'element'),
|
|
202
|
-
"class": this.wrapperClass,
|
|
203
|
-
style: __assign({
|
|
204
|
-
zIndex: currentZIndex
|
|
205
|
-
}, this.$props.wrapperStyle),
|
|
206
|
-
tabindex: 0,
|
|
207
|
-
attrs: this.v3 ? undefined : {
|
|
208
|
-
tabindex: 0
|
|
209
|
-
},
|
|
210
|
-
onMouseleave: this.handleTooltipMouseOut,
|
|
211
|
-
on: this.v3 ? undefined : {
|
|
212
|
-
"mouseleave": this.handleTooltipMouseOut
|
|
213
|
-
}
|
|
214
|
-
}, [h("div", {
|
|
215
|
-
"class": "k-child-animation-container"
|
|
216
|
-
}, [innerToolTip])]);
|
|
217
|
-
if (defaultSlot) {
|
|
218
|
-
return h("div", {
|
|
219
|
-
onMouseover: this.handleMouseOver,
|
|
220
|
-
on: this.v3 ? undefined : {
|
|
221
|
-
"mouseover": this.handleMouseOver,
|
|
222
|
-
"mouseout": this.handleMouseOut
|
|
223
|
-
},
|
|
224
|
-
onMouseout: this.handleMouseOut
|
|
225
|
-
}, [tooltip, defaultSlot]);
|
|
226
|
-
} else {
|
|
227
|
-
return tooltip;
|
|
228
|
-
}
|
|
229
|
-
},
|
|
230
|
-
methods: {
|
|
231
|
-
destroyElement: function destroyElement() {
|
|
232
|
-
clearTimeout(this.openTimeoutId);
|
|
233
|
-
clearInterval(this.updateIntervalId);
|
|
234
|
-
if (document) {
|
|
235
|
-
document.body.removeEventListener('mousemove', this.handleBodyMousemove);
|
|
236
|
-
}
|
|
237
|
-
if (this.element) {
|
|
238
|
-
this.element.remove();
|
|
239
|
-
}
|
|
240
|
-
},
|
|
241
|
-
handleTooltipMouseOut: function handleTooltipMouseOut(event) {
|
|
242
|
-
this.onClose(event);
|
|
243
|
-
},
|
|
244
|
-
handleMouseOut: function handleMouseOut(event) {
|
|
245
|
-
var currentDocument = this.computedTarget ? this.computedTarget.ownerDocument : document;
|
|
246
|
-
var element = currentDocument && currentDocument.elementFromPoint(event.clientX, event.clientY);
|
|
247
|
-
this.willOpen = false;
|
|
248
|
-
if (isTooltipElement(element) || this.computedTarget !== event.target) {
|
|
249
|
-
return;
|
|
250
|
-
}
|
|
251
|
-
if (this.$props.open) {
|
|
252
|
-
return;
|
|
253
|
-
}
|
|
254
|
-
clearInterval(this.updateIntervalId);
|
|
255
|
-
this.onClose(event);
|
|
256
|
-
},
|
|
257
|
-
handleMouseOver: function handleMouseOver(event) {
|
|
258
|
-
var target = event.target;
|
|
259
|
-
if (!this.isVisible(target) || isTooltipElement(target) || target === this.computedTarget) {
|
|
260
|
-
return;
|
|
261
|
-
}
|
|
262
|
-
this.showToolTip(event);
|
|
263
|
-
},
|
|
264
|
-
handleBodyMousemove: function handleBodyMousemove(event) {
|
|
265
|
-
this.top = event.clientY;
|
|
266
|
-
this.left = event.clientX;
|
|
267
|
-
},
|
|
268
|
-
onClose: function onClose(event) {
|
|
269
|
-
this.$emit('close', {
|
|
270
|
-
event: event,
|
|
271
|
-
component: this
|
|
272
|
-
});
|
|
273
|
-
this.computedTarget.removeAttribute('aria-describedby');
|
|
274
|
-
this.currentTargetElement = null;
|
|
275
|
-
this.currentOpen = false;
|
|
276
|
-
this.title = '';
|
|
277
|
-
},
|
|
278
|
-
showToolTip: function showToolTip(event) {
|
|
279
|
-
var _this = this;
|
|
280
|
-
clearTimeout(this.openTimeoutId);
|
|
281
|
-
clearInterval(this.updateIntervalId);
|
|
282
|
-
if (event.target.hasChildNodes()) {
|
|
283
|
-
event.target.childNodes.forEach(function (childElement) {
|
|
284
|
-
if (childElement.nodeName === 'title') {
|
|
285
|
-
event.target.titleExpando = childElement.innerHTML;
|
|
286
|
-
childElement.remove();
|
|
287
|
-
}
|
|
288
|
-
});
|
|
289
|
-
}
|
|
290
|
-
var target = this.computedTarget || event.target;
|
|
291
|
-
var titleResult = this.getTitle(target);
|
|
292
|
-
if (!titleResult.title) {
|
|
293
|
-
if (this.computedOpen) {
|
|
294
|
-
this.onClose(event);
|
|
295
|
-
}
|
|
296
|
-
return;
|
|
297
|
-
}
|
|
298
|
-
if (titleResult.element) {
|
|
299
|
-
titleResult.element.titleExpando = titleResult.title;
|
|
300
|
-
titleResult.element.title = '';
|
|
301
|
-
}
|
|
302
|
-
this.willOpen = true;
|
|
303
|
-
if (!this.$props.openDelay) {
|
|
304
|
-
this.currentTargetElement = target;
|
|
305
|
-
this.currentOpen = true;
|
|
306
|
-
this.title = titleResult.title;
|
|
307
|
-
this.setUpdateInterval();
|
|
308
|
-
} else {
|
|
309
|
-
if (canUseDOM) {
|
|
310
|
-
this.openTimeoutId = window.setTimeout(function () {
|
|
311
|
-
if (_this.willOpen) {
|
|
312
|
-
_this.currentTargetElement = target;
|
|
313
|
-
_this.currentOpen = true;
|
|
314
|
-
_this.title = titleResult.title;
|
|
315
|
-
_this.setUpdateInterval();
|
|
316
|
-
}
|
|
317
|
-
}, this.$props.openDelay);
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
if (this.title !== titleResult.title) {
|
|
321
|
-
this.$emit('open', {
|
|
322
|
-
event: event,
|
|
323
|
-
compoponent: this
|
|
324
|
-
});
|
|
325
|
-
}
|
|
326
|
-
},
|
|
327
|
-
setUpdateInterval: function setUpdateInterval() {
|
|
328
|
-
if (this.$props.updateInterval) {
|
|
329
|
-
this.updateIntervalId = setInterval(this.onIntervalUpdate, this.$props.updateInterval);
|
|
330
|
-
}
|
|
331
|
-
},
|
|
332
|
-
onIntervalUpdate: function onIntervalUpdate() {
|
|
333
|
-
var target = this.computedTarget;
|
|
334
|
-
if (!target) {
|
|
335
|
-
return;
|
|
336
|
-
}
|
|
337
|
-
if (target.parentElement === null) {
|
|
338
|
-
// Getting element from previous target coordinates will cause reflow which is performance hit.
|
|
339
|
-
// Also remount case can be avoided easily
|
|
340
|
-
this.onClose({
|
|
341
|
-
target: target
|
|
342
|
-
});
|
|
343
|
-
} else {
|
|
344
|
-
this.showToolTip({
|
|
345
|
-
target: target
|
|
346
|
-
});
|
|
347
|
-
}
|
|
348
|
-
},
|
|
349
|
-
resetPosition: function resetPosition() {
|
|
350
|
-
if (this.element) {
|
|
351
|
-
var position = this.setPosition(this.element);
|
|
352
|
-
if (this.$props.updatePosition) {
|
|
353
|
-
position = this.$props.updatePosition({
|
|
354
|
-
element: this.element,
|
|
355
|
-
targetElement: this.computedTarget,
|
|
356
|
-
mouseTop: this.top,
|
|
357
|
-
mouseLeft: this.left,
|
|
358
|
-
anchorElement: this.$props.anchorElement,
|
|
359
|
-
position: this.$props.position,
|
|
360
|
-
target: this,
|
|
361
|
-
defaultPosition: position
|
|
362
|
-
});
|
|
363
|
-
}
|
|
364
|
-
this.element.style.left = position.left + 'px';
|
|
365
|
-
this.element.style.top = position.top + 'px';
|
|
366
|
-
}
|
|
367
|
-
},
|
|
368
|
-
isVisible: function isVisible(element) {
|
|
369
|
-
return !this.$props.filter || this.$props.filter(element);
|
|
370
|
-
},
|
|
371
|
-
setPosition: function setPosition(element) {
|
|
372
|
-
var target = this.parentTitle ? this.getTitle(this.computedTarget).element : this.computedTarget;
|
|
373
|
-
var domRect = getDomRect(target);
|
|
374
|
-
var left = getLeftPosition(this.left, element.offsetWidth, domRect, this.$props.anchorElement, this.$props.position);
|
|
375
|
-
var top = getTopPosition(this.top, domRect, element.offsetHeight, this.$props.anchorElement, this.$props.position);
|
|
376
|
-
return {
|
|
377
|
-
left: left,
|
|
378
|
-
top: top
|
|
379
|
-
};
|
|
380
|
-
},
|
|
381
|
-
getTitle: function getTitle(element) {
|
|
382
|
-
while (element) {
|
|
383
|
-
if (element.getAttribute('title') !== null || element.titleExpando) {
|
|
384
|
-
var title = element.getAttribute('title') || element.titleExpando;
|
|
385
|
-
return {
|
|
386
|
-
title: title,
|
|
387
|
-
element: element
|
|
388
|
-
};
|
|
389
|
-
}
|
|
390
|
-
element = this.$props.parentTitle && element.parentElement || null;
|
|
391
|
-
}
|
|
392
|
-
return {
|
|
393
|
-
title: '',
|
|
394
|
-
element: element
|
|
395
|
-
};
|
|
396
|
-
},
|
|
397
|
-
calloutClassName: function calloutClassName() {
|
|
398
|
-
switch (this.$props.position) {
|
|
399
|
-
case 'bottom':
|
|
400
|
-
return 'k-callout k-callout-n';
|
|
401
|
-
case 'left':
|
|
402
|
-
return 'k-callout k-callout-e';
|
|
403
|
-
case 'right':
|
|
404
|
-
return 'k-callout k-callout-w';
|
|
405
|
-
case 'top':
|
|
406
|
-
return 'k-callout k-callout-s';
|
|
407
|
-
default:
|
|
408
|
-
return canUseDOM && this.top < window.innerHeight / 2 ? 'k-callout k-callout-n' : 'k-callout k-callout-s';
|
|
409
|
-
}
|
|
410
|
-
},
|
|
411
|
-
getCurrentZIndex: function getCurrentZIndex() {
|
|
412
|
-
return this.kCurrentZIndex ? this.kCurrentZIndex : DEFAULT_TOOLTIP_ZINDEX;
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
};
|
|
416
|
-
/**
|
|
417
|
-
* @hidden
|
|
418
|
-
*/
|
|
419
|
-
var Tooltip = TooltipVue2;
|
|
420
|
-
export { Tooltip, TooltipVue2 };
|