UNPKG

kingdot

Version:

A UI Components Library For Vue

563 lines (513 loc) 18.2 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 = 222); /******/ }) /************************************************************************/ /******/ ({ /***/ 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 } } /***/ }), /***/ 222: /***/ (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/DraggablePanel/draggablePanel.vue?vue&type=template&id=2cb047fe& var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{ref:"wrap",class:{ 'kd-draggable': true, 'kd-draggable-horizontal': _vm.horizontal, 'kd-draggable-vertical': _vm.vertical, },style:(_vm.wrapStyle)},[(_vm.horizontal)?_c('div',{ref:"dragHorizontalEle",staticClass:"kd-drag-horizontal",class:['kd-drag-horizontal-' + _vm.dragDirection],on:{"mousedown":_vm.dragEleMousedown}},[_vm._t("drag-horizontal-ele")],2):_vm._e(),(_vm.vertical)?_c('div',{ref:"dragVerticalEle",staticClass:"kd-drag-vertical",class:['kd-drag-vertical-' + _vm.dragDirection],on:{"mousedown":_vm.dragEleMousedown}},[_vm._t("drag-vertical-ele")],2):_vm._e(),_c('div',{staticClass:"kd-draggable-content"},[_c('div',{staticClass:"kd-draggable-content-main"},[_vm._t("content")],2)])])} var staticRenderFns = [] // CONCATENATED MODULE: ./components/DraggablePanel/draggablePanel.vue?vue&type=template&id=2cb047fe& // CONCATENATED MODULE: ./components/DraggablePanel/util.js function addEvent(ele, e, func) { if (ele.addEventListener) { ele.addEventListener(e, func, false); } else if (ele.attachEvent) { ele.attachEvent('on' + e, func); } else { ele['on' + e] = func; } } function delEvent(ele, e, func) { if (ele.removeEventListener) { ele.removeEventListener(e, func, false); } else if (ele.detachEvent) { ele.detachEvent('on' + e, func); } else { ele['on' + e] = null; } } var _requestAnimationFrame = function () { var callbackList = []; var requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame || window.oRequestAnimationFrame || function (callback) { window.setTimeout(callback, 1000 / 60); }; var cancelAnimationFrame = window.cancelAnimationFrame || window.mozCancelAnimationFrame || Window.webkitCancelAnimationFrame || window.msCancelAnimationFrame || window.oCancelAnimationFrame || function (id) { window.clearTimeout(id); }; return function (callback, event) { callbackList.find(function (item, index) { if (item.callback === callback) { cancelAnimationFrame(item.requestId); callbackList.splice(index, 1); return true; } }); var requestId = requestAnimationFrame(function (timestamp) { var index = callbackList.findIndex(function (item) { return item.callback === callback; }); ~index && callbackList.splice(index, 1); callback(event, timestamp); }); callbackList.push({ callback: callback, requestId: requestId }); }; }(); // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./components/DraggablePanel/draggablePanel.vue?vue&type=script&lang=js& // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // /* harmony default export */ var draggablePanelvue_type_script_lang_js_ = ({ name: 'KdDraggablePanel', components: {}, props: { width: { type: [String, Number] }, height: { type: [String, Number] }, maxHeight: { type: [String, Number] }, minHeight: { type: [String, Number], default: function _default() { return 0; } }, maxWidth: { type: [String, Number] }, minWidth: { type: [String, Number], default: function _default() { return 0; } }, horizontal: { type: Boolean, default: function _default() { return false; } }, vertical: { type: Boolean, default: function _default() { return false; } }, moveDirection: { type: String, default: '' } }, data: function data() { return { heightValue: this.minHeight, widthValue: this.minWidth, showMax: false, startPos: null, stopPos: null }; }, computed: { wrapStyle: function wrapStyle() { var style = {}; var height = this.checkHeight(this.heightValue); var width = this.checkWidth(this.widthValue); this.$emit('update:height', this.logMax ? '100%' : height); this.$emit('update:width', this.logMax ? '100%' : width); if (this.horizontal) { style.width = this.showMax ? '100%' : width + 'px'; style.height = height ? height + 'px' : '100%'; } if (this.vertical) { style.width = width ? width + 'px' : '100%'; style.height = this.showMax ? '100%' : height + 'px'; } return style; }, dragDirection: function dragDirection() { return !this.moveDirection ? this.horizontal ? 'right' : this.vertical ? 'top' : '' : this.moveDirection; } }, watch: { width: { immediate: true, handler: function handler(v) { if (v != undefined) { this.widthValue = this.checkWidth(+v); } } }, height: { immediate: true, handler: function handler(v) { if (v != undefined) { this.heightValue = this.checkHeight(+v); } } } }, beforeDestroy: function beforeDestroy() { delEvent(document, 'mousemove', this.documentMouseMove); delEvent(document, 'mouseup', this.documentMouseUp); }, methods: { resizeMax: function resizeMax() { this.showMax = true; }, resizeMin: function resizeMin() { this.showMax = false; this.heightValue = this.minHeight; }, dragEleMousedown: function dragEleMousedown(e) { this.startPos = e; addEvent(document, 'mouseup', this.documentMouseUp); addEvent(document, 'mousemove', this.documentMouseMove); }, documentMouseMove: function documentMouseMove(e) { this.stopPos = e; if (this.showMax) { this.showMax = false; if (this.vertical) { this.heightValue = this.$refs.wrap.parentNode.offsetHeight; } if (this.horizontal) { this.widthValue = this.$refs.wrap.parentNode.offsetWidth; } } _requestAnimationFrame(this.changeSize); }, changeSize: function changeSize() { var _this = this; if (this.horizontal) { this.changeWidth(); } if (this.vertical) { this.changeHeight(); } // this.startPos = this.stopPos; this.$nextTick(function () { _this.$emit('layoutResize'); }); }, changeWidth: function changeWidth() { // debugger; var $wrap = this.$refs.wrap; var $dragHorizontalEle = this.$refs.dragHorizontalEle; if (!($wrap && $dragHorizontalEle)) return; if (!(this.startPos && this.stopPos)) return; var dragEleOffsetX = this.startPos.offsetX; var stopClientX = this.stopPos && this.stopPos.clientX; var _ref = $wrap.getBoundingClientRect() || {}, left = _ref.left, right = _ref.right; if (this.dragDirection == 'right') { var dragEleClientRect = $dragHorizontalEle.getBoundingClientRect() || {}; var dragEleWidth = dragEleClientRect.right - dragEleClientRect.left; this.widthValue = stopClientX - left + (dragEleWidth - dragEleOffsetX); this.widthValue = this.checkWidth(this.widthValue); } else { this.widthValue = right - stopClientX; this.widthValue = this.checkWidth(this.widthValue); } }, checkWidth: function checkWidth(w) { if (w < this.minWidth) { w = +this.minWidth; } if (this.maxWidth && w > this.maxWidth) { w = +this.maxWidth; } return w; }, checkHeight: function checkHeight(h) { if (h < this.minHeight) { h = +this.minHeight; } if (this.maxHeight && h > this.maxHeight) { h = +this.maxHeight; } return h; }, changeHeight: function changeHeight() { var $wrap = this.$refs.wrap; if (!$wrap) return; if (!(this.startPos && this.stopPos)) return; var dragEleOffsetY = this.startPos.offsetY; var stopClientY = this.stopPos && this.stopPos.clientY; var _ref2 = $wrap.getBoundingClientRect() || {}, top = _ref2.top, bottom = _ref2.bottom; if (this.dragDirection == 'bottom') { this.heightValue = stopClientY - top; this.heightValue = this.checkHeight(this.heightValue); } else { var height = bottom - top; this.heightValue = top - stopClientY + height + dragEleOffsetY; this.heightValue = this.checkHeight(this.heightValue); } }, documentMouseUp: function documentMouseUp() { this.startPos = null; delEvent(document, 'mousemove', this.documentMouseMove); delEvent(document, 'mouseup', this.documentMouseUp); } } }); // CONCATENATED MODULE: ./components/DraggablePanel/draggablePanel.vue?vue&type=script&lang=js& /* harmony default export */ var DraggablePanel_draggablePanelvue_type_script_lang_js_ = (draggablePanelvue_type_script_lang_js_); // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js var componentNormalizer = __webpack_require__(0); // CONCATENATED MODULE: ./components/DraggablePanel/draggablePanel.vue /* normalize component */ var component = Object(componentNormalizer["a" /* default */])( DraggablePanel_draggablePanelvue_type_script_lang_js_, render, staticRenderFns, false, null, null, null ) /* harmony default export */ var draggablePanel = (component.exports); // CONCATENATED MODULE: ./components/DraggablePanel/index.js draggablePanel.install = function (Vue) { Vue.component(draggablePanel.name, draggablePanel); }; /* harmony default export */ var DraggablePanel = __webpack_exports__["default"] = (draggablePanel); /***/ }) /******/ })["default"];