@arcgis/map-components
Version:
ArcGIS Map Components
406 lines (405 loc) • 19.8 kB
TypeScript
/// <reference path="../../index.d.ts" />
import type Graphic from "@arcgis/core/Graphic.js";
import type SpatialReference from "@arcgis/core/geometry/SpatialReference.js";
import type Map from "@arcgis/core/Map.js";
import type Point from "@arcgis/core/geometry/Point.js";
import type { ArcgisReferenceElement, HeadingLevel } from "../types.js";
import type { PublicLitElement as LitElement } from "@arcgis/lumina";
import type { T9nMeta } from "@arcgis/lumina/controllers";
import type { MapViewOrSceneView } from "@arcgis/core/views/MapViewOrSceneView.js";
import type { State } from "@arcgis/core/popup/types.js";
/**
* > [!WARNING]
* > The Feature (next) component is the successor to the Feature component, provided to you early for testing and feedback. In version 6.0, the implementation of [arcgis-feature](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-feature/) will be updated under the hood to that of [arcgis-feature-next](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-feature-next/), and this component will be removed. To update at version 6.0, simply remove `-next` from the component name.
*
* The Feature (next) component displays a graphic according to its [PopupTemplate](https://developers.arcgis.com/javascript/latest/references/core/PopupTemplate/).
* This component is useful in instances where you want to display information about a graphic but without
* the use of an [arcgis-popup](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-popup/).
*
* To show a graphic's content with [actions](https://developers.arcgis.com/javascript/latest/references/core/PopupTemplate/#actions), [related records](https://developers.arcgis.com/javascript/latest/references/core/popup/content/RelationshipContent/), aggregate feature browser ([clustering](https://developers.arcgis.com/javascript/latest/references/core/layers/support/FeatureReductionCluster/#popupTemplate) or [binning](https://developers.arcgis.com/javascript/latest/references/core/layers/support/FeatureReductionBinning/#popupTemplate)), etc., then use the [arcgis-features-next](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-features-next/) component.
*
* When Arcade expressions that use `$map` or [geometry functions](https://developers.arcgis.com/arcade/function-reference/geometry_functions/) are defined in any popup template content or as expression elements,
* the [map](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-feature-next/#map) and [spatialReference](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-feature-next/#spatialReference) properties need to be defined in the Feature (next) component.
*
* @see [Arcade Profiles: Popup](https://developers.arcgis.com/arcade/profiles/popup/)
* @see [Arcade - expression language](https://developers.arcgis.com/javascript/latest/arcade/)
* @beta
* @since 5.1
*/
export abstract class ArcgisFeatureNext extends LitElement {
/**
* 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/components/arcgis-feature-next/#destroy) method when you are done to
* prevent memory leaks.
*
* @default false
*/
accessor autoDestroyDisabled: boolean;
/**
* Indicates whether to disable chart animation in the component.
*
* @default false
*/
accessor chartAnimationDisabled: boolean;
/**
* Enables automatic creation of a popup template for layers that have popups enabled but no popupTemplate defined. Automatic popup templates are supported for layers that support the `createPopupTemplate` method.
*
* **Note:** Starting with version 4.28, `date` fields are formatted using the `short-date-short-time` preset [dateFormat](https://developers.arcgis.com/javascript/latest/references/core/popup/support/FieldInfoFormat/#dateFormat) rather than `long-month-day-year` in default [popup](https://developers.arcgis.com/javascript/latest/references/core/PopupTemplate/) created by setting the `defaultPopupTemplateEnabled` property to `true`.
* For example, previously a date that may have appeared as `"December 30, 1997"` will now appear as `"12/30/1997 6:00 PM"`.
*
* @default false
*/
accessor defaultPopupTemplateEnabled: boolean;
/**
* The [Graphic](https://developers.arcgis.com/javascript/latest/references/core/Graphic/) used to represent the feature.
*
* @default null
* @see [PopupTemplate.content](https://developers.arcgis.com/javascript/latest/references/core/PopupTemplate/#content)
* @example
* ```js
* let graphic = new Graphic({
* geometry: view.center,
* attributes: {
* name: "Spruce",
* family: "Pinaceae",
* count: 126
* },
* symbol: new SimpleMarkerSymbol({
* style: "square",
* color: "blue",
* size: "8px"
* }),
* popupTemplate: {
* content: [
* {
* // Set popup template content
* }
* ]
* }
* });
* ```
*/
accessor graphic: Graphic | null | undefined;
/**
* The title for the feature. This can be disabled by setting the [hideHeading](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-feature-next/#hideHeading) property to `true`.
*
* @default null
* @see [headingLevel](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-feature-next/#headingLevel)
* @see [hideHeading](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-feature-next/#hideHeading)
*/
get heading(): string;
/**
* Indicates the heading level to use for the headings in the component.
*
* @default 2
*/
accessor headingLevel: HeadingLevel;
/**
* Indicates whether to hide [attachments content](https://developers.arcgis.com/javascript/latest/references/core/popup/content/AttachmentsContent/) within the component.
*
* @default false
*/
accessor hideAttachmentsContent: boolean;
/**
* Indicates whether to hide the component's content.
*
* @default false
*/
accessor hideContent: boolean;
/**
* Indicates whether to hide [custom content](https://developers.arcgis.com/javascript/latest/references/core/popup/content/CustomContent/) within the component.
*
* @default false
*/
accessor hideCustomContent: boolean;
/**
* Indicates whether to hide [expression content](https://developers.arcgis.com/javascript/latest/references/core/popup/content/ExpressionContent/) within the component.
*
* @default false
*/
accessor hideExpressionContent: boolean;
/**
* Indicates whether to hide [fields content](https://developers.arcgis.com/javascript/latest/references/core/popup/content/FieldsContent/) within the component.
*
* @default false
*/
accessor hideFieldsContent: boolean;
/**
* Indicates whether to hide the component's [heading](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-feature-next/#heading).
*
* @default false
*/
accessor hideHeading: boolean;
/**
* Indicates whether to hide the last edited info in the component.
*
* @default false
*/
accessor hideLastEditedInfo: boolean;
/**
* Indicates whether to hide [media content](https://developers.arcgis.com/javascript/latest/references/core/popup/content/MediaContent/) within the component.
*
* @default false
*/
accessor hideMediaContent: boolean;
/**
* Indicates whether to hide [text content](https://developers.arcgis.com/javascript/latest/references/core/popup/content/TextContent/) within the component.
*
* @default false
*/
accessor hideTextContent: boolean;
/**
* Icon which represents the component.
* Typically used when the component is controlled by another component (e.g. by the Expand component).
*
* @default "icon"
* @see [Calcite Icons](https://developers.arcgis.com/calcite-design-system/icons/)
*/
accessor icon: string | undefined;
/**
* Indicates whether the current graphic resides in a non-spatial table.
*
* @default false
* @since 5.1
*/
get isFeatureFromTable(): boolean;
/** The component's default label. */
accessor label: string | undefined;
/**
* The [Point](https://developers.arcgis.com/javascript/latest/references/core/geometry/Point/) representing the location of the map interaction used to trigger the opening of the component.
*
* @since 5.1
* @see [PopupTemplate#content](https://developers.arcgis.com/javascript/latest/references/core/PopupTemplate/#content)
* @see [Arcade Profiles: Popup](https://developers.arcgis.com/arcade/profiles/popup/)
* @example
* view.on("click", (event) => {
* const { mapPoint } = event;
* feature.viewModel.location = mapPoint;
* });
*/
accessor location: Point | null | undefined;
/**
* A map is required when the input [graphic](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-feature-next/#graphic) has a popupTemplate that contains [Arcade](https://developers.arcgis.com/arcade) expressions in [ExpressionInfo](https://developers.arcgis.com/javascript/latest/references/core/popup/ExpressionInfo/) or [ExpressionContent](https://developers.arcgis.com/javascript/latest/references/core/popup/content/ExpressionContent/) that may use the `$map` profile variable to access data from layers within a map. Without a map, expressions that use `$map` will throw an error.
*
* @default null
* @see [Type system](https://developers.arcgis.com/arcade/guide/types/#featuresetcollection)
* @see [Arcade Profiles: Popup](https://developers.arcgis.com/arcade/profiles/popup/)
* @example
* ```js
* // The building footprints represent the buildings that intersect a clicked parcel
* let buildingFootprints = Intersects($feature, FeatureSetByName($map, "Building Footprints"));
* ```
*/
accessor map: Map | null | undefined;
/**
* Replace localized message strings with your own strings.
*
* _**Note**: Individual message keys may change between releases._
*/
accessor messageOverrides: {
componentLabel?: string | undefined;
fields?: string | undefined;
fieldsSummary?: string | undefined;
media?: string | undefined;
next?: string | undefined;
noTitle?: string | undefined;
previous?: string | undefined;
lastEdited?: string | undefined;
lastCreated?: string | undefined;
lastEditedByUser?: string | undefined;
lastCreatedByUser?: string | undefined;
loadingError?: string | undefined;
loading?: string | undefined;
showAll?: string | undefined;
numberRecords?: string | undefined;
relatedFeaturesList?: string | undefined;
noRelatedFeatures?: string | undefined;
relationshipNotFound?: string | undefined;
pageText?: string | undefined;
associationsAttachments?: string | undefined;
associationsConnectivity?: string | undefined;
associationsContainer?: string | undefined;
associationsContents?: string | undefined;
associationsJunctionEdgeFrom?: string | undefined;
associationsJunctionEdgeMidspan?: string | undefined;
associationsJunctionEdgeTo?: string | undefined;
associationsJunctionJunction?: string | undefined;
associationsList?: string | undefined;
associationsStructure?: string | undefined;
noAssociations?: string | undefined;
associationFilterPlaceholder?: string | undefined;
associationsLimitNoticeTitle?: string | undefined;
associationsLimitNoticeMessage?: string | undefined;
openInApp?: string | undefined;
view?: string | undefined;
error?: string | undefined;
returnToInitialFeature?: string | undefined;
};
/** @internal */
protected messages: Partial<{
componentLabel: string;
fields: string;
fieldsSummary: string;
media: string;
next: string;
noTitle: string;
previous: string;
lastEdited: string;
lastCreated: string;
lastEditedByUser: string;
lastCreatedByUser: string;
loadingError: string;
loading: string;
showAll: string;
numberRecords: string;
relatedFeaturesList: string;
noRelatedFeatures: string;
relationshipNotFound: string;
pageText: string;
associationsAttachments: string;
associationsConnectivity: string;
associationsContainer: string;
associationsContents: string;
associationsJunctionEdgeFrom: string;
associationsJunctionEdgeMidspan: string;
associationsJunctionEdgeTo: string;
associationsJunctionJunction: string;
associationsList: string;
associationsStructure: string;
noAssociations: string;
associationFilterPlaceholder: string;
associationsLimitNoticeTitle: string;
associationsLimitNoticeMessage: string;
openInApp: string;
view: string;
error: string;
returnToInitialFeature: string;
}> & T9nMeta<{
componentLabel: string;
fields: string;
fieldsSummary: string;
media: string;
next: string;
noTitle: string;
previous: string;
lastEdited: string;
lastCreated: string;
lastEditedByUser: string;
lastCreatedByUser: string;
loadingError: string;
loading: string;
showAll: string;
numberRecords: string;
relatedFeaturesList: string;
noRelatedFeatures: string;
relationshipNotFound: string;
pageText: string;
associationsAttachments: string;
associationsConnectivity: string;
associationsContainer: string;
associationsContents: string;
associationsJunctionEdgeFrom: string;
associationsJunctionEdgeMidspan: string;
associationsJunctionEdgeTo: string;
associationsJunctionJunction: string;
associationsList: string;
associationsStructure: string;
noAssociations: string;
associationFilterPlaceholder: string;
associationsLimitNoticeTitle: string;
associationsLimitNoticeMessage: string;
openInApp: string;
view: string;
error: string;
returnToInitialFeature: string;
}>;
/**
* 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)
*/
accessor referenceElement: ArcgisReferenceElement | string | undefined;
/**
* This property provides the ability to hide or show [relationship content](https://developers.arcgis.com/javascript/latest/references/core/popup/content/RelationshipContent/) within the component.
*
* @default false
*/
accessor showRelationshipContent: boolean;
/**
* This property provides the ability to hide or show [utility network content](https://developers.arcgis.com/javascript/latest/references/core/popup/content/UtilityNetworkAssociationsContent/) within the component.
*
* @default false
*/
accessor showUtilityNetworkContent: boolean;
/**
* The spatial reference used for [Arcade](https://developers.arcgis.com/arcade) operations.
* This property should be set if the component executes Arcade expressions that contain [geometry functions](https://developers.arcgis.com/arcade/function-reference/geometry_functions/).
*
* @default null
* @see [Type system](https://developers.arcgis.com/arcade/guide/types/#featuresetcollection)
* @see [Arcade Profiles: Popup](https://developers.arcgis.com/arcade/profiles/popup/)
*/
accessor spatialReference: SpatialReference | null | undefined;
/**
* The current state of the component.
*
* @default "disabled"
*/
get state(): State;
/**
* Dates and times displayed in the component will be displayed in this time zone. By default this time zone is
* inherited from [MapView.timeZone](https://developers.arcgis.com/javascript/latest/references/core/views/MapView/#timeZone). When a MapView is not associated with the component,
* then the property will fallback to the `system` time zone.
*
* **Possible Values**
* - `system`: Dates and times will be displayed in the timezone of the device or browser.
* - `unknown`: Dates and time are not adjusted for any timezone.
* - Specified IANA timezone: Dates and times will be displayed in the specified IANA time zone. See [wikipedia - List of tz database time zones](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
*/
accessor timeZone: string;
/**
* The view associated with the component.
* > **Note:** The recommended approach is to fully migrate applications to use map and scene components and avoid using MapView and SceneView directly. However, if you are migrating a large application from widgets to components, you might prefer a more gradual transition. To support this use case, the SDK includes this `view` property which connects a component to a MapView or SceneView. Ultimately, once migration is complete, the arcgis-feature-next component will be associated with a map or scene component rather than using the `view` property.
*/
accessor view: MapViewOrSceneView | null | undefined;
/** Permanently destroy the component. */
destroy(): Promise<void>;
/**
* Paginates to the next [media](https://developers.arcgis.com/javascript/latest/references/core/popup/content/MediaContent/) info.
*
* @param contentElementIndex
*/
nextMedia(contentElementIndex: number): void;
/**
* Paginates to the previous [media](https://developers.arcgis.com/javascript/latest/references/core/popup/content/MediaContent/) info.
*
* @param contentElementIndex
*/
previousMedia(contentElementIndex: number): void;
/**
* Paginates to a specified [media](https://developers.arcgis.com/javascript/latest/references/core/popup/content/MediaContent/) info object. For example,
* you may have [media](https://developers.arcgis.com/javascript/latest/references/core/popup/content/MediaContent/) content which contains
* multiple `mediaInfos`. This method allows you to specify the index of the `mediaInfos`
* you wish to display.
*
* @param contentElementIndex
* @param mediaInfoIndex
*/
setActiveMedia(contentElementIndex: number, mediaInfoIndex: number): void;
/**
* Updates the geometry of the graphic.
*
* @since 5.1
*/
updateGeometry(): Promise<void>;
/** Emitted when the value of a property is changed. Use this to listen to changes to properties. */
readonly arcgisPropertyChange: import("@arcgis/lumina").TargetedEvent<this, { name: "flowItems" | "state"; }>;
/** Emitted when the component associated with a map or scene view is ready to be interacted with. */
readonly arcgisReady: import("@arcgis/lumina").TargetedEvent<this, void>;
readonly "@eventTypes": {
arcgisPropertyChange: ArcgisFeatureNext["arcgisPropertyChange"]["detail"];
arcgisReady: ArcgisFeatureNext["arcgisReady"]["detail"];
};
}