|
|
|
@ -401,15 +401,15 @@ window.AwesompleteUtil = (function () { |
|
|
|
|
// for arrays at top and subtop level
|
|
|
|
|
if (level < 2 && prop) { |
|
|
|
|
// if a 'value' is specified and found a mathing property, create extra 'value' property.
|
|
|
|
|
if (value && (prop + '.').lastIndexOf(value + '.', 0) === 0) { result['value'] = result[prop] } |
|
|
|
|
if (value && (prop + '.').lastIndexOf(value + '.', 0) === 0) { result.value = result[prop] } |
|
|
|
|
// if a 'label' is specified and found a mathing property, create extra 'label' property.
|
|
|
|
|
if (label && (prop + '.').lastIndexOf(label + '.', 0) === 0) { result['label'] = result[prop] } |
|
|
|
|
if (label && (prop + '.').lastIndexOf(label + '.', 0) === 0) { result.label = result[prop] } |
|
|
|
|
} |
|
|
|
|
if (level === 0) { |
|
|
|
|
// Make sure that both value and label properties exist, even if they are nil.
|
|
|
|
|
// This is handy with limit 0 or 1 when the result doesn't have to contain an array.
|
|
|
|
|
if (value && !('value' in result)) { result['value'] = null } |
|
|
|
|
if (label && !('label' in result)) { result['label'] = null } |
|
|
|
|
if (value && !('value' in result)) { result.value = null } |
|
|
|
|
if (label && !('label' in result)) { result.label = null } |
|
|
|
|
} |
|
|
|
|
return result |
|
|
|
|
} |
|
|
|
@ -506,17 +506,18 @@ window.AwesompleteUtil = (function () { |
|
|
|
|
var boundOnKeydown = _onKeydown.bind(awe) |
|
|
|
|
var boundOnInput = _onInput.bind(awe) |
|
|
|
|
var boundSelect = _select.bind(awe) |
|
|
|
|
var boundDetach = _detach.bind({awe: awe, |
|
|
|
|
var boundDetach = _detach.bind({ |
|
|
|
|
awe: awe, |
|
|
|
|
boundMatch: boundMatch, |
|
|
|
|
boundOnInput: boundOnInput, |
|
|
|
|
boundOnKeydown: boundOnKeydown, |
|
|
|
|
boundSelect: boundSelect |
|
|
|
|
}) |
|
|
|
|
var events = { |
|
|
|
|
'keydown': boundOnKeydown, |
|
|
|
|
'input': boundOnInput |
|
|
|
|
keydown: boundOnKeydown, |
|
|
|
|
input: boundOnInput |
|
|
|
|
} |
|
|
|
|
events['blur'] = events[_AWE_CLOSE] = events[_AWE_LOAD] = boundMatch |
|
|
|
|
events.blur = events[_AWE_CLOSE] = events[_AWE_LOAD] = boundMatch |
|
|
|
|
events[_AWE_SELECT] = boundSelect |
|
|
|
|
$.bind(elem, events) |
|
|
|
|
|
|
|
|
|