react-selectize
Advanced tools
Comparing version 0.0.8 to 0.0.9
{ | ||
"name": "react-selectize", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"description": "react implementation of selectize", | ||
@@ -5,0 +5,0 @@ "main": "src/ReactSelectize.js", |
@@ -26,3 +26,4 @@ (function(){ | ||
render: function(){ | ||
var showOptions, this$ = this; | ||
var outOfOptions, showOptions, this$ = this; | ||
outOfOptions = !this.props.addOptions && this.props.values.length === this.props.options.length; | ||
showOptions = (function(){ | ||
@@ -34,3 +35,3 @@ switch (false) { | ||
return false; | ||
case !(this.props.values.length > 0 && this.props.values.length === this.props.options.length): | ||
case !outOfOptions: | ||
return false; | ||
@@ -69,3 +70,3 @@ default: | ||
})( | ||
this.props.values), input(import$({ | ||
this.props.values), input({ | ||
disabled: this.props.disabled, | ||
@@ -75,6 +76,24 @@ ref: 'search', | ||
value: this.state.search, | ||
onChange: (function(){ | ||
switch (false) { | ||
case !(this.isBelowLimit() && !outOfOptions): | ||
return function(arg$){ | ||
var value, filteredOptions; | ||
value = arg$.currentTarget.value; | ||
filteredOptions = this$.filterOptions(value); | ||
return this$.setState({ | ||
focusedOption: 0, | ||
open: filteredOptions.length > 0, | ||
search: value | ||
}); | ||
}; | ||
default: | ||
return function(){}; | ||
} | ||
}.call(this)), | ||
onKeyDown: function(e){ | ||
var ref$, label; | ||
if (e.which === 9) { | ||
return this$.setState({ | ||
switch (e.which) { | ||
case 9: | ||
this$.setState({ | ||
open: false | ||
@@ -84,24 +103,27 @@ }, function(){ | ||
}); | ||
} else { | ||
switch (ref$ = [e.which], false) { | ||
case 8 !== ref$[0]: | ||
if (this$.state.search.length > 0) { | ||
return; | ||
} | ||
if ((ref$ = this$.removeValue(last(this$.props.values))) != null) { | ||
label = ref$.label; | ||
} | ||
if (!!label && !!this$.props.restoreOnBackspace) { | ||
this$.setState({ | ||
focusedOption: 0, | ||
open: true, | ||
search: label | ||
}); | ||
} else { | ||
this$.setState({ | ||
open: false | ||
}); | ||
} | ||
break; | ||
case 13 !== ref$[0]: | ||
break; | ||
case 8: | ||
if (this$.state.search.length > 0) { | ||
return; | ||
} | ||
if ((ref$ = this$.removeValue(last(this$.props.values))) != null) { | ||
label = ref$.label; | ||
} | ||
if (!!label && !!this$.props.restoreOnBackspace) { | ||
this$.setState({ | ||
focusedOption: 0, | ||
open: true, | ||
search: label | ||
}); | ||
} else { | ||
this$.setState({ | ||
open: false | ||
}); | ||
} | ||
e.preventDefault(); | ||
e.stopPropagation(); | ||
} | ||
if (outOfOptions) {} else { | ||
switch (e.which) { | ||
case 13: | ||
this$.selectOption(this$.state.focusedOption); | ||
@@ -114,3 +136,3 @@ this$.setState({ | ||
break; | ||
case 27 !== ref$[0]: | ||
case 27: | ||
if (this$.state.open) { | ||
@@ -125,6 +147,6 @@ this$.setState({ | ||
break; | ||
case 38 !== ref$[0]: | ||
case 38: | ||
this$.focusAdjacentOption(-1); | ||
break; | ||
case 40 !== ref$[0]: | ||
case 40: | ||
this$.focusAdjacentOption(1); | ||
@@ -142,16 +164,3 @@ break; | ||
} | ||
}, this.isBelowLimit() | ||
? { | ||
onChange: function(arg$){ | ||
var value, filteredOptions, ref$; | ||
value = arg$.currentTarget.value; | ||
filteredOptions = this$.filterOptions(value); | ||
return this$.setState({ | ||
focusedOption: filteredOptions.length === 1 || typeof (filteredOptions != null ? (ref$ = filteredOptions[0]) != null ? ref$.newOption : void 8 : void 8) === 'undefined' ? 0 : 1, | ||
open: this$.state.open || filteredOptions.length > 0, | ||
search: value | ||
}); | ||
} | ||
} | ||
: {})), div({ | ||
}), div({ | ||
className: 'reset', | ||
@@ -158,0 +167,0 @@ onClick: function(e){ |
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
523