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

705 lines
21 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 = 574);
  86. /******/ })
  87. /************************************************************************/
  88. /******/ ({
  89. /***/ 13:
  90. /***/ (function(module, exports) {
  91. module.exports = require("tis-ui/lib/mixins/emitter");
  92. /***/ }),
  93. /***/ 134:
  94. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  95. "use strict";
  96. /* harmony default export */ __webpack_exports__["a"] = ({
  97. inject: ['rootMenu'],
  98. computed: {
  99. indexPath: function indexPath() {
  100. var path = [this.index];
  101. var parent = this.$parent;
  102. while (parent.$options.componentName !== 'TisMenu') {
  103. if (parent.index) {
  104. path.unshift(parent.index);
  105. }
  106. parent = parent.$parent;
  107. }
  108. return path;
  109. },
  110. parentMenu: function parentMenu() {
  111. var parent = this.$parent;
  112. while (parent && ['TisMenu', 'TisSubmenu'].indexOf(parent.$options.componentName) === -1) {
  113. parent = parent.$parent;
  114. }
  115. return parent;
  116. },
  117. paddingStyle: function paddingStyle() {
  118. if (this.rootMenu.mode !== 'vertical') return {};
  119. var padding = 20;
  120. var parent = this.$parent;
  121. if (this.rootMenu.collapse) {
  122. padding = 20;
  123. } else {
  124. while (parent && parent.$options.componentName !== 'TisMenu') {
  125. if (parent.$options.componentName === 'TisSubmenu') {
  126. padding += 20;
  127. }
  128. parent = parent.$parent;
  129. }
  130. }
  131. return { paddingLeft: padding + 'px' };
  132. }
  133. }
  134. });
  135. /***/ }),
  136. /***/ 2:
  137. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  138. "use strict";
  139. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return normalizeComponent; });
  140. /* globals __VUE_SSR_CONTEXT__ */
  141. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  142. // This module is a runtime utility for cleaner component module output and will
  143. // be included in the final webpack user bundle.
  144. function normalizeComponent (
  145. scriptExports,
  146. render,
  147. staticRenderFns,
  148. functionalTemplate,
  149. injectStyles,
  150. scopeId,
  151. moduleIdentifier, /* server only */
  152. shadowMode /* vue-cli only */
  153. ) {
  154. // Vue.extend constructor export interop
  155. var options = typeof scriptExports === 'function'
  156. ? scriptExports.options
  157. : scriptExports
  158. // render functions
  159. if (render) {
  160. options.render = render
  161. options.staticRenderFns = staticRenderFns
  162. options._compiled = true
  163. }
  164. // functional template
  165. if (functionalTemplate) {
  166. options.functional = true
  167. }
  168. // scopedId
  169. if (scopeId) {
  170. options._scopeId = 'data-v-' + scopeId
  171. }
  172. var hook
  173. if (moduleIdentifier) { // server build
  174. hook = function (context) {
  175. // 2.3 injection
  176. context =
  177. context || // cached call
  178. (this.$vnode && this.$vnode.ssrContext) || // stateful
  179. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  180. // 2.2 with runInNewContext: true
  181. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  182. context = __VUE_SSR_CONTEXT__
  183. }
  184. // inject component styles
  185. if (injectStyles) {
  186. injectStyles.call(this, context)
  187. }
  188. // register component module identifier for async chunk inferrence
  189. if (context && context._registeredComponents) {
  190. context._registeredComponents.add(moduleIdentifier)
  191. }
  192. }
  193. // used by ssr in case component is cached and beforeCreate
  194. // never gets called
  195. options._ssrRegister = hook
  196. } else if (injectStyles) {
  197. hook = shadowMode
  198. ? function () {
  199. injectStyles.call(
  200. this,
  201. (options.functional ? this.parent : this).$root.$options.shadowRoot
  202. )
  203. }
  204. : injectStyles
  205. }
  206. if (hook) {
  207. if (options.functional) {
  208. // for template-only hot-reload because in that case the render fn doesn't
  209. // go through the normalizer
  210. options._injectStyles = hook
  211. // register for functional component in vue file
  212. var originalRender = options.render
  213. options.render = function renderWithStyleInjection (h, context) {
  214. hook.call(context)
  215. return originalRender(h, context)
  216. }
  217. } else {
  218. // inject component registration as beforeCreate hook
  219. var existing = options.beforeCreate
  220. options.beforeCreate = existing
  221. ? [].concat(existing, hook)
  222. : [hook]
  223. }
  224. }
  225. return {
  226. exports: scriptExports,
  227. options: options
  228. }
  229. }
  230. /***/ }),
  231. /***/ 34:
  232. /***/ (function(module, exports) {
  233. module.exports = require("tis-ui/lib/utils/vue-popper");
  234. /***/ }),
  235. /***/ 574:
  236. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  237. "use strict";
  238. // ESM COMPAT FLAG
  239. __webpack_require__.r(__webpack_exports__);
  240. // EXTERNAL MODULE: external "tis-ui/lib/transitions/collapse-transition"
  241. var collapse_transition_ = __webpack_require__(98);
  242. var collapse_transition_default = /*#__PURE__*/__webpack_require__.n(collapse_transition_);
  243. // EXTERNAL MODULE: ./packages/menu/src/menu-mixin.js
  244. var menu_mixin = __webpack_require__(134);
  245. // EXTERNAL MODULE: external "tis-ui/lib/mixins/emitter"
  246. var emitter_ = __webpack_require__(13);
  247. var emitter_default = /*#__PURE__*/__webpack_require__.n(emitter_);
  248. // EXTERNAL MODULE: external "tis-ui/lib/utils/vue-popper"
  249. var vue_popper_ = __webpack_require__(34);
  250. var vue_popper_default = /*#__PURE__*/__webpack_require__.n(vue_popper_);
  251. // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/menu/src/submenu.vue?vue&type=script&lang=js&
  252. var poperMixins = {
  253. props: {
  254. transformOrigin: {
  255. type: [Boolean, String],
  256. default: false
  257. },
  258. offset: vue_popper_default.a.props.offset,
  259. boundariesPadding: vue_popper_default.a.props.boundariesPadding,
  260. popperOptions: vue_popper_default.a.props.popperOptions
  261. },
  262. data: vue_popper_default.a.data,
  263. methods: vue_popper_default.a.methods,
  264. beforeDestroy: vue_popper_default.a.beforeDestroy,
  265. deactivated: vue_popper_default.a.deactivated
  266. };
  267. /* harmony default export */ var submenuvue_type_script_lang_js_ = ({
  268. name: 'TisSubmenu',
  269. componentName: 'TisSubmenu',
  270. mixins: [menu_mixin["a" /* default */], emitter_default.a, poperMixins],
  271. components: { TisCollapseTransition: collapse_transition_default.a },
  272. props: {
  273. index: {
  274. type: String,
  275. required: true
  276. },
  277. showTimeout: {
  278. type: Number,
  279. default: 300
  280. },
  281. hideTimeout: {
  282. type: Number,
  283. default: 300
  284. },
  285. popperClass: String,
  286. disabled: Boolean,
  287. popperAppendToBody: {
  288. type: Boolean,
  289. default: undefined
  290. }
  291. },
  292. data: function data() {
  293. return {
  294. popperJS: null,
  295. timeout: null,
  296. items: {},
  297. submenus: {},
  298. mouseInChild: false
  299. };
  300. },
  301. watch: {
  302. opened: function opened(val) {
  303. var _this = this;
  304. if (this.isMenuPopup) {
  305. this.$nextTick(function (_) {
  306. _this.updatePopper();
  307. });
  308. }
  309. }
  310. },
  311. computed: {
  312. // popper option
  313. appendToBody: function appendToBody() {
  314. return this.popperAppendToBody === undefined ? this.isFirstLevel : this.popperAppendToBody;
  315. },
  316. menuTransitionName: function menuTransitionName() {
  317. return this.rootMenu.collapse ? 'el-zoom-in-left' : 'el-zoom-in-top';
  318. },
  319. opened: function opened() {
  320. return this.rootMenu.openedMenus.indexOf(this.index) > -1;
  321. },
  322. active: function active() {
  323. var isActive = false;
  324. var submenus = this.submenus;
  325. var items = this.items;
  326. Object.keys(items).forEach(function (index) {
  327. if (items[index].active) {
  328. isActive = true;
  329. }
  330. });
  331. Object.keys(submenus).forEach(function (index) {
  332. if (submenus[index].active) {
  333. isActive = true;
  334. }
  335. });
  336. return isActive;
  337. },
  338. hoverBackground: function hoverBackground() {
  339. return this.rootMenu.hoverBackground;
  340. },
  341. backgroundColor: function backgroundColor() {
  342. return this.rootMenu.backgroundColor || '';
  343. },
  344. activeTextColor: function activeTextColor() {
  345. return this.rootMenu.activeTextColor || '';
  346. },
  347. textColor: function textColor() {
  348. return this.rootMenu.textColor || '';
  349. },
  350. mode: function mode() {
  351. return this.rootMenu.mode;
  352. },
  353. isMenuPopup: function isMenuPopup() {
  354. return this.rootMenu.isMenuPopup;
  355. },
  356. titleStyle: function titleStyle() {
  357. if (this.mode !== 'horizontal') {
  358. return {
  359. color: this.textColor
  360. };
  361. }
  362. return {
  363. borderBottomColor: this.active ? this.rootMenu.activeTextColor ? this.activeTextColor : '' : 'transparent',
  364. color: this.active ? this.activeTextColor : this.textColor
  365. };
  366. },
  367. isFirstLevel: function isFirstLevel() {
  368. var isFirstLevel = true;
  369. var parent = this.$parent;
  370. while (parent && parent !== this.rootMenu) {
  371. if (['TisSubmenu', 'TisMenuItemGroup'].indexOf(parent.$options.componentName) > -1) {
  372. isFirstLevel = false;
  373. break;
  374. } else {
  375. parent = parent.$parent;
  376. }
  377. }
  378. return isFirstLevel;
  379. }
  380. },
  381. methods: {
  382. handleCollapseToggle: function handleCollapseToggle(value) {
  383. if (value) {
  384. this.initPopper();
  385. } else {
  386. this.doDestroy();
  387. }
  388. },
  389. addItem: function addItem(item) {
  390. this.$set(this.items, item.index, item);
  391. },
  392. removeItem: function removeItem(item) {
  393. delete this.items[item.index];
  394. },
  395. addSubmenu: function addSubmenu(item) {
  396. this.$set(this.submenus, item.index, item);
  397. },
  398. removeSubmenu: function removeSubmenu(item) {
  399. delete this.submenus[item.index];
  400. },
  401. handleClick: function handleClick() {
  402. var rootMenu = this.rootMenu,
  403. disabled = this.disabled;
  404. if (rootMenu.menuTrigger === 'hover' && rootMenu.mode === 'horizontal' || rootMenu.collapse && rootMenu.mode === 'vertical' || disabled) {
  405. return;
  406. }
  407. this.dispatch('TisMenu', 'submenu-click', this);
  408. },
  409. handleMouseenter: function handleMouseenter(event) {
  410. var _this2 = this;
  411. var showTimeout = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.showTimeout;
  412. if (!('ActiveXObject' in window) && event.type === 'focus' && !event.relatedTarget) {
  413. return;
  414. }
  415. var rootMenu = this.rootMenu,
  416. disabled = this.disabled;
  417. if (rootMenu.menuTrigger === 'click' && rootMenu.mode === 'horizontal' || !rootMenu.collapse && rootMenu.mode === 'vertical' || disabled) {
  418. return;
  419. }
  420. this.dispatch('TisSubmenu', 'mouse-enter-child');
  421. clearTimeout(this.timeout);
  422. this.timeout = setTimeout(function () {
  423. _this2.rootMenu.openMenu(_this2.index, _this2.indexPath);
  424. }, showTimeout);
  425. if (this.appendToBody) {
  426. this.$parent.$el.dispatchEvent(new MouseEvent('mouseenter'));
  427. }
  428. },
  429. handleMouseleave: function handleMouseleave() {
  430. var _this3 = this;
  431. var deepDispatch = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  432. var rootMenu = this.rootMenu;
  433. if (rootMenu.menuTrigger === 'click' && rootMenu.mode === 'horizontal' || !rootMenu.collapse && rootMenu.mode === 'vertical') {
  434. return;
  435. }
  436. this.dispatch('TisSubmenu', 'mouse-leave-child');
  437. clearTimeout(this.timeout);
  438. this.timeout = setTimeout(function () {
  439. !_this3.mouseInChild && _this3.rootMenu.closeMenu(_this3.index);
  440. }, this.hideTimeout);
  441. if (this.appendToBody && deepDispatch) {
  442. if (this.$parent.$options.name === 'TisSubmenu') {
  443. this.$parent.handleMouseleave(true);
  444. }
  445. }
  446. },
  447. handleTitleMouseenter: function handleTitleMouseenter() {
  448. if (this.mode === 'horizontal' && !this.rootMenu.backgroundColor) return;
  449. var title = this.$refs['submenu-title'];
  450. title && (title.style.backgroundColor = this.rootMenu.hoverBackground);
  451. },
  452. handleTitleMouseleave: function handleTitleMouseleave() {
  453. if (this.mode === 'horizontal' && !this.rootMenu.backgroundColor) return;
  454. var title = this.$refs['submenu-title'];
  455. title && (title.style.backgroundColor = this.rootMenu.backgroundColor || '');
  456. },
  457. updatePlacement: function updatePlacement() {
  458. this.currentPlacement = this.mode === 'horizontal' && this.isFirstLevel ? 'bottom-start' : 'right-start';
  459. },
  460. initPopper: function initPopper() {
  461. this.referenceElm = this.$el;
  462. this.popperElm = this.$refs.menu;
  463. this.updatePlacement();
  464. }
  465. },
  466. created: function created() {
  467. var _this4 = this;
  468. this.$on('toggle-collapse', this.handleCollapseToggle);
  469. this.$on('mouse-enter-child', function () {
  470. _this4.mouseInChild = true;
  471. clearTimeout(_this4.timeout);
  472. });
  473. this.$on('mouse-leave-child', function () {
  474. _this4.mouseInChild = false;
  475. clearTimeout(_this4.timeout);
  476. });
  477. },
  478. mounted: function mounted() {
  479. this.parentMenu.addSubmenu(this);
  480. this.rootMenu.addSubmenu(this);
  481. this.initPopper();
  482. },
  483. beforeDestroy: function beforeDestroy() {
  484. this.parentMenu.removeSubmenu(this);
  485. this.rootMenu.removeSubmenu(this);
  486. },
  487. render: function render(h) {
  488. var _this5 = this;
  489. var active = this.active,
  490. opened = this.opened,
  491. paddingStyle = this.paddingStyle,
  492. titleStyle = this.titleStyle,
  493. backgroundColor = this.backgroundColor,
  494. rootMenu = this.rootMenu,
  495. currentPlacement = this.currentPlacement,
  496. menuTransitionName = this.menuTransitionName,
  497. mode = this.mode,
  498. disabled = this.disabled,
  499. popperClass = this.popperClass,
  500. $slots = this.$slots,
  501. isFirstLevel = this.isFirstLevel;
  502. var popupMenu = h(
  503. 'transition',
  504. {
  505. attrs: { name: menuTransitionName }
  506. },
  507. [h(
  508. 'div',
  509. {
  510. ref: 'menu',
  511. directives: [{
  512. name: 'show',
  513. value: opened
  514. }],
  515. 'class': ['el-menu--' + mode, popperClass],
  516. on: {
  517. 'mouseenter': function mouseenter($event) {
  518. return _this5.handleMouseenter($event, 100);
  519. },
  520. 'mouseleave': function mouseleave() {
  521. return _this5.handleMouseleave(true);
  522. },
  523. 'focus': function focus($event) {
  524. return _this5.handleMouseenter($event, 100);
  525. }
  526. }
  527. },
  528. [h(
  529. 'ul',
  530. {
  531. attrs: {
  532. role: 'menu'
  533. },
  534. 'class': ['el-menu el-menu--popup', 'el-menu--popup-' + currentPlacement],
  535. style: { backgroundColor: rootMenu.backgroundColor || '' } },
  536. [$slots.default]
  537. )]
  538. )]
  539. );
  540. var inlineMenu = h('tis-collapse-transition', [h(
  541. 'ul',
  542. {
  543. attrs: {
  544. role: 'menu'
  545. },
  546. 'class': 'el-menu el-menu--inline',
  547. directives: [{
  548. name: 'show',
  549. value: opened
  550. }],
  551. style: { backgroundColor: rootMenu.backgroundColor || '' } },
  552. [$slots.default]
  553. )]);
  554. var submenuTitleIcon = rootMenu.mode === 'horizontal' && isFirstLevel || rootMenu.mode === 'vertical' && !rootMenu.collapse ? 'el-icon-arrow-down' : 'el-icon-arrow-right';
  555. return h(
  556. 'li',
  557. {
  558. 'class': {
  559. 'el-submenu': true,
  560. 'is-active': active,
  561. 'is-opened': opened,
  562. 'is-disabled': disabled
  563. },
  564. attrs: { role: 'menuitem',
  565. 'aria-haspopup': 'true',
  566. 'aria-expanded': opened
  567. },
  568. on: {
  569. 'mouseenter': this.handleMouseenter,
  570. 'mouseleave': function mouseleave() {
  571. return _this5.handleMouseleave(false);
  572. },
  573. 'focus': this.handleMouseenter
  574. }
  575. },
  576. [h(
  577. 'div',
  578. {
  579. 'class': 'el-submenu__title',
  580. ref: 'submenu-title',
  581. on: {
  582. 'click': this.handleClick,
  583. 'mouseenter': this.handleTitleMouseenter,
  584. 'mouseleave': this.handleTitleMouseleave
  585. },
  586. style: [paddingStyle, titleStyle, { backgroundColor: backgroundColor }]
  587. },
  588. [$slots.title, h('i', { 'class': ['el-submenu__icon-arrow', submenuTitleIcon] })]
  589. ), this.isMenuPopup ? popupMenu : inlineMenu]
  590. );
  591. }
  592. });
  593. // CONCATENATED MODULE: ./packages/menu/src/submenu.vue?vue&type=script&lang=js&
  594. /* harmony default export */ var src_submenuvue_type_script_lang_js_ = (submenuvue_type_script_lang_js_);
  595. // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
  596. var componentNormalizer = __webpack_require__(2);
  597. // CONCATENATED MODULE: ./packages/menu/src/submenu.vue
  598. var render, staticRenderFns
  599. /* normalize component */
  600. var component = Object(componentNormalizer["a" /* default */])(
  601. src_submenuvue_type_script_lang_js_,
  602. render,
  603. staticRenderFns,
  604. false,
  605. null,
  606. null,
  607. null
  608. )
  609. /* hot reload */
  610. if (false) { var api; }
  611. component.options.__file = "packages/menu/src/submenu.vue"
  612. /* harmony default export */ var submenu = (component.exports);
  613. // CONCATENATED MODULE: ./packages/submenu/index.js
  614. /* istanbul ignore next */
  615. submenu.install = function (Vue) {
  616. Vue.component(submenu.name, submenu);
  617. };
  618. /* harmony default export */ var packages_submenu = __webpack_exports__["default"] = (submenu);
  619. /***/ }),
  620. /***/ 98:
  621. /***/ (function(module, exports) {
  622. module.exports = require("tis-ui/lib/transitions/collapse-transition");
  623. /***/ })
  624. /******/ });