Comparing version 1.1.1 to 1.1.2
# Changelog | ||
All notable changes to this project will be documented in this file. | ||
[1.1.2] - 2018-08-22 | ||
* new option: footer | ||
[1.1.1] - 2018-08-16 | ||
* fixed bug #15 | ||
[1.1.0] - 2018-07-20 | ||
@@ -5,0 +11,0 @@ * drop support IE |
11
demo.js
@@ -168,2 +168,13 @@ var rangeText = function (start, end) { | ||
} | ||
}); | ||
// demo-12 | ||
new Lightpick({ | ||
field: document.getElementById('demo-12'), | ||
singleDate: false, | ||
numberOfMonths: 2, | ||
footer: true, | ||
onSelect: function(start, end){ | ||
document.getElementById('result-12').innerHTML = rangeText(start, end); | ||
} | ||
}); |
@@ -54,2 +54,3 @@ /** | ||
hideOnBodyClick: true, | ||
footer: false, | ||
locale: { | ||
@@ -60,2 +61,4 @@ buttons: { | ||
close: '×', | ||
reset: 'Reset', | ||
apply: 'Apply', | ||
}, | ||
@@ -330,9 +333,24 @@ tooltip: ['day', 'days'], | ||
self.el.innerHTML = '<div class="lightpick__inner">' | ||
var html = '<div class="lightpick__inner">' | ||
+ (opts.numberOfMonths > 1 ? renderTopButtons(opts, 'days') : '') | ||
+ '<div class="lightpick__months"></div>' | ||
+ '<div class="lightpick__tooltip" style="visibility: hidden"></div>' | ||
+ '<div class="lightpick__months-of-the-year"></div>' | ||
+ '</div>'; | ||
+ '<div class="lightpick__months-of-the-year"></div>'; | ||
if (opts.footer) { | ||
html += '<div class="lightpick__footer">'; | ||
if (opts.footer === true) { | ||
html += '<button type="button" class="lightpick__reset-action">' + opts.locale.buttons.reset + '</button>'; | ||
html += '<button type="button" class="lightpick__apply-action">' + opts.locale.buttons.apply + '</button>'; | ||
} | ||
else { | ||
html += opts.footer; | ||
} | ||
html += '</div>'; | ||
} | ||
html += '</div>'; | ||
self.el.innerHTML = html; | ||
document.querySelector(opts.parentEl).appendChild(self.el); | ||
@@ -444,5 +462,8 @@ | ||
} | ||
else if (target.classList.contains('lightpick__close-action')) { | ||
else if (target.classList.contains('lightpick__close-action') || target.classList.contains('lightpick__apply-action')) { | ||
self.hide(); | ||
} | ||
else if (target.classList.contains('lightpick__reset-action')) { | ||
self.reset(); | ||
} | ||
else if (target.classList.contains('lightpick__month-title')) { | ||
@@ -521,3 +542,3 @@ if (target.hasAttribute('data-ym')) { | ||
if (opts.repickTrigger !== opts.field) { | ||
if (((opts.startDate && !opts.endDate) || opts.repickTrigger === opts.secondField) && dt.isSameOrBefore(opts.startDate)) { | ||
day.classList.add('is-flipped'); | ||
@@ -993,2 +1014,14 @@ } | ||
reset: function() | ||
{ | ||
this.setStartDate(null, true); | ||
this.setEndDate(null, true); | ||
updateDates(this.el, this._opts); | ||
if (typeof this._opts.onSelect === 'function') { | ||
this._opts.onSelect.call(this, this.getStartDate(), this.getEndDate()); | ||
} | ||
}, | ||
reloadOptions: function(options) | ||
@@ -995,0 +1028,0 @@ { |
{ | ||
"name": "lightpick", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "Javascript date range picker - lightweight, no jQuery", | ||
@@ -5,0 +5,0 @@ "main": "lightpick.js", |
@@ -173,5 +173,11 @@ [![npm version](https://badge.fury.io/js/lightpick.svg)](https://www.npmjs.com/package/lightpick) [![license](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/wakirin/lightpick/blob/master/LICENSE) | ||
### footer | ||
- Type: `Boolean|String` | ||
- Default: `false` | ||
Footer calendar, if set to `true` will use default footer (Reset/Apply buttons) or custom string (html). | ||
### locale | ||
- Type: `Object` | ||
- Default: `{ buttons: { prev: '<', next: '>', close: '×'}, tooltip: ['day', 'days'] }` | ||
- Default: `{ buttons: { prev: '<', next: '>', close: '×', reset: 'Reset', apply: 'Apply'}, tooltip: ['day', 'days'] }` | ||
@@ -178,0 +184,0 @@ Text for buttons, tooltip. |
Sorry, the diff of this file is not supported yet
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
98142
1654
256