UNPKG

10.1 kBJavaScriptView Raw
1module.exports =
2/******/ (function(modules) { // webpackBootstrap
3/******/ // The module cache
4/******/ var installedModules = {};
5/******/
6/******/ // The require function
7/******/ function __webpack_require__(moduleId) {
8/******/
9/******/ // Check if module is in cache
10/******/ if(installedModules[moduleId]) {
11/******/ return installedModules[moduleId].exports;
12/******/ }
13/******/ // Create a new module (and put it into the cache)
14/******/ var module = installedModules[moduleId] = {
15/******/ i: moduleId,
16/******/ l: false,
17/******/ exports: {}
18/******/ };
19/******/
20/******/ // Execute the module function
21/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
22/******/
23/******/ // Flag the module as loaded
24/******/ module.l = true;
25/******/
26/******/ // Return the exports of the module
27/******/ return module.exports;
28/******/ }
29/******/
30/******/
31/******/ // expose the modules object (__webpack_modules__)
32/******/ __webpack_require__.m = modules;
33/******/
34/******/ // expose the module cache
35/******/ __webpack_require__.c = installedModules;
36/******/
37/******/ // define getter function for harmony exports
38/******/ __webpack_require__.d = function(exports, name, getter) {
39/******/ if(!__webpack_require__.o(exports, name)) {
40/******/ Object.defineProperty(exports, name, {
41/******/ configurable: false,
42/******/ enumerable: true,
43/******/ get: getter
44/******/ });
45/******/ }
46/******/ };
47/******/
48/******/ // getDefaultExport function for compatibility with non-harmony modules
49/******/ __webpack_require__.n = function(module) {
50/******/ var getter = module && module.__esModule ?
51/******/ function getDefault() { return module['default']; } :
52/******/ function getModuleExports() { return module; };
53/******/ __webpack_require__.d(getter, 'a', getter);
54/******/ return getter;
55/******/ };
56/******/
57/******/ // Object.prototype.hasOwnProperty.call
58/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
59/******/
60/******/ // __webpack_public_path__
61/******/ __webpack_require__.p = "/dist/";
62/******/
63/******/ // Load entry module and return exports
64/******/ return __webpack_require__(__webpack_require__.s = 207);
65/******/ })
66/************************************************************************/
67/******/ ({
68
69/***/ 14:
70/***/ (function(module, exports) {
71
72module.exports = require("throttle-debounce/debounce");
73
74/***/ }),
75
76/***/ 2:
77/***/ (function(module, exports) {
78
79module.exports = require("element-ui/lib/utils/util");
80
81/***/ }),
82
83/***/ 20:
84/***/ (function(module, exports) {
85
86module.exports = require("element-ui/lib/utils/vdom");
87
88/***/ }),
89
90/***/ 207:
91/***/ (function(module, exports, __webpack_require__) {
92
93"use strict";
94
95
96exports.__esModule = true;
97
98var _main = __webpack_require__(208);
99
100var _main2 = _interopRequireDefault(_main);
101
102function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
103
104/* istanbul ignore next */
105_main2.default.install = function (Vue) {
106 Vue.component(_main2.default.name, _main2.default);
107};
108
109exports.default = _main2.default;
110
111/***/ }),
112
113/***/ 208:
114/***/ (function(module, exports, __webpack_require__) {
115
116"use strict";
117
118
119exports.__esModule = true;
120
121var _vuePopper = __webpack_require__(7);
122
123var _vuePopper2 = _interopRequireDefault(_vuePopper);
124
125var _debounce = __webpack_require__(14);
126
127var _debounce2 = _interopRequireDefault(_debounce);
128
129var _dom = __webpack_require__(3);
130
131var _vdom = __webpack_require__(20);
132
133var _util = __webpack_require__(2);
134
135var _vue = __webpack_require__(4);
136
137var _vue2 = _interopRequireDefault(_vue);
138
139function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
140
141exports.default = {
142 name: 'ElTooltip',
143
144 mixins: [_vuePopper2.default],
145
146 props: {
147 openDelay: {
148 type: Number,
149 default: 0
150 },
151 disabled: Boolean,
152 manual: Boolean,
153 effect: {
154 type: String,
155 default: 'dark'
156 },
157 arrowOffset: {
158 type: Number,
159 default: 0
160 },
161 popperClass: String,
162 content: String,
163 visibleArrow: {
164 default: true
165 },
166 transition: {
167 type: String,
168 default: 'el-fade-in-linear'
169 },
170 popperOptions: {
171 default: function _default() {
172 return {
173 boundariesPadding: 10,
174 gpuAcceleration: false
175 };
176 }
177 },
178 enterable: {
179 type: Boolean,
180 default: true
181 },
182 hideAfter: {
183 type: Number,
184 default: 0
185 }
186 },
187
188 data: function data() {
189 return {
190 timeoutPending: null,
191 focusing: false
192 };
193 },
194
195 computed: {
196 tooltipId: function tooltipId() {
197 return 'el-tooltip-' + (0, _util.generateId)();
198 }
199 },
200 beforeCreate: function beforeCreate() {
201 var _this = this;
202
203 if (this.$isServer) return;
204
205 this.popperVM = new _vue2.default({
206 data: { node: '' },
207 render: function render(h) {
208 return this.node;
209 }
210 }).$mount();
211
212 this.debounceClose = (0, _debounce2.default)(200, function () {
213 return _this.handleClosePopper();
214 });
215 },
216 render: function render(h) {
217 var _this2 = this;
218
219 if (this.popperVM) {
220 this.popperVM.node = h(
221 'transition',
222 {
223 attrs: {
224 name: this.transition
225 },
226 on: {
227 'afterLeave': this.doDestroy
228 }
229 },
230 [h(
231 'div',
232 {
233 on: {
234 'mouseleave': function mouseleave() {
235 _this2.setExpectedState(false);_this2.debounceClose();
236 },
237 'mouseenter': function mouseenter() {
238 _this2.setExpectedState(true);
239 }
240 },
241
242 ref: 'popper',
243 attrs: { role: 'tooltip',
244 id: this.tooltipId,
245 'aria-hidden': this.disabled || !this.showPopper ? 'true' : 'false'
246 },
247 directives: [{
248 name: 'show',
249 value: !this.disabled && this.showPopper
250 }],
251
252 'class': ['el-tooltip__popper', 'is-' + this.effect, this.popperClass] },
253 [this.$slots.content || this.content]
254 )]
255 );
256 }
257
258 if (!this.$slots.default || !this.$slots.default.length) return this.$slots.default;
259
260 var vnode = (0, _vdom.getFirstComponentChild)(this.$slots.default);
261
262 if (!vnode) return vnode;
263
264 var data = vnode.data = vnode.data || {};
265 data.staticClass = this.concatClass(data.staticClass, 'el-tooltip');
266
267 return vnode;
268 },
269 mounted: function mounted() {
270 var _this3 = this;
271
272 this.referenceElm = this.$el;
273 if (this.$el.nodeType === 1) {
274 this.$el.setAttribute('aria-describedby', this.tooltipId);
275 this.$el.setAttribute('tabindex', 0);
276 (0, _dom.on)(this.referenceElm, 'mouseenter', this.show);
277 (0, _dom.on)(this.referenceElm, 'mouseleave', this.hide);
278 (0, _dom.on)(this.referenceElm, 'focus', function () {
279 if (!_this3.$slots.default || !_this3.$slots.default.length) {
280 _this3.handleFocus();
281 return;
282 }
283 var instance = _this3.$slots.default[0].componentInstance;
284 if (instance && instance.focus) {
285 instance.focus();
286 } else {
287 _this3.handleFocus();
288 }
289 });
290 (0, _dom.on)(this.referenceElm, 'blur', this.handleBlur);
291 (0, _dom.on)(this.referenceElm, 'click', this.removeFocusing);
292 }
293 },
294
295 watch: {
296 focusing: function focusing(val) {
297 if (val) {
298 (0, _dom.addClass)(this.referenceElm, 'focusing');
299 } else {
300 (0, _dom.removeClass)(this.referenceElm, 'focusing');
301 }
302 }
303 },
304 methods: {
305 show: function show() {
306 this.setExpectedState(true);
307 this.handleShowPopper();
308 },
309 hide: function hide() {
310 this.setExpectedState(false);
311 this.debounceClose();
312 },
313 handleFocus: function handleFocus() {
314 this.focusing = true;
315 this.show();
316 },
317 handleBlur: function handleBlur() {
318 this.focusing = false;
319 this.hide();
320 },
321 removeFocusing: function removeFocusing() {
322 this.focusing = false;
323 },
324 concatClass: function concatClass(a, b) {
325 if (a && a.indexOf(b) > -1) return a;
326 return a ? b ? a + ' ' + b : a : b || '';
327 },
328 handleShowPopper: function handleShowPopper() {
329 var _this4 = this;
330
331 if (!this.expectedState || this.manual) return;
332 clearTimeout(this.timeout);
333 this.timeout = setTimeout(function () {
334 _this4.showPopper = true;
335 }, this.openDelay);
336
337 if (this.hideAfter > 0) {
338 this.timeoutPending = setTimeout(function () {
339 _this4.showPopper = false;
340 }, this.hideAfter);
341 }
342 },
343 handleClosePopper: function handleClosePopper() {
344 if (this.enterable && this.expectedState || this.manual) return;
345 clearTimeout(this.timeout);
346
347 if (this.timeoutPending) {
348 clearTimeout(this.timeoutPending);
349 }
350 this.showPopper = false;
351
352 if (this.disabled) {
353 this.doDestroy();
354 }
355 },
356 setExpectedState: function setExpectedState(expectedState) {
357 if (expectedState === false) {
358 clearTimeout(this.timeoutPending);
359 }
360 this.expectedState = expectedState;
361 }
362 },
363
364 destroyed: function destroyed() {
365 var reference = this.referenceElm;
366 (0, _dom.off)(reference, 'mouseenter', this.show);
367 (0, _dom.off)(reference, 'mouseleave', this.hide);
368 (0, _dom.off)(reference, 'focus', this.handleFocus);
369 (0, _dom.off)(reference, 'blur', this.handleBlur);
370 (0, _dom.off)(reference, 'click', this.removeFocusing);
371 }
372};
373
374/***/ }),
375
376/***/ 3:
377/***/ (function(module, exports) {
378
379module.exports = require("element-ui/lib/utils/dom");
380
381/***/ }),
382
383/***/ 4:
384/***/ (function(module, exports) {
385
386module.exports = require("vue");
387
388/***/ }),
389
390/***/ 7:
391/***/ (function(module, exports) {
392
393module.exports = require("element-ui/lib/utils/vue-popper");
394
395/***/ })
396
397/******/ });
\No newline at end of file