ember-cli-bootstrap-datepicker
Advanced tools
Comparing version 0.3.4 to 0.4.0
@@ -6,9 +6,6 @@ import Ember from 'ember'; | ||
setupBootstrapDatepicker: function() { | ||
var self = this, | ||
element = this.$(), | ||
value = this.get('value'), | ||
dates = []; | ||
setupBootstrapDatepicker: Ember.on('didInsertElement', function() { | ||
var self = this; | ||
element. | ||
this.$(). | ||
datepicker({ | ||
@@ -36,47 +33,32 @@ autoclose: this.get('autoclose'), | ||
Ember.run(function() { | ||
self.didChangeDate(event); | ||
self._didChangeDate(event); | ||
}); | ||
}); | ||
if (value) { | ||
if (this.get('multidate')) { | ||
// split datesIsoString by multidate separator | ||
var multidateSeparator = this.get('multidateSeparator') || ','; | ||
var isoDates = value.split(multidateSeparator); | ||
this._updateDatepicker(); | ||
}), | ||
// generate array of date objecs | ||
dates = isoDates.map(function(date) { | ||
return self._resetTime(new Date(date)); | ||
}); | ||
} | ||
else { | ||
dates = [self._resetTime(new Date(value))]; | ||
} | ||
element.datepicker. | ||
apply(element, Array.prototype.concat.call(['update'], dates)); | ||
} | ||
}.on('didInsertElement'), | ||
teardownBootstrapDatepicker: function() { | ||
teardownBootstrapDatepicker: Ember.on('willDestroyElement', function() { | ||
this.$().datepicker('remove'); | ||
}.on('willDestroyElement'), | ||
}), | ||
didChangeDate: function(event) { | ||
var isoDate = null; | ||
didChangeValue: Ember.observer('value', function() { | ||
this._updateDatepicker(); | ||
}), | ||
_didChangeDate: function(event) { | ||
var value = null; | ||
if (event.date) { | ||
if (this.get('multidate')) { | ||
// set value to array if multidate | ||
isoDate = this.$().datepicker('getDates').map(function(date) { | ||
return date.toISOString(); | ||
}); | ||
value = this.$().datepicker('getDates'); | ||
} else { | ||
value = this.$().datepicker('getDate'); | ||
} | ||
else { | ||
isoDate = this.$().datepicker('getDate').toISOString(); | ||
} | ||
} | ||
this.set('value', isoDate); | ||
this.set('value', value); | ||
}, | ||
didChangeValue: function() { | ||
_updateDatepicker: function() { | ||
var self = this, | ||
@@ -86,21 +68,21 @@ element = this.$(), | ||
dates = []; | ||
// If value is undefined or null, we don't want bootstrap-datepicker to | ||
// display 1970-01-01. We want a blank value. | ||
if (value) { | ||
if (Ember.isArray(value)) { | ||
dates = value.map(function(date) { | ||
return self._resetTime(new Date(date)); | ||
}); | ||
} else { | ||
dates = [self._resetTime(new Date(value))]; | ||
} | ||
} else { | ||
dates = [null]; | ||
switch (Ember.typeOf(value)) { | ||
case 'array': | ||
dates = value; | ||
break; | ||
case 'date': | ||
dates = [value]; | ||
break; | ||
default: | ||
dates = [null]; | ||
} | ||
element.datepicker. | ||
apply(element, Array.prototype.concat.call(['update'], dates)); | ||
}.observes('value'), | ||
dates = dates.map(function(date) { | ||
return (Ember.isNone(date)) ? null : self._resetTime(date); | ||
}); | ||
element.datepicker | ||
.apply(element, Array.prototype.concat.call(['update'], dates)); | ||
}, | ||
// HACK: Have to reset time to 00:00:00 because of the bug in | ||
@@ -113,2 +95,3 @@ // bootstrap-datepicker | ||
date.setSeconds(0); | ||
date.setMilliseconds(0); | ||
@@ -115,0 +98,0 @@ return date; |
@@ -10,5 +10,5 @@ /* jshint node: true */ | ||
app.import(app.bowerDirectory + '/bootstrap-datepicker/js/bootstrap-datepicker.js'); | ||
app.import(app.bowerDirectory + '/bootstrap-datepicker/dist/js/bootstrap-datepicker.js'); | ||
app.import(app.bowerDirectory + '/bootstrap-datepicker/dist/css/bootstrap-datepicker.css'); | ||
} | ||
}; |
The MIT License (MIT) | ||
Copyright (c) 2014 Alexander Sulim | ||
Copyright (c) 2015 Alex Sulim | ||
@@ -5,0 +5,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: |
{ | ||
"name": "ember-cli-bootstrap-datepicker", | ||
"version": "0.3.4", | ||
"description": "Datepicker component for Ember CLI based on bootstrap-datepicker", | ||
"version": "0.4.0", | ||
"description": "Datepicker component for Ember CLI based on bootstrap-datepicker. It doesn't have any external dependency except bootstrap-datepicker, supports popup and inline modes.", | ||
"directories": { | ||
@@ -21,22 +21,27 @@ "doc": "doc", | ||
"devDependencies": { | ||
"broccoli-asset-rev": "^2.0.0", | ||
"broccoli-ember-hbs-template-compiler": "^1.6.1", | ||
"ember-cli": "0.1.5", | ||
"ember-cli-content-security-policy": "0.3.0", | ||
"ember-cli-dependency-checker": "0.0.7", | ||
"ember-cli-esnext": "0.1.1", | ||
"broccoli-asset-rev": "^2.0.2", | ||
"ember-cli": "0.2.2", | ||
"ember-cli-app-version": "0.3.3", | ||
"ember-cli-content-security-policy": "0.4.0", | ||
"ember-cli-dependency-checker": "0.0.8", | ||
"ember-cli-htmlbars": "0.7.4", | ||
"ember-cli-ic-ajax": "0.1.1", | ||
"ember-cli-inject-live-reload": "^1.3.0", | ||
"ember-cli-qunit": "0.1.2", | ||
"ember-data": "1.0.0-beta.12", | ||
"ember-export-application-global": "^1.0.0", | ||
"express": "^4.8.5", | ||
"glob": "^4.0.5" | ||
"ember-cli-qunit": "0.3.9", | ||
"ember-cli-uglify": "1.0.1", | ||
"ember-data": "1.0.0-beta.16.1", | ||
"ember-export-application-global": "^1.0.2", | ||
"ember-disable-prototype-extensions": "^1.0.0" | ||
}, | ||
"keywords": [ | ||
"ember-addon", | ||
"ember-cli", | ||
"ember-datepicker", | ||
"bootstrap", | ||
"bootstrap-datepicker", | ||
"datepicker" | ||
], | ||
"dependencies": { | ||
"ember-cli-babel": "^4.0.0" | ||
}, | ||
"ember-addon": { | ||
@@ -43,0 +48,0 @@ "configPath": "tests/dummy/config", |
# Ember CLI datepicker add-on | ||
[![Build Status](https://travis-ci.org/soulim/ember-cli-bootstrap-datepicker.svg?branch=master&style=flat)](https://travis-ci.org/soulim/ember-cli-bootstrap-datepicker) | ||
[![Ember Observer Score](http://emberobserver.com/badges/ember-cli-bootstrap-datepicker.svg)](http://emberobserver.com/addons/ember-cli-bootstrap-datepicker) | ||
[![Code Climate](https://codeclimate.com/github/soulim/ember-cli-bootstrap-datepicker/badges/gpa.svg)](https://codeclimate.com/github/soulim/ember-cli-bootstrap-datepicker) | ||
The add-on provides you a date input component based on amazing bootstrap-datepicker library. It supports popup and inline mode, and can be used in Ember CLI applications. | ||
It doesn't have any external dependecy except bootstrap-datepicker. | ||
[Online demo](http://sul.im/ember-cli-bootstrap-datepicker) | ||
@@ -168,5 +172,7 @@ | ||
Type: `Boolean` | ||
Type: `Boolean` or `String` | ||
Default: `false` | ||
> If true or “linked”, displays a “Today” button at the bottom of the datepicker to select the current date. If true, the “Today” button will only move the current date into view; if “linked”, the current date will also be selected. [More...](http://bootstrap-datepicker.readthedocs.org/en/latest/options.html#todaybtn) | ||
```handlebars | ||
@@ -210,2 +216,2 @@ {{bootstrap-datepicker value=expiresAt todayBtn=true}} | ||
[MIT License](https://github.com/soulim/ember-cli-bootstrap-datepicker/blob/master/LICENSE.md) | ||
[MIT License](https://github.com/soulim/ember-cli-bootstrap-datepicker/blob/master/LICENSE.md) |
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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
9089756
75909
216
1
36
2
1
+ Addedember-cli-babel@^4.0.0
+ Addedacorn@5.7.4(transitive)
+ Addedacorn-babel@0.11.1-38(transitive)
+ Addedamdefine@1.0.1(transitive)
+ Addedansi-regex@2.1.1(transitive)
+ Addedansi-styles@2.2.1(transitive)
+ Addedast-types@0.7.80.8.150.9.6(transitive)
+ Addedbabel-core@4.7.16(transitive)
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedbroccoli-babel-transpiler@4.1.0(transitive)
+ Addedbroccoli-filter@0.1.14(transitive)
+ Addedbroccoli-kitchen-sink-helpers@0.2.9(transitive)
+ Addedbroccoli-writer@0.1.1(transitive)
+ Addedchalk@1.1.3(transitive)
+ Addedclone@0.2.0(transitive)
+ Addedcommander@2.20.3(transitive)
+ Addedcommoner@0.10.8(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addedconvert-source-map@0.5.1(transitive)
+ Addedcore-js@0.6.1(transitive)
+ Addeddebug@2.6.9(transitive)
+ Addeddefined@1.0.1(transitive)
+ Addeddetect-indent@3.0.1(transitive)
+ Addeddetective@4.7.1(transitive)
+ Addedember-cli-babel@4.3.3(transitive)
+ Addedember-cli-version-checker@1.3.1(transitive)
+ Addedescape-string-regexp@1.0.5(transitive)
+ Addedesprima@2.7.33.1.3(transitive)
+ Addedesprima-fb@15001.1001.0-dev-harmony-fb(transitive)
+ Addedestraverse@1.9.3(transitive)
+ Addedesutils@1.1.6(transitive)
+ Addedfs-readdir-recursive@0.1.2(transitive)
+ Addedfs.realpath@1.0.0(transitive)
+ Addedget-stdin@4.0.1(transitive)
+ Addedglob@5.0.157.2.3(transitive)
+ Addedglobals@6.4.1(transitive)
+ Addedgraceful-fs@4.2.11(transitive)
+ Addedhas-ansi@2.0.0(transitive)
+ Addediconv-lite@0.4.24(transitive)
+ Addedinflight@1.0.6(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedis-finite@1.1.0(transitive)
+ Addedis-integer@1.0.7(transitive)
+ Addedjs-tokens@1.0.0(transitive)
+ Addedjsesc@0.5.0(transitive)
+ Addedleft-pad@0.0.3(transitive)
+ Addedleven@1.0.2(transitive)
+ Addedline-numbers@0.2.0(transitive)
+ Addedlodash@3.10.1(transitive)
+ Addedminimatch@3.1.2(transitive)
+ Addedminimist@1.2.8(transitive)
+ Addedmkdirp@0.3.50.5.6(transitive)
+ Addedmktemp@0.4.0(transitive)
+ Addedms@2.0.0(transitive)
+ Addedobject-assign@4.1.1(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedoutput-file-sync@1.1.2(transitive)
+ Addedpath-is-absolute@1.0.1(transitive)
+ Addedprivate@0.1.8(transitive)
+ Addedpromise-map-series@0.2.3(transitive)
+ Addedq@1.5.1(transitive)
+ Addedquick-temp@0.1.8(transitive)
+ Addedrecast@0.10.430.11.23(transitive)
+ Addedregenerate@1.4.2(transitive)
+ Addedregenerator-babel@0.8.13-2(transitive)
+ Addedregexpu@1.3.0(transitive)
+ Addedregjsgen@0.2.0(transitive)
+ Addedregjsparser@0.1.5(transitive)
+ Addedrepeating@1.1.3(transitive)
+ Addedrimraf@2.7.1(transitive)
+ Addedrsvp@3.6.2(transitive)
+ Addedsafer-buffer@2.1.2(transitive)
+ Addedsemver@5.7.2(transitive)
+ Addedshebang-regex@1.0.0(transitive)
+ Addedslash@1.0.0(transitive)
+ Addedsource-map@0.1.320.4.40.5.7(transitive)
+ Addedsource-map-support@0.2.10(transitive)
+ Addedsprintf-js@1.1.3(transitive)
+ Addedstrip-ansi@3.0.1(transitive)
+ Addedsupports-color@2.0.0(transitive)
+ Addedsymlink-or-copy@1.3.1(transitive)
+ Addedthrough@2.3.8(transitive)
+ Addedto-fast-properties@1.0.3(transitive)
+ Addedtrim-right@1.0.1(transitive)
+ Addedunderscore.string@3.3.6(transitive)
+ Addedutil-deprecate@1.0.2(transitive)
+ Addedwalk-sync@0.1.3(transitive)
+ Addedwrappy@1.0.2(transitive)