UNPKG

12.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, { enumerable: true, get: getter });
41/******/ }
42/******/ };
43/******/
44/******/ // define __esModule on exports
45/******/ __webpack_require__.r = function(exports) {
46/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
47/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
48/******/ }
49/******/ Object.defineProperty(exports, '__esModule', { value: true });
50/******/ };
51/******/
52/******/ // create a fake namespace object
53/******/ // mode & 1: value is a module id, require it
54/******/ // mode & 2: merge all properties of value into the ns
55/******/ // mode & 4: return value when already ns object
56/******/ // mode & 8|1: behave like require
57/******/ __webpack_require__.t = function(value, mode) {
58/******/ if(mode & 1) value = __webpack_require__(value);
59/******/ if(mode & 8) return value;
60/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
61/******/ var ns = Object.create(null);
62/******/ __webpack_require__.r(ns);
63/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
64/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
65/******/ return ns;
66/******/ };
67/******/
68/******/ // getDefaultExport function for compatibility with non-harmony modules
69/******/ __webpack_require__.n = function(module) {
70/******/ var getter = module && module.__esModule ?
71/******/ function getDefault() { return module['default']; } :
72/******/ function getModuleExports() { return module; };
73/******/ __webpack_require__.d(getter, 'a', getter);
74/******/ return getter;
75/******/ };
76/******/
77/******/ // Object.prototype.hasOwnProperty.call
78/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
79/******/
80/******/ // __webpack_public_path__
81/******/ __webpack_require__.p = "/dist/";
82/******/
83/******/
84/******/ // Load entry module and return exports
85/******/ return __webpack_require__(__webpack_require__.s = 127);
86/******/ })
87/************************************************************************/
88/******/ ({
89
90/***/ 127:
91/***/ (function(module, __webpack_exports__, __webpack_require__) {
92
93"use strict";
94__webpack_require__.r(__webpack_exports__);
95
96// EXTERNAL MODULE: external "element-ui/lib/utils/vue-popper"
97var vue_popper_ = __webpack_require__(5);
98var vue_popper_default = /*#__PURE__*/__webpack_require__.n(vue_popper_);
99
100// EXTERNAL MODULE: external "throttle-debounce/debounce"
101var debounce_ = __webpack_require__(15);
102var debounce_default = /*#__PURE__*/__webpack_require__.n(debounce_);
103
104// EXTERNAL MODULE: external "element-ui/lib/utils/dom"
105var dom_ = __webpack_require__(2);
106
107// EXTERNAL MODULE: external "element-ui/lib/utils/util"
108var util_ = __webpack_require__(3);
109
110// EXTERNAL MODULE: external "vue"
111var external_vue_ = __webpack_require__(7);
112var external_vue_default = /*#__PURE__*/__webpack_require__.n(external_vue_);
113
114// CONCATENATED MODULE: ./packages/tooltip/src/main.js
115
116
117
118
119
120
121/* harmony default export */ var main = ({
122 name: 'ElTooltip',
123
124 mixins: [vue_popper_default.a],
125
126 props: {
127 openDelay: {
128 type: Number,
129 default: 0
130 },
131 disabled: Boolean,
132 manual: Boolean,
133 effect: {
134 type: String,
135 default: 'dark'
136 },
137 arrowOffset: {
138 type: Number,
139 default: 0
140 },
141 popperClass: String,
142 content: String,
143 visibleArrow: {
144 default: true
145 },
146 transition: {
147 type: String,
148 default: 'el-fade-in-linear'
149 },
150 popperOptions: {
151 default: function _default() {
152 return {
153 boundariesPadding: 10,
154 gpuAcceleration: false
155 };
156 }
157 },
158 enterable: {
159 type: Boolean,
160 default: true
161 },
162 hideAfter: {
163 type: Number,
164 default: 0
165 },
166 tabindex: {
167 type: Number,
168 default: 0
169 }
170 },
171
172 data: function data() {
173 return {
174 tooltipId: 'el-tooltip-' + Object(util_["generateId"])(),
175 timeoutPending: null,
176 focusing: false
177 };
178 },
179 beforeCreate: function beforeCreate() {
180 var _this = this;
181
182 if (this.$isServer) return;
183
184 this.popperVM = new external_vue_default.a({
185 data: { node: '' },
186 render: function render(h) {
187 return this.node;
188 }
189 }).$mount();
190
191 this.debounceClose = debounce_default()(200, function () {
192 return _this.handleClosePopper();
193 });
194 },
195 render: function render(h) {
196 var _this2 = this;
197
198 if (this.popperVM) {
199 this.popperVM.node = h(
200 'transition',
201 {
202 attrs: {
203 name: this.transition
204 },
205 on: {
206 'afterLeave': this.doDestroy
207 }
208 },
209 [h(
210 'div',
211 {
212 on: {
213 'mouseleave': function mouseleave() {
214 _this2.setExpectedState(false);_this2.debounceClose();
215 },
216 'mouseenter': function mouseenter() {
217 _this2.setExpectedState(true);
218 }
219 },
220
221 ref: 'popper',
222 attrs: { role: 'tooltip',
223 id: this.tooltipId,
224 'aria-hidden': this.disabled || !this.showPopper ? 'true' : 'false'
225 },
226 directives: [{
227 name: 'show',
228 value: !this.disabled && this.showPopper
229 }],
230
231 'class': ['el-tooltip__popper', 'is-' + this.effect, this.popperClass] },
232 [this.$slots.content || this.content]
233 )]
234 );
235 }
236
237 var firstElement = this.getFirstElement();
238 if (!firstElement) return null;
239
240 var data = firstElement.data = firstElement.data || {};
241 data.staticClass = this.addTooltipClass(data.staticClass);
242
243 return firstElement;
244 },
245 mounted: function mounted() {
246 var _this3 = this;
247
248 this.referenceElm = this.$el;
249 if (this.$el.nodeType === 1) {
250 this.$el.setAttribute('aria-describedby', this.tooltipId);
251 this.$el.setAttribute('tabindex', this.tabindex);
252 Object(dom_["on"])(this.referenceElm, 'mouseenter', this.show);
253 Object(dom_["on"])(this.referenceElm, 'mouseleave', this.hide);
254 Object(dom_["on"])(this.referenceElm, 'focus', function () {
255 if (!_this3.$slots.default || !_this3.$slots.default.length) {
256 _this3.handleFocus();
257 return;
258 }
259 var instance = _this3.$slots.default[0].componentInstance;
260 if (instance && instance.focus) {
261 instance.focus();
262 } else {
263 _this3.handleFocus();
264 }
265 });
266 Object(dom_["on"])(this.referenceElm, 'blur', this.handleBlur);
267 Object(dom_["on"])(this.referenceElm, 'click', this.removeFocusing);
268 }
269 // fix issue https://github.com/ElemeFE/element/issues/14424
270 if (this.value && this.popperVM) {
271 this.popperVM.$nextTick(function () {
272 if (_this3.value) {
273 _this3.updatePopper();
274 }
275 });
276 }
277 },
278
279 watch: {
280 focusing: function focusing(val) {
281 if (val) {
282 Object(dom_["addClass"])(this.referenceElm, 'focusing');
283 } else {
284 Object(dom_["removeClass"])(this.referenceElm, 'focusing');
285 }
286 }
287 },
288 methods: {
289 show: function show() {
290 this.setExpectedState(true);
291 this.handleShowPopper();
292 },
293 hide: function hide() {
294 this.setExpectedState(false);
295 this.debounceClose();
296 },
297 handleFocus: function handleFocus() {
298 this.focusing = true;
299 this.show();
300 },
301 handleBlur: function handleBlur() {
302 this.focusing = false;
303 this.hide();
304 },
305 removeFocusing: function removeFocusing() {
306 this.focusing = false;
307 },
308 addTooltipClass: function addTooltipClass(prev) {
309 if (!prev) {
310 return 'el-tooltip';
311 } else {
312 return 'el-tooltip ' + prev.replace('el-tooltip', '');
313 }
314 },
315 handleShowPopper: function handleShowPopper() {
316 var _this4 = this;
317
318 if (!this.expectedState || this.manual) return;
319 clearTimeout(this.timeout);
320 this.timeout = setTimeout(function () {
321 _this4.showPopper = true;
322 }, this.openDelay);
323
324 if (this.hideAfter > 0) {
325 this.timeoutPending = setTimeout(function () {
326 _this4.showPopper = false;
327 }, this.hideAfter);
328 }
329 },
330 handleClosePopper: function handleClosePopper() {
331 if (this.enterable && this.expectedState || this.manual) return;
332 clearTimeout(this.timeout);
333
334 if (this.timeoutPending) {
335 clearTimeout(this.timeoutPending);
336 }
337 this.showPopper = false;
338
339 if (this.disabled) {
340 this.doDestroy();
341 }
342 },
343 setExpectedState: function setExpectedState(expectedState) {
344 if (expectedState === false) {
345 clearTimeout(this.timeoutPending);
346 }
347 this.expectedState = expectedState;
348 },
349 getFirstElement: function getFirstElement() {
350 var slots = this.$slots.default;
351 if (!Array.isArray(slots)) return null;
352 var element = null;
353 for (var index = 0; index < slots.length; index++) {
354 if (slots[index] && slots[index].tag) {
355 element = slots[index];
356 };
357 }
358 return element;
359 }
360 },
361
362 beforeDestroy: function beforeDestroy() {
363 this.popperVM && this.popperVM.$destroy();
364 },
365 destroyed: function destroyed() {
366 var reference = this.referenceElm;
367 if (reference.nodeType === 1) {
368 Object(dom_["off"])(reference, 'mouseenter', this.show);
369 Object(dom_["off"])(reference, 'mouseleave', this.hide);
370 Object(dom_["off"])(reference, 'focus', this.handleFocus);
371 Object(dom_["off"])(reference, 'blur', this.handleBlur);
372 Object(dom_["off"])(reference, 'click', this.removeFocusing);
373 }
374 }
375});
376// CONCATENATED MODULE: ./packages/tooltip/index.js
377
378
379/* istanbul ignore next */
380main.install = function (Vue) {
381 Vue.component(main.name, main);
382};
383
384/* harmony default export */ var tooltip = __webpack_exports__["default"] = (main);
385
386/***/ }),
387
388/***/ 15:
389/***/ (function(module, exports) {
390
391module.exports = require("throttle-debounce/debounce");
392
393/***/ }),
394
395/***/ 2:
396/***/ (function(module, exports) {
397
398module.exports = require("element-ui/lib/utils/dom");
399
400/***/ }),
401
402/***/ 3:
403/***/ (function(module, exports) {
404
405module.exports = require("element-ui/lib/utils/util");
406
407/***/ }),
408
409/***/ 5:
410/***/ (function(module, exports) {
411
412module.exports = require("element-ui/lib/utils/vue-popper");
413
414/***/ }),
415
416/***/ 7:
417/***/ (function(module, exports) {
418
419module.exports = require("vue");
420
421/***/ })
422
423/******/ });
\No newline at end of file