框架源码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

423 lines
12 KiB

4 years ago
  1. module.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 = 102);
  86. /******/ })
  87. /************************************************************************/
  88. /******/ ({
  89. /***/ 10:
  90. /***/ (function(module, exports) {
  91. module.exports = require("tis-ui/lib/utils/util");
  92. /***/ }),
  93. /***/ 102:
  94. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  95. "use strict";
  96. // ESM COMPAT FLAG
  97. __webpack_require__.r(__webpack_exports__);
  98. // EXTERNAL MODULE: external "tis-ui/lib/utils/vue-popper"
  99. var vue_popper_ = __webpack_require__(34);
  100. var vue_popper_default = /*#__PURE__*/__webpack_require__.n(vue_popper_);
  101. // EXTERNAL MODULE: external "throttle-debounce/debounce"
  102. var debounce_ = __webpack_require__(62);
  103. var debounce_default = /*#__PURE__*/__webpack_require__.n(debounce_);
  104. // EXTERNAL MODULE: external "tis-ui/lib/utils/dom"
  105. var dom_ = __webpack_require__(7);
  106. // EXTERNAL MODULE: external "tis-ui/lib/utils/util"
  107. var util_ = __webpack_require__(10);
  108. // EXTERNAL MODULE: external "vue"
  109. var external_vue_ = __webpack_require__(4);
  110. var external_vue_default = /*#__PURE__*/__webpack_require__.n(external_vue_);
  111. // CONCATENATED MODULE: ./packages/tooltip/src/main.js
  112. /* harmony default export */ var main = ({
  113. name: 'TisTooltip',
  114. mixins: [vue_popper_default.a],
  115. props: {
  116. openDelay: {
  117. type: Number,
  118. default: 0
  119. },
  120. disabled: Boolean,
  121. manual: Boolean,
  122. effect: {
  123. type: String,
  124. default: 'dark'
  125. },
  126. arrowOffset: {
  127. type: Number,
  128. default: 0
  129. },
  130. popperClass: String,
  131. content: String,
  132. visibleArrow: {
  133. default: true
  134. },
  135. transition: {
  136. type: String,
  137. default: 'el-fade-in-linear'
  138. },
  139. popperOptions: {
  140. default: function _default() {
  141. return {
  142. boundariesPadding: 10,
  143. gpuAcceleration: false
  144. };
  145. }
  146. },
  147. enterable: {
  148. type: Boolean,
  149. default: true
  150. },
  151. hideAfter: {
  152. type: Number,
  153. default: 0
  154. },
  155. tabindex: {
  156. type: Number,
  157. default: 0
  158. }
  159. },
  160. data: function data() {
  161. return {
  162. tooltipId: 'el-tooltip-' + Object(util_["generateId"])(),
  163. timeoutPending: null,
  164. focusing: false
  165. };
  166. },
  167. beforeCreate: function beforeCreate() {
  168. var _this = this;
  169. if (this.$isServer) return;
  170. this.popperVM = new external_vue_default.a({
  171. data: { node: '' },
  172. render: function render(h) {
  173. return this.node;
  174. }
  175. }).$mount();
  176. this.debounceClose = debounce_default()(200, function () {
  177. return _this.handleClosePopper();
  178. });
  179. },
  180. render: function render(h) {
  181. var _this2 = this;
  182. if (this.popperVM) {
  183. this.popperVM.node = h(
  184. 'transition',
  185. {
  186. attrs: {
  187. name: this.transition
  188. },
  189. on: {
  190. 'afterLeave': this.doDestroy
  191. }
  192. },
  193. [h(
  194. 'div',
  195. {
  196. on: {
  197. 'mouseleave': function mouseleave() {
  198. _this2.setExpectedState(false);_this2.debounceClose();
  199. },
  200. 'mouseenter': function mouseenter() {
  201. _this2.setExpectedState(true);
  202. }
  203. },
  204. ref: 'popper',
  205. attrs: { role: 'tooltip',
  206. id: this.tooltipId,
  207. 'aria-hidden': this.disabled || !this.showPopper ? 'true' : 'false'
  208. },
  209. directives: [{
  210. name: 'show',
  211. value: !this.disabled && this.showPopper
  212. }],
  213. 'class': ['el-tooltip__popper', 'is-' + this.effect, this.popperClass] },
  214. [this.$slots.content || this.content]
  215. )]
  216. );
  217. }
  218. var firstElement = this.getFirstElement();
  219. if (!firstElement) return null;
  220. var data = firstElement.data = firstElement.data || {};
  221. data.staticClass = this.addTooltipClass(data.staticClass);
  222. return firstElement;
  223. },
  224. mounted: function mounted() {
  225. var _this3 = this;
  226. this.referenceElm = this.$el;
  227. if (this.$el.nodeType === 1) {
  228. this.$el.setAttribute('aria-describedby', this.tooltipId);
  229. this.$el.setAttribute('tabindex', this.tabindex);
  230. Object(dom_["on"])(this.referenceElm, 'mouseenter', this.show);
  231. Object(dom_["on"])(this.referenceElm, 'mouseleave', this.hide);
  232. Object(dom_["on"])(this.referenceElm, 'focus', function () {
  233. if (!_this3.$slots.default || !_this3.$slots.default.length) {
  234. _this3.handleFocus();
  235. return;
  236. }
  237. var instance = _this3.$slots.default[0].componentInstance;
  238. if (instance && instance.focus) {
  239. instance.focus();
  240. } else {
  241. _this3.handleFocus();
  242. }
  243. });
  244. Object(dom_["on"])(this.referenceElm, 'blur', this.handleBlur);
  245. Object(dom_["on"])(this.referenceElm, 'click', this.removeFocusing);
  246. }
  247. // fix issue https://github.com/ElemeFE/element/issues/14424
  248. if (this.value && this.popperVM) {
  249. this.popperVM.$nextTick(function () {
  250. if (_this3.value) {
  251. _this3.updatePopper();
  252. }
  253. });
  254. }
  255. },
  256. watch: {
  257. focusing: function focusing(val) {
  258. if (val) {
  259. Object(dom_["addClass"])(this.referenceElm, 'focusing');
  260. } else {
  261. Object(dom_["removeClass"])(this.referenceElm, 'focusing');
  262. }
  263. }
  264. },
  265. methods: {
  266. show: function show() {
  267. this.setExpectedState(true);
  268. this.handleShowPopper();
  269. },
  270. hide: function hide() {
  271. this.setExpectedState(false);
  272. this.debounceClose();
  273. },
  274. handleFocus: function handleFocus() {
  275. this.focusing = true;
  276. this.show();
  277. },
  278. handleBlur: function handleBlur() {
  279. this.focusing = false;
  280. this.hide();
  281. },
  282. removeFocusing: function removeFocusing() {
  283. this.focusing = false;
  284. },
  285. addTooltipClass: function addTooltipClass(prev) {
  286. if (!prev) {
  287. return 'el-tooltip';
  288. } else {
  289. return 'el-tooltip ' + prev.replace('el-tooltip', '');
  290. }
  291. },
  292. handleShowPopper: function handleShowPopper() {
  293. var _this4 = this;
  294. if (!this.expectedState || this.manual) return;
  295. clearTimeout(this.timeout);
  296. this.timeout = setTimeout(function () {
  297. _this4.showPopper = true;
  298. }, this.openDelay);
  299. if (this.hideAfter > 0) {
  300. this.timeoutPending = setTimeout(function () {
  301. _this4.showPopper = false;
  302. }, this.hideAfter);
  303. }
  304. },
  305. handleClosePopper: function handleClosePopper() {
  306. if (this.enterable && this.expectedState || this.manual) return;
  307. clearTimeout(this.timeout);
  308. if (this.timeoutPending) {
  309. clearTimeout(this.timeoutPending);
  310. }
  311. this.showPopper = false;
  312. if (this.disabled) {
  313. this.doDestroy();
  314. }
  315. },
  316. setExpectedState: function setExpectedState(expectedState) {
  317. if (expectedState === false) {
  318. clearTimeout(this.timeoutPending);
  319. }
  320. this.expectedState = expectedState;
  321. },
  322. getFirstElement: function getFirstElement() {
  323. var slots = this.$slots.default;
  324. if (!Array.isArray(slots)) return null;
  325. var element = null;
  326. for (var index = 0; index < slots.length; index++) {
  327. if (slots[index] && slots[index].tag) {
  328. element = slots[index];
  329. };
  330. }
  331. return element;
  332. }
  333. },
  334. beforeDestroy: function beforeDestroy() {
  335. this.popperVM && this.popperVM.$destroy();
  336. },
  337. destroyed: function destroyed() {
  338. var reference = this.referenceElm;
  339. if (reference.nodeType === 1) {
  340. Object(dom_["off"])(reference, 'mouseenter', this.show);
  341. Object(dom_["off"])(reference, 'mouseleave', this.hide);
  342. Object(dom_["off"])(reference, 'focus', this.handleFocus);
  343. Object(dom_["off"])(reference, 'blur', this.handleBlur);
  344. Object(dom_["off"])(reference, 'click', this.removeFocusing);
  345. }
  346. }
  347. });
  348. // CONCATENATED MODULE: ./packages/tooltip/index.js
  349. /* istanbul ignore next */
  350. main.install = function (Vue) {
  351. Vue.component(main.name, main);
  352. };
  353. /* harmony default export */ var tooltip = __webpack_exports__["default"] = (main);
  354. /***/ }),
  355. /***/ 34:
  356. /***/ (function(module, exports) {
  357. module.exports = require("tis-ui/lib/utils/vue-popper");
  358. /***/ }),
  359. /***/ 4:
  360. /***/ (function(module, exports) {
  361. module.exports = require("vue");
  362. /***/ }),
  363. /***/ 62:
  364. /***/ (function(module, exports) {
  365. module.exports = require("throttle-debounce/debounce");
  366. /***/ }),
  367. /***/ 7:
  368. /***/ (function(module, exports) {
  369. module.exports = require("tis-ui/lib/utils/dom");
  370. /***/ })
  371. /******/ });