UNPKG

kingdot

Version:

A UI Components Library For Vue

547 lines (504 loc) 17.8 kB
module.exports = /******/ (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 = 224); /******/ }) /************************************************************************/ /******/ ({ /***/ 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 } } /***/ }), /***/ 224: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_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.vue?vue&type=template&id=fea24a52& var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{directives:[{name:"resize",rawName:"v-resize",value:(_vm.Recapture),expression:"Recapture"}],class:[ _vm.mainClass, { 'kd-tabs-default': _vm.type === 'default'} ]},[_c('div',{ref:"tabs",staticClass:"kd-tabs-main-move",class:{ 'kd-tabs-show-control': _vm.showControl, 'kd-addabble-box': _vm.addable }},[_c('div',{staticClass:"kd-control right",class:{ 'kd-move-disable-right': _vm.movedisabledRight },on:{"click":_vm.moveLeft}},[_c('i',{staticClass:"kd-icon-arrow-right kd-control-icon"})]),_c('div',{staticClass:"kd-control left",class:{ 'kd-move-disable-left': _vm.movedisabledLeft },on:{"click":_vm.moveRight}},[_c('i',{staticClass:"kd-icon-arrow-left kd-control-icon"})]),_c('div',{ref:"kdTabsContent",staticClass:"kd-tabs-content",class:{'kd-tab-content-fluid': _vm.fluid},style:({ 'margin-left': _vm.marginLeft + 'px' })},[_vm._t("default"),(_vm.type === 'default' && _vm.activeBarFlag)?_c('div',{staticClass:"kd-move-bar",style:({ width: _vm.activeWidth + 'px', left: _vm.activeMarginLeft + 'px', })}):_vm._e(),(_vm.type === 'vertical')?_c('div',{staticClass:"kd-move-vertical",style:({ 'margin-top': _vm.marginTop + 'px', height:_vm.activeHeight+'px' })}):_vm._e()],2)]),(_vm.addable)?_c('div',{staticClass:"kd-add-tab",on:{"click":_vm.addTab}},[_vm._t("addable",[_c('i',{staticClass:"kd-icon-plus"})])],2):_vm._e()])} var staticRenderFns = [] // CONCATENATED MODULE: ./components/Tabs/tabs.vue?vue&type=template&id=fea24a52& // CONCATENATED MODULE: ./components/Tabs/resize.js var directives = { bind: function bind(el, binding) { // el为绑定的元素,binding为绑定给指令的对象 var width = '';var height = ''; function isReize() { var style = document.defaultView.getComputedStyle(el); if (width !== style.width || height !== style.height) { binding.value({ width: style.width, height: style.height }); // 关键(这传入的是函数,所以执行此函数) } width = style.width; height = style.height; } el.__vueSetInterval__ = setInterval(isReize, 300); }, unbind: function unbind(el) { clearInterval(el.__vueSetInterval__); } }; /* harmony default export */ var resize = (directives); // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./components/Tabs/tabs.vue?vue&type=script&lang=js& function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // /* harmony default export */ var tabsvue_type_script_lang_js_ = ({ name: 'KdTabs', directives: { resize: resize }, props: { value: { type: [String, Number], default: '' }, type: { type: String, default: 'default' }, closable: { type: Boolean, default: false }, // default small 仅支持 super-card size: { type: String, default: 'default' }, tabClickMove: { type: Boolean, default: false }, addable: { type: Boolean, default: false }, // 点击是否移动到最前面 handleTabMove: { type: Boolean, default: false }, // 左右移动距离 movingDistance: { type: [String, Number], default: null }, // 仅适用于 super-card fluid: { type: Boolean, default: false } }, data: function data() { var _mainClass; var mainClass = (_mainClass = { 'kd-tabs': true }, _defineProperty(_mainClass, 'kd-tabs-' + this.type, this.type !== 'default'), _defineProperty(_mainClass, 'kd-tabs-' + this.size, this.size !== 'default'), _mainClass); return { mainClass: mainClass, flag: false, movedisabledRight: false, movedisabledLeft: false, innerValue: this.value, marginLeft: 0, activeMarginLeft: '', marginTop: '', activeWidth: '', showControl: false, regionWidth: 0, contentWidth: 0, singleWidth: '', activeHeight: '', activeBarFlag: true }; }, watch: { marginLeft: function marginLeft(newValue) { newValue === 0 ? this.movedisabledLeft = true : this.movedisabledLeft = false; newValue === -(this.contentWidth - this.regionWidth) ? this.movedisabledRight = true : this.movedisabledRight = false; } }, updated: function updated() { this.Recapture(); }, mounted: function mounted() { this.Recapture(); }, methods: { Recapture: function Recapture() { this.activeBarFlag = this.$refs.kdTabsContent.querySelector('.kd-tab'); this.contentWidth = this.$refs.tabs.querySelector('.kd-tabs-content').scrollWidth; this.regionWidth = this.$refs.tabs.clientWidth; this.showControl = this.regionWidth < this.contentWidth; if (!this.showControl) { this.marginLeft = 0; } }, setMoveBarPosition: function setMoveBarPosition(_ref) { var _ref$marginLeft = _ref.marginLeft, marginLeft = _ref$marginLeft === undefined ? '' : _ref$marginLeft, _ref$marginTop = _ref.marginTop, marginTop = _ref$marginTop === undefined ? '' : _ref$marginTop, _ref$width = _ref.width, width = _ref$width === undefined ? 0 : _ref$width, _ref$height = _ref.height, height = _ref$height === undefined ? 0 : _ref$height; this.marginTop = marginTop; this.activeMarginLeft = marginLeft; this.activeWidth = width; this.activeHeight = height; }, tabsActive: function tabsActive(_ref2) { var _ref2$val = _ref2.val, val = _ref2$val === undefined ? '' : _ref2$val, _ref2$marginLeft = _ref2.marginLeft, marginLeft = _ref2$marginLeft === undefined ? '' : _ref2$marginLeft, _ref2$marginTop = _ref2.marginTop, marginTop = _ref2$marginTop === undefined ? '' : _ref2$marginTop, _ref2$width = _ref2.width, width = _ref2$width === undefined ? 0 : _ref2$width, _ref2$height = _ref2.height, height = _ref2$height === undefined ? 0 : _ref2$height, cliclFlag = _ref2.cliclFlag; this.innerValue = val; this.setMoveBarPosition({ marginLeft: marginLeft, marginTop: marginTop, width: width, height: height }); if (cliclFlag) { this.$emit('input', val); this.$emit('click', val); } }, tabHandelMove: function tabHandelMove(_ref3) { var _ref3$marginLeft = _ref3.marginLeft, marginLeft = _ref3$marginLeft === undefined ? '' : _ref3$marginLeft, _ref3$event = _ref3.event, event = _ref3$event === undefined ? '' : _ref3$event; if (this.type === 'default') { this.marginLeft = -marginLeft + 20; } else { this.marginLeft = this.marginLeft - marginLeft + 20; } }, moveLeft: function moveLeft() { if (this.movedisabledRight) { return; } this.calculateTravelDistance(); if (this.marginLeft - this.singleWidth + this.contentWidth < this.regionWidth) { this.marginLeft = -(this.contentWidth - this.regionWidth); } else { this.marginLeft -= this.singleWidth; } }, moveRight: function moveRight() { if (this.movedisabledLeft) { return; } this.calculateTravelDistance(); if (this.marginLeft + this.singleWidth > 0) { this.marginLeft = 0; } else { this.marginLeft += this.singleWidth; } }, calculateTravelDistance: function calculateTravelDistance() { var distance = ''; this.movingDistance ? distance = this.movingDistance : distance = this.$refs.tabs.clientWidth; this.singleWidth = distance; }, close: function close(v) { var _this = this; this.$emit('close', v); this.$nextTick(function () { _this.Recapture(); if (_this.showControl) { _this.marginLeft = -(_this.contentWidth - _this.regionWidth); } }); }, addTab: function addTab(v) { var _this2 = this; this.$emit('addTab'); this.$nextTick(function () { _this2.Recapture(); if (_this2.showControl) { _this2.marginLeft = -(_this2.contentWidth - _this2.regionWidth); } }); } } }); // 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_); // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js var componentNormalizer = __webpack_require__(0); // CONCATENATED MODULE: ./components/Tabs/tabs.vue /* normalize component */ var component = Object(componentNormalizer["a" /* default */])( Tabs_tabsvue_type_script_lang_js_, render, staticRenderFns, false, null, null, null ) /* harmony default export */ var tabs = (component.exports); // CONCATENATED MODULE: ./components/Tabs/index.js tabs.install = function (Vue) { Vue.component(tabs.name, tabs); }; /* harmony default export */ var Tabs = __webpack_exports__["default"] = (tabs); /***/ }) /******/ })["default"];