@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
205 lines (203 loc) • 9.72 kB
TypeScript
import type PopupTemplate from "../../PopupTemplate.js";
import type { IdentifiableMixin, IdentifiableMixinProperties } from "../../core/Identifiable.js";
import type { JSONSupport } from "../../core/JSONSupport.js";
import type { SymbolUnion } from "../../symbols/types.js";
import type { GetResultsCallback, GetSuggestionsCallback, SearchFilter } from "./types.js";
import type { PopupTemplateProperties } from "../../PopupTemplate.js";
export interface SearchSourceProperties extends IdentifiableMixinProperties, Partial<Pick<SearchSource, "autoNavigate" | "filter" | "getResults" | "getSuggestions" | "maxResults" | "maxSuggestions" | "minSuggestCharacters" | "outFields" | "placeholder" | "popupEnabled" | "prefix" | "resultGraphicEnabled" | "resultSymbol" | "suffix" | "suggestionsEnabled" | "withinViewEnabled" | "zoomScale">> {
/**
* The popup template used to display search results.
* If no popup is needed, set the source's popupTemplate to `null`.
*
* > [!WARNING]
* >
* > This property should be set in instances
* > where there is no existing [PopupTemplate](https://developers.arcgis.com/javascript/latest/references/core/PopupTemplate/)
* > configured. For example, [feature sources](https://developers.arcgis.com/javascript/latest/references/core/widgets/Search/LayerSearchSource/)
* > will default to any existing [FeatureLayer.popupTemplate](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#popupTemplate)
* > configured on the layer.
*/
popupTemplate?: PopupTemplateProperties | null;
}
/**
* The following properties define generic [Search.sources](https://developers.arcgis.com/javascript/latest/references/core/widgets/Search/#sources) properties
* for use in the [Search widget](https://developers.arcgis.com/javascript/latest/references/core/widgets/Search/) or [Search component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-search/). Please see the sublasses that extend this
* class for more information about working with Search sources.
*
* @since 4.0
* @see [Search widget](https://developers.arcgis.com/javascript/latest/references/core/widgets/Search/) - _Deprecated since 4.33. Use the [Search component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-search/) instead._
* @see [Search component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-search/)
* @see [LayerSearchSource](https://developers.arcgis.com/javascript/latest/references/core/widgets/Search/LayerSearchSource/)
* @see [LocatorSearchSource](https://developers.arcgis.com/javascript/latest/references/core/widgets/Search/LocatorSearchSource/)
* @see [Sample - Search component with multiple sources](https://developers.arcgis.com/javascript/latest/sample-code/search-component-multisource/)
* @see [Sample - Search component with custom source](https://developers.arcgis.com/javascript/latest/sample-code/search-component-customsource/)
*/
export default class SearchSource extends SearchSourceSuperclass {
constructor(properties?: SearchSourceProperties);
/**
* Indicates whether to automatically navigate to the
* selected result once selected.
*
* @default true
*/
accessor autoNavigate: boolean | null | undefined;
/**
* For filtering suggests or search results. Setting a value here takes precedence over [withinViewEnabled](https://developers.arcgis.com/javascript/latest/references/core/widgets/Search/SearchSource/#withinViewEnabled).
* Please see the object specification table below for details.
*
* @since 4.4
* @example
* const theExtent = new Extent({
* xmin: 11376463,
* ymin: -5163501,
* xmax: 18890529,
* ymax: -662888,
* spatialReference: {
* wkid: 3857
* }
* });
*
* const searchExtent = {
* geometry: theExtent,
* where: "TERRITORY = 'Northern Territory'"
* };
*
* const sources = [{
* layer: featureLayerTourism,
* placeholder: "Darwin",
* maxResults: 5,
* searchFields: ["POI"],
* displayField: "POI",
* name: "In a Sunburned Country",
* filter: searchExtent
* }];
*
* const searchWidget = new Search({
* view: view,
* sources: sources
* });
*/
accessor filter: SearchFilter | null | undefined;
/**
* Function used to get search results. See [GetResultsCallback](https://developers.arcgis.com/javascript/latest/references/core/widgets/Search/types/#GetResultsCallback) for the function definition.
* When resolved, returns an object containing an array of [search results](https://developers.arcgis.com/javascript/latest/references/core/widgets/Search/types/#SearchResult).
*
* @returns When resolved, returns an object containing an array of [search results](https://developers.arcgis.com/javascript/latest/references/core/widgets/Search/types/#SearchResult).
* @see [Sample - Search component with custom source](https://developers.arcgis.com/javascript/latest/sample-code/search-component-customsource/)
*/
accessor getResults: GetResultsCallback | null | undefined;
/**
* Function used to get search suggestions. See [GetSuggestionsCallback](https://developers.arcgis.com/javascript/latest/references/core/widgets/Search/types/#GetSuggestionsCallback) for the function definition.
* When resolved, returns an object containing an array of [suggest results](https://developers.arcgis.com/javascript/latest/references/core/widgets/Search/types/#SuggestResult).
*
* @returns When resolved, returns an object containing an array of [suggest results](https://developers.arcgis.com/javascript/latest/references/core/widgets/Search/types/#SuggestResult).
* @see [Sample - Search component with custom source](https://developers.arcgis.com/javascript/latest/sample-code/search-component-customsource/)
*/
accessor getSuggestions: GetSuggestionsCallback | null | undefined;
/**
* Indicates the maximum number of search results to return.
*
* @default 6
*/
accessor maxResults: number | null | undefined;
/**
* Indicates the maximum number of suggestions
* to return for the widget's input.
*
* @default 6
*/
accessor maxSuggestions: number | null | undefined;
/**
* Indicates the minimum number of characters
* required before querying for a suggestion.
*/
accessor minSuggestCharacters: number | null | undefined;
/** Specifies the fields returned with the search results. */
accessor outFields: string[] | null | undefined;
/**
* Used as a hint for the source input text.
*
* @default ""
*/
accessor placeholder: string | null | undefined;
/**
* Indicates whether to display a
* [Popup](https://developers.arcgis.com/javascript/latest/references/core/widgets/Popup/) when a selected result is clicked.
*/
accessor popupEnabled: boolean | null | undefined;
/**
* The popup template used to display search results.
* If no popup is needed, set the source's popupTemplate to `null`.
*
* > [!WARNING]
* >
* > This property should be set in instances
* > where there is no existing [PopupTemplate](https://developers.arcgis.com/javascript/latest/references/core/PopupTemplate/)
* > configured. For example, [feature sources](https://developers.arcgis.com/javascript/latest/references/core/widgets/Search/LayerSearchSource/)
* > will default to any existing [FeatureLayer.popupTemplate](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#popupTemplate)
* > configured on the layer.
*/
get popupTemplate(): PopupTemplate | null | undefined;
set popupTemplate(value: PopupTemplateProperties | null | undefined);
/**
* Specify this to prefix the user's input of the search text.
*
* @default ""
*/
accessor prefix: string;
/**
* Indicates whether to show a graphic on the
* map for the selected source using the [resultSymbol](https://developers.arcgis.com/javascript/latest/references/core/widgets/Search/SearchSource/#resultSymbol).
* If using a [LayerSearchSource](https://developers.arcgis.com/javascript/latest/references/core/widgets/Search/LayerSearchSource/), then this property only applies when the `LayerSearchSource` is not part of the map.
*/
accessor resultGraphicEnabled: boolean | null | undefined;
/**
* The symbol used to display the result.
*
* > [!WARNING]
* >
* > **Known Limitations**
* >
* > This property only applies when the layer/locator/source is not part of the map.
*/
accessor resultSymbol: SymbolUnion | null | undefined;
/**
* Specify this to add a suffix to the user's input for the search value.
*
* @default ""
*/
accessor suffix: string;
/**
* Indicates whether to display suggestions
* as the user enters input text in the widget.
*
* @default true
*/
accessor suggestionsEnabled: boolean | null | undefined;
/**
* Indicates whether to constrain the search
* results to the view's extent.
*
* @default false
*/
accessor withinViewEnabled: boolean;
/**
* The set zoom scale for the resulting search result.
* This scale is automatically honored.
*
* @example
* let searchWidget = new Search({
* view: view,
* sources: [
* {
* layer: featureLayer,
* searchFields: ["Name", "Team"],
* name: "LayerSearchSource",
* zoomScale: 500000
* }
* ]
* });
*/
accessor zoomScale: number | null | undefined;
}
declare const SearchSourceSuperclass: typeof JSONSupport & typeof IdentifiableMixin