UNPKG

vueui-widgets

Version:
1,708 lines (1,513 loc) 274 kB
// 数组find方法 if (!Array.prototype.find) { Object.defineProperty(Array.prototype, 'find', { value: function (predicate) { if (this == null) { throw new TypeError('"this" is null or not defined'); } var o = Object(this); var len = o.length >>> 0; if (typeof predicate !== 'function') { throw new TypeError('predicate must be a function') } var thisArg = arguments[1]; var k = 0; while (k < len) { var kValue = o[k]; if (predicate.call(thisArg, kValue, k, o)) { return kValue } k++; } return undefined } }); } var iconTypes = { info: 'information-circled', success: 'checkmark-circled', warning: 'android-alert', error: 'close-circled', loading: 'load-c', confirm: 'help-circled' }; var isFunc = function (f) { return typeof f === 'function'; }; var isStr = function (s) { return typeof s === 'string'; }; var isArr = function (arr) { return arr instanceof Array; }; var getType = function (obj) { return Object.prototype.toString.call(obj).slice(8, -1).toLowerCase(); }; var _maxZIndex = 0; var getMaxZIndex = function () { if (_maxZIndex) { return _maxZIndex += 2 } _maxZIndex = 1000; Array.from(document.querySelectorAll('body>*')).forEach(function (el) { var ref = window.getComputedStyle(el, null); var zIndex = ref.zIndex; if (!isNaN(zIndex)) { _maxZIndex = Math.max(_maxZIndex, zIndex); } }); return _maxZIndex }; var isFoundByOptions = function (vm, query) { return isStr(query) ? vm.$options.name === query : Object.keys(query).every(function (_) { return vm.$options[_] === query[_]; }) }; var findChildrens = function (vm, query) { var rtnArr = [], nochecked = vm.$children.slice(); while (nochecked.length) { var item = nochecked.shift(); isFoundByOptions(item, query) ? rtnArr.push(item) : item.$children.forEach(function (_) { return nochecked.push(_); }); } return rtnArr }; var findParent = function (vm, query) { var par = vm.$parent; while (par) { if (isFoundByOptions(par, query)) { return par } par = par.$parent; } }; var winScrollbarLock = { getScrollbarWidth: function getScrollbarWidth() { var p = document.createElement('p'); var styles = { width: '100px', height: '100px', overflowY: 'scroll' }; for (var key in styles) { p.style[key] = styles[key]; } document.body.appendChild(p); var scrollbarWidth = p.offsetWidth - p.clientWidth; p.remove(); return scrollbarWidth }, lock: function lock() { this.locked = true; var winHeight = window.innerHeight; var ref = document.body; var scrollHeight = ref.scrollHeight; if (winHeight > scrollHeight) { return } document.body.style.paddingRight = (this.getScrollbarWidth()) + "px"; document.body.style.overflow = 'hidden'; }, unlock: function unlock() { this.locked = false; document.body.style.paddingRight = document.body.style.overflow = ''; } }; var throttle = function (fn, gapTime) { if ( gapTime === void 0 ) gapTime = 16; var lastTime = null; return function () { var nowTime = Date.now(); if (!lastTime || nowTime - lastTime > gapTime) { fn(); lastTime = nowTime; } } }; var addStylesheet = function (id, styleStr) { var styleEl = document.getElementById(id); if (styleEl) { return } styleEl = document.createElement('style'); styleEl.id = id; styleEl.innerHTML = styleStr; document.head.appendChild(styleEl); }; var parseSize = function (size) { return isNaN(size) ? size : ((+size) + "px"); }; var UiRender = { functional: true, render: function (h, ctx) { return ctx.props.render(h); } }; /** * 设置文本域自动高度 * @param {HTMLTextAreaElement} textarea * @param {Number} minRows * @param {Number} maxRows */ var setAutoHeight = function (textarea, minRows, maxRows) { var style = window.getComputedStyle(textarea, null); var borderWidth = parseInt(style.borderTopWidth) + parseInt(style.borderBottomWidth); var padding = parseInt(style.paddingTop) + parseInt(style.paddingBottom); var lineHeight = parseInt(style.lineHeight); var matches = textarea.value.match(/\n/gm); var lbCount = matches ? matches.length : 0; var compare = borderWidth + padding + lineHeight * lbCount < textarea.scrollHeight; if (typeof minRows === 'number' && (!compare && lbCount <= minRows)) { return } if (typeof maxRows === 'number' && lbCount >= maxRows) { return } textarea.style.height = 'auto'; textarea.style.height = (textarea.scrollHeight + borderWidth) + "px"; }; /** * 格式化日期 * @param {Date|String} date * @param {String} format */ var dateFormat = function (date, format) { if ( format === void 0 ) format = 'yyyy-MM-dd hh:mm:ss'; if (typeof date === 'string') { var mts = date.match(/(\/Date\((\d+)\)\/)/); if (mts && mts.length >= 3) { date = parseInt(mts[2]); } } date = new Date(date); if (!date || date.toUTCString() === 'Invalid Date') { return '' } var map = { M: date.getMonth() + 1, d: date.getDate(), h: date.getHours(), m: date.getMinutes(), s: date.getSeconds(), q: Math.floor((date.getMonth() + 3) / 3), S: date.getMilliseconds() }; format = format.replace(/([yMdhmsqS])+/g, function (all, t) { var v = map[t]; if (v !== undefined) { if (all.length > 1) { v = '0' + v; v = v.substr(v.length - 2); } return v } else if (t === 'y') { return (date.getFullYear() + '').substr(4 - all.length) } return all }); return format }; var tools = /*#__PURE__*/Object.freeze({ iconTypes: iconTypes, isFunc: isFunc, isStr: isStr, isArr: isArr, getType: getType, getMaxZIndex: getMaxZIndex, findChildrens: findChildrens, findParent: findParent, winScrollbarLock: winScrollbarLock, throttle: throttle, addStylesheet: addStylesheet, parseSize: parseSize, UiRender: UiRender, setAutoHeight: setAutoHeight, dateFormat: dateFormat }); // // // var script = { name: 'UiIcon', props: { type: String, size: [Number, String], color: String }, computed: { styles: function styles() { var fontSize = this.size && ((parseInt(this.size)) + "px"); return { fontSize: fontSize, color: this.color } } } }; function normalizeComponent(template, style, script, scopeId, isFunctionalTemplate, moduleIdentifier /* server only */ , shadowMode, createInjector, createInjectorSSR, createInjectorShadow) { if (typeof shadowMode !== 'boolean') { createInjectorSSR = createInjector; createInjector = shadowMode; shadowMode = false; } // Vue.extend constructor export interop. var options = typeof script === 'function' ? script.options : script; // render functions if (template && template.render) { options.render = template.render; options.staticRenderFns = template.staticRenderFns; options._compiled = true; // functional template if (isFunctionalTemplate) { options.functional = true; } } // scopedId if (scopeId) { options._scopeId = scopeId; } var hook; if (moduleIdentifier) { // server build hook = function hook(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 (style) { style.call(this, createInjectorSSR(context)); } // register component module identifier for async chunk inference 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 (style) { hook = shadowMode ? function () { style.call(this, createInjectorShadow(this.$root.$options.shadowRoot)); } : function (context) { style.call(this, createInjector(context)); }; } if (hook) { if (options.functional) { // 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 script; } var normalizeComponent_1 = normalizeComponent; /* script */ var __vue_script__ = script; /* template */ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('i',_vm._g({class:[("ion-" + _vm.type), 'ui-icon'],style:(_vm.styles)},_vm.$listeners))}; var __vue_staticRenderFns__ = []; /* style */ var __vue_inject_styles__ = undefined; /* scoped */ var __vue_scope_id__ = undefined; /* module identifier */ var __vue_module_identifier__ = undefined; /* functional template */ var __vue_is_functional_template__ = false; /* style inject */ /* style inject SSR */ var Icon = normalizeComponent_1( { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ }, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, undefined, undefined ); // var script$1 = { name: 'UiAvatar', components: { UiIcon: Icon }, data: function data() { return { prefix: 'ui-avatar' } }, props: { shape: { default: 'circle', validator: function validator(value) { return ['circle', 'square'].indexOf(value) !== -1 } }, size: { default: 'default', validator: function validator(value) { return ['large', 'small', 'default'].indexOf(value) !== -1 } }, src: String, icon: String }, computed: { classes: function classes() { var ref = this; var prefix = ref.prefix; var shape = ref.shape; var size = ref.size; var icon = ref.icon; var src = ref.src; return [prefix, (prefix + "--" + shape), (prefix + "--" + size), { isIcon: icon }] } } }; /* script */ var __vue_script__$1 = script$1; /* template */ var __vue_render__$1 = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('span',_vm._g({class:_vm.classes},_vm.$listeners),[_vm._t("default",[(_vm.src)?_c('img',{attrs:{"src":_vm.src}}):(_vm.icon)?_c('UiIcon',{attrs:{"type":_vm.icon}}):_vm._e()])],2)}; var __vue_staticRenderFns__$1 = []; /* style */ var __vue_inject_styles__$1 = undefined; /* scoped */ var __vue_scope_id__$1 = undefined; /* module identifier */ var __vue_module_identifier__$1 = undefined; /* functional template */ var __vue_is_functional_template__$1 = false; /* style inject */ /* style inject SSR */ var Avatar = normalizeComponent_1( { render: __vue_render__$1, staticRenderFns: __vue_staticRenderFns__$1 }, __vue_inject_styles__$1, __vue_script__$1, __vue_scope_id__$1, __vue_is_functional_template__$1, __vue_module_identifier__$1, undefined, undefined ); // var script$2 = { name: 'UiCard', components: { UiIcon: Icon }, data: function data() { return { prefix: 'ui-card', hasHeader: false } }, props: { bordered: { type: Boolean, default: true }, disHover: Boolean, shadow: Boolean, padding: { type: [Number, String], default: 16 }, title: String, icon: String }, computed: { classes: function classes() { var ref = this; var prefix = ref.prefix; var bordered = ref.bordered; var disHover = ref.disHover; var shadow = ref.shadow; return [prefix, { bordered: bordered, disHover: disHover, shadow: shadow }] } }, mounted: function mounted() { var ref = this.$slots; var title = ref.title; var extra = ref.extra; this.hasHeader = title !== undefined || extra !== undefined || this.icon || this.title; } }; /* script */ var __vue_script__$2 = script$2; /* template */ var __vue_render__$2 = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{class:_vm.classes},[(_vm.hasHeader)?_c('div',{class:(_vm.prefix + "--header")},[_c('div',{class:(_vm.prefix + "--title")},[_vm._t("title",[(_vm.icon)?_c('UiIcon',{attrs:{"type":_vm.icon}}):_vm._e(),_vm._v("\n "+_vm._s(_vm.title)+"\n ")])],2),_vm._v(" "),_vm._t("extra")],2):_vm._e(),_vm._v(" "),_c('div',{class:(_vm.prefix + "--body"),style:({padding: (_vm.padding + "px")})},[_vm._t("default")],2)])}; var __vue_staticRenderFns__$2 = []; /* style */ var __vue_inject_styles__$2 = undefined; /* scoped */ var __vue_scope_id__$2 = undefined; /* module identifier */ var __vue_module_identifier__$2 = undefined; /* functional template */ var __vue_is_functional_template__$2 = false; /* style inject */ /* style inject SSR */ var Card = normalizeComponent_1( { render: __vue_render__$2, staticRenderFns: __vue_staticRenderFns__$2 }, __vue_inject_styles__$2, __vue_script__$2, __vue_scope_id__$2, __vue_is_functional_template__$2, __vue_module_identifier__$2, undefined, undefined ); // var script$3 = { name: 'UiCloseIconButton', components: { UiIcon: Icon }, props: { size: { type: [Number, String], default: 22 } }, computed: { styles: function styles() { var size = parseSize(this.size); return { width: size, fontSize: size } } } }; /* script */ var __vue_script__$3 = script$3; /* template */ var __vue_render__$3 = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('UiIcon',_vm._g({staticClass:"ui-close-icon-button",style:(_vm.styles),attrs:{"type":"ios-close-empty"}},_vm.$listeners))}; var __vue_staticRenderFns__$3 = []; /* style */ var __vue_inject_styles__$3 = undefined; /* scoped */ var __vue_scope_id__$3 = undefined; /* module identifier */ var __vue_module_identifier__$3 = undefined; /* functional template */ var __vue_is_functional_template__$3 = false; /* style inject */ /* style inject SSR */ var CloseIconButton = normalizeComponent_1( { render: __vue_render__$3, staticRenderFns: __vue_staticRenderFns__$3 }, __vue_inject_styles__$3, __vue_script__$3, __vue_scope_id__$3, __vue_is_functional_template__$3, __vue_module_identifier__$3, undefined, undefined ); // var script$4 = { name: 'UiAlert', components: { UiIcon: Icon, UiCloseIconButton: CloseIconButton }, data: function data() { return { prefix: 'ui-alert', hasDesc: false, visible: true } }, props: { type: { default: 'info', validator: function validator(value) { return ['info', 'success', 'warning', 'error'].indexOf(value) !== -1 } }, closable: Boolean, showIcon: Boolean }, computed: { iconType: function iconType() { return iconTypes[this.type] }, classes: function classes() { var ref = this; var prefix = ref.prefix; var type = ref.type; var hasDesc = ref.hasDesc; return [prefix, (prefix + "--" + type), { hasDesc: hasDesc }] } }, methods: { close: function close(event) { this.visible = false; this.$emit('on-close', event); } }, mounted: function mounted() { this.hasDesc = this.$slots.desc !== undefined; } }; /* script */ var __vue_script__$4 = script$4; /* template */ var __vue_render__$4 = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('transition',{attrs:{"name":_vm.prefix}},[(_vm.visible)?_c('div',{class:_vm.classes},[(_vm.showIcon)?_c('UiIcon',{class:(_vm.prefix + "--icon"),attrs:{"type":_vm.iconType}}):_vm._e(),_vm._v(" "),_c('div',{class:(_vm.prefix + "--body")},[_c('p',{class:(_vm.prefix + "--title")},[_vm._t("default")],2),_vm._v(" "),_c('p',{class:(_vm.prefix + "--desc")},[_vm._t("desc")],2)]),_vm._v(" "),(_vm.closable)?_c('UiCloseIconButton',{class:(_vm.prefix + "--close"),on:{"click":_vm.close}}):_vm._e()],1):_vm._e()])}; var __vue_staticRenderFns__$4 = []; /* style */ var __vue_inject_styles__$4 = undefined; /* scoped */ var __vue_scope_id__$4 = undefined; /* module identifier */ var __vue_module_identifier__$4 = undefined; /* functional template */ var __vue_is_functional_template__$4 = false; /* style inject */ /* style inject SSR */ var Alert = normalizeComponent_1( { render: __vue_render__$4, staticRenderFns: __vue_staticRenderFns__$4 }, __vue_inject_styles__$4, __vue_script__$4, __vue_scope_id__$4, __vue_is_functional_template__$4, __vue_module_identifier__$4, undefined, undefined ); // // // // // // // var script$5 = { name: 'UiBadge', data: function data() { return { prefix: 'ui-badge', hasSlot: false } }, props: { count: [Number, String], overflowCount: { type: [Number, String], default: 99 }, dot: Boolean, className: String, type: { default: 'error', validator: function validator(value) { return ['success', 'primary', 'normal', 'error', 'warning', 'info'].indexOf(value) !== -1 } }, showZero: Boolean, text: String, offset: Array }, computed: { showCount: function showCount() { return this.text || (+this.count > +this.overflowCount ? ((this.overflowCount) + "+") : this.count) }, isDot: function isDot() { return this.dot && this.count !== 0 }, isShow: function isShow() { return this.text || (!this.dot && (this.count || this.showZero)) }, contentClasses: function contentClasses() { return [((this.prefix) + "--count"), this.type, this.className] }, contentStyles: function contentStyles() { var ref = (this.offset || []); var x = ref[0]; var y = ref[1]; var style = {}; if (x) { style.right = (-x) + "px"; } if (y) { style.top = y + "px"; } return style } }, mounted: function mounted() { this.hasSlot = this.$slots.default !== undefined; } }; /* script */ var __vue_script__$5 = script$5; /* template */ var __vue_render__$5 = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('span',{class:[_vm.prefix, {hasSlot: _vm.hasSlot}]},[_vm._t("default"),_vm._v(" "),(_vm.isDot)?_c('sup',{class:[(_vm.prefix + "--dot"), _vm.type],style:(_vm.contentStyles)}):(_vm.isShow)?_c('sup',{class:_vm.contentClasses,style:(_vm.contentStyles)},[_vm._v(_vm._s(_vm.showCount))]):_vm._e()],2)}; var __vue_staticRenderFns__$5 = []; /* style */ var __vue_inject_styles__$5 = undefined; /* scoped */ var __vue_scope_id__$5 = undefined; /* module identifier */ var __vue_module_identifier__$5 = undefined; /* functional template */ var __vue_is_functional_template__$5 = false; /* style inject */ /* style inject SSR */ var Badge = normalizeComponent_1( { render: __vue_render__$5, staticRenderFns: __vue_staticRenderFns__$5 }, __vue_inject_styles__$5, __vue_script__$5, __vue_scope_id__$5, __vue_is_functional_template__$5, __vue_module_identifier__$5, undefined, undefined ); // var script$6 = { name: 'UiRate', components: { UiIcon: Icon }, data: function data() { return { prefix: 'ui-rate', inputValue: this.value, tempValue: this.value } }, props: { count: { type: Number, default: 5 }, value: { type: Number, default: 0 }, allowHalf: Boolean, disabled: Boolean, showText: Boolean, clearable: Boolean, icon: { type: String, default: 'star' } }, watch: { value: function value(newval) { this.inputValue = this.tempValue = newval; }, inputValue: function inputValue(newval) { this.$emit('input', newval); this.$emit('on-change', newval); } }, methods: { onMouseenter: function onMouseenter(i, isFull) { if ( isFull === void 0 ) isFull = true; if (this.disabled) { return } this.tempValue = isFull ? i : i - .5; }, onMouseleave: function onMouseleave() { this.tempValue = this.inputValue; }, onClick: function onClick(i, isFull) { if ( isFull === void 0 ) isFull = true; if (this.disabled) { return } var value = isFull ? i : i - .5; if (this.clearable && value === this.inputValue) { return this.inputValue = 0 } this.inputValue = value; }, isActive: function isActive(i, isFull) { if ( isFull === void 0 ) isFull = true; return i <= this.tempValue && i <= this.inputValue + (isFull ? 0 : .5) }, fullClasses: function fullClasses(i) { var ref = this; var prefix = ref.prefix; var tempValue = ref.tempValue; var disabled = ref.disabled; return [(prefix + "--icon"), { active: this.isActive(i), hover: i <= tempValue, disabled: disabled }] }, halfClasses: function halfClasses(i) { var ref = this; var prefix = ref.prefix; var tempValue = ref.tempValue; var disabled = ref.disabled; return [(prefix + "--icon"), { active: this.isActive(i, false), hover: i <= tempValue + .5, disabled: disabled }] } } }; /* script */ var __vue_script__$6 = script$6; /* template */ var __vue_render__$6 = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{class:_vm.prefix},[_c('ul',{class:(_vm.prefix + "--list")},_vm._l((_vm.count),function(i){return _c('li',{key:i,class:(_vm.prefix + "--item")},[_c('UiIcon',{class:_vm.fullClasses(i),attrs:{"type":_vm.icon},on:{"mouseenter":function($event){return _vm.onMouseenter(i)},"mouseleave":_vm.onMouseleave,"click":function($event){return _vm.onClick(i)}}}),_vm._v(" "),(_vm.allowHalf)?_c('div',{class:(_vm.prefix + "--half")},[_c('UiIcon',{class:_vm.halfClasses(i),attrs:{"type":_vm.icon},on:{"mouseenter":function($event){return _vm.onMouseenter(i, false)},"mouseleave":_vm.onMouseleave,"click":function($event){return _vm.onClick(i, false)}}})],1):_vm._e()],1)}),0),_vm._v(" "),(_vm.showText)?_c('span',{class:(_vm.prefix + "--text")},[_vm._t("default",[_vm._v(_vm._s(_vm.inputValue)+" 星")])],2):_vm._e()])}; var __vue_staticRenderFns__$6 = []; /* style */ var __vue_inject_styles__$6 = undefined; /* scoped */ var __vue_scope_id__$6 = undefined; /* module identifier */ var __vue_module_identifier__$6 = undefined; /* functional template */ var __vue_is_functional_template__$6 = false; /* style inject */ /* style inject SSR */ var Rate = normalizeComponent_1( { render: __vue_render__$6, staticRenderFns: __vue_staticRenderFns__$6 }, __vue_inject_styles__$6, __vue_script__$6, __vue_scope_id__$6, __vue_is_functional_template__$6, __vue_module_identifier__$6, undefined, undefined ); // var prefix = 'ui-notice'; var script$7 = { name: 'UiNotice', components: { UiIcon: Icon, UiCloseIconButton: CloseIconButton }, transition: prefix, data: function data() { return { prefix: prefix, hasDesc: false } }, props: { title: String, duration: Number, onClose: Function, type: { default: 'open', validator: function validator(value) { return ['info', 'success', 'warning', 'error', 'open'].indexOf(value) !== -1 } } }, computed: { iconType: function iconType() { return iconTypes[this.type] }, showIcon: function showIcon() { return this.type !== 'open' } }, mounted: function mounted() { var this$1 = this; var ref = this.$slots.default; var desc = ref[0]; this.hasDesc = desc && (desc.text || desc.children); if (this.duration) { this.timerId = setTimeout(function () { return this$1.close(); }, this.duration * 1000); } }, beforeDestroy: function beforeDestroy() { clearTimeout(this.timerId); }, methods: { close: function close(event) { isFunc(this.onClose) && this.onClose(); this.$emit('close'); } } }; /* script */ var __vue_script__$7 = script$7; /* template */ var __vue_render__$7 = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{class:_vm.prefix},[_c('div',{class:[(_vm.prefix + "--box"), {hasDesc: _vm.hasDesc}]},[(_vm.showIcon)?_c('UiIcon',{class:[(_vm.prefix + "--icon"), _vm.type],attrs:{"type":_vm.iconType}}):_vm._e(),_vm._v(" "),_c('div',{class:(_vm.prefix + "--body")},[(_vm.title)?_c('div',{class:(_vm.prefix + "--title")},[_vm._v(_vm._s(_vm.title))]):_vm._e(),_vm._v(" "),_vm._t("default")],2),_vm._v(" "),_c('UiCloseIconButton',{class:(_vm.prefix + "--close"),on:{"click":_vm.close}})],1)])}; var __vue_staticRenderFns__$7 = []; /* style */ var __vue_inject_styles__$7 = undefined; /* scoped */ var __vue_scope_id__$7 = undefined; /* module identifier */ var __vue_module_identifier__$7 = undefined; /* functional template */ var __vue_is_functional_template__$7 = false; /* style inject */ /* style inject SSR */ var UiNotice = normalizeComponent_1( { render: __vue_render__$7, staticRenderFns: __vue_staticRenderFns__$7 }, __vue_inject_styles__$7, __vue_script__$7, __vue_scope_id__$7, __vue_is_functional_template__$7, __vue_module_identifier__$7, undefined, undefined ); // var prefix$1 = 'ui-message'; var script$8 = { name: 'UiMessage', components: { UiIcon: Icon, UiCloseIconButton: CloseIconButton }, transition: prefix$1, data: function data() { return { prefix: prefix$1 } }, props: { duration: Number, onClose: Function, closable: Boolean, type: { default: 'info', validator: function validator(value) { return ['info', 'success', 'warning', 'error', 'loading'].indexOf(value) !== -1 } } }, computed: { iconType: function iconType() { return iconTypes[this.type] } }, mounted: function mounted() { var this$1 = this; if (this.duration) { this.timerId = setTimeout(function () { return this$1.close(); }, this.duration * 1000); } }, beforeDestroy: function beforeDestroy() { clearTimeout(this.timerId); }, methods: { close: function close() { isFunc(this.onClose) && this.onClose(); this.$emit('close'); } } }; /* script */ var __vue_script__$8 = script$8; /* template */ var __vue_render__$8 = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{class:_vm.prefix},[_c('div',{class:(_vm.prefix + "--box")},[_c('UiIcon',{class:[(_vm.prefix + "--icon"), _vm.type],attrs:{"type":_vm.iconType}}),_vm._v(" "),_vm._t("default"),_vm._v(" "),(_vm.closable)?_c('UiCloseIconButton',{class:(_vm.prefix + "--close"),on:{"click":_vm.close}}):_vm._e()],2)])}; var __vue_staticRenderFns__$8 = []; /* style */ var __vue_inject_styles__$8 = undefined; /* scoped */ var __vue_scope_id__$8 = undefined; /* module identifier */ var __vue_module_identifier__$8 = undefined; /* functional template */ var __vue_is_functional_template__$8 = false; /* style inject */ /* style inject SSR */ var UiMessage = normalizeComponent_1( { render: __vue_render__$8, staticRenderFns: __vue_staticRenderFns__$8 }, __vue_inject_styles__$8, __vue_script__$8, __vue_scope_id__$8, __vue_is_functional_template__$8, __vue_module_identifier__$8, undefined, undefined ); // // // // // // // var script$9 = { props: { transition: String } }; /* script */ var __vue_script__$9 = script$9; /* template */ var __vue_render__$9 = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"ui-notice-wrapper"},[_c('transition-group',{attrs:{"name":_vm.transition,"tag":"div"}},[_vm._t("default")],2)],1)}; var __vue_staticRenderFns__$9 = []; /* style */ var __vue_inject_styles__$9 = undefined; /* scoped */ var __vue_scope_id__$9 = undefined; /* module identifier */ var __vue_module_identifier__$9 = undefined; /* functional template */ var __vue_is_functional_template__$9 = false; /* style inject */ /* style inject SSR */ var UiWrapper = normalizeComponent_1( { render: __vue_render__$9, staticRenderFns: __vue_staticRenderFns__$9 }, __vue_inject_styles__$9, __vue_script__$9, __vue_scope_id__$9, __vue_is_functional_template__$9, __vue_module_identifier__$9, undefined, undefined ); /** * @param {import('vue').VueConstructor} Vue * @param {Vue} Component * @param {Vue} WrappedComponent */ var createNoticeManager = function (Vue, Component, config) { if ( config === void 0 ) config = {}; var comWrapper, key = 0; var getWrapper = function () { comWrapper = comWrapper || new Vue({ name: 'UiNoticeManager', data: function data() { return { comps: [], zIndex: 0 } }, watch: { 'comps.length': function comps_length(newval, oldval) { if (newval > oldval) { this.zIndex = getMaxZIndex(); } } }, render: function render(h) { var this$1 = this; return h( UiWrapper, { style: { zIndex: this.zIndex }, props: { transition: Component.transition } }, this.comps.map(function (ref, i) { var ui = ref.ui; var key = ref.key; var props = ref.props; return h( ui, { key: key, props: props, on: { close: function () { return this$1.comps.splice(i, 1); } } }, isFunc(props.render) ? [props.render(h)] : (props.content || props.desc) ) }) ) }, mounted: function mounted() { document.body.appendChild(this.$el); }, beforeDestroy: function beforeDestroy() { comWrapper = null; document.body.removeChild(this.$el); }, methods: { addCompOptions: function addCompOptions(props) { if ( props === void 0 ) props = {}; var option = { props: props, ui: Component, key: key++ }; this.comps.push(option); return option.key }, delComOptionByKey: function delComOptionByKey(key) { var index = this.comps.find(function (_) { return _.key === key; }); if (index !== -1) { this.comps.splice(index, 1); } } } }).$mount(); return comWrapper }; var defaultConfig = Object.assign({}, { duration: 2, closable: false }, config); var addNotice = function (options, type) { if ( type === void 0 ) type = 'info'; options = isStr(options) ? Object.assign({}, defaultConfig, { content: options, type: type }) : Object.assign({}, defaultConfig, options, { type: type }); return getWrapper().addCompOptions(options) }; var noticeFunc = function (options) { return addNotice(options); }; noticeFunc.open = function (options) { return addNotice(options, 'open'); }; noticeFunc.info = function (options) { return addNotice(options, 'info'); }; noticeFunc.warning = function (options) { return addNotice(options, 'warning'); }; noticeFunc.error = function (options) { return addNotice(options, 'error'); }; noticeFunc.success = function (options) { return addNotice(options, 'success'); }; noticeFunc.loading = function (options) { var key = addNotice(options, 'loading'); return function () { return getWrapper().delComOptionByKey(key); } }; noticeFunc.config = function (options) { return defaultConfig = Object.assign({}, defaultConfig, options); }; noticeFunc.destroy = function () { return comWrapper && comWrapper.$destroy(); }; return noticeFunc }; var createNotice = function (Vue) { return createNoticeManager(Vue, UiNotice, { duration: 4 }); }; var createMessage = function (Vue) { return createNoticeManager(Vue, UiMessage); }; // // // // // // // // // // // var script$a = { name: 'UiCircle', data: function data() { return { prefix: 'ui-circle' } }, props: { percent: { type: Number, default: 0 }, size: { type: Number, default: 120 }, strokeLinecap: { type: String, default: 'round' }, strokeWidth: { type: Number, default: 6 }, strokeColor: { type: String, default: '#2db7f5' }, trailWidth: { type: Number, default: 5 }, trailColor: { type: String, default: '#eaeef2' }, dashboard: Boolean }, computed: { styles: function styles() { return { width: ((this.size) + "px"), height: ((this.size) + "px") } }, computedStrokeWidth: function computedStrokeWidth () { return this.percent === 0 && this.dashboard ? 0 : this.strokeWidth }, radius: function radius() { return 50 - this.strokeWidth / 2 }, pathString: function pathString() { var ref = this; var r = ref.radius; var dashboard = ref.dashboard; return dashboard ? ("M 50,50 m 0," + r + " a " + r + "," + r + " 0 1 1 0,-" + (2 * r) + " a " + r + "," + r + " 0 1 1 0," + (2 * r)) : ("M 50,50 m 0,-" + r + " a " + r + "," + r + " 0 1 1 0," + (2 * r) + " a " + r + "," + r + " 0 1 1 0,-" + (2 * r)) }, len: function len() { return Math.PI * 2 * this.radius }, trailStyle: function trailStyle() { return this.dashboard && { 'stroke-dasharray': ((this.len - 75) + "px " + (this.len) + "px"), 'stroke-dashoffset': ("-" + (75 / 2) + "px"), 'transition': 'stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s' } }, pathStyle: function pathStyle() { return this.dashboard ? { 'stroke-dasharray': (((this.percent / 100) * (this.len - 75)) + "px " + (this.len) + "px"), 'stroke-dashoffset': ("-" + (75 / 2) + "px"), 'transition': 'stroke-dashoffset .3s ease 0s, stroke-dasharray .6s ease 0s, stroke .6s, stroke-width .06s ease .6s' } : { 'stroke-dasharray': ((this.len) + "px " + (this.len) + "px"), 'stroke-dashoffset': ((((100 - this.percent) / 100 * this.len)) + "px"), 'transition': 'stroke-dashoffset 0.6s ease 0s, stroke 0.6s ease' } } } }; /* script */ var __vue_script__$a = script$a; /* template */ var __vue_render__$a = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{class:_vm.prefix,style:(_vm.styles)},[_c('svg',{attrs:{"viewBox":"0 0 100 100"}},[_c('path',{style:(_vm.trailStyle),attrs:{"d":_vm.pathString,"stroke":_vm.trailColor,"stroke-width":_vm.trailWidth,"fill-opacity":0}}),_vm._v(" "),_c('path',{style:(_vm.pathStyle),attrs:{"d":_vm.pathString,"stroke-linecap":_vm.strokeLinecap,"stroke":_vm.strokeColor,"stroke-width":_vm.computedStrokeWidth,"fill-opacity":"0"}})]),_vm._v(" "),_c('div',{class:(_vm.prefix + "--inner")},[_vm._t("default")],2)])}; var __vue_staticRenderFns__$a = []; /* style */ var __vue_inject_styles__$a = undefined; /* scoped */ var __vue_scope_id__$a = undefined; /* module identifier */ var __vue_module_identifier__$a = undefined; /* functional template */ var __vue_is_functional_template__$a = false; /* style inject */ /* style inject SSR */ var Circle = normalizeComponent_1( { render: __vue_render__$a, staticRenderFns: __vue_staticRenderFns__$a }, __vue_inject_styles__$a, __vue_script__$a, __vue_scope_id__$a, __vue_is_functional_template__$a, __vue_module_identifier__$a, undefined, undefined ); // // // // // var script$b = { name: 'UiBreadcrumb', props: { separator: { type: String, default: '/' } } }; /* script */ var __vue_script__$b = script$b; /* template */ var __vue_render__$b = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"ui-breadcrumb"},[_vm._t("default")],2)}; var __vue_staticRenderFns__$b = []; /* style */ var __vue_inject_styles__$b = undefined; /* scoped */ var __vue_scope_id__$b = undefined; /* module identifier */ var __vue_module_identifier__$b = undefined; /* functional template */ var __vue_is_functional_template__$b = false; /* style inject */ /* style inject SSR */ var UiBreadcrumb = normalizeComponent_1( { render: __vue_render__$b, staticRenderFns: __vue_staticRenderFns__$b }, __vue_inject_styles__$b, __vue_script__$b, __vue_scope_id__$b, __vue_is_functional_template__$b, __vue_module_identifier__$b, undefined, undefined ); // var script$c = { name: 'UiBreadcrumbItem', data: function data() { return { prefix: 'ui-breadcrumb-item', separator: '' } }, props: { replace: Boolean, to: [String, Object], target: { type: String, default: '_self' }, href: String, append: Boolean }, mounted: function mounted() { var parent = findParent(this, 'UiBreadcrumb'); if (parent) { this.separator = parent.separator; } } }; /* script */ var __vue_script__$c = script$c; /* template */ var __vue_render__$c = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('span',{class:_vm.prefix},[(_vm.to)?_c('router-link',{class:(_vm.prefix + "--link"),attrs:{"to":_vm.to,"replace":_vm.replace,"append":_vm.append}},[_vm._t("default")],2):(_vm.href)?_c('a',{class:(_vm.prefix + "--link"),attrs:{"href":_vm.href,"target":_vm.target}},[_vm._t("default")],2):_c('span',{class:[(_vm.prefix + "--link"), 'notlink']},[_vm._t("default")],2),_vm._v(" "),_c('span',{class:(_vm.prefix + "--separator"),domProps:{"innerHTML":_vm._s(_vm.separator)}})],1)}; var __vue_staticRenderFns__$c = []; /* style */ var __vue_inject_styles__$c = undefined; /* scoped */ var __vue_scope_id__$c = undefined; /* module identifier */ var __vue_module_identifier__$c = undefined; /* functional template */ var __vue_is_functional_template__$c = false; /* style inject */ /* style inject SSR */ var UiBreadcrumbItem = normalizeComponent_1( { render: __vue_render__$c, staticRenderFns: __vue_staticRenderFns__$c }, __vue_inject_styles__$c, __vue_script__$c, __vue_scope_id__$c, __vue_is_functional_template__$c, __vue_module_identifier__$c, undefined, undefined ); var Breadcrumb = UiBreadcrumb; var BreadcrumbItem = UiBreadcrumbItem; // // // // // var script$d = { name: 'UiTimeline', props: { pending: Boolean } }; /* script */ var __vue_script__$d = script$d; /* template */ var __vue_render__$d = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('ul',{staticClass:"ui-timeline",class:{pending: _vm.pending}},[_vm._t("default")],2)}; var __vue_staticRenderFns__$d = []; /* style */ var __vue_inject_styles__$d = undefined; /* scoped */ var __vue_scope_id__$d = undefined; /* module identifier */ var __vue_module_identifier__$d = undefined; /* functional template */ var __vue_is_functional_template__$d = false; /* style inject */ /* style inject SSR */ var UiTimeline = normalizeComponent_1( { render: __vue_render__$d, staticRenderFns: __vue_staticRenderFns__$d }, __vue_inject_styles__$d, __vue_script__$d, __vue_scope_id__$d, __vue_is_functional_template__$d, __vue_module_identifier__$d, undefined, undefined ); // // // // // // // // // // // var script$e = { name: 'UiTimelineItem', data: function data() { return { prefix: 'ui-timeline-item', custom: false } }, props: { color: { type: String, default: 'blue' } }, computed: { clsName: function clsName() { return ['blue', 'red', 'green'].indexOf(this.color) !== -1 }, styles: function styles() { return !this.clsName && { color: this.color } } }, mounted: function mounted() { this.custom = this.$slots.dot !== undefined; } }; /* script */ var __vue_script__$e = script$e; /* template */ var __vue_render__$e = function () { var _obj; var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('li',{class:_vm.prefix},[_c('span',{class:(_vm.prefix + "--tail")}),_vm._v(" "),_c('span',{class:[(_vm.prefix + "--dot"), ( _obj = {}, _obj[_vm.color] = _vm.clsName, _obj.custom = _vm.custom, _obj )],style:(_vm.styles)},[_vm._t("dot")],2),_vm._v(" "),_c('div',{class:(_vm.prefix + "--content")},[_vm._t("default")],2)])}; var __vue_staticRenderFns__$e = []; /* style */ var __vue_inject_styles__$e = undefined; /* scoped */ var __vue_scope_id__$e = undefined; /* module identifier */ var __vue_module_identifier__$e = undefined; /* functional template */ var __vue_is_functional_template__$e = false; /* style inject */ /* style inject SSR */ var UiTimelineItem = normalizeComponent_1( { render: __vue_render__$e, staticRenderFns: __vue_staticRenderFns__$e }, __vue_inject_styles__$e, __vue_script__$e, __vue_scope_id__$e, __vue_is_functional_template__$e, __vue_module_identifier__$e, undefined, undefined ); var Timeline = UiTimeline; var TimelineItem = UiTimelineItem; // // // // // // // // // var script$f = { name: 'UiSpin', data: function data() { return { prefix: 'ui-spin' } }, props: { size: { validator: function validator(value) { return ['large', 'small'].indexOf(value) !== -1 } }, fix: Boolean } }; /* script */ var __vue_script__$f = script$f; /* template */ var __vue_render__$f = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('transition',{attrs:{"name":_vm.prefix}},[_c('div',{class:[_vm.prefix, {fix: _vm.fix}]},[_c('div',[_vm._t("default",[_c('div',{class:[(_vm.prefix + "--dot"), _vm.size]})])],2)])])}; var __vue_staticRenderFns__$f = []; /* style */ var __vue_inject_styles__$f = undefined; /* scoped */ var __vue_scope_id__$f = undefined; /* module identifier */ var __vue_module_identifier__$f = undefined; /* functional template */ var __vue_is_functional_template__$f = false; /* style inject */ /* style inject SSR */ var UiSpin = normalizeComponent_1( { render: __vue_render__$f, staticRenderFns: __vue_staticRenderFns__$f }, __vue_inject_styles__$f, __vue_script__$f, __vue_scope_id__$f, __vue_is_functional_template__$f, __vue_module_identifier__$f, undefined, undefined ); /** * 创建加载中组件 * @param {Vue.VueConstructor} Vue */ var spinService = function (Vue) { return { getVM: function getVM(options) { if ( options === void 0 ) options = {}; var that = this; return this.vm || new Vue({ data: function data() { return { visible: false } }, watch: { visible: function visible(newval) { if (!newval) { winScrollbarLock.unlock(); } } }, render: function render(h) { return h(UiSpin, { props: { size: options.size, fix: true }, style: { zIndex: getMaxZIndex(), position: 'fixed' }, directives: [{ name: 'show', value: this.visible }], }, isFunc(options.render) ? [options.render(h)] : undefined) }, mounted: function mounted() { document.body.appendChild(this.$el); this.visible = true; }, beforeDestroy: function beforeDestroy() { that.vm = null; this.$el.parentNode && this.$el.parentNode.removeChild(this.$el); }, methods: { show: function show(visible) { if ( visible === void 0 ) visible = true; this.visible = visible; } } }).$mount() }, show: function show(options) { winScrollbarLock.lock(); this.vm = this.getVM(options); this.vm.show(); }, hide: function hide() { this.vm.show(false); }, destroy: function destroy() { this.vm.$destroy(); } } }; // var script$g = { name: 'UiSteps', props: { current: { type: Number, default: 0 }, status: { default: 'process', validator: function validator(value) { return ['wait', 'process', 'finish', 'error'].indexOf(value) !== -1 } }, size: { validator: function validator(value) { return value === 'small' } }, direction: { default: 'horizontal', validator: function validator(value) { return ['horizontal', 'vertical'].indexOf(value) !== -1 } } }, watch: { current: function current() { this.setItemsState(); } }, mounted: function mounted() { this.setItemsState(); }, methods: { setItemsState: function setItemsState() { var this$1 = this; var childs = findChildrens(this, 'UiStep'), count = childs.length; childs.forEach(function (item, index) { var isCurrent = index === this$1.current; var width = this$1.direction === 'horizontal' ? ((1 / count * 100) + "%") : undefined; var status = isCurrent ? this$1.status : index < this$1.current ? 'finish' : 'wait'; item.setState({ index: index, isCurrent: isCurrent, width: width, status: status }); }); } } }; /* script */ var __vue_script__$g = script$g; /* template */ var __vue_render__$g = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"ui-steps",class:[_vm.size, _vm.direction]},[_vm._t("default")],2)}; var __vue_staticRenderFns__$g = []; /* style */ var __vue_inject_styles__$g = undefined; /* scoped */ var __vue_scope_id__$g = undefined; /* module identifier */ var __vue_module_identifier__$g = undefined; /* functional template */ var __vue_is_functional_template__$g = false; /* style inject */ /* style inject SSR */ var UiSteps = normalizeComponent_1( { render: __vue_render__$g, staticRenderFns: __vue_staticRenderFns__$g }, __vue_inject_styles__$g, __vue_script__$g, __vue_scope_id__$g, __vue_is_functional_template__$g, __vue_module_identifier__$g, undefined, undefined ); // var script$h = { name: 'UiStep', components: { UiIcon: Icon }, data: function data() { return { prefix: 'ui-step', state: {} } }, props: { title: String, content: String, icon: String }, computed: { iconType: function iconType() { var ref = this.state; var status = ref.status; return this.icon || (status === 'finish' && 'ios-checkmark-empty') || (status === 'error' && 'ios-close-empty') } }, methods: { setState: function setState(state) { this.state = Object.assign({}, this.state, state); } } }; /* script */ var __vue_script__$h = script$h; /* template */ var __vue_render__$h = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{class:[_vm.prefix, _vm.state.status],style:({width: _vm.state.width})},[_c('div',{class:(_vm.prefix + "--tail")}),_vm._v(" "),_c('span',{class:[(_vm.prefix + "--head"), {icon: _vm.icon}]},[(_vm.iconType)?_c('UiIcon',{attrs:{"type":_vm.iconType}}):_c('b',[_vm._v(_vm._s(_vm.state.index + 1))])],1),_vm._v(" "),_c('div',{class:(_vm.prefix + "--main")},[_c('div',{class:(_vm.prefix + "--title")},[_vm._v(_vm._s(_vm.title))]),_vm._v(" "),(_vm.content)?_c('div',{class:(_vm.prefix + "--content")},[_vm._v(_vm._s(_vm.content))]):_vm._e()])])}; var __vue_staticRenderFns__$h = []; /* style */ var __vue_inject_styles__$h = undefined; /* scoped */ var __vue_scope_id__$h = undefined; /* module identifier */ var __vue_module_identifier__$h = undefined; /* functional template */ var __vue_is_functional_template__$h = false; /* style inject */ /* style inject SSR */ var UiStep = normalizeComponent_1( { render: __vue_render__$h, staticRenderFns: __vue_staticRenderFns__$h }, __vue_inject_styles__$h, __vue_script__$h, __vue_scope_id__$h, __vue_is_functional_template__$h, __vue_module_identifier__$h, undefined, undefined ); var Steps = UiSteps; var Step = UiStep; // var script$i = { data: function data() { return { fixed: false, affixStyle: {}, placeholderStyle: {} } }, props: { offsetTop: { type: Number, default: 0 }, offsetBottom: Number }, computed: { isFixedBottom: function isFixedBotto