UNPKG

zcloud-ui

Version:

A Component Library for Vue.js.

707 lines (647 loc) 23.1 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 = "/"; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 77); /******/ }) /************************************************************************/ /******/ ({ /***/ 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 } } /***/ }), /***/ 48: /***/ (function(module, exports) { module.exports = require("vue"); /***/ }), /***/ 77: /***/ (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!./packages/dialog/src/main.vue?vue&type=template&id=3d3e5052& var render = function() { var _vm = this var _h = _vm.$createElement var _c = _vm._self._c || _h return _c( "el-dialog", _vm._g( _vm._b( { directives: [{ name: "dialogDrag", rawName: "v-dialogDrag" }], staticClass: "zl-dialog", attrs: { modal: _vm.modals, visible: _vm.show, "close-on-click-modal": _vm.closeOnClickModal, "before-close": _vm.cancel }, scopedSlots: _vm._u( [ _vm.$slots.title ? { key: "title", fn: function() { return [_vm._t("title")] }, proxy: true } : null, { key: "footer", fn: function() { return [ _c( "span", { staticClass: "dialog-footer" }, [ _vm._t("footer"), !_vm.hideSubmitButton ? _c( "el-button", { attrs: { type: "primary", size: _vm.buttonSize, loading: _vm.loading, disabled: _vm.disabledConfirmButton }, on: { click: _vm.submit } }, [_vm._v(_vm._s(_vm.confirmButtonText))] ) : _vm._e(), !_vm.hideCancelButton ? _c( "el-button", { attrs: { size: _vm.buttonSize }, on: { click: _vm.cancel } }, [_vm._v(_vm._s(_vm.closeButtonText))] ) : _vm._e() ], 2 ) ] }, proxy: true } ], null, true ) }, "el-dialog", _vm.$attrs, false ), _vm.$listeners ), [_vm._t("default")], 2 ) } var staticRenderFns = [] render._withStripped = true // CONCATENATED MODULE: ./packages/dialog/src/main.vue?vue&type=template&id=3d3e5052& // EXTERNAL MODULE: external "vue" var external_vue_ = __webpack_require__(48); var external_vue_default = /*#__PURE__*/__webpack_require__.n(external_vue_); // CONCATENATED MODULE: ./src/directives/dialogDrag.js /* eslint-disable */ // 需要在对话框中添加 v-dialogDrag external_vue_default.a.directive('dialogDrag', { bind: function bind(el, binding, vnode, oldVnode) { try { // 弹框可拉伸最小宽高 var minWidth = 200; var minHeight = 100; // 初始非全屏 var isFullScreen = false; // 当前宽高 var nowWidth = 0; var nowHight = 0; // 当前顶部高度 var nowMarginTop = 0; // 获取弹框头部(这部分可双击全屏) var dialogHeaderEl = el.querySelector('.el-dialog__header'); // 获取弹框底部 var dialogFootEl = el.querySelector('.el-dialog__footer'); // 弹窗 var dragDom = el.querySelector('.el-dialog'); dragDom.style.maxHeight = '100VH'; var headFootHeight = 0; var timer = setInterval(function () { if (dialogHeaderEl.offsetHeight) { headFootHeight = dialogHeaderEl.offsetHeight + dialogFootEl.offsetHeight; clearInterval(timer); } }, 200); // 给弹窗加上overflow auto;不然缩小时框内的标签可能超出dialog; dragDom.style.overflow = 'auto'; // 清除选择头部文字效果 dialogHeaderEl.onselectstart = new Function('return false'); // 头部加上可拖动cursor dialogHeaderEl.style.cursor = 'move'; // 获取原有属性 ie dom元素.currentStyle 火狐谷歌 window.getComputedStyle(dom元素, null); var sty = dragDom.currentStyle || window.getComputedStyle(dragDom, null); var moveDown = function moveDown(e) { // 鼠标按下,计算当前元素距离可视区的距离 var disX = e.clientX - dialogHeaderEl.offsetLeft; var disY = e.clientY - dialogHeaderEl.offsetTop; // 获取到的值带px 正则匹配替换 var styL = void 0, styT = void 0; // 注意在ie中 第一次获取到的值为组件自带50% 移动之后赋值为px if (sty.left.includes('%')) { styL = +document.body.clientWidth * (+sty.left.replace(/%/g, '') / 100); styT = +document.body.clientHeight * (+sty.top.replace(/%/g, '') / 100); } else { styL = +sty.left.replace(/px/g, ''); styT = +sty.top.replace(/px/g, ''); } document.onmousemove = function (e) { // 通过事件委托,计算移动的距离 var l = e.clientX - disX; var t = e.clientY - disY; // 移动当前元素 dragDom.style.left = l + styL + 'px'; dragDom.style.top = t + styT + 'px'; // 将此时的位置传出去 // binding.value({x:e.pageX,y:e.pageY}) }; document.onmouseup = function (e) { document.onmousemove = null; document.onmouseup = null; }; }; dialogHeaderEl.onmousedown = moveDown; // 双击(头部)效果不想要可以注释 dialogHeaderEl.ondblclick = function (e) { if (isFullScreen === false) { nowHight = dragDom.clientHeight; nowWidth = dragDom.clientWidth; nowMarginTop = dragDom.style.marginTop; dragDom.style.left = 0; dragDom.style.top = 0; dragDom.querySelector('.el-dialog__body').style.height = 'calc(100VH - ' + headFootHeight + 'px)'; dragDom.querySelector('.el-dialog__body').style.maxHeight = 'calc(100VH - ' + headFootHeight + 'px)'; dragDom.style.height = '100VH'; dragDom.style.width = '100VW'; dragDom.style.marginTop = 0; isFullScreen = true; dialogHeaderEl.style.cursor = 'initial'; dialogHeaderEl.onmousedown = null; } else { dragDom.style.height = 'auto'; dragDom.querySelector('.el-dialog__body').style.height = 'calc(100% - 300px)'; dragDom.querySelector('.el-dialog__body').style.maxHeight = 'calc(100VH - 300px)'; dragDom.style.width = nowWidth + 'px'; dragDom.style.marginTop = nowMarginTop; isFullScreen = false; dialogHeaderEl.style.cursor = 'move'; dialogHeaderEl.onmousedown = moveDown; } }; // 拉伸(右下方)效果不想要可以注释 // let resizeEl = document.createElement('div'); // dragDom.appendChild(resizeEl); // // 在弹窗右下角加上一个10-10px的控制块 // resizeEl.style.cursor = 'se-resize'; // resizeEl.style.position = 'absolute'; // resizeEl.style.height = '10px'; // resizeEl.style.width = '10px'; // resizeEl.style.right = '0px'; // resizeEl.style.bottom = '0px'; // resizeEl.style.zIndex = '99'; // // 鼠标拉伸弹窗 // resizeEl.onmousedown = (e) => { // // 记录初始x位置 // let clientX = e.clientX; // // 鼠标按下,计算当前元素距离可视区的距离 // let disX = e.clientX - resizeEl.offsetLeft; // let disY = e.clientY - resizeEl.offsetTop; // document.onmousemove = function (e) { // e.preventDefault(); // 移动时禁用默认事件 // // 通过事件委托,计算移动的距离 // let x = e.clientX - disX + (e.clientX - clientX);// 这里 由于elementUI的dialog控制居中的,所以水平拉伸效果是双倍 // let y = e.clientY - disY; // // 比较是否小于最小宽高 // dragDom.style.width = x > minWidth ? `${x}px` : minWidth + 'px'; // dragDom.style.height = y > minHeight ? `${y}px` : minHeight + 'px'; // }; // // 拉伸结束 // document.onmouseup = function (e) { // document.onmousemove = null; // document.onmouseup = null; // }; // }; // 拉伸(右边)效果不想要可以注释 var resizeElR = document.createElement('div'); dragDom.appendChild(resizeElR); // 在弹窗右下角加上一个10-10px的控制块 resizeElR.style.cursor = 'w-resize'; resizeElR.style.position = 'absolute'; resizeElR.style.height = '100%'; resizeElR.style.width = '10px'; resizeElR.style.right = '0px'; resizeElR.style.top = '0px'; // 鼠标拉伸弹窗 resizeElR.onmousedown = function (e) { var elW = dragDom.clientWidth; var EloffsetLeft = dragDom.offsetLeft; // 记录初始x位置 var clientX = e.clientX; document.onmousemove = function (e) { e.preventDefault(); // 移动时禁用默认事件 // 右侧鼠标拖拽位置 if (clientX > EloffsetLeft + elW - 10 && clientX < EloffsetLeft + elW) { // 往左拖拽 if (clientX > e.clientX) { if (dragDom.clientWidth >= minWidth) { dragDom.style.width = elW - (clientX - e.clientX) * 2 + 'px'; } } // 往右拖拽 if (clientX < e.clientX) { dragDom.style.width = elW + (e.clientX - clientX) * 2 + 'px'; } } }; // 拉伸结束 document.onmouseup = function (e) { document.onmousemove = null; document.onmouseup = null; }; }; // 拉伸(左边)效果不想要可以注释 var resizeElL = document.createElement('div'); dragDom.appendChild(resizeElL); // 在弹窗右下角加上一个10-10px的控制块 resizeElL.style.cursor = 'w-resize'; resizeElL.style.position = 'absolute'; resizeElL.style.height = '100%'; resizeElL.style.width = '10px'; resizeElL.style.left = '0px'; resizeElL.style.top = '0px'; // 鼠标拉伸弹窗 resizeElL.onmousedown = function (e) { var elW = dragDom.clientWidth; var EloffsetLeft = dragDom.offsetLeft; // 记录初始x位置 var clientX = e.clientX; document.onmousemove = function (e) { e.preventDefault(); // 移动时禁用默认事件 // 左侧鼠标拖拽位置 if (clientX > EloffsetLeft && clientX < EloffsetLeft + 10) { // 往左拖拽 if (clientX > e.clientX) { dragDom.style.width = elW + (clientX - e.clientX) * 2 + 'px'; } // 往右拖拽 if (clientX < e.clientX) { if (dragDom.clientWidth >= minWidth) { dragDom.style.width = elW - (e.clientX - clientX) * 2 + 'px'; } } } }; // 拉伸结束 document.onmouseup = function (e) { document.onmousemove = null; document.onmouseup = null; }; }; // 拉伸(下边)效果不想要可以注释 var resizeElB = document.createElement('div'); dragDom.appendChild(resizeElB); // 在弹窗右下角加上一个10-10px的控制块 resizeElB.style.cursor = 'n-resize'; resizeElB.style.position = 'absolute'; resizeElB.style.height = '10px'; resizeElB.style.width = '100%'; resizeElB.style.left = '0px'; resizeElB.style.bottom = '0px'; // 鼠标拉伸弹窗 resizeElB.onmousedown = function (e) { var EloffsetTop = dragDom.offsetTop; var ELscrollTop = el.scrollTop; var clientY = e.clientY; var elH = dragDom.clientHeight; document.onmousemove = function (e) { e.preventDefault(); // 移动时禁用默认事件 // 底部鼠标拖拽位置 if (ELscrollTop + clientY > EloffsetTop + elH - 20 && ELscrollTop + clientY < EloffsetTop + elH) { // 往上拖拽 if (clientY > e.clientY) { if (dragDom.clientHeight >= minHeight) { dragDom.style.height = elH - (clientY - e.clientY) * 2 + 'px'; dragDom.querySelector('.el-dialog__body').style.height = 'calc(100% - ' + headFootHeight + 'px)'; } } // 往下拖拽 if (clientY < e.clientY) { dragDom.style.height = elH + (e.clientY - clientY) * 2 + 'px'; dragDom.querySelector('.el-dialog__body').style.height = 'calc(100% - ' + headFootHeight + 'px)'; } } }; // 拉伸结束 document.onmouseup = function (e) { document.onmousemove = null; document.onmouseup = null; }; }; } catch (error) { console.log(error); } } }); // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/dialog/src/main.vue?vue&type=script&lang=js& // // // // // // // // // // // // // // // // /* harmony default export */ var mainvue_type_script_lang_js_ = ({ name: 'ZlDialog', data: function data() { return { modals: true }; }, props: { show: { // 是否显示dailog type: Boolean, required: true, default: false }, loading: { type: Boolean, default: false }, buttonSize: { // 按钮大小 type: String, default: 'small' }, closeOnClickModal: { // 禁用某些操作,可配置 type: Boolean, default: false }, confirmButtonText: { type: String, default: '确定' }, closeButtonText: { type: String, default: '关闭' }, disabledConfirmButton: { type: Boolean, default: false }, hideSubmitButton: { type: Boolean, default: false }, modal: { type: Boolean, default: true }, hideCancelButton: { type: Boolean, default: false // 隐藏按钮 } }, created: function created() { // 设置模态框 this.modals = this.modal; // 全屏下模态框去除,hack 浏览器返回会留下modal if (this.$attrs.fullscreen || this.$attrs.fullscreen === '') { this.modals = false; } }, methods: { // 确认事件 submit: function submit() { this.$emit('submit'); }, // 取消事件 cancel: function cancel() { this.$emit('update:show', false); // 更新父组件show this.$emit('reset'); } } }); // CONCATENATED MODULE: ./packages/dialog/src/main.vue?vue&type=script&lang=js& /* harmony default export */ var src_mainvue_type_script_lang_js_ = (mainvue_type_script_lang_js_); // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js var componentNormalizer = __webpack_require__(0); // CONCATENATED MODULE: ./packages/dialog/src/main.vue /* normalize component */ var component = Object(componentNormalizer["a" /* default */])( src_mainvue_type_script_lang_js_, render, staticRenderFns, false, null, null, null ) /* hot reload */ if (false) { var api; } component.options.__file = "packages/dialog/src/main.vue" /* harmony default export */ var main = (component.exports); // CONCATENATED MODULE: ./packages/dialog/index.js /* istanbul ignore next */ main.install = function (Vue) { Vue.component(main.name, main); }; /* harmony default export */ var dialog = __webpack_exports__["default"] = (main); /***/ }) /******/ });