status-selector
Version:
a component for vue webapp
2 lines • 11.2 kB
JavaScript
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("selector",[],e):"object"==typeof exports?exports.selector=e():t.selector=e()}("undefined"!=typeof self?self:this,function(){return function(t){function e(s){if(n[s])return n[s].exports;var r=n[s]={i:s,l:!1,exports:{}};return t[s].call(r.exports,r,r.exports,e),r.l=!0,r.exports}var n={};return e.m=t,e.c=n,e.d=function(t,n,s){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:s})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="/dist/",e(e.s=4)}([function(t,e){function n(t,e){var n=t[1]||"",r=t[3];if(!r)return n;if(e&&"function"==typeof btoa){var o=s(r);return[n].concat(r.sources.map(function(t){return"/*# sourceURL="+r.sourceRoot+t+" */"})).concat([o]).join("\n")}return[n].join("\n")}function s(t){return"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(t))))+" */"}t.exports=function(t){var e=[];return e.toString=function(){return this.map(function(e){var s=n(e,t);return e[2]?"@media "+e[2]+"{"+s+"}":s}).join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var s={},r=0;r<this.length;r++){var o=this[r][0];"number"==typeof o&&(s[o]=!0)}for(r=0;r<t.length;r++){var i=t[r];"number"==typeof i[0]&&s[i[0]]||(n&&!i[2]?i[2]=n:n&&(i[2]="("+i[2]+") and ("+n+")"),e.push(i))}},e}},function(t,e,n){function s(t){for(var e=0;e<t.length;e++){var n=t[e],s=u[n.id];if(s){s.refs++;for(var r=0;r<s.parts.length;r++)s.parts[r](n.parts[r]);for(;r<n.parts.length;r++)s.parts.push(o(n.parts[r]));s.parts.length>n.parts.length&&(s.parts.length=n.parts.length)}else{for(var i=[],r=0;r<n.parts.length;r++)i.push(o(n.parts[r]));u[n.id]={id:n.id,refs:1,parts:i}}}}function r(){var t=document.createElement("style");return t.type="text/css",f.appendChild(t),t}function o(t){var e,n,s=document.querySelector("style["+m+'~="'+t.id+'"]');if(s){if(h)return v;s.parentNode.removeChild(s)}if(y){var o=p++;s=d||(d=r()),e=i.bind(null,s,o,!1),n=i.bind(null,s,o,!0)}else s=r(),e=a.bind(null,s),n=function(){s.parentNode.removeChild(s)};return e(t),function(s){if(s){if(s.css===t.css&&s.media===t.media&&s.sourceMap===t.sourceMap)return;e(t=s)}else n()}}function i(t,e,n,s){var r=n?"":s.css;if(t.styleSheet)t.styleSheet.cssText=b(e,r);else{var o=document.createTextNode(r),i=t.childNodes;i[e]&&t.removeChild(i[e]),i.length?t.insertBefore(o,i[e]):t.appendChild(o)}}function a(t,e){var n=e.css,s=e.media,r=e.sourceMap;if(s&&t.setAttribute("media",s),g.ssrId&&t.setAttribute(m,e.id),r&&(n+="\n/*# sourceURL="+r.sources[0]+" */",n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */"),t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}var l="undefined"!=typeof document;if("undefined"!=typeof DEBUG&&DEBUG&&!l)throw new Error("vue-style-loader cannot be used in a non-browser environment. Use { target: 'node' } in your Webpack config to indicate a server-rendering environment.");var c=n(8),u={},f=l&&(document.head||document.getElementsByTagName("head")[0]),d=null,p=0,h=!1,v=function(){},g=null,m="data-vue-ssr-id",y="undefined"!=typeof navigator&&/msie [6-9]\b/.test(navigator.userAgent.toLowerCase());t.exports=function(t,e,n,r){h=n,g=r||{};var o=c(t,e);return s(o),function(e){for(var n=[],r=0;r<o.length;r++){var i=o[r],a=u[i.id];a.refs--,n.push(a)}e?(o=c(t,e),s(o)):o=[];for(var r=0;r<n.length;r++){var a=n[r];if(0===a.refs){for(var l=0;l<a.parts.length;l++)a.parts[l]();delete u[a.id]}}}};var b=function(){var t=[];return function(e,n){return t[e]=n,t.filter(Boolean).join("\n")}}()},function(t,e,n){"use strict";function s(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var r=n(10);n.n(r);e.a={name:"Selector",props:{children:{type:Array,value:[]},parents:{type:Array,value:[],required:!0},union:{type:Boolean,value:!1}},data:function(){return{childrenStatus:"",parentStatus:"",status:[],showModal:!1}},methods:{showChildren:function(t){var e=t.target;console.log(e.dataset.status),void 0!==e.dataset.status&&(this.showModal=!this.showModal,this.parentStatus=e.dataset.status,this.$emit("tap-parent",this.parentStatus))},hideModal:function(t){void 0===t.target.dataset.status&&(this.showModal=!1)},getData:function(t){var e=this;if(!this.union)return void this.$emit("tap-children",this.childrenStatus);this.childrenStatus=t.status;var n=this.parents.findIndex(function(t){return t.status===e.parentStatus});if(console.log(n),this.$set(this.parents,n,{title:t.title,status:this.parentStatus}),0===this.status.length)this.status.push(s({},this.parentStatus,this.childrenStatus));else{var r=!0,o=!1,i=void 0;try{for(var a,l=this.status[Symbol.iterator]();!(r=(a=l.next()).done);r=!0){var c=a.value;for(var u in c)if(u===this.parentStatus)return c[u]=this.childrenStatus,void this.$emit("tap-children",this.status)}}catch(t){o=!0,i=t}finally{try{!r&&l.return&&l.return()}finally{if(o)throw i}}this.status.push(s({},this.parentStatus,this.childrenStatus))}console.log("status",this.status),this.$emit("tap-children",this.status)}},mounted:function(){}}},function(t,e,n){t.exports=n.p+"c821eb345a6f2cf2bddd4be49bf11602.eot"},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=n(5),r={install:function(t){t.component(s.a.name,s.a)}};e.default=r},function(t,e,n){"use strict";function s(t){n(6)}var r=n(2),o=n(16),i=n(9),a=s,l=i(r.a,o.a,!1,a,null,null);e.a=l.exports},function(t,e,n){var s=n(7);"string"==typeof s&&(s=[[t.i,s,""]]),s.locals&&(t.exports=s.locals);n(1)("1734c3ac",s,!0,{})},function(t,e,n){e=t.exports=n(0)(!1),e.push([t.i,"*{padding:0;margin:0}li{list-style:none}a{text-decoration:none}.selector .se-status{position:relative;z-index:120}.selector .se-status .se-nav{box-shadow:0 .2rem .3rem #e5e5e5;background:#fff}.selector .se-status .se-nav ul{display:flex;justify-content:start;align-items:center;flex-flow:row nowrap}.selector .se-status .se-nav ul li{padding:1rem;text-align:center;line-height:1.5rem}.selector .se-status .se-body{max-height:0;overflow:hidden;background:#fff;-webkit-transition:all .8s;-moz-transition:all .8s;-ms-transition:all .8s;-o-transition:all .8s;transition:all .8s}.selector .se-status .se-body.modal-active{max-height:100vh}.selector .se-status .se-body ul li{padding:.4rem 1rem;font-size:1rem;line-height:1.6rem;display:flex;justify-content:space-between;align-items:center;flex-flow:row nowrap}.selector .se-status .se-body ul li .iconfont{font-size:.6rem;color:#09f}.selector .modal{position:fixed;z-index:-1;background:#222;opacity:0;width:100%;left:0;top:0;bottom:0;-webkit-transition:all .4s;-moz-transition:all .4s;-ms-transition:all .4s;-o-transition:all .4s;transition:all .4s}.selector .modal.active{opacity:.5;z-index:99}",""])},function(t,e){t.exports=function(t,e){for(var n=[],s={},r=0;r<e.length;r++){var o=e[r],i=o[0],a=o[1],l=o[2],c=o[3],u={id:t+":"+r,css:a,media:l,sourceMap:c};s[i]?s[i].parts.push(u):n.push(s[i]={id:i,parts:[u]})}return n}},function(t,e){t.exports=function(t,e,n,s,r,o){var i,a=t=t||{},l=typeof t.default;"object"!==l&&"function"!==l||(i=t,a=t.default);var c="function"==typeof a?a.options:a;e&&(c.render=e.render,c.staticRenderFns=e.staticRenderFns,c._compiled=!0),n&&(c.functional=!0),r&&(c._scopeId=r);var u;if(o?(u=function(t){t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,t||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),s&&s.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(o)},c._ssrRegister=u):s&&(u=s),u){var f=c.functional,d=f?c.render:c.beforeCreate;f?(c._injectStyles=u,c.render=function(t,e){return u.call(e),d(t,e)}):c.beforeCreate=d?[].concat(d,u):[u]}return{esModule:i,exports:a,options:c}}},function(t,e,n){var s=n(11);"string"==typeof s&&(s=[[t.i,s,""]]),s.locals&&(t.exports=s.locals);n(1)("2e202d2e",s,!0,{})},function(t,e,n){var s=n(12);e=t.exports=n(0)(!1),e.push([t.i,"@font-face{font-family:iconfont;src:url("+s(n(3))+");src:url("+s(n(3))+'#iefix) format("embedded-opentype"),url("data:application/x-font-woff2;charset=utf-8;base64,d09GMgABAAAAAAMsAAsAAAAABzwAAALgAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHEIGVgCDHAqBfIFZATYCJAMQCwoABCAFhG0HQxtGBsguMYVrBxIIMwNFOXLlvPaFCXgb4uFzv89zk7y/WUYFqFABVRKoKsLxrScFpGwlGdepZ4WHc5kBgMyIQD35wqVNy2n64IYKWfi5GfUT8ifnfrNz7QXE5Xmp1/MweE5koTCBqv9Ab930b41qICNNYQ1gpDnP57mc3gQ6kGt8O8ttjKl7Pb8XBRhYGtieuJZwASXIDdPL15A06mu7CXSY0S/n2OZ+BBUr+KBA3KWKgIo7IUVh2Sq0JmaW+znXqFHT09w0nrnvxy9rUUzSZDz/9PUNGS1/FfnlHQQHLhkCqa8LgM0jYxVSiJuTqcvyBOPydLTPtwWpqsRVTf4UBMHDh5XiL4+QZKKFV3aBDZTOfEUJBF8VSHytQoYfYqkhsw05g9mp94UkBrrKBx6evR3g9xGRx/5PEBJP9sbTuS5Avr+2XV9/PJYVwsO9b+XbCGSiHUPXPWPCylNPPt2YHQgIVoPn/wYyg79NzdHoH93v3otH7Hdj4j1/bIOFXaGBPwXCEfx3Ixo/2ws10N7R2QES6ZrYxHinfHw8VoMcfK/yOw3pSx6EyMdzRwr8N14n39He+f+VAj7/n+dc5ff2dJVg6uJNNJ+IBV2t5clSgNyFcglvGTucSOgQXgo1x4DvKyzDmysJ1XBC0mYaWTVLFnYVjU4baKn20GHF1vxOg5g8Udqx7BQg9PlA0uM9sj5fZGEzaIzIoqUv8tDhYtSt2Gk+aOkaA4GDjMUUppJtEenlpb46BIpvCCzXOj4GzKNRPDI43M9ugQXsijFeXBnlnGDCbBNvgv3AMGzsMFsDiQ+qnDuzQ0Nk6kaDkm2iUkcYIOCADBOlYJTEZiGmMVc6+HwIUPgMArYgWinGAMZDW8dGDBreQG6ZrE2iXznEE6cYxXEERjA2E7YJugGDwYY50900QMINUg8kHLOGRD2y1TT4vMUsQCWrgV+hRIocJRr1gQqW4vpQSARL9WlBkgqGgBA=") format("woff2"),url('+s(n(13))+') format("woff"),url('+s(n(14))+') format("truetype"),url('+s(n(15))+'#iconfont) format("svg")}.iconfont{font-family:iconfont!important;font-size:16px;font-style:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.icon-zhengque:before{content:"\\E640"}.icon-fanhui:before{content:"\\E646"}.icon-xiala:before{content:"\\E69A"}',""])},function(t,e){t.exports=function(t){return"string"!=typeof t?t:(/^['"].*['"]$/.test(t)&&(t=t.slice(1,-1)),/["'() \t\n]/.test(t)?'"'+t.replace(/"/g,'\\"').replace(/\n/g,"\\n")+'"':t)}},function(t,e,n){t.exports=n.p+"7631c046b154b3781ed9fb090a8fafe3.woff"},function(t,e,n){t.exports=n.p+"105cdd982960c17c425fc656cb94d413.ttf"},function(t,e,n){t.exports=n.p+"20f82bc812549b7818b86ea646279bba.svg"},function(t,e,n){"use strict";var s=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"selector",on:{click:t.hideModal}},[n("div",{staticClass:"se-status"},[n("div",{staticClass:"se-nav"},[n("ul",{on:{click:t.showChildren}},t._l(t.parents,function(e){return n("li",{staticClass:"se-navitem",attrs:{"data-status":e.status}},[t._v(t._s(e.title)+" "),n("i",{staticClass:"iconfont icon-xiala"})])}),0)]),t._v(" "),n("div",{staticClass:"se-body",class:{"modal-active":t.showModal}},[n("ul",t._l(t.children,function(e){return n("li",{staticClass:"se-cell",on:{click:function(n){return t.getData(e)}}},[t._v("\n "+t._s(e.title)+"\n "),e.status===t.childrenStatus?n("i",{staticClass:"iconfont icon-zhengque iconsize"}):t._e()])}),0)])]),t._v(" "),n("div",{staticClass:"modal",class:{active:t.showModal}})])},r=[],o={render:s,staticRenderFns:r};e.a=o}])});
//# sourceMappingURL=selector.js.map