search-client
Version:
Javascript library for executing searches in the Haive search-index via the SearchManager REST interface.
39 lines • 1.84 kB
JavaScript
import { __extends } from "tslib";
import { BaseSettings } from '../Common';
import { QueryChangeSpecifications } from '../Common/QueryChangeSpecifications';
import { AutocompleteTriggers } from './AutocompleteTriggers';
/**
* These are all the settings that can affect the returned suggestions for autocomplete() lookups.
*/
var AutocompleteSettings = /** @class */ (function (_super) {
__extends(AutocompleteSettings, _super);
/**
* Creates an AutocompleteSettings object for you, based on AutocompleteSettings defaults and the overrides provided as a param.
* @param settings - The settings defined here will override the default AutocompleteSettings.
*/
function AutocompleteSettings(settings) {
var _this = _super.call(this) // dummy (using init instead)
|| this;
// Setup settings object before calling super.init with it.
if (typeof settings === 'string') {
settings = { baseUrl: settings };
}
settings.servicePath =
typeof settings.servicePath !== 'undefined'
? settings.servicePath
: 'autocomplete';
_super.prototype.init.call(_this, settings);
// Setup our own stuff (props not in the base class).
_this.triggers = new AutocompleteTriggers(settings.triggers);
// A change in any of the defined fields should indicate that the results may have changed.
_this.queryChangeSpecs =
typeof settings.queryChangeSpecs !== 'undefined'
? settings.queryChangeSpecs
: QueryChangeSpecifications.maxSuggestions |
QueryChangeSpecifications.queryText;
return _this;
}
return AutocompleteSettings;
}(BaseSettings));
export { AutocompleteSettings };
//# sourceMappingURL=AutocompleteSettings.js.map