UNPKG

simple-vue-timeline

Version:
8 lines 18.5 kB
(function(t,e){"object"===typeof exports&&"object"===typeof module?module.exports=e(require("vue")):"function"===typeof define&&define.amd?define([],e):"object"===typeof exports?exports["simple-vue-timeline"]=e(require("vue")):t["simple-vue-timeline"]=e(t["Vue"])})("undefined"!==typeof self?self:this,(function(t){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"===typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s="fae3")}({8875:function(t,e,n){var r,o,i;(function(n,u){o=[],r=u,i="function"===typeof r?r.apply(e,o):r,void 0===i||(t.exports=i)})("undefined"!==typeof self&&self,(function(){function t(){var e=Object.getOwnPropertyDescriptor(document,"currentScript");if(!e&&"currentScript"in document&&document.currentScript)return document.currentScript;if(e&&e.get!==t&&document.currentScript)return document.currentScript;try{throw new Error}catch(d){var n,r,o,i=/.*at [^(]*\((.*):(.+):(.+)\)$/gi,u=/@([^@]*):(\d+):(\d+)\s*$/gi,c=i.exec(d.stack)||u.exec(d.stack),a=c&&c[1]||!1,f=c&&c[2]||!1,s=document.location.href.replace(document.location.hash,""),l=document.getElementsByTagName("script");a===s&&(n=document.documentElement.outerHTML,r=new RegExp("(?:[^\\n]+?\\n){0,"+(f-2)+"}[^<]*<script>([\\d\\D]*?)<\\/script>[\\d\\D]*","i"),o=n.replace(r,"$1").trim());for(var p=0;p<l.length;p++){if("interactive"===l[p].readyState)return l[p];if(l[p].src===a)return l[p];if(a===s&&l[p].innerHTML&&l[p].innerHTML.trim()===o)return l[p]}return null}}return t}))},"8bbf":function(e,n){e.exports=t},f08e:function(t,e,n){},fae3:function(t,e,n){"use strict";n.r(e),n.d(e,"SimpleTimelinePlugin",(function(){return re})),n.d(e,"Control",(function(){return ne})),n.d(e,"Item",(function(){return te})),n.d(e,"Status",(function(){return qt}));var r={};if(n.r(r),n.d(r,"SimpleTimeline",(function(){return Bt})),n.d(r,"SimpleTimelineItem",(function(){return kt})),n.d(r,"SimpleTimelineControl",(function(){return Q})),n.d(r,"Status",(function(){return qt})),n.d(r,"Item",(function(){return te})),n.d(r,"Control",(function(){return ne})),"undefined"!==typeof window){var o=window.document.currentScript,i=n("8875");o=i(),"currentScript"in document||Object.defineProperty(document,"currentScript",{get:i});var u=o&&o.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);u&&(n.p=u[1])}var c=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("b-container",{staticClass:"timeline-container",attrs:{fluid:"md"}},t._l(t.items,(function(e){return n("timeline-item",t._g({key:e.id,attrs:{dateFormat:t.dateFormat,item:e}},t.$listeners))})),1)},a=[];function f(t,e,n,r){var o,i=arguments.length,u=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)u=Reflect.decorate(t,e,n,r);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(u=(i<3?o(u):i>3?o(e,n,u):o(e,n))||u);return i>3&&u&&Object.defineProperty(e,n,u),u}var s=n("8bbf"),l=n.n(s); /** * vue-class-component v7.2.6 * (c) 2015-present Evan You * @license MIT */ function p(t){return p="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"===typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},p(t)}function d(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function m(t){return y(t)||b(t)||h()}function y(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e<t.length;e++)n[e]=t[e];return n}}function b(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}function h(){throw new TypeError("Invalid attempt to spread non-iterable instance")}function v(){return"undefined"!==typeof Reflect&&Reflect.defineMetadata&&Reflect.getOwnMetadataKeys}function g(t,e){_(t,e),Object.getOwnPropertyNames(e.prototype).forEach((function(n){_(t.prototype,e.prototype,n)})),Object.getOwnPropertyNames(e).forEach((function(n){_(t,e,n)}))}function _(t,e,n){var r=n?Reflect.getOwnMetadataKeys(e,n):Reflect.getOwnMetadataKeys(e);r.forEach((function(r){var o=n?Reflect.getOwnMetadata(r,e,n):Reflect.getOwnMetadata(r,e);n?Reflect.defineMetadata(r,o,t,n):Reflect.defineMetadata(r,o,t)}))}var O={__proto__:[]},S=O instanceof Array;function w(t){return function(e,n,r){var o="function"===typeof e?e:e.constructor;o.__decorators__||(o.__decorators__=[]),"number"!==typeof r&&(r=void 0),o.__decorators__.push((function(e){return t(e,n,r)}))}}function M(t){var e=p(t);return null==t||"object"!==e&&"function"!==e}function j(t,e){var n=e.prototype._init;e.prototype._init=function(){var e=this,n=Object.getOwnPropertyNames(t);if(t.$options.props)for(var r in t.$options.props)t.hasOwnProperty(r)||n.push(r);n.forEach((function(n){Object.defineProperty(e,n,{get:function(){return t[n]},set:function(e){t[n]=e},configurable:!0})}))};var r=new e;e.prototype._init=n;var o={};return Object.keys(r).forEach((function(t){void 0!==r[t]&&(o[t]=r[t])})),o}var D=["data","beforeCreate","created","beforeMount","mounted","beforeDestroy","destroyed","beforeUpdate","updated","activated","deactivated","render","errorCaptured","serverPrefetch"];function P(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e.name=e.name||t._componentTag||t.name;var n=t.prototype;Object.getOwnPropertyNames(n).forEach((function(t){if("constructor"!==t)if(D.indexOf(t)>-1)e[t]=n[t];else{var r=Object.getOwnPropertyDescriptor(n,t);void 0!==r.value?"function"===typeof r.value?(e.methods||(e.methods={}))[t]=r.value:(e.mixins||(e.mixins=[])).push({data:function(){return d({},t,r.value)}}):(r.get||r.set)&&((e.computed||(e.computed={}))[t]={get:r.get,set:r.set})}})),(e.mixins||(e.mixins=[])).push({data:function(){return j(this,t)}});var r=t.__decorators__;r&&(r.forEach((function(t){return t(e)})),delete t.__decorators__);var o=Object.getPrototypeOf(t.prototype),i=o instanceof l.a?o.constructor:l.a,u=i.extend(e);return C(u,t,i),v()&&g(u,t),u}var Y={prototype:!0,arguments:!0,callee:!0,caller:!0};function C(t,e,n){Object.getOwnPropertyNames(e).forEach((function(r){if(!Y[r]){var o=Object.getOwnPropertyDescriptor(t,r);if(!o||o.configurable){var i=Object.getOwnPropertyDescriptor(e,r);if(!S){if("cid"===r)return;var u=Object.getOwnPropertyDescriptor(n,r);if(!M(i.value)&&u&&u.value===i.value)return}0,Object.defineProperty(t,r,i)}}}))}function x(t){return"function"===typeof t?P(t):function(e){return P(e,t)}}x.registerHooks=function(t){D.push.apply(D,m(t))};var E=x;var T="undefined"!==typeof Reflect&&"undefined"!==typeof Reflect.getMetadata;function R(t,e,n){if(T&&!Array.isArray(t)&&"function"!==typeof t&&"undefined"===typeof t.type){var r=Reflect.getMetadata("design:type",e,n);r!==Object&&(t.type=r)}}function N(t){return void 0===t&&(t={}),function(e,n){R(t,e,n),w((function(e,n){(e.props||(e.props={}))[n]=t}))(e,n)}}var H=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("b-row",[n("b-col",{staticClass:"align-self-center",attrs:{cols:"3",sm:"2",lg:"1"}},[n("div",{staticClass:"text-muted"},[t._v(t._s(t.formattedDate))])]),n("b-col",{attrs:{cols:"1",sm:"1",lg:"1"}},[n("div",{staticClass:"timeline h-100"},[n("h3",{staticClass:"h-100 d-flex justify-content-center"},[n("div",{staticClass:"timeline-icon badge badge-pill align-self-center",class:"badge-"+t.item.status},[n("font-awesome-icon",{attrs:{icon:t.item.icon}})],1)])])]),n("b-col",{attrs:{cols:"8",sm:"9",lg:"10"}},[n("b-card",{staticClass:"mt-1 mb-1",attrs:{header:t.item.title,"border-variant":t.item.status,"header-bg-variant":t.item.status,"header-text-variant":"white","footer-tag":"footer"}},[n("b-card-text",[t._v(t._s(t.item.body))]),n("div",{attrs:{slot:"footer"},slot:"footer"},t._l(t.item.controls,(function(e){return n("timeline-control",{key:e.method,attrs:{eventId:t.item.id,control:e}})})),1)],1)],1)],1)},$=[],A=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"float-right"},[n("b-button",{staticClass:"ml-1",attrs:{size:"sm"},on:{click:t.handleClick}},[n("font-awesome-icon",{attrs:{icon:t.control.icon}})],1)],1)},I=[];function k(t){return k="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"===typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},k(t)}function F(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Z(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function L(t,e,n){return e&&Z(t.prototype,e),n&&Z(t,n),t}function U(t,e){return!e||"object"!==k(e)&&"function"!==typeof e?V(t):e}function V(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function z(t){return z=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},z(t)}function J(t,e){if("function"!==typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&K(t,e)}function K(t,e){return K=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},K(t,e)}var q=function(t){function e(){return F(this,e),U(this,z(e).apply(this,arguments))}return J(e,t),L(e,[{key:"handleClick",value:function(){this.$parent.$emit("timeline-"+this.control.method,{eventId:this.eventId})}}]),e}(l.a);f([N()],q.prototype,"control",void 0),f([N()],q.prototype,"eventId",void 0),q=f([E({})],q);var G=q,W=G;function X(t,e,n,r,o,i,u,c){var a,f="function"===typeof t?t.options:t;if(e&&(f.render=e,f.staticRenderFns=n,f._compiled=!0),r&&(f.functional=!0),i&&(f._scopeId="data-v-"+i),u?(a=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__),o&&o.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(u)},f._ssrRegister=a):o&&(a=c?function(){o.call(this,(f.functional?this.parent:this).$root.$options.shadowRoot)}:o),a)if(f.functional){f._injectStyles=a;var s=f.render;f.render=function(t,e){return a.call(e),s(t,e)}}else{var l=f.beforeCreate;f.beforeCreate=l?[].concat(l,a):[a]}return{exports:t,options:f}}var B=X(W,A,I,!1,null,null,null),Q=B.exports,tt=/d{1,4}|M{1,4}|YY(?:YY)?|S{1,3}|Do|ZZ|Z|([HhMsDm])\1?|[aA]|"[^"]*"|'[^']*'/g,et="[1-9]\\d?",nt="\\d\\d",rt="\\d{3}",ot="\\d{4}",it="[^\\s]+",ut=/\[([^]*?)\]/gm;function ct(t,e){for(var n=[],r=0,o=t.length;r<o;r++)n.push(t[r].substr(0,e));return n}var at=function(t){return function(e,n){var r=n[t].map((function(t){return t.toLowerCase()})),o=r.indexOf(e.toLowerCase());return o>-1?o:null}};function ft(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var r=0,o=e;r<o.length;r++){var i=o[r];for(var u in i)t[u]=i[u]}return t}var st=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],lt=["January","February","March","April","May","June","July","August","September","October","November","December"],pt=ct(lt,3),dt=ct(st,3),mt={dayNamesShort:dt,dayNames:st,monthNamesShort:pt,monthNames:lt,amPm:["am","pm"],DoFn:function(t){return t+["th","st","nd","rd"][t%10>3?0:(t-t%10!==10?1:0)*t%10]}},yt=ft({},mt),bt=function(t,e){void 0===e&&(e=2),t=String(t);while(t.length<e)t="0"+t;return t},ht={D:function(t){return String(t.getDate())},DD:function(t){return bt(t.getDate())},Do:function(t,e){return e.DoFn(t.getDate())},d:function(t){return String(t.getDay())},dd:function(t){return bt(t.getDay())},ddd:function(t,e){return e.dayNamesShort[t.getDay()]},dddd:function(t,e){return e.dayNames[t.getDay()]},M:function(t){return String(t.getMonth()+1)},MM:function(t){return bt(t.getMonth()+1)},MMM:function(t,e){return e.monthNamesShort[t.getMonth()]},MMMM:function(t,e){return e.monthNames[t.getMonth()]},YY:function(t){return bt(String(t.getFullYear()),4).substr(2)},YYYY:function(t){return bt(t.getFullYear(),4)},h:function(t){return String(t.getHours()%12||12)},hh:function(t){return bt(t.getHours()%12||12)},H:function(t){return String(t.getHours())},HH:function(t){return bt(t.getHours())},m:function(t){return String(t.getMinutes())},mm:function(t){return bt(t.getMinutes())},s:function(t){return String(t.getSeconds())},ss:function(t){return bt(t.getSeconds())},S:function(t){return String(Math.round(t.getMilliseconds()/100))},SS:function(t){return bt(Math.round(t.getMilliseconds()/10),2)},SSS:function(t){return bt(t.getMilliseconds(),3)},a:function(t,e){return t.getHours()<12?e.amPm[0]:e.amPm[1]},A:function(t,e){return t.getHours()<12?e.amPm[0].toUpperCase():e.amPm[1].toUpperCase()},ZZ:function(t){var e=t.getTimezoneOffset();return(e>0?"-":"+")+bt(100*Math.floor(Math.abs(e)/60)+Math.abs(e)%60,4)},Z:function(t){var e=t.getTimezoneOffset();return(e>0?"-":"+")+bt(Math.floor(Math.abs(e)/60),2)+":"+bt(Math.abs(e)%60,2)}},vt=function(t){return+t-1},gt=[null,et],_t=[null,it],Ot=["isPm",it,function(t,e){var n=t.toLowerCase();return n===e.amPm[0]?0:n===e.amPm[1]?1:null}],St=["timezoneOffset","[^\\s]*?[\\+\\-]\\d\\d:?\\d\\d|[^\\s]*?Z?",function(t){var e=(t+"").match(/([+-]|\d\d)/gi);if(e){var n=60*+e[1]+parseInt(e[2],10);return"+"===e[0]?n:-n}return 0}],wt=(at("monthNamesShort"),at("monthNames"),{default:"ddd MMM DD YYYY HH:mm:ss",shortDate:"M/D/YY",mediumDate:"MMM D, YYYY",longDate:"MMMM D, YYYY",fullDate:"dddd, MMMM D, YYYY",isoDate:"YYYY-MM-DD",isoDateTime:"YYYY-MM-DDTHH:mm:ssZ",shortTime:"HH:mm",mediumTime:"HH:mm:ss",longTime:"HH:mm:ss.SSS"}),Mt=function(t,e,n){if(void 0===e&&(e=wt["default"]),void 0===n&&(n={}),"number"===typeof t&&(t=new Date(t)),"[object Date]"!==Object.prototype.toString.call(t)||isNaN(t.getTime()))throw new Error("Invalid Date pass to format");e=wt[e]||e;var r=[];e=e.replace(ut,(function(t,e){return r.push(e),"@@@"}));var o=ft(ft({},yt),n);return e=e.replace(tt,(function(e){return ht[e](t,o)})),e.replace(/@@@/g,(function(){return r.shift()}))};function jt(t){return jt="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"===typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},jt(t)}function Dt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Pt(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function Yt(t,e,n){return e&&Pt(t.prototype,e),n&&Pt(t,n),t}function Ct(t,e){return!e||"object"!==jt(e)&&"function"!==typeof e?xt(t):e}function xt(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Et(t){return Et=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Et(t)}function Tt(t,e){if("function"!==typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Rt(t,e)}function Rt(t,e){return Rt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Rt(t,e)}var Nt=function(t){function e(){return Dt(this,e),Ct(this,Et(e).apply(this,arguments))}return Tt(e,t),Yt(e,[{key:"formattedDate",get:function(){return Mt(this.item.createdDate,this.dateFormat)}}]),e}(l.a);f([N()],Nt.prototype,"item",void 0),f([N()],Nt.prototype,"dateFormat",void 0),Nt=f([E({components:{timelineControl:Q}})],Nt);var Ht,$t=Nt,At=$t,It=X(At,H,$,!1,null,null,null),kt=It.exports;function Ft(t){return Ft="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"===typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ft(t)}function Zt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Lt(t,e){return!e||"object"!==Ft(e)&&"function"!==typeof e?Ut(t):e}function Ut(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Vt(t){return Vt=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Vt(t)}function zt(t,e){if("function"!==typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Jt(t,e)}function Jt(t,e){return Jt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Jt(t,e)}var Kt=Ht=function(t){function e(){return Zt(this,e),Lt(this,Vt(e).apply(this,arguments))}return zt(e,t),e}(l.a);f([N({default:function(){return[]}})],Kt.prototype,"items",void 0),f([N({default:"DD/MM/YY"})],Kt.prototype,"dateFormat",void 0),Kt=Ht=f([E({components:{timeline:Ht,timelineItem:kt}})],Kt);var qt,Gt=Kt,Wt=Gt,Xt=X(Wt,c,a,!1,null,null,null),Bt=Xt.exports;function Qt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(function(t){t["PRIMARY"]="primary",t["SUCCESS"]="success",t["WARNING"]="warning",t["DANGER"]="danger",t["INFO"]="info"})(qt||(qt={}));var te=function t(e,n,r,o,i,u,c){Qt(this,t),this.id=e,this.icon=n,this.status=r,this.title=o,this.controls=i,this.createdDate=u,this.body=c};function ee(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var ne=function t(e,n){ee(this,t),this.method=e,this.icon=n},re=(n("f08e"),{install:function(t){for(var e in r)t&&e&&r[e]&&t.component(e,r[e])}});"undefined"!==typeof window&&window.Vue&&window.Vue.use(re)}})})); //# sourceMappingURL=simple-vue-timeline.umd.min.js.map