Skip to content

Commit

Permalink
Format ts files using prettier, update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
tkirda committed Oct 10, 2023
1 parent 16ad576 commit abbdea0
Show file tree
Hide file tree
Showing 7 changed files with 123 additions and 3,326 deletions.
50 changes: 42 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@
"type": "git",
"url": "git://github.com/devbridge/jQuery-Autocomplete.git"
},
"dependencies": {
"@types/jquery": "^2.0.32",
"peerDependencies": {
"jquery": ">=1.9"
},
"devDependencies": {
"@types/jquery": "^3.5.22",
"grunt": "^1.0.1",
"grunt-contrib-uglify": "^1.0.1",
"prettier": "^3.0.3"
"jquery-mockjax": "^2.6.0",
"prettier": "^3.0.3",
"typescript": "^5.2.2"
},
"prettier": {
"printWidth": 100,
Expand Down
4 changes: 0 additions & 4 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
Devbridge Group accelerates software to market for enterprise clients through dedicated product teams, user experience and software engineering expertise.

[www.devbridge.com](http://www.devbridge.com/)

# Ajax Autocomplete for jQuery

Ajax Autocomplete for jQuery allows you to easily create
Expand Down
7 changes: 2 additions & 5 deletions spec/runner.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,8 @@
<script type="text/javascript" src="lib/jasmine-2.0.1/boot.js"></script>

<!-- jQuery -->
<script src="../scripts/jquery-2.1.1.js"></script>
<script src="../scripts/jquery.mockjax.js"></script>
<script type="text/javascript">
window.JSON || document.write('<scr' + 'ipt src="//cdnjs.cloudflare.com/ajax/libs/json2/20110223/json2.min.js"><\/scr' + 'ipt>');
</script>
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
<script src="../node_modules/jquery-mockjax/dist/jquery.mockjax.js"></script>

<!-- Autocomplete -->
<script src="../src/jquery.autocomplete.js"></script>
Expand Down
72 changes: 34 additions & 38 deletions typings/jquery-autocomplete/jquery.autocomplete-tests.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
///<reference path="../jquery/jquery.d.ts" />
///<reference path="../jquery-autocomplete/jquery.autocomplete.d.ts" />


// ----------------------------------------------------------------------------------------
// --------------------------------- WEBSITE EXAMPLE --------------------------------------
// ---------- https://www.devbridge.com/sourcery/components/jquery-autocomplete/ ----------
// --------------- https://devbridge.github.io/jQuery-Autocomplete/ -----------------------
// ----------------------------------------------------------------------------------------

var input = $('#autocomplete');
Expand All @@ -21,33 +19,33 @@ input.autocomplete({
serviceUrl: '/autocomplete/countries',
onSelect: function (suggestion) {
alert('You selected: ' + suggestion.value + ', ' + suggestion.data);
}
},
});

// Local lookup (no ajax):
var countries = [
{ value: 'Andorra', data: 'AD' },
// ...
{ value: 'Zimbabwe', data: 'ZZ' }
{ value: 'Zimbabwe', data: 'ZZ' },
];

input.autocomplete({
lookup: countries,
onSelect: function (suggestion) {
alert('You selected: ' + suggestion.value + ', ' + suggestion.data);
}
},
});

// Non standard query/results
input.autocomplete({
paramName: 'searchString',
transformResult: function(response: any, originalQuery: string): AutocompleteResponse {
transformResult: function (response: any, originalQuery: string): AutocompleteResponse {
return {
suggestions: $.map(response.myData, function (dataItem) {
return {value: dataItem.valueField, data: dataItem.dataField};
})
return { value: dataItem.valueField, data: dataItem.dataField };
}),
};
}
},
});

// ----------------------------------------------------------------------------------------
Expand All @@ -68,13 +66,11 @@ input.autocomplete().enable();
input.autocomplete().hide();
input.autocomplete().dispose();


// ----------------------------------------------------------------------------------------
// ------------------------------ TEST DEFAULT OPTIONS ------------------------------------
// ----------------------------------------------------------------------------------------

input.autocomplete({

//----------------o AJAX SETTINGS

serviceUrl: '/autocomplete/countries',
Expand All @@ -88,69 +84,69 @@ input.autocomplete({
//----------------o CONFIG SETTINGS

noCache: false,
delimiter: "-",
delimiter: '-',
onSearchStart(query: string) {
console.log("query: ", query);
console.log('query: ', query);
},
onSearchComplete(query: string, suggestions: AutocompleteSuggestion[]) {
console.log("query: ", query);
console.log("suggestions: ", suggestions);
console.log('query: ', query);
console.log('suggestions: ', suggestions);
},
onSearchError(query: string, jqXHR: JQueryXHR, textStatus: string, errorThrown: any) {
console.log("query: ", query);
console.log("jqXHR: ", jqXHR);
console.log("textStatus: ", textStatus);
console.log("errorThrown: ", errorThrown);
console.log('query: ', query);
console.log('jqXHR: ', jqXHR);
console.log('textStatus: ', textStatus);
console.log('errorThrown: ', errorThrown);
},
transformResult(response: any, originalQuery: string): AutocompleteResponse {
return {
suggestions: [
{ value: 'Andorra', data: 'AD' },
// ...
{ value: 'Zimbabwe', data: 'ZZ' }
]
}
return {
suggestions: [
{ value: 'Andorra', data: 'AD' },
// ...
{ value: 'Zimbabwe', data: 'ZZ' },
],
};
},
onSelect(suggestion: AutocompleteSuggestion) {
console.log("suggestions: ", suggestion);
console.log('suggestions: ', suggestion);
},
minChars: 1,
lookupLimit: 1,
lookup: [
{ value: 'Andorra', data: 'AD' },
// ...
{ value: 'Zimbabwe', data: 'ZZ' }
{ value: 'Zimbabwe', data: 'ZZ' },
],
lookupFilter(suggestion: AutocompleteSuggestion, query: string, queryLowercase: string): any {
return query !== "query"
return query !== 'query';
},
triggerSelectOnValidInput: true,
preventBadQueries: true,
autoSelectFirst: false,
onHide(container: any) {
console.log("container: ", container);
console.log('container: ', container);
},

//----------------o PRESENTATION SETTINGS

beforeRender(container: any) {
console.log("container: ", container);
console.log('container: ', container);
},
formatResult(suggestion: AutocompleteSuggestion, currentValue: string): string {
return currentValue;
},
groupBy: "category",
groupBy: 'category',
maxHeight: 300,
width: "auto",
width: 'auto',
zIndex: 9999,
appendTo: document.body,
forceFixPosition: false,
orientation: "bottom",
orientation: 'bottom',
preserveInput: false,
showNoSuggestionNotice: false,
noSuggestionNotice: "No results",
noSuggestionNotice: 'No results',
onInvalidateSelection() {
console.log("onInvalidateSelection");
console.log('onInvalidateSelection');
},
tabDisabled: false
tabDisabled: false,
});
Loading

0 comments on commit abbdea0

Please sign in to comment.