mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Typeahead : DisplayKey is now Display
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
//
|
||||
|
||||
var substringMatcher = function (strs: any) {
|
||||
return function findMatches(q: string, syncResults: (x: any) => void) {
|
||||
return function findMatches(q: string, syncResults: (x: Array<any>) => void) {
|
||||
var matches: Array<{ value: string }> = [];
|
||||
// regex used to determine if a string contains the substring `q`
|
||||
var substrRegex = new RegExp(q, 'i');
|
||||
@@ -97,7 +97,7 @@ function test_datasets_array() {
|
||||
|
||||
function with_displayKey_option() {
|
||||
$('#the-basics .typeahead').typeahead(options, [{
|
||||
displayKey: 'value',
|
||||
display: 'value',
|
||||
source: substringMatcher(states)
|
||||
}]
|
||||
);
|
||||
@@ -114,7 +114,7 @@ function test_datasets_array() {
|
||||
function with_all_options() {
|
||||
$('#the-basics .typeahead').typeahead(options, [{
|
||||
name: 'states',
|
||||
displayKey: 'value',
|
||||
display: 'value',
|
||||
templates: {},
|
||||
source: substringMatcher(states)
|
||||
}]
|
||||
@@ -125,13 +125,13 @@ function test_datasets_array() {
|
||||
$('#the-basics .typeahead').typeahead(options, [
|
||||
{
|
||||
name: 'states',
|
||||
displayKey: 'value',
|
||||
display: 'value',
|
||||
templates: {},
|
||||
source: substringMatcher(states)
|
||||
},
|
||||
{
|
||||
name: 'states alternative',
|
||||
displayKey: 'value',
|
||||
display: 'value',
|
||||
templates: {},
|
||||
source: substringMatcher(states)
|
||||
}
|
||||
@@ -161,7 +161,7 @@ function test_datasets_objects() {
|
||||
function with_displayKey_option() {
|
||||
$('#the-basics .typeahead').typeahead(options,
|
||||
{
|
||||
displayKey: 'value',
|
||||
display: 'value',
|
||||
source: substringMatcher(states)
|
||||
}
|
||||
);
|
||||
@@ -180,7 +180,7 @@ function test_datasets_objects() {
|
||||
$('#the-basics .typeahead').typeahead(options,
|
||||
{
|
||||
name: 'states',
|
||||
displayKey: 'value',
|
||||
display: x => x.value,
|
||||
templates: {},
|
||||
source: substringMatcher(states)
|
||||
}
|
||||
@@ -191,13 +191,13 @@ function test_datasets_objects() {
|
||||
$('#the-basics .typeahead').typeahead(options,
|
||||
{
|
||||
name: 'states',
|
||||
displayKey: 'value',
|
||||
display: 'value',
|
||||
templates: {},
|
||||
source: substringMatcher(states)
|
||||
},
|
||||
{
|
||||
name: 'states alternative',
|
||||
displayKey: 'value',
|
||||
display: 'value',
|
||||
templates: {},
|
||||
source: substringMatcher(states)
|
||||
}
|
||||
@@ -291,7 +291,7 @@ function test_dataset_templates() {
|
||||
suggestion: function (context) {
|
||||
return context.name;
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+2
-3
@@ -105,7 +105,7 @@ declare module Twitter.Typeahead {
|
||||
* cb can be invoked synchronously or asynchronously.
|
||||
*
|
||||
*/
|
||||
source: ((query: string, syncResults: (result: any) => void, asyncResults?: (result: any) => void) => void);
|
||||
source: ((query: string, syncResults: (result: Array<any>) => void, asyncResults?: (result: Array<any>) => void) => void);
|
||||
|
||||
/**
|
||||
* The name of the dataset.
|
||||
@@ -120,7 +120,7 @@ declare module Twitter.Typeahead {
|
||||
* This will be used when setting the value of the input control after a suggestion is selected. Can be either a key string or a function that transforms a suggestion object into a string.
|
||||
* Defaults to value.
|
||||
*/
|
||||
displayKey?: string | ((obj: any) => string);
|
||||
display?: string | ((obj: any) => string);
|
||||
|
||||
/**
|
||||
* A hash of templates to be used when rendering the dataset.
|
||||
@@ -128,7 +128,6 @@ declare module Twitter.Typeahead {
|
||||
*/
|
||||
templates?: Templates;
|
||||
async?: boolean;
|
||||
display?: boolean | ((x: any) => boolean);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user