UNPKG

kingdot

Version:

A UI Components Library For Vue

865 lines (785 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 = 254); /******/ }) /************************************************************************/ /******/ ({ /***/ 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 } } /***/ }), /***/ 254: /***/ (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/Steps/steps.vue?vue&type=template&id=4796b2cc& var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{ref:"kdSteps",class:_vm.allClassList,style:(_vm.stepsStyle),attrs:{"id":"kd-steps"}},[_vm._t("default")],2)} var staticRenderFns = [] // CONCATENATED MODULE: ./components/Steps/steps.vue?vue&type=template&id=4796b2cc& // EXTERNAL MODULE: ./src/utils/utils.js + 1 modules var utils = __webpack_require__(3); // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./components/Steps/steps.vue?vue&type=script&lang=js& // // // // // // // // // // /* harmony default export */ var stepsvue_type_script_lang_js_ = ({ name: 'KdSteps', components: {}, props: { value: { type: [String, Number], default: 1 }, type: { type: String, default: 'default' // default,simple,spot若为simple,description/direction/space失效 }, position: { type: String, default: 'right' }, size: { type: String, default: 'default' }, direction: { type: String, default: 'horizontal' // (horizontal,vertical),vertical,父元素一定要设置高度 }, width: { type: [String, Number] }, isClick: { type: Boolean, default: false }, finishStatus: { type: String, default: 'finished' // error,wait,finished,active }, currentStatus: { type: String, default: 'active' // error,wait,finished,active }, finishedStyle: { type: String, default: 'icon' // icon number } }, data: function data() { return { stepIndex: this.value, children: [], orientation: this.direction, spotLineLH: '' }; }, computed: { allClassList: function allClassList() { var allClassAry = ['kd-steps-container', this.direction ? 'kd-steps-' + this.direction : '']; return allClassAry; }, stepsStyle: function stepsStyle() { var style = {}; if (this.width) { style.width = this.width + 'px'; } return style; } }, watch: { value: function value(v) { this.stepIndex = v; }, direction: function direction(v) { this.orientation = v; }, children: function children(steps) { steps.forEach(function (child, index) { child.index = index + 1; }); } }, created: function created() { this.resetDirection(); }, mounted: function mounted() { this.getChildWidth(); }, methods: { resetDirection: function resetDirection() { if (this.type !== 'default') { this.orientation = 'horizontal'; } }, getChildWidth: function getChildWidth() { var childNum = this.children.length; var precent = 100; var lastChildWidth = precent / childNum + '%'; var parent = this; var childrenList = Array.from(parent.children); var lastChild = childrenList[childNum - 1]; if (childNum === 2) { childrenList[0].$el.style['flex-basis'] = 90 + '%'; } if (this.type === 'default' && this.direction === 'vertical') { var headH = lastChild.$refs.stepHead.clientHeight; var mainElement = lastChild.$refs.stepMain; lastChild.$el.style['max-height'] = lastChildWidth; if (!mainElement) { lastChild.$el.style.height = headH + 'px'; } else { if (!lastChild.$refs.stepDesc && lastChild.$refs.stepTitle) { lastChild.$el.style.height = headH + 'px'; } } } else if (this.direction === 'horizontal') { // debugger; lastChild.$el.style['max-width'] = lastChildWidth; childrenList.forEach(function (item, index) { var stepHead = item.$refs.stepHead; var headWidth = stepHead ? Object(utils["e" /* isIe */])() ? stepHead.clientWidth : stepHead.offsetWidth : 0; var mainElement = item.$refs.stepMain; var stepTitle = mainElement ? item.$refs.stepTitle : null; var titleWidth = stepTitle ? Object(utils["e" /* isIe */])() ? stepTitle.clientWidth : stepTitle.offsetWidth : 0; var stepDesc = mainElement ? item.$refs.stepDesc : null; if (!stepDesc && stepTitle) { item.$refs.stepMain.style.width = titleWidth + headWidth + 'px'; } if (index === childrenList.length - 1) { if (!mainElement) { item.$el.style.width = headWidth + 'px'; } } }); } if (this.type === 'simple') { lastChild.$el.style['flex-basis'] = lastChildWidth; } } } }); // CONCATENATED MODULE: ./components/Steps/steps.vue?vue&type=script&lang=js& /* harmony default export */ var Steps_stepsvue_type_script_lang_js_ = (stepsvue_type_script_lang_js_); // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js var componentNormalizer = __webpack_require__(0); // CONCATENATED MODULE: ./components/Steps/steps.vue /* normalize component */ var component = Object(componentNormalizer["a" /* default */])( Steps_stepsvue_type_script_lang_js_, render, staticRenderFns, false, null, null, null ) /* harmony default export */ var steps = (component.exports); // CONCATENATED MODULE: ./components/Steps/index.js steps.install = function (Vue) { Vue.component(steps.name, steps); }; /* harmony default export */ var Steps = __webpack_exports__["default"] = (steps); /***/ }), /***/ 27: /***/ (function(module, exports) { /***/ }), /***/ 3: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, "g", function() { return /* binding */ utils_ulid; }); __webpack_require__.d(__webpack_exports__, "f", function() { return /* binding */ mouseDragBegin; }); __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ animationFrame; }); __webpack_require__.d(__webpack_exports__, "e", function() { return /* binding */ isIe; }); __webpack_require__.d(__webpack_exports__, "c", function() { return /* binding */ isEmpty; }); __webpack_require__.d(__webpack_exports__, "d", function() { return /* binding */ isFunction; }); __webpack_require__.d(__webpack_exports__, "b", function() { return /* binding */ arrayEquals; }); // UNUSED EXPORTS: isNumber, _$, getElementInScroll, getScrollbarWidth, getStyle, stopPropagation // CONCATENATED MODULE: ./node_modules/ulid/dist/index.esm.js function createError(message) { var err = new Error(message); err.source = "ulid"; return err; } // These values should NEVER change. If // they do, we're no longer making ulids! var ENCODING = "0123456789ABCDEFGHJKMNPQRSTVWXYZ"; // Crockford's Base32 var ENCODING_LEN = ENCODING.length; var TIME_MAX = Math.pow(2, 48) - 1; var TIME_LEN = 10; var RANDOM_LEN = 16; function replaceCharAt(str, index, char) { if (index > str.length - 1) { return str; } return str.substr(0, index) + char + str.substr(index + 1); } function incrementBase32(str) { var done = undefined; var index = str.length; var char = void 0; var charIndex = void 0; var maxCharIndex = ENCODING_LEN - 1; while (!done && index-- >= 0) { char = str[index]; charIndex = ENCODING.indexOf(char); if (charIndex === -1) { throw createError("incorrectly encoded string"); } if (charIndex === maxCharIndex) { str = replaceCharAt(str, index, ENCODING[0]); continue; } done = replaceCharAt(str, index, ENCODING[charIndex + 1]); } if (typeof done === "string") { return done; } throw createError("cannot increment this string"); } function randomChar(prng) { var rand = Math.floor(prng() * ENCODING_LEN); if (rand === ENCODING_LEN) { rand = ENCODING_LEN - 1; } return ENCODING.charAt(rand); } function encodeTime(now, len) { if (isNaN(now)) { throw new Error(now + " must be a number"); } if (now > TIME_MAX) { throw createError("cannot encode time greater than " + TIME_MAX); } if (now < 0) { throw createError("time must be positive"); } if (Number.isInteger(now) === false) { throw createError("time must be an integer"); } var mod = void 0; var str = ""; for (; len > 0; len--) { mod = now % ENCODING_LEN; str = ENCODING.charAt(mod) + str; now = (now - mod) / ENCODING_LEN; } return str; } function encodeRandom(len, prng) { var str = ""; for (; len > 0; len--) { str = randomChar(prng) + str; } return str; } function decodeTime(id) { if (id.length !== TIME_LEN + RANDOM_LEN) { throw createError("malformed ulid"); } var time = id.substr(0, TIME_LEN).split("").reverse().reduce(function (carry, char, index) { var encodingIndex = ENCODING.indexOf(char); if (encodingIndex === -1) { throw createError("invalid character found: " + char); } return carry += encodingIndex * Math.pow(ENCODING_LEN, index); }, 0); if (time > TIME_MAX) { throw createError("malformed ulid, timestamp too large"); } return time; } function detectPrng() { var allowInsecure = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; var root = arguments[1]; if (!root) { root = typeof window !== "undefined" ? window : null; } var browserCrypto = root && (root.crypto || root.msCrypto); if (browserCrypto) { return function () { var buffer = new Uint8Array(1); browserCrypto.getRandomValues(buffer); return buffer[0] / 0xff; }; } else { try { var nodeCrypto = __webpack_require__(27); return function () { return nodeCrypto.randomBytes(1).readUInt8() / 0xff; }; } catch (e) {} } if (allowInsecure) { try { console.error("secure crypto unusable, falling back to insecure Math.random()!"); } catch (e) {} return function () { return Math.random(); }; } throw createError("secure crypto unusable, insecure Math.random not allowed"); } function factory(currPrng) { if (!currPrng) { currPrng = detectPrng(); } return function ulid(seedTime) { if (isNaN(seedTime)) { seedTime = Date.now(); } return encodeTime(seedTime, TIME_LEN) + encodeRandom(RANDOM_LEN, currPrng); }; } function monotonicFactory(currPrng) { if (!currPrng) { currPrng = detectPrng(); } var lastTime = 0; var lastRandom = void 0; return function ulid(seedTime) { if (isNaN(seedTime)) { seedTime = Date.now(); } if (seedTime <= lastTime) { var incrementedRandom = lastRandom = incrementBase32(lastRandom); return encodeTime(lastTime, TIME_LEN) + incrementedRandom; } lastTime = seedTime; var newRandom = lastRandom = encodeRandom(RANDOM_LEN, currPrng); return encodeTime(seedTime, TIME_LEN) + newRandom; }; } var ulid = factory(); // CONCATENATED MODULE: ./src/utils/utils.js 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 utils_ulid = function () { var crypto = (typeof window === 'undefined' ? 'undefined' : _typeof(window)) === 'object' && (window.crypto || window.msCrypto); // IE 11 uses window.msCrypto if (!crypto || !crypto.getRandomValues) { return factory(Math.random); } else { return factory(); } }(); function isNullOrUndefined(o) { return o === null || o === undefined; } function isNumber(o) { return typeof o === 'number'; } var pathMap = {}; var i18n = {}; var hasOwn = Object.prototype.hasOwnProperty; var charCodeOfDot = '.'.charCodeAt(0); var rePropName = RegExp( // Match anything that isn't a dot or bracket. '[^.[\\]]+' + '|' + // Or match property names within brackets. '\\[(?:' + // Match a non-string expression. "([^\"'].*)" + '|' + // Or match strings (supports escaping characters). "([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2" + ')\\]' + '|' + // Or match "" as the space between consecutive dots or empty brackets. '(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))', 'g'); // eslint-disable-next-line no-useless-escape var valueRegexp = /\{([^\}\s]+)\}/g; function castPath(path) { if (typeof path !== 'string') return path; if (pathMap[path]) return pathMap[path]; var result = []; if (path.charCodeAt(0) === charCodeOfDot) { result.push(''); } path.replace(rePropName, function (match, expression, quote, subString) { var key = match; if (quote) { // eslint-disable-next-line no-undef key = subString.replace(reEscapeChar, '$1'); } else if (expression) { key = expression; } result.push(key); }); pathMap[path] = result; return result; } function get(object, path, defaultValue) { if (hasOwn.call(object, path)) return object[path]; path = castPath(path); var index = 0; var length = path.length; while (!isNullOrUndefined(object) && index < length) { object = object[path[index++]]; } return index && index === length && object !== undefined ? object : defaultValue; } function _$(key, data) { var value = get(i18n, key); if (isNullOrUndefined(value)) { value = key; } if (data) { value = value.replace(valueRegexp, function (nouse, variable) { var suffix = void 0; var index = variable.indexOf(':'); if (index > 0) { suffix = variable.substr(0, index); suffix = suffix.split('|'); variable = variable.substr(index + 1); variable = get(data, variable); if (variable > 1) { return suffix.length > 1 ? suffix[1] : suffix[0]; } else { return suffix.length > 1 ? suffix[0] : ''; } } else { variable = get(data, variable); return isNullOrUndefined(variable) ? nouse : variable; } }); } return value; } function getElementInScroll(e, eqValue) { if (typeof eqValue !== 'number') { eqValue = eqValue.offsetHeight; } var data = e.getBoundingClientRect(); var clientHeight = document.body.clientHeight; var selfHeight = e.offsetHeight; var result = void 0; if (clientHeight - data.y - selfHeight - eqValue > 0) { result = true; } else if (data.y - eqValue > 0) { result = false; } else { result = true; } return result; } var _scrollbarWdith = null; var _getScrollbarWidth = function _getScrollbarWidth() { var odiv = document.createElement('div'); // 创建一个div var styles = { width: '100px', height: '100px', overflowY: 'scroll' // 让他有滚动条 }; var i; var scrollbarWidth; for (i in styles) { odiv.style[i] = styles[i]; }odiv.setAttribute('id', 'tet_scroll'); document.body.appendChild(odiv); // 把div添加到body中 scrollbarWidth = odiv.offsetWidth - odiv.clientWidth; // 相减 _removeNode(odiv); // 移除创建的div return scrollbarWidth; // 返回滚动条宽度 }; function _removeNode(node) { node.remove ? node.remove() : node.parentElement.removeChild(node); } function getScrollbarWidth() { if (!_scrollbarWdith) { _scrollbarWdith = _getScrollbarWidth(); } return _scrollbarWdith; } function getStyle(obj, attr, getNumber) { var _result; if (obj.currentStyle) { _result = obj.currentStyle[attr]; } else { _result = document.defaultView.getComputedStyle(obj, null)[attr]; } return getNumber ? Number.parseInt(_result) : _result; } var windowPaddingMin = 1; function mouseDragBegin(_ref, dragFn, endFn) { var x = _ref.x, y = _ref.y, target = _ref.target; var outBraking = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; var startPosition = { x: x, y: y }; var prePosition = { x: x, y: y }; var _target$getClientRect = target.getClientRects()[0], top = _target$getClientRect.top, left = _target$getClientRect.left, width = _target$getClientRect.width, height = _target$getClientRect.height; var _document$body = document.body, offsetHeight = _document$body.offsetHeight, offsetWidth = _document$body.offsetWidth; var minLeft = (outBraking.left || windowPaddingMin) + (startPosition.x - left); var minTop = (outBraking.top || windowPaddingMin) + (startPosition.y - top); var maxTop = offsetHeight - height; var maxLeft = offsetWidth - (outBraking.right || windowPaddingMin) - (width - (startPosition.x - left)); var mouseMove = function mouseMove(e) { e = window.event || e; var _x, _y; if (minLeft > e.x) { _x = minLeft; } else if (e.x > maxLeft) { _x = maxLeft; } else { _x = e.x; } if (e.y < minTop) { _y = minTop; } else if (e.y > maxTop) { _y = maxTop; } else { _y = e.y; } prePosition = { x: _x, y: _y }; dragFn(startPosition, prePosition); e.preventDefault(); }; var mouseUp = function mouseUp() { endFn && endFn(startPosition, prePosition); document.removeEventListener('mousemove', mouseMove); document.removeEventListener('mouseup', mouseUp); }; document.addEventListener('mousemove', mouseMove); document.addEventListener('mouseup', mouseUp); } var _requestAnimationFrame = window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : setTimeout; function animationFrame(fn) { return _requestAnimationFrame(fn); } function stopPropagation(event) { window.event ? window.event.cancelBubble = true : event.stopPropagation(); } var userAgent = navigator.userAgent; // 取得浏览器的userAgent字符串 // eslint-disable-next-line no-unused-vars var isIE = userAgent.indexOf('compatible') > -1 && userAgent.indexOf('MSIE') > -1; function isIe() { var result = false; var userAgent = navigator.userAgent; // 取得浏览器的userAgent字符串 var isIE = userAgent.indexOf('compatible') > -1 && userAgent.indexOf('MSIE') > -1; // 判断是否IE<11浏览器 var isEdge = userAgent.indexOf('Edge') > -1 && !isIE; // 判断是否IE的Edge浏览器 var isIE11 = userAgent.indexOf('Trident') > -1 && userAgent.indexOf('rv:11.0') > -1; if (isIE || isEdge || isIE11) { result = true; } else { result = false; } return result; } function isEmpty(val) { // val 为 null、undefined 时 if (val == null) return true; if (typeof val === 'number') return isNaN(val); if (typeof val === 'boolean' || val instanceof RegExp) return false; if (typeof val === 'string') return val.trim().length === 0; if ((typeof val === 'undefined' ? 'undefined' : _typeof(val)) === 'object') { if (Object.prototype.toString.call(val) === '[object Array]') return !val.length; if (Object.prototype.toString.call(val) === '[object Object]') return !Object.keys(val).length; } return false; } function isFunction(fn) { return fn && Object.toString.call(fn) === '[object Function]'; } function arrayEquals(arr1, arr2) { if (!(arr1 || arr2)) return false; if (arr1.length !== arr2.length) return false; for (var i = 0; i < arr1.length; i++) { if (arr1[i] instanceof Array && arr2[i] instanceof Array) { return arrayEquals(arr1[i], arr2[i]); } else { if (arr1[i] !== arr2[i]) return false; } } return true; } /***/ }) /******/ })["default"];