@arcgis/map-components
Version:
ArcGIS Map Components
390 lines (388 loc) • 21.3 kB
TypeScript
/// <reference types="@arcgis/core/interfaces.d.ts" />
/// <reference types="../../index.d.ts" />
import { default as SearchViewModel } from '@arcgis/core/widgets/Search/SearchViewModel.js';
import { ArcgisReferenceElement } from '../../utils/component-utils';
import { JsxNode, PublicLitElement as LitElement, TargetedEvent } from '@arcgis/lumina';
import { Nil } from '@arcgis/components-utils';
import { Use } from '@arcgis/lumina/controllers';
type ActiveMenu = "none" | "source" | "suggestion";
declare const useSearchViewModel: (component: LitElement & Pick<SearchViewModel, never> & import('../../controllers/useViewModel').ViewModelControllerUses<SearchViewModel>) => SearchViewModel;
/**
* The Search component provides a way to perform search operations on locator service(s), map/feature service feature layer(s), SceneLayers with an associated feature layer,
* BuildingComponentSublayer with an associated feature layer, GeoJSONLayer, CSVLayer, OGCFeatureLayer, and/or table(s). If using a locator with a geocoding service, the
* findAddressCandidates operation is used, whereas queries are used on feature layers.
*
* By default, the Search component uses the ArcGIS World Geocoding Service via this URL: `https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer`.
* If a global apiKey is present, the Search component uses this URL: `https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer`. If an apiKey
* is present on the LocatorSearchSource, then the Search component uses the URL defined by the LocatorSearchSource.url property.
*
* The Search component sets the view on the Search result. The level of detail (LOD) at the center of the view depends on the data source, with higher quality data
* sources returning extents closer to the `feature` obtained from the search. To manually define the scale of the view at the Search result, use the `zoomScale` property
* of the LocatorSearchSource or LayerSearchSource. Search component results are typically sorted according to their relevance to the search and their relative importance.
* However, when the scale of the MapView or SceneView is less than or equal to 300,000, the operations support prioritization of candidates based on their distance from a
* specified point (the center of the view) by passing in the `location parameter`. Features closest to the input location show up higher in the list of results.
* This behavior can be changed by using the localSearchDisabled property.
*
* [Read more...](https://developers.arcgis.com/javascript/latest/references/map-components/arcgis-search/)
*/
export declare class ArcgisSearch extends LitElement {
/**
* By assigning the `id` attribute of the Map or Scene component to this property, you can position a child component anywhere in the DOM while still maintaining a connection to the Map or Scene.
*
* @see [Associate components with a Map or Scene component](https://developers.arcgis.com/javascript/latest/programming-patterns/#associate-components-with-a-map-or-scene-component)
*/
referenceElement?: ArcgisReferenceElement | string;
/** @default "top-left" */
position: __esri.UIPosition;
/**
* This function provides the ability to override either the
* [MapView goTo()](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#goTo) or
* [SceneView goTo()](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#goTo) methods.
*
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#goToOverride)
*
* @since 4.33
*/
goToOverride: nullish | __esri.GoToOverride;
/**
* Icon which represents the component.
* Typically used when the component is controlled by another component (e.g. by the Expand component).
*
* @see [Calcite Icons](https://developers.arcgis.com/calcite-design-system/icons/)
* @default "search"
*/
icon: string;
/**
* The current active menu of the Search component.
*
* @default "none"
*/
activeMenu: ActiveMenu;
/**
* The [source](#sources) object currently selected. Can be either a
* [LayerSearchSource](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-LayerSearchSource.html) or a [LocatorSearchSource](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-LocatorSearchSource.html).
*
* @default null
*/
get activeSource(): Nil | (__esri.LayerSearchSource | __esri.LocatorSearchSource);
/**
* The selected source's index. This value is `-1` when all sources are selected.
*
* @default 0
*/
activeSourceIndex: number;
/**
* String value used as a hint for input text when searching on multiple sources. See
* the image below to view the location and style of this text in the context of the component.
*
* 
*
* @default "Find address or place"
*/
allPlaceholder: string | nullish;
/**
* The combined collection of [defaultSources](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#defaultSources)
* and [sources](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#sources).
* The [defaultSources](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#defaultSources)
* displays first in the Search UI.
*/
readonly allSources: __esri.Collection<__esri.LayerSearchSource | __esri.LocatorSearchSource>;
/**
* Indicates whether to automatically navigate to the selected result.
*
* @default false
*/
autoNavigateDisabled: boolean;
/**
* Indicates whether to automatically select and zoom to the first geocoded result. If `false`, the
* [findAddressCandidates](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-find-address-candidates.htm)
* operation will still geocode the input string, but the top result will not be selected. To work with the
* geocoded results, you can set up a [search-complete](#event-search-complete) event handler and get the results
* through the event object.
*
* @default false
*/
autoSelectDisabled: boolean;
/**
* A read-only property that is a [Collection](https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html)
* of [LayerSearchSource](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-LayerSearchSource.html)
* and/or [LocatorSearchSource](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-LocatorSearchSource.html). This property
* may contain [ArcGIS Portal](https://enterprise.arcgis.com/en/portal/)
* [locators](http://enterprise.arcgis.com/en/server/latest/publish-services/windows/geocode-services.htm)
* and any web map or web scene [configurable search sources](http://doc.arcgis.com/en/arcgis-online/create-maps/configure-feature-search.htm).
* Web maps or web scenes may contain
* [map](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-MapImageLayer.html)/[feature](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html) service feature
* layer(s), and/or [table(s)](https://developers.arcgis.com/javascript/latest/api-reference/esri-webdoc-applicationProperties-SearchTable.html) as sources.
*
* This property is used to populate the Search UI if the [sources](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#sources) property is not set.
*/
readonly defaultSources: __esri.Collection<__esri.LayerSearchSource | __esri.LocatorSearchSource>;
/**
* When true, the component is visually withdrawn and cannot be interacted with.
*
* @default false
*/
disabled: boolean;
/**
* Indicates whether or not to include [defaultSources](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#defaultSources) in the Search UI.
* This can be a boolean value or a function that returns an array of Search [sources](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#sources).
*
* @default false
*/
includeDefaultSourcesDisabled: boolean | Function;
/**
* Enables location services within the component.
*
* 
*
* ::: esri-md class="warning"
* The use of this property is only supported on secure origins.
* To use it, switch your application to a secure origin, such as HTTPS.
* Note that localhost is considered "potentially secure" and can be used for easy testing in browsers that supports
* [Window.isSecureContext](https://developer.mozilla.org/en-US/docs/Web/API/isSecureContext#browser_compatibility)
* (currently Chrome and Firefox).
* :::
*
* @default false
*/
locationDisabled: boolean;
/**
* The maximum number of results returned by the component if not specified by the source.
*
* @default 6
*/
maxResults: number;
/**
* The maximum number of suggestions returned by the component if not specified by the source.
*
* If working with the default
* [ArcGIS Online Geocoding service](https://developers.arcgis.com/rest/geocode/api-reference/overview-world-geocoding-service.htm),
* the default remains at `5`.
*
* @default 6
*/
maxSuggestions: number;
/**
* The minimum number of characters needed for the search if not specified by the source.
*
* @default 3
*/
minSuggestCharacters: number;
/**
* Indicates whether to display the [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html) on feature click. The graphic can
* be clicked to display a [Popup](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html).
*
* @default false
*/
popupDisabled: boolean;
/**
* A customized [PopupTemplate](https://developers.arcgis.com/javascript/latest/api-reference/esri-PopupTemplate.html) for the selected feature.
* Note that any [templates](https://developers.arcgis.com/javascript/latest/api-reference/esri-PopupTemplate.html)
* defined on [allSources](#allSources) take precedence over those defined directly on the template.
*
* @autocast
* @default null
*/
popupTemplate: nullish | __esri.PopupTemplate;
/**
* It is possible to search a specified portal instance's [locator services](http://enterprise.arcgis.com/en/portal/latest/administer/windows/configure-portal-to-geocode-addresses.htm)
* Use this property to set this [ArcGIS Portal](https://enterprise.arcgis.com/en/portal/) instance to search.
*/
portal: nullish | __esri.Portal;
/**
* The graphic used to highlight the resulting feature or location.
*
* :::esri-md class="panel trailer-1"
* A graphic will be placed in the View's
* [graphics](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html#graphics)
* for [layer](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-LayerView.html)
* that do not support the `highlight` method.
* :::
*
* @default null
*/
readonly resultGraphic: nullish | __esri.Graphic;
/**
* Indicates if the [resultGraphic](#resultGraphic) will display at the
* location of the selected feature.
*
* @default false
*/
resultGraphicDisabled: boolean;
/**
* An array of objects, each containing a [SearchResult](#SearchResult) from the search.
*
* @default null
*/
readonly results: nullish | __esri.SearchResults[];
/**
* Indicates whether to display the option to search all sources. When `true`, the "All" option
* is displayed by default:
*
* 
*
* When `false`, no option to search all sources at once is available:
*
* 
*
* @default false
*/
searchAllDisabled: boolean;
/** The value of the search box input text string. */
searchTerm: string;
/**
* The result selected from a search.
*
* @see [arcgisSelectResult](https://developers.arcgis.com/javascript/latest/references/map-components/arcgis-search/#arcgisSelectResult)
* @see [select()](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchViewModel.html#select)
* @default null
*/
readonly selectedResult: nullish | __esri.SearchResult;
/**
* The Search component may be used to search features in a
* [map](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-MapImageLayer.html)/[feature](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html) service feature
* layer(s), [SceneLayers](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-SceneLayer.html) with an associated feature layer,
* [BuildingComponentSublayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-buildingSublayers-BuildingComponentSublayer.html) with an associated feature layer,
* [GeoJSONLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-GeoJSONLayer.html), [CSVLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-CSVLayer.html) or
* [OGCFeatureLayer](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-OGCFeatureLayer.html), or [table](https://developers.arcgis.com/javascript/latest/api-reference/esri-webdoc-applicationProperties-SearchTable.html),
* or geocode locations with a [locator](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-locator.html). The `sources` property defines the sources from which
* to search for the [view](#view) specified by the Search component instance. There are two types of sources:
*
* * [LayerSearchSource](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-LayerSearchSource.html)
* * [LocatorSearchSource](https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-LocatorSearchSource.html)
*
* Any combination of these sources may be used
* together in the same instance of the Search component.
*
* ::: esri-md class="warning"
* Feature layers created from client-side graphics are not supported.
* :::
*
* @autocast {"typedCollection": true}
*/
sources: __esri.Collection<__esri.LayerSearchSource | __esri.LocatorSearchSource>;
/**
* An array of results from the [suggest method](#suggest).
*
* This is available if working with a 10.3 or greater geocoding service that has [suggest capability
* loaded](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-suggest.htm) or a
* 10.3 or greater feature layer that supports pagination, i.e. `supportsPagination = true`.
*
* @default null
*/
readonly suggestions: nullish | __esri.SuggestResults[];
/**
* Enable suggestions for the component.
*
* This is only available if working with a 10.3 or greater geocoding service that has [suggest capability
* loaded](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-suggest.htm) or a 10.3 or greater feature layer that supports pagination, i.e. `supportsPagination = true`.
*
* @default false
*/
suggestionsDisabled: boolean;
/**
* If true, the component will not be destroyed automatically when it is
* disconnected from the document. This is useful when you want to move the
* component to a different place on the page, or temporarily hide it. If this
* is set, make sure to call the [destroy](https://developers.arcgis.com/javascript/latest/references/map-components/arcgis-search/#destroy) method when you are done to
* prevent memory leaks.
*
* @default false
*/
autoDestroyDisabled: boolean;
/**
* Replace localized message strings with your own strings.
*
* _**Note**: Individual message keys may change between releases._
*/
messageOverrides?: typeof this.messages._overrides;
/** The component's default label. */
label?: string;
/**
* The current state of the component.
*
* @default "ready"
*/
readonly state: "ready" | "loading" | "disabled" | "searching";
/**
* Clears the current searchTerm, search results, suggest results, graphic, and graphics layer.
* It also hides any open menus.
*/
clear(): void;
/** Permanently destroy the component. */
destroy(): Promise<void>;
/**
* Depending on the sources specified, search() queries the feature layer(s) and/or performs
* address matching using any specified [locator(s)](https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-locator.html) and
* returns any applicable results.
*/
search(searchItem?: __esri.Graphic | __esri.Point | __esri.SuggestResult | Nil | number[] | string): Promise<__esri.SearchResponse | Nil>;
/**
* Performs a suggest() request on the active Locator. It also uses the current value of
* the component or one that is passed in.
*
* Suggestions are available if working with a 10.3 or greater geocoding service that has
* [suggest capability
* loaded](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-suggest.htm) or a 10.3 or greater feature layer that supports pagination, i.e.
* `supportsPagination = true`.
*/
suggest(query?: string): Promise<__esri.SuggestResponse | Nil>;
/** Brings focus to the component's text input. */
setFocus(): Promise<void>;
/** Emitted when the value of a property is changed. Use this to listen to changes to properties. */
readonly arcgisPropertyChange: TargetedEvent<this, {
name: "state";
}>;
/** Emitted when the component associated with a map or scene view is is ready to be interacted with. */
readonly arcgisReady: TargetedEvent<this, void>;
/** Fires when a result is cleared from the input box or a new result is selected. */
readonly arcgisSearchClear: TargetedEvent<this, __esri.SearchViewModelSearchClearEvent>;
/** Fires when the [search()](#search) method is called and returns its results. */
readonly arcgisSearchComplete: TargetedEvent<this, __esri.SearchViewModelSearchCompleteEvent>;
/** Fires when the [search()](#search) method starts. */
readonly arcgisSearchStart: TargetedEvent<this, __esri.SearchViewModelSearchStartEvent>;
/** Fires when a search result is selected. */
readonly arcgisSelectResult: TargetedEvent<this, __esri.SearchViewModelSelectResultEvent>;
/** Fires when the [suggest](#suggest) method is called and returns its results. */
readonly arcgisSuggestComplete: TargetedEvent<this, __esri.SearchViewModelSuggestCompleteEvent>;
/** Fires when the [suggest()](#suggest) method starts. */
readonly arcgisSuggestStart: TargetedEvent<this, __esri.SearchViewModelSuggestStartEvent>;
private messages: Partial<{
componentLabel: string;
searchButtonTitle: string;
placeholder: string;
searchIn: string;
all: string;
allPlaceholder: string;
locateError: string;
untitledResult: string;
untitledSource: string;
noResults: string;
noResultsFound: string;
noResultsFoundForValue: string;
showMoreResults: string;
hideMoreResults: string;
searchResult: string;
moreResultsHeader: string;
useCurrentLocation: string;
}> & import('@arcgis/lumina/controllers').T9nMeta<{
componentLabel: string;
searchButtonTitle: string;
placeholder: string;
searchIn: string;
all: string;
allPlaceholder: string;
locateError: string;
untitledResult: string;
untitledSource: string;
noResults: string;
noResultsFound: string;
noResultsFoundForValue: string;
showMoreResults: string;
hideMoreResults: string;
searchResult: string;
moreResultsHeader: string;
useCurrentLocation: string;
}>;
}
export {};