bulma-extensions
Advanced tools
Comparing version 1.1.0 to 2.0.0
@@ -178,4 +178,4 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
this._id = 'datePicker' + new Date().getTime() + Math.floor(Math.random() * Math.floor(9999)); | ||
this.dateFormat = this.options.dateFormat ? this.options.dateFormat : 'yyyy-mm-dd'; | ||
this._lang = this.options.lang; | ||
this.lang = this.options.lang; | ||
this.dateFormat = this.options.dateFormat; | ||
this._open = false; | ||
@@ -212,3 +212,3 @@ | ||
for (var i = 0; i < this.options.disabledDates.length; i++) { | ||
this.options.disabledDates[i] = __WEBPACK_IMPORTED_MODULE_0__utils_date__["d" /* parseDate */](__WEBPACK_IMPORTED_MODULE_0__utils_date__["c" /* getFormatedDate */](new Date(this.options.disabledDates[i]), this.dateFormat, __WEBPACK_IMPORTED_MODULE_3__langs_langs__["a" /* default */][this.options.lang])); | ||
this.options.disabledDates[i] = __WEBPACK_IMPORTED_MODULE_0__utils_date__["d" /* parseDate */](__WEBPACK_IMPORTED_MODULE_0__utils_date__["c" /* getFormatedDate */](new Date(this.options.disabledDates[i]), this.dateFormat, this.lang)); | ||
} | ||
@@ -231,3 +231,3 @@ } | ||
date: this.date, | ||
lang: __WEBPACK_IMPORTED_MODULE_3__langs_langs__["a" /* default */][this.lang], | ||
lang: this.lang, | ||
getDayName: this[getDayNameDatePicker] | ||
@@ -382,3 +382,3 @@ }))); | ||
this.element.value = __WEBPACK_IMPORTED_MODULE_0__utils_date__["c" /* getFormatedDate */](new Date(year, month, day), this.dateFormat, __WEBPACK_IMPORTED_MODULE_3__langs_langs__["a" /* default */][this.lang]); | ||
this.element.value = __WEBPACK_IMPORTED_MODULE_0__utils_date__["c" /* getFormatedDate */](new Date(year, month, day), this.dateFormat, this.lang); | ||
if (this.options.closeOnSelect) { | ||
@@ -422,3 +422,3 @@ this.hide(); | ||
// will try to use weekStart from options if provided, also verify if it's in the range 0 ~ 6 | ||
day += typeof this.options.weekStart != 'number' && this.options.weekStart >= 0 && this.options.weekStart <= 6 ? this.options.weekStart : __WEBPACK_IMPORTED_MODULE_3__langs_langs__["a" /* default */][this.lang].weekStart; | ||
day += typeof this.options.weekStart != 'number' && this.options.weekStart >= 0 && this.options.weekStart <= 6 ? this.options.weekStart : this.lang.weekStart; | ||
while (day >= 7) { | ||
@@ -428,3 +428,3 @@ day -= 7; | ||
return abbr ? __WEBPACK_IMPORTED_MODULE_3__langs_langs__["a" /* default */][this.lang].weekdaysShort[day] : __WEBPACK_IMPORTED_MODULE_3__langs_langs__["a" /* default */][this.lang].weekdays[day]; | ||
return abbr ? this.lang.weekdaysShort[day] : this.lang.weekdays[day]; | ||
} | ||
@@ -449,3 +449,3 @@ }, { | ||
// will try to use weekStart from options if provided, also verify if it's in the range 0 ~ 6 | ||
var startDay = typeof this.options.weekStart != 'number' && this.options.weekStart >= 0 && this.options.weekStart <= 6 ? this.options.weekStart : __WEBPACK_IMPORTED_MODULE_3__langs_langs__["a" /* default */][this.lang].weekStart; | ||
var startDay = typeof this.options.weekStart != 'number' && this.options.weekStart >= 0 && this.options.weekStart <= 6 ? this.options.weekStart : this.lang.weekStart; | ||
if (startDay > 0) { | ||
@@ -652,3 +652,3 @@ before -= startDay; | ||
} | ||
this.elementCalendarNavMonth.innerHTML = __WEBPACK_IMPORTED_MODULE_3__langs_langs__["a" /* default */][this.lang].months[this.date.month]; | ||
this.elementCalendarNavMonth.innerHTML = this.lang.months[this.date.month]; | ||
this.elementCalendarNavYear.innerHTML = this.date.year; | ||
@@ -771,3 +771,6 @@ this.elementCalendarNavDay.innerHTML = this.date.day; | ||
this._lang = typeof __WEBPACK_IMPORTED_MODULE_3__langs_langs__["a" /* default */][lang] !== 'undefined' ? lang : 'en'; | ||
this._lang = __WEBPACK_IMPORTED_MODULE_3__langs_langs__["a" /* default */][lang]; | ||
if (typeof this._lang === 'undefined') { | ||
this._lang = __WEBPACK_IMPORTED_MODULE_3__langs_langs__["a" /* default */]['en']; | ||
} | ||
} | ||
@@ -791,3 +794,3 @@ | ||
} else { | ||
date = __WEBPACK_IMPORTED_MODULE_0__utils_date__["d" /* parseDate */](__WEBPACK_IMPORTED_MODULE_0__utils_date__["c" /* getFormatedDate */](date, this.dateFormat, __WEBPACK_IMPORTED_MODULE_3__langs_langs__["a" /* default */][this.lang])); | ||
date = __WEBPACK_IMPORTED_MODULE_0__utils_date__["d" /* parseDate */](__WEBPACK_IMPORTED_MODULE_0__utils_date__["c" /* getFormatedDate */](date, this.dateFormat, this.lang)); | ||
} | ||
@@ -817,3 +820,3 @@ this._date = { | ||
} else { | ||
this._minDate = __WEBPACK_IMPORTED_MODULE_0__utils_date__["d" /* parseDate */](__WEBPACK_IMPORTED_MODULE_0__utils_date__["c" /* getFormatedDate */](minDate, this._dateFormat, __WEBPACK_IMPORTED_MODULE_3__langs_langs__["a" /* default */][this.options.lang])); | ||
this._minDate = __WEBPACK_IMPORTED_MODULE_0__utils_date__["d" /* parseDate */](__WEBPACK_IMPORTED_MODULE_0__utils_date__["c" /* getFormatedDate */](minDate, this._dateFormat, this.lang)); | ||
} | ||
@@ -838,3 +841,3 @@ } | ||
} else { | ||
this._maxDate = __WEBPACK_IMPORTED_MODULE_0__utils_date__["d" /* parseDate */](__WEBPACK_IMPORTED_MODULE_0__utils_date__["c" /* getFormatedDate */](maxDate, this._dateFormat, __WEBPACK_IMPORTED_MODULE_3__langs_langs__["a" /* default */][this.options.lang])); | ||
this._maxDate = __WEBPACK_IMPORTED_MODULE_0__utils_date__["d" /* parseDate */](__WEBPACK_IMPORTED_MODULE_0__utils_date__["c" /* getFormatedDate */](maxDate, this._dateFormat, this.lang)); | ||
} | ||
@@ -1250,2 +1253,9 @@ } | ||
}, | ||
cs: { | ||
weekStart: 1, | ||
months: ['Leden', 'Únor', 'Březen', 'Duben', 'Květen', 'Červen', 'Červenec', 'Srpen', 'Září', 'Říjen', 'Listopad', 'Prosinec'], | ||
monthsShort: ['Led', 'Úno', 'Bře', 'Dub', 'Kvě', 'Čvn', 'Čvc', 'Srp', 'Zář', 'Říj', 'Lis', 'Pro'], | ||
weekdays: ['Neděle', 'Pondělí', 'Úterý', 'Středa', 'Čtvrtek', 'Pátek', 'Sobota'], | ||
weekdaysShort: ['Ne', 'Po', 'Út', 'St', 'Čt', 'Pá', 'So'] | ||
}, | ||
de: { | ||
@@ -1403,2 +1413,11 @@ weekStart: 1, | ||
}, | ||
vi: { | ||
weekStart: 1, | ||
previousMonth: 'Tháng Trước', | ||
nextMonth: 'Tháng Sau', | ||
months: ["Tháng 1", "Tháng 2", "Tháng 3", "Tháng 4", "Tháng 5", "Tháng 6", "Tháng 7", "Tháng 8", "Tháng 9", "Tháng 10", "Tháng 11", "Tháng 12"], | ||
monthsShort: ["Th1", "Th2", "Th3", "Th4", "Th5", "Th6", "Th7", "Th8", "Th9", "Th10", "Th11", "Th12"], | ||
weekdays: ["Chủ nhật", "Thứ hai", "Thứ ba", "Thứ tư", "Thứ năm", "Thứ sáu", "Thứ bảy"], | ||
weekdaysShort: ["CN", "T2", "T3", "T4", "T5", "T6", "T7"] | ||
}, | ||
'zh-cn': { | ||
@@ -1405,0 +1424,0 @@ weekStart: 1, |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.bulmaCalendar=t():e.bulmaCalendar=t()}("undefined"!=typeof self?self:this,function(){return function(a){var n={};function r(e){if(n[e])return n[e].exports;var t=n[e]={i:e,l:!1,exports:{}};return a[e].call(t.exports,t,t.exports,r),t.l=!0,t.exports}return r.m=a,r.c=n,r.d=function(e,t,a){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:a})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var f=a(1),i=a(2),n=a(3),b=a(4),o=a(5),s=a(6),l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},d=function(){function n(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(e,t,a){return t&&n(e.prototype,t),a&&n(e,a),e}}();var h=Symbol("onToggleDatePicker"),u=Symbol("onCloseDatePicker"),c=Symbol("onPreviousYearDatePicker"),m=Symbol("onNextYearDatePicker"),v=Symbol("onPreviousMonthDatePicker"),y=Symbol("onNextMonthDatePicker"),p=Symbol("onDateClickDatePicker"),k=Symbol("getDayNameDatePicker"),g=!1;try{var r=Object.defineProperty({},"passive",{get:function(){g=!0}});window.addEventListener("testPassive",null,r),window.removeEventListener("testPassive",null,r)}catch(e){}var S=function(e){function r(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,r);var a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(r.__proto__||Object.getPrototypeOf(r)).call(this));if(a.element=i.a(e)?document.querySelector(e):e,!a.element)throw new Error("An invalid selector or non-DOM node has been provided.");return a._clickEvents=["click"],a.options=l({},o.a,t),a[h]=a[h].bind(a),a[u]=a[u].bind(a),a[c]=a[c].bind(a),a[m]=a[m].bind(a),a[v]=a[v].bind(a),a[y]=a[y].bind(a),a[p]=a[p].bind(a),a[k]=a[k].bind(a),a._init(),a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(r,n["a"]),d(r,[{key:"_init",value:function(){return this._id="datePicker"+(new Date).getTime()+Math.floor(Math.random()*Math.floor(9999)),this.dateFormat=this.options.dateFormat?this.options.dateFormat:"yyyy-mm-dd",this._lang=this.options.lang,this._open=!1,this._initDates(),this._build(),this._bindEvents(),this.emit("datepicker:ready",this._date),this}},{key:"_initDates",value:function(){if(this.element.value?this.date=f.d(this.element.value):this.date=this.options.startDate?this.options.dateFormat:new Date,this.minDate=this.options.minDate?this.options.minDate:"1970-01-01",this.maxDate=this.options.maxDate?this.options.maxDate:"9999-12-31",this.options.disabledDates){Array.isArray(this.options.disabledDates)||(this.options.disabledDates=[this.options.disabledDates]);for(var e=0;e<this.options.disabledDates.length;e++)this.options.disabledDates[e]=f.d(f.c(new Date(this.options.disabledDates[e]),this.dateFormat,b.a[this.options.lang]))}}},{key:"_build",value:function(){var e=document.createRange().createContextualFragment(Object(s.a)(l({},this.options,{id:this.id,date:this.date,lang:b.a[this.lang],getDayName:this[k]})));this.elementContainer=e.querySelector("#"+this.id),this.elementCalendar=this.elementContainer.querySelector(".calendar"),this.options.overlay&&(this.elementOverlay=this.elementContainer.querySelector(".modal-background"),this.elementCloseButton=this.elementContainer.querySelector(".modal-close")),this.elementCalendarNav=this.elementCalendar.querySelector(".calendar-nav"),this.elementCalendarNavMonth=this.elementCalendar.querySelector(".calendar-month"),this.elementCalendarNavYear=this.elementCalendar.querySelector(".calendar-year"),this.elementCalendarNavDay=this.elementCalendar.querySelector(".calendar-day"),this.elementCalendarNavPreviousMonth=this.elementCalendarNav.querySelector(".calendar-nav-previous-month"),this.elementCalendarNavNextMonth=this.elementCalendarNav.querySelector(".calendar-nav-next-month"),this.elementCalendarNavPreviousYear=this.elementCalendarNav.querySelector(".calendar-nav-previous-year"),this.elementCalendarNavNextYear=this.elementCalendarNav.querySelector(".calendar-nav-next-year"),this.elementCalendarHeader=this.elementCalendar.querySelector(".calendar-header"),this.elementCalendarBody=this.elementCalendar.querySelector(".calendar-body"),document.body.appendChild(e)}},{key:"_bindEvents",value:function(){var t=this;!0===this.options.toggleOnInputClick&&this._clickEvents.forEach(function(e){t.element.addEventListener(e,t[h])}),this.options.overlay&&(this.elementCloseButton&&this._clickEvents.forEach(function(e){t.elementCloseButton.addEventListener(e,t[u])}),this.options.closeOnOverlayClick&&this.elementOverlay&&this._clickEvents.forEach(function(e){t.elementOverlay.addEventListener(e,t[u])})),this.elementCalendarNavPreviousYear&&this._clickEvents.forEach(function(e){t.elementCalendarNavPreviousYear.addEventListener(e,t[c])}),this.elementCalendarNavNextYear&&this._clickEvents.forEach(function(e){t.elementCalendarNavNextYear.addEventListener(e,t[m])}),this.elementCalendarNavPreviousMonth&&this._clickEvents.forEach(function(e){t.elementCalendarNavPreviousMonth.addEventListener(e,t[v])}),this.elementCalendarNavNextMonth&&this._clickEvents.forEach(function(e){t.elementCalendarNavNextMonth.addEventListener(e,t[y])})}},{key:h,value:function(e){e.preventDefault(),this.open?this.hide():this.show()}},{key:u,value:function(e){g||e.preventDefault(),this.hide()}},{key:c,value:function(e){g||e.preventDefault(),this.prevYear()}},{key:m,value:function(e){g||e.preventDefault(),this.nextYear()}},{key:v,value:function(e){g||e.preventDefault(),this.prevMonth()}},{key:y,value:function(e){g||e.preventDefault(),this.nextMonth()}},{key:p,value:function(e){if(g||e.preventDefault(),!e.currentTarget.classList.contains("is-disabled")){this.date=e.currentTarget.dataset.date;var t=this.date,a=t.year,n=t.month,r=t.day;this.emit("datepicker:date:selected",this),this.element.value=f.c(new Date(a,n,r),this.dateFormat,b.a[this.lang]),this.options.closeOnSelect&&this.hide()}}},{key:"_bindDaysEvents",value:function(){var a=this;[].forEach.call(this.elementCalendarDays,function(t){a._clickEvents.forEach(function(e){t.addEventListener(e,a[p])})})}},{key:k,value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];for(e+="number"!=typeof this.options.weekStart&&0<=this.options.weekStart&&this.options.weekStart<=6?this.options.weekStart:b.a[this.lang].weekStart;7<=e;)e-=7;return t?b.a[this.lang].weekdaysShort[e]:b.a[this.lang].weekdays[e]}},{key:"_renderDay",value:function(e,t,a,n,r,i,o,s,l,d){return'\n <div data-date="'+a+"-"+t+"-"+e+'" class="calendar-date'+(i?" is-disabled":"")+(s?" calendar-range":"")+(l?" calendar-range-start":"")+(d?" calendar-range-end":"")+'">\n <button class="date-item'+(r?" is-today":"")+(n?" is-active":"")+'">'+e+"</button>\n </div>\n "}},{key:"_renderDays",value:function(){var e=new Date,t="",a=f.b(this.date.year,this.date.month),n=new Date(this.date.year,this.date.month,1).getDay();this.emit("datepicker:rendered",this);var r="number"!=typeof this.options.weekStart&&0<=this.options.weekStart&&this.options.weekStart<=6?this.options.weekStart:b.a[this.lang].weekStart;0<r&&(n-=r)<0&&(n+=7);for(var i=a+n,o=i;7<o;)o-=7;i+=7-o;for(var s=0;s<i;s++){var l=new Date(this.date.year,this.date.month,s-n+1),d=f.a(l,this.options.startDate),h=!1,u=!1,c=f.a(l,e),m=s<n||a+n<=s,v=!1;if(l.setHours(0,0,0,0),d||(u=h=!1),(l.getMonth()!==this.date.month||this.minDate&&l.getTime()<this.minDate.getTime()||this.maxDate&&l.getTime()>this.maxDate.getTime())&&(v=!0),this.options.disabledDates)for(var y=0;y<this.options.disabledDates.length;y++)l.getTime()==this.options.disabledDates[y].getTime()&&(v=!0);t+=this._renderDay(l.getDate(),this.date.month,this.date.year,d,c,v,m,!1,h,u)}this.elementCalendarBody.insertAdjacentHTML("beforeend",t),this.elementCalendarDays=this.elementCalendarBody.querySelectorAll(".calendar-date"),this._bindDaysEvents()}},{key:"prevMonth",value:function(){this.date.month-=1,this._refreshCalendar()}},{key:"_disablePrevMonth",value:function(){this.elementCalendarNavPreviousMonth.setAttribute("disabled","disabled")}},{key:"_enablePrevMonth",value:function(){this.elementCalendarNavPreviousMonth.removeAttribute("disabled")}},{key:"nextMonth",value:function(){this.date.month+=1,this._refreshCalendar()}},{key:"_disableNextMonth",value:function(){this.elementCalendarNavNextMonth.setAttribute("disabled","disabled")}},{key:"_enableNextMonth",value:function(){this.elementCalendarNavNextMonth.removeAttribute("disabled")}},{key:"prevYear",value:function(){this.date.year-=1,this._refreshCalendar()}},{key:"_disablePrevYear",value:function(){this.elementCalendarNavPreviousYear.setAttribute("disabled","disabled")}},{key:"_enablePrevYear",value:function(){this.elementCalendarNavPreviousYear.removeAttribute("disabled")}},{key:"nextYear",value:function(){this.date.year+=1,this._refreshCalendar()}},{key:"_disableNextYear",value:function(){this.elementCalendarNavNextYear.setAttribute("disabled","disabled")}},{key:"_enableNextYear",value:function(){this.elementCalendarNavNextYear.removeAttribute("disabled")}},{key:"show",value:function(){this.element.value&&(this.options.startDate=f.d(this.element.value)),this._refreshCalendar(),this.emit("datepicker:show",this),this.elementContainer.classList.add("is-active"),this.options.overlay||this._adjustPosition(),this._open=!0}},{key:"hide",value:function(){this._open=!1,this.emit("datepicker:hide",this),this.elementContainer.classList.remove("is-active")}},{key:"_refreshCalendar",value:function(){this.date.month<0&&(this.date.year-=Math.ceil(Math.abs(this.date.month)/12),this.date.month+=12),11<this.date.month&&(this.date.year+=Math.floor(Math.abs(this.date.month)/12),this.date.month-=12),this.elementCalendarNavMonth.innerHTML=b.a[this.lang].months[this.date.month],this.elementCalendarNavYear.innerHTML=this.date.year,this.elementCalendarNavDay.innerHTML=this.date.day,this.elementCalendarBody.innerHTML="";var e=0,t=0,a=12,n=9999;return this.minDate&&(e=this.minDate.getMonth(),t=this.minDate.getFullYear()),this.maxDate&&(a=this.maxDate.getMonth(),n=this.maxDate.getFullYear()),this.date.year<=t?this._disablePrevYear():this._enablePrevYear(),this.date.year>=n?this._disableNextYear():this._enableNextYear(),this.date.year<=t&&this.date.month<=e?this._disablePrevMonth():this._enablePrevMonth(),this.date.year>=n&&this.date.month>=a?this._disableNextMonth():this._enableNextMonth(),this._renderDays(),this}},{key:"_adjustPosition",value:function(){var e=void 0,t=void 0,a=void 0;if("function"==typeof this.element.getBoundingClientRect)e=(a=this.element.getBoundingClientRect()).left+window.pageXOffset,t=a.bottom+window.pageYOffset;else for(e=this.element.offsetLeft,t=this.element.offsetTop+this.element.offsetHeight;this.element=this.element.offsetParent;)e+=this.element.offsetLeft,t+=this.element.offsetTop;this.elementCalendar.style.position="absolute",this.elementCalendar.style.left=e+"px",this.elementCalendar.style.top=t+"px"}},{key:"destroy",value:function(){this.elementCalendar.remove()}},{key:"id",get:function(){return this._id}},{key:"lang",get:function(){return this._lang},set:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"en";this._lang=void 0!==b.a[e]?e:"en"}},{key:"date",get:function(){return this._date},set:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new Date;e=i.a(e)?f.d(e,this.dateFormat):f.d(f.c(e,this.dateFormat,b.a[this.lang])),this._date={year:e.getFullYear(),month:e.getMonth(),day:e.getDate()}}},{key:"minDate",get:function(){return this._minDate},set:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"1970-01-01";i.a(e)?this._minDate=f.d(e,this.dateFormat):this._minDate=f.d(f.c(e,this._dateFormat,b.a[this.options.lang]))}},{key:"maxDate",get:function(){return this._maxDate},set:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"9999-12-31";i.a(e)?this._maxDate=f.d(e,this.dateFormat):this._maxDate=f.d(f.c(e,this._dateFormat,b.a[this.options.lang]))}},{key:"dateFormat",get:function(){return this._dateFormat},set:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"yyyy-mm-dd";return this._dateFormat=e,this._initDates(),this}}],[{key:"attach",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:'input[type="date"]',t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},a=new Array,n=i.a(e)?document.querySelectorAll(e):Array.isArray(e)?e:[e];return[].forEach.call(n,function(e){setTimeout(function(){a.push(new r(e,t))},100)}),a}}]),r}();t.default=S},function(e,t,a){"use strict";a.d(t,"b",function(){return n}),a.d(t,"a",function(){return r}),a.d(t,"d",function(){return o}),a.d(t,"c",function(){return s});var n=function(e,t){return[31,i(e)?29:28,31,30,31,30,31,31,30,31,30,31][t]},r=function(e,t){return e.setHours(0,0,0,0),t.setHours(0,0,0,0),e.getTime()===t.getTime()},i=function(e){return e%4==0&&e%100!=0||e%400==0},o=function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:void 0,a=new Date;a.setHours(0,0,0,0);var n=/((?:mm?)|(?:dd?)|(?:yyy?y?))[^0-9]((?:mm?)|(?:dd?)|(?:yyy?y?))[^0-9]((?:mm?)|(?:dd?)|(?:yyy?y?))/i.exec(t);if(n){var r=/(\d+)[^0-9](\d+)[^0-9](\d+)/i.exec(e);if(r){switch(n[1][0]){case"d":a.setDate(r[1]);break;case"m":a.setMonth(r[1]-1);break;case"y":a.setFullYear(r[1])}switch(n[2][0]){case"d":a.setDate(r[2]);break;case"m":a.setMonth(r[2]-1);break;case"y":a.setFullYear(r[2])}switch(n[3][0]){case"d":a.setDate(r[3]);break;case"m":a.setMonth(r[3]-1);break;case"y":a.setFullYear(r[3])}}}return a},s=function(e,t,a){var n={d:e.getDate(),dd:e.getDate(),D:e.getDay(),m:e.getMonth()+1,mm:e.getMonth()+1,M:e.getMonth(),MM:e.getMonth(),yy:e.getFullYear().toString().substr(-2),yyyy:e.getFullYear()};return n.dd<10&&(n.dd="0"+n.dd),n.mm<10&&(n.mm="0"+n.mm),n.D=a.weekdays[n.D?n.D-1:6],n.M=a.monthsShort[n.M],n.MM=a.months[n.MM],t.replace(/(?:[dmM]{1,2}|D|yyyy|yy)/g,function(e){return void 0!==n[e]?n[e]:e})}},function(e,t,a){"use strict";a.d(t,"a",function(){return r});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r=function(e){return"string"==typeof e||!!e&&"object"===(void 0===e?"undefined":n(e))&&"[object String]"===Object.prototype.toString.call(e)}},function(e,t,a){"use strict";var n=function(){function n(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(e,t,a){return t&&n(e.prototype,t),a&&n(e,a),e}}();var r=function(){function t(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[];!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this._listeners=new Map(e),this._middlewares=new Map}return n(t,[{key:"listenerCount",value:function(e){return this._listeners.has(e)?this._listeners.get(e).length:0}},{key:"removeListeners",value:function(){var t=this,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null,a=1<arguments.length&&void 0!==arguments[1]&&arguments[1];null!==e?Array.isArray(e)?name.forEach(function(e){return t.removeListeners(e,a)}):(this._listeners.delete(e),a&&this.removeMiddleware(e)):this._listeners=new Map}},{key:"middleware",value:function(e,t){var a=this;Array.isArray(e)?name.forEach(function(e){return a.middleware(e,t)}):(Array.isArray(this._middlewares.get(e))||this._middlewares.set(e,[]),this._middlewares.get(e).push(t))}},{key:"removeMiddleware",value:function(){var t=this,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null;null!==e?Array.isArray(e)?name.forEach(function(e){return t.removeMiddleware(e)}):this._middlewares.delete(e):this._middlewares=new Map}},{key:"on",value:function(e,t){var a=this,n=2<arguments.length&&void 0!==arguments[2]&&arguments[2];if(Array.isArray(e))e.forEach(function(e){return a.on(e,t)});else{var r=(e=e.toString()).split(/,|, | /);1<r.length?r.forEach(function(e){return a.on(e,t)}):(Array.isArray(this._listeners.get(e))||this._listeners.set(e,[]),this._listeners.get(e).push({once:n,callback:t}))}}},{key:"once",value:function(e,t){this.on(e,t,!0)}},{key:"emit",value:function(a,n){var r=this,i=2<arguments.length&&void 0!==arguments[2]&&arguments[2];a=a.toString();var o=this._listeners.get(a),s=null,l=0,d=i;if(Array.isArray(o))for(o.forEach(function(e,t){i||(s=r._middlewares.get(a),Array.isArray(s)?(s.forEach(function(e){e(n,function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null;null!==e&&(n=e),l++},a)}),l>=s.length&&(d=!0)):d=!0),d&&(e.once&&(o[t]=null),e.callback(n))});-1!==o.indexOf(null);)o.splice(o.indexOf(null),1)}}]),t}();t.a=r},function(e,t,a){"use strict";t.a={ar:{weekStart:0,previousMonth:"الشهر الماضي",nextMonth:"الشهر القادم",months:["يناير","فبراير","مارس","أبريل","مايو","يونيو","يوليو","أغسطس","سبتمبر","أكتوبر","نوفمبر","ديسمبر"],monthsShort:["يناير","فبراير","مارس","أبريل","مايو","يونيو","يوليو","أغسطس","سبتمبر","أكتوبر","نوفمبر","ديسمبر"],weekdays:["السبت","الأحد","الاثنين","الثلاثاء","الأربعاء","الخميس","الجمعة"],weekdaysShort:["السبت","الأحد","الاثنين","الثلاثاء","الأربعاء","الخميس","الجمعة"]},bn:{weekStart:1,months:["জানুয়ারী","ফেব্রুয়ারি","মার্চ","এপ্রিল","মে","জুন","জুলাই","অগাস্ট","সেপ্টেম্বর","অক্টোবর","নভেম্বর","ডিসেম্বর"],monthsShort:["জানুয়ারী","ফেব্রুয়ারি","মার্চ","এপ্রিল","মে","জুন","জুলাই","অগাস্ট","সেপ্টেম্বর","অক্টোবর","নভেম্বর","ডিসেম্বর"],weekdays:["রবিবার","সোমবার","মঙ্গলবার","বুধবার","বৃহস্পতিবার","শুক্রবার","শনিবার"],weekdaysShort:["রবিবার","সোমবার","মঙ্গলবার","বুধবার","বৃহস্পতিবার","শুক্রবার","শনিবার"]},de:{weekStart:1,previousMonth:"Vorheriger Monat",nextMonth:"Nächster Monat",months:["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"],monthsShort:["Jan","Febr","März","Apr","Mai","Juni","Juli","Aug","Sept","Okt","Nov","Dez"],weekdays:["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"],weekdaysShort:["So","Mo","Di","Mi","Do","Fr","Sa"]},en:{weekStart:1,previousMonth:"Previous Month",nextMonth:"Next Month",months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],weekdays:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekdaysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},es:{weekStart:1,previousMonth:"Mes anterior",nextMonth:"Próximo mes",months:["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],monthsShort:["Ene","Feb","Mar","Abr","May","Jun","Jul","Ago","Sep","Oct","Nov","Dic"],weekdays:["Domingo","Lunes","Martes","Miércoles","Jueves","Viernes","Sábado"],weekdaysShort:["Dom","Lun","Mar","Mie","Jue","Vie","Sab"]},fa:{weekStart:1,months:["ژانویه","فوریه","مارس","آوریل","مه","ژوئن","ژوئیه","اوت","سپتامبر","اکتبر","نوامبر","دسامبر"],monthsShort:["ژان","فور","مار","آور","مه","ژون","ژوی","اوت","سپت","اکت","نوا","دسا"],weekdays:["یکشنبه","دوشنبه","سهشنبه","چهارشنبه","پنجشنبه","جمعه","شنبه","یکشنبه"],weekdaysShort:["یک","دو","سه","چهار","پنج","جمعه","شنبه","یک"]},fr:{weekStart:1,previousMonth:"Mois précédent",nextMonth:"Mois suivant",months:["Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Août","Septembre","Octobre","Novembre","Décembre"],monthsShort:["Jan","Fév","Mar","Avr","Mai","Juin","Juil","Auo","Sep","Oct","Nov","Déc"],weekdays:["Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi"],weekdaysShort:["Dim","Lun","Mar","Mer","Jeu","Ven","Sam"]},hi:{weekStart:1,months:["जनवरी","फ़रवरी","मार्च","अप्रैल","मई","जून","जुलाई","अगस्त","सितम्बर","अक्टूबर","नवंबर","दिसम्बर"],monthsShort:["जन","फ़रवरी","मार्च","अप्रैल","मई","जून","जुलाई","अगस्त","सितं","अक्टूबर","नवं","दिसम्बर"],weekdays:["रविवार","सोमवार","मंगलवार","बुधवार","गुरुवार","शुक्रवार","शनिवार"],weekdaysShort:["सूर्य","सोम","मंगल","बुध","गुरु","शुक्र","शनि"]},hr:{weekStart:2,previousMonth:"Prošli mjesec",nextMonth:"Slijedeći mjesec",months:["siječanj","veljača","ožujak","travanj","svibanj","lipanj","srpanj","kolovoz","rujan","listopad","studeni","prosinac"],monthsShort:["sij","velj","ožu","tra","svi","lip","srp","kol","ruj","lis","stu","pro"],weekdays:["nedjelja","ponedjeljak","utorak","srijeda","četvrtak","petak","subota"],weekdaysShort:["ned","pon","uto","sri","čet","pet","sub"]},hu:{weekStart:1,previousMonth:"Előző hónap",nextMonth:"Következő hónap",months:["Január","Február","Március","Április","Május","Június","Július","Augusztus","Szeptember","Október","November","December"],monthsShort:["Jan","Feb","Már","Ápr","Máj","Jún","Júl","Aug","Szept","Okt","Nov","Dec"],weekdays:["Vasárnap","Hétfő","Kedd","Szerda","Csütörtök","Péntek","Szombat"],weekdaysShort:["V","H","K","Sze","Cs","P","Szo"]},id:{weekStart:1,months:["Januari","Februari","Maret","April","Mei","Juni","Juli","Agustus","September","Oktober","November","Desember"],monthsShort:["Jan","Feb","Mar","Apr","Mei","Jun","Jul","Ags","Sep","Okt","Nov","Des"],weekdays:["Minggu","Senin","Selasa","Rabu","Kamis","Jumat","Sabtu"],weekdaysShort:["Mgu","Sen","Sel","Rab","Kam","Jum","Sab"]},it:{weekStart:1,previousMonth:"Mese Precedente",nextMonth:"Prossimo Mese",months:["Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno","Luglio","Agosto","Settembre","Ottobre","Novembre","Dicembre"],monthsShort:["Gen","Feb","Mar","Apr","Mag","Giu","Lug","Ago","Set","Ott","Nov","Dic"],weekdays:["Domenica","Lunedì","Martedì","Mercoledì","Giovedì","Venerdì","Sabato"],weekdaysShort:["Dom","Lun","Mar","Mer","Gio","Ven","Sab"]},ja:{weekStart:1,months:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],monthsShort:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],weekdays:["日曜","月曜","火曜","水曜","木曜","金曜","土曜"],weekdaysShort:["日","月","火","水","木","金","土"]},nl:{weekStart:1,previousMonth:"Vorige Maand",nextMonth:"Volgende Maand",months:["januari","februari","maart","april","mei","juni","juli","augustus","september","oktober","november","december"],monthsShort:["jan","feb","mrt","apr","mei","jun","jul","aug","sep","okt","nov","dec"],weekdays:["zondag","maandag","dinsdag","woensdag","donderdag","vrijdag","zaterdag"],weekdaysShort:["zo","ma","di","wo","do","vr","za"]},pt:{weekStart:1,months:["Janeiro","Fevereiro","Março","Abril","Maio","Junho","Julho","Agosto","Setembro","Outubro","Novembro","Dezembro"],monthsShort:["Jan","Fev","Mar","Abr","Mai","Jun","Jul","Ago","Set","Out","Nov","Dez"],weekdays:["Domingo","Segunda","Terça","Quarta","Quinta","Sexta","Sábado"],weekdaysShort:["Dom","Seg","Ter","Qua","Qui","Sex","Sáb"]},"pt-BR":{weekStart:1,previousMonth:"Mês anterior",nextMonth:"Próximo mês",months:["Janeiro","Fevereiro","Março","Abril","Maio","Junho","Julho","Agosto","Setembro","Outubro","Novembro","Dezembro"],monthsShort:["Jan","Fev","Mar","Abr","Mai","Jun","Jul","Ago","Set","Out","Nov","Dez"],weekdays:["Domingo","Segunda-feira","Terça-feira","Quarta-feira","Quinta-feira","Sexta-feira","Sábado"],weekdaysShort:["Dom","Seg","Ter","Qua","Qui","Sex","Sáb"]},ru:{weekStart:1,previousMonth:"Предыдущий месяц",nextMonth:"Следующий месяц",months:["Январь","Февраль","Март","Апрель","Май","Июнь","Июль","Август","Сентябрь","Октябрь","Ноябрь","Декабрь"],monthsShort:["Янв","Фев","Мар","Апр","Май","Июн","Июл","Авг","Сен","Окт","Ноя","Дек"],weekdays:["Воскресенье","Понедельник","Вторник","Среда","Четверг","Пятница","Суббота"],weekdaysShort:["Вс","Пн","Вт","Ср","Чт","Пт","Сб"]},sr:{weekStart:2,previousMonth:"Prošli mesec",nextMonth:"Sledeći mesec",months:["januar","februar","mart","april","maj","jun","jul","avgust","septembar","oktobar","novembar","decembar"],monthsShort:["jan","feb","mar","apr","maj","jun","jul","avg","sep","okt","nov","dec"],weekdays:["nedelja","ponedeljak","utorak","sreda","četvrtak","petak","subota"],weekdaysShort:["ned","pon","uto","sre","čet","pet","sub"]},th:{weekStart:1,previousMonth:"เดือนก่อนหน้า",nextMonth:"เดือนถัดไป",months:["มกราคม","กุมภาพันธ์","มีนาคม","เมษายน","พฤษภาคม","มิถุนายน","กรกฎาคม","สิงหาคม","กันยายน","ตุลาคม","พฤศจิกายน","ธันวาคม"],monthsShort:["ม.ค.","ก.พ.","มี.ค.","เม.ย.","พ.ค.","มิ.ย.","ก.ค.","ส.ค.","ก.ย.","ต.ค.","พ.ย.","ธ.ค."],weekdays:["อาทิตย์","จันทร์","อังคาร","พุธ","พฤหัสบดี","ศุกร์","เสาร์"],weekdaysShort:["อา.","จ.","อ.","พ.","พฤ.","ศ.","ส."]},tr:{weekStart:1,previousMonth:"Önceki Ay",nextMonth:"Gelecek Ay",months:["Ocak","Şubat","Mart","Nisan","Mayıs","Haziran","Temmuz","Ağustos","Eylül","Ekim","Kasım","Aralık"],monthsShort:["Oca","Şub","Mar","Nis","May","Haz","Tem","Ağu","Eyl","Eki","Kas","Ara"],weekdays:["Pazar","Pazartesi","Salı","Çarşamba","Perşembe","Cuma","Cumartesi"],weekdaysShort:["Paz","Pzt","Sal","Çar","Per","Cum","Cmt"]},"zh-cn":{weekStart:1,previousMonth:"上个月",nextMonth:"下个月",months:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],monthsShort:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],weekdays:["星期天","星期一","星期二","星期三","星期四","星期五","星期六"],weekdaysShort:["周日","周一","周二","周三","周四","周五","周六"]}}},function(e,t,a){"use strict";var n={startDate:new Date,weekStart:null,minDate:null,maxDate:null,disabledDates:null,dateFormat:"yyyy-mm-dd",lang:"en",overlay:!1,closeOnOverlayClick:!0,closeOnSelect:!0,toggleOnInputClick:!0,icons:{month:{previous:'<svg viewBox="0 0 50 80" xml:space="preserve">\n <polyline fill="none" stroke-width=".5em" stroke-linecap="round" stroke-linejoin="round" points="45.63,75.8 0.375,38.087 45.63,0.375 "/>\n </svg>',next:'<svg viewBox="0 0 50 80" xml:space="preserve">\n <polyline fill="none" stroke-width=".5em" stroke-linecap="round" stroke-linejoin="round" points="0.375,0.375 45.63,38.087 0.375,75.8 "/>\n </svg>'},year:{previous:'<svg viewBox="0 0 50 80" xml:space="preserve">\n <polyline fill="none" stroke-width=".5em" stroke-linecap="round" stroke-linejoin="round" points="45.63,75.8 0.375,38.087 45.63,0.375 "/>\n </svg>',next:'<svg viewBox="0 0 50 80" xml:space="preserve">\n <polyline fill="none" stroke-width=".5em" stroke-linecap="round" stroke-linejoin="round" points="0.375,0.375 45.63,38.087 0.375,75.8 "/>\n </svg>'}}};t.a=n},function(e,t,a){"use strict";t.a=function(e){return"<div id='"+e.id+"' class=\"datepicker "+(e.overlay?"modal":"")+'">\n '+(e.overlay?'<div class="modal-background"></div>':"")+'\n <div class="calendar">\n <div class="calendar-nav">\n <div class="calendar-nav-month">\n <button class="calendar-nav-previous-month button is-small is-text">'+e.icons.month.previous+'</button>\n <div class="calendar-month">'+e.lang.months[e.date.month]+'</div>\n <button class="calendar-nav-next-month button is-small is-text">'+e.icons.month.next+'</button>\n </div>\n <div class="calendar-nav-day">\n <div class="calendar-day">'+e.date.day+'</div>\n </div>\n <div class="calendar-nav-year">\n <button class="calendar-nav-previous-year button is-small is-text">'+e.icons.year.previous+'</button>\n <div class="calendar-year">'+e.date.year+'</div>\n <button class="calendar-nav-next-year button is-small is-text">'+e.icons.year.next+'</button>\n </div>\n </div>\n <div class="calendar-container">\n <div class="calendar-header">\n <div class="calendar-date">'+e.getDayName(0,!0)+'</div>\n <div class="calendar-date">'+e.getDayName(1,!0)+'</div>\n <div class="calendar-date">'+e.getDayName(2,!0)+'</div>\n <div class="calendar-date">'+e.getDayName(3,!0)+'</div>\n <div class="calendar-date">'+e.getDayName(4,!0)+'</div>\n <div class="calendar-date">'+e.getDayName(5,!0)+'</div>\n <div class="calendar-date">'+e.getDayName(6,!0)+'</div>\n </div>\n <div class="calendar-body"></div>\n </div>\n </div>\n </div>'}}]).default}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.bulmaCalendar=t():e.bulmaCalendar=t()}("undefined"!=typeof self?self:this,function(){return function(n){var a={};function r(e){if(a[e])return a[e].exports;var t=a[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,r),t.l=!0,t.exports}return r.m=n,r.c=a,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var f=n(1),i=n(2),a=n(3),o=n(4),s=n(5),l=n(6),d=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},h=function(){function a(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(e,t,n){return t&&a(e.prototype,t),n&&a(e,n),e}}();var u=Symbol("onToggleDatePicker"),c=Symbol("onCloseDatePicker"),m=Symbol("onPreviousYearDatePicker"),v=Symbol("onNextYearDatePicker"),y=Symbol("onPreviousMonthDatePicker"),b=Symbol("onNextMonthDatePicker"),p=Symbol("onDateClickDatePicker"),k=Symbol("getDayNameDatePicker"),g=!1;try{var r=Object.defineProperty({},"passive",{get:function(){g=!0}});window.addEventListener("testPassive",null,r),window.removeEventListener("testPassive",null,r)}catch(e){}var S=function(e){function r(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,r);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(r.__proto__||Object.getPrototypeOf(r)).call(this));if(n.element=i.a(e)?document.querySelector(e):e,!n.element)throw new Error("An invalid selector or non-DOM node has been provided.");return n._clickEvents=["click"],n.options=d({},s.a,t),n[u]=n[u].bind(n),n[c]=n[c].bind(n),n[m]=n[m].bind(n),n[v]=n[v].bind(n),n[y]=n[y].bind(n),n[b]=n[b].bind(n),n[p]=n[p].bind(n),n[k]=n[k].bind(n),n._init(),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(r,a["a"]),h(r,[{key:"_init",value:function(){return this._id="datePicker"+(new Date).getTime()+Math.floor(Math.random()*Math.floor(9999)),this.lang=this.options.lang,this.dateFormat=this.options.dateFormat,this._open=!1,this._initDates(),this._build(),this._bindEvents(),this.emit("datepicker:ready",this._date),this}},{key:"_initDates",value:function(){if(this.element.value?this.date=f.d(this.element.value):this.date=this.options.startDate?this.options.dateFormat:new Date,this.minDate=this.options.minDate?this.options.minDate:"1970-01-01",this.maxDate=this.options.maxDate?this.options.maxDate:"9999-12-31",this.options.disabledDates){Array.isArray(this.options.disabledDates)||(this.options.disabledDates=[this.options.disabledDates]);for(var e=0;e<this.options.disabledDates.length;e++)this.options.disabledDates[e]=f.d(f.c(new Date(this.options.disabledDates[e]),this.dateFormat,this.lang))}}},{key:"_build",value:function(){var e=document.createRange().createContextualFragment(Object(l.a)(d({},this.options,{id:this.id,date:this.date,lang:this.lang,getDayName:this[k]})));this.elementContainer=e.querySelector("#"+this.id),this.elementCalendar=this.elementContainer.querySelector(".calendar"),this.options.overlay&&(this.elementOverlay=this.elementContainer.querySelector(".modal-background"),this.elementCloseButton=this.elementContainer.querySelector(".modal-close")),this.elementCalendarNav=this.elementCalendar.querySelector(".calendar-nav"),this.elementCalendarNavMonth=this.elementCalendar.querySelector(".calendar-month"),this.elementCalendarNavYear=this.elementCalendar.querySelector(".calendar-year"),this.elementCalendarNavDay=this.elementCalendar.querySelector(".calendar-day"),this.elementCalendarNavPreviousMonth=this.elementCalendarNav.querySelector(".calendar-nav-previous-month"),this.elementCalendarNavNextMonth=this.elementCalendarNav.querySelector(".calendar-nav-next-month"),this.elementCalendarNavPreviousYear=this.elementCalendarNav.querySelector(".calendar-nav-previous-year"),this.elementCalendarNavNextYear=this.elementCalendarNav.querySelector(".calendar-nav-next-year"),this.elementCalendarHeader=this.elementCalendar.querySelector(".calendar-header"),this.elementCalendarBody=this.elementCalendar.querySelector(".calendar-body"),document.body.appendChild(e)}},{key:"_bindEvents",value:function(){var t=this;!0===this.options.toggleOnInputClick&&this._clickEvents.forEach(function(e){t.element.addEventListener(e,t[u])}),this.options.overlay&&(this.elementCloseButton&&this._clickEvents.forEach(function(e){t.elementCloseButton.addEventListener(e,t[c])}),this.options.closeOnOverlayClick&&this.elementOverlay&&this._clickEvents.forEach(function(e){t.elementOverlay.addEventListener(e,t[c])})),this.elementCalendarNavPreviousYear&&this._clickEvents.forEach(function(e){t.elementCalendarNavPreviousYear.addEventListener(e,t[m])}),this.elementCalendarNavNextYear&&this._clickEvents.forEach(function(e){t.elementCalendarNavNextYear.addEventListener(e,t[v])}),this.elementCalendarNavPreviousMonth&&this._clickEvents.forEach(function(e){t.elementCalendarNavPreviousMonth.addEventListener(e,t[y])}),this.elementCalendarNavNextMonth&&this._clickEvents.forEach(function(e){t.elementCalendarNavNextMonth.addEventListener(e,t[b])})}},{key:u,value:function(e){e.preventDefault(),this.open?this.hide():this.show()}},{key:c,value:function(e){g||e.preventDefault(),this.hide()}},{key:m,value:function(e){g||e.preventDefault(),this.prevYear()}},{key:v,value:function(e){g||e.preventDefault(),this.nextYear()}},{key:y,value:function(e){g||e.preventDefault(),this.prevMonth()}},{key:b,value:function(e){g||e.preventDefault(),this.nextMonth()}},{key:p,value:function(e){if(g||e.preventDefault(),!e.currentTarget.classList.contains("is-disabled")){this.date=e.currentTarget.dataset.date;var t=this.date,n=t.year,a=t.month,r=t.day;this.emit("datepicker:date:selected",this),this.element.value=f.c(new Date(n,a,r),this.dateFormat,this.lang),this.options.closeOnSelect&&this.hide()}}},{key:"_bindDaysEvents",value:function(){var n=this;[].forEach.call(this.elementCalendarDays,function(t){n._clickEvents.forEach(function(e){t.addEventListener(e,n[p])})})}},{key:k,value:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];for(e+="number"!=typeof this.options.weekStart&&0<=this.options.weekStart&&this.options.weekStart<=6?this.options.weekStart:this.lang.weekStart;7<=e;)e-=7;return t?this.lang.weekdaysShort[e]:this.lang.weekdays[e]}},{key:"_renderDay",value:function(e,t,n,a,r,i,o,s,l,d){return'\n <div data-date="'+n+"-"+t+"-"+e+'" class="calendar-date'+(i?" is-disabled":"")+(s?" calendar-range":"")+(l?" calendar-range-start":"")+(d?" calendar-range-end":"")+'">\n <button class="date-item'+(r?" is-today":"")+(a?" is-active":"")+'">'+e+"</button>\n </div>\n "}},{key:"_renderDays",value:function(){var e=new Date,t="",n=f.b(this.date.year,this.date.month),a=new Date(this.date.year,this.date.month,1).getDay();this.emit("datepicker:rendered",this);var r="number"!=typeof this.options.weekStart&&0<=this.options.weekStart&&this.options.weekStart<=6?this.options.weekStart:this.lang.weekStart;0<r&&(a-=r)<0&&(a+=7);for(var i=n+a,o=i;7<o;)o-=7;i+=7-o;for(var s=0;s<i;s++){var l=new Date(this.date.year,this.date.month,s-a+1),d=f.a(l,this.options.startDate),h=!1,u=!1,c=f.a(l,e),m=s<a||n+a<=s,v=!1;if(l.setHours(0,0,0,0),d||(u=h=!1),(l.getMonth()!==this.date.month||this.minDate&&l.getTime()<this.minDate.getTime()||this.maxDate&&l.getTime()>this.maxDate.getTime())&&(v=!0),this.options.disabledDates)for(var y=0;y<this.options.disabledDates.length;y++)l.getTime()==this.options.disabledDates[y].getTime()&&(v=!0);t+=this._renderDay(l.getDate(),this.date.month,this.date.year,d,c,v,m,!1,h,u)}this.elementCalendarBody.insertAdjacentHTML("beforeend",t),this.elementCalendarDays=this.elementCalendarBody.querySelectorAll(".calendar-date"),this._bindDaysEvents()}},{key:"prevMonth",value:function(){this.date.month-=1,this._refreshCalendar()}},{key:"_disablePrevMonth",value:function(){this.elementCalendarNavPreviousMonth.setAttribute("disabled","disabled")}},{key:"_enablePrevMonth",value:function(){this.elementCalendarNavPreviousMonth.removeAttribute("disabled")}},{key:"nextMonth",value:function(){this.date.month+=1,this._refreshCalendar()}},{key:"_disableNextMonth",value:function(){this.elementCalendarNavNextMonth.setAttribute("disabled","disabled")}},{key:"_enableNextMonth",value:function(){this.elementCalendarNavNextMonth.removeAttribute("disabled")}},{key:"prevYear",value:function(){this.date.year-=1,this._refreshCalendar()}},{key:"_disablePrevYear",value:function(){this.elementCalendarNavPreviousYear.setAttribute("disabled","disabled")}},{key:"_enablePrevYear",value:function(){this.elementCalendarNavPreviousYear.removeAttribute("disabled")}},{key:"nextYear",value:function(){this.date.year+=1,this._refreshCalendar()}},{key:"_disableNextYear",value:function(){this.elementCalendarNavNextYear.setAttribute("disabled","disabled")}},{key:"_enableNextYear",value:function(){this.elementCalendarNavNextYear.removeAttribute("disabled")}},{key:"show",value:function(){this.element.value&&(this.options.startDate=f.d(this.element.value)),this._refreshCalendar(),this.emit("datepicker:show",this),this.elementContainer.classList.add("is-active"),this.options.overlay||this._adjustPosition(),this._open=!0}},{key:"hide",value:function(){this._open=!1,this.emit("datepicker:hide",this),this.elementContainer.classList.remove("is-active")}},{key:"_refreshCalendar",value:function(){this.date.month<0&&(this.date.year-=Math.ceil(Math.abs(this.date.month)/12),this.date.month+=12),11<this.date.month&&(this.date.year+=Math.floor(Math.abs(this.date.month)/12),this.date.month-=12),this.elementCalendarNavMonth.innerHTML=this.lang.months[this.date.month],this.elementCalendarNavYear.innerHTML=this.date.year,this.elementCalendarNavDay.innerHTML=this.date.day,this.elementCalendarBody.innerHTML="";var e=0,t=0,n=12,a=9999;return this.minDate&&(e=this.minDate.getMonth(),t=this.minDate.getFullYear()),this.maxDate&&(n=this.maxDate.getMonth(),a=this.maxDate.getFullYear()),this.date.year<=t?this._disablePrevYear():this._enablePrevYear(),this.date.year>=a?this._disableNextYear():this._enableNextYear(),this.date.year<=t&&this.date.month<=e?this._disablePrevMonth():this._enablePrevMonth(),this.date.year>=a&&this.date.month>=n?this._disableNextMonth():this._enableNextMonth(),this._renderDays(),this}},{key:"_adjustPosition",value:function(){var e=void 0,t=void 0,n=void 0;if("function"==typeof this.element.getBoundingClientRect)e=(n=this.element.getBoundingClientRect()).left+window.pageXOffset,t=n.bottom+window.pageYOffset;else for(e=this.element.offsetLeft,t=this.element.offsetTop+this.element.offsetHeight;this.element=this.element.offsetParent;)e+=this.element.offsetLeft,t+=this.element.offsetTop;this.elementCalendar.style.position="absolute",this.elementCalendar.style.left=e+"px",this.elementCalendar.style.top=t+"px"}},{key:"destroy",value:function(){this.elementCalendar.remove()}},{key:"id",get:function(){return this._id}},{key:"lang",get:function(){return this._lang},set:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"en";this._lang=o.a[e],void 0===this._lang&&(this._lang=o.a.en)}},{key:"date",get:function(){return this._date},set:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new Date;e=i.a(e)?f.d(e,this.dateFormat):f.d(f.c(e,this.dateFormat,this.lang)),this._date={year:e.getFullYear(),month:e.getMonth(),day:e.getDate()}}},{key:"minDate",get:function(){return this._minDate},set:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"1970-01-01";i.a(e)?this._minDate=f.d(e,this.dateFormat):this._minDate=f.d(f.c(e,this._dateFormat,this.lang))}},{key:"maxDate",get:function(){return this._maxDate},set:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"9999-12-31";i.a(e)?this._maxDate=f.d(e,this.dateFormat):this._maxDate=f.d(f.c(e,this._dateFormat,this.lang))}},{key:"dateFormat",get:function(){return this._dateFormat},set:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"yyyy-mm-dd";return this._dateFormat=e,this._initDates(),this}}],[{key:"attach",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:'input[type="date"]',t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},n=new Array,a=i.a(e)?document.querySelectorAll(e):Array.isArray(e)?e:[e];return[].forEach.call(a,function(e){setTimeout(function(){n.push(new r(e,t))},100)}),n}}]),r}();t.default=S},function(e,t,n){"use strict";n.d(t,"b",function(){return a}),n.d(t,"a",function(){return r}),n.d(t,"d",function(){return o}),n.d(t,"c",function(){return s});var a=function(e,t){return[31,i(e)?29:28,31,30,31,30,31,31,30,31,30,31][t]},r=function(e,t){return e.setHours(0,0,0,0),t.setHours(0,0,0,0),e.getTime()===t.getTime()},i=function(e){return e%4==0&&e%100!=0||e%400==0},o=function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:void 0,n=new Date;n.setHours(0,0,0,0);var a=/((?:mm?)|(?:dd?)|(?:yyy?y?))[^0-9]((?:mm?)|(?:dd?)|(?:yyy?y?))[^0-9]((?:mm?)|(?:dd?)|(?:yyy?y?))/i.exec(t);if(a){var r=/(\d+)[^0-9](\d+)[^0-9](\d+)/i.exec(e);if(r){switch(a[1][0]){case"d":n.setDate(r[1]);break;case"m":n.setMonth(r[1]-1);break;case"y":n.setFullYear(r[1])}switch(a[2][0]){case"d":n.setDate(r[2]);break;case"m":n.setMonth(r[2]-1);break;case"y":n.setFullYear(r[2])}switch(a[3][0]){case"d":n.setDate(r[3]);break;case"m":n.setMonth(r[3]-1);break;case"y":n.setFullYear(r[3])}}}return n},s=function(e,t,n){var a={d:e.getDate(),dd:e.getDate(),D:e.getDay(),m:e.getMonth()+1,mm:e.getMonth()+1,M:e.getMonth(),MM:e.getMonth(),yy:e.getFullYear().toString().substr(-2),yyyy:e.getFullYear()};return a.dd<10&&(a.dd="0"+a.dd),a.mm<10&&(a.mm="0"+a.mm),a.D=n.weekdays[a.D?a.D-1:6],a.M=n.monthsShort[a.M],a.MM=n.months[a.MM],t.replace(/(?:[dmM]{1,2}|D|yyyy|yy)/g,function(e){return void 0!==a[e]?a[e]:e})}},function(e,t,n){"use strict";n.d(t,"a",function(){return r});var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r=function(e){return"string"==typeof e||!!e&&"object"===(void 0===e?"undefined":a(e))&&"[object String]"===Object.prototype.toString.call(e)}},function(e,t,n){"use strict";var a=function(){function a(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(e,t,n){return t&&a(e.prototype,t),n&&a(e,n),e}}();var r=function(){function t(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[];!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this._listeners=new Map(e),this._middlewares=new Map}return a(t,[{key:"listenerCount",value:function(e){return this._listeners.has(e)?this._listeners.get(e).length:0}},{key:"removeListeners",value:function(){var t=this,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null,n=1<arguments.length&&void 0!==arguments[1]&&arguments[1];null!==e?Array.isArray(e)?name.forEach(function(e){return t.removeListeners(e,n)}):(this._listeners.delete(e),n&&this.removeMiddleware(e)):this._listeners=new Map}},{key:"middleware",value:function(e,t){var n=this;Array.isArray(e)?name.forEach(function(e){return n.middleware(e,t)}):(Array.isArray(this._middlewares.get(e))||this._middlewares.set(e,[]),this._middlewares.get(e).push(t))}},{key:"removeMiddleware",value:function(){var t=this,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null;null!==e?Array.isArray(e)?name.forEach(function(e){return t.removeMiddleware(e)}):this._middlewares.delete(e):this._middlewares=new Map}},{key:"on",value:function(e,t){var n=this,a=2<arguments.length&&void 0!==arguments[2]&&arguments[2];if(Array.isArray(e))e.forEach(function(e){return n.on(e,t)});else{var r=(e=e.toString()).split(/,|, | /);1<r.length?r.forEach(function(e){return n.on(e,t)}):(Array.isArray(this._listeners.get(e))||this._listeners.set(e,[]),this._listeners.get(e).push({once:a,callback:t}))}}},{key:"once",value:function(e,t){this.on(e,t,!0)}},{key:"emit",value:function(n,a){var r=this,i=2<arguments.length&&void 0!==arguments[2]&&arguments[2];n=n.toString();var o=this._listeners.get(n),s=null,l=0,d=i;if(Array.isArray(o))for(o.forEach(function(e,t){i||(s=r._middlewares.get(n),Array.isArray(s)?(s.forEach(function(e){e(a,function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null;null!==e&&(a=e),l++},n)}),l>=s.length&&(d=!0)):d=!0),d&&(e.once&&(o[t]=null),e.callback(a))});-1!==o.indexOf(null);)o.splice(o.indexOf(null),1)}}]),t}();t.a=r},function(e,t,n){"use strict";t.a={ar:{weekStart:0,previousMonth:"الشهر الماضي",nextMonth:"الشهر القادم",months:["يناير","فبراير","مارس","أبريل","مايو","يونيو","يوليو","أغسطس","سبتمبر","أكتوبر","نوفمبر","ديسمبر"],monthsShort:["يناير","فبراير","مارس","أبريل","مايو","يونيو","يوليو","أغسطس","سبتمبر","أكتوبر","نوفمبر","ديسمبر"],weekdays:["السبت","الأحد","الاثنين","الثلاثاء","الأربعاء","الخميس","الجمعة"],weekdaysShort:["السبت","الأحد","الاثنين","الثلاثاء","الأربعاء","الخميس","الجمعة"]},bn:{weekStart:1,months:["জানুয়ারী","ফেব্রুয়ারি","মার্চ","এপ্রিল","মে","জুন","জুলাই","অগাস্ট","সেপ্টেম্বর","অক্টোবর","নভেম্বর","ডিসেম্বর"],monthsShort:["জানুয়ারী","ফেব্রুয়ারি","মার্চ","এপ্রিল","মে","জুন","জুলাই","অগাস্ট","সেপ্টেম্বর","অক্টোবর","নভেম্বর","ডিসেম্বর"],weekdays:["রবিবার","সোমবার","মঙ্গলবার","বুধবার","বৃহস্পতিবার","শুক্রবার","শনিবার"],weekdaysShort:["রবিবার","সোমবার","মঙ্গলবার","বুধবার","বৃহস্পতিবার","শুক্রবার","শনিবার"]},cs:{weekStart:1,months:["Leden","Únor","Březen","Duben","Květen","Červen","Červenec","Srpen","Září","Říjen","Listopad","Prosinec"],monthsShort:["Led","Úno","Bře","Dub","Kvě","Čvn","Čvc","Srp","Zář","Říj","Lis","Pro"],weekdays:["Neděle","Pondělí","Úterý","Středa","Čtvrtek","Pátek","Sobota"],weekdaysShort:["Ne","Po","Út","St","Čt","Pá","So"]},de:{weekStart:1,previousMonth:"Vorheriger Monat",nextMonth:"Nächster Monat",months:["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"],monthsShort:["Jan","Febr","März","Apr","Mai","Juni","Juli","Aug","Sept","Okt","Nov","Dez"],weekdays:["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"],weekdaysShort:["So","Mo","Di","Mi","Do","Fr","Sa"]},en:{weekStart:1,previousMonth:"Previous Month",nextMonth:"Next Month",months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],weekdays:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekdaysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},es:{weekStart:1,previousMonth:"Mes anterior",nextMonth:"Próximo mes",months:["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],monthsShort:["Ene","Feb","Mar","Abr","May","Jun","Jul","Ago","Sep","Oct","Nov","Dic"],weekdays:["Domingo","Lunes","Martes","Miércoles","Jueves","Viernes","Sábado"],weekdaysShort:["Dom","Lun","Mar","Mie","Jue","Vie","Sab"]},fa:{weekStart:1,months:["ژانویه","فوریه","مارس","آوریل","مه","ژوئن","ژوئیه","اوت","سپتامبر","اکتبر","نوامبر","دسامبر"],monthsShort:["ژان","فور","مار","آور","مه","ژون","ژوی","اوت","سپت","اکت","نوا","دسا"],weekdays:["یکشنبه","دوشنبه","سهشنبه","چهارشنبه","پنجشنبه","جمعه","شنبه","یکشنبه"],weekdaysShort:["یک","دو","سه","چهار","پنج","جمعه","شنبه","یک"]},fr:{weekStart:1,previousMonth:"Mois précédent",nextMonth:"Mois suivant",months:["Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Août","Septembre","Octobre","Novembre","Décembre"],monthsShort:["Jan","Fév","Mar","Avr","Mai","Juin","Juil","Auo","Sep","Oct","Nov","Déc"],weekdays:["Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi"],weekdaysShort:["Dim","Lun","Mar","Mer","Jeu","Ven","Sam"]},hi:{weekStart:1,months:["जनवरी","फ़रवरी","मार्च","अप्रैल","मई","जून","जुलाई","अगस्त","सितम्बर","अक्टूबर","नवंबर","दिसम्बर"],monthsShort:["जन","फ़रवरी","मार्च","अप्रैल","मई","जून","जुलाई","अगस्त","सितं","अक्टूबर","नवं","दिसम्बर"],weekdays:["रविवार","सोमवार","मंगलवार","बुधवार","गुरुवार","शुक्रवार","शनिवार"],weekdaysShort:["सूर्य","सोम","मंगल","बुध","गुरु","शुक्र","शनि"]},hr:{weekStart:2,previousMonth:"Prošli mjesec",nextMonth:"Slijedeći mjesec",months:["siječanj","veljača","ožujak","travanj","svibanj","lipanj","srpanj","kolovoz","rujan","listopad","studeni","prosinac"],monthsShort:["sij","velj","ožu","tra","svi","lip","srp","kol","ruj","lis","stu","pro"],weekdays:["nedjelja","ponedjeljak","utorak","srijeda","četvrtak","petak","subota"],weekdaysShort:["ned","pon","uto","sri","čet","pet","sub"]},hu:{weekStart:1,previousMonth:"Előző hónap",nextMonth:"Következő hónap",months:["Január","Február","Március","Április","Május","Június","Július","Augusztus","Szeptember","Október","November","December"],monthsShort:["Jan","Feb","Már","Ápr","Máj","Jún","Júl","Aug","Szept","Okt","Nov","Dec"],weekdays:["Vasárnap","Hétfő","Kedd","Szerda","Csütörtök","Péntek","Szombat"],weekdaysShort:["V","H","K","Sze","Cs","P","Szo"]},id:{weekStart:1,months:["Januari","Februari","Maret","April","Mei","Juni","Juli","Agustus","September","Oktober","November","Desember"],monthsShort:["Jan","Feb","Mar","Apr","Mei","Jun","Jul","Ags","Sep","Okt","Nov","Des"],weekdays:["Minggu","Senin","Selasa","Rabu","Kamis","Jumat","Sabtu"],weekdaysShort:["Mgu","Sen","Sel","Rab","Kam","Jum","Sab"]},it:{weekStart:1,previousMonth:"Mese Precedente",nextMonth:"Prossimo Mese",months:["Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno","Luglio","Agosto","Settembre","Ottobre","Novembre","Dicembre"],monthsShort:["Gen","Feb","Mar","Apr","Mag","Giu","Lug","Ago","Set","Ott","Nov","Dic"],weekdays:["Domenica","Lunedì","Martedì","Mercoledì","Giovedì","Venerdì","Sabato"],weekdaysShort:["Dom","Lun","Mar","Mer","Gio","Ven","Sab"]},ja:{weekStart:1,months:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],monthsShort:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],weekdays:["日曜","月曜","火曜","水曜","木曜","金曜","土曜"],weekdaysShort:["日","月","火","水","木","金","土"]},nl:{weekStart:1,previousMonth:"Vorige Maand",nextMonth:"Volgende Maand",months:["januari","februari","maart","april","mei","juni","juli","augustus","september","oktober","november","december"],monthsShort:["jan","feb","mrt","apr","mei","jun","jul","aug","sep","okt","nov","dec"],weekdays:["zondag","maandag","dinsdag","woensdag","donderdag","vrijdag","zaterdag"],weekdaysShort:["zo","ma","di","wo","do","vr","za"]},pt:{weekStart:1,months:["Janeiro","Fevereiro","Março","Abril","Maio","Junho","Julho","Agosto","Setembro","Outubro","Novembro","Dezembro"],monthsShort:["Jan","Fev","Mar","Abr","Mai","Jun","Jul","Ago","Set","Out","Nov","Dez"],weekdays:["Domingo","Segunda","Terça","Quarta","Quinta","Sexta","Sábado"],weekdaysShort:["Dom","Seg","Ter","Qua","Qui","Sex","Sáb"]},"pt-BR":{weekStart:1,previousMonth:"Mês anterior",nextMonth:"Próximo mês",months:["Janeiro","Fevereiro","Março","Abril","Maio","Junho","Julho","Agosto","Setembro","Outubro","Novembro","Dezembro"],monthsShort:["Jan","Fev","Mar","Abr","Mai","Jun","Jul","Ago","Set","Out","Nov","Dez"],weekdays:["Domingo","Segunda-feira","Terça-feira","Quarta-feira","Quinta-feira","Sexta-feira","Sábado"],weekdaysShort:["Dom","Seg","Ter","Qua","Qui","Sex","Sáb"]},ru:{weekStart:1,previousMonth:"Предыдущий месяц",nextMonth:"Следующий месяц",months:["Январь","Февраль","Март","Апрель","Май","Июнь","Июль","Август","Сентябрь","Октябрь","Ноябрь","Декабрь"],monthsShort:["Янв","Фев","Мар","Апр","Май","Июн","Июл","Авг","Сен","Окт","Ноя","Дек"],weekdays:["Воскресенье","Понедельник","Вторник","Среда","Четверг","Пятница","Суббота"],weekdaysShort:["Вс","Пн","Вт","Ср","Чт","Пт","Сб"]},sr:{weekStart:2,previousMonth:"Prošli mesec",nextMonth:"Sledeći mesec",months:["januar","februar","mart","april","maj","jun","jul","avgust","septembar","oktobar","novembar","decembar"],monthsShort:["jan","feb","mar","apr","maj","jun","jul","avg","sep","okt","nov","dec"],weekdays:["nedelja","ponedeljak","utorak","sreda","četvrtak","petak","subota"],weekdaysShort:["ned","pon","uto","sre","čet","pet","sub"]},th:{weekStart:1,previousMonth:"เดือนก่อนหน้า",nextMonth:"เดือนถัดไป",months:["มกราคม","กุมภาพันธ์","มีนาคม","เมษายน","พฤษภาคม","มิถุนายน","กรกฎาคม","สิงหาคม","กันยายน","ตุลาคม","พฤศจิกายน","ธันวาคม"],monthsShort:["ม.ค.","ก.พ.","มี.ค.","เม.ย.","พ.ค.","มิ.ย.","ก.ค.","ส.ค.","ก.ย.","ต.ค.","พ.ย.","ธ.ค."],weekdays:["อาทิตย์","จันทร์","อังคาร","พุธ","พฤหัสบดี","ศุกร์","เสาร์"],weekdaysShort:["อา.","จ.","อ.","พ.","พฤ.","ศ.","ส."]},tr:{weekStart:1,previousMonth:"Önceki Ay",nextMonth:"Gelecek Ay",months:["Ocak","Şubat","Mart","Nisan","Mayıs","Haziran","Temmuz","Ağustos","Eylül","Ekim","Kasım","Aralık"],monthsShort:["Oca","Şub","Mar","Nis","May","Haz","Tem","Ağu","Eyl","Eki","Kas","Ara"],weekdays:["Pazar","Pazartesi","Salı","Çarşamba","Perşembe","Cuma","Cumartesi"],weekdaysShort:["Paz","Pzt","Sal","Çar","Per","Cum","Cmt"]},vi:{weekStart:1,previousMonth:"Tháng Trước",nextMonth:"Tháng Sau",months:["Tháng 1","Tháng 2","Tháng 3","Tháng 4","Tháng 5","Tháng 6","Tháng 7","Tháng 8","Tháng 9","Tháng 10","Tháng 11","Tháng 12"],monthsShort:["Th1","Th2","Th3","Th4","Th5","Th6","Th7","Th8","Th9","Th10","Th11","Th12"],weekdays:["Chủ nhật","Thứ hai","Thứ ba","Thứ tư","Thứ năm","Thứ sáu","Thứ bảy"],weekdaysShort:["CN","T2","T3","T4","T5","T6","T7"]},"zh-cn":{weekStart:1,previousMonth:"上个月",nextMonth:"下个月",months:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],monthsShort:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],weekdays:["星期天","星期一","星期二","星期三","星期四","星期五","星期六"],weekdaysShort:["周日","周一","周二","周三","周四","周五","周六"]}}},function(e,t,n){"use strict";var a={startDate:new Date,weekStart:null,minDate:null,maxDate:null,disabledDates:null,dateFormat:"yyyy-mm-dd",lang:"en",overlay:!1,closeOnOverlayClick:!0,closeOnSelect:!0,toggleOnInputClick:!0,icons:{month:{previous:'<svg viewBox="0 0 50 80" xml:space="preserve">\n <polyline fill="none" stroke-width=".5em" stroke-linecap="round" stroke-linejoin="round" points="45.63,75.8 0.375,38.087 45.63,0.375 "/>\n </svg>',next:'<svg viewBox="0 0 50 80" xml:space="preserve">\n <polyline fill="none" stroke-width=".5em" stroke-linecap="round" stroke-linejoin="round" points="0.375,0.375 45.63,38.087 0.375,75.8 "/>\n </svg>'},year:{previous:'<svg viewBox="0 0 50 80" xml:space="preserve">\n <polyline fill="none" stroke-width=".5em" stroke-linecap="round" stroke-linejoin="round" points="45.63,75.8 0.375,38.087 45.63,0.375 "/>\n </svg>',next:'<svg viewBox="0 0 50 80" xml:space="preserve">\n <polyline fill="none" stroke-width=".5em" stroke-linecap="round" stroke-linejoin="round" points="0.375,0.375 45.63,38.087 0.375,75.8 "/>\n </svg>'}}};t.a=a},function(e,t,n){"use strict";t.a=function(e){return"<div id='"+e.id+"' class=\"datepicker "+(e.overlay?"modal":"")+'">\n '+(e.overlay?'<div class="modal-background"></div>':"")+'\n <div class="calendar">\n <div class="calendar-nav">\n <div class="calendar-nav-month">\n <button class="calendar-nav-previous-month button is-small is-text">'+e.icons.month.previous+'</button>\n <div class="calendar-month">'+e.lang.months[e.date.month]+'</div>\n <button class="calendar-nav-next-month button is-small is-text">'+e.icons.month.next+'</button>\n </div>\n <div class="calendar-nav-day">\n <div class="calendar-day">'+e.date.day+'</div>\n </div>\n <div class="calendar-nav-year">\n <button class="calendar-nav-previous-year button is-small is-text">'+e.icons.year.previous+'</button>\n <div class="calendar-year">'+e.date.year+'</div>\n <button class="calendar-nav-next-year button is-small is-text">'+e.icons.year.next+'</button>\n </div>\n </div>\n <div class="calendar-container">\n <div class="calendar-header">\n <div class="calendar-date">'+e.getDayName(0,!0)+'</div>\n <div class="calendar-date">'+e.getDayName(1,!0)+'</div>\n <div class="calendar-date">'+e.getDayName(2,!0)+'</div>\n <div class="calendar-date">'+e.getDayName(3,!0)+'</div>\n <div class="calendar-date">'+e.getDayName(4,!0)+'</div>\n <div class="calendar-date">'+e.getDayName(5,!0)+'</div>\n <div class="calendar-date">'+e.getDayName(6,!0)+'</div>\n </div>\n <div class="calendar-body"></div>\n </div>\n </div>\n </div>'}}]).default}); |
@@ -9,3 +9,2 @@ # bulma-calendar | ||
<img src="https://img4.hostingpics.net/pics/812322ScreenShot20170810at125834.png" width="50%"> | ||
@@ -17,3 +16,3 @@ # Examples | ||
```js | ||
date = new bulmaCalendar(document.querySelector('.sr-date'), { | ||
date = bulmaCalendar.attach(document.querySelector('.sr-date'), { | ||
dataFormat: 'd MM yyyy' // 1 January 2018 | ||
@@ -41,3 +40,3 @@ }); | ||
date = new bulmaCalendar(document.querySelector('.sr-date'), { | ||
date = bulmaCalendar.attach(document.querySelector('.sr-date'), { | ||
lang: 'it' // one of: en (default), fr, de, tr, it, th, pt-BR | ||
@@ -54,14 +53,30 @@ }); | ||
startDate: new Date(), | ||
// the default data format `field` value | ||
dateFormat: 'yyyy/mm/dd', | ||
// internationalization | ||
lang: 'en', | ||
weekStart: null, | ||
minDate: null, | ||
maxDate: null, | ||
disabledDates: null, | ||
dateFormat: 'yyyy-mm-dd', // the default data format `field` value | ||
lang: 'en', // internationalization | ||
overlay: false, | ||
closeOnOverlayClick: true, | ||
closeOnSelect: true, | ||
// callback function | ||
onSelect: null, // callback(new Date(year, month, day)) | ||
onOpen: null, // callback(this) | ||
onClose: null, // callback(this) | ||
onRender: null // callback(this) | ||
}; | ||
toggleOnInputClick: true, | ||
icons: { | ||
month: { | ||
previous: `<svg viewBox="0 0 50 80" xml:space="preserve"> | ||
<polyline fill="none" stroke-width=".5em" stroke-linecap="round" stroke-linejoin="round" points="45.63,75.8 0.375,38.087 45.63,0.375 "/> | ||
</svg>`, | ||
next: `<svg viewBox="0 0 50 80" xml:space="preserve"> | ||
<polyline fill="none" stroke-width=".5em" stroke-linecap="round" stroke-linejoin="round" points="0.375,0.375 45.63,38.087 0.375,75.8 "/> | ||
</svg>` | ||
}, | ||
year: { | ||
previous: `<svg viewBox="0 0 50 80" xml:space="preserve"> | ||
<polyline fill="none" stroke-width=".5em" stroke-linecap="round" stroke-linejoin="round" points="45.63,75.8 0.375,38.087 45.63,0.375 "/> | ||
</svg>`, | ||
next: `<svg viewBox="0 0 50 80" xml:space="preserve"> | ||
<polyline fill="none" stroke-width=".5em" stroke-linecap="round" stroke-linejoin="round" points="0.375,0.375 45.63,38.087 0.375,75.8 "/> | ||
</svg>` | ||
} | ||
}; | ||
``` | ||
@@ -68,0 +83,0 @@ |
@@ -1,143 +0,96 @@ | ||
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : | ||
typeof define === 'function' && define.amd ? define('bulmaCarousel', factory) : | ||
(global.bulmaCarousel = factory()); | ||
}(this, (function () { 'use strict'; | ||
(function webpackUniversalModuleDefinition(root, factory) { | ||
if(typeof exports === 'object' && typeof module === 'object') | ||
module.exports = factory(); | ||
else if(typeof define === 'function' && define.amd) | ||
define([], factory); | ||
else if(typeof exports === 'object') | ||
exports["bulmaCarousel"] = factory(); | ||
else | ||
root["bulmaCarousel"] = factory(); | ||
})(typeof self !== 'undefined' ? self : this, function() { | ||
return /******/ (function(modules) { // webpackBootstrap | ||
/******/ // The module cache | ||
/******/ var installedModules = {}; | ||
/******/ | ||
/******/ // The require function | ||
/******/ function __webpack_require__(moduleId) { | ||
/******/ | ||
/******/ // Check if module is in cache | ||
/******/ if(installedModules[moduleId]) { | ||
/******/ return installedModules[moduleId].exports; | ||
/******/ } | ||
/******/ // Create a new module (and put it into the cache) | ||
/******/ var module = installedModules[moduleId] = { | ||
/******/ i: moduleId, | ||
/******/ l: false, | ||
/******/ exports: {} | ||
/******/ }; | ||
/******/ | ||
/******/ // Execute the module function | ||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); | ||
/******/ | ||
/******/ // Flag the module as loaded | ||
/******/ module.l = true; | ||
/******/ | ||
/******/ // Return the exports of the module | ||
/******/ return module.exports; | ||
/******/ } | ||
/******/ | ||
/******/ | ||
/******/ // expose the modules object (__webpack_modules__) | ||
/******/ __webpack_require__.m = modules; | ||
/******/ | ||
/******/ // expose the module cache | ||
/******/ __webpack_require__.c = installedModules; | ||
/******/ | ||
/******/ // define getter function for harmony exports | ||
/******/ __webpack_require__.d = function(exports, name, getter) { | ||
/******/ if(!__webpack_require__.o(exports, name)) { | ||
/******/ Object.defineProperty(exports, name, { | ||
/******/ configurable: false, | ||
/******/ enumerable: true, | ||
/******/ get: getter | ||
/******/ }); | ||
/******/ } | ||
/******/ }; | ||
/******/ | ||
/******/ // getDefaultExport function for compatibility with non-harmony modules | ||
/******/ __webpack_require__.n = function(module) { | ||
/******/ var getter = module && module.__esModule ? | ||
/******/ function getDefault() { return module['default']; } : | ||
/******/ function getModuleExports() { return module; }; | ||
/******/ __webpack_require__.d(getter, 'a', getter); | ||
/******/ return getter; | ||
/******/ }; | ||
/******/ | ||
/******/ // Object.prototype.hasOwnProperty.call | ||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; | ||
/******/ | ||
/******/ // __webpack_public_path__ | ||
/******/ __webpack_require__.p = ""; | ||
/******/ | ||
/******/ // Load entry module and return exports | ||
/******/ return __webpack_require__(__webpack_require__.s = 0); | ||
/******/ }) | ||
/************************************************************************/ | ||
/******/ ([ | ||
/* 0 */ | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
class EventEmitter { | ||
constructor(listeners = []) { | ||
this._listeners = new Map(listeners); | ||
this._middlewares = new Map(); | ||
} | ||
"use strict"; | ||
Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); | ||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__events__ = __webpack_require__(1); | ||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__defaultOptions__ = __webpack_require__(2); | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
listenerCount(eventName) { | ||
if (!this._listeners.has(eventName)) { | ||
return 0; | ||
} | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
const eventListeners = this._listeners.get(eventName); | ||
return eventListeners.length; | ||
} | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
removeListeners(eventName = null, middleware = false) { | ||
if (eventName !== null) { | ||
if (Array.isArray(eventName)) { | ||
name.forEach(e => this.removeListeners(e, middleware)); | ||
} else { | ||
this._listeners.delete(eventName); | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
if (middleware) { | ||
this.removeMiddleware(eventName); | ||
} | ||
} | ||
} else { | ||
this._listeners = new Map(); | ||
} | ||
} | ||
middleware(eventName, fn) { | ||
if (Array.isArray(eventName)) { | ||
name.forEach(e => this.middleware(e, fn)); | ||
} else { | ||
if (!Array.isArray(this._middlewares.get(eventName))) { | ||
this._middlewares.set(eventName, []); | ||
} | ||
(this._middlewares.get(eventName)).push(fn); | ||
} | ||
} | ||
removeMiddleware(eventName = null) { | ||
if (eventName !== null) { | ||
if (Array.isArray(eventName)) { | ||
name.forEach(e => this.removeMiddleware(e)); | ||
} else { | ||
this._middlewares.delete(eventName); | ||
} | ||
} else { | ||
this._middlewares = new Map(); | ||
} | ||
} | ||
on(name, callback, once = false) { | ||
if (Array.isArray(name)) { | ||
name.forEach(e => this.on(e, callback)); | ||
} else { | ||
name = name.toString(); | ||
const split = name.split(/,|, | /); | ||
if (split.length > 1) { | ||
split.forEach(e => this.on(e, callback)); | ||
} else { | ||
if (!Array.isArray(this._listeners.get(name))) { | ||
this._listeners.set(name, []); | ||
} | ||
(this._listeners.get(name)).push({once: once, callback: callback}); | ||
} | ||
} | ||
} | ||
once(name, callback) { | ||
this.on(name, callback, true); | ||
} | ||
emit(name, data, silent = false) { | ||
name = name.toString(); | ||
let listeners = this._listeners.get(name); | ||
let middlewares = null; | ||
let doneCount = 0; | ||
let execute = silent; | ||
if (Array.isArray(listeners)) { | ||
listeners.forEach((listener, index) => { | ||
// Start Middleware checks unless we're doing a silent emit | ||
if (!silent) { | ||
middlewares = this._middlewares.get(name); | ||
// Check and execute Middleware | ||
if (Array.isArray(middlewares)) { | ||
middlewares.forEach(middleware => { | ||
middleware(data, (newData = null) => { | ||
if (newData !== null) { | ||
data = newData; | ||
} | ||
doneCount++; | ||
}, name); | ||
}); | ||
if (doneCount >= middlewares.length) { | ||
execute = true; | ||
} | ||
} else { | ||
execute = true; | ||
} | ||
} | ||
// If Middleware checks have been passed, execute | ||
if (execute) { | ||
if (listener.once) { | ||
listeners[index] = null; | ||
} | ||
listener.callback(data); | ||
} | ||
}); | ||
// Dirty way of removing used Events | ||
while (listeners.indexOf(null) !== -1) { | ||
listeners.splice(listeners.indexOf(null), 1); | ||
} | ||
} | ||
} | ||
} | ||
const defaultOptions = { | ||
size: 1, | ||
autoplay: false, | ||
delay: 5000, | ||
threshold: 50, //required min distance traveled to be considered swipe | ||
restraint: 100, // maximum distance allowed at the same time in perpendicular direction | ||
allowedTime: 500 // maximum time allowed to travel that distance | ||
}; | ||
const BULMA_CAROUSEL_EVENTS = { | ||
var BULMA_CAROUSEL_EVENTS = { | ||
'ready': 'carousel:ready', | ||
@@ -148,5 +101,5 @@ 'slideBefore': 'carousel:slide:before', | ||
const onSwipeStart = Symbol('onSwipeStart'); | ||
const onSwipeMove = Symbol('onSwipeMove'); | ||
const onSwipeEnd = Symbol('onSwipeEnd'); | ||
var onSwipeStart = Symbol('onSwipeStart'); | ||
var onSwipeMove = Symbol('onSwipeMove'); | ||
var onSwipeEnd = Symbol('onSwipeEnd'); | ||
@@ -156,3 +109,3 @@ var supportsPassive = false; | ||
var opts = Object.defineProperty({}, 'passive', { | ||
get: function() { | ||
get: function get() { | ||
supportsPassive = true; | ||
@@ -165,36 +118,41 @@ } | ||
class bulmaCarousel extends EventEmitter { | ||
constructor(selector, options = {}) { | ||
super(); | ||
var bulmaCarousel = function (_EventEmitter) { | ||
_inherits(bulmaCarousel, _EventEmitter); | ||
this.element = typeof selector === 'string' | ||
? document.querySelector(selector) | ||
: selector; | ||
function bulmaCarousel(selector) { | ||
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
_classCallCheck(this, bulmaCarousel); | ||
var _this = _possibleConstructorReturn(this, (bulmaCarousel.__proto__ || Object.getPrototypeOf(bulmaCarousel)).call(this)); | ||
_this.element = typeof selector === 'string' ? document.querySelector(selector) : selector; | ||
// An invalid selector or non-DOM node has been provided. | ||
if (!this.element) { | ||
if (!_this.element) { | ||
throw new Error('An invalid selector or non-DOM node has been provided.'); | ||
} | ||
this._clickEvents = ['click']; | ||
this.options = Object.assign({}, defaultOptions, options); | ||
if (this.element.dataset.autoplay) { | ||
this.options.autoplay = this.element.dataset.autoplay; | ||
_this._clickEvents = ['click']; | ||
_this.options = Object.assign({}, __WEBPACK_IMPORTED_MODULE_1__defaultOptions__["a" /* default */], options); | ||
if (_this.element.dataset.autoplay) { | ||
_this.options.autoplay = _this.element.dataset.autoplay; | ||
} | ||
if (this.element.dataset.delay) { | ||
this.options.delay = this.element.dataset.delay; | ||
if (_this.element.dataset.delay) { | ||
_this.options.delay = _this.element.dataset.delay; | ||
} | ||
if (this.element.dataset.size && !this.element.classList.contains('carousel-animate-fade')) { | ||
this.options.size = this.element.dataset.size; | ||
if (_this.element.dataset.size && !_this.element.classList.contains('carousel-animate-fade')) { | ||
_this.options.size = _this.element.dataset.size; | ||
} | ||
if (this.element.classList.contains('carousel-animate-fade')) { | ||
this.options.size = 1; | ||
if (_this.element.classList.contains('carousel-animate-fade')) { | ||
_this.options.size = 1; | ||
} | ||
this.forceHiddenNavigation = false; | ||
_this.forceHiddenNavigation = false; | ||
this[onSwipeStart] = this[onSwipeStart].bind(this); | ||
this[onSwipeMove] = this[onSwipeMove].bind(this); | ||
this[onSwipeEnd] = this[onSwipeEnd].bind(this); | ||
_this[onSwipeStart] = _this[onSwipeStart].bind(_this); | ||
_this[onSwipeMove] = _this[onSwipeMove].bind(_this); | ||
_this[onSwipeEnd] = _this[onSwipeEnd].bind(_this); | ||
this.init(); | ||
_this.init(); | ||
return _this; | ||
} | ||
@@ -207,345 +165,600 @@ | ||
*/ | ||
static attach(selector = '.carousel, .hero-carousel', options = {}) { | ||
let instances = new Array(); | ||
const elements = document.querySelectorAll(selector); | ||
[].forEach.call(elements, element => { | ||
setTimeout(() => { | ||
instances.push(new bulmaCarousel(element, options)); | ||
}, 100); | ||
}); | ||
return instances; | ||
} | ||
/** | ||
* Initiate plugin | ||
* @method init | ||
* @return {void} | ||
*/ | ||
init() { | ||
this.container = this.element.querySelector('.carousel-container'); | ||
this.items = this.element.querySelectorAll('.carousel-item'); | ||
this.currentItem = { | ||
element: this.element, | ||
node: this.element.querySelector('.carousel-item.is-active'), | ||
pos: -1 | ||
}; | ||
this.currentItem.pos = this.currentItem.node ? Array.from(this.items).indexOf(this.currentItem.node) : -1; | ||
if (!this.currentItem.node) { | ||
this.currentItem.node = this.items[0]; | ||
this.currentItem.node.classList.add('is-active'); | ||
this.currentItem.pos = 0; | ||
} | ||
this.forceHiddenNavigation = this.items.length <= 1; | ||
_createClass(bulmaCarousel, [{ | ||
key: 'init', | ||
let images = this.element.querySelectorAll('img'); | ||
[].forEach.call(images, img => { | ||
img.setAttribute('draggable', false); | ||
}); | ||
this._resize(); | ||
this._setOrder(); | ||
this._initNavigation(); | ||
this._bindEvents(); | ||
/** | ||
* Initiate plugin | ||
* @method init | ||
* @return {void} | ||
*/ | ||
value: function init() { | ||
this.container = this.element.querySelector('.carousel-container'); | ||
this.items = this.element.querySelectorAll('.carousel-item'); | ||
this.currentItem = { | ||
element: this.element, | ||
node: this.element.querySelector('.carousel-item.is-active'), | ||
pos: -1 | ||
}; | ||
this.currentItem.pos = this.currentItem.node ? Array.from(this.items).indexOf(this.currentItem.node) : -1; | ||
if (!this.currentItem.node) { | ||
this.currentItem.node = this.items[0]; | ||
this.currentItem.node.classList.add('is-active'); | ||
this.currentItem.pos = 0; | ||
} | ||
this.forceHiddenNavigation = this.items.length <= 1; | ||
if (this.options.autoplay) { | ||
this._autoPlay(this.options.delay); | ||
var images = this.element.querySelectorAll('img'); | ||
[].forEach.call(images, function (img) { | ||
img.setAttribute('draggable', false); | ||
}); | ||
this._resize(); | ||
this._setOrder(); | ||
this._initNavigation(); | ||
this._bindEvents(); | ||
if (this.options.autoplay) { | ||
this._autoPlay(this.options.delay); | ||
} | ||
this.emit(BULMA_CAROUSEL_EVENTS.ready, this.currentItem); | ||
} | ||
}, { | ||
key: '_resize', | ||
value: function _resize() { | ||
var _this2 = this; | ||
this.emit(BULMA_CAROUSEL_EVENTS.ready, this.currentItem); | ||
} | ||
var computedStyle = window.getComputedStyle(this.element); | ||
var width = parseInt(computedStyle.getPropertyValue('width'), 10); | ||
_resize() { | ||
const computedStyle = window.getComputedStyle(this.element); | ||
const width = parseInt(computedStyle.getPropertyValue('width'), 10); | ||
// Detect which animation is setup and auto-calculate size and transformation | ||
if (this.options.size > 1) { | ||
if (this.options.size >= Array.from(this.items).length) { | ||
this.offset = 0; | ||
} else { | ||
this.offset = width / this.options.size; | ||
} | ||
// Detect which animation is setup and auto-calculate size and transformation | ||
if (this.options.size > 1) { | ||
if (this.options.size >= Array.from(this.items).length) { | ||
this.offset = 0; | ||
} else { | ||
this.offset = width / this.options.size; | ||
this.container.style.left = 0 - this.offset + 'px'; | ||
this.container.style.transform = 'translateX(' + this.offset + 'px)'; | ||
[].forEach.call(this.items, function (item) { | ||
item.style.flexBasis = _this2.offset + 'px'; | ||
}); | ||
} | ||
this.container.style.left = 0 - this.offset + 'px'; | ||
this.container.style.transform = `translateX(${this.offset}px)`; | ||
[].forEach.call(this.items, item => { | ||
item.style.flexBasis = `${this.offset}px`; | ||
}); | ||
} | ||
// If animation is fade then force carouselContainer size (due to the position: absolute) | ||
if (this.element.classList.contains('carousel-animate-fade') && this.items.length) { | ||
let img = this.items[0].querySelector('img'); | ||
let scale = 1; | ||
if (img.naturalWidth) { | ||
scale = width / img.naturalWidth; | ||
this.container.style.height = (img.naturalHeight * scale) + 'px'; | ||
} else { | ||
img.onload = () => { | ||
// If animation is fade then force carouselContainer size (due to the position: absolute) | ||
if (this.element.classList.contains('carousel-animate-fade') && this.items.length) { | ||
var img = this.items[0].querySelector('img'); | ||
var scale = 1; | ||
if (img.naturalWidth) { | ||
scale = width / img.naturalWidth; | ||
this.container.style.height = (img.naturalHeight * scale) + 'px'; | ||
}; | ||
this.container.style.height = img.naturalHeight * scale + 'px'; | ||
} else { | ||
img.onload = function () { | ||
scale = width / img.naturalWidth; | ||
_this2.container.style.height = img.naturalHeight * scale + 'px'; | ||
}; | ||
} | ||
} | ||
} | ||
} | ||
/** | ||
* Bind all events | ||
* @method _bindEvents | ||
* @return {void} | ||
*/ | ||
_bindEvents() { | ||
if (this.previousControl) { | ||
this._clickEvents.forEach(clickEvent => { | ||
this.previousControl.addEventListener(clickEvent, e => { | ||
if (!supportsPassive) { | ||
e.preventDefault(); | ||
} | ||
if (this._autoPlayInterval) { | ||
clearInterval(this._autoPlayInterval); | ||
this._autoPlay(this.optionsdelay); | ||
} | ||
this._slide('previous'); | ||
}, supportsPassive ? { passive: true } : false); | ||
}); | ||
} | ||
/** | ||
* Bind all events | ||
* @method _bindEvents | ||
* @return {void} | ||
*/ | ||
if (this.nextControl) { | ||
this._clickEvents.forEach(clickEvent => { | ||
this.nextControl.addEventListener(clickEvent, e => { | ||
if (!supportsPassive) { | ||
e.preventDefault(); | ||
} | ||
if (this._autoPlayInterval) { | ||
clearInterval(this._autoPlayInterval); | ||
this._autoPlay(this.options.delay); | ||
} | ||
this._slide('next'); | ||
}, supportsPassive ? { passive: true } : false); | ||
}); | ||
}, { | ||
key: '_bindEvents', | ||
value: function _bindEvents() { | ||
var _this3 = this; | ||
if (this.previousControl) { | ||
this._clickEvents.forEach(function (clickEvent) { | ||
_this3.previousControl.addEventListener(clickEvent, function (e) { | ||
if (!supportsPassive) { | ||
e.preventDefault(); | ||
} | ||
if (_this3._autoPlayInterval) { | ||
clearInterval(_this3._autoPlayInterval); | ||
_this3._autoPlay(_this3.optionsdelay); | ||
} | ||
_this3._slide('previous'); | ||
}, supportsPassive ? { passive: true } : false); | ||
}); | ||
} | ||
if (this.nextControl) { | ||
this._clickEvents.forEach(function (clickEvent) { | ||
_this3.nextControl.addEventListener(clickEvent, function (e) { | ||
if (!supportsPassive) { | ||
e.preventDefault(); | ||
} | ||
if (_this3._autoPlayInterval) { | ||
clearInterval(_this3._autoPlayInterval); | ||
_this3._autoPlay(_this3.options.delay); | ||
} | ||
_this3._slide('next'); | ||
}, supportsPassive ? { passive: true } : false); | ||
}); | ||
} | ||
// Bind swipe events | ||
this.element.addEventListener('touchstart', this[onSwipeStart], supportsPassive ? { passive: true } : false); | ||
this.element.addEventListener('mousedown', this[onSwipeStart], supportsPassive ? { passive: true } : false); | ||
this.element.addEventListener('touchmove', this[onSwipeMove], supportsPassive ? { passive: true } : false); | ||
this.element.addEventListener('mousemove', this[onSwipeMove], supportsPassive ? { passive: true } : false); | ||
this.element.addEventListener('touchend', this[onSwipeEnd], supportsPassive ? { passive: true } : false); | ||
this.element.addEventListener('mouseup', this[onSwipeEnd], supportsPassive ? { passive: true } : false); | ||
} | ||
}, { | ||
key: 'destroy', | ||
value: function destroy() { | ||
this.element.removeEventListener('touchstart', this[onSwipeStart], supportsPassive ? { passive: true } : false); | ||
this.element.removeEventListener('mousedown', this[onSwipeStart], supportsPassive ? { passive: true } : false); | ||
this.element.removeEventListener('touchmove', this[onSwipeMove], supportsPassive ? { passive: true } : false); | ||
this.element.removeEventListener('mousemove', this[onSwipeMove], supportsPassive ? { passive: true } : false); | ||
this.element.removeEventListener('touchend', this[onSwipeEnd], supportsPassive ? { passive: true } : false); | ||
this.element.removeEventListener('mouseup', this[onSwipeEnd], supportsPassive ? { passive: true } : false); | ||
} | ||
// Bind swipe events | ||
this.element.addEventListener('touchstart', this[onSwipeStart], supportsPassive ? { passive: true } : false); | ||
this.element.addEventListener('mousedown', this[onSwipeStart], supportsPassive ? { passive: true } : false); | ||
this.element.addEventListener('touchmove', this[onSwipeMove], supportsPassive ? { passive: true } : false); | ||
this.element.addEventListener('mousemove', this[onSwipeMove], supportsPassive ? { passive: true } : false); | ||
this.element.addEventListener('touchend', this[onSwipeEnd], supportsPassive ? { passive: true } : false); | ||
this.element.addEventListener('mouseup', this[onSwipeEnd], supportsPassive ? { passive: true } : false); | ||
} | ||
/** | ||
* Save current position on start swiping | ||
* @method onSwipeStart | ||
* @param {Event} e Swipe event | ||
* @return {void} | ||
*/ | ||
destroy() { | ||
this.element.removeEventListener('touchstart', this[onSwipeStart], supportsPassive ? { passive: true } : false); | ||
this.element.removeEventListener('mousedown', this[onSwipeStart], supportsPassive ? { passive: true } : false); | ||
this.element.removeEventListener('touchmove', this[onSwipeMove], supportsPassive ? { passive: true } : false); | ||
this.element.removeEventListener('mousemove', this[onSwipeMove], supportsPassive ? { passive: true } : false); | ||
this.element.removeEventListener('touchend', this[onSwipeEnd], supportsPassive ? { passive: true } : false); | ||
this.element.removeEventListener('mouseup', this[onSwipeEnd], supportsPassive ? { passive: true } : false); | ||
} | ||
}, { | ||
key: onSwipeStart, | ||
value: function value(e) { | ||
if (!supportsPassive) { | ||
e.preventDefault(); | ||
} | ||
/** | ||
* Save current position on start swiping | ||
* @method onSwipeStart | ||
* @param {Event} e Swipe event | ||
* @return {void} | ||
*/ | ||
[onSwipeStart](e) { | ||
if (!supportsPassive) { | ||
e.preventDefault(); | ||
e = e ? e : window.event; | ||
e = 'changedTouches' in e ? e.changedTouches[0] : e; | ||
this._touch = { | ||
start: { | ||
time: new Date().getTime(), // record time when finger first makes contact with surface | ||
x: e.pageX, | ||
y: e.pageY | ||
}, | ||
dist: { | ||
x: 0, | ||
y: 0 | ||
} | ||
}; | ||
} | ||
e = e ? e : window.event; | ||
e = ('changedTouches' in e) ? e.changedTouches[0] : e; | ||
this._touch = { | ||
start: { | ||
time: new Date().getTime(), // record time when finger first makes contact with surface | ||
x: e.pageX, | ||
y: e.pageY | ||
}, | ||
dist: { | ||
x: 0, | ||
y: 0 | ||
/** | ||
* Save current position on end swiping | ||
* @method onSwipeMove | ||
* @param {Event} e swipe event | ||
* @return {void} | ||
*/ | ||
}, { | ||
key: onSwipeMove, | ||
value: function value(e) { | ||
if (!supportsPassive) { | ||
e.preventDefault(); | ||
} | ||
}; | ||
} | ||
} | ||
/** | ||
* Save current position on end swiping | ||
* @method onSwipeMove | ||
* @param {Event} e swipe event | ||
* @return {void} | ||
*/ | ||
[onSwipeMove](e) { | ||
if (!supportsPassive) { | ||
e.preventDefault(); | ||
/** | ||
* Save current position on end swiping | ||
* @method onSwipeEnd | ||
* @param {Event} e swipe event | ||
* @return {void} | ||
*/ | ||
}, { | ||
key: onSwipeEnd, | ||
value: function value(e) { | ||
if (!supportsPassive) { | ||
e.preventDefault(); | ||
} | ||
e = e ? e : window.event; | ||
e = 'changedTouches' in e ? e.changedTouches[0] : e; | ||
this._touch.dist = { | ||
x: e.pageX - this._touch.start.x, // get horizontal dist traveled by finger while in contact with surface | ||
y: e.pageY - this._touch.start.y // get vertical dist traveled by finger while in contact with surface | ||
}; | ||
this._handleGesture(); | ||
} | ||
} | ||
/** | ||
* Save current position on end swiping | ||
* @method onSwipeEnd | ||
* @param {Event} e swipe event | ||
* @return {void} | ||
*/ | ||
[onSwipeEnd](e) { | ||
if (!supportsPassive) { | ||
e.preventDefault(); | ||
/** | ||
* Identify the gestureand slide if necessary | ||
* @method _handleGesture | ||
* @return {void} | ||
*/ | ||
}, { | ||
key: '_handleGesture', | ||
value: function _handleGesture() { | ||
var elapsedTime = new Date().getTime() - this._touch.start.time; // get time elapsed | ||
if (elapsedTime <= this.options.allowedTime) { | ||
// first condition for awipe met | ||
if (Math.abs(this._touch.dist.x) >= this.options.threshold && Math.abs(this._touch.dist.y) <= this.options.restraint) { | ||
// 2nd condition for horizontal swipe met | ||
this._touch.dist.x < 0 ? this._slide('next') : this._slide('previous'); // if dist traveled is negative, it indicates left swipe | ||
} | ||
} | ||
} | ||
e = e ? e : window.event; | ||
e = ('changedTouches' in e) ? e.changedTouches[0] : e; | ||
this._touch.dist = { | ||
x: e.pageX - this._touch.start.x, // get horizontal dist traveled by finger while in contact with surface | ||
y: e.pageY - this._touch.start.y // get vertical dist traveled by finger while in contact with surface | ||
}; | ||
/** | ||
* Initiate Navigation area and Previous/Next buttons | ||
* @method _initNavigation | ||
* @return {[type]} [description] | ||
*/ | ||
this._handleGesture(); | ||
} | ||
}, { | ||
key: '_initNavigation', | ||
value: function _initNavigation() { | ||
this.previousControl = this.element.querySelector('.carousel-nav-left'); | ||
this.nextControl = this.element.querySelector('.carousel-nav-right'); | ||
/** | ||
* Identify the gestureand slide if necessary | ||
* @method _handleGesture | ||
* @return {void} | ||
*/ | ||
_handleGesture() { | ||
const elapsedTime = new Date().getTime() - this._touch.start.time; // get time elapsed | ||
if (elapsedTime <= this.options.allowedTime) { // first condition for awipe met | ||
if (Math.abs(this._touch.dist.x) >= this.options.threshold && Math.abs(this._touch.dist.y) <= this.options.restraint) { // 2nd condition for horizontal swipe met | ||
(this._touch.dist.x < 0) | ||
? this._slide('next') | ||
: this._slide('previous'); // if dist traveled is negative, it indicates left swipe | ||
if (this.items.length <= 1 || this.forceHiddenNavigation) { | ||
if (this.container) { | ||
this.container.style.left = '0'; | ||
} | ||
if (this.previousControl) { | ||
this.previousControl.style.display = 'none'; | ||
} | ||
if (this.nextControl) { | ||
this.nextControl.style.display = 'none'; | ||
} | ||
} | ||
} | ||
} | ||
/** | ||
* Initiate Navigation area and Previous/Next buttons | ||
* @method _initNavigation | ||
* @return {[type]} [description] | ||
*/ | ||
_initNavigation() { | ||
this.previousControl = this.element.querySelector('.carousel-nav-left'); | ||
this.nextControl = this.element.querySelector('.carousel-nav-right'); | ||
/** | ||
* Update each item order | ||
* @method _setOrder | ||
*/ | ||
if (this.items.length <= 1 || this.forceHiddenNavigation) { | ||
if (this.container) { | ||
this.container.style.left = '0'; | ||
}, { | ||
key: '_setOrder', | ||
value: function _setOrder() { | ||
this.currentItem.node.style.order = '1'; | ||
this.currentItem.node.style.zIndex = '1'; | ||
var item = this.currentItem.node; | ||
var i = void 0, | ||
j = void 0, | ||
ref = void 0; | ||
for (i = j = 2, ref = Array.from(this.items).length; 2 <= ref ? j <= ref : j >= ref; i = 2 <= ref ? ++j : --j) { | ||
item = this._next(item); | ||
item.style.order = '' + i % Array.from(this.items).length; | ||
item.style.zIndex = '0'; | ||
} | ||
if (this.previousControl) { | ||
this.previousControl.style.display = 'none'; | ||
} | ||
/** | ||
* Find next item to display | ||
* @method _next | ||
* @param {Node} element Current Node element | ||
* @return {Node} Next Node element | ||
*/ | ||
}, { | ||
key: '_next', | ||
value: function _next(element) { | ||
if (element.nextElementSibling) { | ||
return element.nextElementSibling; | ||
} else { | ||
return this.items[0]; | ||
} | ||
if (this.nextControl) { | ||
this.nextControl.style.display = 'none'; | ||
} | ||
/** | ||
* Find previous item to display | ||
* @method _previous | ||
* @param {Node} element Current Node element | ||
* @return {Node} Previous Node element | ||
*/ | ||
}, { | ||
key: '_previous', | ||
value: function _previous(element) { | ||
if (element.previousElementSibling) { | ||
return element.previousElementSibling; | ||
} else { | ||
return this.items[this.items.length - 1]; | ||
} | ||
} | ||
} | ||
/** | ||
* Update each item order | ||
* @method _setOrder | ||
*/ | ||
_setOrder() { | ||
this.currentItem.node.style.order = '1'; | ||
this.currentItem.node.style.zIndex = '1'; | ||
let item = this.currentItem.node; | ||
let i, | ||
j, | ||
ref; | ||
for ( | ||
i = j = 2, ref = Array.from(this.items).length; ( | ||
2 <= ref | ||
? j <= ref | ||
: j >= ref); i = 2 <= ref | ||
? ++j | ||
: --j) { | ||
item = this._next(item); | ||
item.style.order = '' + i % Array.from(this.items).length; | ||
item.style.zIndex = '0'; | ||
/** | ||
* Update slides to display the wanted one | ||
* @method _slide | ||
* @param {String} [direction='next'] Direction in which items need to move | ||
* @return {void} | ||
*/ | ||
}, { | ||
key: '_slide', | ||
value: function _slide() { | ||
var _this4 = this; | ||
var direction = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'next'; | ||
if (this.items.length) { | ||
this.oldItemNode = this.currentItem.node; | ||
this.emit(BULMA_CAROUSEL_EVENTS.slideBefore, this.currentItem); | ||
// initialize direction to change order | ||
if (direction === 'previous') { | ||
this.currentItem.node = this._previous(this.currentItem.node); | ||
// add reverse class | ||
if (!this.element.classList.contains('carousel-animate-fade')) { | ||
this.element.classList.add('is-reversing'); | ||
this.container.style.transform = 'translateX(' + -Math.abs(this.offset) + 'px)'; | ||
} | ||
} else { | ||
// Reorder items | ||
this.currentItem.node = this._next(this.currentItem.node); | ||
// re_slide reverse class | ||
this.element.classList.remove('is-reversing'); | ||
this.container.style.transform = 'translateX(' + Math.abs(this.offset) + 'px)'; | ||
} | ||
this.currentItem.node.classList.add('is-active'); | ||
this.oldItemNode.classList.remove('is-active'); | ||
// Disable transition to instant change order | ||
this.element.classList.remove('carousel-animated'); | ||
// Enable transition to animate order 1 to order 2 | ||
setTimeout(function () { | ||
_this4.element.classList.add('carousel-animated'); | ||
}, 50); | ||
this._setOrder(); | ||
this.emit(BULMA_CAROUSEL_EVENTS.slideAfter, this.currentItem); | ||
} | ||
} | ||
} | ||
/** | ||
* Find next item to display | ||
* @method _next | ||
* @param {Node} element Current Node element | ||
* @return {Node} Next Node element | ||
*/ | ||
_next(element) { | ||
if (element.nextElementSibling) { | ||
return element.nextElementSibling; | ||
} else { | ||
return this.items[0]; | ||
/** | ||
* Initiate autoplay system | ||
* @method _autoPlay | ||
* @param {Number} [delay=5000] Delay between slides in milliseconds | ||
* @return {void} | ||
*/ | ||
}, { | ||
key: '_autoPlay', | ||
value: function _autoPlay() { | ||
var _this5 = this; | ||
var delay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 5000; | ||
this._autoPlayInterval = setInterval(function () { | ||
_this5._slide('next'); | ||
}, delay); | ||
} | ||
} | ||
}], [{ | ||
key: 'attach', | ||
value: function attach() { | ||
var selector = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '.carousel, .hero-carousel'; | ||
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
/** | ||
* Find previous item to display | ||
* @method _previous | ||
* @param {Node} element Current Node element | ||
* @return {Node} Previous Node element | ||
*/ | ||
_previous(element) { | ||
if (element.previousElementSibling) { | ||
return element.previousElementSibling; | ||
} else { | ||
return this.items[this.items.length - 1]; | ||
var instances = new Array(); | ||
var elements = document.querySelectorAll(selector); | ||
[].forEach.call(elements, function (element) { | ||
setTimeout(function () { | ||
instances.push(new bulmaCarousel(element, options)); | ||
}, 100); | ||
}); | ||
return instances; | ||
} | ||
}]); | ||
return bulmaCarousel; | ||
}(__WEBPACK_IMPORTED_MODULE_0__events__["a" /* default */]); | ||
/* harmony default export */ __webpack_exports__["default"] = (bulmaCarousel); | ||
/***/ }), | ||
/* 1 */ | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
"use strict"; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
var EventEmitter = function () { | ||
function EventEmitter() { | ||
var listeners = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; | ||
_classCallCheck(this, EventEmitter); | ||
this._listeners = new Map(listeners); | ||
this._middlewares = new Map(); | ||
} | ||
/** | ||
* Update slides to display the wanted one | ||
* @method _slide | ||
* @param {String} [direction='next'] Direction in which items need to move | ||
* @return {void} | ||
*/ | ||
_slide(direction = 'next') { | ||
if (this.items.length) { | ||
this.oldItemNode = this.currentItem.node; | ||
this.emit(BULMA_CAROUSEL_EVENTS.slideBefore, this.currentItem); | ||
// initialize direction to change order | ||
if (direction === 'previous') { | ||
this.currentItem.node = this._previous(this.currentItem.node); | ||
// add reverse class | ||
if (!this.element.classList.contains('carousel-animate-fade')) { | ||
this.element.classList.add('is-reversing'); | ||
this.container.style.transform = `translateX(${ - Math.abs(this.offset)}px)`; | ||
_createClass(EventEmitter, [{ | ||
key: "listenerCount", | ||
value: function listenerCount(eventName) { | ||
if (!this._listeners.has(eventName)) { | ||
return 0; | ||
} | ||
var eventListeners = this._listeners.get(eventName); | ||
return eventListeners.length; | ||
} | ||
}, { | ||
key: "removeListeners", | ||
value: function removeListeners() { | ||
var _this = this; | ||
var eventName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; | ||
var middleware = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; | ||
if (eventName !== null) { | ||
if (Array.isArray(eventName)) { | ||
name.forEach(function (e) { | ||
return _this.removeListeners(e, middleware); | ||
}); | ||
} else { | ||
this._listeners.delete(eventName); | ||
if (middleware) { | ||
this.removeMiddleware(eventName); | ||
} | ||
} | ||
} else { | ||
// Reorder items | ||
this.currentItem.node = this._next(this.currentItem.node); | ||
// re_slide reverse class | ||
this.element.classList.remove('is-reversing'); | ||
this.container.style.transform = `translateX(${Math.abs(this.offset)}px)`; | ||
this._listeners = new Map(); | ||
} | ||
this.currentItem.node.classList.add('is-active'); | ||
this.oldItemNode.classList.remove('is-active'); | ||
} | ||
}, { | ||
key: "middleware", | ||
value: function middleware(eventName, fn) { | ||
var _this2 = this; | ||
// Disable transition to instant change order | ||
this.element.classList.remove('carousel-animated'); | ||
// Enable transition to animate order 1 to order 2 | ||
setTimeout(() => { | ||
this.element.classList.add('carousel-animated'); | ||
}, 50); | ||
if (Array.isArray(eventName)) { | ||
name.forEach(function (e) { | ||
return _this2.middleware(e, fn); | ||
}); | ||
} else { | ||
if (!Array.isArray(this._middlewares.get(eventName))) { | ||
this._middlewares.set(eventName, []); | ||
} | ||
this._setOrder(); | ||
this.emit(BULMA_CAROUSEL_EVENTS.slideAfter, this.currentItem); | ||
this._middlewares.get(eventName).push(fn); | ||
} | ||
} | ||
} | ||
}, { | ||
key: "removeMiddleware", | ||
value: function removeMiddleware() { | ||
var _this3 = this; | ||
/** | ||
* Initiate autoplay system | ||
* @method _autoPlay | ||
* @param {Number} [delay=5000] Delay between slides in milliseconds | ||
* @return {void} | ||
*/ | ||
_autoPlay(delay = 5000) { | ||
this._autoPlayInterval = setInterval(() => { | ||
this._slide('next'); | ||
}, delay); | ||
} | ||
} | ||
var eventName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; | ||
return bulmaCarousel; | ||
if (eventName !== null) { | ||
if (Array.isArray(eventName)) { | ||
name.forEach(function (e) { | ||
return _this3.removeMiddleware(e); | ||
}); | ||
} else { | ||
this._middlewares.delete(eventName); | ||
} | ||
} else { | ||
this._middlewares = new Map(); | ||
} | ||
} | ||
}, { | ||
key: "on", | ||
value: function on(name, callback) { | ||
var _this4 = this; | ||
}))); | ||
var once = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; | ||
if (Array.isArray(name)) { | ||
name.forEach(function (e) { | ||
return _this4.on(e, callback); | ||
}); | ||
} else { | ||
name = name.toString(); | ||
var split = name.split(/,|, | /); | ||
if (split.length > 1) { | ||
split.forEach(function (e) { | ||
return _this4.on(e, callback); | ||
}); | ||
} else { | ||
if (!Array.isArray(this._listeners.get(name))) { | ||
this._listeners.set(name, []); | ||
} | ||
this._listeners.get(name).push({ once: once, callback: callback }); | ||
} | ||
} | ||
} | ||
}, { | ||
key: "once", | ||
value: function once(name, callback) { | ||
this.on(name, callback, true); | ||
} | ||
}, { | ||
key: "emit", | ||
value: function emit(name, data) { | ||
var _this5 = this; | ||
var silent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; | ||
name = name.toString(); | ||
var listeners = this._listeners.get(name); | ||
var middlewares = null; | ||
var doneCount = 0; | ||
var execute = silent; | ||
if (Array.isArray(listeners)) { | ||
listeners.forEach(function (listener, index) { | ||
// Start Middleware checks unless we're doing a silent emit | ||
if (!silent) { | ||
middlewares = _this5._middlewares.get(name); | ||
// Check and execute Middleware | ||
if (Array.isArray(middlewares)) { | ||
middlewares.forEach(function (middleware) { | ||
middleware(data, function () { | ||
var newData = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; | ||
if (newData !== null) { | ||
data = newData; | ||
} | ||
doneCount++; | ||
}, name); | ||
}); | ||
if (doneCount >= middlewares.length) { | ||
execute = true; | ||
} | ||
} else { | ||
execute = true; | ||
} | ||
} | ||
// If Middleware checks have been passed, execute | ||
if (execute) { | ||
if (listener.once) { | ||
listeners[index] = null; | ||
} | ||
listener.callback(data); | ||
} | ||
}); | ||
// Dirty way of removing used Events | ||
while (listeners.indexOf(null) !== -1) { | ||
listeners.splice(listeners.indexOf(null), 1); | ||
} | ||
} | ||
} | ||
}]); | ||
return EventEmitter; | ||
}(); | ||
/* harmony default export */ __webpack_exports__["a"] = (EventEmitter); | ||
/***/ }), | ||
/* 2 */ | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
"use strict"; | ||
var defaultOptions = { | ||
size: 1, | ||
autoplay: false, | ||
delay: 5000, | ||
threshold: 50, //required min distance traveled to be considered swipe | ||
restraint: 100, // maximum distance allowed at the same time in perpendicular direction | ||
allowedTime: 500 // maximum time allowed to travel that distance | ||
}; | ||
/* harmony default export */ __webpack_exports__["a"] = (defaultOptions); | ||
/***/ }) | ||
/******/ ])["default"]; | ||
}); |
@@ -1,1 +0,1 @@ | ||
(function(a,b){"object"==typeof exports&&"undefined"!=typeof module?module.exports=b():"function"==typeof define&&define.amd?define("bulmaCarousel",b):a.bulmaCarousel=b()})(this,function(){"use strict";var a=Math.abs;class b{constructor(a=[]){this._listeners=new Map(a),this._middlewares=new Map}listenerCount(a){if(!this._listeners.has(a))return 0;const b=this._listeners.get(a);return b.length}removeListeners(a=null,b=!1){null===a?this._listeners=new Map:Array.isArray(a)?name.forEach(a=>this.removeListeners(a,b)):(this._listeners.delete(a),b&&this.removeMiddleware(a))}middleware(a,b){Array.isArray(a)?name.forEach(a=>this.middleware(a,b)):(!Array.isArray(this._middlewares.get(a))&&this._middlewares.set(a,[]),this._middlewares.get(a).push(b))}removeMiddleware(a=null){null===a?this._middlewares=new Map:Array.isArray(a)?name.forEach(a=>this.removeMiddleware(a)):this._middlewares.delete(a)}on(a,b,c=!1){if(Array.isArray(a))a.forEach(a=>this.on(a,b));else{a=a.toString();const d=a.split(/,|, | /);1<d.length?d.forEach(a=>this.on(a,b)):(!Array.isArray(this._listeners.get(a))&&this._listeners.set(a,[]),this._listeners.get(a).push({once:c,callback:b}))}}once(a,b){this.on(a,b,!0)}emit(a,b,c=!1){a=a.toString();let d=this._listeners.get(a),e=null,f=0,g=c;if(Array.isArray(d))for(d.forEach((h,i)=>{c||(e=this._middlewares.get(a),Array.isArray(e)?(e.forEach(c=>{c(b,(a=null)=>{null!==a&&(b=a),f++},a)}),f>=e.length&&(g=!0)):g=!0),g&&(h.once&&(d[i]=null),h.callback(b))});-1!==d.indexOf(null);)d.splice(d.indexOf(null),1)}}const c={size:1,autoplay:!1,delay:5e3,threshold:50,restraint:100,allowedTime:500},d={ready:"carousel:ready",slideBefore:"carousel:slide:before",slideAfter:"carousel:slide:after"},f=Symbol("onSwipeStart"),g=Symbol("onSwipeMove"),h=Symbol("onSwipeEnd");var i=!1;try{var e=Object.defineProperty({},"passive",{get:function(){i=!0}});window.addEventListener("testPassive",null,e),window.removeEventListener("testPassive",null,e)}catch(a){}class j extends b{constructor(a,b={}){if(super(),this.element="string"==typeof a?document.querySelector(a):a,!this.element)throw new Error("An invalid selector or non-DOM node has been provided.");this._clickEvents=["click"],this.options=Object.assign({},c,b),this.element.dataset.autoplay&&(this.options.autoplay=this.element.dataset.autoplay),this.element.dataset.delay&&(this.options.delay=this.element.dataset.delay),this.element.dataset.size&&!this.element.classList.contains("carousel-animate-fade")&&(this.options.size=this.element.dataset.size),this.element.classList.contains("carousel-animate-fade")&&(this.options.size=1),this.forceHiddenNavigation=!1,this[f]=this[f].bind(this),this[g]=this[g].bind(this),this[h]=this[h].bind(this),this.init()}static attach(a=".carousel, .hero-carousel",b={}){let c=[];const d=document.querySelectorAll(a);return[].forEach.call(d,a=>{setTimeout(()=>{c.push(new j(a,b))},100)}),c}init(){this.container=this.element.querySelector(".carousel-container"),this.items=this.element.querySelectorAll(".carousel-item"),this.currentItem={element:this.element,node:this.element.querySelector(".carousel-item.is-active"),pos:-1},this.currentItem.pos=this.currentItem.node?Array.from(this.items).indexOf(this.currentItem.node):-1,this.currentItem.node||(this.currentItem.node=this.items[0],this.currentItem.node.classList.add("is-active"),this.currentItem.pos=0),this.forceHiddenNavigation=1>=this.items.length;let a=this.element.querySelectorAll("img");[].forEach.call(a,a=>{a.setAttribute("draggable",!1)}),this._resize(),this._setOrder(),this._initNavigation(),this._bindEvents(),this.options.autoplay&&this._autoPlay(this.options.delay),this.emit(d.ready,this.currentItem)}_resize(){const a=window.getComputedStyle(this.element),b=parseInt(a.getPropertyValue("width"),10);if(1<this.options.size&&(this.offset=this.options.size>=Array.from(this.items).length?0:b/this.options.size,this.container.style.left=0-this.offset+"px",this.container.style.transform=`translateX(${this.offset}px)`,[].forEach.call(this.items,a=>{a.style.flexBasis=`${this.offset}px`})),this.element.classList.contains("carousel-animate-fade")&&this.items.length){let a=this.items[0].querySelector("img"),c=1;a.naturalWidth?(c=b/a.naturalWidth,this.container.style.height=a.naturalHeight*c+"px"):a.onload=()=>{c=b/a.naturalWidth,this.container.style.height=a.naturalHeight*c+"px"}}}_bindEvents(){this.previousControl&&this._clickEvents.forEach(a=>{this.previousControl.addEventListener(a,a=>{i||a.preventDefault(),this._autoPlayInterval&&(clearInterval(this._autoPlayInterval),this._autoPlay(this.optionsdelay)),this._slide("previous")},!!i&&{passive:!0})}),this.nextControl&&this._clickEvents.forEach(a=>{this.nextControl.addEventListener(a,a=>{i||a.preventDefault(),this._autoPlayInterval&&(clearInterval(this._autoPlayInterval),this._autoPlay(this.options.delay)),this._slide("next")},!!i&&{passive:!0})}),this.element.addEventListener("touchstart",this[f],!!i&&{passive:!0}),this.element.addEventListener("mousedown",this[f],!!i&&{passive:!0}),this.element.addEventListener("touchmove",this[g],!!i&&{passive:!0}),this.element.addEventListener("mousemove",this[g],!!i&&{passive:!0}),this.element.addEventListener("touchend",this[h],!!i&&{passive:!0}),this.element.addEventListener("mouseup",this[h],!!i&&{passive:!0})}destroy(){this.element.removeEventListener("touchstart",this[f],!!i&&{passive:!0}),this.element.removeEventListener("mousedown",this[f],!!i&&{passive:!0}),this.element.removeEventListener("touchmove",this[g],!!i&&{passive:!0}),this.element.removeEventListener("mousemove",this[g],!!i&&{passive:!0}),this.element.removeEventListener("touchend",this[h],!!i&&{passive:!0}),this.element.removeEventListener("mouseup",this[h],!!i&&{passive:!0})}[f](a){i||a.preventDefault(),a=a?a:window.event,a="changedTouches"in a?a.changedTouches[0]:a,this._touch={start:{time:new Date().getTime(),x:a.pageX,y:a.pageY},dist:{x:0,y:0}}}[g](a){i||a.preventDefault()}[h](a){i||a.preventDefault(),a=a?a:window.event,a="changedTouches"in a?a.changedTouches[0]:a,this._touch.dist={x:a.pageX-this._touch.start.x,y:a.pageY-this._touch.start.y},this._handleGesture()}_handleGesture(){const b=new Date().getTime()-this._touch.start.time;b<=this.options.allowedTime&&a(this._touch.dist.x)>=this.options.threshold&&a(this._touch.dist.y)<=this.options.restraint&&(0>this._touch.dist.x?this._slide("next"):this._slide("previous"))}_initNavigation(){this.previousControl=this.element.querySelector(".carousel-nav-left"),this.nextControl=this.element.querySelector(".carousel-nav-right"),(1>=this.items.length||this.forceHiddenNavigation)&&(this.container&&(this.container.style.left="0"),this.previousControl&&(this.previousControl.style.display="none"),this.nextControl&&(this.nextControl.style.display="none"))}_setOrder(){this.currentItem.node.style.order="1",this.currentItem.node.style.zIndex="1";let a,b,c,d=this.currentItem.node;for(a=b=2,c=Array.from(this.items).length;2<=c?b<=c:b>=c;a=2<=c?++b:--b)d=this._next(d),d.style.order=""+a%Array.from(this.items).length,d.style.zIndex="0"}_next(a){return a.nextElementSibling?a.nextElementSibling:this.items[0]}_previous(a){return a.previousElementSibling?a.previousElementSibling:this.items[this.items.length-1]}_slide(b="next"){this.items.length&&(this.oldItemNode=this.currentItem.node,this.emit(d.slideBefore,this.currentItem),"previous"===b?(this.currentItem.node=this._previous(this.currentItem.node),!this.element.classList.contains("carousel-animate-fade")&&(this.element.classList.add("is-reversing"),this.container.style.transform=`translateX(${-a(this.offset)}px)`)):(this.currentItem.node=this._next(this.currentItem.node),this.element.classList.remove("is-reversing"),this.container.style.transform=`translateX(${a(this.offset)}px)`),this.currentItem.node.classList.add("is-active"),this.oldItemNode.classList.remove("is-active"),this.element.classList.remove("carousel-animated"),setTimeout(()=>{this.element.classList.add("carousel-animated")},50),this._setOrder(),this.emit(d.slideAfter,this.currentItem))}_autoPlay(a=5e3){this._autoPlayInterval=setInterval(()=>{this._slide("next")},a)}}return j}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.bulmaCarousel=t():e.bulmaCarousel=t()}("undefined"!=typeof self?self:this,function(){return function(n){var i={};function s(e){if(i[e])return i[e].exports;var t=i[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,s),t.l=!0,t.exports}return s.m=n,s.c=i,s.d=function(e,t,n){s.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,"a",t),t},s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.p="",s(s.s=0)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),r=n(2),o=function(){function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}}();var a="carousel:ready",l="carousel:slide:before",u="carousel:slide:after",h=Symbol("onSwipeStart"),c=Symbol("onSwipeMove"),d=Symbol("onSwipeEnd"),f=!1;try{var s=Object.defineProperty({},"passive",{get:function(){f=!0}});window.addEventListener("testPassive",null,s),window.removeEventListener("testPassive",null,s)}catch(e){}var v=function(e){function s(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(s.__proto__||Object.getPrototypeOf(s)).call(this));if(n.element="string"==typeof e?document.querySelector(e):e,!n.element)throw new Error("An invalid selector or non-DOM node has been provided.");return n._clickEvents=["click"],n.options=Object.assign({},r.a,t),n.element.dataset.autoplay&&(n.options.autoplay=n.element.dataset.autoplay),n.element.dataset.delay&&(n.options.delay=n.element.dataset.delay),n.element.dataset.size&&!n.element.classList.contains("carousel-animate-fade")&&(n.options.size=n.element.dataset.size),n.element.classList.contains("carousel-animate-fade")&&(n.options.size=1),n.forceHiddenNavigation=!1,n[h]=n[h].bind(n),n[c]=n[c].bind(n),n[d]=n[d].bind(n),n.init(),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(s,i["a"]),o(s,[{key:"init",value:function(){this.container=this.element.querySelector(".carousel-container"),this.items=this.element.querySelectorAll(".carousel-item"),this.currentItem={element:this.element,node:this.element.querySelector(".carousel-item.is-active"),pos:-1},this.currentItem.pos=this.currentItem.node?Array.from(this.items).indexOf(this.currentItem.node):-1,this.currentItem.node||(this.currentItem.node=this.items[0],this.currentItem.node.classList.add("is-active"),this.currentItem.pos=0),this.forceHiddenNavigation=this.items.length<=1;var e=this.element.querySelectorAll("img");[].forEach.call(e,function(e){e.setAttribute("draggable",!1)}),this._resize(),this._setOrder(),this._initNavigation(),this._bindEvents(),this.options.autoplay&&this._autoPlay(this.options.delay),this.emit(a,this.currentItem)}},{key:"_resize",value:function(){var t=this,e=window.getComputedStyle(this.element),n=parseInt(e.getPropertyValue("width"),10);if(1<this.options.size&&(this.options.size>=Array.from(this.items).length?this.offset=0:this.offset=n/this.options.size,this.container.style.left=0-this.offset+"px",this.container.style.transform="translateX("+this.offset+"px)",[].forEach.call(this.items,function(e){e.style.flexBasis=t.offset+"px"})),this.element.classList.contains("carousel-animate-fade")&&this.items.length){var i=this.items[0].querySelector("img"),s=1;i.naturalWidth?(s=n/i.naturalWidth,this.container.style.height=i.naturalHeight*s+"px"):i.onload=function(){s=n/i.naturalWidth,t.container.style.height=i.naturalHeight*s+"px"}}}},{key:"_bindEvents",value:function(){var t=this;this.previousControl&&this._clickEvents.forEach(function(e){t.previousControl.addEventListener(e,function(e){f||e.preventDefault(),t._autoPlayInterval&&(clearInterval(t._autoPlayInterval),t._autoPlay(t.optionsdelay)),t._slide("previous")},!!f&&{passive:!0})}),this.nextControl&&this._clickEvents.forEach(function(e){t.nextControl.addEventListener(e,function(e){f||e.preventDefault(),t._autoPlayInterval&&(clearInterval(t._autoPlayInterval),t._autoPlay(t.options.delay)),t._slide("next")},!!f&&{passive:!0})}),this.element.addEventListener("touchstart",this[h],!!f&&{passive:!0}),this.element.addEventListener("mousedown",this[h],!!f&&{passive:!0}),this.element.addEventListener("touchmove",this[c],!!f&&{passive:!0}),this.element.addEventListener("mousemove",this[c],!!f&&{passive:!0}),this.element.addEventListener("touchend",this[d],!!f&&{passive:!0}),this.element.addEventListener("mouseup",this[d],!!f&&{passive:!0})}},{key:"destroy",value:function(){this.element.removeEventListener("touchstart",this[h],!!f&&{passive:!0}),this.element.removeEventListener("mousedown",this[h],!!f&&{passive:!0}),this.element.removeEventListener("touchmove",this[c],!!f&&{passive:!0}),this.element.removeEventListener("mousemove",this[c],!!f&&{passive:!0}),this.element.removeEventListener("touchend",this[d],!!f&&{passive:!0}),this.element.removeEventListener("mouseup",this[d],!!f&&{passive:!0})}},{key:h,value:function(e){f||e.preventDefault(),e="changedTouches"in(e=e||window.event)?e.changedTouches[0]:e,this._touch={start:{time:(new Date).getTime(),x:e.pageX,y:e.pageY},dist:{x:0,y:0}}}},{key:c,value:function(e){f||e.preventDefault()}},{key:d,value:function(e){f||e.preventDefault(),e="changedTouches"in(e=e||window.event)?e.changedTouches[0]:e,this._touch.dist={x:e.pageX-this._touch.start.x,y:e.pageY-this._touch.start.y},this._handleGesture()}},{key:"_handleGesture",value:function(){(new Date).getTime()-this._touch.start.time<=this.options.allowedTime&&Math.abs(this._touch.dist.x)>=this.options.threshold&&Math.abs(this._touch.dist.y)<=this.options.restraint&&(this._touch.dist.x<0?this._slide("next"):this._slide("previous"))}},{key:"_initNavigation",value:function(){this.previousControl=this.element.querySelector(".carousel-nav-left"),this.nextControl=this.element.querySelector(".carousel-nav-right"),(this.items.length<=1||this.forceHiddenNavigation)&&(this.container&&(this.container.style.left="0"),this.previousControl&&(this.previousControl.style.display="none"),this.nextControl&&(this.nextControl.style.display="none"))}},{key:"_setOrder",value:function(){this.currentItem.node.style.order="1",this.currentItem.node.style.zIndex="1";var e,t=this.currentItem.node,n=void 0,i=void 0;for(n=i=2,e=Array.from(this.items).length;2<=e?i<=e:e<=i;n=2<=e?++i:--i)(t=this._next(t)).style.order=""+n%Array.from(this.items).length,t.style.zIndex="0"}},{key:"_next",value:function(e){return e.nextElementSibling?e.nextElementSibling:this.items[0]}},{key:"_previous",value:function(e){return e.previousElementSibling?e.previousElementSibling:this.items[this.items.length-1]}},{key:"_slide",value:function(){var e=this,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"next";this.items.length&&(this.oldItemNode=this.currentItem.node,this.emit(l,this.currentItem),"previous"===t?(this.currentItem.node=this._previous(this.currentItem.node),this.element.classList.contains("carousel-animate-fade")||(this.element.classList.add("is-reversing"),this.container.style.transform="translateX("+-Math.abs(this.offset)+"px)")):(this.currentItem.node=this._next(this.currentItem.node),this.element.classList.remove("is-reversing"),this.container.style.transform="translateX("+Math.abs(this.offset)+"px)"),this.currentItem.node.classList.add("is-active"),this.oldItemNode.classList.remove("is-active"),this.element.classList.remove("carousel-animated"),setTimeout(function(){e.element.classList.add("carousel-animated")},50),this._setOrder(),this.emit(u,this.currentItem))}},{key:"_autoPlay",value:function(){var e=this,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:5e3;this._autoPlayInterval=setInterval(function(){e._slide("next")},t)}}],[{key:"attach",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:".carousel, .hero-carousel",t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},n=new Array,i=document.querySelectorAll(e);return[].forEach.call(i,function(e){setTimeout(function(){n.push(new s(e,t))},100)}),n}}]),s}();t.default=v},function(e,t,n){"use strict";var i=function(){function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}}();var s=function(){function t(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[];!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this._listeners=new Map(e),this._middlewares=new Map}return i(t,[{key:"listenerCount",value:function(e){return this._listeners.has(e)?this._listeners.get(e).length:0}},{key:"removeListeners",value:function(){var t=this,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null,n=1<arguments.length&&void 0!==arguments[1]&&arguments[1];null!==e?Array.isArray(e)?name.forEach(function(e){return t.removeListeners(e,n)}):(this._listeners.delete(e),n&&this.removeMiddleware(e)):this._listeners=new Map}},{key:"middleware",value:function(e,t){var n=this;Array.isArray(e)?name.forEach(function(e){return n.middleware(e,t)}):(Array.isArray(this._middlewares.get(e))||this._middlewares.set(e,[]),this._middlewares.get(e).push(t))}},{key:"removeMiddleware",value:function(){var t=this,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null;null!==e?Array.isArray(e)?name.forEach(function(e){return t.removeMiddleware(e)}):this._middlewares.delete(e):this._middlewares=new Map}},{key:"on",value:function(e,t){var n=this,i=2<arguments.length&&void 0!==arguments[2]&&arguments[2];if(Array.isArray(e))e.forEach(function(e){return n.on(e,t)});else{var s=(e=e.toString()).split(/,|, | /);1<s.length?s.forEach(function(e){return n.on(e,t)}):(Array.isArray(this._listeners.get(e))||this._listeners.set(e,[]),this._listeners.get(e).push({once:i,callback:t}))}}},{key:"once",value:function(e,t){this.on(e,t,!0)}},{key:"emit",value:function(n,i){var s=this,r=2<arguments.length&&void 0!==arguments[2]&&arguments[2];n=n.toString();var o=this._listeners.get(n),a=null,l=0,u=r;if(Array.isArray(o))for(o.forEach(function(e,t){r||(a=s._middlewares.get(n),Array.isArray(a)?(a.forEach(function(e){e(i,function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null;null!==e&&(i=e),l++},n)}),l>=a.length&&(u=!0)):u=!0),u&&(e.once&&(o[t]=null),e.callback(i))});-1!==o.indexOf(null);)o.splice(o.indexOf(null),1)}}]),t}();t.a=s},function(e,t,n){"use strict";t.a={size:1,autoplay:!1,delay:5e3,threshold:50,restraint:100,allowedTime:500}}]).default}); |
@@ -0,1 +1,48 @@ | ||
<a name="1.2.0"></a> | ||
# [1.2.0](https://github.com/Wikiki/bulma-pricingtable/compare/1.1.0...1.2.0) (2018-04-13) | ||
<a name="1.1.0"></a> | ||
# [1.1.0](https://github.com/Wikiki/bulma-pricingtable/compare/0.1.7...1.1.0) (2018-04-13) | ||
### Bug Fixes | ||
* **gulp:** Correct dist filenames ([2fe00d0](https://github.com/Wikiki/bulma-pricingtable/commit/2fe00d0)) | ||
* **gulp:** Remove Bulma’s important from dist’sass ([3a763e4](https://github.com/Wikiki/bulma-pricingtable/commit/3a763e4)) | ||
* **gulp:** Use UMD modules style ([9033d39](https://github.com/Wikiki/bulma-pricingtable/commit/9033d39)) | ||
* **pacjage:** Correct file paths ([faa9bd7](https://github.com/Wikiki/bulma-pricingtable/commit/faa9bd7)) | ||
* **travis:** Remove configuration ([892419e](https://github.com/Wikiki/bulma-pricingtable/commit/892419e)) | ||
<a name="1.0.0"></a> | ||
# [1.0.0](https://github.com/Wikiki/bulma-pricingtable/compare/0.1.7...1.0.0) (2018-04-13) | ||
### Bug Fixes | ||
* **gulp:** Correct dist filenames ([2fe00d0](https://github.com/Wikiki/bulma-pricingtable/commit/2fe00d0)) | ||
* **gulp:** Remove Bulma’s important from dist’sass ([3a763e4](https://github.com/Wikiki/bulma-pricingtable/commit/3a763e4)) | ||
* **gulp:** Use UMD modules style ([9033d39](https://github.com/Wikiki/bulma-pricingtable/commit/9033d39)) | ||
* **pacjage:** Correct file paths ([faa9bd7](https://github.com/Wikiki/bulma-pricingtable/commit/faa9bd7)) | ||
* **travis:** Remove configuration ([892419e](https://github.com/Wikiki/bulma-pricingtable/commit/892419e)) | ||
<a name="0.1.9"></a> | ||
## [0.1.9](https://github.com/Wikiki/bulma-pricingtable/compare/0.1.7...0.1.9) (2018-04-13) | ||
### Bug Fixes | ||
* **gulp:** Correct dist filenames ([2fe00d0](https://github.com/Wikiki/bulma-pricingtable/commit/2fe00d0)) | ||
* **gulp:** Remove Bulma’s important from dist’sass ([3a763e4](https://github.com/Wikiki/bulma-pricingtable/commit/3a763e4)) | ||
* **gulp:** Use UMD modules style ([9033d39](https://github.com/Wikiki/bulma-pricingtable/commit/9033d39)) | ||
* **pacjage:** Correct file paths ([faa9bd7](https://github.com/Wikiki/bulma-pricingtable/commit/faa9bd7)) | ||
* **travis:** Remove configuration ([892419e](https://github.com/Wikiki/bulma-pricingtable/commit/892419e)) | ||
<a name="0.1.8"></a> | ||
@@ -2,0 +49,0 @@ ## [0.1.8](https://github.com/Wikiki/bulma-pricingtable/compare/0.1.7...0.1.8) (2018-02-11) |
131
package.json
{ | ||
"name": "bulma-extensions", | ||
"description": "Set of extensions for Bulma.io CSS Framework", | ||
"main": "dist/extensions.sass", | ||
"main": "./dist/js/bulma-extensions.min.js", | ||
"style": "./dist/css/bulma-extensions.moin.css", | ||
"version": "2.0.0", | ||
"scripts": { | ||
"build": "gulp", | ||
"commit": "git-cz", | ||
"precommit": "npm test", | ||
"travis-deploy-once": "travis-deploy-once", | ||
"semantic-release": "semantic-release pre && npm publish && semantic-release post" | ||
"semantic-release": "semantic-release", | ||
"watch:test": "jest test/index.test.js -w", | ||
"test": "jest test/index.test.js" | ||
}, | ||
@@ -26,102 +32,43 @@ "repository": { | ||
"devDependencies": { | ||
"@babel/core": "^7.0.0-beta.39", | ||
"@babel/preset-env": "^7.0.0-beta.39", | ||
"babel-core": "^7.0.0-beta.3", | ||
"ansi-colors": "^2.0.1", | ||
"autoprefixer": "^8.6.2", | ||
"babel-core": "^6.26.3", | ||
"babel-jest": "^23.0.1", | ||
"babel-loader": "^7.1.4", | ||
"babel-plugin-transform-object-rest-spread": "^6.26.0", | ||
"bulma": "^0.6.2", | ||
"camelcase": "^4.1.0", | ||
"conventional-github-releaser": "^2.0.0", | ||
"babel-preset-env": "^1.7.0", | ||
"bulma": "^0.7.1", | ||
"camelcase": "^5.0.0", | ||
"commitizen": "^2.10.1", | ||
"cz-conventional-changelog": "^2.1.0", | ||
"del": "^3.0.0", | ||
"gulp": "^3.9.1", | ||
"gulp-autoprefixer": "^4.1.0", | ||
"gulp-babel": "^7.0.1", | ||
"gulp-babel-minify": "^0.3.0", | ||
"gulp-better-rollup": "^3.0.0", | ||
"gulp-bump": "^3.1.0", | ||
"gulp-clean-css": "^3.9.2", | ||
"fancy-log": "^1.3.2", | ||
"gulp": "^4.0.0", | ||
"gulp-autoprefixer": "^5.0.0", | ||
"gulp-clean-css": "^3.9.4", | ||
"gulp-concat": "^2.6.1", | ||
"gulp-conventional-changelog": "^1.1.11", | ||
"gulp-git": "^2.5.1", | ||
"gulp-nop": "0.0.3", | ||
"gulp-postcss": "^7.0.1", | ||
"gulp-sass": "^3.1.0", | ||
"gulp-sourcemaps": "^2.6.4", | ||
"gulp-sass": "^4.0.1", | ||
"gulp-uglify": "^3.0.0", | ||
"gulp-util": "^3.0.8", | ||
"rollup-plugin-babel": "^3.0.3", | ||
"run-sequence": "^2.2.1", | ||
"jest": "^23.1.0", | ||
"regenerator-runtime": "^0.11.1", | ||
"semantic-release": "^15.5.2", | ||
"travis-deploy-once": "^5.0.0", | ||
"semantic-release": "^15.5.1" | ||
"webpack": "^4.12.0", | ||
"webpack-stream": "^4.0.3" | ||
}, | ||
"config": { | ||
"commitizen": { | ||
"path": "node_modules/cz-conventional-changelog" | ||
} | ||
}, | ||
"files": [ | ||
"dist/extensions.sass", | ||
"dist/bulma-extensions.min.css", | ||
"bulma-accordion/dist/bulma-accordion.sass", | ||
"bulma-accordion/dist/bulma-accordion.css", | ||
"bulma-accordion/dist/bulma-accordion.min.css", | ||
"bulma-accordion/dist/bulma-accordion.js", | ||
"bulma-accordion/dist/bulma-accordion.min.js", | ||
"bulma-badge/dist/bulma-badge.sass", | ||
"bulma-badge/dist/bulma-badge.css", | ||
"bulma-badge/dist/bulma-badge.min.css", | ||
"bulma-calendar/dist/bulma-calendar.sass", | ||
"bulma-calendar/dist/bulma-calendar.css", | ||
"bulma-calendar/dist/bulma-calendar.min.css", | ||
"bulma-calendar/dist/bulma-calendar.js", | ||
"bulma-calendar/dist/bulma-calendar.min.js", | ||
"bulma-carousel/dist/bulma-carousel.sass", | ||
"bulma-carousel/dist/bulma-carousel.css", | ||
"bulma-carousel/dist/bulma-carousel.min.css", | ||
"bulma-carousel/dist/bulma-carousel.js", | ||
"bulma-carousel/dist/bulma-carousel.min.js", | ||
"bulma-checkradio/dist/bulma-checkradio.sass", | ||
"bulma-checkradio/dist/bulma-checkradio.css", | ||
"bulma-checkradio/dist/bulma-checkradio.min.css", | ||
"bulma-divider/dist/bulma-divider.sass", | ||
"bulma-divider/dist/bulma-divider.css", | ||
"bulma-divider/dist/bulma-divider.min.css", | ||
"bulma-iconpicker/dist/bulma-iconpicker.sass", | ||
"bulma-iconpicker/dist/bulma-iconpicker.css", | ||
"bulma-iconpicker/dist/bulma-iconpicker.min.css", | ||
"bulma-iconpicker/dist/bulma-iconpicker.js", | ||
"bulma-iconpicker/dist/bulma-iconpicker.min.js", | ||
"bulma-pageloader/dist/bulma-pageloader.sass", | ||
"bulma-pageloader/dist/bulma-pageloader.css", | ||
"bulma-pageloader/dist/bulma-pageloader.min.css", | ||
"bulma-pricingtable/dist/bulma-pricingtable.sass", | ||
"bulma-pricingtable/dist/bulma-pricingtable.css", | ||
"bulma-pricingtable/dist/bulma-pricingtable.min.css", | ||
"bulma-quickview/dist/bulma-quickview.sass", | ||
"bulma-quickview/dist/bulma-quickview.css", | ||
"bulma-quickview/dist/bulma-quickview.min.css", | ||
"bulma-quickview/dist/bulma-quickview.js", | ||
"bulma-quickview/dist/bulma-quickview.min.js", | ||
"bulma-ribbon/dist/bulma-ribbon.sass", | ||
"bulma-ribbon/dist/bulma-ribbon.css", | ||
"bulma-ribbon/dist/bulma-ribbon.min.css", | ||
"bulma-slider/dist/bulma-slider.sass", | ||
"bulma-slider/dist/bulma-slider.css", | ||
"bulma-slider/dist/bulma-slider.min.css", | ||
"bulma-steps/dist/bulma-steps.sass", | ||
"bulma-steps/dist/bulma-steps.css", | ||
"bulma-steps/dist/bulma-steps.min.css", | ||
"bulma-steps/dist/bulma-steps.js", | ||
"bulma-steps/dist/bulma-steps.min.js", | ||
"bulma-switch/dist/bulma-switch.sass", | ||
"bulma-switch/dist/bulma-switch.css", | ||
"bulma-switch/dist/bulma-switch.min.css", | ||
"bulma-tagsinput/dist/bulma-tagsinput.sass", | ||
"bulma-tagsinput/dist/bulma-tagsinput.css", | ||
"bulma-tagsinput/dist/bulma-tagsinput.min.css", | ||
"bulma-tagsinput/dist/bulma-tagsinput.js", | ||
"bulma-tagsinput/dist/bulma-tagsinput.min.js", | ||
"bulma-timeline/dist/bulma-timeline.sass", | ||
"bulma-timeline/dist/bulma-timeline.css", | ||
"bulma-timeline/dist/bulma-timeline.min.css", | ||
"bulma-tooltip/dist/bulma-tooltip.sass", | ||
"bulma-tooltip/dist/bulma-tooltip.css", | ||
"bulma-tooltip/dist/bulma-tooltip.min.css", | ||
"dist/**", | ||
"src/**", | ||
"bulma-*/dist/**", | ||
"bulma-*/src/**", | ||
"LICENSE", | ||
"README.md" | ||
], | ||
"version": "1.1.0" | ||
] | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1251248
149
11364
6