Merge pull request #3527 from codyrancher/one-option-fp

[forwardport] Fix FormContextualSelectArray to accept 1 option
This commit is contained in:
Westly Wright 2019-10-31 14:34:27 -07:00 committed by GitHub
commit adcfbf96bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -32,7 +32,7 @@ export default Component.extend({
get(this, 'values').removeAt(index);
}
},
lastValue: computed('values', {
lastValue: computed('values', 'values.[]', {
get() {
return get(this, 'values').objectAt(get(this, 'values.length') - 1);
},
@ -43,7 +43,8 @@ export default Component.extend({
}
}),
canAddMore: computed('filteredContent', function() {
return get(this, 'filteredContent.length') > 1;
return get(this, 'filteredContent.length') > 1
|| get(this, 'filteredContent.length') > 0 && get(this, 'values.length') === 0;
}),
lastIndex: computed('values.[]', function() {
return get(this, 'values.length') - 1;