UNPKG

@mdsfe/mds-ui

Version:

A set of enterprise-class Vue UI components.

1,300 lines (1,143 loc) 35.5 kB
(function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(require("./icon"), require("./_util/proptype")); else if(typeof define === 'function' && define.amd) define(["./icon", "./_util/proptype"], factory); else { var a = typeof exports === 'object' ? factory(require("./icon"), require("./_util/proptype")) : factory(root["./icon"], root["./_util/proptype"]); for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i]; } })(window, function(__WEBPACK_EXTERNAL_MODULE__7__, __WEBPACK_EXTERNAL_MODULE__8__) { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = "/dist/"; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 91); /******/ }) /************************************************************************/ /******/ ({ /***/ 0: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return normalizeComponent; }); /* globals __VUE_SSR_CONTEXT__ */ // IMPORTANT: Do NOT use ES2015 features in this file (except for modules). // This module is a runtime utility for cleaner component module output and will // be included in the final webpack user bundle. function normalizeComponent ( scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, /* server only */ shadowMode /* vue-cli only */ ) { // Vue.extend constructor export interop var options = typeof scriptExports === 'function' ? scriptExports.options : scriptExports // render functions if (render) { options.render = render options.staticRenderFns = staticRenderFns options._compiled = true } // functional template if (functionalTemplate) { options.functional = true } // scopedId if (scopeId) { options._scopeId = 'data-v-' + scopeId } var hook if (moduleIdentifier) { // server build hook = function (context) { // 2.3 injection context = context || // cached call (this.$vnode && this.$vnode.ssrContext) || // stateful (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional // 2.2 with runInNewContext: true if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') { context = __VUE_SSR_CONTEXT__ } // inject component styles if (injectStyles) { injectStyles.call(this, context) } // register component module identifier for async chunk inferrence if (context && context._registeredComponents) { context._registeredComponents.add(moduleIdentifier) } } // used by ssr in case component is cached and beforeCreate // never gets called options._ssrRegister = hook } else if (injectStyles) { hook = shadowMode ? function () { injectStyles.call( this, (options.functional ? this.parent : this).$root.$options.shadowRoot ) } : injectStyles } if (hook) { if (options.functional) { // for template-only hot-reload because in that case the render fn doesn't // go through the normalizer options._injectStyles = hook // register for functional component in vue file var originalRender = options.render options.render = function renderWithStyleInjection (h, context) { hook.call(context) return originalRender(h, context) } } else { // inject component registration as beforeCreate hook var existing = options.beforeCreate options.beforeCreate = existing ? [].concat(existing, hook) : [hook] } } return { exports: scriptExports, options: options } } /***/ }), /***/ 142: /***/ (function(module, exports) { // removed by extract-text-webpack-plugin /***/ }), /***/ 231: /***/ (function(module, exports) { // removed by extract-text-webpack-plugin /***/ }), /***/ 3: /***/ (function(module, exports) { module.exports = require("babel-runtime/helpers/defineProperty"); /***/ }), /***/ 36: /***/ (function(module, exports) { module.exports = require("lodash.debounce"); /***/ }), /***/ 7: /***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE__7__; /***/ }), /***/ 8: /***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE__8__; /***/ }), /***/ 91: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXTERNAL MODULE: ./components/style/index.less var style = __webpack_require__(142); // EXTERNAL MODULE: ./components/tabs/style/index.less var tabs_style = __webpack_require__(231); // CONCATENATED MODULE: ./components/tabs/style/index.js // EXTERNAL MODULE: external "babel-runtime/helpers/defineProperty" var defineProperty_ = __webpack_require__(3); var defineProperty_default = /*#__PURE__*/__webpack_require__.n(defineProperty_); // EXTERNAL MODULE: external "./_util/proptype" var proptype_ = __webpack_require__(8); // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./components/tabs/tabs-bar.vue?vue&type=template&id=06cd0d0a& var tabs_barvue_type_template_id_06cd0d0a_render = function () { var _vm = this var _h = _vm.$createElement var _c = _vm._self._c || _h return _c( "div", { class: _vm.prefixCls + "-bar", attrs: { role: "tablist" } }, [ _c( "div", { class: _vm.prefixCls + "-extra-content", staticStyle: { float: "right" }, }, [ _vm._t("default"), _vm.isShowPlus ? _c("mds-icon", { class: _vm.prefixCls + "-new-tab mdsicon-line-plus", attrs: { type: "plus" }, nativeOn: { click: function ($event) { return _vm.handleCreate($event) }, }, }) : _vm._e(), ], 2 ), _c("tabs-nav", { attrs: { active: _vm.active, animated: _vm.animated, size: _vm.size, tabs: _vm.tabs, type: _vm.type, line: _vm.line, position: _vm.position, }, }), ], 1 ) } var staticRenderFns = [] tabs_barvue_type_template_id_06cd0d0a_render._withStripped = true // CONCATENATED MODULE: ./components/tabs/tabs-bar.vue?vue&type=template&id=06cd0d0a& // EXTERNAL MODULE: external "./icon" var external_icon_ = __webpack_require__(7); var external_icon_default = /*#__PURE__*/__webpack_require__.n(external_icon_); // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./components/tabs/tabs-ink.vue?vue&type=template&id=e235f146& var tabs_inkvue_type_template_id_e235f146_render = function () { var _vm = this var _h = _vm.$createElement var _c = _vm._self._c || _h return _c("div", { class: _vm.classes, style: _vm.style }) } var tabs_inkvue_type_template_id_e235f146_staticRenderFns = [] tabs_inkvue_type_template_id_e235f146_render._withStripped = true // CONCATENATED MODULE: ./components/tabs/tabs-ink.vue?vue&type=template&id=e235f146& // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./components/tabs/tabs-ink.vue?vue&type=script&lang=js& // // // // /* harmony default export */ var tabs_inkvue_type_script_lang_js_ = ({ name: 'MdsTabsInk', props: { prefixCls: { type: String, default: 'mds-tabs' }, animated: { type: Boolean }, offset: { type: Number }, size: { type: Number }, vertical: { type: Boolean }, line: { type: String } }, computed: { classes: function classes() { var prefixCls = this.prefixCls; return [prefixCls + '-ink-bar', this.animated ? prefixCls + '-ink-bar-animated' : prefixCls + '-ink-bar-no-animated']; }, style: function style() { var _this = this; var verticalStyle = function verticalStyle(size, offset) { return { transform: 'translate3d(0, ' + offset + 'px, 0)', height: size + 'px' }; }; var horizontalStyle = function horizontalStyle(size, offset) { return { transform: 'translate3d(' + (offset + (_this.line === 'short' ? size / 3 : 0)) + 'px, 0, 0)', width: size / (_this.line === 'short' ? 3 : 1) + 'px' }; }; return this.vertical ? verticalStyle(this.size, this.offset) : horizontalStyle(this.size, this.offset); } } }); // CONCATENATED MODULE: ./components/tabs/tabs-ink.vue?vue&type=script&lang=js& /* harmony default export */ var tabs_tabs_inkvue_type_script_lang_js_ = (tabs_inkvue_type_script_lang_js_); // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js var componentNormalizer = __webpack_require__(0); // CONCATENATED MODULE: ./components/tabs/tabs-ink.vue /* normalize component */ var component = Object(componentNormalizer["a" /* default */])( tabs_tabs_inkvue_type_script_lang_js_, tabs_inkvue_type_template_id_e235f146_render, tabs_inkvue_type_template_id_e235f146_staticRenderFns, false, null, null, null ) /* hot reload */ if (false) { var api; } component.options.__file = "components/tabs/tabs-ink.vue" /* harmony default export */ var tabs_ink = (component.exports); // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./components/tabs/tabs-tab.vue?vue&type=script&lang=js& /* harmony default export */ var tabs_tabvue_type_script_lang_js_ = ({ name: 'MdsTabsTab', inject: ['tabsRoot'], props: { prefixCls: { type: String, default: 'mds-tabs' }, closable: { type: Boolean, default: true }, disabled: { type: Boolean, default: false }, icon: { type: String }, index: { type: [String, Number] }, tab: { type: [String, Object, Array] }, type: { type: String } }, computed: { classes: function classes() { var _ref; var prefixCls = this.prefixCls; return [prefixCls + '-tab', (_ref = {}, defineProperty_default()(_ref, prefixCls + '-tab-disabled', this.disabled), defineProperty_default()(_ref, prefixCls + '-tab-active', this.active), _ref)]; }, active: function active() { return this.index === this.tabsRoot.active; } }, components: { MdsIcon: external_icon_default.a }, methods: { handleClick: function handleClick(e) { if (this.disabled) return; !this.active && this.$emit('change', this.index); var info = { e: e, vm: this, index: this.index }; this.tabsRoot.$emit('tab-click', info); }, handleClose: function handleClose(e) { this.tabsRoot.$emit('edit', 'remove', this.index); e.stopPropagation(); } }, render: function render(h) { var icon = this.icon ? h('mds-icon', { props: { type: this.icon } }) : null; var close = this.type === 'editable-card' && this.closable ? h('mds-icon', { props: { type: 'line-close' }, nativeOn: { click: this.handleClose } }) : null; return h('div', { 'class': this.classes, attr: { role: 'tab', 'aria-disabled': this.disabled + '', 'aria-selected': this.active + '' }, on: { click: this.handleClick } }, [icon, this.tab, close]); } }); // CONCATENATED MODULE: ./components/tabs/tabs-tab.vue?vue&type=script&lang=js& /* harmony default export */ var tabs_tabs_tabvue_type_script_lang_js_ = (tabs_tabvue_type_script_lang_js_); // CONCATENATED MODULE: ./components/tabs/tabs-tab.vue var tabs_tab_render, tabs_tab_staticRenderFns /* normalize component */ var tabs_tab_component = Object(componentNormalizer["a" /* default */])( tabs_tabs_tabvue_type_script_lang_js_, tabs_tab_render, tabs_tab_staticRenderFns, false, null, null, null ) /* hot reload */ if (false) { var tabs_tab_api; } tabs_tab_component.options.__file = "components/tabs/tabs-tab.vue" /* harmony default export */ var tabs_tab = (tabs_tab_component.exports); // EXTERNAL MODULE: external "lodash.debounce" var external_lodash_debounce_ = __webpack_require__(36); var external_lodash_debounce_default = /*#__PURE__*/__webpack_require__.n(external_lodash_debounce_); // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./components/tabs/tabs-nav.vue?vue&type=script&lang=js& /* harmony default export */ var tabs_navvue_type_script_lang_js_ = ({ name: 'MdsTabsNav', data: function data() { return { next: false, prev: false, shouldScroll: true, activeNode: null, inkSize: 0, inkOffset: 0, offset: 0 }; }, inject: ['tabsRoot'], props: { prefixCls: { type: String, default: 'mds-tabs' }, animated: { type: Boolean }, active: { type: [String, Number], active: 1 }, position: { type: String }, size: { type: String }, tabs: { type: Array, default: function _default() { return []; } }, type: { type: String }, line: { type: String } }, components: { TabsInk: tabs_ink, TabsTab: tabs_tab }, computed: { classes: function classes() { var prefixCls = this.prefixCls; return [prefixCls + '-nav-container', defineProperty_default()({}, prefixCls + '-nav-container-scrolling', this.showNextPrev)]; }, style: function style() { var target = Math.min(0, this.offset); return { transform: this.isVertical ? 'translate3d(0,' + target + 'px,0)' : 'translate3d(' + target + 'px,0,0)' }; }, showNextPrev: function showNextPrev() { console.log(this.next); console.log(this.prev); return this.next || this.prev; }, isVertical: function isVertical() { var position = this.position; return position === 'left' || position === 'right'; }, showLine: function showLine() { return this.line || 'default'; } }, methods: { handleTabChange: function handleTabChange(index) { this.shouldScroll = true; this.tabsRoot.$emit('change', index); }, handlePrev: function handlePrev(e) { if (!this.prev) return; var warp = this.$refs.wrap; var warpWH = this.getOffsetWH(warp); this.offset += warpWH; this.tabsRoot.$emit('prev-click', e); }, handleNext: function handleNext(e) { if (!this.next) return; var warp = this.$refs.wrap; var warpWH = this.getOffsetWH(warp); this.offset -= warpWH; this.tabsRoot.$emit('next-click', e); }, setInk: function setInk() { var nav = this.$refs.nav; var active = this.$refs.active && this.$refs.active.$el; var containerOffset = this.getOffsetLT(nav); if (active) { var tabOffset = this.getOffsetLT(active); this.inkOffset = tabOffset - containerOffset; this.inkSize = this.getOffsetWH(active); } }, getOffsetWH: function getOffsetWH(node) { return node ? this.isVertical ? node.offsetHeight : node.offsetWidth : 0; }, getOffsetLT: function getOffsetLT(node) { return node ? this.isVertical ? node.getBoundingClientRect().top : node.getBoundingClientRect().left : 0; }, scrollToActive: function scrollToActive() { var active = this.$refs.active && this.$refs.active.$el; var warp = this.$refs.wrap; if (active) { var activeTabWH = this.getOffsetWH(active); var navWrapWH = this.getOffsetWH(warp); var activeOffset = this.getOffsetLT(active); var navOffset = this.getOffsetLT(warp); if (navOffset > activeOffset) { this.offset += navOffset - activeOffset; } else if (navOffset + navWrapWH < activeOffset + activeTabWH) { this.offset -= activeOffset + activeTabWH - (navOffset + navWrapWH); } else {} this.shouldScroll = false; } }, setNextPrev: function setNextPrev() { var nav = this.$refs.nav; var navWH = this.getOffsetWH(nav); var warp = this.$refs.wrap; var warpWH = this.getOffsetWH(warp); var minOffset = warpWH - navWH; if (minOffset >= 0) { this.next = false; this.offset = 0; } else if (minOffset < this.offset) { this.next = true; } else { this.next = false; this.offset = minOffset; } this.prev = this.offset < 0; } }, mounted: function mounted() { var _this = this; var debouncedResize = external_lodash_debounce_default()(function () { _this.setNextPrev(); _this.scrollToActive(); }, 200); this.resizeEvent = window.addEventListener('resize', debouncedResize); }, beforeUpdate: function beforeUpdate() { this.setNextPrev(); }, updated: function updated() { this.setInk(); this.shouldScroll && this.scrollToActive(); }, render: function render(h) { var _ref2, _ref3, _this2 = this; var prefixCls = this.prefixCls; var prev = h('span', { attrs: { unselectable: 'unselectable' }, 'class': [prefixCls + '-tab-prev', (_ref2 = {}, defineProperty_default()(_ref2, prefixCls + '-tab-btn-disabled', !this.prev), defineProperty_default()(_ref2, prefixCls + '-tab-arrow-show', this.showNextPrev), _ref2)], on: { click: this.handlePrev }, ref: 'prev' }, [h('mds-icon', { attrs: { type: 'line-caret-left' } })]); var next = h('span', { attrs: { unselectable: 'unselectable' }, 'class': [prefixCls + '-tab-next', (_ref3 = {}, defineProperty_default()(_ref3, prefixCls + '-tab-btn-disabled', !this.next), defineProperty_default()(_ref3, prefixCls + '-tab-arrow-show', this.showNextPrev), _ref3)], on: { click: this.handleNext } }, [h('mds-icon', { attrs: { type: 'line-caret-right' } })]); var ink = h('tabs-ink', { props: { animated: this.animated, size: this.inkSize, offset: this.inkOffset, vertical: this.isVertical, line: this.showLine } }); var tabs = this.tabs.map(function (item) { return h('tabs-tab', { props: { closable: item.closable, disabled: item.disabled, index: item.index, icon: item.icon, tab: item.tab, type: _this2.type }, on: { change: _this2.handleTabChange }, key: item.index, ref: item.index === _this2.tabsRoot.active ? 'active' : '' }); }); var nav = h('div', { 'class': prefixCls + '-nav-scroll' }, [h('div', { 'class': [prefixCls + '-nav'], style: this.style, ref: 'nav' }, [ink, tabs])]); var warp = h('div', { 'class': prefixCls + '-nav-wrap', ref: 'wrap' }, [nav]); return h('div', { 'class': this.classes }, [prev, next, warp]); } }); // CONCATENATED MODULE: ./components/tabs/tabs-nav.vue?vue&type=script&lang=js& /* harmony default export */ var tabs_tabs_navvue_type_script_lang_js_ = (tabs_navvue_type_script_lang_js_); // CONCATENATED MODULE: ./components/tabs/tabs-nav.vue var tabs_nav_render, tabs_nav_staticRenderFns /* normalize component */ var tabs_nav_component = Object(componentNormalizer["a" /* default */])( tabs_tabs_navvue_type_script_lang_js_, tabs_nav_render, tabs_nav_staticRenderFns, false, null, null, null ) /* hot reload */ if (false) { var tabs_nav_api; } tabs_nav_component.options.__file = "components/tabs/tabs-nav.vue" /* harmony default export */ var tabs_nav = (tabs_nav_component.exports); // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./components/tabs/tabs-bar.vue?vue&type=script&lang=js& // // // // // // // // // // // // // // // // // // // // // /* harmony default export */ var tabs_barvue_type_script_lang_js_ = ({ name: 'MdsTabsBar', props: { prefixCls: { type: String, default: 'mds-tabs' }, active: { type: [String, Number] }, animated: { type: Boolean }, hideAdd: { type: Boolean }, panes: { type: Array, default: function _default() { return []; } }, position: { type: String }, size: { type: String }, tabs: { type: Array, default: function _default() { return []; } }, type: { type: String }, line: { type: String } }, components: { MdsIcon: external_icon_default.a, TabsNav: tabs_nav }, computed: { isShowPlus: function isShowPlus() { return this.type === 'editable-card' && !this.hideAdd; } }, methods: { handleCreate: function handleCreate() { this.$emit('edit', 'add'); } } }); // CONCATENATED MODULE: ./components/tabs/tabs-bar.vue?vue&type=script&lang=js& /* harmony default export */ var tabs_tabs_barvue_type_script_lang_js_ = (tabs_barvue_type_script_lang_js_); // CONCATENATED MODULE: ./components/tabs/tabs-bar.vue /* normalize component */ var tabs_bar_component = Object(componentNormalizer["a" /* default */])( tabs_tabs_barvue_type_script_lang_js_, tabs_barvue_type_template_id_06cd0d0a_render, staticRenderFns, false, null, null, null ) /* hot reload */ if (false) { var tabs_bar_api; } tabs_bar_component.options.__file = "components/tabs/tabs-bar.vue" /* harmony default export */ var tabs_bar = (tabs_bar_component.exports); // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./components/tabs/tabs-content.vue?vue&type=template&id=09231af0& var tabs_contentvue_type_template_id_09231af0_render = function () { var _vm = this var _h = _vm.$createElement var _c = _vm._self._c || _h return _c( "div", { class: _vm.classes, style: _vm.style }, [_vm._t("default")], 2 ) } var tabs_contentvue_type_template_id_09231af0_staticRenderFns = [] tabs_contentvue_type_template_id_09231af0_render._withStripped = true // CONCATENATED MODULE: ./components/tabs/tabs-content.vue?vue&type=template&id=09231af0& // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./components/tabs/tabs-content.vue?vue&type=script&lang=js& // // // // // // // // /* harmony default export */ var tabs_contentvue_type_script_lang_js_ = ({ name: 'MdsTabsContent', props: { prefixCls: { type: String, default: 'mds-tabs' }, activeIndex: { type: Number } }, computed: { classes: function classes() { var prefixCls = this.prefixCls; return [prefixCls + '-content', prefixCls + '-content-animated']; }, style: function style() { var marginLeft = this.activeIndex > -1 ? this.activeIndex * 100 : 0; var style = { marginLeft: '-' + marginLeft + '%' }; return style; } }, updated: function updated() { this.$emit('contentUpdate'); } }); // CONCATENATED MODULE: ./components/tabs/tabs-content.vue?vue&type=script&lang=js& /* harmony default export */ var tabs_tabs_contentvue_type_script_lang_js_ = (tabs_contentvue_type_script_lang_js_); // CONCATENATED MODULE: ./components/tabs/tabs-content.vue /* normalize component */ var tabs_content_component = Object(componentNormalizer["a" /* default */])( tabs_tabs_contentvue_type_script_lang_js_, tabs_contentvue_type_template_id_09231af0_render, tabs_contentvue_type_template_id_09231af0_staticRenderFns, false, null, null, null ) /* hot reload */ if (false) { var tabs_content_api; } tabs_content_component.options.__file = "components/tabs/tabs-content.vue" /* harmony default export */ var tabs_content = (tabs_content_component.exports); // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./components/tabs/tabs.vue?vue&type=script&lang=js& /* harmony default export */ var tabsvue_type_script_lang_js_ = ({ name: 'MdsTabs', data: function data() { return { panes: [] }; }, model: { prop: 'active', event: 'change' }, provide: function provide() { return { tabsRoot: this }; }, props: { prefixCls: { type: String, default: 'mds-tabs' }, active: { type: [String, Number] }, animated: { type: Boolean, default: true }, hideAdd: { type: Boolean, default: false }, position: { type: String, default: 'top', validator: function validator(value) { return Object(proptype_["oneOf"])(value, ['top', 'right', 'bottom', 'left']); } }, size: { type: String, default: 'default', validator: function validator(value) { return Object(proptype_["oneOf"])(value, ['default', 'small']); } }, type: { type: String, default: 'line', validator: function validator(value) { return Object(proptype_["oneOf"])(value, ['card', 'editable-card', 'line']); } }, line: { type: String, default: 'default', validator: function validator(value) { return Object(proptype_["oneOf"])(value, ['default', 'short']); } } }, components: { TabsBar: tabs_bar, TabsContent: tabs_content }, computed: { classes: function classes() { var _ref; var prefixCls = this.prefixCls; return [prefixCls, prefixCls + '-' + this.position, prefixCls + '-' + this.type, (_ref = {}, defineProperty_default()(_ref, prefixCls + '-mini', this.size === 'small'), defineProperty_default()(_ref, prefixCls + '-vertical', this.position === 'left' || this.position === 'right'), defineProperty_default()(_ref, prefixCls + '-card', this.isCard), defineProperty_default()(_ref, prefixCls + '-no-animation', !this.animated || this.isCard), _ref)]; }, tabs: function tabs() { var _this = this; return this.panes.map(function (vm) { var closable = vm.closable, disabled = vm.disabled, icon = vm.icon, index = vm.index; var tab = vm.$slots.tab ? vm.$slots.tab : vm.tab; var isActive = _this.active === index; return { closable: closable, disabled: disabled, icon: icon, index: index, isActive: isActive, tab: tab }; }); }, activeIndex: function activeIndex() { var _this2 = this; return this.panes.findIndex(function (vm) { return vm.index === _this2.active; }); }, isCard: function isCard() { return this.type === 'card' || this.type === 'editable-card'; } }, methods: { getPanes: function getPanes(value) { var oldPanesLenght = this.panes.length; var panes = this.$refs.content.$children; if (oldPanesLenght !== panes.length) { this.panes = panes; } }, handleEdit: function handleEdit(action, index) { this.$emit('edit', action, index); } }, mounted: function mounted() { this.getPanes(); }, render: function render(h) { var bar = h('tabs-bar', { props: { active: this.active, animated: this.animated, hideAdd: this.hideAdd, position: this.position, size: this.size, tabs: this.tabs, type: this.type, line: this.line }, on: { edit: this.handleEdit } }, [this.$slots.extra]); var content = h('tabs-content', { ref: 'content', props: { animated: this.animated, activeIndex: this.activeIndex }, on: { contentUpdate: this.getPanes } }, [this.$slots.default]); var children = this.position !== 'bottom' ? [bar, content] : [content, bar]; return h('div', { 'class': this.classes }, children); } }); // CONCATENATED MODULE: ./components/tabs/tabs.vue?vue&type=script&lang=js& /* harmony default export */ var tabs_tabsvue_type_script_lang_js_ = (tabsvue_type_script_lang_js_); // CONCATENATED MODULE: ./components/tabs/tabs.vue var tabs_render, tabs_staticRenderFns /* normalize component */ var tabs_component = Object(componentNormalizer["a" /* default */])( tabs_tabsvue_type_script_lang_js_, tabs_render, tabs_staticRenderFns, false, null, null, null ) /* hot reload */ if (false) { var tabs_api; } tabs_component.options.__file = "components/tabs/tabs.vue" /* harmony default export */ var tabs_tabs = (tabs_component.exports); // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./components/tabs/pane.vue?vue&type=template&id=d3eb5fa4& var panevue_type_template_id_d3eb5fa4_render = function () { var _vm = this var _h = _vm.$createElement var _c = _vm._self._c || _h return _c( "div", { class: _vm.classes, attrs: { role: "pane", "aria-hidden": !_vm.active + "" }, }, [_vm._t("default")], 2 ) } var panevue_type_template_id_d3eb5fa4_staticRenderFns = [] panevue_type_template_id_d3eb5fa4_render._withStripped = true // CONCATENATED MODULE: ./components/tabs/pane.vue?vue&type=template&id=d3eb5fa4& // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./components/tabs/pane.vue?vue&type=script&lang=js& // // // // // // // // // /* harmony default export */ var panevue_type_script_lang_js_ = ({ name: 'MdsTabsPane', inject: ['tabsRoot'], props: { prefixCls: { type: String, default: 'mds-tabs' }, closable: { type: Boolean, default: true }, disabled: { type: Boolean, default: false }, index: { type: [String, Number], required: true }, icon: { type: String }, tab: { type: [String, Object] } }, computed: { classes: function classes() { var prefixCls = this.prefixCls + '-tabpane'; return [prefixCls, this.active ? prefixCls + '-active' : prefixCls + '-inactive']; }, active: function active() { return this.index === this.tabsRoot.active; } } }); // CONCATENATED MODULE: ./components/tabs/pane.vue?vue&type=script&lang=js& /* harmony default export */ var tabs_panevue_type_script_lang_js_ = (panevue_type_script_lang_js_); // CONCATENATED MODULE: ./components/tabs/pane.vue /* normalize component */ var pane_component = Object(componentNormalizer["a" /* default */])( tabs_panevue_type_script_lang_js_, panevue_type_template_id_d3eb5fa4_render, panevue_type_template_id_d3eb5fa4_staticRenderFns, false, null, null, null ) /* hot reload */ if (false) { var pane_api; } pane_component.options.__file = "components/tabs/pane.vue" /* harmony default export */ var pane = (pane_component.exports); // CONCATENATED MODULE: ./components/tabs/index.js tabs_tabs.Pane = pane; /* istanbul ignore next */ tabs_tabs.install = function (Vue) { Vue.component(tabs_tabs.name, tabs_tabs); Vue.component(pane.name, pane); }; /* harmony default export */ var components_tabs = __webpack_exports__["default"] = (tabs_tabs); /***/ }) /******/ }); });