UNPKG

kingdot

Version:

A UI Components Library For Vue

864 lines (796 loc) 28.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 = "/dist/"; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 252); /******/ }) /************************************************************************/ /******/ ({ /***/ 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 } } /***/ }), /***/ 252: /***/ (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/Spinner/spinner.vue?vue&type=template&id=08571f6a& var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"kd-spinner",class:[ 'kd-spinner-' + _vm.size, { 'kd-spinner-right': _vm.buttonPosition, 'kd-spinner-disabled': _vm.disabled, } ]},[_c('i',{staticClass:"kd-spinner-btn",class:_vm.minusStyles,on:{"click":_vm.minusNum}}),_c('i',{staticClass:"kdicon kd-spinner-btn",class:_vm.addStyles,on:{"click":_vm.addNum}}),_c('kd-input',{ref:"input",staticClass:"kd-spinner-input",class:[("kd-spinner-" + (_vm.buttonPosition?_vm.buttonPosition +'-': '') + "input")],attrs:{"disabled":_vm.disabled,"placeholder":_vm.placeholder,"size":_vm.size || 'default'},on:{"blur":_vm.handleBlur,"focus":_vm.handleFocus,"keydown":[function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"up",38,$event.key,["Up","ArrowUp"])){ return null; }return _vm.addNum($event)},function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"down",40,$event.key,["Down","ArrowDown"])){ return null; }return _vm.minusNum($event)}]},model:{value:(_vm.inputValue),callback:function ($$v) {_vm.inputValue=$$v},expression:"inputValue"}})],1)} var staticRenderFns = [] // CONCATENATED MODULE: ./components/Spinner/spinner.vue?vue&type=template&id=08571f6a& // EXTERNAL MODULE: ./components/Input/index.js var Input = __webpack_require__(26); // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./components/Spinner/spinner.vue?vue&type=script&lang=js& // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // /* harmony default export */ var spinnervue_type_script_lang_js_ = ({ name: 'KdSpinner', components: { KdInput: Input["default"] }, props: { value: { type: [Number, String], default: 0 }, min: { type: Number }, max: { type: Number }, step: { type: Number, default: null }, precision: { type: Number, default: null }, buttonPosition: { type: String, default: '' }, disabled: { type: Boolean, default: false }, placeholder: { type: String, default: '' }, size: { type: String, default: 'default' }, inputStep: { type: Boolean, default: false } }, data: function data() { return { inputValue: null, isMax: false, isMin: false }; }, computed: { addStyles: function addStyles() { var pos = this.buttonPosition; var disabled = this.disabled; var isMax = this.isMax; var styles = ['kd-spinner-' + (pos ? pos + '-' : '') + 'add', pos ? 'kd-icon-arrow-up-solid' : 'kd-icon-plus-solid', { 'kd-spinner-disabled-btn': disabled || isMax }]; return styles; }, minusStyles: function minusStyles() { var pos = this.buttonPosition; var disabled = this.disabled; var isMin = this.isMin; var styles = ['kd-spinner-' + (pos ? pos + '-' : '') + 'minus', pos ? 'kd-icon-arrow-down' : 'kd-icon-minus-solid', { 'kd-spinner-disabled-btn': disabled || isMin }]; return styles; } }, watch: { value: { immediate: true, handler: function handler(v) { this.valueFilter(Number(v)); } }, min: { immediate: false, handler: function handler(v) { if (v == undefined) return; if (v > this.value) { this.isMin = true; } if (v < this.value || v === this.value) { this.isMin = this.value === v || this.value < this.min; } } }, max: { immediate: false, handler: function handler(v) { if (v == undefined) return; if (v < this.value) { this.isMax = true; } if (v > this.value || v === this.value) { this.isMax = this.value === v || this.value > this.max; } } } }, methods: { valueFilter: function valueFilter(v) { var value = v; // 小数点 if (this.precision !== null) { value = this.addPoint(value); } this.isMax = v === this.max || v > this.max; this.isMin = v === this.min || v < this.min; this.inputValue = value; }, // 增加 addNum: function addNum() { var value = Number(this.inputValue); var max = this.max; var min = this.min; if (value === this.max || this.disabled) return; if (this.step === null) { value += 1; } else { value = (value * 10 + this.step * 10) / 10; } if (value > max && max !== null) { value = max; } if (value < min && value != undefined) { value = min; } this.$emit('input', value); this.$emit('change', value, this.value); }, // 减小 minusNum: function minusNum() { var value = Number(this.inputValue); var min = this.min; var max = this.max; if (value === this.min || this.disabled) return; if (this.step === null) { value -= 1; } else { value = (value * 10 - this.step * 10) / 10; } if (value < min && min !== null) { value = min; } if (value > max && min != undefined) { value = max; } this.$emit('input', value); this.$emit('change', value, this.value); }, handleChange: function handleChange(v) { var newv = Number(v); if (v === '' || isNaN(newv)) return; if (newv < this.min && this.min !== null) { newv = this.min; } if (newv > this.max && this.max !== null) { newv = this.max; } this.valueFilter(newv); // 小数点转换number,会导致值为整数 this.inputValue = newv; this.$emit('input', newv); this.$emit('change', newv, this.value); }, handleBlur: function handleBlur(e) { var step = this.step; var value = Number(this.inputValue); if (isNaN(value)) { this.valueFilter(this.value); return; } // 去掉input输入时即刻变化,改为失焦 if (value < this.min && this.min !== null) { value = this.min; } if (value > this.max && this.max !== null) { value = this.max; } this.valueFilter(value); this.inputValue = value; // 输入精准 if (this.inputStep && step !== null) { var num = value / step; // 四舍五入取两位小数 var pow = Math.pow(10, this.precision); value = Math.floor(Math.round(num) * pow) / pow * step; } if (this.precision !== null) { this.inputValue = this.addPoint(value); } // this.$emit('input', this.inputValue); this.$emit('input', value); this.$emit('change', value, this.value); this.$emit('blur', e); }, addPoint: function addPoint(value) { return value.toFixed(this.precision); }, handleFocus: function handleFocus(e) { this.$emit('focus', e); }, focus: function focus() { this.$refs.input.focus(); }, blur: function blur() { this.$refs.input.blur(); }, select: function select() { this.$refs.input.select(); } } }); // CONCATENATED MODULE: ./components/Spinner/spinner.vue?vue&type=script&lang=js& /* harmony default export */ var Spinner_spinnervue_type_script_lang_js_ = (spinnervue_type_script_lang_js_); // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js var componentNormalizer = __webpack_require__(0); // CONCATENATED MODULE: ./components/Spinner/spinner.vue /* normalize component */ var component = Object(componentNormalizer["a" /* default */])( Spinner_spinnervue_type_script_lang_js_, render, staticRenderFns, false, null, null, null ) /* harmony default export */ var spinner = (component.exports); // CONCATENATED MODULE: ./components/Spinner/index.js spinner.install = function (Vue) { Vue.component(spinner.name, spinner); }; /* harmony default export */ var Spinner = __webpack_exports__["default"] = (spinner); /***/ }), /***/ 26: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _input_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6); _input_vue__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].install = function (Vue) { Vue.component(_input_vue__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].name, _input_vue__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"]); }; /* harmony default export */ __webpack_exports__["default"] = (_input_vue__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"]); /***/ }), /***/ 6: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./components/Input/input.vue?vue&type=template&id=a7898d5a& var render = function () { var _obj; var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{class:[ _vm.type === 'textarea' ? 'kd-textarea' : 'kd-input', 'kd-input-' + _vm.size, ( _obj = { 'kd-input-disabled': _vm.disabled, 'kd-input-group': _vm.$slots.prepend || _vm.$slots.append, 'kd-with-prefix': _vm.$slots.prefix, 'kd-with-suffix': _vm.$slots.suffix || _vm.success || _vm.warning || _vm.error || _vm.clearable, 'kd-input-fluid': _vm.fluid }, _obj['kd-input-status-' + (_vm.status === 'error' ? 'err' : _vm.status)] = _vm.success || _vm.warning || _vm.error, _obj['kd-textarea-show-count'] = _vm.showCount, _obj['kd-is-exceed'] = _vm.isExceed, _obj['kd-textarea-resize-vertical'] = _vm.type === 'textarea' && _vm.resize === 'vertical', _obj ) ],style:({width: parseInt(_vm.width) + 'px'})},[(_vm.$slots.prepend)?_c('div',{staticClass:"kd-input-prepend"},[_vm._t("prepend")],2):_vm._e(),_c('div',{staticClass:"kd-input-wrapper"},[(_vm.$slots.prefix)?_c('div',{staticClass:"kd-input-prefix"},[_vm._t("prefix")],2):_vm._e(),((_vm.type)==='checkbox'&&(_vm.type !== 'textarea'))?_c('input',_vm._b({directives:[{name:"model",rawName:"v-model",value:(_vm.innerValue),expression:"innerValue"}],ref:"input",staticClass:"kd-input-inner",attrs:{"readonly":_vm.readonly,"disabled":_vm.disabled,"tabindex":_vm.tabindex,"maxlength":_vm.maxlength,"type":"checkbox"},domProps:{"checked":Array.isArray(_vm.innerValue)?_vm._i(_vm.innerValue,null)>-1:(_vm.innerValue)},on:{"focus":_vm.focusHandler,"change":[function($event){var $$a=_vm.innerValue,$$el=$event.target,$$c=$$el.checked?(true):(false);if(Array.isArray($$a)){var $$v=null,$$i=_vm._i($$a,$$v);if($$el.checked){$$i<0&&(_vm.innerValue=$$a.concat([$$v]))}else{$$i>-1&&(_vm.innerValue=$$a.slice(0,$$i).concat($$a.slice($$i+1)))}}else{_vm.innerValue=$$c}},_vm.changeHandler],"blur":_vm.blurHandler,"keydown":_vm.keydownHandler,"keyup":_vm.keyupHandler}},'input',_vm.$attrs,false)):((_vm.type)==='radio'&&(_vm.type !== 'textarea'))?_c('input',_vm._b({directives:[{name:"model",rawName:"v-model",value:(_vm.innerValue),expression:"innerValue"}],ref:"input",staticClass:"kd-input-inner",attrs:{"readonly":_vm.readonly,"disabled":_vm.disabled,"tabindex":_vm.tabindex,"maxlength":_vm.maxlength,"type":"radio"},domProps:{"checked":_vm._q(_vm.innerValue,null)},on:{"focus":_vm.focusHandler,"change":[function($event){_vm.innerValue=null},_vm.changeHandler],"blur":_vm.blurHandler,"keydown":_vm.keydownHandler,"keyup":_vm.keyupHandler}},'input',_vm.$attrs,false)):(_vm.type !== 'textarea')?_c('input',_vm._b({directives:[{name:"model",rawName:"v-model",value:(_vm.innerValue),expression:"innerValue"}],ref:"input",staticClass:"kd-input-inner",attrs:{"readonly":_vm.readonly,"disabled":_vm.disabled,"tabindex":_vm.tabindex,"maxlength":_vm.maxlength,"type":_vm.type},domProps:{"value":(_vm.innerValue)},on:{"focus":_vm.focusHandler,"change":_vm.changeHandler,"blur":_vm.blurHandler,"keydown":_vm.keydownHandler,"keyup":_vm.keyupHandler,"input":function($event){if($event.target.composing){ return; }_vm.innerValue=$event.target.value}}},'input',_vm.$attrs,false)):_c('textarea',_vm._b({directives:[{name:"model",rawName:"v-model",value:(_vm.innerValue),expression:"innerValue"}],ref:"textarea",staticClass:"kd-input-inner",style:(_vm.textareaStyle),attrs:{"type":_vm.type,"readonly":_vm.readonly,"disabled":_vm.disabled,"rows":_vm.rows,"maxlength":_vm.maxlength,"tabindex":_vm.tabindex},domProps:{"value":(_vm.innerValue)},on:{"focus":_vm.focusHandler,"change":_vm.changeHandler,"blur":_vm.blurHandler,"keydown":_vm.keydownHandler,"keyup":_vm.keyupHandler,"input":function($event){if($event.target.composing){ return; }_vm.innerValue=$event.target.value}}},'textarea',_vm.$attrs,false)),(_vm.$slots.suffix || _vm.clearable || _vm.success || _vm.warning || _vm.error)?_c('div',{staticClass:"kd-input-suffix"},[_vm._t("suffix"),(_vm.success || _vm.warning || _vm.error)?_c('i',{class:{ 'kd-icon-success-solid': _vm.success, 'kd-icon-warning-solid': _vm.warning, 'kd-icon-error-solid': _vm.error }}):(_vm.showClearable)?_c('i',{staticClass:"kd-icon-error-solid kd-input-clearable",class:{'kd-input-show': _vm.value},on:{"click":function($event){$event.stopPropagation();return _vm.clear($event)}}}):_vm._e()],2):_vm._e(),(_vm.isShowCount)?_c('span',{staticClass:"kd-textarea-count"},[_vm._v("\n "+_vm._s(_vm.textLength)+"/"+_vm._s(_vm.limit)+"\n ")]):_vm._e()]),(_vm.$slots.append)?_c('div',{staticClass:"kd-input-append"},[_vm._t("append")],2):_vm._e()])} var staticRenderFns = [] // CONCATENATED MODULE: ./components/Input/input.vue?vue&type=template&id=a7898d5a& // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./components/Input/input.vue?vue&type=script&lang=js& // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // /* harmony default export */ var inputvue_type_script_lang_js_ = ({ name: 'KdInput', inheritAttrs: false, props: { tabindex: { type: String }, value: { type: [Number, String] }, width: { type: [Number, String] }, type: { type: String, default: 'text' }, readonly: { type: Boolean, default: false }, disabled: { type: Boolean, default: false }, size: { type: String, default: 'default' }, status: { type: String }, clearable: { type: Boolean, default: false }, fluid: { type: Boolean, default: false }, resize: { type: String }, rows: { type: [Number, String], default: 3 }, showCount: { type: Boolean, default: false }, lengthLimit: { type: Boolean, default: false }, maxVerticalResizeHeight: { type: [Number, String], default: 200 } }, data: function data() { return { innerValue: '', maxlength: '', currentTextareaStyle: {} }; }, computed: { textareaStyle: function textareaStyle() { return Object.assign({}, this.currentTextareaStyle, { resize: this.resize, width: parseInt(this.width) + 'px' }, this.resize === 'vertical' ? { maxHeight: this.maxVerticalResizeHeight + 'px' } : {}); }, success: function success() { return this.status === 'success'; }, error: function error() { return this.status === 'error'; }, warning: function warning() { return this.status === 'warning'; }, showClearable: function showClearable() { return this.clearable && !this.readonly && !this.disabled && this.innerValue && this.type !== 'textarea'; }, isShowCount: function isShowCount() { return this.showCount && this.$attrs.maxlength && (this.type === 'text' || this.type === 'textarea') && !this.disabled && !this.readonly; }, textLength: function textLength() { if (typeof this.value === 'number') { return String(this.value).length; } return (this.value || '').length; }, limit: function limit() { return this.$attrs.maxlength; }, isExceed: function isExceed() { return this.$attrs.maxlength && (this.type === 'text' || this.type === 'textarea') && !this.disabled && !this.readonly && this.textLength > this.limit; } }, watch: { value: function value(v) { this.innerValue = v; }, innerValue: function innerValue(v) { if (v === this.value) return; this.$emit('input', v); } }, created: function created() { this.innerValue = this.value; if (this.$attrs.maxlength) { this.maxlength = this.$attrs.maxlength; } else if (this.lengthLimit) { this.maxlength = 512; } }, methods: { getInputElem: function getInputElem() { return this.$refs.input || this.$refs.textarea; }, focus: function focus() { this.getInputElem().focus(); }, blur: function blur() { this.getInputElem().blur(); }, select: function select() { this.getInputElem().select(); }, focusHandler: function focusHandler(event) { this.$emit('focus', event); }, changeHandler: function changeHandler(event) { this.$emit('change', event.target.value); }, blurHandler: function blurHandler(event) { this.innerValue = this.value; this.$emit('blur', event); }, clear: function clear() { this.$emit('input', ''); this.$emit('change', ''); this.$emit('clear'); }, keydownHandler: function keydownHandler(e) { if (e.code === 'Enter') { this.$emit('enter', e); } else { this.$emit('keydown', e); } }, keyupHandler: function keyupHandler(e) { this.$emit('keyup', e); } } }); // CONCATENATED MODULE: ./components/Input/input.vue?vue&type=script&lang=js& /* harmony default export */ var Input_inputvue_type_script_lang_js_ = (inputvue_type_script_lang_js_); // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js var componentNormalizer = __webpack_require__(0); // CONCATENATED MODULE: ./components/Input/input.vue /* normalize component */ var component = Object(componentNormalizer["a" /* default */])( Input_inputvue_type_script_lang_js_, render, staticRenderFns, false, null, null, null ) /* harmony default export */ var input = __webpack_exports__["a"] = (component.exports); /***/ }) /******/ })["default"];