bulma-extensions
Advanced tools
Comparing version 0.7.4 to 0.7.5
@@ -82,2 +82,11 @@ var datepicker_langs = { | ||
weekdaysShort: ['周日', '周一','周二','周三','周四','周五','周六'] | ||
}, | ||
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'] | ||
} | ||
@@ -122,7 +131,11 @@ } | ||
_init() { | ||
// this.parent = this.element.parentElement; | ||
this._id = 'datePicker' + ( new Date() ).getTime(); | ||
this._id = 'datePicker' + ( new Date() ).getTime() + Math.floor(Math.random() * Math.floor(9999)); | ||
this.lang = typeof datepicker_langs[this.lang] !== 'undefined' ? this.lang : 'en'; | ||
this.month = this.options.startDate.getMonth(), | ||
this.year = this.options.startDate.getFullYear(), | ||
// Set the startDate to the input value | ||
if (this.element.value) { | ||
this.options.startDate = new Date(this.element.value); | ||
} | ||
this.month = this.options.startDate.getMonth(); | ||
this.year = this.options.startDate.getFullYear(); | ||
this.day = this.options.startDate.getDate(); | ||
this.open = false; | ||
@@ -148,23 +161,31 @@ | ||
<div class="calendar-nav"> | ||
<div class="calendar-nav-previous-year"> | ||
<button class="button is-small is-text"> | ||
<i class="fa fa-chevron-left"></i> | ||
</button> | ||
<div class="calendar-nav-month"> | ||
<div class="calendar-nav-previous-month"> | ||
<button class="button is-small is-text"> | ||
<i class="fa fa-chevron-left"></i> | ||
</button> | ||
</div> | ||
<div class="calendar-month">${datepicker_langs[this.options.lang].months[this.month]}</div> | ||
<div class="calendar-nav-next-month"> | ||
<button class="button is-small is-text"> | ||
<i class="fa fa-chevron-right"></i> | ||
</button> | ||
</div> | ||
</div> | ||
<div class="calendar-nav-previous-month"> | ||
<button class="button is-small is-text"> | ||
<i class="fa fa-chevron-left"></i> | ||
</button> | ||
<div class="calendar-nav-day"> | ||
<div class="calendar-day">${this.day}</div> | ||
</div> | ||
<div class="calendar-month">${datepicker_langs[this.options.lang].months[this.month] + ' ' + this.year}</div> | ||
<div class="calendar-nav-next-month"> | ||
<button class="button is-small is-text"> | ||
<i class="fa fa-chevron-right"></i> | ||
</button> | ||
<div class="calendar-nav-year"> | ||
<div class="calendar-nav-previous-year"> | ||
<button class="button is-small is-text"> | ||
<i class="fa fa-chevron-left"></i> | ||
</button> | ||
</div> | ||
<div class="calendar-year">${this.year}</div> | ||
<div class="calendar-nav-next-year"> | ||
<button class="button is-small is-text"> | ||
<i class="fa fa-chevron-right"></i> | ||
</button> | ||
</div> | ||
</div> | ||
<div class="calendar-nav-next-year"> | ||
<button class="button is-small is-text"> | ||
<i class="fa fa-chevron-right"></i> | ||
</button> | ||
</div> | ||
</div> | ||
@@ -199,2 +220,4 @@ <div class="calendar-container"> | ||
this.datePickerCalendarNavMonth = this.datePickerCalendar.querySelector('.calendar-month'); | ||
this.datePickerCalendarNavYear = this.datePickerCalendar.querySelector('.calendar-year'); | ||
this.datePickerCalendarNavDay = this.datePickerCalendar.querySelector('.calendar-day'); | ||
this.datePickerCalendarNavPreviousMonth = this.datePickerCalendarNav.querySelector('.calendar-nav-previous-month'); | ||
@@ -206,3 +229,2 @@ this.datePickerCalendarNavNextMonth = this.datePickerCalendarNav.querySelector('.calendar-nav-next-month'); | ||
this.datePickerCalendarBody = this.datePickerCalendar.querySelector('.calendar-body'); | ||
this._renderDays(); | ||
} | ||
@@ -216,4 +238,2 @@ | ||
_bindEvents() { | ||
var _this = this; | ||
// Bind event to element in order to display/hide DatePicker on click | ||
@@ -223,6 +243,6 @@ this.element.addEventListener(this._clickEvent, (e) => { | ||
if (_this.open) { | ||
_this.hide(); | ||
if (this.open) { | ||
this.hide(); | ||
} else { | ||
_this.show(); | ||
this.show(); | ||
} | ||
@@ -236,3 +256,3 @@ }); | ||
e.preventDefault(); | ||
_this.hide(); | ||
this.hide(); | ||
}); | ||
@@ -244,3 +264,3 @@ } | ||
e.preventDefault(); | ||
_this.hide(); | ||
this.hide(); | ||
}); | ||
@@ -253,7 +273,7 @@ } | ||
e.preventDefault(); | ||
_this.prevYear(); | ||
this.prevYear(); | ||
}); | ||
this.datePickerCalendarNavNextYear.addEventListener(this._clickEvent, (e) => { | ||
e.preventDefault(); | ||
_this.nextYear(); | ||
this.nextYear(); | ||
}); | ||
@@ -264,7 +284,7 @@ | ||
e.preventDefault(); | ||
_this.prevMonth(); | ||
this.prevMonth(); | ||
}); | ||
this.datePickerCalendarNavNextMonth.addEventListener(this._clickEvent, (e) => { | ||
e.preventDefault(); | ||
_this.nextMonth(); | ||
this.nextMonth(); | ||
}); | ||
@@ -279,15 +299,14 @@ } | ||
_bindDaysEvents() { | ||
var _this = this; | ||
[].forEach.call(this.datePickerCalendarDays, (calendarDay) => { | ||
calendarDay.addEventListener(this._clickEvent, (e) => { | ||
e.preventDefault(); | ||
if (typeof _this.options.onSelect != 'undefined' && | ||
_this.options.onSelect != null && | ||
_this.options.onSelect) { | ||
_this.options.onSelect(new Date(year, month, day)); | ||
if (typeof this.options.onSelect != 'undefined' && | ||
this.options.onSelect != null && | ||
this.options.onSelect) { | ||
this.options.onSelect(new Date(year, month, day)); | ||
} | ||
let date = e.currentTarget.dataset.date.split('/'); | ||
_this.element.value = _this.getFormatedDate(( new Date(date[0], date[1], date[2]) ), _this.options.dataFormat); | ||
if (_this.options.closeOnSelect) { | ||
_this.hide(); | ||
this.element.value = this.getFormatedDate(( new Date(date[0], date[1], date[2]) ), this.options.dataFormat); | ||
if (this.options.closeOnSelect) { | ||
this.hide(); | ||
} | ||
@@ -354,3 +373,3 @@ }); | ||
isBetween = false, | ||
isSelected = false, | ||
isSelected = this._compareDates(day, this.options.startDate), | ||
isSelectedIn = false, | ||
@@ -387,3 +406,2 @@ isSelectedOut = false, | ||
this.adjustCalendar(); | ||
this._renderDays(); | ||
} | ||
@@ -399,3 +417,2 @@ | ||
this.adjustCalendar(); | ||
this._renderDays(); | ||
} | ||
@@ -411,3 +428,2 @@ | ||
this.adjustCalendar(); | ||
this._renderDays(); | ||
} | ||
@@ -423,3 +439,2 @@ | ||
this.adjustCalendar(); | ||
this._renderDays(); | ||
} | ||
@@ -433,2 +448,11 @@ | ||
show() { | ||
// Set the startDate to the input value | ||
if (this.element.value) { | ||
this.options.startDate = new Date(this.element.value); | ||
} | ||
this.month = this.options.startDate.getMonth(); | ||
this.year = this.options.startDate.getFullYear(); | ||
this.day = this.options.startDate.getDate(); | ||
this.adjustCalendar(); | ||
if (typeof this.options.onOpen != 'undefined' && | ||
@@ -439,2 +463,3 @@ this.options.onOpen != null && | ||
} | ||
this.datePickerContainer.classList.add('is-active'); | ||
@@ -471,4 +496,7 @@ if (!this.options.overlay) { | ||
} | ||
this.datePickerCalendarNavMonth.innerHTML = datepicker_langs[this.options.lang].months[this.month] + ' ' + this.year; | ||
this.datePickerCalendarNavMonth.innerHTML = datepicker_langs[this.options.lang].months[this.month]; | ||
this.datePickerCalendarNavYear.innerHTML = this.year; | ||
this.datePickerCalendarNavDay.innerHTML = this.day; | ||
this.datePickerCalendarBody.innerHTML = ''; | ||
this._renderDays(); | ||
return this; | ||
@@ -475,0 +503,0 @@ } |
@@ -11,21 +11,24 @@ var $jscomp={scope:{},owns:function(a,b){return Object.prototype.hasOwnProperty.call(a,b)}};$jscomp.defineProperty="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){if(c.get||c.set)throw new TypeError("ES3 does not support getters and setters.");a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)};$jscomp.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global&&null!=global?global:a};$jscomp.global=$jscomp.getGlobal(this); | ||
months:"januar februar mart april maj jun jul avgust septembar oktobar novembar decembar".split(" "),monthsShort:"jan feb mar apr maj jun jul avg sep okt nov dec".split(" "),weekdays:"nedelja ponedeljak utorak sreda \u010detvrtak petak subota".split(" "),weekdaysShort:"ned pon uto sre \u010det pet sub".split(" ")},"zh-cn":{weekStart:1,previousMonth:"\u4e0a\u4e2a\u6708",nextMonth:"\u4e0b\u4e2a\u6708",months:"\u4e00\u6708 \u4e8c\u6708 \u4e09\u6708 \u56db\u6708 \u4e94\u6708 \u516d\u6708 \u4e03\u6708 \u516b\u6708 \u4e5d\u6708 \u5341\u6708 \u5341\u4e00\u6708 \u5341\u4e8c\u6708".split(" "), | ||
monthsShort:"\u4e00\u6708 \u4e8c\u6708 \u4e09\u6708 \u56db\u6708 \u4e94\u6708 \u516d\u6708 \u4e03\u6708 \u516b\u6708 \u4e5d\u6708 \u5341\u6708 \u5341\u4e00\u6708 \u5341\u4e8c\u6708".split(" "),weekdays:"\u661f\u671f\u5929 \u661f\u671f\u4e00 \u661f\u671f\u4e8c \u661f\u671f\u4e09 \u661f\u671f\u56db \u661f\u671f\u4e94 \u661f\u671f\u516d".split(" "),weekdaysShort:"\u5468\u65e5 \u5468\u4e00 \u5468\u4e8c \u5468\u4e09 \u5468\u56db \u5468\u4e94 \u5468\u516d".split(" ")}},DatePicker=function(a,b){b=void 0=== | ||
b?{}:b;this._clickEvent="ontouchstart"in window?"touchstart":"click";this.element="string"===typeof a?document.querySelector(a):a;if(!this.element)throw Error("An invalid selector or non-DOM node has been provided.");this.options=Object.assign({},{startDate:new Date,dataFormat:"yyyy/mm/dd",lang:"en",overlay:!1,closeOnOverlayClick:!0,closeOnSelect:!0,onSelect:null,onOpen:null,onClose:null,onRender:null},b);this._init()}; | ||
DatePicker.prototype._init=function(){this._id="datePicker"+(new Date).getTime();this.lang="undefined"!==typeof datepicker_langs[this.lang]?this.lang:"en";this.month=this.options.startDate.getMonth();this.year=this.options.startDate.getFullYear();this.open=!1;this._build();this._bindEvents();return this}; | ||
DatePicker.prototype._build=function(){var a="\n <div id='"+this._id+"' class=\"datepicker "+(this.options.overlay?"modal":"")+'">\n '+(this.options.overlay?'<div class="modal-background"></div>':"")+'\n <div class="calendar">\n <div class="calendar-nav">\n <div class="calendar-nav-previous-year">\n <button class="button is-small is-text">\n <i class="fa fa-chevron-left"></i>\n </button>\n </div>\n <div class="calendar-nav-previous-month">\n <button class="button is-small is-text">\n <i class="fa fa-chevron-left"></i>\n </button>\n </div>\n <div class="calendar-month">'+ | ||
(datepicker_langs[this.options.lang].months[this.month]+" "+this.year)+'</div>\n <div class="calendar-nav-next-month">\n <button class="button is-small is-text">\n <i class="fa fa-chevron-right"></i>\n </button>\n </div>\n <div class="calendar-nav-next-year">\n <button class="button is-small is-text">\n <i class="fa fa-chevron-right"></i>\n </button>\n </div>\n </div>\n <div class="calendar-container">\n <div class="calendar-header">\n <div class="calendar-date">'+ | ||
this._getDayName(0,!0)+'</div>\n <div class="calendar-date">'+this._getDayName(1,!0)+'</div>\n <div class="calendar-date">'+this._getDayName(2,!0)+'</div>\n <div class="calendar-date">'+this._getDayName(3,!0)+'</div>\n <div class="calendar-date">'+this._getDayName(4,!0)+'</div>\n <div class="calendar-date">'+this._getDayName(5,!0)+'</div>\n <div class="calendar-date">'+this._getDayName(6,!0)+'</div>\n </div>\n <div class="calendar-body"></div>\n </div>\n </div>\n </div>\n '; | ||
document.body.insertAdjacentHTML("beforeend",a);this.datePickerContainer=document.getElementById(this._id);this.datePickerCalendar=this.datePickerContainer.querySelector(".calendar");this.options.overlay&&(this.datePickerOverlay=this.datePickerContainer.querySelector(".modal-background"),this.datePickerCloseButton=this.datePickerContainer.querySelector(".modal-close"));this.datePickerCalendarNav=this.datePickerCalendar.querySelector(".calendar-nav");this.datePickerCalendarNavMonth=this.datePickerCalendar.querySelector(".calendar-month"); | ||
this.datePickerCalendarNavPreviousMonth=this.datePickerCalendarNav.querySelector(".calendar-nav-previous-month");this.datePickerCalendarNavNextMonth=this.datePickerCalendarNav.querySelector(".calendar-nav-next-month");this.datePickerCalendarNavPreviousYear=this.datePickerCalendarNav.querySelector(".calendar-nav-previous-year");this.datePickerCalendarNavNextYear=this.datePickerCalendarNav.querySelector(".calendar-nav-next-year");this.datePickerCalendarHeader=this.datePickerCalendar.querySelector(".calendar-header"); | ||
this.datePickerCalendarBody=this.datePickerCalendar.querySelector(".calendar-body");this._renderDays()}; | ||
monthsShort:"\u4e00\u6708 \u4e8c\u6708 \u4e09\u6708 \u56db\u6708 \u4e94\u6708 \u516d\u6708 \u4e03\u6708 \u516b\u6708 \u4e5d\u6708 \u5341\u6708 \u5341\u4e00\u6708 \u5341\u4e8c\u6708".split(" "),weekdays:"\u661f\u671f\u5929 \u661f\u671f\u4e00 \u661f\u671f\u4e8c \u661f\u671f\u4e09 \u661f\u671f\u56db \u661f\u671f\u4e94 \u661f\u671f\u516d".split(" "),weekdaysShort:"\u5468\u65e5 \u5468\u4e00 \u5468\u4e8c \u5468\u4e09 \u5468\u56db \u5468\u4e94 \u5468\u516d".split(" ")},es:{weekStart:1,previousMonth:"Mes anterior", | ||
nextMonth:"Pr\u00f3ximo mes",months:"Enero Febrero Marzo Abril Mayo Junio Julio Agosto Septiembre Octubre Noviembre Diciembre".split(" "),monthsShort:"Ene Feb Mar Abr May Jun Jul Ago Sep Oct Nov Dic".split(" "),weekdays:"Domingo Lunes Martes Mi\u00e9rcoles Jueves Viernes S\u00e1bado".split(" "),weekdaysShort:"Dom Lun Mar Mie Jue Vie Sab".split(" ")}},DatePicker=function(a,b){b=void 0===b?{}:b;this._clickEvent="ontouchstart"in window?"touchstart":"click";this.element="string"===typeof a?document.querySelector(a): | ||
a;if(!this.element)throw Error("An invalid selector or non-DOM node has been provided.");this.options=Object.assign({},{startDate:new Date,dataFormat:"yyyy/mm/dd",lang:"en",overlay:!1,closeOnOverlayClick:!0,closeOnSelect:!0,onSelect:null,onOpen:null,onClose:null,onRender:null},b);this._init()}; | ||
DatePicker.prototype._init=function(){this._id="datePicker"+(new Date).getTime()+Math.floor(Math.random()*Math.floor(9999));this.lang="undefined"!==typeof datepicker_langs[this.lang]?this.lang:"en";this.element.value&&(this.options.startDate=new Date(this.element.value));this.month=this.options.startDate.getMonth();this.year=this.options.startDate.getFullYear();this.day=this.options.startDate.getDate();this.open=!1;this._build();this._bindEvents();return this}; | ||
DatePicker.prototype._build=function(){var a="\n <div id='"+this._id+"' class=\"datepicker "+(this.options.overlay?"modal":"")+'">\n '+(this.options.overlay?'<div class="modal-background"></div>':"")+'\n <div class="calendar">\n <div class="calendar-nav">\n <div class="calendar-nav-month">\n <div class="calendar-nav-previous-month">\n <button class="button is-small is-text">\n <i class="fa fa-chevron-left"></i>\n </button>\n </div>\n <div class="calendar-month">'+ | ||
datepicker_langs[this.options.lang].months[this.month]+'</div>\n <div class="calendar-nav-next-month">\n <button class="button is-small is-text">\n <i class="fa fa-chevron-right"></i>\n </button>\n </div>\n </div>\n <div class="calendar-nav-day">\n <div class="calendar-day">'+this.day+'</div>\n </div>\n <div class="calendar-nav-year">\n <div class="calendar-nav-previous-year">\n <button class="button is-small is-text">\n <i class="fa fa-chevron-left"></i>\n </button>\n </div>\n <div class="calendar-year">'+ | ||
this.year+'</div>\n <div class="calendar-nav-next-year">\n <button class="button is-small is-text">\n <i class="fa fa-chevron-right"></i>\n </button>\n </div>\n </div>\n </div>\n <div class="calendar-container">\n <div class="calendar-header">\n <div class="calendar-date">'+this._getDayName(0,!0)+'</div>\n <div class="calendar-date">'+this._getDayName(1,!0)+'</div>\n <div class="calendar-date">'+ | ||
this._getDayName(2,!0)+'</div>\n <div class="calendar-date">'+this._getDayName(3,!0)+'</div>\n <div class="calendar-date">'+this._getDayName(4,!0)+'</div>\n <div class="calendar-date">'+this._getDayName(5,!0)+'</div>\n <div class="calendar-date">'+this._getDayName(6,!0)+'</div>\n </div>\n <div class="calendar-body"></div>\n </div>\n </div>\n </div>\n ';document.body.insertAdjacentHTML("beforeend",a); | ||
this.datePickerContainer=document.getElementById(this._id);this.datePickerCalendar=this.datePickerContainer.querySelector(".calendar");this.options.overlay&&(this.datePickerOverlay=this.datePickerContainer.querySelector(".modal-background"),this.datePickerCloseButton=this.datePickerContainer.querySelector(".modal-close"));this.datePickerCalendarNav=this.datePickerCalendar.querySelector(".calendar-nav");this.datePickerCalendarNavMonth=this.datePickerCalendar.querySelector(".calendar-month");this.datePickerCalendarNavYear= | ||
this.datePickerCalendar.querySelector(".calendar-year");this.datePickerCalendarNavDay=this.datePickerCalendar.querySelector(".calendar-day");this.datePickerCalendarNavPreviousMonth=this.datePickerCalendarNav.querySelector(".calendar-nav-previous-month");this.datePickerCalendarNavNextMonth=this.datePickerCalendarNav.querySelector(".calendar-nav-next-month");this.datePickerCalendarNavPreviousYear=this.datePickerCalendarNav.querySelector(".calendar-nav-previous-year");this.datePickerCalendarNavNextYear= | ||
this.datePickerCalendarNav.querySelector(".calendar-nav-next-year");this.datePickerCalendarHeader=this.datePickerCalendar.querySelector(".calendar-header");this.datePickerCalendarBody=this.datePickerCalendar.querySelector(".calendar-body")}; | ||
DatePicker.prototype._bindEvents=function(){var a=this;this.element.addEventListener(this._clickEvent,function(b){b.preventDefault();a.open?a.hide():a.show()});this.options.overlay&&(this.datePickerCloseButton&&this.datePickerCloseButton.addEventListener(this._clickEvent,function(b){b.preventDefault();a.hide()}),this.options.closeOnOverlayClick&&this.datePickerOverlay.addEventListener(this._clickEvent,function(b){b.preventDefault();a.hide()}));this.datePickerCalendarNavPreviousYear.addEventListener(this._clickEvent, | ||
function(b){b.preventDefault();a.prevYear()});this.datePickerCalendarNavNextYear.addEventListener(this._clickEvent,function(b){b.preventDefault();a.nextYear()});this.datePickerCalendarNavPreviousMonth.addEventListener(this._clickEvent,function(b){b.preventDefault();a.prevMonth()});this.datePickerCalendarNavNextMonth.addEventListener(this._clickEvent,function(b){b.preventDefault();a.nextMonth()})}; | ||
DatePicker.prototype._bindDaysEvents=function(){var a=this,b=this;[].forEach.call(this.datePickerCalendarDays,function(c){c.addEventListener(a._clickEvent,function(a){a.preventDefault();if("undefined"!=typeof b.options.onSelect&&null!=b.options.onSelect&&b.options.onSelect)b.options.onSelect(new Date(year,month,day));a=a.currentTarget.dataset.date.split("/");b.element.value=b.getFormatedDate(new Date(a[0],a[1],a[2]),b.options.dataFormat);b.options.closeOnSelect&&b.hide()})})}; | ||
DatePicker.prototype._bindDaysEvents=function(){var a=this;[].forEach.call(this.datePickerCalendarDays,function(b){b.addEventListener(a._clickEvent,function(b){b.preventDefault();if("undefined"!=typeof a.options.onSelect&&null!=a.options.onSelect&&a.options.onSelect)a.options.onSelect(new Date(year,month,day));b=b.currentTarget.dataset.date.split("/");a.element.value=a.getFormatedDate(new Date(b[0],b[1],b[2]),a.options.dataFormat);a.options.closeOnSelect&&a.hide()})})}; | ||
DatePicker.prototype._getDayName=function(a,b){for(a+=datepicker_langs[this.options.lang].weekStart;7<=a;)a-=7;return(void 0===b?0:b)?datepicker_langs[this.options.lang].weekdaysShort[a]:datepicker_langs[this.options.lang].weekdays[a]}; | ||
DatePicker.prototype._renderDay=function(a,b,c,d,f,e,g,k,l,h){return'\n <div data-date="'+(c+"/"+b+"/"+a)+'" class="calendar-date'+(e?" is-disabled":"")+(k?" calendar-range":"")+(l?" calendar-range-start":"")+(h?" calendar-range-end":"")+'">\n <button class="date-item'+(f?" is-today":"")+(d?" is-active":"")+'">'+a+"</button>\n </div>\n "}; | ||
DatePicker.prototype._renderDays=function(){var a=new Date,b="",c=this.getDaysInMonth(this.year,this.month),d=(new Date(this.year,this.month,1)).getDay();if("undefined"!=typeof this.options.onRender&&null!=this.options.onRender&&this.options.onRender)this.options.onRender(this);0<datepicker_langs[this.options.lang].weekStart&&(d-=datepicker_langs[this.options.lang].weekStart,0>d&&(d+=7));for(var f=c+d,e=f;7<e;)e-=7;f+=7-e;for(e=0;e<f;e++){var g=new Date(this.year,this.month,1+(e-d)),k=this._compareDates(g, | ||
a),l=e<d||e>=c+d,h=!1;g.getMonth()!==this.month&&(h=!0);b+=this._renderDay(g.getDate(),this.month,this.year,!1,k,h,l,!1,!1,!1)}this.datePickerCalendarBody.insertAdjacentHTML("beforeend",b);this.datePickerCalendarDays=this.datePickerCalendarBody.querySelectorAll(".calendar-date");this._bindDaysEvents()};DatePicker.prototype.prevMonth=function(){--this.month;this.adjustCalendar();this._renderDays()};DatePicker.prototype.nextMonth=function(){this.month+=1;this.adjustCalendar();this._renderDays()}; | ||
DatePicker.prototype.prevYear=function(){--this.year;this.adjustCalendar();this._renderDays()};DatePicker.prototype.nextYear=function(){this.year+=1;this.adjustCalendar();this._renderDays()};DatePicker.prototype.show=function(){if("undefined"!=typeof this.options.onOpen&&null!=this.options.onOpen&&this.options.onOpen)this.options.onOpen(this);this.datePickerContainer.classList.add("is-active");this.options.overlay||this.adjustPosition();this.open=!0}; | ||
DatePicker.prototype._renderDay=function(a,b,c,d,f,e,g,h,k,l){return'\n <div data-date="'+(c+"/"+b+"/"+a)+'" class="calendar-date'+(e?" is-disabled":"")+(h?" calendar-range":"")+(k?" calendar-range-start":"")+(l?" calendar-range-end":"")+'">\n <button class="date-item'+(f?" is-today":"")+(d?" is-active":"")+'">'+a+"</button>\n </div>\n "}; | ||
DatePicker.prototype._renderDays=function(){var a=new Date,b="",c=this.getDaysInMonth(this.year,this.month),d=(new Date(this.year,this.month,1)).getDay();if("undefined"!=typeof this.options.onRender&&null!=this.options.onRender&&this.options.onRender)this.options.onRender(this);0<datepicker_langs[this.options.lang].weekStart&&(d-=datepicker_langs[this.options.lang].weekStart,0>d&&(d+=7));for(var f=c+d,e=f;7<e;)e-=7;f+=7-e;for(e=0;e<f;e++){var g=new Date(this.year,this.month,1+(e-d)),h=this._compareDates(g, | ||
this.options.startDate),k=!1,l=!1,n=this._compareDates(g,a),p=e<d||e>=c+d,m=!1;h||(l=k=!1);g.getMonth()!==this.month&&(m=!0);b+=this._renderDay(g.getDate(),this.month,this.year,h,n,m,p,!1,k,l)}this.datePickerCalendarBody.insertAdjacentHTML("beforeend",b);this.datePickerCalendarDays=this.datePickerCalendarBody.querySelectorAll(".calendar-date");this._bindDaysEvents()};DatePicker.prototype.prevMonth=function(){--this.month;this.adjustCalendar()}; | ||
DatePicker.prototype.nextMonth=function(){this.month+=1;this.adjustCalendar()};DatePicker.prototype.prevYear=function(){--this.year;this.adjustCalendar()};DatePicker.prototype.nextYear=function(){this.year+=1;this.adjustCalendar()}; | ||
DatePicker.prototype.show=function(){this.element.value&&(this.options.startDate=new Date(this.element.value));this.month=this.options.startDate.getMonth();this.year=this.options.startDate.getFullYear();this.day=this.options.startDate.getDate();this.adjustCalendar();if("undefined"!=typeof this.options.onOpen&&null!=this.options.onOpen&&this.options.onOpen)this.options.onOpen(this);this.datePickerContainer.classList.add("is-active");this.options.overlay||this.adjustPosition();this.open=!0}; | ||
DatePicker.prototype.hide=function(){this.open=!1;if("undefined"!=typeof this.options.onClose&&null!=this.options.onClose&&this.options.onClose)this.options.onClose(this);this.datePickerContainer.classList.remove("is-active")}; | ||
DatePicker.prototype.adjustCalendar=function(){0>this.month&&(this.year-=Math.ceil(Math.abs(this.month)/12),this.month+=12);11<this.month&&(this.year+=Math.floor(Math.abs(this.month)/12),this.month-=12);this.datePickerCalendarNavMonth.innerHTML=datepicker_langs[this.options.lang].months[this.month]+" "+this.year;this.datePickerCalendarBody.innerHTML="";return this}; | ||
DatePicker.prototype.adjustCalendar=function(){0>this.month&&(this.year-=Math.ceil(Math.abs(this.month)/12),this.month+=12);11<this.month&&(this.year+=Math.floor(Math.abs(this.month)/12),this.month-=12);this.datePickerCalendarNavMonth.innerHTML=datepicker_langs[this.options.lang].months[this.month];this.datePickerCalendarNavYear.innerHTML=this.year;this.datePickerCalendarNavDay.innerHTML=this.day;this.datePickerCalendarBody.innerHTML="";this._renderDays();return this}; | ||
DatePicker.prototype.adjustPosition=function(){var a,b;if("function"===typeof this.element.getBoundingClientRect)b=this.element.getBoundingClientRect(),a=b.left+window.pageXOffset,b=b.bottom+window.pageYOffset;else for(a=this.element.offsetLeft,b=this.element.offsetTop+this.element.offsetHeight;this.element=this.element.offsetParent;)a+=this.element.offsetLeft,b+=this.element.offsetTop;this.datePickerCalendar.style.position="absolute";this.datePickerCalendar.style.left=a+"px";this.datePickerCalendar.style.top= | ||
@@ -32,0 +35,0 @@ b+"px"};DatePicker.prototype.destroy=function(){this.datePickerCalendar.remove()}; |
{ | ||
"name": "bulma-calendar", | ||
"version": "0.1.9", | ||
"version": "0.2.0", | ||
"description": "Display a calendar for date selection or for planning management, in different colors and sizes", | ||
@@ -5,0 +5,0 @@ "main": "calendar.sass", |
{ | ||
"name": "bulma-extensions", | ||
"version": "0.7.4", | ||
"version": "0.7.5", | ||
"description": "Set of extensions for Bulma.io CSS Framework", | ||
@@ -5,0 +5,0 @@ "main": "extensions.sass", |
Sorry, the diff of this file is not supported yet
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
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
536365
8763