diff --git a/ajax.js b/ajax.js new file mode 100644 index 0000000..2bf5713 --- /dev/null +++ b/ajax.js @@ -0,0 +1,54 @@ +; +(function(factory) { + if (typeof module === 'object' && typeof module.exports == 'object') { + module.exports = factory( + require('vue'), require('jquery') + ); + } else { + factory(window.Vue, window.Jquery); + } +})(function(Vue, $) { + Vue.prototype.ajax = function() { + var _url=arguments[0],_success=arguments[3],_error=arguments[4]; + var _type='GET'; + var _data={}; + if(typeof arguments[1]=='string'){ + _type=arguments[1]; + } + else if(typeof arguments[1]=='object'){ + _data=arguments[1]; + } + else if(typeof arguments[1]=='function'){ + _success=arguments[1]; + _error=arguments[2]; + } + if(typeof arguments[2]=='object'){ + _data=arguments[2]; + } + else if(arguments[1]!='function'){ + _success=arguments[2]; + _error=arguments[3]; + } + + $.ajax({ + url: _url, + dataType: "json", + type: _type, + data: _data, + success: function(data) { + if (data.success) { + _success && _success(data); + } else { + _error && _error(data.error!=undefined?data.error:'未知错误'); + } + }, + error: function(XMLHttpRequest, textStatus, errorThrown) { + if (XMLHttpRequest.status == 401) { + location.href = $('#major-layout-login').val(); + } else { + _error && _error(errorThrown); + } + } + }); + } +}); \ No newline at end of file diff --git a/ajaxServer.js b/ajaxServer.js new file mode 100644 index 0000000..1c6ed52 --- /dev/null +++ b/ajaxServer.js @@ -0,0 +1,33 @@ +; +(function(factory) { + if (typeof module === 'object' && typeof module.exports == 'object') { + module.exports = factory( + require('vue'), require('jquery') + ); + } else { + factory(window.Vue, window.Jquery); + } +})(function(Vue, $) { + Vue.prototype.ajaxServer = function(url, type, data, success, error) { + $.ajax({ + url: url, + dataType: "json", + type: type, + data: data, + success: function(data) { + if (data.success) { + success && success(data); + } else { + error && error(data.error); + } + }, + error: function(XMLHttpRequest, textStatus, errorThrown) { + if (XMLHttpRequest.status == 401) { + location.href = $('#major-layout-login').val(); + } else { + error && error(errorThrown); + } + } + }); + } +}); diff --git a/autoinput.css b/autoinput.css new file mode 100644 index 0000000..4670c86 --- /dev/null +++ b/autoinput.css @@ -0,0 +1,71 @@ +.lg-autoinput{ + display: inline-block; + position: relative; + input{ + padding-left: 20px; + padding-right: 20px; + } + i:first-child:before{ + content: '\e60a'; + color: #e1e1e1; + font-family: "iconfont" !important; + position: absolute; + top: 7px; + left: 3px; + font-size: 14px; + } + .c:before{ + content: '\e65e'; + color: #e1e1e1; + font-family: "iconfont" !important; + position: absolute; + top: 7px; + right: 10px; + font-size: 14px; + cursor: pointer; + } + + ul{ + position: absolute; + z-index: 1000; + top:25px; + padding-top:3px; + padding-bottom:2px; + border:1px solid #5986e1; + border-top:none; + border-radius: 3px; + margin-right: 5px; + background-color: white; + box-sizing:border-box; + max-height: 150px; + overflow-y:auto; + li{ + height: 24px; + line-height: 24px; + cursor: pointer; + padding: 0 5px 0 20px; + + font-size: 12px; + &:hover{ + background-color:#5986e1; + color: white; + a{ + color: white; + } + } + a{ + color: #666; + display: inline-block; + width: 100%; + white-space: nowrap; + overflow: hidden; + text-overflow:ellipsis; + &:hover{ + background-color:#5986e1; + color: white; + } + } + } + } + +} diff --git a/autoinput.js b/autoinput.js new file mode 100644 index 0000000..83c71df --- /dev/null +++ b/autoinput.js @@ -0,0 +1,64 @@ +; +(function(factory) { + if (typeof module === 'object' && typeof module.exports == 'object') { + module.exports = factory( + require('vue') + ); + } else { + factory(window.Vue); + } +})(function(Vue) { + var autoinput={}; + autoinput.install = function(Vue) { + Vue.component('autoinput',{ + delimiters: ['${', '}'], + props: ['data', 'width','placeholder','update','select','clear','value'], + template: '
', + methods: { + check: function(obj) {//li select + this.selected=obj.text; + this.select&&this.select(obj); + this.show=false; + }, + focus:function (argument) {//input focus + this.show=true; + }, + keyup:function (event) {//input keyup + this.update&&this.update(this.selected,this.list); + }, + blur:function (event) {//input blur + var _this=this; + if(this.over){ + _this.show=false; + } + }, + clean:function (argument) {//clean input + this.selected=''; + this.show=false; + this.list=[]; + this.clear&&this.clear(); + }, + enter:function (argument) {//hover ul + this.over=false; + }, + leave:function (argument) {//leave ul + this.over=true; + } + }, + data:function (argument) { + return { + selected:this.value?this.value:'', + show:false, + visible:false, + over:true + } + }, + watch:{ + value:function(vNew,vOld){ + this.selected=vNew; + } + } + }) + } + Vue.use(autoinput); +}); diff --git a/checkbox-group.js b/checkbox-group.js new file mode 100644 index 0000000..a13d97d --- /dev/null +++ b/checkbox-group.js @@ -0,0 +1,54 @@ +; +(function(factory) { + if (typeof module === 'object' && typeof module.exports == 'object') { + module.exports = factory( + require('vue') + ); + } else { + factory(window.Vue); + } +})(function(Vue) { + var checkboxGroup = {}; + checkboxGroup.install = function(Vue) { + Vue.component('checkbox-group', { + delimiters: ['${', '}'], + props: ['data', 'model', 'className','index'], + template: '', + methods: { + check: function() { + this.$emit('input',this.selected.join(',')); + }, + name:function(name,index){ + if(index!=undefined){ + return name+index; + } + return name; + }, + id:function(id,index){ + if(index!=undefined){ + return id+index; + } + return id; + } + }, + data:function(){ + return { + selected:getVal(this.model) + } + }, + watch:{ + model:function(val){ + this.selected=getVal(val); + } + } + }) + } + function getVal(value){ + var result=[]; + if(value&&value!=''){ + result=value.split(','); + } + return result + } + Vue.use(checkboxGroup); +}); diff --git a/legoland.css b/legoland.css new file mode 100644 index 0000000..27e99fb --- /dev/null +++ b/legoland.css @@ -0,0 +1,2510 @@ +/* ------- color -------*/ +/*蓝1*/ +/*深蓝*/ +/*橙*/ +/*红*/ +/*绿*/ +/*紫*/ +/*深灰*/ +/*灰*/ +/*浅灰*/ +/*灰*/ +/*灰黄*/ +/*浅灰黄*/ +/* ------- font -------*/ +/* ------- grid -------*/ +/* ------- structure -------*/ +/* 导航高度 */ +/* 菜单宽度 */ +/* 导航文字颜色 */ +/* base 公共基础 */ +html, +body { + margin: 0; + height: 100%; + font-family: Arial, "Microsoft Yahei", "Helvetica Neue", "Hiragino Sans GB", sans-serif; + overflow-x: hidden; + color: #666; +} +iframe { + width: 100%; + height: 100%; + border: none; + color: white; +} +a { + box-sizing: border-box; + text-decoration: none !important; + color: #5986e1; + cursor: pointer; +} +ul { + margin: 0; + padding: 0; + list-style: none; +} +p { + margin: 0; +} +label, +span { + color: #666; + font-size: 12px; +} +@font-face { + font-family: "iconfont"; + src: url('iconfont.eot?t=1477549960'); + /* IE9*/ + src: url('iconfont.eot?t=1477549960#iefix') format('embedded-opentype'), /* IE6-IE8 */ url('iconfont.woff?t=1477549960') format('woff'), /* chrome, firefox */ url('iconfont.ttf?t=1477549960') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/ url('iconfont.svg?t=1477549960#iconfont') format('svg'); + /* iOS 4.1- */ +} +.iconfont { + font-family: "iconfont" !important; + font-size: 16px; + font-style: normal; + -webkit-font-smoothing: antialiased; + -webkit-text-stroke-width: 0.2px; + -moz-osx-font-smoothing: grayscale; +} +.icon-sousuo:before { + content: "\e60a"; +} +.icon-yonghu:before { + content: "\e60b"; +} +.icon-roundadd:before { + content: "\e670"; +} +.icon-roundaddfill:before { + content: "\e66f"; +} +.icon-jinzhi:before { + content: "\e639"; +} +.icon-zhengque:before { + content: "\e637"; +} +.icon-cuowu:before { + content: "\e638"; +} +.icon-xiasanjiao:before { + content: "\e644"; +} +.icon-shangsanjiao:before { + content: "\e645"; +} +.icon-zuosanjiao:before { + content: "\e646"; +} +.icon-yousanjiao:before { + content: "\e648"; +} +.icon-upfn:before { + content: "\e62c"; +} +.icon-arrow-up-o:before { + content: "\e641"; +} +.icon-arrow-down-o:before { + content: "\e642"; +} +.icon-jiantou:before { + content: "\e62f"; +} +.icon-check:before { + content: "\e65d"; +} +.icon-close:before { + content: "\e65e"; +} +.icon-roundcheckfill:before { + content: "\e65f"; +} +.icon-roundcheck:before { + content: "\e660"; +} +.icon-roundclosefill:before { + content: "\e661"; +} +.icon-roundrightfill:before { + content: "\e662"; +} +.icon-roundright:before { + content: "\e663"; +} +.icon-back:before { + content: "\e667"; +} +.icon-right:before { + content: "\e66a"; +} +.icon-up_sm_ic:before { + content: "\e63f"; +} +.icon-down_sm_ic:before { + content: "\e633"; +} +.icon-yiwen:before { + content: "\e658"; +} +.icon-chucuo:before { + content: "\e659"; +} +.icon-squarecheckfill:before { + content: "\e66c"; +} +.icon-square:before { + content: "\e66d"; +} +.icon-squarecheck:before { + content: "\e66e"; +} +.icon-edit:before { + content: "\e600"; +} +.lg-color-main { + color: #5986e1 !important; +} +.lg-color-main-bg { + background-color: #5986e1; +} +.lg-color-highlight { + color: #ff8447 !important; +} +.lg-color-highlight-bg { + background-color: #ff8447; +} +.lg-color-danger { + color: #d05538 !important; +} +.lg-color-danger-bg { + background-color: #d05538; +} +.lg-color-success { + color: #8bb455 !important; +} +.lg-color-success-bg { + background-color: #8bb455; +} +.lg-color-plain { + color: #e1e1e1 !important; +} +.lg-color-plain-bg { + background-color: #e1e1e1; +} +.lg-color-sys { + color: #464e78 !important; +} +.lg-color-sys-bg { + background-color: #464e78; +} +.lg-color-title { + color: #333; +} +.lg-color-title-bg { + background-color: #333; +} +.lg-color-text { + color: #666; +} +.lg-color-text-bg { + background-color: #666; +} +.lg-color-subtext { + color: #999; +} +.lg-color-subtext-bg { + background-color: #999; +} +.lg-color-border { + color: #e1e1e1; + border: 1px solid #e1e1e1; +} +.lg-color-border-bg { + background-color: #e1e1e1; +} +.lg-color-bg { + background-color: #ededed; +} +.lg-fn-hide, +.hide { + display: none; +} +.lg-fn-show, +.show { + display: block; +} +.lg-fn-invisible, +.invisible { + visibility: hidden; +} +.lg-fn-right, +.right { + float: right; +} +.lg-fn-left, +.left { + float: left; +} +.lg-fn-clear:before, +.clear:before, +.lg-fn-clear:after, +.clear:after { + content: " "; + display: table; +} +.lg-fn-clear:after, +.clear:after { + clear: both; +} +.lg-blank-10 { + display: block; + width: 100%; + height: 10px; +} +.lg-blank-20 { + display: block; + width: 100%; + height: 20px; +} +.lg-blank-50 { + display: block; + width: 100%; + height: 50px; +} +.lg-nowrap { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} +.lg-error-border { + border: 1px solid #d05538 !important; +} +.lg-error-msg { + color: #d05538 !important; + font-size: 12px; +} +/* grid 栅格 */ +.lg-grid-container { + padding: 15px; + margin-top: -15px; + margin-bottom: -15px; +} +.lg-grid-row { + margin-left: -15px; + margin-right: -15px; + margin-top: 15px; + margin-bottom: 15px; +} +.lg-grid-row:before, +.lg-grid-row:after { + content: ' '; + display: table; + clear: both; +} +.lg-grid-1 { + position: relative; + box-sizing: border-box; + float: left; + padding: 0 15px; + min-height: 22px; + width: 8.33333333%; +} +.lg-grid-offset-1 { + margin-left: 8.33333333%; +} +.lg-grid-2 { + position: relative; + box-sizing: border-box; + float: left; + padding: 0 15px; + min-height: 22px; + width: 16.66666667%; +} +.lg-grid-offset-2 { + margin-left: 16.66666667%; +} +.lg-grid-3 { + position: relative; + box-sizing: border-box; + float: left; + padding: 0 15px; + min-height: 22px; + width: 25%; +} +.lg-grid-offset-3 { + margin-left: 25%; +} +.lg-grid-4 { + position: relative; + box-sizing: border-box; + float: left; + padding: 0 15px; + min-height: 22px; + width: 33.33333333%; +} +.lg-grid-offset-4 { + margin-left: 33.33333333%; +} +.lg-grid-5 { + position: relative; + box-sizing: border-box; + float: left; + padding: 0 15px; + min-height: 22px; + width: 41.66666667%; +} +.lg-grid-offset-5 { + margin-left: 41.66666667%; +} +.lg-grid-6 { + position: relative; + box-sizing: border-box; + float: left; + padding: 0 15px; + min-height: 22px; + width: 50%; +} +.lg-grid-offset-6 { + margin-left: 50%; +} +.lg-grid-7 { + position: relative; + box-sizing: border-box; + float: left; + padding: 0 15px; + min-height: 22px; + width: 58.33333333%; +} +.lg-grid-offset-7 { + margin-left: 58.33333333%; +} +.lg-grid-8 { + position: relative; + box-sizing: border-box; + float: left; + padding: 0 15px; + min-height: 22px; + width: 66.66666667%; +} +.lg-grid-offset-8 { + margin-left: 66.66666667%; +} +.lg-grid-9 { + position: relative; + box-sizing: border-box; + float: left; + padding: 0 15px; + min-height: 22px; + width: 75%; +} +.lg-grid-offset-9 { + margin-left: 75%; +} +.lg-grid-10 { + position: relative; + box-sizing: border-box; + float: left; + padding: 0 15px; + min-height: 22px; + width: 83.33333333%; +} +.lg-grid-offset-10 { + margin-left: 83.33333333%; +} +.lg-grid-11 { + position: relative; + box-sizing: border-box; + float: left; + padding: 0 15px; + min-height: 22px; + width: 91.66666667%; +} +.lg-grid-offset-11 { + margin-left: 91.66666667%; +} +.lg-grid-12 { + position: relative; + box-sizing: border-box; + float: left; + padding: 0 15px; + min-height: 22px; + width: 100%; +} +.lg-grid-offset-12 { + margin-left: 100%; +} +.lg-grid-blank { + display: block; + height: 10px; +} +.lg-title, +.lg-title-m, +.lg-title-r { + font-size: 16px; + line-height: 40px; + color: #333; + display: inline; + margin-right: 30px; +} +.lg-text { + font-size: 14px; + line-height: 22px; + color: #666; +} +.lg-subtext { + font-size: 12px; + line-height: 18px; + color: #999; +} +/* 未整理 */ +.lg-title-m { + text-align: center; + display: block; +} +.lg-title-r { + text-align: right; +} +.lg-text-s { + font-size: 14px; + line-height: 18px; + color: #999; +} +.lg-btn, +.lg-btn-large, +.lg-btn-small, +.lg-btn-o, +.lg-btn-o-large, +.lg-btn-o-small, +.lg-btn-o, +.lg-btn-small-o, +.lg-btn-large-o, +.lg-btn-main, +.lg-btn-o-main, +.lg-btn-danger, +.lg-btn-o-danger, +.lg-btn-success, +.lg-btn-o-success, +.lg-btn-sys, +.lg-btn-o-sys, +.lg-btn-plain, +.lg-btn-o-plain, +.lg-btn-highlight, +.lg-btn-o-highlight, +.lg-btn-large-main, +.lg-btn-large-o-main, +.lg-btn-large-danger, +.lg-btn-large-o-danger, +.lg-btn-large-success, +.lg-btn-large-o-success, +.lg-btn-large-sys, +.lg-btn-large-o-sys, +.lg-btn-large-plain, +.lg-btn-large-o-plain, +.lg-btn-large-highlight, +.lg-btn-large-o-highlight, +.lg-btn-small-main, +.lg-btn-small-o-main, +.lg-btn-small-danger, +.lg-btn-small-o-danger, +.lg-btn-small-success, +.lg-btn-small-o-success, +.lg-btn-small-sys, +.lg-btn-small-o-sys, +.lg-btn-small-plain, +.lg-btn-small-o-plain, +.lg-btn-small-highlight, +.lg-btn-small-o-highlight { + display: inline-block; + text-align: center; + vertical-align: middle; + margin: 5px; + padding: 6px 12px; + font-size: 12px; + font-family: Arial, "Microsoft Yahei", "Helvetica Neue", "Hiragino Sans GB", sans-serif; + height: 30px; + min-width: 100px; + line-height: 14px; + cursor: pointer; + outline: none; + border: 1px solid #5986e1; + border-radius: 3px; + color: white; + background-color: #5986e1; + -webkit-text-stroke-width: 0; +} +.lg-btn:last-child, +.lg-btn-large:last-child, +.lg-btn-small:last-child, +.lg-btn-o:last-child, +.lg-btn-o-large:last-child, +.lg-btn-o-small:last-child { + margin-right: 0; +} +.lg-btn:before, +.lg-btn-large:before, +.lg-btn-small:before, +.lg-btn-o:before, +.lg-btn-o-large:before, +.lg-btn-o-small:before { + margin-right: 3px; + margin-left: 2px; + font-size: 14px; +} +.lg-btn:hover, +.lg-btn-large:hover, +.lg-btn-small:hover, +.lg-btn-o:hover, +.lg-btn-o-large:hover, +.lg-btn-o-small:hover { + background-color: #2e67d9; + border-color: #2e67d9; + color: white; +} +.lg-btn .iconfont, +.lg-btn-large .iconfont, +.lg-btn-small .iconfont, +.lg-btn-o .iconfont, +.lg-btn-o-large .iconfont, +.lg-btn-o-small .iconfont { + font-size: 14px; + margin-right: 5px; +} +.lg-btn-large, +.lg-btn-large-o, +.lg-btn-large-main, +.lg-btn-large-o-main, +.lg-btn-large-danger, +.lg-btn-large-o-danger, +.lg-btn-large-success, +.lg-btn-large-o-success, +.lg-btn-large-sys, +.lg-btn-large-o-sys, +.lg-btn-large-plain, +.lg-btn-large-o-plain, +.lg-btn-large-highlight, +.lg-btn-large-o-highlight { + font-size: 20px; + line-height: 24px; + height: 40px; + min-width: 176px; +} +.lg-btn-large:before { + font-size: 20px; +} +.lg-btn-large .iconfont { + font-size: 20px; +} +.lg-btn-small, +.lg-btn-small-o, +.lg-btn-small-main, +.lg-btn-small-o-main, +.lg-btn-small-danger, +.lg-btn-small-o-danger, +.lg-btn-small-success, +.lg-btn-small-o-success, +.lg-btn-small-sys, +.lg-btn-small-o-sys, +.lg-btn-small-plain, +.lg-btn-small-o-plain, +.lg-btn-small-highlight, +.lg-btn-small-o-highlight { + height: 24px; + line-height: 14px; + font-size: 12px; + padding-top: 4px; + padding-bottom: 4px; + min-width: 66px; +} +.lg-btn-small:before { + font-size: 12px; +} +.lg-btn-small .iconfont { + font-size: 12px; +} +/* o */ +.lg-btn-o { + color: #5986e1; + border: 1px solid #5986e1; + background-color: white !important; +} +.lg-btn-o:hover { + color: #2e67d9; + border: 1px solid #2e67d9; +} +.lg-btn-o:last-child { + margin-right: 0; +} +.lg-btn-o:before { + margin-right: 5px; + font-size: 14px; +} +.lg-btn-small-o { + color: #5986e1; + border: 1px solid #5986e1; + background-color: white !important; +} +.lg-btn-small-o:hover { + color: #2e67d9; + border: 1px solid #2e67d9; +} +.lg-btn-small-o:last-child { + margin-right: 0; +} +.lg-btn-small-o:before { + margin-right: 5px; + font-size: 14px; +} +.lg-btn-large-o { + color: #5986e1; + border: 1px solid #5986e1; + background-color: white !important; +} +.lg-btn-large-o:hover { + color: #2e67d9; + border: 1px solid #2e67d9; +} +.lg-btn-large-o:last-child { + margin-right: 0; +} +.lg-btn-large-o:before { + margin-right: 5px; + font-size: 14px; +} +/* color */ +.lg-btn.lg-color-main { + background-color: #5986e1; + border-color: #5986e1; +} +.lg-btn.lg-color-main:hover { + color: white; + background-color: #2e67d9; + border-color: #2e67d9; +} +.lg-btn-o.lg-color-main, +.lg-btn-o.lg-btn-main { + background-color: white; + border-color: #5986e1; + color: #5986e1; +} +.lg-btn-o.lg-color-main:hover, +.lg-btn-o.lg-btn-main:hover { + background-color: white; + color: #2e67d9 !important; + border-color: #2e67d9; +} +.lg-btn-main { + background-color: #5986e1; + border-color: #5986e1; +} +.lg-btn-main:hover { + color: white; + background-color: #2e67d9; + border-color: #2e67d9; +} +.lg-btn-o-main { + background-color: white; + border-color: #5986e1; + color: #5986e1; +} +.lg-btn-o-main:hover { + background-color: white; + color: #2e67d9; + border-color: #2e67d9; +} +.lg-btn-o-main:last-child { + margin-right: 0; +} +.lg-btn-o-main:before { + margin-right: 5px; + font-size: 14px; +} +.lg-btn.lg-color-danger { + background-color: #d05538; + border-color: #d05538; +} +.lg-btn.lg-color-danger:hover { + color: white; + background-color: #ac4229; + border-color: #ac4229; +} +.lg-btn-o.lg-color-danger, +.lg-btn-o.lg-btn-danger { + background-color: white; + border-color: #d05538; + color: #d05538; +} +.lg-btn-o.lg-color-danger:hover, +.lg-btn-o.lg-btn-danger:hover { + background-color: white; + color: #ac4229 !important; + border-color: #ac4229; +} +.lg-btn-danger { + background-color: #d05538; + border-color: #d05538; +} +.lg-btn-danger:hover { + color: white; + background-color: #ac4229; + border-color: #ac4229; +} +.lg-btn-o-danger { + background-color: white; + border-color: #d05538; + color: #d05538; +} +.lg-btn-o-danger:hover { + background-color: white; + color: #ac4229; + border-color: #ac4229; +} +.lg-btn-o-danger:last-child { + margin-right: 0; +} +.lg-btn-o-danger:before { + margin-right: 5px; + font-size: 14px; +} +.lg-btn.lg-color-success { + background-color: #8bb455; + border-color: #8bb455; +} +.lg-btn.lg-color-success:hover { + color: white; + background-color: #719442; + border-color: #719442; +} +.lg-btn-o.lg-color-success, +.lg-btn-o.lg-btn-success { + background-color: white; + border-color: #8bb455; + color: #8bb455; +} +.lg-btn-o.lg-color-success:hover, +.lg-btn-o.lg-btn-success:hover { + background-color: white; + color: #719442 !important; + border-color: #719442; +} +.lg-btn-success { + background-color: #8bb455; + border-color: #8bb455; +} +.lg-btn-success:hover { + color: white; + background-color: #719442; + border-color: #719442; +} +.lg-btn-o-success { + background-color: white; + border-color: #8bb455; + color: #8bb455; +} +.lg-btn-o-success:hover { + background-color: white; + color: #719442; + border-color: #719442; +} +.lg-btn-o-success:last-child { + margin-right: 0; +} +.lg-btn-o-success:before { + margin-right: 5px; + font-size: 14px; +} +.lg-btn.lg-color-sys { + background-color: #464e78; + border-color: #464e78; +} +.lg-btn.lg-color-sys:hover { + color: white; + background-color: #333958; + border-color: #333958; +} +.lg-btn-o.lg-color-sys, +.lg-btn-o.lg-btn-sys { + background-color: white; + border-color: #464e78; + color: #464e78; +} +.lg-btn-o.lg-color-sys:hover, +.lg-btn-o.lg-btn-sys:hover { + background-color: white; + color: #333958 !important; + border-color: #333958; +} +.lg-btn-sys { + background-color: #464e78; + border-color: #464e78; +} +.lg-btn-sys:hover { + color: white; + background-color: #333958; + border-color: #333958; +} +.lg-btn-o-sys { + background-color: white; + border-color: #464e78; + color: #464e78; +} +.lg-btn-o-sys:hover { + background-color: white; + color: #333958; + border-color: #333958; +} +.lg-btn-o-sys:last-child { + margin-right: 0; +} +.lg-btn-o-sys:before { + margin-right: 5px; + font-size: 14px; +} +.lg-btn.lg-color-plain { + background-color: #e1e1e1; + border-color: #e1e1e1; +} +.lg-btn.lg-color-plain:hover { + color: white; + background-color: #c8c8c8; + border-color: #c8c8c8; +} +.lg-btn-o.lg-color-plain, +.lg-btn-o.lg-btn-plain { + background-color: white; + border-color: #e1e1e1; + color: #e1e1e1; +} +.lg-btn-o.lg-color-plain:hover, +.lg-btn-o.lg-btn-plain:hover { + background-color: white; + color: #c8c8c8 !important; + border-color: #c8c8c8; +} +.lg-btn-plain { + background-color: #e1e1e1; + border-color: #e1e1e1; +} +.lg-btn-plain:hover { + color: white; + background-color: #c8c8c8; + border-color: #c8c8c8; +} +.lg-btn-o-plain { + background-color: white; + border-color: #e1e1e1; + color: #e1e1e1; +} +.lg-btn-o-plain:hover { + background-color: white; + color: #c8c8c8; + border-color: #c8c8c8; +} +.lg-btn-o-plain:last-child { + margin-right: 0; +} +.lg-btn-o-plain:before { + margin-right: 5px; + font-size: 14px; +} +.lg-btn.lg-color-highlight { + background-color: #ff8447; + border-color: #ff8447; +} +.lg-btn.lg-color-highlight:hover { + color: white; + background-color: #ff6214; + border-color: #ff6214; +} +.lg-btn-o.lg-color-highlight, +.lg-btn-o.lg-btn-highlight { + background-color: white; + border-color: #ff8447; + color: #ff8447; +} +.lg-btn-o.lg-color-highlight:hover, +.lg-btn-o.lg-btn-highlight:hover { + background-color: white; + color: #ff6214 !important; + border-color: #ff6214; +} +.lg-btn-highlight { + background-color: #ff8447; + border-color: #ff8447; +} +.lg-btn-highlight:hover { + color: white; + background-color: #ff6214; + border-color: #ff6214; +} +.lg-btn-o-highlight { + background-color: white; + border-color: #ff8447; + color: #ff8447; +} +.lg-btn-o-highlight:hover { + background-color: white; + color: #ff6214; + border-color: #ff6214; +} +.lg-btn-o-highlight:last-child { + margin-right: 0; +} +.lg-btn-o-highlight:before { + margin-right: 5px; + font-size: 14px; +} +.lg-btn-large.lg-color-main { + background-color: #5986e1; + border-color: #5986e1; +} +.lg-btn-large.lg-color-main:hover { + color: white; + background-color: #2e67d9; + border-color: #2e67d9; +} +.lg-btn-large-o.lg-color-main, +.lg-btn-large-o.lg-btn-large-main { + background-color: white; + border-color: #5986e1; + color: #5986e1; +} +.lg-btn-large-o.lg-color-main:hover, +.lg-btn-large-o.lg-btn-large-main:hover { + background-color: white; + color: #2e67d9 !important; + border-color: #2e67d9; +} +.lg-btn-large-main { + background-color: #5986e1; + border-color: #5986e1; +} +.lg-btn-large-main:hover { + color: white; + background-color: #2e67d9; + border-color: #2e67d9; +} +.lg-btn-large-o-main { + background-color: white; + border-color: #5986e1; + color: #5986e1; +} +.lg-btn-large-o-main:hover { + background-color: white; + color: #2e67d9; + border-color: #2e67d9; +} +.lg-btn-large-o-main:last-child { + margin-right: 0; +} +.lg-btn-large-o-main:before { + margin-right: 5px; + font-size: 14px; +} +.lg-btn-large.lg-color-danger { + background-color: #d05538; + border-color: #d05538; +} +.lg-btn-large.lg-color-danger:hover { + color: white; + background-color: #ac4229; + border-color: #ac4229; +} +.lg-btn-large-o.lg-color-danger, +.lg-btn-large-o.lg-btn-large-danger { + background-color: white; + border-color: #d05538; + color: #d05538; +} +.lg-btn-large-o.lg-color-danger:hover, +.lg-btn-large-o.lg-btn-large-danger:hover { + background-color: white; + color: #ac4229 !important; + border-color: #ac4229; +} +.lg-btn-large-danger { + background-color: #d05538; + border-color: #d05538; +} +.lg-btn-large-danger:hover { + color: white; + background-color: #ac4229; + border-color: #ac4229; +} +.lg-btn-large-o-danger { + background-color: white; + border-color: #d05538; + color: #d05538; +} +.lg-btn-large-o-danger:hover { + background-color: white; + color: #ac4229; + border-color: #ac4229; +} +.lg-btn-large-o-danger:last-child { + margin-right: 0; +} +.lg-btn-large-o-danger:before { + margin-right: 5px; + font-size: 14px; +} +.lg-btn-large.lg-color-success { + background-color: #8bb455; + border-color: #8bb455; +} +.lg-btn-large.lg-color-success:hover { + color: white; + background-color: #719442; + border-color: #719442; +} +.lg-btn-large-o.lg-color-success, +.lg-btn-large-o.lg-btn-large-success { + background-color: white; + border-color: #8bb455; + color: #8bb455; +} +.lg-btn-large-o.lg-color-success:hover, +.lg-btn-large-o.lg-btn-large-success:hover { + background-color: white; + color: #719442 !important; + border-color: #719442; +} +.lg-btn-large-success { + background-color: #8bb455; + border-color: #8bb455; +} +.lg-btn-large-success:hover { + color: white; + background-color: #719442; + border-color: #719442; +} +.lg-btn-large-o-success { + background-color: white; + border-color: #8bb455; + color: #8bb455; +} +.lg-btn-large-o-success:hover { + background-color: white; + color: #719442; + border-color: #719442; +} +.lg-btn-large-o-success:last-child { + margin-right: 0; +} +.lg-btn-large-o-success:before { + margin-right: 5px; + font-size: 14px; +} +.lg-btn-large.lg-color-sys { + background-color: #464e78; + border-color: #464e78; +} +.lg-btn-large.lg-color-sys:hover { + color: white; + background-color: #333958; + border-color: #333958; +} +.lg-btn-large-o.lg-color-sys, +.lg-btn-large-o.lg-btn-large-sys { + background-color: white; + border-color: #464e78; + color: #464e78; +} +.lg-btn-large-o.lg-color-sys:hover, +.lg-btn-large-o.lg-btn-large-sys:hover { + background-color: white; + color: #333958 !important; + border-color: #333958; +} +.lg-btn-large-sys { + background-color: #464e78; + border-color: #464e78; +} +.lg-btn-large-sys:hover { + color: white; + background-color: #333958; + border-color: #333958; +} +.lg-btn-large-o-sys { + background-color: white; + border-color: #464e78; + color: #464e78; +} +.lg-btn-large-o-sys:hover { + background-color: white; + color: #333958; + border-color: #333958; +} +.lg-btn-large-o-sys:last-child { + margin-right: 0; +} +.lg-btn-large-o-sys:before { + margin-right: 5px; + font-size: 14px; +} +.lg-btn-large.lg-color-plain { + background-color: #e1e1e1; + border-color: #e1e1e1; +} +.lg-btn-large.lg-color-plain:hover { + color: white; + background-color: #c8c8c8; + border-color: #c8c8c8; +} +.lg-btn-large-o.lg-color-plain, +.lg-btn-large-o.lg-btn-large-plain { + background-color: white; + border-color: #e1e1e1; + color: #e1e1e1; +} +.lg-btn-large-o.lg-color-plain:hover, +.lg-btn-large-o.lg-btn-large-plain:hover { + background-color: white; + color: #c8c8c8 !important; + border-color: #c8c8c8; +} +.lg-btn-large-plain { + background-color: #e1e1e1; + border-color: #e1e1e1; +} +.lg-btn-large-plain:hover { + color: white; + background-color: #c8c8c8; + border-color: #c8c8c8; +} +.lg-btn-large-o-plain { + background-color: white; + border-color: #e1e1e1; + color: #e1e1e1; +} +.lg-btn-large-o-plain:hover { + background-color: white; + color: #c8c8c8; + border-color: #c8c8c8; +} +.lg-btn-large-o-plain:last-child { + margin-right: 0; +} +.lg-btn-large-o-plain:before { + margin-right: 5px; + font-size: 14px; +} +.lg-btn-large.lg-color-highlight { + background-color: #ff8447; + border-color: #ff8447; +} +.lg-btn-large.lg-color-highlight:hover { + color: white; + background-color: #ff6214; + border-color: #ff6214; +} +.lg-btn-large-o.lg-color-highlight, +.lg-btn-large-o.lg-btn-large-highlight { + background-color: white; + border-color: #ff8447; + color: #ff8447; +} +.lg-btn-large-o.lg-color-highlight:hover, +.lg-btn-large-o.lg-btn-large-highlight:hover { + background-color: white; + color: #ff6214 !important; + border-color: #ff6214; +} +.lg-btn-large-highlight { + background-color: #ff8447; + border-color: #ff8447; +} +.lg-btn-large-highlight:hover { + color: white; + background-color: #ff6214; + border-color: #ff6214; +} +.lg-btn-large-o-highlight { + background-color: white; + border-color: #ff8447; + color: #ff8447; +} +.lg-btn-large-o-highlight:hover { + background-color: white; + color: #ff6214; + border-color: #ff6214; +} +.lg-btn-large-o-highlight:last-child { + margin-right: 0; +} +.lg-btn-large-o-highlight:before { + margin-right: 5px; + font-size: 14px; +} +.lg-btn-small.lg-color-main { + background-color: #5986e1; + border-color: #5986e1; +} +.lg-btn-small.lg-color-main:hover { + color: white; + background-color: #2e67d9; + border-color: #2e67d9; +} +.lg-btn-small-o.lg-color-main, +.lg-btn-small-o.lg-btn-small-main { + background-color: white; + border-color: #5986e1; + color: #5986e1; +} +.lg-btn-small-o.lg-color-main:hover, +.lg-btn-small-o.lg-btn-small-main:hover { + background-color: white; + color: #2e67d9 !important; + border-color: #2e67d9; +} +.lg-btn-small-main { + background-color: #5986e1; + border-color: #5986e1; +} +.lg-btn-small-main:hover { + color: white; + background-color: #2e67d9; + border-color: #2e67d9; +} +.lg-btn-small-o-main { + background-color: white; + border-color: #5986e1; + color: #5986e1; +} +.lg-btn-small-o-main:hover { + background-color: white; + color: #2e67d9; + border-color: #2e67d9; +} +.lg-btn-small-o-main:last-child { + margin-right: 0; +} +.lg-btn-small-o-main:before { + margin-right: 5px; + font-size: 14px; +} +.lg-btn-small.lg-color-danger { + background-color: #d05538; + border-color: #d05538; +} +.lg-btn-small.lg-color-danger:hover { + color: white; + background-color: #ac4229; + border-color: #ac4229; +} +.lg-btn-small-o.lg-color-danger, +.lg-btn-small-o.lg-btn-small-danger { + background-color: white; + border-color: #d05538; + color: #d05538; +} +.lg-btn-small-o.lg-color-danger:hover, +.lg-btn-small-o.lg-btn-small-danger:hover { + background-color: white; + color: #ac4229 !important; + border-color: #ac4229; +} +.lg-btn-small-danger { + background-color: #d05538; + border-color: #d05538; +} +.lg-btn-small-danger:hover { + color: white; + background-color: #ac4229; + border-color: #ac4229; +} +.lg-btn-small-o-danger { + background-color: white; + border-color: #d05538; + color: #d05538; +} +.lg-btn-small-o-danger:hover { + background-color: white; + color: #ac4229; + border-color: #ac4229; +} +.lg-btn-small-o-danger:last-child { + margin-right: 0; +} +.lg-btn-small-o-danger:before { + margin-right: 5px; + font-size: 14px; +} +.lg-btn-small.lg-color-success { + background-color: #8bb455; + border-color: #8bb455; +} +.lg-btn-small.lg-color-success:hover { + color: white; + background-color: #719442; + border-color: #719442; +} +.lg-btn-small-o.lg-color-success, +.lg-btn-small-o.lg-btn-small-success { + background-color: white; + border-color: #8bb455; + color: #8bb455; +} +.lg-btn-small-o.lg-color-success:hover, +.lg-btn-small-o.lg-btn-small-success:hover { + background-color: white; + color: #719442 !important; + border-color: #719442; +} +.lg-btn-small-success { + background-color: #8bb455; + border-color: #8bb455; +} +.lg-btn-small-success:hover { + color: white; + background-color: #719442; + border-color: #719442; +} +.lg-btn-small-o-success { + background-color: white; + border-color: #8bb455; + color: #8bb455; +} +.lg-btn-small-o-success:hover { + background-color: white; + color: #719442; + border-color: #719442; +} +.lg-btn-small-o-success:last-child { + margin-right: 0; +} +.lg-btn-small-o-success:before { + margin-right: 5px; + font-size: 14px; +} +.lg-btn-small.lg-color-sys { + background-color: #464e78; + border-color: #464e78; +} +.lg-btn-small.lg-color-sys:hover { + color: white; + background-color: #333958; + border-color: #333958; +} +.lg-btn-small-o.lg-color-sys, +.lg-btn-small-o.lg-btn-small-sys { + background-color: white; + border-color: #464e78; + color: #464e78; +} +.lg-btn-small-o.lg-color-sys:hover, +.lg-btn-small-o.lg-btn-small-sys:hover { + background-color: white; + color: #333958 !important; + border-color: #333958; +} +.lg-btn-small-sys { + background-color: #464e78; + border-color: #464e78; +} +.lg-btn-small-sys:hover { + color: white; + background-color: #333958; + border-color: #333958; +} +.lg-btn-small-o-sys { + background-color: white; + border-color: #464e78; + color: #464e78; +} +.lg-btn-small-o-sys:hover { + background-color: white; + color: #333958; + border-color: #333958; +} +.lg-btn-small-o-sys:last-child { + margin-right: 0; +} +.lg-btn-small-o-sys:before { + margin-right: 5px; + font-size: 14px; +} +.lg-btn-small.lg-color-plain { + background-color: #e1e1e1; + border-color: #e1e1e1; +} +.lg-btn-small.lg-color-plain:hover { + color: white; + background-color: #c8c8c8; + border-color: #c8c8c8; +} +.lg-btn-small-o.lg-color-plain, +.lg-btn-small-o.lg-btn-small-plain { + background-color: white; + border-color: #e1e1e1; + color: #e1e1e1; +} +.lg-btn-small-o.lg-color-plain:hover, +.lg-btn-small-o.lg-btn-small-plain:hover { + background-color: white; + color: #c8c8c8 !important; + border-color: #c8c8c8; +} +.lg-btn-small-plain { + background-color: #e1e1e1; + border-color: #e1e1e1; +} +.lg-btn-small-plain:hover { + color: white; + background-color: #c8c8c8; + border-color: #c8c8c8; +} +.lg-btn-small-o-plain { + background-color: white; + border-color: #e1e1e1; + color: #e1e1e1; +} +.lg-btn-small-o-plain:hover { + background-color: white; + color: #c8c8c8; + border-color: #c8c8c8; +} +.lg-btn-small-o-plain:last-child { + margin-right: 0; +} +.lg-btn-small-o-plain:before { + margin-right: 5px; + font-size: 14px; +} +.lg-btn-small.lg-color-highlight { + background-color: #ff8447; + border-color: #ff8447; +} +.lg-btn-small.lg-color-highlight:hover { + color: white; + background-color: #ff6214; + border-color: #ff6214; +} +.lg-btn-small-o.lg-color-highlight, +.lg-btn-small-o.lg-btn-small-highlight { + background-color: white; + border-color: #ff8447; + color: #ff8447; +} +.lg-btn-small-o.lg-color-highlight:hover, +.lg-btn-small-o.lg-btn-small-highlight:hover { + background-color: white; + color: #ff6214 !important; + border-color: #ff6214; +} +.lg-btn-small-highlight { + background-color: #ff8447; + border-color: #ff8447; +} +.lg-btn-small-highlight:hover { + color: white; + background-color: #ff6214; + border-color: #ff6214; +} +.lg-btn-small-o-highlight { + background-color: white; + border-color: #ff8447; + color: #ff8447; +} +.lg-btn-small-o-highlight:hover { + background-color: white; + color: #ff6214; + border-color: #ff6214; +} +.lg-btn-small-o-highlight:last-child { + margin-right: 0; +} +.lg-btn-small-o-highlight:before { + margin-right: 5px; + font-size: 14px; +} +/* group */ +.lg-btn-group { + display: inline-block; + margin: 5px; +} +.lg-btn-group * { + margin: 0; + border-radius: 0; + float: left; +} +.lg-btn-group > *:first-child { + border-top-left-radius: 3px; + border-bottom-left-radius: 3px; +} +.lg-btn-group > *:last-child { + border-top-right-radius: 3px; + border-bottom-right-radius: 3px; +} +.lg-btn-group *[class^='lg-btn'][class*='-o'] + *[class^='lg-btn'][class*='-o'] { + border-left: none; +} +/* disable */ +*[class^="lg-btn"][disabled='disabled'] { + border-color: #e1e1e1 !important; + background-color: #e1e1e1 !important; +} +*[class^="lg-btn"][disabled='disabled']:hover { + border-color: #e1e1e1 !important; + background-color: #e1e1e1 !important; +} +*[class^="lg-btn-"][class*="-o"][disabled='disabled'] { + border-color: #e1e1e1 !important; + background-color: white !important; + color: #e1e1e1 !important; +} +*[class^="lg-btn-"][class*="-o"][disabled='disabled']:hover { + border-color: #e1e1e1 !important; + background-color: white !important; + color: #e1e1e1 !important; +} +/* text + textarea + select + checkbox + radio + switchbox */ +input, +select, +textarea { + outline: none; + border-radius: 3px; + font-size: 12px; +} +input, +select { + box-sizing: border-box; + width: 120px; + margin-right: 5px; + line-height: 22px; + -moz-appearance: textfield; +} +input::-webkit-inner-spin-button, +input::-webkit-outer-spin-button { + -webkit-appearance: none; + margin: 0; +} +label { + font-weight: normal; + margin: 0; +} +label.lg-require:before { + content: '*'; + color: red; +} +/* text */ +input[type='text'], +input[type='number'], +input[type='telephone'] { + border: 1px solid #e1e1e1; + padding: 3px 5px; + font-size: 12px; + color: #666; + height: 30px; +} +input[type='text']:active, +input[type='number']:active, +input[type='telephone']:active, +input[type='text']:focus, +input[type='number']:focus, +input[type='telephone']:focus { + border: 1px solid #5986e1; +} +/* textarea */ +textarea { + border: 1px solid #e1e1e1; + padding: 3px 5px; + font-size: 12px; + color: #666; + width: 80%; + min-height: 100px; + resize: none; +} +textarea:active, +textarea:focus { + border: 1px solid #5986e1; +} +/* select */ +select { + border: 1px solid #e1e1e1; + padding: 3px 5px; + font-size: 12px; + color: #666; +} +select:active, +select:focus { + border: 1px solid #5986e1; +} +select option:hover { + background-color: #5986e1; +} +select option[selected] { + background-color: #5986e1; +} +/* checkbox & radio */ +input[type='checkbox'], +input[type='radio'] { + opacity: 0; + z-index: 1; + height: 0; + width: 0; + margin: 0; +} +/* checkbox */ +.lg-checkbox label, +.lg-checkbox-all label, +.lg-checkbox-part label, +.lg-checkbox-plain label { + white-space: nowrap; +} +.lg-checkbox input[type='checkbox'] + label, +.lg-checkbox-all input[type='checkbox'] + label, +.lg-checkbox-part input[type='checkbox'] + label, +.lg-checkbox-plain input[type='checkbox'] + label { + cursor: pointer; + width: auto; + margin-right: 10px; + position: static; + display: inline !important; +} +.lg-checkbox input[type='checkbox'] + label:hover, +.lg-checkbox-all input[type='checkbox'] + label:hover, +.lg-checkbox-part input[type='checkbox'] + label:hover, +.lg-checkbox-plain input[type='checkbox'] + label:hover { + color: #ff8447; +} +.lg-checkbox input[type='checkbox'] + label:before, +.lg-checkbox-all input[type='checkbox'] + label:before, +.lg-checkbox-part input[type='checkbox'] + label:before, +.lg-checkbox-plain input[type='checkbox'] + label:before { + content: ''; + border: 1px solid #999; + border-radius: 4px; + margin-right: 6px; + width: 14px; + height: 14px; + display: inline-block; + vertical-align: text-top; + box-sizing: border-box; + font-size: 12px; +} +.lg-checkbox input[type='checkbox']:checked + label:before, +.lg-checkbox-all input[type='checkbox']:checked + label:before, +.lg-checkbox-part input[type='checkbox']:checked + label:before, +.lg-checkbox-plain input[type='checkbox']:checked + label:before { + color: #ff8447; + content: "\e65d"; + font-family: "iconfont" !important; + border-color: #ff8447; + line-height: 12px; +} +.lg-checkbox input[type='checkbox']:disabled + label, +.lg-checkbox-all input[type='checkbox']:disabled + label, +.lg-checkbox-part input[type='checkbox']:disabled + label, +.lg-checkbox-plain input[type='checkbox']:disabled + label { + color: #999; +} +.lg-checkbox input[type='checkbox']:disabled + label:before, +.lg-checkbox-all input[type='checkbox']:disabled + label:before, +.lg-checkbox-part input[type='checkbox']:disabled + label:before, +.lg-checkbox-plain input[type='checkbox']:disabled + label:before { + border-color: #999; +} +.lg-checkbox input[type='checkbox']:disabled + label:hover, +.lg-checkbox-all input[type='checkbox']:disabled + label:hover, +.lg-checkbox-part input[type='checkbox']:disabled + label:hover, +.lg-checkbox-plain input[type='checkbox']:disabled + label:hover { + color: #999; +} +.lg-checkbox input[type='checkbox']:disabled:checked + label, +.lg-checkbox-all input[type='checkbox']:disabled:checked + label, +.lg-checkbox-part input[type='checkbox']:disabled:checked + label, +.lg-checkbox-plain input[type='checkbox']:disabled:checked + label { + color: #999; +} +.lg-checkbox input[type='checkbox']:disabled:checked + label:before, +.lg-checkbox-all input[type='checkbox']:disabled:checked + label:before, +.lg-checkbox-part input[type='checkbox']:disabled:checked + label:before, +.lg-checkbox-plain input[type='checkbox']:disabled:checked + label:before { + color: #999; + background-color: transparent; + border-color: #999; +} +.lg-checkbox-all input[type='checkbox']:disabled:checked + label { + color: #999; +} +.lg-checkbox-all input[type='checkbox']:disabled:checked + label:before { + color: white; + background-color: #999; + border-color: #999; +} +.lg-checkbox-part input[type='checkbox']:checked + label:before { + color: #666; + background-color: transparent; + border-color: #666; +} +/* radio */ +.lg-radio label, +.lg-radio-plain label { + white-space: nowrap; +} +.lg-radio input[type='radio'] + label, +.lg-radio-plain input[type='radio'] + label { + cursor: pointer; + width: auto; + margin-right: 10px; + position: static; + display: inline !important; +} +.lg-radio input[type='radio'] + label:hover, +.lg-radio-plain input[type='radio'] + label:hover { + color: #ff8447; +} +.lg-radio input[type='radio'] + label:before, +.lg-radio-plain input[type='radio'] + label:before { + content: ''; + border: 1px solid #999; + border-radius: 8px; + margin-right: 6px; + width: 14px; + height: 14px; + display: inline-block; + vertical-align: text-top; + box-sizing: border-box; +} +.lg-radio input[type='radio']:checked + label, +.lg-radio-plain input[type='radio']:checked + label { + position: relative; +} +.lg-radio input[type='radio']:checked + label:before, +.lg-radio-plain input[type='radio']:checked + label:before { + border-color: #ff8447; +} +.lg-radio input[type='radio']:checked + label:after, +.lg-radio-plain input[type='radio']:checked + label:after { + content: ""; + width: 8px; + height: 8px; + background-color: #ff8447; + border-radius: 5px; + position: absolute; + top: 3px; + left: 3px; +} +.lg-radio input[type='radio']:disabled + label, +.lg-radio-plain input[type='radio']:disabled + label { + color: #999; +} +.lg-radio input[type='radio']:disabled + label:before, +.lg-radio-plain input[type='radio']:disabled + label:before { + border-color: #999; +} +.lg-radio input[type='radio']:disabled + label:hover, +.lg-radio-plain input[type='radio']:disabled + label:hover { + color: #999; +} +.lg-radio input[type='radio']:disabled:checked + label, +.lg-radio-plain input[type='radio']:disabled:checked + label { + color: #999; +} +.lg-radio input[type='radio']:disabled:checked + label:before, +.lg-radio-plain input[type='radio']:disabled:checked + label:before { + color: #999; + background-color: transparent; + border-color: #999; +} +.lg-radio input[type='radio']:disabled:checked + label:after, +.lg-radio-plain input[type='radio']:disabled:checked + label:after { + content: ""; + background-color: #999; +} +.lg-plain .lg-checkbox > label:before, +.lg-plain .lg-radio > label:before { + display: none !important; +} +.lg-plain .lg-checkbox > label:after, +.lg-plain .lg-radio > label:after { + display: none !important; +} +.lg-radio-plain input[type='radio'] + label:before, +.lg-checkbox-plain input[type='radio'] + label:before, +.lg-radio-plain input[type='checkbox'] + label:before, +.lg-checkbox-plain input[type='checkbox'] + label:before, +.lg-radio-plain input[type='radio'] + label:after, +.lg-checkbox-plain input[type='radio'] + label:after, +.lg-radio-plain input[type='checkbox'] + label:after, +.lg-checkbox-plain input[type='checkbox'] + label:after { + display: none; +} +.lg-radio-plain input[type='radio']:checked + label, +.lg-checkbox-plain input[type='radio']:checked + label, +.lg-radio-plain input[type='checkbox']:checked + label, +.lg-checkbox-plain input[type='checkbox']:checked + label { + color: #ff8447; +} +/* switchbox */ +.lg-switch input[type='checkbox'] + label { + color: white; + background-color: #e1e1e1; + height: 26px; + line-height: 26px; + border-radius: 20px; + display: inline-block !important; + padding: 2px 8px 2px 2px; + box-sizing: content-box; +} +.lg-switch input[type='checkbox'] + label:before { + content: ""; + height: 24px; + width: 24px; + margin-right: 6px; + border-radius: 11px; + background-color: white; + border-color: white; + line-height: 30px; + vertical-align: middle; + display: inline-block; + position: relative; + top: -1px; +} +.lg-switch input[type='checkbox'] + label + label { + display: none !important; +} +.lg-switch input[type='checkbox']:checked + label + label { + cursor: pointer; + color: white; + background-color: #8bb455; + height: 26px; + line-height: 26px; + border-radius: 20px; + display: inline-block !important; + padding: 2px 2px 2px 8px; + box-sizing: content-box; +} +.lg-switch input[type='checkbox']:checked + label + label:after { + content: ""; + height: 24px; + width: 24px; + margin-left: 6px; + border-radius: 11px; + background-color: white; + border-color: white; + line-height: 30px; + vertical-align: middle; + display: inline-block; + position: relative; + top: -1px; +} +.lg-switch input[type='checkbox']:checked + label { + display: none !important; +} +.lg-switch .lg-main:checked + label + label { + background-color: #464e78 !important; +} +.lg-tag { + border-radius: 13px; + background-color: #e1e1e1; + color: #666; + padding: 4px 12px; + margin-right: 15px; + cursor: pointer; + display: inline; + font-size: 14px; + position: relative; + white-space: nowrap; +} +.lg-tag.active, +.lg-tag.lg-fn-active { + color: #ff8447; + background-color: #fff0db; +} +.lg-tag.lg-diy:after { + content: '\e661'; + font-family: "iconfont" !important; + color: red; + position: absolute; + top: -5px; + right: -5px; +} +.lg-tag-add { + display: inline-block; +} +.lg-tag-add:before { + content: '\e670'; + font-family: "iconfont" !important; + color: #e1e1e1; + font-size: 25px; + vertical-align: sub; + margin-right: 5px; +} +.lg-tag-add .icon-zhengque { + color: #8bb455; +} +.lg-tag-add .icon-cuowu { + color: #ff8447; +} +.lg-tab { + display: block; + list-style: none; + height: 38px; + line-height: 40px; + background-color: #f7f9fe; + font-size: 14px; + border-bottom: 1px solid #ccdaf7; + box-sizing: content-box; +} +.lg-tab .lg-tab-li { + float: left; + color: #666; + padding: 0 27px; + position: relative; + cursor: pointer; + height: 38px; +} +.lg-tab .lg-tab-li:after { + content: ''; + border-right: 1px solid #e1e1e1; + height: 36%; + position: absolute; + top: 32%; + left: 0; +} +.lg-tab .lg-tab-li:first-child:after { + height: 0; +} +.lg-tab .lg-tab-li * { + color: #666; +} +.lg-tab .lg-active, +.lg-tab .lg-fn-active, +.lg-tab .active { + background-color: white; + border: 1px solid #ccdaf7; + border-bottom: none; + color: #6D77AA; + font-weight: bold; +} +.lg-tab .lg-active:after, +.lg-tab .lg-fn-active:after, +.lg-tab .active:after { + height: 0; +} +.lg-tab .lg-active *, +.lg-tab .lg-fn-active *, +.lg-tab .active * { + color: #6D77AA; +} +.lg-tab .lg-active + .lg-tab-li:after, +.lg-tab .active + .lg-tab-li:after, +.lg-tab .lg-fn-active + .lg-tab-li:after { + height: 0; +} +.lg-tab-body { + border: 1px solid #ccdaf7; + border-top: none; + padding: 5px; +} +/* toast & bubble & error & progress*/ +/* toast */ +.lg-toast { + display: inline-block; + max-width: 232px; + padding: 15px 20px; + margin: 10px; + border-radius: 4px; + box-shadow: 2px 2px 12px 2px #e1e1e1; + background-color: white; +} +/* bubble */ +.lg-toast, +.lg-bubble, +.lg-bubble-top, +.lg-bubble-bottom { + display: inline-block; + max-width: 232px; + padding: 15px 20px; + margin: 10px; + border-radius: 4px; + box-shadow: 2px 2px 12px 2px #e1e1e1; + background-color: white; +} +.lg-bubble, +.lg-bubble-top { + color: #ff8447; + position: relative; + box-shadow: 4px 4px 14px 1px #e1e1e1; +} +.lg-bubble:after, +.lg-bubble-top:after { + content: ''; + border: 8px solid transparent; + border-top: 8px solid white; + position: absolute; + bottom: -16px; + right: 50%; + margin-right: -8px; +} +.lg-bubble-bottom { + color: #ff8447; + position: relative; + box-shadow: -4px -4px 14px 1px #e1e1e1; +} +.lg-bubble-bottom:after { + content: ''; + border: 8px solid transparent; + border-bottom: 8px solid white; + position: absolute; + top: -15px; + right: 50%; + margin-right: -8px; +} +/* error */ +.lg-error { + color: #ff8447; +} +.lg-error-b { + color: #ff8447; + display: block; + line-height: 30px; +} +input:focus + .lg-error { + display: none; +} +input:focus + .lg-error-b { + visibility: hidden; +} +/* progress */ +.lg-progress { + height: 30px; + width: 200px; + overflow: hidden; + margin: 0 20px; + display: inline-block; + position: relative; + border-radius: 15px; + background-color: #ededed; +} +.lg-progress > * { + display: block; + height: 100%; + background-color: #5986e1; +} +.lg-table { + width: 100%; + border-collapse: collapse; + line-height: 36px; + text-align: center; + color: #666; + border-bottom: 1px solid #e1e1e1; +} +.lg-table thead tr { + background-color: #6d77aa; + color: white; + height: 40px; +} +.lg-table thead tr.lg-color-danger-bg { + background-color: #d05538; +} +.lg-table thead tr.lg-color-success-bg { + background-color: #8bb455; +} +.lg-table thead tr.lg-color-plain-bg { + background-color: #e1e1e1; +} +.lg-table thead tr.lg-color-highlight-bg { + background-color: #ff8447; +} +.lg-table thead th { + font-weight: normal; + position: relative; + text-align: center; + border: none; + font-size: 14px; + white-space: nowrap; +} +.lg-table thead th.lg-asc { + cursor: pointer; +} +.lg-table thead th.lg-asc:after { + content: '\e644'; + font-family: iconfont !important; + position: absolute; + top: -1px; + font-size: 12px; + margin: 0 5px; + color: #f8f8f8; +} +.lg-table thead th.lg-desc { + cursor: pointer; +} +.lg-table thead th.lg-desc:after { + content: '\e64a'; + font-family: iconfont !important; + position: absolute; + top: 2px; + font-size: 20px; + margin: 0 5px; + color: #f8f8f8; +} +.lg-table thead tr.lg-table-tr th { + border: 1px solid white; +} +.lg-table tr { + border: none; +} +.lg-table tbody tr:nth-child(2n) { + background-color: #f4f4f8; +} +.lg-table td { + border: none; + font-size: 12px; +} +.lg-table a.lg-dropdown { + color: #666; +} +.lg-table-scroll { + overflow-x: auto; +} +.lg-dropdown { + position: relative; + display: inline-block; +} +.lg-dropdown > ul { + display: none; + width: 100%; + position: absolute; + top: 100%; + width: auto; + overflow: hidden; +} +.lg-dropdown > ul li { + width: 100%; + box-sizing: border-box; +} +.lg-dropdown:hover > ul { + display: block; + border: 1px solid #e1e1e1; + list-style: none; + position: absolute; + top: 100%; + left: 0; + background-color: white; + z-index: 1; + float: left; +} +.lg-dropdown:hover > ul li { + border-bottom: 1px solid #e1e1e1; + padding: 4px 8px; + font-size: 12px; + line-height: 22px; + white-space: nowrap; + float: left; +} +.lg-dropdown:hover > ul li:hover { + color: #ff8447; +} +.lg-dropdown:hover > ul li:last-child { + border-bottom: none; +} +.lg-tree { + height: 100%; + max-height: 100%; + position: relative; + overflow-y: auto; + overflow-x: hidden; + border: 1px solid #e1e1e1; + border-bottom: none; + margin-bottom: 20px; +} +.lg-tree a { + cursor: pointer; + position: relative; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + border-bottom: 1px solid #ededed; + display: block; + color: #333; +} +.lg-tree a:hover { + background-color: #ededed; + color: #464e78; +} +.lg-tree a:hover:before, +.lg-tree a:hover:after { + color: #464e78; +} +.lg-tree a.current, +.lg-tree a.lg-fn-current { + background-color: #ededed; + color: #464e78; +} +.lg-tree ul { + display: none; +} +.lg-tree .lg-fn-active + ul, +.lg-tree .active + ul { + display: block; +} +.lg-tree > li > a { + padding-left: 20px; + line-height: 60px; + height: 60px; + font-size: 18px; + color: #333333; +} +.lg-tree > li > a > i, +.lg-tree > li > a > i:before, +.lg-tree > li > a > i:after { + font-size: 18px; +} +.lg-tree > li > ul > li > a { + padding-left: 40px; + line-height: 55px; + height: 55px; + font-size: 16.2px; + color: #404040; +} +.lg-tree > li > ul > li > a > i, +.lg-tree > li > ul > li > a > i:before, +.lg-tree > li > ul > li > a > i:after { + font-size: 16.2px; +} +.lg-tree > li > ul > li > ul > li > a { + padding-left: 60px; + line-height: 50px; + height: 50px; + font-size: 14.58px; + color: #4d4d4d; +} +.lg-tree > li > ul > li > ul > li > a > i, +.lg-tree > li > ul > li > ul > li > a > i:before, +.lg-tree > li > ul > li > ul > li > a > i:after { + font-size: 14.58px; +} +.lg-tree > li > ul > li > ul > li > ul > li > a { + padding-left: 80px; + line-height: 45px; + height: 45px; + font-size: 13.122px; + color: #595959; +} +.lg-tree > li > ul > li > ul > li > ul > li > a > i, +.lg-tree > li > ul > li > ul > li > ul > li > a > i:before, +.lg-tree > li > ul > li > ul > li > ul > li > a > i:after { + font-size: 13.122px; +} +.lg-tree > li > ul > li > ul > li > ul > li > ul > li > a { + padding-left: 100px; + line-height: 40px; + height: 40px; + font-size: 11.8098px; + color: #666666; +} +.lg-tree > li > ul > li > ul > li > ul > li > ul > li > a > i, +.lg-tree > li > ul > li > ul > li > ul > li > ul > li > a > i:before, +.lg-tree > li > ul > li > ul > li > ul > li > ul > li > a > i:after { + font-size: 11.8098px; +} +.lg-tree > li > ul > li > ul > li > ul > li > ul > li > ul > li > a { + padding-left: 120px; + line-height: 35px; + height: 35px; + font-size: 10.62882px; + color: #737373; +} +.lg-tree > li > ul > li > ul > li > ul > li > ul > li > ul > li > a > i, +.lg-tree > li > ul > li > ul > li > ul > li > ul > li > ul > li > a > i:before, +.lg-tree > li > ul > li > ul > li > ul > li > ul > li > ul > li > a > i:after { + font-size: 10.62882px; +} +.lg-table-scroll::-webkit-scrollbar { + border: 1px solid #e1e1e1; + border: none; + width: 8px; + height: 8px; +} +.lg-table-scroll::-webkit-scrollbar-thumb { + background-color: #c1c1c1; + border-radius: 10px; +} +.lg-table-scroll::-webkit-scrollbar-button:start:decrement, +.lg-table-scroll::-webkit-scrollbar-button:end:increment { + display: block; +} +.lg-table-scroll::-webkit-scrollbar-button:end:decrement, +.lg-table-scroll::-webkit-scrollbar-button:start:increment { + display: none; +} +.lg-breadcrumb { + width: 100%; + margin: 0; + padding-left: 15px; + list-style: none; + font-size: 14px; + z-index: 1000; +} +.lg-breadcrumb span { + font-size: 14px; +} +.lg-breadcrumb > * { + float: left; + color: #666; + display: table; +} +.lg-breadcrumb > *:before { + content: ">"; + font-family: consolas; + font-size: 18px; + padding: 0 8px; +} +.lg-breadcrumb > *:first-child { + padding-left: 0; +} +.lg-breadcrumb > *:first-child:before { + display: none; +} +.lg-breadcrumb > *:last-child { + padding-right: 0; +} +.lg-breadcrumb > * > * { + line-height: 24px; +} +.lg-breadcrumb > * > a { + cursor: pointer; + color: #666; +} +.lg-breadcrumb > * a:hover { + color: #5986e1; +} +.lg-form-line, +.lg-form-block, +.lg-form-box { + margin-top: 5px; + padding-left: 100px; + position: relative; + min-height: 30px; +} +.lg-form-line label, +.lg-form-block label, +.lg-form-box label { + width: 100px; + position: absolute; + top: 0; + left: 0; + line-height: 30px; + text-align: right; + font-size: 12px; +} +.lg-form-line input + span, +.lg-form-block input + span, +.lg-form-box input + span { + margin-right: 5px; +} +.lg-form-line label + span, +.lg-form-block label + span, +.lg-form-box label + span { + line-height: 30px; + margin-left: 5px; + display: inline-block; +} +.lg-form-line *[class^='lg-btn'], +.lg-form-block *[class^='lg-btn'], +.lg-form-box *[class^='lg-btn'] { + margin-top: 0; + margin-bottom: 0; +} +.lg-form-line span, +.lg-form-block span, +.lg-form-box span { + word-break: break-all; + margin-right: 5px; +} +.lg-condition { + padding: 0 16px; + border-top: 1px solid #e1e1e1; + border-bottom: 1px solid #e1e1e1; + background-color: #f8f8f8; + font-size: 12px; + margin-bottom: 16px; +} +.lg-condition .lg-condition-box, +.lg-condition .lg-condition-block { + border-top: 1px solid #e1e1e1; + padding: 10px 0; +} +.lg-condition .lg-condition-box:first-child, +.lg-condition .lg-condition-block:first-child { + border-top: none; +} +.lg-condition .lg-condition-box > li, +.lg-condition .lg-condition-block > li { + padding: 5px 0; +} +.lg-condition .lg-condition-box > li > .lg-label, +.lg-condition .lg-condition-block > li > .lg-label { + position: absolute; +} +.lg-condition .lg-condition-box .wp-condition-group, +.lg-condition .lg-condition-block .wp-condition-group { + line-height: 30px; +} +.lg-condition .lg-condition-box span, +.lg-condition .lg-condition-block span { + margin-right: 5px; + color: #999; +} +.lg-condition .lg-condition-box label, +.lg-condition .lg-condition-block label { + text-align: right; + line-height: 30px; + width: 100px; +} +.lg-condition .lg-condition-box tr td:first-child, +.lg-condition .lg-condition-block tr td:first-child { + text-align: right; + white-space: nowrap; + vertical-align: top; + line-height: 34px; +} +.lg-condition .lg-condition-box .lg-radio label, +.lg-condition .lg-condition-block .lg-radio label, +.lg-condition .lg-condition-box .lg-checkbox label, +.lg-condition .lg-condition-block .lg-checkbox label, +.lg-condition .lg-condition-box .lg-radio-plain label, +.lg-condition .lg-condition-block .lg-radio-plain label, +.lg-condition .lg-condition-box .lg-checkbox-plain label, +.lg-condition .lg-condition-block .lg-checkbox-plain label { + display: inline-block; + line-height: 30px; + margin: 0 15px 0 5px; + cursor: pointer; +} +.lg-condition .lg-condition-box .lg-radio input[type='radio']:checked + label, +.lg-condition .lg-condition-block .lg-radio input[type='radio']:checked + label, +.lg-condition .lg-condition-box .lg-checkbox input[type='checkbox']:checked + label, +.lg-condition .lg-condition-block .lg-checkbox input[type='checkbox']:checked + label { + color: #ff8447; +} +.lg-condition .lg-condition-box .lg-radio input[type='radio']:checked + label:after, +.lg-condition .lg-condition-block .lg-radio input[type='radio']:checked + label:after, +.lg-condition .lg-condition-box .lg-checkbox input[type='checkbox']:checked + label:after, +.lg-condition .lg-condition-block .lg-checkbox input[type='checkbox']:checked + label:after { + background-color: #ff8447; +} +.lg-condition .lg-condition-box .lg-radio input[type='radio']:checked + label:before, +.lg-condition .lg-condition-block .lg-radio input[type='radio']:checked + label:before, +.lg-condition .lg-condition-box .lg-checkbox input[type='checkbox']:checked + label:before, +.lg-condition .lg-condition-block .lg-checkbox input[type='checkbox']:checked + label:before { + border-color: #ff8447; +} +.lg-condition .lg-condition-box .lg-checkbox input[type='checkbox']:checked + label:before, +.lg-condition .lg-condition-block .lg-checkbox input[type='checkbox']:checked + label:before { + background-color: #ff8447; +} +.lg-condition .lg-condition-box .lg-radio-plain input[type='radio']:checked + label, +.lg-condition .lg-condition-block .lg-radio-plain input[type='radio']:checked + label, +.lg-condition .lg-condition-box .lg-checkbox-plain input[type='checkbox']:checked + label, +.lg-condition .lg-condition-block .lg-checkbox-plain input[type='checkbox']:checked + label { + color: #ff8447; +} +.lg-condition .lg-condition-box *[class^='lg-btn'], +.lg-condition .lg-condition-block *[class^='lg-btn'] { + margin-top: 0; + margin-bottom: 0; +} diff --git a/radio-group.js b/radio-group.js new file mode 100644 index 0000000..d97c530 --- /dev/null +++ b/radio-group.js @@ -0,0 +1,48 @@ +; +(function(factory) { + if (typeof module === 'object' && typeof module.exports == 'object') { + module.exports = factory( + require('vue') + ); + } else { + factory(window.Vue); + } +})(function(Vue) { + var radioGroup = {}; + radioGroup.install = function(Vue) { + Vue.component('radio-group', { + delimiters: ['${', '}'], + props: ['data', 'model', 'className', 'index'], + template: '', + methods: { + check: function() { + this.$emit('input', this.selected); + }, + name: function(name, index) { + if (index != undefined) { + return name + index; + } + return name; + }, + id: function(id, index) { + if (index != undefined) { + return id + index; + } + return id; + } + }, + data: function() { + return { + selected: this.model + } + }, + watch: { + model: function(val, oldVal) { + this.selected = val; + this.$emit('input', this.selected); + } + } + }) + } + Vue.use(radioGroup); +}); diff --git a/select-group.js b/select-group.js new file mode 100644 index 0000000..64d634a --- /dev/null +++ b/select-group.js @@ -0,0 +1,43 @@ +; +(function(factory) { + if (typeof module === 'object' && typeof module.exports == 'object') { + module.exports = factory( + require('vue') + ); + } else { + factory(window.Vue); + } +})(function(Vue) { + var selectGroup={}; + selectGroup.install = function(Vue) { + Vue.component('select-group',{ + delimiters: ['${', '}'], + props: ['data', 'model', 'keyset','defaultVal', 'hide'], + template: '', + methods: { + change: function(event) { + //if model is pased by object, components can set value by reference whitch is suggested when modify value only + if (typeof this.model == 'object') { + this.model[this.keyset] = this.selected; + } + //if model is pased by value,we cannot modify it directly,so we use $emit whitch is suggested when need callback + else { + this.$parent.$emit(this.keyset, this.selected,event.target['options'][event.target['selectedIndex']].label); + } + } + }, + data: function() { + return { + selected: this.defaultVal!=undefined ? this.defaultVal: this.data[0] ? this.data[0].val : '' + }; + }, + watch: { + data: function(val, oldVal) { + if(this.data[0]) + this.selected = this.defaultVal!=undefined ? this.defaultVal:this.data[0].val; + } + } + }) + } + Vue.use(selectGroup); +}); diff --git a/validate-rule.js b/validate-rule.js new file mode 100644 index 0000000..aeec6e2 --- /dev/null +++ b/validate-rule.js @@ -0,0 +1,52 @@ +; +(function(factory) { + if (typeof module === 'object' && typeof module.exports == 'object') { + module.exports = factory(); + } else { + window.validateRule=factory(); + } +})(function() { + return { + rules: { + required: /\S+/, + email: /^\w[\._\-\w]*@[\w_-]+(?:\.[\w_-]+)+$/i, + mobile: /^\d{11}$/, + idcard: /^(?:\d{14}|\d{17})[\dx]$/i, + number: /^(?:\d+(?:\.\d+)?)$/, + range: function(value, range) { + if (!value) return true; + + if (range[0] && value < range[0]) { + return false; + } + + if (range[1] && value > range[1]) { + return false; + } + + return true; + }, + length: function(value, range) { + if (value) { + return (new RegExp('^[\\s\\S]{' + range.join(',') + '}$')).test(value); + } + return true; + }, + remote: function(value, options) { + return $.ajax(options).then(function() { + return options.checker.apply(null, arguments); + }); + } + }, + + msgs: { + required: '该字段必填', + email: '邮箱格式错误', + mobile: '手机号码格式错误', + idcard: '身份证格式错误', + number: '该字段必须为数字', + range: '字段输入范围错误', + length: '字段输入长度错误' + } + }; +}); \ No newline at end of file diff --git a/validate.js b/validate.js new file mode 100644 index 0000000..0a58e3e --- /dev/null +++ b/validate.js @@ -0,0 +1,45 @@ +; +(function(factory) { + if (typeof module === 'object' && typeof module.exports == 'object') { + module.exports = factory( + require('vue'), require('vue-components/validate-rule') + ); + } else { + factory(window.Vue, window.validateRule); + } +})(function(Vue, defaultRules) { + Vue.prototype.validate = function(form, rules) { + var errorList = []; + rules.forEach(function(item, i) { + if (item.rule) { + if (typeof item.rule == 'object') { + for(var key in item.rule){ + errorList.push(check({ value: form[item.key], rule: key, arg: item.rule[key],key: item.key })) + } + } + } + }) + return errorList.filter(function(item) { + return item.hasError + }); + } + + function check(arg) { + var vTrim = (arg.value + '').replace(/(^\s*)|(\s*$)/g, ""); + var result, flag,message; + if (typeof defaultRules.rules[arg.rule] == 'function') { + flag = defaultRules.rules[arg.rule](vTrim,arg.arg.slice(1,3)); + } else if(defaultRules.rules[arg.rule]) { + flag = defaultRules.rules[arg.rule].test(vTrim); + } else{ + flag = arg.rule.test(vTrim); + } + result = { + hasError: !flag, + key: arg.key, + rule: arg.rule, + msg: arg.arg[0] ? arg.arg[0] : defaultRules.msgs[arg.rule] + }; + return result; + } +}); diff --git a/vdialog/bower.json b/vdialog/bower.json new file mode 100644 index 0000000..fe2ebd2 --- /dev/null +++ b/vdialog/bower.json @@ -0,0 +1,8 @@ +{ + "name": "vpager", + "desc": "vpui-pager", + "main": "index.js", + "version": "1.0.0", + "dependencies": { + } +} \ No newline at end of file diff --git a/vdialog/examples/index.html b/vdialog/examples/index.html new file mode 100644 index 0000000..0de28a0 --- /dev/null +++ b/vdialog/examples/index.html @@ -0,0 +1,102 @@ + + + + + + vdialog example + + + + + + + +
+ + + + + body1 + + + body2 + + + body3 + +
+ + + + diff --git a/vdialog/index.css b/vdialog/index.css new file mode 100644 index 0000000..0ca4809 --- /dev/null +++ b/vdialog/index.css @@ -0,0 +1,96 @@ +.lg-dialog-mask { + position: fixed; + top: 0; + right: 0; + left: 0; + bottom: 0; + background-color: rgba(0, 0, 0, 0.6); + z-index: 10000; +} + +.lg-dialog-body { + min-height: 190px; + min-width: 320px; + padding: 40px; + padding-bottom: 35px; + border: 1px solid white; + border-radius: 3px; + background-color: white; + margin: auto; + position: relative; + top: 50%; + transform: translateY(-50%); +} + +.lg-dialog-close { + display: block; + width: 30px; + height: 30px; + line-height: 30px; + text-align: center; + font-size: 30px; + text-decoration: none; + color: #ccc; + position: absolute; + right: 12px; + top: 10px; + cursor: pointer; +} + +.lg-dialog-title { + color: #464E78; + font-size: 20px; + height: 24px; + text-align: center; +} + +.lg-dialog-content { + overflow: auto; + font-size: 14px; + padding-bottom: 60px; + height: 100%; +} + +.lg-dialog-title + .lg-dialog-content { + padding-top: 20px; +} + +.lg-dialog-bottom { + position: fixed; + bottom: 35px; + right: 40px; + left: 40px; +} + +.lg-dialog-btns { + text-align: center; + height: 42px; + padding: 10px 0px; + list-style: none; + margin: 0px; + border: 0px; + width: 100%; + border-collapse: collapse; + table-layout: fixed; +} + +.lg-dialog-btns .lg-btn { + min-width: 60px; + width: 100%; + height: 40px; + margin: 0; + line-height: 30px; + font-size: 18px; +} + +.lg-dialog-btns td { + padding: 0 10px; +} + +.lg-dialog-btns .lg-dialog-btnfirst { + padding-left: 0; +} + +.lg-dialog-btns .lg-dialog-btnlast { + padding-right: 0; +} diff --git a/vdialog/index.js b/vdialog/index.js new file mode 100644 index 0000000..b26d6ec --- /dev/null +++ b/vdialog/index.js @@ -0,0 +1,70 @@ +; +(function(factory) { + if (typeof module === 'object' && typeof module.exports == 'object') { + module.exports = factory( + require('vue') + ); + } else { + window.Vdialog=factory(window.Vue); + } +})(function(Vue) { + var vDialog = {}, + template; + if (document.getElementById('vdialog-template')) { + template = document.getElementById('vdialog-template').innerHTML; + } else { + template = __inline('index.tpl'); + } + vDialog.install = function(Vue) { + Vue.component('vdialog', { + props: { + 'option': { + type: Object + } + }, + template: template, + methods: { + close: function(flag) { + this.show=false; + this.reject(flag); + }, + sure:function(index){ + this.show=false; + this.resolve(index); + }, + open:function (argument) { + var _this=this; + this.show=true; + this.promise = new Promise(function(resolve, reject){ + _this.resolve = resolve; + _this.reject = reject; + }); + return this.promise; + } + }, + data: function() { + return { + show:false, + resolve:'', + reject:'' + } + }, + computed:{ + dialog:{ + get:function (argument) { + var option=this.option; + var result={ + title:option.title||'', + btns:option&&option.btns ? option.btns :[{text:'取消',klass:'lg-btn-o'},{text:'确定'}], + height:option&&option.height&&option.height>190 ? option.height+'px' :'190', + width:option&&option.width&&option.width>320 ? option.width+'px' :'320px' + } + return result; + } + } + } + }) + } + Vue.use(vDialog); + return vDialog; +}); diff --git a/vdialog/index.tpl b/vdialog/index.tpl new file mode 100644 index 0000000..7865764 --- /dev/null +++ b/vdialog/index.tpl @@ -0,0 +1,18 @@ +
+
+ × +
+
+ +
+
+ + + + +
+ +
+
+
+
\ No newline at end of file diff --git a/vform/examples/index.html b/vform/examples/index.html new file mode 100644 index 0000000..43bdb54 --- /dev/null +++ b/vform/examples/index.html @@ -0,0 +1,110 @@ + + + + + + vform example + + + + + +
+
+
+
+ + + - + + ¥/㎡ +
+
+ + + +
+
+ + +
+
+ + +
+
+
+
+ + +
+
+
+
+ + + + + + + + + + +
+
+ + + + + + + +
+
+
+
+ + + system + selected + diy +
+ +
+
+
+ + + + + + diff --git a/vform/index.js b/vform/index.js new file mode 100644 index 0000000..69835b9 --- /dev/null +++ b/vform/index.js @@ -0,0 +1,159 @@ +; +(function(factory) { + if (typeof module === 'object' && typeof module.exports == 'object') { + module.exports = factory( + require('vue'), require('rule.js') + ); + } else { + window.vForm = factory(window.Vue, window.Vrules); + } +})(function(Vue, BaseRule) { + var _ERRORCLASS = 'lg-error-border'; + var _ERRORMSGCLASS = 'lg-error-msg'; + + function addErrorStyle(el, errors) { + var hasClass = !!el.className.match(new RegExp('(\\s|^)' + _ERRORCLASS + '(\\s|$)')) + if (!hasClass) + el.className += ' ' + _ERRORCLASS; + var hasSibling = el.nextSibling && el.nextSibling.className && (!!el.nextSibling.className.match(new RegExp('(\\s|^)' + _ERRORMSGCLASS + '(\\s|$)'))); + if (!hasSibling) { + var msgEl = document.createElement('span'); + msgEl.className = _ERRORMSGCLASS; + el.after(msgEl); + } + el.nextSibling.innerHTML = errors[0].msg; + } + + function removeErrorStyle(el) { + var reg = new RegExp('(\\s|^)' + _ERRORCLASS + '(\\s|$)'); + el.className = el.className.replace(reg, ''); + var hasSibling = el.nextSibling && el.nextSibling.className && (!!el.nextSibling.className.match(new RegExp('(\\s|^)' + _ERRORMSGCLASS + '(\\s|$)'))); + if (hasSibling) { + el.nextSibling.remove(); + } + } + + function check(el,rules, fieldName, autocheck) { + if(el.childNodes) + console.log(el.childNodes); + var errorArry = []; + for (var ruleName in rules) { + if (BaseRule[ruleName]) { //default rule + var rule = BaseRule[ruleName]; + var arg = typeof rules[ruleName] == 'object' ? rules[ruleName][0] : rules[ruleName]; + var msg = typeof rules[ruleName] == 'object' && rules[ruleName][1] ? rules[ruleName][1] : rule.msg; + if (!autocheck || ruleName != 'required') { //never check required at real-time + switch (typeof rule.exp) { + case 'function': + if (!rule.exp(el.value, arg)) { + errorArry.push(Result(ruleName, fieldName, msg)); + } + break; + case 'object': + if (!rule.exp.test(el.value)) { + errorArry.push(Result(ruleName, fieldName, msg)); + } + break; + } + } + } else { //customer rule + var rule = rules[ruleName]; + var msg = '输入有误'; + if (!isNaN(rules[ruleName].length)) { //array + rule = rules[ruleName][0]; + msg = rules[ruleName][1]; + } + switch (typeof rule) { + case 'function': + if (!rules[ruleName](el.value)) { + errorArry.push(Result(ruleName, fieldName, msg)); + } + break; + case 'object': + if (!rules[ruleName].test(el.value)) { + errorArry.push(Result(ruleName, fieldName, msg)); + } + break; + } + } + } + if (errorArry.length) { + addErrorStyle(el, errorArry); + } else { + removeErrorStyle(el); + } + return errorArry; + } + + function checkAll() { + var err=[]; + this.fields.forEach(function(item,i){ + err=err.concat(check(item.el,item.rules,item.field,false)); + }) + return err; + } + + function Result(ruleName, fieldName, errorMsg) { + return { + rule: ruleName, + field: fieldName, + msg: errorMsg + } + } + function attachField(vm,group,el,field,rules,tag){ + if(!vm.$vform) + vm.$vform=[]; + if(!vm.$vform[group]) + vm.$vform[group]={ + checkAll:checkAll, + check:check, + fields:[] + } + vm.$vform[group].fields.push({ + el:el, + field:field, + rules:rules, + tag:tag + }) + + } + var vForm = {}; + //binding.arg:field name(字段名), + //binding.modifiers: , + //binding.value:default/customer rules(自定义规则,eg:{name:/\s{4}/}), + //tag:displayname(字段中文标签), + //group:, + vForm.install = function(Vue) { + Vue.directive('form', { + bind: function(el, binding, vnode) { + var vm = vnode.context; + var rules = binding.value; + var fieldName = binding.arg; + var group=el.getAttribute('group')||'default'; + var tag=el.getAttribute('tag')||'该字段'; + attachField(vm,group,el,fieldName,rules,tag); + + el.addEventListener('keyup', check.bind(el,el, rules, fieldName, true)); + el.addEventListener('change', check.bind(el,el, rules, fieldName, true)); + el.addEventListener('blur', check.bind(el,el, rules, fieldName, true)); + + }, + inserted: function(el, binding) { + + }, + update: function(el, binding) { + + }, + componentUpdated: function(el, binding) { + + }, + unbind: function() { + + } + }) + } + + + Vue.use(vForm); + return vForm; +}); diff --git a/vform/rule.js b/vform/rule.js new file mode 100644 index 0000000..6f345fa --- /dev/null +++ b/vform/rule.js @@ -0,0 +1,65 @@ +; +(function(factory) { + if (typeof module === 'object' && typeof module.exports == 'object') { + module.exports = factory(); + } else { + window.Vrules = factory(); + } +})(function() { + + return { + required: { + msg: '必填', + exp: /\S+/ + }, + mobile: { + msg: '格式错误', + exp: /^\d{11}$/ + }, + idcard: { + msg: '格式错误', + exp: /^(?:\d{14}|\d{17})[\dx]$/i + }, + email: { + msg: '格式错误', + exp: /^\w[\._\-\w]*@[\w_-]+(?:\.[\w_-]+)+$/i + }, + number: { + msg: '必须为数字', + exp: /^\d*$/ + }, + float: { + msg: '必须为数值', + exp: /^(?:\d+(?:\.\d+)?)$/ + }, + int: { + msg: '必须为整数', + exp: /^(?:\d+(?:\.\d+)?)$/ + }, + range: { + msg: '必须在范围内', + exp: function(value, range) { + if (!value) return true; + + if (range[0] && value < range[0]) { + return false; + } + + if (range[1] && value > range[1]) { + return false; + } + + return true; + } + }, + length: { + msg: '长度不正确', + exp: function(value, range) { + if (value) { + return (new RegExp('^[\\s\\S]{' + range + '}$')).test(value); + } + return true; + } + } + } +}); diff --git a/vpager/bower.json b/vpager/bower.json new file mode 100644 index 0000000..fe2ebd2 --- /dev/null +++ b/vpager/bower.json @@ -0,0 +1,8 @@ +{ + "name": "vpager", + "desc": "vpui-pager", + "main": "index.js", + "version": "1.0.0", + "dependencies": { + } +} \ No newline at end of file diff --git a/vpager/examples/index.html b/vpager/examples/index.html new file mode 100644 index 0000000..85d7d3a --- /dev/null +++ b/vpager/examples/index.html @@ -0,0 +1,79 @@ + + + + + + vpager example + + + + + + +
+ + +
+ + + + diff --git a/vpager/index.css b/vpager/index.css new file mode 100644 index 0000000..686c438 --- /dev/null +++ b/vpager/index.css @@ -0,0 +1,137 @@ +.lg-pager{ + margin:5px auto; + font: 12px Tahoma,Helvetica Neue,Hiragino Sans GB,Microsoft Yahei,sans-serif; + overflow:hidden; + height: 50px; + text-align: right; +} +.lg-pager-left{ + text-align: left; +} +.lg-pager-center{ + text-align: center; +} + +.lg-pager ul{ + display: inline-block; +} + +.lg-pager li{ + float: left; + list-style: none; +} + +.lg-pager-item{ + border: 1px solid #dfdfdf; + border-radius: 2px; + background-color: #fff; + margin: 2px 3px; + height: 28px; + line-height: 28px; + font-size: 12px; +} + +.lg-pager-item:hover{ + border-color: #5986E1; +} +.lg-pager-item.disable a{ + color: #a3a3a3; +} +.lg-pager-item.disable a:after,.lg-pager-item.disable a:before{ + color: #a3a3a3; + border-left-color:#a3a3a3; +} +.lg-pager-item.disable:hover{ + border-color: #dfdfdf; +} + +.lg-pager-item a{ + display: inline-block; + text-align: center; + color: #666; + height: 28px; + min-width: 28px; + line-height: 28px; + padding:0 5px; + text-decoration: none; +} + + +.lg-pager-current{ + background: #5986E1; + border-color: #5986E1; +} + +.lg-pager-current a{ + color: #fff; +} + +.lg-pager-item-large a{ + padding: 0px 4px; +} + +.lg-pager-previous a:before{ + content: ''; + display: inline-block; + border-top:5px solid transparent; + border-bottom:5px solid transparent; + border-left:7px solid #666; + border-right:none; + -webkit-transform: rotateZ(180deg); + -moz-transform: rotateZ(180deg); + -o-transform: rotateZ(180deg); + -ms-transform: rotateZ(180deg); + transform: rotateZ(180deg); +} + +.lg-pager-next a:after{ + content: ''; + display: inline-block; + border-top:5px solid transparent; + border-bottom:5px solid transparent; + border-left:7px solid #666; + border-right:none; +} + +.lg-pager-current a, .lg-pager-point a{ + cursor: default; +} + +.lg-pager-shortcut{ + height: 24px; + color: #a3a3a3; + padding: 5px; +} + +.lg-pager-shortcut input,.lg-pager-shortcut select{ + height: 24px; + width: 38px; + padding: 0px; + outline: none; + text-align: center; + margin: 0px; + border-radius: 3px; + border: 1px solid #a3a3a3; + box-size:border-box; +} +.lg-pager-shortcut select{ + padding:0 3px; + width:auto; + margin:0 5px; +} + +.lg-pager-shortcut-confirm{ + border-radius: 3px; + background: #5986E1; + text-decoration: none; + text-align: center; + display: inline-block; + color: #fff; + width: 50px; + height: 24px; + line-height: 24px; + margin:0 5px; +} +.lg-pager-dot{ + border:none; +} \ No newline at end of file diff --git a/vpager/index.js b/vpager/index.js new file mode 100644 index 0000000..8f150fd --- /dev/null +++ b/vpager/index.js @@ -0,0 +1,127 @@ +; +(function(factory) { + if (typeof module === 'object' && typeof module.exports == 'object') { + module.exports = factory( + require('vue') + ); + } else { + factory(window.Vue); + } +})(function(Vue) { + var vPager = {}, + template; + if (document.getElementById('vpager-template')) { + template = document.getElementById('vpager-template').innerHTML; + } else { + template = __inline('index.tpl'); + } + vPager.install = function(Vue) { + Vue.component('vpager', { + props: { + 'model': { + type: Object, + require: true + }, + 'callback': { + type: Function + }, + 'position': { + type: String + }, + 'max': { + type: Number, + default: 10, + validator: function(value) { + return value > 5; + } + }, + 'option':{ + type:Array + } + }, + template: template, + methods: { + to: function(page,disable) { + if (disable) + return; + if (isNaN(Number(page))) { + alert('别任性~'); + this.shortcut = ''; + return; + } + if (Number(page) > this.pager.page) + page = this.pager.page; + if (Number(page) < 1) + page = 1; + this.calc(this.pager, page); + this.callback && this.callback(page,this.pager.size); + this.shortcut = ''; + }, + calc: function(pager, cur) { + cur = Math.floor(cur / 1); + start = 2, end = pager.page - 1; + if (pager.page > this.m) { + if (cur - this.pre > 1) { + start = cur - this.pre; + if (cur + this.next - pager.page < 0) { + end = cur + this.next + } else { + start = end - (this.m-3); + } + } else { + end = start + this.m-3; + } + } else if (start > end) { + end = 1; + } + pager.start = start; + pager.end = end; + pager.cur = cur; + }, + select: function(size) { + this.update(); + this.to(1); + }, + update:function(size){ + if(size){ + this.pager.size=size; + } + this.pager.total=this.model.total; + this.pager.cur=this.model.cur; + this.pager.page=Math.ceil(this.pager.total / this.pager.size); + this.calc(this.pager, this.pager.cur); + } + }, + data: function() { + var option = this.option ? this.option : [10, 20, 50]; + var size = option.indexOf(this.model.size) >= 0 ? this.model.size : option[0]; + console.log(size); + return { + pager: { + page: Math.ceil(this.model.total / size), + size: size, + total: this.model.total, + cur: this.model.cur + }, + shortcut: '', + m: this.max, + pre:Math.floor((this.max-3)/2), + next:Math.ceil((this.max-3)/2), + opt: option + } + }, + created:function(){ + this.calc(this.pager, this.pager.cur); + }, + watch:{ + model: { + handler(){ + this.update(this.model.size); + }, + deep:true + } + } + }) + } + Vue.use(vPager); +}); diff --git a/vpager/index.tpl b/vpager/index.tpl new file mode 100644 index 0000000..3cb47d3 --- /dev/null +++ b/vpager/index.tpl @@ -0,0 +1,37 @@ +
+ +
\ No newline at end of file diff --git a/vqrcode.js b/vqrcode.js new file mode 100644 index 0000000..5a579c3 --- /dev/null +++ b/vqrcode.js @@ -0,0 +1,64 @@ +; +(function(factory) { + if (typeof module === 'object' && typeof module.exports == 'object') { + module.exports = factory( + require('vue'),require('vue-components/vdialog'),require('qrcode') + ); + } else { + window.Vqrcode=factory(window.Vue,window.Vdialog,window.QRCode); + } +})(function(Vue,Vdialog,QRCode) { + var vQrcode={}; + vQrcode.install = function(Vue) { + Vue.component('vqrcode',{ + template: '
', + methods: { + open: function(url,name) { + var _this=this; + this.createQRcode(url); + this.$refs.dialog.open().then(function(index){ + _this.download(name); + },function(){}); + }, + createQRcode: function(url) { + if (this.oQrcode) { + this.oQrcode.clear(); + this.oQrcode.makeCode(url); + } else { + this.oQrcode = new QRCode(document.getElementById("qrImg"), { + text: url, + width: 120, + height: 120, + colorDark: "#000000", + colorLight: "#ffffff", + render: 'canvas' + }); + } + }, + download:function(qrname){ + var myCanvas = document.getElementById("qrImg").getElementsByTagName('canvas')[0]; + var image = myCanvas.toDataURL("image/png"); + var save_link = document.createElementNS('http://www.w3.org/1999/xhtml', 'a'); + save_link.href = image; + save_link.download = qrname + '.png'; + var event = document.createEvent('MouseEvents'); + event.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); + save_link.dispatchEvent(event); + } + }, + data:function (argument) { + return { + dialogoption:{ + title:'二维码', + btns:[{ + name:'下载' + }] + }, + oQrcode:null + } + } + }) + } + Vue.use(vQrcode); + return vQrcode; +}); diff --git a/vselect.js b/vselect.js new file mode 100644 index 0000000..f50133e --- /dev/null +++ b/vselect.js @@ -0,0 +1,50 @@ +; +(function(factory) { + if (typeof module === 'object' && typeof module.exports == 'object') { + module.exports = factory( + require('vue') + ); + } else { + factory(window.Vue); + } +})(function(Vue) { + var vselect={}; + vselect.install = function(Vue) { + Vue.component('vselect',{ + delimiters: ['${', '}'], + props: ['data','model','keyset','hide','style'], + template: '', + methods: { + change: function(event) { + if(typeof this.keyset=='function'&&event.target['selectedIndex']>=0){ + this.keyset(this.selected,event.target['options'][event.target['selectedIndex']].label); + }else if(this.keyset&&event.target['selectedIndex']>=0){ + this.$parent.$emit(this.keyset, this.selected,event.target['options'][event.target['selectedIndex']].label); + } + this.$emit('input', this.selected); + } + }, + data: function() { + return { + selected: this.model!=undefined?this.model:this.data[0]?this.data[0].val:'' + }; + }, + watch: { + data: function(val, oldVal) { + if(this.data[0]){ + this.selected = this.model!=undefined?this.model:this.data[0].val; + this.$emit('input', this.selected); + } + }, + model:function(val,oldVal){ + this.selected=val; + var label=this.data.filter(function(item){ + return item.val==val + }); + this.$emit('input',val); + } + } + }) + } + Vue.use(vselect); +}); diff --git a/vue/vue.js b/vue/vue.js new file mode 100644 index 0000000..6270df2 --- /dev/null +++ b/vue/vue.js @@ -0,0 +1,9316 @@ +/*! + * Vue.js v2.2.6 + * (c) 2014-2017 Evan You + * Released under the MIT License. + */ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global.Vue = factory()); +}(this, (function () { 'use strict'; + +/* */ + +/** + * Convert a value to a string that is actually rendered. + */ +function _toString (val) { + return val == null + ? '' + : typeof val === 'object' + ? JSON.stringify(val, null, 2) + : String(val) +} + +/** + * Convert a input value to a number for persistence. + * If the conversion fails, return original string. + */ +function toNumber (val) { + var n = parseFloat(val); + return isNaN(n) ? val : n +} + +/** + * Make a map and return a function for checking if a key + * is in that map. + */ +function makeMap ( + str, + expectsLowerCase +) { + var map = Object.create(null); + var list = str.split(','); + for (var i = 0; i < list.length; i++) { + map[list[i]] = true; + } + return expectsLowerCase + ? function (val) { return map[val.toLowerCase()]; } + : function (val) { return map[val]; } +} + +/** + * Check if a tag is a built-in tag. + */ +var isBuiltInTag = makeMap('slot,component', true); + +/** + * Remove an item from an array + */ +function remove (arr, item) { + if (arr.length) { + var index = arr.indexOf(item); + if (index > -1) { + return arr.splice(index, 1) + } + } +} + +/** + * Check whether the object has the property. + */ +var hasOwnProperty = Object.prototype.hasOwnProperty; +function hasOwn (obj, key) { + return hasOwnProperty.call(obj, key) +} + +/** + * Check if value is primitive + */ +function isPrimitive (value) { + return typeof value === 'string' || typeof value === 'number' +} + +/** + * Create a cached version of a pure function. + */ +function cached (fn) { + var cache = Object.create(null); + return (function cachedFn (str) { + var hit = cache[str]; + return hit || (cache[str] = fn(str)) + }) +} + +/** + * Camelize a hyphen-delimited string. + */ +var camelizeRE = /-(\w)/g; +var camelize = cached(function (str) { + return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; }) +}); + +/** + * Capitalize a string. + */ +var capitalize = cached(function (str) { + return str.charAt(0).toUpperCase() + str.slice(1) +}); + +/** + * Hyphenate a camelCase string. + */ +var hyphenateRE = /([^-])([A-Z])/g; +var hyphenate = cached(function (str) { + return str + .replace(hyphenateRE, '$1-$2') + .replace(hyphenateRE, '$1-$2') + .toLowerCase() +}); + +/** + * Simple bind, faster than native + */ +function bind (fn, ctx) { + function boundFn (a) { + var l = arguments.length; + return l + ? l > 1 + ? fn.apply(ctx, arguments) + : fn.call(ctx, a) + : fn.call(ctx) + } + // record original fn length + boundFn._length = fn.length; + return boundFn +} + +/** + * Convert an Array-like object to a real Array. + */ +function toArray (list, start) { + start = start || 0; + var i = list.length - start; + var ret = new Array(i); + while (i--) { + ret[i] = list[i + start]; + } + return ret +} + +/** + * Mix properties into target object. + */ +function extend (to, _from) { + for (var key in _from) { + to[key] = _from[key]; + } + return to +} + +/** + * Quick object check - this is primarily used to tell + * Objects from primitive values when we know the value + * is a JSON-compliant type. + */ +function isObject (obj) { + return obj !== null && typeof obj === 'object' +} + +/** + * Strict object type check. Only returns true + * for plain JavaScript objects. + */ +var toString = Object.prototype.toString; +var OBJECT_STRING = '[object Object]'; +function isPlainObject (obj) { + return toString.call(obj) === OBJECT_STRING +} + +/** + * Merge an Array of Objects into a single Object. + */ +function toObject (arr) { + var res = {}; + for (var i = 0; i < arr.length; i++) { + if (arr[i]) { + extend(res, arr[i]); + } + } + return res +} + +/** + * Perform no operation. + */ +function noop () {} + +/** + * Always return false. + */ +var no = function () { return false; }; + +/** + * Return same value + */ +var identity = function (_) { return _; }; + +/** + * Generate a static keys string from compiler modules. + */ +function genStaticKeys (modules) { + return modules.reduce(function (keys, m) { + return keys.concat(m.staticKeys || []) + }, []).join(',') +} + +/** + * Check if two values are loosely equal - that is, + * if they are plain objects, do they have the same shape? + */ +function looseEqual (a, b) { + var isObjectA = isObject(a); + var isObjectB = isObject(b); + if (isObjectA && isObjectB) { + try { + return JSON.stringify(a) === JSON.stringify(b) + } catch (e) { + // possible circular reference + return a === b + } + } else if (!isObjectA && !isObjectB) { + return String(a) === String(b) + } else { + return false + } +} + +function looseIndexOf (arr, val) { + for (var i = 0; i < arr.length; i++) { + if (looseEqual(arr[i], val)) { return i } + } + return -1 +} + +/** + * Ensure a function is called only once. + */ +function once (fn) { + var called = false; + return function () { + if (!called) { + called = true; + fn(); + } + } +} + +/* */ + +var config = { + /** + * Option merge strategies (used in core/util/options) + */ + optionMergeStrategies: Object.create(null), + + /** + * Whether to suppress warnings. + */ + silent: false, + + /** + * Show production mode tip message on boot? + */ + productionTip: "development" !== 'production', + + /** + * Whether to enable devtools + */ + devtools: "development" !== 'production', + + /** + * Whether to record perf + */ + performance: false, + + /** + * Error handler for watcher errors + */ + errorHandler: null, + + /** + * Ignore certain custom elements + */ + ignoredElements: [], + + /** + * Custom user key aliases for v-on + */ + keyCodes: Object.create(null), + + /** + * Check if a tag is reserved so that it cannot be registered as a + * component. This is platform-dependent and may be overwritten. + */ + isReservedTag: no, + + /** + * Check if a tag is an unknown element. + * Platform-dependent. + */ + isUnknownElement: no, + + /** + * Get the namespace of an element + */ + getTagNamespace: noop, + + /** + * Parse the real tag name for the specific platform. + */ + parsePlatformTagName: identity, + + /** + * Check if an attribute must be bound using property, e.g. value + * Platform-dependent. + */ + mustUseProp: no, + + /** + * List of asset types that a component can own. + */ + _assetTypes: [ + 'component', + 'directive', + 'filter' + ], + + /** + * List of lifecycle hooks. + */ + _lifecycleHooks: [ + 'beforeCreate', + 'created', + 'beforeMount', + 'mounted', + 'beforeUpdate', + 'updated', + 'beforeDestroy', + 'destroyed', + 'activated', + 'deactivated' + ], + + /** + * Max circular updates allowed in a scheduler flush cycle. + */ + _maxUpdateCount: 100 +}; + +/* */ + +var emptyObject = Object.freeze({}); + +/** + * Check if a string starts with $ or _ + */ +function isReserved (str) { + var c = (str + '').charCodeAt(0); + return c === 0x24 || c === 0x5F +} + +/** + * Define a property. + */ +function def (obj, key, val, enumerable) { + Object.defineProperty(obj, key, { + value: val, + enumerable: !!enumerable, + writable: true, + configurable: true + }); +} + +/** + * Parse simple path. + */ +var bailRE = /[^\w.$]/; +function parsePath (path) { + if (bailRE.test(path)) { + return + } + var segments = path.split('.'); + return function (obj) { + for (var i = 0; i < segments.length; i++) { + if (!obj) { return } + obj = obj[segments[i]]; + } + return obj + } +} + +/* */ +/* globals MutationObserver */ + +// can we use __proto__? +var hasProto = '__proto__' in {}; + +// Browser environment sniffing +var inBrowser = typeof window !== 'undefined'; +var UA = inBrowser && window.navigator.userAgent.toLowerCase(); +var isIE = UA && /msie|trident/.test(UA); +var isIE9 = UA && UA.indexOf('msie 9.0') > 0; +var isEdge = UA && UA.indexOf('edge/') > 0; +var isAndroid = UA && UA.indexOf('android') > 0; +var isIOS = UA && /iphone|ipad|ipod|ios/.test(UA); +var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge; + +// this needs to be lazy-evaled because vue may be required before +// vue-server-renderer can set VUE_ENV +var _isServer; +var isServerRendering = function () { + if (_isServer === undefined) { + /* istanbul ignore if */ + if (!inBrowser && typeof global !== 'undefined') { + // detect presence of vue-server-renderer and avoid + // Webpack shimming the process + _isServer = global['process'].env.VUE_ENV === 'server'; + } else { + _isServer = false; + } + } + return _isServer +}; + +// detect devtools +var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__; + +/* istanbul ignore next */ +function isNative (Ctor) { + return /native code/.test(Ctor.toString()) +} + +var hasSymbol = + typeof Symbol !== 'undefined' && isNative(Symbol) && + typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys); + +/** + * Defer a task to execute it asynchronously. + */ +var nextTick = (function () { + var callbacks = []; + var pending = false; + var timerFunc; + + function nextTickHandler () { + pending = false; + var copies = callbacks.slice(0); + callbacks.length = 0; + for (var i = 0; i < copies.length; i++) { + copies[i](); + } + } + + // the nextTick behavior leverages the microtask queue, which can be accessed + // via either native Promise.then or MutationObserver. + // MutationObserver has wider support, however it is seriously bugged in + // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It + // completely stops working after triggering a few times... so, if native + // Promise is available, we will use it: + /* istanbul ignore if */ + if (typeof Promise !== 'undefined' && isNative(Promise)) { + var p = Promise.resolve(); + var logError = function (err) { console.error(err); }; + timerFunc = function () { + p.then(nextTickHandler).catch(logError); + // in problematic UIWebViews, Promise.then doesn't completely break, but + // it can get stuck in a weird state where callbacks are pushed into the + // microtask queue but the queue isn't being flushed, until the browser + // needs to do some other work, e.g. handle a timer. Therefore we can + // "force" the microtask queue to be flushed by adding an empty timer. + if (isIOS) { setTimeout(noop); } + }; + } else if (typeof MutationObserver !== 'undefined' && ( + isNative(MutationObserver) || + // PhantomJS and iOS 7.x + MutationObserver.toString() === '[object MutationObserverConstructor]' + )) { + // use MutationObserver where native Promise is not available, + // e.g. PhantomJS IE11, iOS7, Android 4.4 + var counter = 1; + var observer = new MutationObserver(nextTickHandler); + var textNode = document.createTextNode(String(counter)); + observer.observe(textNode, { + characterData: true + }); + timerFunc = function () { + counter = (counter + 1) % 2; + textNode.data = String(counter); + }; + } else { + // fallback to setTimeout + /* istanbul ignore next */ + timerFunc = function () { + setTimeout(nextTickHandler, 0); + }; + } + + return function queueNextTick (cb, ctx) { + var _resolve; + callbacks.push(function () { + if (cb) { cb.call(ctx); } + if (_resolve) { _resolve(ctx); } + }); + if (!pending) { + pending = true; + timerFunc(); + } + if (!cb && typeof Promise !== 'undefined') { + return new Promise(function (resolve) { + _resolve = resolve; + }) + } + } +})(); + +var _Set; +/* istanbul ignore if */ +if (typeof Set !== 'undefined' && isNative(Set)) { + // use native Set when available. + _Set = Set; +} else { + // a non-standard Set polyfill that only works with primitive keys. + _Set = (function () { + function Set () { + this.set = Object.create(null); + } + Set.prototype.has = function has (key) { + return this.set[key] === true + }; + Set.prototype.add = function add (key) { + this.set[key] = true; + }; + Set.prototype.clear = function clear () { + this.set = Object.create(null); + }; + + return Set; + }()); +} + +var warn = noop; +var tip = noop; +var formatComponentName; + +{ + var hasConsole = typeof console !== 'undefined'; + var classifyRE = /(?:^|[-_])(\w)/g; + var classify = function (str) { return str + .replace(classifyRE, function (c) { return c.toUpperCase(); }) + .replace(/[-_]/g, ''); }; + + warn = function (msg, vm) { + if (hasConsole && (!config.silent)) { + console.error("[Vue warn]: " + msg + " " + ( + vm ? formatLocation(formatComponentName(vm)) : '' + )); + } + }; + + tip = function (msg, vm) { + if (hasConsole && (!config.silent)) { + console.warn("[Vue tip]: " + msg + " " + ( + vm ? formatLocation(formatComponentName(vm)) : '' + )); + } + }; + + formatComponentName = function (vm, includeFile) { + if (vm.$root === vm) { + return '' + } + var name = typeof vm === 'string' + ? vm + : typeof vm === 'function' && vm.options + ? vm.options.name + : vm._isVue + ? vm.$options.name || vm.$options._componentTag + : vm.name; + + var file = vm._isVue && vm.$options.__file; + if (!name && file) { + var match = file.match(/([^/\\]+)\.vue$/); + name = match && match[1]; + } + + return ( + (name ? ("<" + (classify(name)) + ">") : "") + + (file && includeFile !== false ? (" at " + file) : '') + ) + }; + + var formatLocation = function (str) { + if (str === "") { + str += " - use the \"name\" option for better debugging messages."; + } + return ("\n(found in " + str + ")") + }; +} + +/* */ + + +var uid$1 = 0; + +/** + * A dep is an observable that can have multiple + * directives subscribing to it. + */ +var Dep = function Dep () { + this.id = uid$1++; + this.subs = []; +}; + +Dep.prototype.addSub = function addSub (sub) { + this.subs.push(sub); +}; + +Dep.prototype.removeSub = function removeSub (sub) { + remove(this.subs, sub); +}; + +Dep.prototype.depend = function depend () { + if (Dep.target) { + Dep.target.addDep(this); + } +}; + +Dep.prototype.notify = function notify () { + // stabilize the subscriber list first + var subs = this.subs.slice(); + for (var i = 0, l = subs.length; i < l; i++) { + subs[i].update(); + } +}; + +// the current target watcher being evaluated. +// this is globally unique because there could be only one +// watcher being evaluated at any time. +Dep.target = null; +var targetStack = []; + +function pushTarget (_target) { + if (Dep.target) { targetStack.push(Dep.target); } + Dep.target = _target; +} + +function popTarget () { + Dep.target = targetStack.pop(); +} + +/* + * not type checking this file because flow doesn't play well with + * dynamically accessing methods on Array prototype + */ + +var arrayProto = Array.prototype; +var arrayMethods = Object.create(arrayProto);[ + 'push', + 'pop', + 'shift', + 'unshift', + 'splice', + 'sort', + 'reverse' +] +.forEach(function (method) { + // cache original method + var original = arrayProto[method]; + def(arrayMethods, method, function mutator () { + var arguments$1 = arguments; + + // avoid leaking arguments: + // http://jsperf.com/closure-with-arguments + var i = arguments.length; + var args = new Array(i); + while (i--) { + args[i] = arguments$1[i]; + } + var result = original.apply(this, args); + var ob = this.__ob__; + var inserted; + switch (method) { + case 'push': + inserted = args; + break + case 'unshift': + inserted = args; + break + case 'splice': + inserted = args.slice(2); + break + } + if (inserted) { ob.observeArray(inserted); } + // notify change + ob.dep.notify(); + return result + }); +}); + +/* */ + +var arrayKeys = Object.getOwnPropertyNames(arrayMethods); + +/** + * By default, when a reactive property is set, the new value is + * also converted to become reactive. However when passing down props, + * we don't want to force conversion because the value may be a nested value + * under a frozen data structure. Converting it would defeat the optimization. + */ +var observerState = { + shouldConvert: true, + isSettingProps: false +}; + +/** + * Observer class that are attached to each observed + * object. Once attached, the observer converts target + * object's property keys into getter/setters that + * collect dependencies and dispatches updates. + */ +var Observer = function Observer (value) { + this.value = value; + this.dep = new Dep(); + this.vmCount = 0; + def(value, '__ob__', this); + if (Array.isArray(value)) { + var augment = hasProto + ? protoAugment + : copyAugment; + augment(value, arrayMethods, arrayKeys); + this.observeArray(value); + } else { + this.walk(value); + } +}; + +/** + * Walk through each property and convert them into + * getter/setters. This method should only be called when + * value type is Object. + */ +Observer.prototype.walk = function walk (obj) { + var keys = Object.keys(obj); + for (var i = 0; i < keys.length; i++) { + defineReactive$$1(obj, keys[i], obj[keys[i]]); + } +}; + +/** + * Observe a list of Array items. + */ +Observer.prototype.observeArray = function observeArray (items) { + for (var i = 0, l = items.length; i < l; i++) { + observe(items[i]); + } +}; + +// helpers + +/** + * Augment an target Object or Array by intercepting + * the prototype chain using __proto__ + */ +function protoAugment (target, src) { + /* eslint-disable no-proto */ + target.__proto__ = src; + /* eslint-enable no-proto */ +} + +/** + * Augment an target Object or Array by defining + * hidden properties. + */ +/* istanbul ignore next */ +function copyAugment (target, src, keys) { + for (var i = 0, l = keys.length; i < l; i++) { + var key = keys[i]; + def(target, key, src[key]); + } +} + +/** + * Attempt to create an observer instance for a value, + * returns the new observer if successfully observed, + * or the existing observer if the value already has one. + */ +function observe (value, asRootData) { + if (!isObject(value)) { + return + } + var ob; + if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) { + ob = value.__ob__; + } else if ( + observerState.shouldConvert && + !isServerRendering() && + (Array.isArray(value) || isPlainObject(value)) && + Object.isExtensible(value) && + !value._isVue + ) { + ob = new Observer(value); + } + if (asRootData && ob) { + ob.vmCount++; + } + return ob +} + +/** + * Define a reactive property on an Object. + */ +function defineReactive$$1 ( + obj, + key, + val, + customSetter +) { + var dep = new Dep(); + + var property = Object.getOwnPropertyDescriptor(obj, key); + if (property && property.configurable === false) { + return + } + + // cater for pre-defined getter/setters + var getter = property && property.get; + var setter = property && property.set; + + var childOb = observe(val); + Object.defineProperty(obj, key, { + enumerable: true, + configurable: true, + get: function reactiveGetter () { + var value = getter ? getter.call(obj) : val; + if (Dep.target) { + dep.depend(); + if (childOb) { + childOb.dep.depend(); + } + if (Array.isArray(value)) { + dependArray(value); + } + } + return value + }, + set: function reactiveSetter (newVal) { + var value = getter ? getter.call(obj) : val; + /* eslint-disable no-self-compare */ + if (newVal === value || (newVal !== newVal && value !== value)) { + return + } + /* eslint-enable no-self-compare */ + if ("development" !== 'production' && customSetter) { + customSetter(); + } + if (setter) { + setter.call(obj, newVal); + } else { + val = newVal; + } + childOb = observe(newVal); + dep.notify(); + } + }); +} + +/** + * Set a property on an object. Adds the new property and + * triggers change notification if the property doesn't + * already exist. + */ +function set (target, key, val) { + if (Array.isArray(target) && typeof key === 'number') { + target.length = Math.max(target.length, key); + target.splice(key, 1, val); + return val + } + if (hasOwn(target, key)) { + target[key] = val; + return val + } + var ob = (target ).__ob__; + if (target._isVue || (ob && ob.vmCount)) { + "development" !== 'production' && warn( + 'Avoid adding reactive properties to a Vue instance or its root $data ' + + 'at runtime - declare it upfront in the data option.' + ); + return val + } + if (!ob) { + target[key] = val; + return val + } + defineReactive$$1(ob.value, key, val); + ob.dep.notify(); + return val +} + +/** + * Delete a property and trigger change if necessary. + */ +function del (target, key) { + if (Array.isArray(target) && typeof key === 'number') { + target.splice(key, 1); + return + } + var ob = (target ).__ob__; + if (target._isVue || (ob && ob.vmCount)) { + "development" !== 'production' && warn( + 'Avoid deleting properties on a Vue instance or its root $data ' + + '- just set it to null.' + ); + return + } + if (!hasOwn(target, key)) { + return + } + delete target[key]; + if (!ob) { + return + } + ob.dep.notify(); +} + +/** + * Collect dependencies on array elements when the array is touched, since + * we cannot intercept array element access like property getters. + */ +function dependArray (value) { + for (var e = (void 0), i = 0, l = value.length; i < l; i++) { + e = value[i]; + e && e.__ob__ && e.__ob__.dep.depend(); + if (Array.isArray(e)) { + dependArray(e); + } + } +} + +/* */ + +/** + * Option overwriting strategies are functions that handle + * how to merge a parent option value and a child option + * value into the final value. + */ +var strats = config.optionMergeStrategies; + +/** + * Options with restrictions + */ +{ + strats.el = strats.propsData = function (parent, child, vm, key) { + if (!vm) { + warn( + "option \"" + key + "\" can only be used during instance " + + 'creation with the `new` keyword.' + ); + } + return defaultStrat(parent, child) + }; +} + +/** + * Helper that recursively merges two data objects together. + */ +function mergeData (to, from) { + if (!from) { return to } + var key, toVal, fromVal; + var keys = Object.keys(from); + for (var i = 0; i < keys.length; i++) { + key = keys[i]; + toVal = to[key]; + fromVal = from[key]; + if (!hasOwn(to, key)) { + set(to, key, fromVal); + } else if (isPlainObject(toVal) && isPlainObject(fromVal)) { + mergeData(toVal, fromVal); + } + } + return to +} + +/** + * Data + */ +strats.data = function ( + parentVal, + childVal, + vm +) { + if (!vm) { + // in a Vue.extend merge, both should be functions + if (!childVal) { + return parentVal + } + if (typeof childVal !== 'function') { + "development" !== 'production' && warn( + 'The "data" option should be a function ' + + 'that returns a per-instance value in component ' + + 'definitions.', + vm + ); + return parentVal + } + if (!parentVal) { + return childVal + } + // when parentVal & childVal are both present, + // we need to return a function that returns the + // merged result of both functions... no need to + // check if parentVal is a function here because + // it has to be a function to pass previous merges. + return function mergedDataFn () { + return mergeData( + childVal.call(this), + parentVal.call(this) + ) + } + } else if (parentVal || childVal) { + return function mergedInstanceDataFn () { + // instance merge + var instanceData = typeof childVal === 'function' + ? childVal.call(vm) + : childVal; + var defaultData = typeof parentVal === 'function' + ? parentVal.call(vm) + : undefined; + if (instanceData) { + return mergeData(instanceData, defaultData) + } else { + return defaultData + } + } + } +}; + +/** + * Hooks and props are merged as arrays. + */ +function mergeHook ( + parentVal, + childVal +) { + return childVal + ? parentVal + ? parentVal.concat(childVal) + : Array.isArray(childVal) + ? childVal + : [childVal] + : parentVal +} + +config._lifecycleHooks.forEach(function (hook) { + strats[hook] = mergeHook; +}); + +/** + * Assets + * + * When a vm is present (instance creation), we need to do + * a three-way merge between constructor options, instance + * options and parent options. + */ +function mergeAssets (parentVal, childVal) { + var res = Object.create(parentVal || null); + return childVal + ? extend(res, childVal) + : res +} + +config._assetTypes.forEach(function (type) { + strats[type + 's'] = mergeAssets; +}); + +/** + * Watchers. + * + * Watchers hashes should not overwrite one + * another, so we merge them as arrays. + */ +strats.watch = function (parentVal, childVal) { + /* istanbul ignore if */ + if (!childVal) { return Object.create(parentVal || null) } + if (!parentVal) { return childVal } + var ret = {}; + extend(ret, parentVal); + for (var key in childVal) { + var parent = ret[key]; + var child = childVal[key]; + if (parent && !Array.isArray(parent)) { + parent = [parent]; + } + ret[key] = parent + ? parent.concat(child) + : [child]; + } + return ret +}; + +/** + * Other object hashes. + */ +strats.props = +strats.methods = +strats.computed = function (parentVal, childVal) { + if (!childVal) { return Object.create(parentVal || null) } + if (!parentVal) { return childVal } + var ret = Object.create(null); + extend(ret, parentVal); + extend(ret, childVal); + return ret +}; + +/** + * Default strategy. + */ +var defaultStrat = function (parentVal, childVal) { + return childVal === undefined + ? parentVal + : childVal +}; + +/** + * Validate component names + */ +function checkComponents (options) { + for (var key in options.components) { + var lower = key.toLowerCase(); + if (isBuiltInTag(lower) || config.isReservedTag(lower)) { + warn( + 'Do not use built-in or reserved HTML elements as component ' + + 'id: ' + key + ); + } + } +} + +/** + * Ensure all props option syntax are normalized into the + * Object-based format. + */ +function normalizeProps (options) { + var props = options.props; + if (!props) { return } + var res = {}; + var i, val, name; + if (Array.isArray(props)) { + i = props.length; + while (i--) { + val = props[i]; + if (typeof val === 'string') { + name = camelize(val); + res[name] = { type: null }; + } else { + warn('props must be strings when using array syntax.'); + } + } + } else if (isPlainObject(props)) { + for (var key in props) { + val = props[key]; + name = camelize(key); + res[name] = isPlainObject(val) + ? val + : { type: val }; + } + } + options.props = res; +} + +/** + * Normalize raw function directives into object format. + */ +function normalizeDirectives (options) { + var dirs = options.directives; + if (dirs) { + for (var key in dirs) { + var def = dirs[key]; + if (typeof def === 'function') { + dirs[key] = { bind: def, update: def }; + } + } + } +} + +/** + * Merge two option objects into a new one. + * Core utility used in both instantiation and inheritance. + */ +function mergeOptions ( + parent, + child, + vm +) { + { + checkComponents(child); + } + normalizeProps(child); + normalizeDirectives(child); + var extendsFrom = child.extends; + if (extendsFrom) { + parent = typeof extendsFrom === 'function' + ? mergeOptions(parent, extendsFrom.options, vm) + : mergeOptions(parent, extendsFrom, vm); + } + if (child.mixins) { + for (var i = 0, l = child.mixins.length; i < l; i++) { + var mixin = child.mixins[i]; + if (mixin.prototype instanceof Vue$3) { + mixin = mixin.options; + } + parent = mergeOptions(parent, mixin, vm); + } + } + var options = {}; + var key; + for (key in parent) { + mergeField(key); + } + for (key in child) { + if (!hasOwn(parent, key)) { + mergeField(key); + } + } + function mergeField (key) { + var strat = strats[key] || defaultStrat; + options[key] = strat(parent[key], child[key], vm, key); + } + return options +} + +/** + * Resolve an asset. + * This function is used because child instances need access + * to assets defined in its ancestor chain. + */ +function resolveAsset ( + options, + type, + id, + warnMissing +) { + /* istanbul ignore if */ + if (typeof id !== 'string') { + return + } + var assets = options[type]; + // check local registration variations first + if (hasOwn(assets, id)) { return assets[id] } + var camelizedId = camelize(id); + if (hasOwn(assets, camelizedId)) { return assets[camelizedId] } + var PascalCaseId = capitalize(camelizedId); + if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] } + // fallback to prototype chain + var res = assets[id] || assets[camelizedId] || assets[PascalCaseId]; + if ("development" !== 'production' && warnMissing && !res) { + warn( + 'Failed to resolve ' + type.slice(0, -1) + ': ' + id, + options + ); + } + return res +} + +/* */ + +function validateProp ( + key, + propOptions, + propsData, + vm +) { + var prop = propOptions[key]; + var absent = !hasOwn(propsData, key); + var value = propsData[key]; + // handle boolean props + if (isType(Boolean, prop.type)) { + if (absent && !hasOwn(prop, 'default')) { + value = false; + } else if (!isType(String, prop.type) && (value === '' || value === hyphenate(key))) { + value = true; + } + } + // check default value + if (value === undefined) { + value = getPropDefaultValue(vm, prop, key); + // since the default value is a fresh copy, + // make sure to observe it. + var prevShouldConvert = observerState.shouldConvert; + observerState.shouldConvert = true; + observe(value); + observerState.shouldConvert = prevShouldConvert; + } + { + assertProp(prop, key, value, vm, absent); + } + return value +} + +/** + * Get the default value of a prop. + */ +function getPropDefaultValue (vm, prop, key) { + // no default, return undefined + if (!hasOwn(prop, 'default')) { + return undefined + } + var def = prop.default; + // warn against non-factory defaults for Object & Array + if ("development" !== 'production' && isObject(def)) { + warn( + 'Invalid default value for prop "' + key + '": ' + + 'Props with type Object/Array must use a factory function ' + + 'to return the default value.', + vm + ); + } + // the raw prop value was also undefined from previous render, + // return previous default value to avoid unnecessary watcher trigger + if (vm && vm.$options.propsData && + vm.$options.propsData[key] === undefined && + vm._props[key] !== undefined) { + return vm._props[key] + } + // call factory function for non-Function types + // a value is Function if its prototype is function even across different execution context + return typeof def === 'function' && getType(prop.type) !== 'Function' + ? def.call(vm) + : def +} + +/** + * Assert whether a prop is valid. + */ +function assertProp ( + prop, + name, + value, + vm, + absent +) { + if (prop.required && absent) { + warn( + 'Missing required prop: "' + name + '"', + vm + ); + return + } + if (value == null && !prop.required) { + return + } + var type = prop.type; + var valid = !type || type === true; + var expectedTypes = []; + if (type) { + if (!Array.isArray(type)) { + type = [type]; + } + for (var i = 0; i < type.length && !valid; i++) { + var assertedType = assertType(value, type[i]); + expectedTypes.push(assertedType.expectedType || ''); + valid = assertedType.valid; + } + } + if (!valid) { + warn( + 'Invalid prop: type check failed for prop "' + name + '".' + + ' Expected ' + expectedTypes.map(capitalize).join(', ') + + ', got ' + Object.prototype.toString.call(value).slice(8, -1) + '.', + vm + ); + return + } + var validator = prop.validator; + if (validator) { + if (!validator(value)) { + warn( + 'Invalid prop: custom validator check failed for prop "' + name + '".', + vm + ); + } + } +} + +/** + * Assert the type of a value + */ +function assertType (value, type) { + var valid; + var expectedType = getType(type); + if (expectedType === 'String') { + valid = typeof value === (expectedType = 'string'); + } else if (expectedType === 'Number') { + valid = typeof value === (expectedType = 'number'); + } else if (expectedType === 'Boolean') { + valid = typeof value === (expectedType = 'boolean'); + } else if (expectedType === 'Function') { + valid = typeof value === (expectedType = 'function'); + } else if (expectedType === 'Object') { + valid = isPlainObject(value); + } else if (expectedType === 'Array') { + valid = Array.isArray(value); + } else { + valid = value instanceof type; + } + return { + valid: valid, + expectedType: expectedType + } +} + +/** + * Use function string name to check built-in types, + * because a simple equality check will fail when running + * across different vms / iframes. + */ +function getType (fn) { + var match = fn && fn.toString().match(/^\s*function (\w+)/); + return match && match[1] +} + +function isType (type, fn) { + if (!Array.isArray(fn)) { + return getType(fn) === getType(type) + } + for (var i = 0, len = fn.length; i < len; i++) { + if (getType(fn[i]) === getType(type)) { + return true + } + } + /* istanbul ignore next */ + return false +} + +function handleError (err, vm, info) { + if (config.errorHandler) { + config.errorHandler.call(null, err, vm, info); + } else { + { + warn(("Error in " + info + ":"), vm); + } + /* istanbul ignore else */ + if (inBrowser && typeof console !== 'undefined') { + console.error(err); + } else { + throw err + } + } +} + +/* not type checking this file because flow doesn't play well with Proxy */ + +var initProxy; + +{ + var allowedGlobals = makeMap( + 'Infinity,undefined,NaN,isFinite,isNaN,' + + 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' + + 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' + + 'require' // for Webpack/Browserify + ); + + var warnNonPresent = function (target, key) { + warn( + "Property or method \"" + key + "\" is not defined on the instance but " + + "referenced during render. Make sure to declare reactive data " + + "properties in the data option.", + target + ); + }; + + var hasProxy = + typeof Proxy !== 'undefined' && + Proxy.toString().match(/native code/); + + if (hasProxy) { + var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta'); + config.keyCodes = new Proxy(config.keyCodes, { + set: function set (target, key, value) { + if (isBuiltInModifier(key)) { + warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key)); + return false + } else { + target[key] = value; + return true + } + } + }); + } + + var hasHandler = { + has: function has (target, key) { + var has = key in target; + var isAllowed = allowedGlobals(key) || key.charAt(0) === '_'; + if (!has && !isAllowed) { + warnNonPresent(target, key); + } + return has || !isAllowed + } + }; + + var getHandler = { + get: function get (target, key) { + if (typeof key === 'string' && !(key in target)) { + warnNonPresent(target, key); + } + return target[key] + } + }; + + initProxy = function initProxy (vm) { + if (hasProxy) { + // determine which proxy handler to use + var options = vm.$options; + var handlers = options.render && options.render._withStripped + ? getHandler + : hasHandler; + vm._renderProxy = new Proxy(vm, handlers); + } else { + vm._renderProxy = vm; + } + }; +} + +var mark; +var measure; + +{ + var perf = inBrowser && window.performance; + /* istanbul ignore if */ + if ( + perf && + perf.mark && + perf.measure && + perf.clearMarks && + perf.clearMeasures + ) { + mark = function (tag) { return perf.mark(tag); }; + measure = function (name, startTag, endTag) { + perf.measure(name, startTag, endTag); + perf.clearMarks(startTag); + perf.clearMarks(endTag); + perf.clearMeasures(name); + }; + } +} + +/* */ + +var VNode = function VNode ( + tag, + data, + children, + text, + elm, + context, + componentOptions +) { + this.tag = tag; + this.data = data; + this.children = children; + this.text = text; + this.elm = elm; + this.ns = undefined; + this.context = context; + this.functionalContext = undefined; + this.key = data && data.key; + this.componentOptions = componentOptions; + this.componentInstance = undefined; + this.parent = undefined; + this.raw = false; + this.isStatic = false; + this.isRootInsert = true; + this.isComment = false; + this.isCloned = false; + this.isOnce = false; +}; + +var prototypeAccessors = { child: {} }; + +// DEPRECATED: alias for componentInstance for backwards compat. +/* istanbul ignore next */ +prototypeAccessors.child.get = function () { + return this.componentInstance +}; + +Object.defineProperties( VNode.prototype, prototypeAccessors ); + +var createEmptyVNode = function () { + var node = new VNode(); + node.text = ''; + node.isComment = true; + return node +}; + +function createTextVNode (val) { + return new VNode(undefined, undefined, undefined, String(val)) +} + +// optimized shallow clone +// used for static nodes and slot nodes because they may be reused across +// multiple renders, cloning them avoids errors when DOM manipulations rely +// on their elm reference. +function cloneVNode (vnode) { + var cloned = new VNode( + vnode.tag, + vnode.data, + vnode.children, + vnode.text, + vnode.elm, + vnode.context, + vnode.componentOptions + ); + cloned.ns = vnode.ns; + cloned.isStatic = vnode.isStatic; + cloned.key = vnode.key; + cloned.isCloned = true; + return cloned +} + +function cloneVNodes (vnodes) { + var len = vnodes.length; + var res = new Array(len); + for (var i = 0; i < len; i++) { + res[i] = cloneVNode(vnodes[i]); + } + return res +} + +/* */ + +var normalizeEvent = cached(function (name) { + var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first + name = once$$1 ? name.slice(1) : name; + var capture = name.charAt(0) === '!'; + name = capture ? name.slice(1) : name; + return { + name: name, + once: once$$1, + capture: capture + } +}); + +function createFnInvoker (fns) { + function invoker () { + var arguments$1 = arguments; + + var fns = invoker.fns; + if (Array.isArray(fns)) { + for (var i = 0; i < fns.length; i++) { + fns[i].apply(null, arguments$1); + } + } else { + // return handler return value for single handlers + return fns.apply(null, arguments) + } + } + invoker.fns = fns; + return invoker +} + +function updateListeners ( + on, + oldOn, + add, + remove$$1, + vm +) { + var name, cur, old, event; + for (name in on) { + cur = on[name]; + old = oldOn[name]; + event = normalizeEvent(name); + if (!cur) { + "development" !== 'production' && warn( + "Invalid handler for event \"" + (event.name) + "\": got " + String(cur), + vm + ); + } else if (!old) { + if (!cur.fns) { + cur = on[name] = createFnInvoker(cur); + } + add(event.name, cur, event.once, event.capture); + } else if (cur !== old) { + old.fns = cur; + on[name] = old; + } + } + for (name in oldOn) { + if (!on[name]) { + event = normalizeEvent(name); + remove$$1(event.name, oldOn[name], event.capture); + } + } +} + +/* */ + +function mergeVNodeHook (def, hookKey, hook) { + var invoker; + var oldHook = def[hookKey]; + + function wrappedHook () { + hook.apply(this, arguments); + // important: remove merged hook to ensure it's called only once + // and prevent memory leak + remove(invoker.fns, wrappedHook); + } + + if (!oldHook) { + // no existing hook + invoker = createFnInvoker([wrappedHook]); + } else { + /* istanbul ignore if */ + if (oldHook.fns && oldHook.merged) { + // already a merged invoker + invoker = oldHook; + invoker.fns.push(wrappedHook); + } else { + // existing plain hook + invoker = createFnInvoker([oldHook, wrappedHook]); + } + } + + invoker.merged = true; + def[hookKey] = invoker; +} + +/* */ + +// The template compiler attempts to minimize the need for normalization by +// statically analyzing the template at compile time. +// +// For plain HTML markup, normalization can be completely skipped because the +// generated render function is guaranteed to return Array. There are +// two cases where extra normalization is needed: + +// 1. When the children contains components - because a functional component +// may return an Array instead of a single root. In this case, just a simple +// normalization is needed - if any child is an Array, we flatten the whole +// thing with Array.prototype.concat. It is guaranteed to be only 1-level deep +// because functional components already normalize their own children. +function simpleNormalizeChildren (children) { + for (var i = 0; i < children.length; i++) { + if (Array.isArray(children[i])) { + return Array.prototype.concat.apply([], children) + } + } + return children +} + +// 2. When the children contains constructs that always generated nested Arrays, +// e.g.