kingdot
Version:
A UI Components Library For Vue
1,315 lines (789 loc) • 27 kB
JavaScript
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 = 234);
/******/ })
/************************************************************************/
/******/ ({
/***/ 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
}
}
/***/ }),
/***/ 2:
/***/ (function(module, exports) {
module.exports = require("vue");
/***/ }),
/***/ 201:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _node_modules_vue_loader_lib_index_js_vue_loader_options_dialog_vue_vue_type_style_index_0_lang_true___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(93);
/* harmony import */ var _node_modules_vue_loader_lib_index_js_vue_loader_options_dialog_vue_vue_type_style_index_0_lang_true___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_vue_loader_lib_index_js_vue_loader_options_dialog_vue_vue_type_style_index_0_lang_true___WEBPACK_IMPORTED_MODULE_0__);
/* unused harmony reexport * */
/* unused harmony default export */ var _unused_webpack_default_export = (_node_modules_vue_loader_lib_index_js_vue_loader_options_dialog_vue_vue_type_style_index_0_lang_true___WEBPACK_IMPORTED_MODULE_0___default.a);
/***/ }),
/***/ 234:
/***/ (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/Dialog/dialog.vue?vue&type=template&id=424fa471&
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{directives:[{name:"transfer-dom",rawName:"v-transfer-dom"}],staticClass:"kd-dialog-container",attrs:{"data-transfer":_vm.transfer}},[_c('transition',{attrs:{"name":"kd-dialog-mask"}},[(_vm.visible && _vm.mask)?_c('div',{staticClass:"kd-dialog-mask",on:{"click":_vm.handleModalClick}}):_vm._e()]),_c('transition',{attrs:{"name":"kd-dialog-fade"}},[(_vm.visible)?_c('div',{staticClass:"kd-dialog-wrapper"},[_c('div',{staticClass:"kd-dialog",class:("kd-dialog-" + _vm.type),style:([
_vm.style ]),attrs:{"id":"kd-dialog"}},[_c('div',{class:[
'kd-dialog-header',
{
'kd-dialog-center': _vm.center,
'kd-dialog-header-backgroundColor': _vm.showTitle,
} ],on:{"mousedown":function($event){return _vm.mousedown($event)}}},[(_vm.showTitle)?_vm._t("title",[_c('span',{staticClass:"kd-dialog-title"},[_vm._v(_vm._s(_vm.title))])]):_vm._e(),(_vm.showClose)?_c('i',{staticClass:"kd-dialog-icon kd-icon-close",on:{"click":function($event){$event.stopPropagation();return _vm.close($event)}}}):_vm._e(),(_vm.showTitle)?_c('div',{staticClass:"kd-dialog-line"}):_vm._e()],2),(_vm.type == 'default')?_c('div',{staticClass:"kd-dialog-body",style:(_vm.bodyStyle)},[_vm._t("default",[_vm._v("我是内容区域")])],2):_vm._e(),(_vm.type == 'confirm')?_c('div',{staticClass:"kd-dialog-body",class:("kd-dialog-body-" + _vm.type)},[_vm._t("default",[(_vm.icon)?_c('span',{staticClass:"kd-icon-section"},[_c('i',{class:['kd-dialog-icon-size-confirm', _vm.iconObj],style:({ color: _vm.iconColorObj })})]):_vm._e(),(_vm.confirmTitle!=='')?_c('p',{staticClass:"kd-dialog-confirm-title"},[_vm._v(_vm._s(_vm.confirmTitle))]):_vm._e(),(_vm.confirmTips!=='')?_c('p',{staticClass:"kd-dialog-confirm-tips"},[_vm._v(_vm._s(_vm.confirmTips))]):_vm._e()])],2):_vm._e(),(_vm.type == 'tips')?_c('div',{staticClass:"kd-dialog-body kd-dialog-tips-body",class:{ 'kd-dialog-tips-body-center': _vm.tipsIsCenter }},[_vm._t("default",[(_vm.icon)?_c('span',{staticClass:"kd-icon-section",class:{ 'kd-dailog-tips-icon': !_vm.tipsIsCenter }},[_c('i',{class:[
'kd-dialog-icon-size-tips',
_vm.iconObj,
{ 'kd-dialog-icon-size-tips-center': _vm.tipsIsCenter } ],style:({ color: _vm.iconColorObj })})]):_vm._e(),_c('span',{staticClass:"kd-dialog-tips-title",class:{ 'kd-dialog-tips-title-center': _vm.tipsIsCenter }},[_vm._v(_vm._s(_vm.tipsTitle))]),_c('p',{staticClass:"kd-dialog-tips-message",class:{ 'kd-dialog-tips-message-center': _vm.tipsIsCenter }},[_vm._v("\n "+_vm._s(_vm.tipsMessage)+"\n ")])])],2):_vm._e(),_c('div',{class:{
'kd-dialog-footer': true,
'kd-dialog-footer-height': !_vm.showFooter,
'kd-dialog-center': _vm.center,
}},[(_vm.showFooter)?_c('div',{staticClass:"kd-dialog-line"}):_vm._e(),(_vm.showFooter)?_vm._t("footer",[_c('kd-button',{staticClass:"kd-dialog-btn",on:{"click":function($event){return _vm.close(true)}}},[_vm._v("\n "+_vm._s(_vm.cancelText)+"\n ")]),_c('kd-button',{staticClass:"kd-dialog-btn",attrs:{"type":"primary","disabled":_vm.isDisabledOK,"loading":_vm.selfDisableOk},on:{"click":_vm._ok}},[_c('span',[_vm._v(_vm._s(_vm.okText))])])]):_vm._e()],2)])]):_vm._e()])],1)}
var staticRenderFns = []
// CONCATENATED MODULE: ./components/Dialog/dialog.vue?vue&type=template&id=424fa471&
// EXTERNAL MODULE: ./components/Dialog/transfer-dom.js
var transfer_dom = __webpack_require__(88);
// EXTERNAL MODULE: ./src/utils/zIndex.js
var zIndex = __webpack_require__(5);
// CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./components/Dialog/dialog.vue?vue&type=script&lang=js&
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
/* harmony default export */ var dialogvue_type_script_lang_js_ = ({
name: 'KdDialog',
directives: {
transferDom: transfer_dom["a" /* default */]
},
props: {
// v-model绑定,控制dialog显示与隐藏
value: {
type: Boolean,
default: false
},
// Dialog 的标题,也可通过具名 slot
title: {
type: String,
default: '标题'
},
// modal 是否需要遮罩层
modal: {
type: Boolean,
default: true
},
// 是否需要头部
showTitle: {
type: Boolean,
default: true
},
// 是否需要底部
showFooter: {
type: Boolean,
default: true
},
// 是否显示关闭按钮
showClose: {
type: Boolean,
default: true
},
// dialog 类型
type: {
type: String,
default: 'default' // default,confirm,tips
},
// icon类型
icon: {
type: String,
default: '' // success,failed,warning,info
},
// 二次确认标题 type:confirm
confirmTitle: {
type: String,
default: ''
},
// 二次确认提示文字 type:confirm
confirmTips: {
type: String,
default: ''
},
// tipsTitle type为tips
tipsTitle: {
type: String,
default: '成功'
},
tipsMessage: {
type: String,
default: ''
},
tipsIsCenter: {
type: Boolean,
default: false
},
// width Dialog 的宽度
width: {
type: [Number, String],
default: 480
},
height: {
type: [Number, String],
default: ''
},
isScroll: {
type: Boolean,
default: false
},
// center 是否对头部和底部采用居中布局
center: {
type: Boolean,
default: false
},
// 点击遮罩层关闭dialog
clickModalToClose: {
type: Boolean,
default: false
},
ok: {
type: Function,
default: undefined
},
cancel: {
type: Function,
default: undefined
},
cancelText: {
type: String,
default: '取消'
},
okText: {
type: String,
default: '确定'
},
// 确认按钮是否禁用
disableOk: {
type: Boolean,
default: false
},
transfer: {
type: Boolean,
default: function _default() {
return !this.$IVIEW || this.$IVIEW.transfer === '' ? true : this.$IVIEW.transfer;
}
}
},
data: function data() {
return {
visible: this.value,
mask: this.modal,
selfDisableOk: false,
isDisabledOK: false,
closed: false,
iconColor_obj: {
success: '#38C482',
failed: '#EF4E76',
warning: '#FF9A42',
info: '#547DFC'
}
};
},
computed: {
style: function style() {
var style = {};
if (this.width) {
style.width = this.width + 'px';
}
return style;
},
bodyStyle: function bodyStyle() {
var style = {};
if (this.height) {
style['max-height'] = this.height + 'px';
if (this.isScroll) {
style['overflow-y'] = 'scroll';
} else {
style.overflow = 'hidden';
}
}
return style;
},
iconObj: function iconObj() {
return {
'kd-icon-success-solid': this.icon === 'success',
'kd-icon-error-solid': this.icon === 'failed',
'kd-icon-warning-solid': this.icon === 'warning',
'kd-icon-message-solid': this.icon === 'info'
};
},
iconColorObj: function iconColorObj() {
return this.iconColor_obj[this.icon];
}
},
watch: {
value: {
immediate: true,
handler: function handler(newValue) {
this.visible = newValue;
this.mask = this.modal ? newValue : false;
}
},
visible: function visible(newValue) {
if (newValue) {
this.$el.style.zIndex = Object(zIndex["a" /* default */])();
}
this.$emit('input', newValue);
},
disableOk: {
immediate: true,
handler: function handler(newValue) {
this.isDisabledOK = newValue;
}
}
},
created: function created() {},
methods: {
// 确认按钮的回调,默认关闭dialogue
_ok: function _ok() {
if (this.isDisabledOK) return;
var callback = this.ok;
if (typeof callback === 'function') {
callback.call(this, this);
} else {
this.visible = false;
this.mask = false;
this.$emit('ok', this);
}
},
// 取消按钮回调 关闭Dialog
close: function close(flag) {
var callback = this.cancel;
if (typeof callback === 'function' && flag) {
callback.call(this, this);
} else {
this.visible = false;
this.mask = false;
this.$emit('cancel', this);
}
},
open: function open() {
this.visible = true;
if (this.modal) {
this.mask = true;
}
},
// 展示和隐藏加载图标
hideLoading: function hideLoading() {
this.selfDisableOk = false;
this.isDisabledOK = false;
},
showLoading: function showLoading() {
this.selfDisableOk = true;
this.isDisabledOK = true;
},
// 点击遮罩层关闭对话框
handleModalClick: function handleModalClick() {
if (!this.clickModalToClose) return;
this.close();
},
mousedown: function mousedown(e) {
var event = e || window.event;
var _target = this.$el.childNodes[1].childNodes[0];
var _targetW = _target.clientWidth;
var _targetH = _target.clientHeight;
var startx = event.clientX;
var starty = event.clientY;
var sbBkx = startx - _target.offsetLeft;
var sbBky = starty - _target.offsetTop;
var ww = document.body.offsetWidth - Math.ceil(_targetW / 2);
var wh = document.body.offsetHeight - Math.floor(_targetH / 2);
if (event.preventDefault) {
event.preventDefault();
} else {
event.returnValue = false;
}
document.onmousemove = function (ev) {
var _event = ev || window.event;
var endx = _event.clientX - sbBkx;
var endy = _event.clientY - sbBky;
if (endx <= Math.ceil(_targetW / 2)) {
endx = Math.ceil(_targetW / 2);
} else if (endx >= ww + 20) {
endx = ww + 20;
}
if (endy <= 0) {
endy = 0;
} else if (endy >= wh) {
endy = wh;
}
_target.style.left = endx + 'px';
_target.style.top = endy + 'px';
};
document.onmouseup = function (e) {
document.onmousemove = null;
document.onmouseup = null;
};
}
}
});
// CONCATENATED MODULE: ./components/Dialog/dialog.vue?vue&type=script&lang=js&
/* harmony default export */ var Dialog_dialogvue_type_script_lang_js_ = (dialogvue_type_script_lang_js_);
// EXTERNAL MODULE: ./components/Dialog/dialog.vue?vue&type=style&index=0&lang=true&
var dialogvue_type_style_index_0_lang_true_ = __webpack_require__(201);
// EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
var componentNormalizer = __webpack_require__(0);
// CONCATENATED MODULE: ./components/Dialog/dialog.vue
/* normalize component */
var component = Object(componentNormalizer["a" /* default */])(
Dialog_dialogvue_type_script_lang_js_,
render,
staticRenderFns,
false,
null,
null,
null
)
/* harmony default export */ var dialog = (component.exports);
// CONCATENATED MODULE: ./components/Dialog/index.js
dialog.install = function (Vue) {
Vue.component(dialog.name, dialog);
};
/* harmony default export */ var Dialog = __webpack_exports__["default"] = (dialog);
/***/ }),
/***/ 5:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* unused harmony export setZIndex */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return nextZIndex; });
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var zIndex = void 0;
var setZIndex = function setZIndex(value) {
zIndex = value;
};
function nextZIndex() {
zIndex = zIndex || (vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$KD || {}).zIndex;
if (typeof zIndex === 'function') {
return zIndex();
} else if ((typeof zIndex === 'undefined' ? 'undefined' : _typeof(zIndex)) === undefined) {
zIndex = 2000;
}
return zIndex++;
}
/***/ }),
/***/ 88:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _src_utils_zIndex_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5);
/**
* Get target DOM Node
* @param {(Node|string|Boolean)} [node=document.body] DOM Node, CSS selector, or Boolean
* @return {Node} The target that the el will be appended to
*/
function getTarget(node) {
if (node === void 0) {
node = document.body;
}
if (node === true) {
return document.body;
}
return node instanceof window.Node ? node : document.querySelector(node);
}
var directive = {
inserted: function inserted(el, _ref, vnode) {
var value = _ref.value;
if (el.dataset && el.dataset.transfer !== 'true') return false;
el.className = el.className ? el.className + ' v-transfer-dom' : 'v-transfer-dom';
el.style.zIndex = Object(_src_utils_zIndex_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])();
var parentNode = el.parentNode;
if (!parentNode) return;
var home = document.createComment('');
var hasMovedOut = false;
if (value !== false) {
parentNode.replaceChild(home, el); // moving out, el is no longer in the document
getTarget(value).appendChild(el); // moving into new place
hasMovedOut = true;
}
if (!el.__transferDomData) {
el.__transferDomData = {
parentNode: parentNode,
home: home,
target: getTarget(value),
hasMovedOut: hasMovedOut,
keepMoved: el.dataset.keepMoved || false
};
}
},
componentUpdated: function componentUpdated(el, _ref2) {
var value = _ref2.value;
if (el.dataset && el.dataset.transfer !== 'true') return false;
// need to make sure children are done updating (vs. `update`)
var ref$1 = el.__transferDomData;
if (!ref$1) return;
// homes.get(el)
var parentNode = ref$1.parentNode;
var home = ref$1.home;
var hasMovedOut = ref$1.hasMovedOut; // recall where home is
if (!hasMovedOut && value) {
// remove from document and leave placeholder
parentNode.replaceChild(home, el);
// append to target
getTarget(value).appendChild(el);
el.__transferDomData = Object.assign({}, el.__transferDomData, { hasMovedOut: true, target: getTarget(value) });
} else if (hasMovedOut && value === false) {
// previously moved, coming back home
parentNode.replaceChild(el, home);
el.__transferDomData = Object.assign({}, el.__transferDomData, { hasMovedOut: false, target: getTarget(value) });
} else if (value) {
// already moved, going somewhere else
getTarget(value).appendChild(el);
}
},
unbind: function unbind(el) {
if (el.dataset && el.dataset.transfer !== 'true') return false;
el.className = el.className.replace('v-transfer-dom', '');
var ref$1 = el.__transferDomData;
if (!ref$1) return;
if (el.__transferDomData.hasMovedOut === true && !el.__transferDomData.keepMoved) {
el.__transferDomData.parentNode && el.__transferDomData.parentNode.appendChild(el);
}
el.__transferDomData = null;
}
};
/* harmony default export */ __webpack_exports__["a"] = (directive);
/***/ }),
/***/ 93:
/***/ (function(module, exports) {
/* @import "./dialog.css"; */
/***/ })
/******/ })["default"];