框架源码
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.

621 lines
18 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 = 154);
  86. /******/ })
  87. /************************************************************************/
  88. /******/ ({
  89. /***/ 10:
  90. /***/ (function(module, exports) {
  91. module.exports = require("tis-ui/lib/utils/util");
  92. /***/ }),
  93. /***/ 154:
  94. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  95. "use strict";
  96. // ESM COMPAT FLAG
  97. __webpack_require__.r(__webpack_exports__);
  98. // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/popover/src/main.vue?vue&type=template&id=52060272&
  99. var render = function() {
  100. var _vm = this
  101. var _h = _vm.$createElement
  102. var _c = _vm._self._c || _h
  103. return _c(
  104. "span",
  105. [
  106. _c(
  107. "transition",
  108. {
  109. attrs: { name: _vm.transition },
  110. on: {
  111. "after-enter": _vm.handleAfterEnter,
  112. "after-leave": _vm.handleAfterLeave
  113. }
  114. },
  115. [
  116. _c(
  117. "div",
  118. {
  119. directives: [
  120. {
  121. name: "show",
  122. rawName: "v-show",
  123. value: !_vm.disabled && _vm.showPopper,
  124. expression: "!disabled && showPopper"
  125. }
  126. ],
  127. ref: "popper",
  128. staticClass: "el-popover el-popper",
  129. class: [_vm.popperClass, _vm.content && "el-popover--plain"],
  130. style: { width: _vm.width + "px" },
  131. attrs: {
  132. role: "tooltip",
  133. id: _vm.tooltipId,
  134. "aria-hidden":
  135. _vm.disabled || !_vm.showPopper ? "true" : "false"
  136. }
  137. },
  138. [
  139. _vm.title
  140. ? _c("div", {
  141. staticClass: "el-popover__title",
  142. domProps: { textContent: _vm._s(_vm.title) }
  143. })
  144. : _vm._e(),
  145. _vm._t("default", [_vm._v(_vm._s(_vm.content))])
  146. ],
  147. 2
  148. )
  149. ]
  150. ),
  151. _c(
  152. "span",
  153. { ref: "wrapper", staticClass: "el-popover__reference-wrapper" },
  154. [_vm._t("reference")],
  155. 2
  156. )
  157. ],
  158. 1
  159. )
  160. }
  161. var staticRenderFns = []
  162. render._withStripped = true
  163. // CONCATENATED MODULE: ./packages/popover/src/main.vue?vue&type=template&id=52060272&
  164. // EXTERNAL MODULE: external "tis-ui/lib/utils/vue-popper"
  165. var vue_popper_ = __webpack_require__(34);
  166. var vue_popper_default = /*#__PURE__*/__webpack_require__.n(vue_popper_);
  167. // EXTERNAL MODULE: external "tis-ui/lib/utils/dom"
  168. var dom_ = __webpack_require__(7);
  169. // EXTERNAL MODULE: external "tis-ui/lib/utils/util"
  170. var util_ = __webpack_require__(10);
  171. // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/popover/src/main.vue?vue&type=script&lang=js&
  172. //
  173. //
  174. //
  175. //
  176. //
  177. //
  178. //
  179. //
  180. //
  181. //
  182. //
  183. //
  184. //
  185. //
  186. //
  187. //
  188. //
  189. //
  190. //
  191. //
  192. //
  193. //
  194. //
  195. //
  196. //
  197. /* harmony default export */ var mainvue_type_script_lang_js_ = ({
  198. name: 'TisPopover',
  199. mixins: [vue_popper_default.a],
  200. props: {
  201. trigger: {
  202. type: String,
  203. default: 'click',
  204. validator: function validator(value) {
  205. return ['click', 'focus', 'hover', 'manual'].indexOf(value) > -1;
  206. }
  207. },
  208. openDelay: {
  209. type: Number,
  210. default: 0
  211. },
  212. closeDelay: {
  213. type: Number,
  214. default: 200
  215. },
  216. title: String,
  217. disabled: Boolean,
  218. content: String,
  219. reference: {},
  220. popperClass: String,
  221. width: {},
  222. visibleArrow: {
  223. default: true
  224. },
  225. arrowOffset: {
  226. type: Number,
  227. default: 0
  228. },
  229. transition: {
  230. type: String,
  231. default: 'fade-in-linear'
  232. },
  233. tabindex: {
  234. type: Number,
  235. default: 0
  236. }
  237. },
  238. computed: {
  239. tooltipId: function tooltipId() {
  240. return 'el-popover-' + Object(util_["generateId"])();
  241. }
  242. },
  243. watch: {
  244. showPopper: function showPopper(val) {
  245. if (this.disabled) {
  246. return;
  247. }
  248. val ? this.$emit('show') : this.$emit('hide');
  249. }
  250. },
  251. mounted: function mounted() {
  252. var _this = this;
  253. var reference = this.referenceElm = this.reference || this.$refs.reference;
  254. var popper = this.popper || this.$refs.popper;
  255. if (!reference && this.$refs.wrapper.children) {
  256. reference = this.referenceElm = this.$refs.wrapper.children[0];
  257. }
  258. // 可访问性
  259. if (reference) {
  260. Object(dom_["addClass"])(reference, 'el-popover__reference');
  261. reference.setAttribute('aria-describedby', this.tooltipId);
  262. reference.setAttribute('tabindex', this.tabindex); // tab序列
  263. popper.setAttribute('tabindex', 0);
  264. if (this.trigger !== 'click') {
  265. Object(dom_["on"])(reference, 'focusin', function () {
  266. _this.handleFocus();
  267. var instance = reference.__vue__;
  268. if (instance && typeof instance.focus === 'function') {
  269. instance.focus();
  270. }
  271. });
  272. Object(dom_["on"])(popper, 'focusin', this.handleFocus);
  273. Object(dom_["on"])(reference, 'focusout', this.handleBlur);
  274. Object(dom_["on"])(popper, 'focusout', this.handleBlur);
  275. }
  276. Object(dom_["on"])(reference, 'keydown', this.handleKeydown);
  277. Object(dom_["on"])(reference, 'click', this.handleClick);
  278. }
  279. if (this.trigger === 'click') {
  280. Object(dom_["on"])(reference, 'click', this.doToggle);
  281. Object(dom_["on"])(document, 'click', this.handleDocumentClick);
  282. } else if (this.trigger === 'hover') {
  283. Object(dom_["on"])(reference, 'mouseenter', this.handleMouseEnter);
  284. Object(dom_["on"])(popper, 'mouseenter', this.handleMouseEnter);
  285. Object(dom_["on"])(reference, 'mouseleave', this.handleMouseLeave);
  286. Object(dom_["on"])(popper, 'mouseleave', this.handleMouseLeave);
  287. } else if (this.trigger === 'focus') {
  288. if (this.tabindex < 0) {
  289. console.warn('[Element Warn][Popover]a negative taindex means that the element cannot be focused by tab key');
  290. }
  291. if (reference.querySelector('input, textarea')) {
  292. Object(dom_["on"])(reference, 'focusin', this.doShow);
  293. Object(dom_["on"])(reference, 'focusout', this.doClose);
  294. } else {
  295. Object(dom_["on"])(reference, 'mousedown', this.doShow);
  296. Object(dom_["on"])(reference, 'mouseup', this.doClose);
  297. }
  298. }
  299. },
  300. beforeDestroy: function beforeDestroy() {
  301. this.cleanup();
  302. },
  303. deactivated: function deactivated() {
  304. this.cleanup();
  305. },
  306. methods: {
  307. doToggle: function doToggle() {
  308. this.showPopper = !this.showPopper;
  309. },
  310. doShow: function doShow() {
  311. this.showPopper = true;
  312. },
  313. doClose: function doClose() {
  314. this.showPopper = false;
  315. },
  316. handleFocus: function handleFocus() {
  317. Object(dom_["addClass"])(this.referenceElm, 'focusing');
  318. if (this.trigger === 'click' || this.trigger === 'focus') this.showPopper = true;
  319. },
  320. handleClick: function handleClick() {
  321. Object(dom_["removeClass"])(this.referenceElm, 'focusing');
  322. },
  323. handleBlur: function handleBlur() {
  324. Object(dom_["removeClass"])(this.referenceElm, 'focusing');
  325. if (this.trigger === 'click' || this.trigger === 'focus') this.showPopper = false;
  326. },
  327. handleMouseEnter: function handleMouseEnter() {
  328. var _this2 = this;
  329. clearTimeout(this._timer);
  330. if (this.openDelay) {
  331. this._timer = setTimeout(function () {
  332. _this2.showPopper = true;
  333. }, this.openDelay);
  334. } else {
  335. this.showPopper = true;
  336. }
  337. },
  338. handleKeydown: function handleKeydown(ev) {
  339. if (ev.keyCode === 27 && this.trigger !== 'manual') {
  340. // esc
  341. this.doClose();
  342. }
  343. },
  344. handleMouseLeave: function handleMouseLeave() {
  345. var _this3 = this;
  346. clearTimeout(this._timer);
  347. if (this.closeDelay) {
  348. this._timer = setTimeout(function () {
  349. _this3.showPopper = false;
  350. }, this.closeDelay);
  351. } else {
  352. this.showPopper = false;
  353. }
  354. },
  355. handleDocumentClick: function handleDocumentClick(e) {
  356. var reference = this.reference || this.$refs.reference;
  357. var popper = this.popper || this.$refs.popper;
  358. if (!reference && this.$refs.wrapper.children) {
  359. reference = this.referenceElm = this.$refs.wrapper.children[0];
  360. }
  361. if (!this.$el || !reference || this.$el.contains(e.target) || reference.contains(e.target) || !popper || popper.contains(e.target)) return;
  362. this.showPopper = false;
  363. },
  364. handleAfterEnter: function handleAfterEnter() {
  365. this.$emit('after-enter');
  366. },
  367. handleAfterLeave: function handleAfterLeave() {
  368. this.$emit('after-leave');
  369. this.doDestroy();
  370. },
  371. cleanup: function cleanup() {
  372. if (this.openDelay || this.closeDelay) {
  373. clearTimeout(this._timer);
  374. }
  375. }
  376. },
  377. destroyed: function destroyed() {
  378. var reference = this.reference;
  379. Object(dom_["off"])(reference, 'click', this.doToggle);
  380. Object(dom_["off"])(reference, 'mouseup', this.doClose);
  381. Object(dom_["off"])(reference, 'mousedown', this.doShow);
  382. Object(dom_["off"])(reference, 'focusin', this.doShow);
  383. Object(dom_["off"])(reference, 'focusout', this.doClose);
  384. Object(dom_["off"])(reference, 'mousedown', this.doShow);
  385. Object(dom_["off"])(reference, 'mouseup', this.doClose);
  386. Object(dom_["off"])(reference, 'mouseleave', this.handleMouseLeave);
  387. Object(dom_["off"])(reference, 'mouseenter', this.handleMouseEnter);
  388. Object(dom_["off"])(document, 'click', this.handleDocumentClick);
  389. }
  390. });
  391. // CONCATENATED MODULE: ./packages/popover/src/main.vue?vue&type=script&lang=js&
  392. /* harmony default export */ var src_mainvue_type_script_lang_js_ = (mainvue_type_script_lang_js_);
  393. // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
  394. var componentNormalizer = __webpack_require__(2);
  395. // CONCATENATED MODULE: ./packages/popover/src/main.vue
  396. /* normalize component */
  397. var component = Object(componentNormalizer["a" /* default */])(
  398. src_mainvue_type_script_lang_js_,
  399. render,
  400. staticRenderFns,
  401. false,
  402. null,
  403. null,
  404. null
  405. )
  406. /* hot reload */
  407. if (false) { var api; }
  408. component.options.__file = "packages/popover/src/main.vue"
  409. /* harmony default export */ var main = (component.exports);
  410. // CONCATENATED MODULE: ./packages/popover/src/directive.js
  411. var getReference = function getReference(el, binding, vnode) {
  412. var _ref = binding.expression ? binding.value : binding.arg;
  413. var popper = vnode.context.$refs[_ref];
  414. if (popper) {
  415. if (Array.isArray(popper)) {
  416. popper[0].$refs.reference = el;
  417. } else {
  418. popper.$refs.reference = el;
  419. }
  420. }
  421. };
  422. /* harmony default export */ var directive = ({
  423. bind: function bind(el, binding, vnode) {
  424. getReference(el, binding, vnode);
  425. },
  426. inserted: function inserted(el, binding, vnode) {
  427. getReference(el, binding, vnode);
  428. }
  429. });
  430. // EXTERNAL MODULE: external "vue"
  431. var external_vue_ = __webpack_require__(4);
  432. var external_vue_default = /*#__PURE__*/__webpack_require__.n(external_vue_);
  433. // CONCATENATED MODULE: ./packages/popover/index.js
  434. external_vue_default.a.directive('popover', directive);
  435. /* istanbul ignore next */
  436. main.install = function (Vue) {
  437. Vue.directive('popover', directive);
  438. Vue.component(main.name, main);
  439. };
  440. main.directive = directive;
  441. /* harmony default export */ var popover = __webpack_exports__["default"] = (main);
  442. /***/ }),
  443. /***/ 2:
  444. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  445. "use strict";
  446. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return normalizeComponent; });
  447. /* globals __VUE_SSR_CONTEXT__ */
  448. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  449. // This module is a runtime utility for cleaner component module output and will
  450. // be included in the final webpack user bundle.
  451. function normalizeComponent (
  452. scriptExports,
  453. render,
  454. staticRenderFns,
  455. functionalTemplate,
  456. injectStyles,
  457. scopeId,
  458. moduleIdentifier, /* server only */
  459. shadowMode /* vue-cli only */
  460. ) {
  461. // Vue.extend constructor export interop
  462. var options = typeof scriptExports === 'function'
  463. ? scriptExports.options
  464. : scriptExports
  465. // render functions
  466. if (render) {
  467. options.render = render
  468. options.staticRenderFns = staticRenderFns
  469. options._compiled = true
  470. }
  471. // functional template
  472. if (functionalTemplate) {
  473. options.functional = true
  474. }
  475. // scopedId
  476. if (scopeId) {
  477. options._scopeId = 'data-v-' + scopeId
  478. }
  479. var hook
  480. if (moduleIdentifier) { // server build
  481. hook = function (context) {
  482. // 2.3 injection
  483. context =
  484. context || // cached call
  485. (this.$vnode && this.$vnode.ssrContext) || // stateful
  486. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  487. // 2.2 with runInNewContext: true
  488. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  489. context = __VUE_SSR_CONTEXT__
  490. }
  491. // inject component styles
  492. if (injectStyles) {
  493. injectStyles.call(this, context)
  494. }
  495. // register component module identifier for async chunk inferrence
  496. if (context && context._registeredComponents) {
  497. context._registeredComponents.add(moduleIdentifier)
  498. }
  499. }
  500. // used by ssr in case component is cached and beforeCreate
  501. // never gets called
  502. options._ssrRegister = hook
  503. } else if (injectStyles) {
  504. hook = shadowMode
  505. ? function () {
  506. injectStyles.call(
  507. this,
  508. (options.functional ? this.parent : this).$root.$options.shadowRoot
  509. )
  510. }
  511. : injectStyles
  512. }
  513. if (hook) {
  514. if (options.functional) {
  515. // for template-only hot-reload because in that case the render fn doesn't
  516. // go through the normalizer
  517. options._injectStyles = hook
  518. // register for functional component in vue file
  519. var originalRender = options.render
  520. options.render = function renderWithStyleInjection (h, context) {
  521. hook.call(context)
  522. return originalRender(h, context)
  523. }
  524. } else {
  525. // inject component registration as beforeCreate hook
  526. var existing = options.beforeCreate
  527. options.beforeCreate = existing
  528. ? [].concat(existing, hook)
  529. : [hook]
  530. }
  531. }
  532. return {
  533. exports: scriptExports,
  534. options: options
  535. }
  536. }
  537. /***/ }),
  538. /***/ 34:
  539. /***/ (function(module, exports) {
  540. module.exports = require("tis-ui/lib/utils/vue-popper");
  541. /***/ }),
  542. /***/ 4:
  543. /***/ (function(module, exports) {
  544. module.exports = require("vue");
  545. /***/ }),
  546. /***/ 7:
  547. /***/ (function(module, exports) {
  548. module.exports = require("tis-ui/lib/utils/dom");
  549. /***/ })
  550. /******/ });