stimulus-flatpickr
Advanced tools
Comparing version 1.2.0-0 to 1.2.0-1
{ | ||
"name": "stimulus-flatpickr", | ||
"version": "1.2.0-0", | ||
"version": "1.2.0-1", | ||
"description": "A Stimulus Wrapper for Flatpickr library", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -144,2 +144,9 @@ import { Application } from 'stimulus' | ||
}) | ||
it('can set preloaded range dates', function() { | ||
addFlatpickrOption('Mode', 'range', controller) | ||
addFlatpickrOption('DefaultDate', ['2018-10-15', '2018-10-20'], controller) | ||
expect(controller.inputTarget).to.have.value('2018-10-15 to 2018-10-20') | ||
}) | ||
}) | ||
@@ -146,0 +153,0 @@ }) |
@@ -19,3 +19,3 @@ const booleanOptions = [ | ||
const stringOptions = ['altInputClass', 'conjunction', 'defaultDate', 'mode', 'nextArrow', 'position', 'prevArrow'] | ||
const stringOptions = ['altInputClass', 'conjunction', 'mode', 'nextArrow', 'position', 'prevArrow'] | ||
@@ -33,2 +33,4 @@ const numberOptions = [ | ||
const arrayOrStringOptions = ['defaultDate'] | ||
const dateOptions = ['maxDate', 'minDate', 'maxTime', 'minTime', 'now'] | ||
@@ -43,3 +45,4 @@ | ||
array: arrayOptions, | ||
number: numberOptions | ||
number: numberOptions, | ||
arrayOrString: arrayOrStringOptions | ||
} |
@@ -119,2 +119,11 @@ import { Controller } from 'stimulus' | ||
_arrayOrString(option) { | ||
const val = this.data.get(option) | ||
try { | ||
return JSON.parse(val) | ||
} catch { | ||
return val | ||
} | ||
} | ||
get flatpickrElement() { | ||
@@ -121,0 +130,0 @@ return (this.hasInstanceTarget && this.instanceTarget) || this.element |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
493293
3309