UNPKG

vue-train-timetable

Version:
8 lines (7 loc) 11.6 kB
/*! * vue-train-timetable v0.1.1 * (c) 2018-present Madao <chrishyman256@gmail.com> * Released under the MIT License. */ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.vueTrainTimetable={})}(this,function(t){"use strict";var e={name:"vue-train-timetable",props:{timetable:{type:Array,default:[],required:!0},position:{type:Number,default:0,required:!1},maximum_display:{type:Number,default:10,required:!1},minimum_display:{type:Number,default:5,required:!1},display_start:{type:Boolean,default:!0,required:!1},display_end:{type:Boolean,default:!0,required:!1},bar_color:{type:String,default:"rgb(235, 247, 149)",required:!1},text_color:{type:String,default:"white",required:!1},direction:{type:String,default:"vertical",required:!1}},data:function(){return{}},computed:{directionStyle:function(){this.$refs.timetable;return"vertical"==this.direction?{}:{width:50*this.displayList.length+"px"}},directionClass:function(){return"vertical"==this.direction?"vertical":"horizontal"},barBackground:function(){return{"background-color":this.bar_color}},displayList:function(){var t=parseInt(this.position,10),e=this.timetable.length,n=t,i=t+this.maximum_display;return i>=e&&(i=e),console.log(i-n,this.minimum_display),i-n<this.minimum_display&&(n=i-this.minimum_display)<0&&(n=0),this.timetable.slice(n,i)}},methods:{is_end:function(t){return this.display_end&&this.timetable.indexOf(t)==this.timetable.length-1},is_start:function(t){return this.display_start&&0==this.timetable.indexOf(t)},appendBarClass:function(t){var e=this.displayList,n=e.indexOf(t),i=[];return n==e.length-1?i.push("end"):0==n&&i.push("start"),this.is_start(t)?i.push("departure"):this.is_end(t)&&i.push("terminal"),i.join(" ")}}},n=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{class:"__vue-train-timetbale "+t.directionClass},[n("ul",{ref:"timetable",class:"timetable "+t.directionClass,style:t.directionStyle},t._l(t.displayList,function(e,i){return n("li",{class:"stop-item "+t.appendBarClass(e)},[n("i",{staticClass:"stop-bar",style:t.barBackground},[t.is_start(e)?n("i",{staticClass:"start-point",style:t.barBackground}):t.is_end(e)?n("i",{staticClass:"end-point",style:t.barBackground}):n("i",{staticClass:"stop-bar pointing",style:t.barBackground})]),t._v(" "),n("span",{staticClass:"stop-text",style:{color:t.text_color}},[t._v("\n "+t._s(e.name)+"\n "),e.icon?n("i",{class:e.icon}):t._e()])])}))])};n._withStripped=!0;var i=function(t,e,n,i,a,r,o,l){var A,s=("function"==typeof n?n.options:n)||{};if(s.__file="/Users/madao/dev/vue-train-timetable/src/vue-train-timetable.vue",s.render||(s.render=t.render,s.staticRenderFns=t.staticRenderFns,s._compiled=!0,a&&(s.functional=!0)),s._scopeId=i,e&&(A=function(t){e.call(this,o(t))}),void 0!==A)if(s.functional){var p=s.render;s.render=function(t,e){return A.call(e),p(t,e)}}else{var d=s.beforeCreate;s.beforeCreate=d?[].concat(d,A):[A]}return s}({render:n,staticRenderFns:[]},function(t){t&&t("data-v-c487f6fa_0",{source:"\n.__vue-train-timetbale[data-v-c487f6fa] {\n font-family: helvetica, sans-serif;\n position: relative;\n font-weight: 500;\n box-sizing: border-box;\n}\n.__vue-train-timetbale ul[data-v-c487f6fa] {\n padding: 0;\n margin: 0;\n}\n.__vue-train-timetbale ul li[data-v-c487f6fa] {\n list-style: none;\n}\n.__vue-train-timetbale .timetable[data-v-c487f6fa] {\n height: 100%;\n}\n.__vue-train-timetbale .start-point[data-v-c487f6fa],\n.__vue-train-timetbale .end-point[data-v-c487f6fa] {\n width: 12px;\n height: 12px;\n border-radius: 12px;\n position: absolute;\n left: 0;\n margin-left: -3px;\n}\n.__vue-train-timetbale .start-point[data-v-c487f6fa] {\n top: -6px;\n}\n.__vue-train-timetbale .end-point[data-v-c487f6fa] {\n bottom: -6px;\n}\n.__vue-train-timetbale .stop-item[data-v-c487f6fa] {\n padding: 5px 0 5px 20px;\n box-sizing: border-box;\n position: relative;\n height: 25px;\n}\n.__vue-train-timetbale .stop-bar[data-v-c487f6fa] {\n position: absolute;\n}\n.__vue-train-timetbale .bearing-wall[data-v-c487f6fa] {\n position: relative;\n display: block;\n visibility: hidden;\n width: 0.1px;\n text-indent: -1000px;\n word-break: break-all;\n line-height: 0.6;\n}\n.__vue-train-timetbale.horizontal[data-v-c487f6fa] {\n height: 100%;\n}\n.__vue-train-timetbale.horizontal .start-point[data-v-c487f6fa] {\n top: -4px;\n}\n.__vue-train-timetbale.horizontal .stop-bar[data-v-c487f6fa] {\n width: 100%;\n height: 4px;\n bottom: 0px;\n left: 0;\n}\n.__vue-train-timetbale.horizontal .stop-bar.pointing[data-v-c487f6fa] {\n bottom: 0;\n width: 4px;\n height: 10px;\n position: absolute;\n left: 0;\n}\n.__vue-train-timetbale.horizontal .stop-item[data-v-c487f6fa] {\n float: left;\n position: relative;\n width: 50px;\n height: 100%;\n}\n.__vue-train-timetbale.horizontal .stop-text[data-v-c487f6fa] {\n position: absolute;\n bottom: 0;\n left: 0;\n transform: rotateZ(-45deg) translateY(-5px) translateX(10px);\n transform-origin: left;\n text-align: left;\n width: 140px;\n}\n.__vue-train-timetbale.horizontal .departure .stop-text[data-v-c487f6fa] {\n transform: rotateZ(-45deg) translateY(-15px) translateX(-10px);\n}\n.__vue-train-timetbale.horizontal .end-point[data-v-c487f6fa] {\n bottom: -3px;\n}\n.__vue-train-timetbale.horizontal .terminal .stop-bar[data-v-c487f6fa] {\n width: 0;\n}\n.__vue-train-timetbale.vertical .stop-item.start .stop-bar[data-v-c487f6fa] {\n top: 50%;\n height: 50%;\n}\n.__vue-train-timetbale.vertical .stop-item.start .stop-bar .pointing[data-v-c487f6fa] {\n top: 0;\n}\n.__vue-train-timetbale.vertical .stop-item.end .stop-bar[data-v-c487f6fa] {\n bottom: 50%;\n height: 50%;\n}\n.__vue-train-timetbale.vertical .stop-item.end .stop-bar .pointing[data-v-c487f6fa] {\n top: 100%;\n}\n.__vue-train-timetbale.vertical .stop-item .departure .stop-text[data-v-c487f6fa] {\n top: -50px;\n left: 0;\n transform: rotateZ(20deg) translateX(-30%);\n transform-origin: left;\n max-width: 140px;\n text-align: left;\n}\n.__vue-train-timetbale.vertical .stop-bar[data-v-c487f6fa] {\n width: 5px;\n height: 100%;\n top: 0;\n left: 0;\n}\n.__vue-train-timetbale.vertical .stop-bar.pointing[data-v-c487f6fa] {\n height: 4px;\n width: 15px;\n top: 50%;\n left: 0;\n margin-top: -2px;\n}\n",map:{version:3,sources:["vue-train-timetable.vue"],names:[],mappings:";AAAA;EACE,mCAAmC;EACnC,mBAAmB;EACnB,iBAAiB;EACjB,uBAAuB;CACxB;AACD;EACE,WAAW;EACX,UAAU;CACX;AACD;EACE,iBAAiB;CAClB;AACD;EACE,aAAa;CACd;AACD;;EAEE,YAAY;EACZ,aAAa;EACb,oBAAoB;EACpB,mBAAmB;EACnB,QAAQ;EACR,kBAAkB;CACnB;AACD;EACE,UAAU;CACX;AACD;EACE,aAAa;CACd;AACD;EACE,wBAAwB;EACxB,uBAAuB;EACvB,mBAAmB;EACnB,aAAa;CACd;AACD;EACE,mBAAmB;CACpB;AACD;EACE,mBAAmB;EACnB,eAAe;EACf,mBAAmB;EACnB,aAAa;EACb,qBAAqB;EACrB,sBAAsB;EACtB,iBAAiB;CAClB;AACD;EACE,aAAa;CACd;AACD;EACE,UAAU;CACX;AACD;EACE,YAAY;EACZ,YAAY;EACZ,YAAY;EACZ,QAAQ;CACT;AACD;EACE,UAAU;EACV,WAAW;EACX,aAAa;EACb,mBAAmB;EACnB,QAAQ;CACT;AACD;EACE,YAAY;EACZ,mBAAmB;EACnB,YAAY;EACZ,aAAa;CACd;AACD;EACE,mBAAmB;EACnB,UAAU;EACV,QAAQ;EACR,6DAA6D;EAC7D,uBAAuB;EACvB,iBAAiB;EACjB,aAAa;CACd;AACD;EACE,+DAA+D;CAChE;AACD;EACE,aAAa;CACd;AACD;EACE,SAAS;CACV;AACD;EACE,SAAS;EACT,YAAY;CACb;AACD;EACE,OAAO;CACR;AACD;EACE,YAAY;EACZ,YAAY;CACb;AACD;EACE,UAAU;CACX;AACD;EACE,WAAW;EACX,QAAQ;EACR,2CAA2C;EAC3C,uBAAuB;EACvB,iBAAiB;EACjB,iBAAiB;CAClB;AACD;EACE,WAAW;EACX,aAAa;EACb,OAAO;EACP,QAAQ;CACT;AACD;EACE,YAAY;EACZ,YAAY;EACZ,SAAS;EACT,QAAQ;EACR,iBAAiB;CAClB",file:"vue-train-timetable.vue",sourcesContent:[".__vue-train-timetbale {\n font-family: helvetica, sans-serif;\n position: relative;\n font-weight: 500;\n box-sizing: border-box;\n}\n.__vue-train-timetbale ul {\n padding: 0;\n margin: 0;\n}\n.__vue-train-timetbale ul li {\n list-style: none;\n}\n.__vue-train-timetbale .timetable {\n height: 100%;\n}\n.__vue-train-timetbale .start-point,\n.__vue-train-timetbale .end-point {\n width: 12px;\n height: 12px;\n border-radius: 12px;\n position: absolute;\n left: 0;\n margin-left: -3px;\n}\n.__vue-train-timetbale .start-point {\n top: -6px;\n}\n.__vue-train-timetbale .end-point {\n bottom: -6px;\n}\n.__vue-train-timetbale .stop-item {\n padding: 5px 0 5px 20px;\n box-sizing: border-box;\n position: relative;\n height: 25px;\n}\n.__vue-train-timetbale .stop-bar {\n position: absolute;\n}\n.__vue-train-timetbale .bearing-wall {\n position: relative;\n display: block;\n visibility: hidden;\n width: 0.1px;\n text-indent: -1000px;\n word-break: break-all;\n line-height: 0.6;\n}\n.__vue-train-timetbale.horizontal {\n height: 100%;\n}\n.__vue-train-timetbale.horizontal .start-point {\n top: -4px;\n}\n.__vue-train-timetbale.horizontal .stop-bar {\n width: 100%;\n height: 4px;\n bottom: 0px;\n left: 0;\n}\n.__vue-train-timetbale.horizontal .stop-bar.pointing {\n bottom: 0;\n width: 4px;\n height: 10px;\n position: absolute;\n left: 0;\n}\n.__vue-train-timetbale.horizontal .stop-item {\n float: left;\n position: relative;\n width: 50px;\n height: 100%;\n}\n.__vue-train-timetbale.horizontal .stop-text {\n position: absolute;\n bottom: 0;\n left: 0;\n transform: rotateZ(-45deg) translateY(-5px) translateX(10px);\n transform-origin: left;\n text-align: left;\n width: 140px;\n}\n.__vue-train-timetbale.horizontal .departure .stop-text {\n transform: rotateZ(-45deg) translateY(-15px) translateX(-10px);\n}\n.__vue-train-timetbale.horizontal .end-point {\n bottom: -3px;\n}\n.__vue-train-timetbale.horizontal .terminal .stop-bar {\n width: 0;\n}\n.__vue-train-timetbale.vertical .stop-item.start .stop-bar {\n top: 50%;\n height: 50%;\n}\n.__vue-train-timetbale.vertical .stop-item.start .stop-bar .pointing {\n top: 0;\n}\n.__vue-train-timetbale.vertical .stop-item.end .stop-bar {\n bottom: 50%;\n height: 50%;\n}\n.__vue-train-timetbale.vertical .stop-item.end .stop-bar .pointing {\n top: 100%;\n}\n.__vue-train-timetbale.vertical .stop-item .departure .stop-text {\n top: -50px;\n left: 0;\n transform: rotateZ(20deg) translateX(-30%);\n transform-origin: left;\n max-width: 140px;\n text-align: left;\n}\n.__vue-train-timetbale.vertical .stop-bar {\n width: 5px;\n height: 100%;\n top: 0;\n left: 0;\n}\n.__vue-train-timetbale.vertical .stop-bar.pointing {\n height: 4px;\n width: 15px;\n top: 50%;\n left: 0;\n margin-top: -2px;\n}\n"]},media:void 0})},e,"data-v-c487f6fa",!1,0,function t(){var e=document.head||document.getElementsByTagName("head")[0],n=t.styles||(t.styles={}),i="undefined"!=typeof navigator&&/msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());return function(t,a){if(!document.querySelector('style[data-vue-ssr-id~="'+t+'"]')){var r=i?a.media||"default":t,o=n[r]||(n[r]={ids:[],parts:[],element:void 0});if(!o.ids.includes(t)){var l=a.source,A=o.ids.length;if(o.ids.push(t),i&&(o.element=o.element||document.querySelector("style[data-group="+r+"]")),!o.element){var s=o.element=document.createElement("style");s.type="text/css",a.media&&s.setAttribute("media",a.media),i&&(s.setAttribute("data-group",r),s.setAttribute("data-next-index","0")),e.appendChild(s)}if(i&&(A=parseInt(o.element.getAttribute("data-next-index")),o.element.setAttribute("data-next-index",A+1)),o.element.styleSheet)o.parts.push(l),o.element.styleSheet.cssText=o.parts.filter(Boolean).join("\n");else{var p=document.createTextNode(l),d=o.element.childNodes;d[A]&&o.element.removeChild(d[A]),d.length?o.element.insertBefore(p,d[A]):o.element.appendChild(p)}}}}});t.default=i,Object.defineProperty(t,"__esModule",{value:!0})}); //# sourceMappingURL=vue-train-timetable.min.js.map