@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/dist/esm/utils.js
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { canUseDOM } from '@progress/kendo-vue-common';
|
|
2
|
-
var arrowWidth = 10;
|
|
3
|
-
var arrowHeight = 10;
|
|
4
|
-
/**
|
|
5
|
-
* @hidden
|
|
6
|
-
*/
|
|
7
|
-
export var getLeftPosition = function getLeftPosition(left, elementWidth, targetElement, anchorElement, position) {
|
|
8
|
-
switch (position) {
|
|
9
|
-
case 'bottom':
|
|
10
|
-
return anchorElement === 'pointer' ? left - elementWidth / 2 : targetElement.left - elementWidth / 2 + targetElement.width / 2;
|
|
11
|
-
case 'left':
|
|
12
|
-
return anchorElement === 'pointer' ? left - elementWidth - arrowWidth : targetElement.left - elementWidth - arrowWidth;
|
|
13
|
-
case 'right':
|
|
14
|
-
return anchorElement === 'pointer' ? left + arrowWidth : targetElement.right + arrowWidth;
|
|
15
|
-
case 'top':
|
|
16
|
-
return anchorElement === 'pointer' ? left - elementWidth / 2 : targetElement.left - elementWidth / 2 + targetElement.width / 2;
|
|
17
|
-
default:
|
|
18
|
-
if (anchorElement === 'pointer') {
|
|
19
|
-
return canUseDOM && left < window.screen.availWidth / 2 ? left - arrowWidth : left - elementWidth + arrowWidth;
|
|
20
|
-
} else {
|
|
21
|
-
return canUseDOM && left < window.screen.availWidth / 2 ? targetElement.left : targetElement.right - elementWidth;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* @hidden
|
|
27
|
-
*/
|
|
28
|
-
export var getTopPosition = function getTopPosition(top, targetElement, elementHeight, anchorElement, position) {
|
|
29
|
-
switch (position) {
|
|
30
|
-
case 'bottom':
|
|
31
|
-
return anchorElement === 'pointer' ? top + arrowHeight : targetElement.bottom + arrowHeight;
|
|
32
|
-
case 'left':
|
|
33
|
-
return anchorElement === 'pointer' ? top - elementHeight / 2 : targetElement.top - elementHeight / 2 + targetElement.height / 2;
|
|
34
|
-
case 'right':
|
|
35
|
-
return anchorElement === 'pointer' ? top - elementHeight / 2 : targetElement.top - elementHeight / 2 + targetElement.height / 2;
|
|
36
|
-
case 'top':
|
|
37
|
-
return anchorElement === 'pointer' ? top - elementHeight - arrowHeight : targetElement.top - elementHeight - arrowHeight;
|
|
38
|
-
default:
|
|
39
|
-
if (anchorElement === 'pointer') {
|
|
40
|
-
return canUseDOM && top < window.innerHeight / 2 ? top + arrowWidth : top - elementHeight - arrowWidth;
|
|
41
|
-
} else {
|
|
42
|
-
return canUseDOM && top < window.innerHeight / 2 ? targetElement.bottom + arrowHeight : targetElement.top - elementHeight - arrowHeight;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
/**
|
|
47
|
-
* @hidden
|
|
48
|
-
*/
|
|
49
|
-
export var getDomRect = function getDomRect(currentTarget) {
|
|
50
|
-
if (currentTarget !== null) {
|
|
51
|
-
return currentTarget.getBoundingClientRect();
|
|
52
|
-
}
|
|
53
|
-
return document.body.getBoundingClientRect();
|
|
54
|
-
};
|
|
55
|
-
/**
|
|
56
|
-
* @hidden
|
|
57
|
-
*/
|
|
58
|
-
export var toolTipSelectors = ['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'];
|
|
59
|
-
/**
|
|
60
|
-
* @hidden
|
|
61
|
-
*/
|
|
62
|
-
export var isTooltipElement = function isTooltipElement(element) {
|
|
63
|
-
if (element === null) {
|
|
64
|
-
return false;
|
|
65
|
-
}
|
|
66
|
-
var node = element;
|
|
67
|
-
while (node) {
|
|
68
|
-
if (node !== null && node.classList && node.classList.contains('k-tooltip')) {
|
|
69
|
-
return true;
|
|
70
|
-
}
|
|
71
|
-
node.parentNode !== null ? node = node.parentNode : node = false;
|
|
72
|
-
}
|
|
73
|
-
return toolTipSelectors.filter(function (t) {
|
|
74
|
-
return t === element.className;
|
|
75
|
-
}).length > 0;
|
|
76
|
-
};
|
package/dist/npm/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/npm/Tooltip.js
DELETED
|
@@ -1,427 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var __assign = undefined && undefined.__assign || function () {
|
|
4
|
-
__assign = Object.assign || function (t) {
|
|
5
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
6
|
-
s = arguments[i];
|
|
7
|
-
for (var p in s) {
|
|
8
|
-
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
|
-
return __assign.apply(this, arguments);
|
|
14
|
-
};
|
|
15
|
-
Object.defineProperty(exports, "__esModule", {
|
|
16
|
-
value: true
|
|
17
|
-
});
|
|
18
|
-
exports.TooltipVue2 = exports.Tooltip = void 0;
|
|
19
|
-
// @ts-ignore
|
|
20
|
-
var Vue = require("vue");
|
|
21
|
-
var allVue = Vue;
|
|
22
|
-
var gh = allVue.h;
|
|
23
|
-
var isV3 = allVue.version && allVue.version[0] === '3';
|
|
24
|
-
var kendo_vue_common_1 = require("@progress/kendo-vue-common");
|
|
25
|
-
var utils_1 = require("./utils");
|
|
26
|
-
var package_metadata_1 = require("./package-metadata");
|
|
27
|
-
var DEFAULT_TOOLTIP_ZINDEX = 100;
|
|
28
|
-
var ARIAIDSUFFIX = '_tb_active';
|
|
29
|
-
/**
|
|
30
|
-
* @hidden
|
|
31
|
-
*/
|
|
32
|
-
var TooltipVue2 = {
|
|
33
|
-
name: 'KendoTooltip',
|
|
34
|
-
inheritAttrs: false,
|
|
35
|
-
props: {
|
|
36
|
-
showCallout: {
|
|
37
|
-
type: Boolean,
|
|
38
|
-
default: true
|
|
39
|
-
},
|
|
40
|
-
setCalloutOnPositionAuto: {
|
|
41
|
-
type: String,
|
|
42
|
-
default: undefined
|
|
43
|
-
},
|
|
44
|
-
anchorElement: {
|
|
45
|
-
type: String,
|
|
46
|
-
default: 'pointer',
|
|
47
|
-
validator: function validator(value) {
|
|
48
|
-
return ['pointer', 'target'].includes(value);
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
content: [String, Object, Function],
|
|
52
|
-
filter: Function,
|
|
53
|
-
openDelay: {
|
|
54
|
-
type: Number,
|
|
55
|
-
default: 400
|
|
56
|
-
},
|
|
57
|
-
open: {
|
|
58
|
-
type: Boolean,
|
|
59
|
-
default: undefined
|
|
60
|
-
},
|
|
61
|
-
position: {
|
|
62
|
-
type: String,
|
|
63
|
-
default: 'auto',
|
|
64
|
-
validator: function validator(value) {
|
|
65
|
-
return ['right', 'left', 'top', 'bottom', 'auto'].includes(value);
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
updatePosition: {
|
|
69
|
-
type: Function,
|
|
70
|
-
default: undefined
|
|
71
|
-
},
|
|
72
|
-
updateInterval: Number,
|
|
73
|
-
className: String,
|
|
74
|
-
wrapperStyle: Object,
|
|
75
|
-
tooltipClassName: String,
|
|
76
|
-
tooltipStyle: Object,
|
|
77
|
-
targetElement: {
|
|
78
|
-
type: undefined
|
|
79
|
-
},
|
|
80
|
-
parentTitle: {
|
|
81
|
-
type: Boolean,
|
|
82
|
-
default: false
|
|
83
|
-
}
|
|
84
|
-
},
|
|
85
|
-
data: function data() {
|
|
86
|
-
return {
|
|
87
|
-
top: 0,
|
|
88
|
-
left: 0,
|
|
89
|
-
currentTargetElement: null,
|
|
90
|
-
currentOpen: false,
|
|
91
|
-
title: ''
|
|
92
|
-
};
|
|
93
|
-
},
|
|
94
|
-
computed: {
|
|
95
|
-
wrapperClass: function wrapperClass() {
|
|
96
|
-
var _a;
|
|
97
|
-
return _a = {
|
|
98
|
-
'k-animation-container': true,
|
|
99
|
-
'k-animation-container-fixed': true,
|
|
100
|
-
'k-animation-container-shown': true
|
|
101
|
-
}, _a[this.$props.className] = true, _a;
|
|
102
|
-
},
|
|
103
|
-
computedTarget: function computedTarget() {
|
|
104
|
-
return this.targetElement !== undefined ? this.targetElement : this.currentTargetElement;
|
|
105
|
-
},
|
|
106
|
-
computedOpen: function computedOpen() {
|
|
107
|
-
return this.open !== undefined ? this.open : this.currentOpen;
|
|
108
|
-
}
|
|
109
|
-
},
|
|
110
|
-
inject: {
|
|
111
|
-
kCurrentZIndex: {
|
|
112
|
-
default: null
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
created: function created() {
|
|
116
|
-
(0, kendo_vue_common_1.validatePackage)(package_metadata_1.packageMetadata);
|
|
117
|
-
this.top = 0;
|
|
118
|
-
this.left = 0;
|
|
119
|
-
this.willOpen = false;
|
|
120
|
-
},
|
|
121
|
-
mounted: function mounted() {
|
|
122
|
-
this.element = (0, kendo_vue_common_1.getRef)(this, 'element');
|
|
123
|
-
if (document) {
|
|
124
|
-
document.body.addEventListener('mousemove', this.handleBodyMousemove);
|
|
125
|
-
}
|
|
126
|
-
},
|
|
127
|
-
destroyed: !!isV3 ? undefined : function () {
|
|
128
|
-
this.destroyElement();
|
|
129
|
-
},
|
|
130
|
-
// @ts-ignore
|
|
131
|
-
unmounted: function unmounted() {
|
|
132
|
-
this.destroyElement();
|
|
133
|
-
},
|
|
134
|
-
updated: function updated() {
|
|
135
|
-
if (this.$props.open && this.$props.targetElement) {
|
|
136
|
-
this.showToolTip({
|
|
137
|
-
target: this.$props.targetElement
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
this.element = (0, kendo_vue_common_1.getRef)(this, 'element');
|
|
141
|
-
if (!this.element) {
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
|
-
this.resetPosition();
|
|
145
|
-
if (this.computedTarget) {
|
|
146
|
-
var appendToElement = this.$props.appendTo ? this.$props.appendTo : this.computedTarget.ownerDocument.body;
|
|
147
|
-
if (this.element.parentElement !== appendToElement) {
|
|
148
|
-
this.computedTarget.ownerDocument.body.append(this.element);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
this.callout = this.v3 ? this.calloutRef : this.$refs.callout;
|
|
152
|
-
if (!this.callout) {
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
this.callout.className = this.calloutClassName();
|
|
156
|
-
if (this.$props.position === 'auto' && kendo_vue_common_1.canUseDOM) {
|
|
157
|
-
this.left < window.screen.availWidth / 2 ? this.callout.style.left = this.$props.setCalloutOnPositionAuto || '25%' : this.callout.style.left = this.$props.setCalloutOnPositionAuto || '75%';
|
|
158
|
-
}
|
|
159
|
-
},
|
|
160
|
-
// @ts-ignore
|
|
161
|
-
setup: !isV3 ? undefined : function () {
|
|
162
|
-
var v3 = !!isV3;
|
|
163
|
-
return {
|
|
164
|
-
v3: v3
|
|
165
|
-
};
|
|
166
|
-
},
|
|
167
|
-
// @ts-ignore
|
|
168
|
-
render: function render(createElement) {
|
|
169
|
-
var h = gh || createElement;
|
|
170
|
-
var defaultSlot = (0, kendo_vue_common_1.getDefaultSlots)(this);
|
|
171
|
-
var currentZIndex = this.getCurrentZIndex();
|
|
172
|
-
var content = this.$props.content ? kendo_vue_common_1.templateRendering.call(this, this.$props.content, kendo_vue_common_1.getListeners.call(this)) : undefined;
|
|
173
|
-
var contentDefaultRendering = this.title;
|
|
174
|
-
var ariaId = (0, kendo_vue_common_1.guid)() + ARIAIDSUFFIX;
|
|
175
|
-
if (this.computedTarget) {
|
|
176
|
-
if (this.computedTarget.hasAttribute('id')) {
|
|
177
|
-
ariaId = this.computedTarget.getAttribute('id') + ARIAIDSUFFIX;
|
|
178
|
-
}
|
|
179
|
-
this.computedTarget.setAttribute('aria-describedby', ariaId);
|
|
180
|
-
}
|
|
181
|
-
var contentRendering = kendo_vue_common_1.getTemplate.call(this, {
|
|
182
|
-
h: h,
|
|
183
|
-
template: content,
|
|
184
|
-
defaultRendering: contentDefaultRendering,
|
|
185
|
-
additionalProps: {
|
|
186
|
-
title: this.title,
|
|
187
|
-
target: this.computedTarget
|
|
188
|
-
}
|
|
189
|
-
});
|
|
190
|
-
var innerToolTip = this.computedOpen && h("div", {
|
|
191
|
-
"class": (0, kendo_vue_common_1.classNames)('k-tooltip', this.$props.tooltipClassName),
|
|
192
|
-
role: 'tooltip',
|
|
193
|
-
attrs: this.v3 ? undefined : {
|
|
194
|
-
role: 'tooltip',
|
|
195
|
-
id: ariaId
|
|
196
|
-
},
|
|
197
|
-
id: ariaId,
|
|
198
|
-
style: __assign({
|
|
199
|
-
position: 'relative'
|
|
200
|
-
}, this.$props.tooltipStyle)
|
|
201
|
-
}, [h("div", {
|
|
202
|
-
"class": "k-tooltip-content"
|
|
203
|
-
}, [contentRendering]), this.$props.showCallout && h("div", {
|
|
204
|
-
ref: (0, kendo_vue_common_1.setRef)(this, 'callout')
|
|
205
|
-
})]);
|
|
206
|
-
var tooltip = this.computedTarget && this.title && this.computedTarget.ownerDocument && h("div", {
|
|
207
|
-
ref: (0, kendo_vue_common_1.setRef)(this, 'element'),
|
|
208
|
-
"class": this.wrapperClass,
|
|
209
|
-
style: __assign({
|
|
210
|
-
zIndex: currentZIndex
|
|
211
|
-
}, this.$props.wrapperStyle),
|
|
212
|
-
tabindex: 0,
|
|
213
|
-
attrs: this.v3 ? undefined : {
|
|
214
|
-
tabindex: 0
|
|
215
|
-
},
|
|
216
|
-
onMouseleave: this.handleTooltipMouseOut,
|
|
217
|
-
on: this.v3 ? undefined : {
|
|
218
|
-
"mouseleave": this.handleTooltipMouseOut
|
|
219
|
-
}
|
|
220
|
-
}, [h("div", {
|
|
221
|
-
"class": "k-child-animation-container"
|
|
222
|
-
}, [innerToolTip])]);
|
|
223
|
-
if (defaultSlot) {
|
|
224
|
-
return h("div", {
|
|
225
|
-
onMouseover: this.handleMouseOver,
|
|
226
|
-
on: this.v3 ? undefined : {
|
|
227
|
-
"mouseover": this.handleMouseOver,
|
|
228
|
-
"mouseout": this.handleMouseOut
|
|
229
|
-
},
|
|
230
|
-
onMouseout: this.handleMouseOut
|
|
231
|
-
}, [tooltip, defaultSlot]);
|
|
232
|
-
} else {
|
|
233
|
-
return tooltip;
|
|
234
|
-
}
|
|
235
|
-
},
|
|
236
|
-
methods: {
|
|
237
|
-
destroyElement: function destroyElement() {
|
|
238
|
-
clearTimeout(this.openTimeoutId);
|
|
239
|
-
clearInterval(this.updateIntervalId);
|
|
240
|
-
if (document) {
|
|
241
|
-
document.body.removeEventListener('mousemove', this.handleBodyMousemove);
|
|
242
|
-
}
|
|
243
|
-
if (this.element) {
|
|
244
|
-
this.element.remove();
|
|
245
|
-
}
|
|
246
|
-
},
|
|
247
|
-
handleTooltipMouseOut: function handleTooltipMouseOut(event) {
|
|
248
|
-
this.onClose(event);
|
|
249
|
-
},
|
|
250
|
-
handleMouseOut: function handleMouseOut(event) {
|
|
251
|
-
var currentDocument = this.computedTarget ? this.computedTarget.ownerDocument : document;
|
|
252
|
-
var element = currentDocument && currentDocument.elementFromPoint(event.clientX, event.clientY);
|
|
253
|
-
this.willOpen = false;
|
|
254
|
-
if ((0, utils_1.isTooltipElement)(element) || this.computedTarget !== event.target) {
|
|
255
|
-
return;
|
|
256
|
-
}
|
|
257
|
-
if (this.$props.open) {
|
|
258
|
-
return;
|
|
259
|
-
}
|
|
260
|
-
clearInterval(this.updateIntervalId);
|
|
261
|
-
this.onClose(event);
|
|
262
|
-
},
|
|
263
|
-
handleMouseOver: function handleMouseOver(event) {
|
|
264
|
-
var target = event.target;
|
|
265
|
-
if (!this.isVisible(target) || (0, utils_1.isTooltipElement)(target) || target === this.computedTarget) {
|
|
266
|
-
return;
|
|
267
|
-
}
|
|
268
|
-
this.showToolTip(event);
|
|
269
|
-
},
|
|
270
|
-
handleBodyMousemove: function handleBodyMousemove(event) {
|
|
271
|
-
this.top = event.clientY;
|
|
272
|
-
this.left = event.clientX;
|
|
273
|
-
},
|
|
274
|
-
onClose: function onClose(event) {
|
|
275
|
-
this.$emit('close', {
|
|
276
|
-
event: event,
|
|
277
|
-
component: this
|
|
278
|
-
});
|
|
279
|
-
this.computedTarget.removeAttribute('aria-describedby');
|
|
280
|
-
this.currentTargetElement = null;
|
|
281
|
-
this.currentOpen = false;
|
|
282
|
-
this.title = '';
|
|
283
|
-
},
|
|
284
|
-
showToolTip: function showToolTip(event) {
|
|
285
|
-
var _this = this;
|
|
286
|
-
clearTimeout(this.openTimeoutId);
|
|
287
|
-
clearInterval(this.updateIntervalId);
|
|
288
|
-
if (event.target.hasChildNodes()) {
|
|
289
|
-
event.target.childNodes.forEach(function (childElement) {
|
|
290
|
-
if (childElement.nodeName === 'title') {
|
|
291
|
-
event.target.titleExpando = childElement.innerHTML;
|
|
292
|
-
childElement.remove();
|
|
293
|
-
}
|
|
294
|
-
});
|
|
295
|
-
}
|
|
296
|
-
var target = this.computedTarget || event.target;
|
|
297
|
-
var titleResult = this.getTitle(target);
|
|
298
|
-
if (!titleResult.title) {
|
|
299
|
-
if (this.computedOpen) {
|
|
300
|
-
this.onClose(event);
|
|
301
|
-
}
|
|
302
|
-
return;
|
|
303
|
-
}
|
|
304
|
-
if (titleResult.element) {
|
|
305
|
-
titleResult.element.titleExpando = titleResult.title;
|
|
306
|
-
titleResult.element.title = '';
|
|
307
|
-
}
|
|
308
|
-
this.willOpen = true;
|
|
309
|
-
if (!this.$props.openDelay) {
|
|
310
|
-
this.currentTargetElement = target;
|
|
311
|
-
this.currentOpen = true;
|
|
312
|
-
this.title = titleResult.title;
|
|
313
|
-
this.setUpdateInterval();
|
|
314
|
-
} else {
|
|
315
|
-
if (kendo_vue_common_1.canUseDOM) {
|
|
316
|
-
this.openTimeoutId = window.setTimeout(function () {
|
|
317
|
-
if (_this.willOpen) {
|
|
318
|
-
_this.currentTargetElement = target;
|
|
319
|
-
_this.currentOpen = true;
|
|
320
|
-
_this.title = titleResult.title;
|
|
321
|
-
_this.setUpdateInterval();
|
|
322
|
-
}
|
|
323
|
-
}, this.$props.openDelay);
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
if (this.title !== titleResult.title) {
|
|
327
|
-
this.$emit('open', {
|
|
328
|
-
event: event,
|
|
329
|
-
compoponent: this
|
|
330
|
-
});
|
|
331
|
-
}
|
|
332
|
-
},
|
|
333
|
-
setUpdateInterval: function setUpdateInterval() {
|
|
334
|
-
if (this.$props.updateInterval) {
|
|
335
|
-
this.updateIntervalId = setInterval(this.onIntervalUpdate, this.$props.updateInterval);
|
|
336
|
-
}
|
|
337
|
-
},
|
|
338
|
-
onIntervalUpdate: function onIntervalUpdate() {
|
|
339
|
-
var target = this.computedTarget;
|
|
340
|
-
if (!target) {
|
|
341
|
-
return;
|
|
342
|
-
}
|
|
343
|
-
if (target.parentElement === null) {
|
|
344
|
-
// Getting element from previous target coordinates will cause reflow which is performance hit.
|
|
345
|
-
// Also remount case can be avoided easily
|
|
346
|
-
this.onClose({
|
|
347
|
-
target: target
|
|
348
|
-
});
|
|
349
|
-
} else {
|
|
350
|
-
this.showToolTip({
|
|
351
|
-
target: target
|
|
352
|
-
});
|
|
353
|
-
}
|
|
354
|
-
},
|
|
355
|
-
resetPosition: function resetPosition() {
|
|
356
|
-
if (this.element) {
|
|
357
|
-
var position = this.setPosition(this.element);
|
|
358
|
-
if (this.$props.updatePosition) {
|
|
359
|
-
position = this.$props.updatePosition({
|
|
360
|
-
element: this.element,
|
|
361
|
-
targetElement: this.computedTarget,
|
|
362
|
-
mouseTop: this.top,
|
|
363
|
-
mouseLeft: this.left,
|
|
364
|
-
anchorElement: this.$props.anchorElement,
|
|
365
|
-
position: this.$props.position,
|
|
366
|
-
target: this,
|
|
367
|
-
defaultPosition: position
|
|
368
|
-
});
|
|
369
|
-
}
|
|
370
|
-
this.element.style.left = position.left + 'px';
|
|
371
|
-
this.element.style.top = position.top + 'px';
|
|
372
|
-
}
|
|
373
|
-
},
|
|
374
|
-
isVisible: function isVisible(element) {
|
|
375
|
-
return !this.$props.filter || this.$props.filter(element);
|
|
376
|
-
},
|
|
377
|
-
setPosition: function setPosition(element) {
|
|
378
|
-
var target = this.parentTitle ? this.getTitle(this.computedTarget).element : this.computedTarget;
|
|
379
|
-
var domRect = (0, utils_1.getDomRect)(target);
|
|
380
|
-
var left = (0, utils_1.getLeftPosition)(this.left, element.offsetWidth, domRect, this.$props.anchorElement, this.$props.position);
|
|
381
|
-
var top = (0, utils_1.getTopPosition)(this.top, domRect, element.offsetHeight, this.$props.anchorElement, this.$props.position);
|
|
382
|
-
return {
|
|
383
|
-
left: left,
|
|
384
|
-
top: top
|
|
385
|
-
};
|
|
386
|
-
},
|
|
387
|
-
getTitle: function getTitle(element) {
|
|
388
|
-
while (element) {
|
|
389
|
-
if (element.getAttribute('title') !== null || element.titleExpando) {
|
|
390
|
-
var title = element.getAttribute('title') || element.titleExpando;
|
|
391
|
-
return {
|
|
392
|
-
title: title,
|
|
393
|
-
element: element
|
|
394
|
-
};
|
|
395
|
-
}
|
|
396
|
-
element = this.$props.parentTitle && element.parentElement || null;
|
|
397
|
-
}
|
|
398
|
-
return {
|
|
399
|
-
title: '',
|
|
400
|
-
element: element
|
|
401
|
-
};
|
|
402
|
-
},
|
|
403
|
-
calloutClassName: function calloutClassName() {
|
|
404
|
-
switch (this.$props.position) {
|
|
405
|
-
case 'bottom':
|
|
406
|
-
return 'k-callout k-callout-n';
|
|
407
|
-
case 'left':
|
|
408
|
-
return 'k-callout k-callout-e';
|
|
409
|
-
case 'right':
|
|
410
|
-
return 'k-callout k-callout-w';
|
|
411
|
-
case 'top':
|
|
412
|
-
return 'k-callout k-callout-s';
|
|
413
|
-
default:
|
|
414
|
-
return kendo_vue_common_1.canUseDOM && this.top < window.innerHeight / 2 ? 'k-callout k-callout-n' : 'k-callout k-callout-s';
|
|
415
|
-
}
|
|
416
|
-
},
|
|
417
|
-
getCurrentZIndex: function getCurrentZIndex() {
|
|
418
|
-
return this.kCurrentZIndex ? this.kCurrentZIndex : DEFAULT_TOOLTIP_ZINDEX;
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
};
|
|
422
|
-
exports.TooltipVue2 = TooltipVue2;
|
|
423
|
-
/**
|
|
424
|
-
* @hidden
|
|
425
|
-
*/
|
|
426
|
-
var Tooltip = TooltipVue2;
|
|
427
|
-
exports.Tooltip = Tooltip;
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { TooltipEvent, TooltipPositionEvent } from './events';
|
|
2
|
-
import { TooltipPosition } from './utils';
|
|
3
|
-
/**
|
|
4
|
-
* Represents the props of the [Kendo UI for Vue Tooltip component]({% slug overview_tooltip %}).
|
|
5
|
-
*/
|
|
6
|
-
export interface TooltipProps {
|
|
7
|
-
/**
|
|
8
|
-
* Sets the anchor element of the Tooltip.
|
|
9
|
-
*
|
|
10
|
-
* The available options are:
|
|
11
|
-
* - (Default) `pointer`—Shows a Tooltip where the cursor is located.
|
|
12
|
-
* - `target`—Positions the Tooltip based on the anchor element.
|
|
13
|
-
*/
|
|
14
|
-
anchorElement?: string;
|
|
15
|
-
/**
|
|
16
|
-
* Defines the container to which the Tooltip will be appended. Defaults to [`body`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/body).
|
|
17
|
-
*/
|
|
18
|
-
appendTo?: HTMLElement | null;
|
|
19
|
-
/**
|
|
20
|
-
* Sets the position of the Tooltip ([see example]({% slug positioning_tooltip %})).
|
|
21
|
-
*
|
|
22
|
-
* The available options are:
|
|
23
|
-
* - (Default) `auto`—Positions the Tooltip depending on the available space.
|
|
24
|
-
* - `right`—Positions the Tooltip to the right side of the element.
|
|
25
|
-
* - `left`—Positions the Tooltip to the left side of the element.
|
|
26
|
-
* - `bottom`—Positions the Tooltip at the bottom of the element.
|
|
27
|
-
* - `top`—Positions the Tooltip at the top of the element.
|
|
28
|
-
*/
|
|
29
|
-
position?: TooltipPosition | String;
|
|
30
|
-
/**
|
|
31
|
-
* Sets a class of the Tooltip animation container.
|
|
32
|
-
*/
|
|
33
|
-
className?: string;
|
|
34
|
-
/**
|
|
35
|
-
* Sets a class of the Tooltip animation container.
|
|
36
|
-
*/
|
|
37
|
-
wrapperStyle?: object;
|
|
38
|
-
/**
|
|
39
|
-
* Sets the content of the Tooltip ([see example]({% slug templates_tooltip %})).
|
|
40
|
-
*/
|
|
41
|
-
content?: any;
|
|
42
|
-
/**
|
|
43
|
-
* Specifies if the Tooltip will be open.
|
|
44
|
-
* Sets the Tooltip in its controlled mode ([see example]({% slug controlledmode_tooltip %})).
|
|
45
|
-
* Requires you to set the `targetElement` property.
|
|
46
|
-
*/
|
|
47
|
-
open?: boolean;
|
|
48
|
-
/**
|
|
49
|
-
* Sets a delay in milliseconds.
|
|
50
|
-
*/
|
|
51
|
-
openDelay?: number;
|
|
52
|
-
/**
|
|
53
|
-
* If any of the parent elements has a title, displays a Tooltip.
|
|
54
|
-
*/
|
|
55
|
-
parentTitle?: boolean;
|
|
56
|
-
/**
|
|
57
|
-
* Specifies if the Tooltip callout will be displayed.
|
|
58
|
-
*/
|
|
59
|
-
showCallout?: boolean;
|
|
60
|
-
/**
|
|
61
|
-
* When the position is set to `auto`, sets the start point of the Tooltip callout (in pixels).
|
|
62
|
-
*/
|
|
63
|
-
setCalloutOnPositionAuto?: any;
|
|
64
|
-
/**
|
|
65
|
-
* Sets the Tooltip target element. You have to use it with the `open` property.
|
|
66
|
-
*/
|
|
67
|
-
targetElement?: any;
|
|
68
|
-
/**
|
|
69
|
-
* Specifies the CSS class names which are set to the Tooltip DOM element.
|
|
70
|
-
*/
|
|
71
|
-
tooltipClassName?: string;
|
|
72
|
-
/**
|
|
73
|
-
* Specifies the styles which are set to the Tooltip DOM element.
|
|
74
|
-
*/
|
|
75
|
-
tooltipStyle?: any;
|
|
76
|
-
/**
|
|
77
|
-
* Callback called when the Tooltip calculates it's position. Useful to modify the default position behavior.
|
|
78
|
-
* Require to return the `top` and `left` position of the Tooltip.
|
|
79
|
-
*/
|
|
80
|
-
updatePosition?: (event: TooltipPositionEvent) => {
|
|
81
|
-
top: number;
|
|
82
|
-
left: number;
|
|
83
|
-
};
|
|
84
|
-
/**
|
|
85
|
-
* Fires when the Tooltip is shown.
|
|
86
|
-
*/
|
|
87
|
-
onOpen?: (event: TooltipEvent) => void;
|
|
88
|
-
/**
|
|
89
|
-
* Fires when the Tooltip is hidden.
|
|
90
|
-
*/
|
|
91
|
-
onClose?: (event: TooltipEvent) => void;
|
|
92
|
-
/**
|
|
93
|
-
* Represents a callback function which determines if a Tooltip will be displayed ([see example]({% slug filter_elements_tooltip %})).
|
|
94
|
-
*/
|
|
95
|
-
filter?: (target: HTMLElement) => void;
|
|
96
|
-
/**
|
|
97
|
-
* The milliseconds interval on which the Tooltip will check for title change. By default the Tooltip does not track for title updates.
|
|
98
|
-
*/
|
|
99
|
-
updateInterval?: number;
|
|
100
|
-
}
|
package/dist/npm/TooltipProps.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
// @ts-ignore
|
|
2
|
-
import { DefineComponent } from 'vue';
|
|
3
|
-
// @ts-ignore
|
|
4
|
-
import * as Vue from 'vue';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @hidden
|
|
8
|
-
*/
|
|
9
|
-
// @ts-ignore
|
|
10
|
-
type Vue2type = Vue.default;
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* @hidden
|
|
14
|
-
*/
|
|
15
|
-
// @ts-ignore
|
|
16
|
-
import { RecordPropsDefinition, ComponentOptions } from 'vue/types/options';
|
|
17
|
-
/**
|
|
18
|
-
* @hidden
|
|
19
|
-
*/
|
|
20
|
-
// @ts-ignore
|
|
21
|
-
export { DefineComponent, RecordPropsDefinition, ComponentOptions, Vue2type };
|