Skip to content

Commit

Permalink
CHG: blur behavior of input text field
Browse files Browse the repository at this point in the history
  • Loading branch information
farthinker committed Jul 29, 2016
1 parent 378a64b commit aed11fd
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 12 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@

## V2.1.2 - 2016-07-27

* `input.textField` will be set empty if `allowInput` option is false and no item is selected when it blurs.

## V2.1.1 - 2016-07-27

* Remove DataProvider.getInstance() which is buggy
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "simple_select",
"version": "2.1.1",
"version": "2.1.2",
"homepage": "https://github.com/mycolorway/simple-select",
"authors": [
"farthinker <[email protected]>"
Expand Down
2 changes: 0 additions & 2 deletions demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
var selectOne = simple.select({
el: $('#select-one'),
placeholder: 'type sth...',
allowInput: '#select-one-name',
noWrap: false
});

Expand Down Expand Up @@ -59,7 +58,6 @@ <h3>Demo one: single select</h3>
<option value="audi" data-hint="car 4" selected>Audi</option>
</optgroup>
</select>
<input type="hidden" id="select-one-name">
</div>

<div class="demo-two">
Expand Down
9 changes: 6 additions & 3 deletions dist/simple-select.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/**
* simple-select v2.1.1
* simple-select v2.1.2
* http://mycolorway.github.io/simple-select
*
* Copyright Mycolorway Design
* Released under the MIT license
* http://mycolorway.github.io/simple-select/license.html
*
* Date: 2016-07-28
* Date: 2016-07-29
*/
;(function(root, factory) {
if (typeof module === 'object' && module.exports) {
Expand Down Expand Up @@ -1175,7 +1175,10 @@ SimpleSelect = (function(superClass) {
if (item = _this.dataProvider.getItemByName(value)) {
_this.selectItem(item);
} else {
_this._setUserInput(value);
if (!_this.opts.allowInput) {
_this.input.setValue('');
}
_this._setUserInput();
}
}
return _this.popover.setActive(false);
Expand Down
4 changes: 2 additions & 2 deletions dist/simple-select.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "simple-select",
"githubOwner": "mycolorway",
"version": "2.1.1",
"version": "2.1.2",
"description": "Autocomplete select component",
"homepage": "http://mycolorway.github.io/simple-select",
"repository": {
Expand Down
4 changes: 3 additions & 1 deletion src/simple-select.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,9 @@ class SimpleSelect extends SimpleModule
if item = @dataProvider.getItemByName(value)
@selectItem item
else
@_setUserInput value
@input.setValue('') unless @opts.allowInput
@_setUserInput()

@popover.setActive false

_setUserInput: (value = @input.getValue()) ->
Expand Down
4 changes: 2 additions & 2 deletions styles/simple-select.css
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/**
* simple-select v2.1.1
* simple-select v2.1.2
* http://mycolorway.github.io/simple-select
*
* Copyright Mycolorway Design
* Released under the MIT license
* http://mycolorway.github.io/simple-select/license.html
*
* Date: 2016-07-28
* Date: 2016-07-29
*/
.simple-select {
position: relative; }
Expand Down

0 comments on commit aed11fd

Please sign in to comment.