@arcgis/core 5.2.0-next.139 → 5.2.0-next.140
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/arcgisGlobal.d.ts +10 -10
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{86d8ccb795611cd6d071.js → 00a600c71ceebe7bfeee.js} +1 -1
- package/assets/esri/core/workers/chunks/0193df3f9fb23633da87.js +1 -0
- package/assets/esri/core/workers/chunks/{3a0b19275751a3a73cd5.js → 07aa6d36f1006b6ab7ff.js} +1 -1
- package/assets/esri/core/workers/chunks/{a054da6cbd8ee4774a57.js → 1f3148cebee1961249a4.js} +1 -1
- package/assets/esri/core/workers/chunks/222af8522773c7dc80b1.js +1 -0
- package/assets/esri/core/workers/chunks/{a4d0df0177ac28e42219.js → 303fde8f3459dde16555.js} +1 -1
- package/assets/esri/core/workers/chunks/{51dd6df99dfe443df218.js → 350540770781b281c39a.js} +1 -1
- package/assets/esri/core/workers/chunks/{f5f4521119d2ce2465d7.js → 3b017b718ea2d4ed498f.js} +1 -1
- package/assets/esri/core/workers/chunks/{1bf5e4b56c32a853f200.js → 3e81dfc9d621ece038fe.js} +1 -1
- package/assets/esri/core/workers/chunks/{685cef5d2245450dc695.js → 4097edb2ad522dff50ce.js} +1 -1
- package/assets/esri/core/workers/chunks/{2398d1ee310bbbc1e20c.js → 4d82db661365daa513a6.js} +1 -1
- package/assets/esri/core/workers/chunks/{544a1326c12e71b33dd8.js → 641d196a554bd07f729e.js} +1 -1
- package/assets/esri/core/workers/chunks/{dce78ea26d078d9c4667.js → 798a63653f82c0e842c5.js} +1 -1
- package/assets/esri/core/workers/chunks/84fcbf7a1d04f01685d1.js +1 -0
- package/assets/esri/core/workers/chunks/{459d5dca9c915b13cfce.js → 8e511079918e2fd9261f.js} +1 -1
- package/assets/esri/core/workers/chunks/{0a8463fe687d3193dd8b.js → fc5a36e54929e03efa86.js} +1 -1
- package/assets/esri/libs/librust-parquet/pkg/parquet_bg.wasm +0 -0
- package/config.js +1 -1
- package/kernel.js +1 -1
- package/{layers/list/BasemapItemCollection.d.ts → layerList/BasemapLayerListModel.d.ts} +14 -14
- package/layerList/BasemapLayerListModel.js +2 -0
- package/{layers/list/CatalogItemCollection.d.ts → layerList/CatalogLayerListModel.d.ts} +15 -15
- package/layerList/CatalogLayerListModel.js +2 -0
- package/{layers/list → layerList}/Item.d.ts +22 -22
- package/layerList/Item.js +2 -0
- package/{layers/list → layerList}/ItemPanel.d.ts +3 -3
- package/layerList/ItemPanel.js +2 -0
- package/{layers/list/LayerItemCollection.d.ts → layerList/LayerListModel.d.ts} +16 -16
- package/layerList/LayerListModel.js +2 -0
- package/{layers/list → layerList}/TableItem.d.ts +11 -11
- package/layerList/TableItem.js +2 -0
- package/{layers/list → layerList}/TableItemPanel.d.ts +2 -2
- package/layerList/TableItemPanel.js +2 -0
- package/{layers/list/TableItemCollection.d.ts → layerList/TableListModel.d.ts} +15 -15
- package/layerList/TableListModel.js +2 -0
- package/{layers/list → layerList}/types.d.ts +29 -29
- package/layers/support/LabelExpressionInfo.d.ts +7 -1
- package/layers/support/LabelExpressionInfo.js +1 -1
- package/package.json +2 -2
- package/popup/{FeatureContent.d.ts → FeatureModel.d.ts} +11 -11
- package/popup/{FeatureContent.js → FeatureModel.js} +1 -1
- package/popup/{FeatureContentCollection.d.ts → FeaturesModel.d.ts} +62 -62
- package/popup/FeaturesModel.js +2 -0
- package/widgets/DirectionalPad/DirectionalPadViewModel.d.ts +2 -0
- package/widgets/DirectionalPad/types.d.ts +5 -1
- package/widgets/DirectionalPad.d.ts +1 -0
- package/widgets/Feature/FeatureViewModel.d.ts +1 -1
- package/widgets/Feature/FeatureViewModel.js +1 -1
- package/widgets/Features/FeaturesViewModel.d.ts +2 -2
- package/widgets/Features/FeaturesViewModel.js +1 -1
- package/widgets/LayerList/LayerListViewModel.d.ts +4 -4
- package/widgets/LayerList/LayerListViewModel.js +1 -1
- package/widgets/LayerList/ListItem.d.ts +5 -5
- package/widgets/LayerList/ListItemPanel.d.ts +4 -4
- package/widgets/LayerList/types.d.ts +7 -7
- package/widgets/Popup/PopupViewModel.d.ts +1 -1
- package/widgets/Popup/PopupViewModel.js +1 -1
- package/widgets/support/SelectionList/FeatureItem.d.ts +9 -2
- package/assets/esri/core/workers/chunks/069bd90cbb7377e2e4bc.js +0 -1
- package/assets/esri/core/workers/chunks/f3214bccb039338acadf.js +0 -1
- package/assets/esri/core/workers/chunks/fd2cea0761587adaa6c9.js +0 -1
- package/layers/list/BasemapItemCollection.js +0 -2
- package/layers/list/CatalogItemCollection.js +0 -2
- package/layers/list/Item.js +0 -2
- package/layers/list/ItemPanel.js +0 -2
- package/layers/list/LayerItemCollection.js +0 -2
- package/layers/list/TableItem.js +0 -2
- package/layers/list/TableItemCollection.js +0 -2
- package/layers/list/TableItemPanel.js +0 -2
- package/popup/FeatureContentCollection.js +0 -2
- /package/{layers/list → layerList}/support/layerListUtils.js +0 -0
|
@@ -3,7 +3,7 @@ import type EsriMap from "../Map.js";
|
|
|
3
3
|
import type Collection from "../core/Collection.js";
|
|
4
4
|
import type Point from "../geometry/Point.js";
|
|
5
5
|
import type SpatialReference from "../geometry/SpatialReference.js";
|
|
6
|
-
import type
|
|
6
|
+
import type FeatureModel from "./FeatureModel.js";
|
|
7
7
|
import type FeatureAbilities from "./support/FeatureAbilities.js";
|
|
8
8
|
import type { EventedAccessor } from "../core/Evented.js";
|
|
9
9
|
import type { ScreenPoint, ScreenRect } from "../core/types.js";
|
|
@@ -20,14 +20,14 @@ import type { ReadonlyArrayOrCollection } from "../core/Collection.js";
|
|
|
20
20
|
import type { FeatureAbilitiesProperties } from "./support/FeatureAbilities.js";
|
|
21
21
|
import type { PointProperties } from "../geometry/Point.js";
|
|
22
22
|
|
|
23
|
-
export interface
|
|
23
|
+
export interface FeaturesModelProperties extends GoToProperties, Partial<Pick<FeaturesModel, "activeFeature" | "aggregatedFeaturesEnabled" | "content" | "defaultPopupTemplateEnabled" | "featurePage" | "features" | "featuresPerPage" | "featureStream" | "heading" | "highlightEnabled" | "includeDefaultActions" | "initialDisplayMode" | "map" | "open" | "selectedFeatureIndex" | "updateLocationEnabled" | "view" | "zoomFactor">> {
|
|
24
24
|
/**
|
|
25
25
|
* [Collection](https://developers.arcgis.com/javascript/latest/references/core/core/Collection/) of [action](https://developers.arcgis.com/javascript/latest/references/core/support/actions/ActionButton/) or [action toggle](https://developers.arcgis.com/javascript/latest/references/core/support/actions/ActionToggle/) objects.
|
|
26
26
|
* Each action may be executed by clicking the icon or image symbolizing them.
|
|
27
27
|
* By default, a `Zoom To` action styled with a magnifying glass icon is included.
|
|
28
28
|
* When this icon is clicked, the view zooms in four LODs and centers on the selected feature.
|
|
29
29
|
*
|
|
30
|
-
* This default action can be removed by setting [includeDefaultActions](https://developers.arcgis.com/javascript/latest/references/core/popup/
|
|
30
|
+
* This default action can be removed by setting [includeDefaultActions](https://developers.arcgis.com/javascript/latest/references/core/popup/FeaturesModel/#includeDefaultActions) to `false`, or by setting the
|
|
31
31
|
* [PopupTemplate.overwriteActions](https://developers.arcgis.com/javascript/latest/references/core/PopupTemplate/#overwriteActions) property to `true` in a [PopupTemplate](https://developers.arcgis.com/javascript/latest/references/core/PopupTemplate/).
|
|
32
32
|
* The order of each action is the order in which they appear in the actions [Collection](https://developers.arcgis.com/javascript/latest/references/core/core/Collection/).
|
|
33
33
|
*
|
|
@@ -51,18 +51,18 @@ export interface FeatureContentCollectionProperties extends GoToProperties, Part
|
|
|
51
51
|
/** Defines the specific [FeatureAbilities](https://developers.arcgis.com/javascript/latest/references/core/popup/support/FeatureAbilities/) that can be used when querying and displaying content. */
|
|
52
52
|
featureItemAbilities?: FeatureAbilitiesProperties | null;
|
|
53
53
|
/**
|
|
54
|
-
* Geometry used to show the location of the feature. This is automatically set when selecting a feature. If displaying content not related to features in the map, such as the results from a task, then you must set this property before setting [open](https://developers.arcgis.com/javascript/latest/references/core/popup/
|
|
54
|
+
* Geometry used to show the location of the feature. This is automatically set when selecting a feature. If displaying content not related to features in the map, such as the results from a task, then you must set this property before setting [open](https://developers.arcgis.com/javascript/latest/references/core/popup/FeaturesModel/#open) to `true`.
|
|
55
55
|
*
|
|
56
56
|
* @see [Intro to popup component](https://developers.arcgis.com/javascript/latest/sample-code/intro-popup/)
|
|
57
57
|
* @example
|
|
58
58
|
* // Sets the location to the center of the view
|
|
59
|
-
*
|
|
60
|
-
*
|
|
59
|
+
* featuresModel.location = viewElement.center;
|
|
60
|
+
* featuresModel.open = true;
|
|
61
61
|
* @example
|
|
62
|
-
* // Display the
|
|
62
|
+
* // Display the featuresModel when and where the user clicks the view.
|
|
63
63
|
* reactiveUtils.on(()=>viewElement, "arcgisViewClick", ({ details: { mapPoint } })=>{
|
|
64
|
-
*
|
|
65
|
-
*
|
|
64
|
+
* featuresModel.location = mapPoint;
|
|
65
|
+
* featuresModel.open = true;
|
|
66
66
|
* });
|
|
67
67
|
*/
|
|
68
68
|
location?: PointProperties | null;
|
|
@@ -70,7 +70,7 @@ export interface FeatureContentCollectionProperties extends GoToProperties, Part
|
|
|
70
70
|
* The spatial reference used for [Arcade](https://developers.arcgis.com/arcade) operations.
|
|
71
71
|
* This property should be set if Arcade expressions are executed that contain [geometry functions](https://developers.arcgis.com/arcade/function-reference/geometry_functions/).
|
|
72
72
|
*
|
|
73
|
-
* Alternatively, the [view](https://developers.arcgis.com/javascript/latest/references/core/popup/
|
|
73
|
+
* Alternatively, the [view](https://developers.arcgis.com/javascript/latest/references/core/popup/FeaturesModel/#view) property can be used to provide the spatial reference instance for this property.
|
|
74
74
|
*
|
|
75
75
|
* @see [Type system](https://developers.arcgis.com/arcade/guide/types/#featuresetcollection)
|
|
76
76
|
* @see [Arcade Profiles: Popup](https://developers.arcgis.com/arcade/profiles/popup/)
|
|
@@ -78,7 +78,7 @@ export interface FeatureContentCollectionProperties extends GoToProperties, Part
|
|
|
78
78
|
spatialReference?: SpatialReferenceProperties | null;
|
|
79
79
|
/**
|
|
80
80
|
* Dates and times will be displayed in this time zone. By default this time zone is
|
|
81
|
-
* inherited from the associated [MapView](https://developers.arcgis.com/javascript/latest/references/core/views/MapView/#timeZone) or [SceneView](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/#timeZone) if the [view](https://developers.arcgis.com/javascript/latest/references/core/popup/
|
|
81
|
+
* inherited from the associated [MapView](https://developers.arcgis.com/javascript/latest/references/core/views/MapView/#timeZone) or [SceneView](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/#timeZone) if the [view](https://developers.arcgis.com/javascript/latest/references/core/popup/FeaturesModel/#view) property is set. When a view is not associated, then the property will fallback to the `system` time zone.
|
|
82
82
|
*
|
|
83
83
|
* **Possible Values**
|
|
84
84
|
*
|
|
@@ -99,15 +99,15 @@ export interface FeatureContentCollectionProperties extends GoToProperties, Part
|
|
|
99
99
|
* @see [Popup component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-popup/)
|
|
100
100
|
* @see [PopupTemplate](https://developers.arcgis.com/javascript/latest/references/core/PopupTemplate/)
|
|
101
101
|
*/
|
|
102
|
-
export default class
|
|
103
|
-
constructor(properties?:
|
|
102
|
+
export default class FeaturesModel extends FeaturesModelSuperclass {
|
|
103
|
+
constructor(properties?: FeaturesModelProperties);
|
|
104
104
|
/**
|
|
105
105
|
* [Collection](https://developers.arcgis.com/javascript/latest/references/core/core/Collection/) of [action](https://developers.arcgis.com/javascript/latest/references/core/support/actions/ActionButton/) or [action toggle](https://developers.arcgis.com/javascript/latest/references/core/support/actions/ActionToggle/) objects.
|
|
106
106
|
* Each action may be executed by clicking the icon or image symbolizing them.
|
|
107
107
|
* By default, a `Zoom To` action styled with a magnifying glass icon is included.
|
|
108
108
|
* When this icon is clicked, the view zooms in four LODs and centers on the selected feature.
|
|
109
109
|
*
|
|
110
|
-
* This default action can be removed by setting [includeDefaultActions](https://developers.arcgis.com/javascript/latest/references/core/popup/
|
|
110
|
+
* This default action can be removed by setting [includeDefaultActions](https://developers.arcgis.com/javascript/latest/references/core/popup/FeaturesModel/#includeDefaultActions) to `false`, or by setting the
|
|
111
111
|
* [PopupTemplate.overwriteActions](https://developers.arcgis.com/javascript/latest/references/core/PopupTemplate/#overwriteActions) property to `true` in a [PopupTemplate](https://developers.arcgis.com/javascript/latest/references/core/PopupTemplate/).
|
|
112
112
|
* The order of each action is the order in which they appear in the actions [Collection](https://developers.arcgis.com/javascript/latest/references/core/core/Collection/).
|
|
113
113
|
*
|
|
@@ -130,17 +130,17 @@ export default class FeatureContentCollection extends FeatureContentCollectionSu
|
|
|
130
130
|
get actions(): Collection<PopupAction>;
|
|
131
131
|
set actions(value: ReadonlyArrayOrCollection<((ActionButtonProperties & { type: "button" }) | (ActionToggleProperties & { type: "toggle" }))>);
|
|
132
132
|
/**
|
|
133
|
-
* Indicates if the features component is open and is not [waiting for results](https://developers.arcgis.com/javascript/latest/references/core/popup/
|
|
133
|
+
* Indicates if the features component is open and is not [waiting for results](https://developers.arcgis.com/javascript/latest/references/core/popup/FeaturesModel/#waitingForResult).
|
|
134
134
|
*
|
|
135
|
-
* @see [waitingForResult](https://developers.arcgis.com/javascript/latest/references/core/popup/
|
|
136
|
-
* @see [open](https://developers.arcgis.com/javascript/latest/references/core/popup/
|
|
135
|
+
* @see [waitingForResult](https://developers.arcgis.com/javascript/latest/references/core/popup/FeaturesModel/#waitingForResult)
|
|
136
|
+
* @see [open](https://developers.arcgis.com/javascript/latest/references/core/popup/FeaturesModel/#open)
|
|
137
137
|
*/
|
|
138
138
|
get active(): boolean;
|
|
139
139
|
/** The highlighted feature on the map that is either hovered over or in focus within the feature menu. */
|
|
140
140
|
accessor activeFeature: Graphic | null | undefined;
|
|
141
141
|
/**
|
|
142
142
|
* Indicates if aggregated feature browsing is active in a
|
|
143
|
-
* [cluster](https://developers.arcgis.com/javascript/latest/references/core/layers/support/FeatureReductionCluster/) or [bin](https://developers.arcgis.com/javascript/latest/references/core/layers/support/FeatureReductionBinning/). This value becomes `true` when the user enables feature browsing with the "Browse features" [action button](https://developers.arcgis.com/javascript/latest/references/core/support/actions/ActionButton/) in the aggregate popup template. This should only be set programmatically when the [selectedFeature](https://developers.arcgis.com/javascript/latest/references/core/popup/
|
|
143
|
+
* [cluster](https://developers.arcgis.com/javascript/latest/references/core/layers/support/FeatureReductionCluster/) or [bin](https://developers.arcgis.com/javascript/latest/references/core/layers/support/FeatureReductionBinning/). This value becomes `true` when the user enables feature browsing with the "Browse features" [action button](https://developers.arcgis.com/javascript/latest/references/core/support/actions/ActionButton/) in the aggregate popup template. This should only be set programmatically when the [selectedFeature](https://developers.arcgis.com/javascript/latest/references/core/popup/FeaturesModel/#selectedFeature) is an [aggregate graphic](https://developers.arcgis.com/javascript/latest/references/core/Graphic/#isAggregate).
|
|
144
144
|
*
|
|
145
145
|
* @default false
|
|
146
146
|
*/
|
|
@@ -176,14 +176,14 @@ export default class FeatureContentCollection extends FeatureContentCollectionSu
|
|
|
176
176
|
/**
|
|
177
177
|
* The heading currently displayed for the selected feature item.
|
|
178
178
|
*
|
|
179
|
-
* This value resolves to the [selected feature item's heading](https://developers.arcgis.com/javascript/latest/references/core/popup/
|
|
179
|
+
* This value resolves to the [selected feature item's heading](https://developers.arcgis.com/javascript/latest/references/core/popup/FeaturesModel/#selectedFeatureItem) when available, otherwise it falls back to [heading](https://developers.arcgis.com/javascript/latest/references/core/popup/FeaturesModel/#heading).
|
|
180
180
|
*
|
|
181
|
-
* @see [heading](https://developers.arcgis.com/javascript/latest/references/core/popup/
|
|
182
|
-
* @see [selectedFeatureItem](https://developers.arcgis.com/javascript/latest/references/core/popup/
|
|
181
|
+
* @see [heading](https://developers.arcgis.com/javascript/latest/references/core/popup/FeaturesModel/#heading)
|
|
182
|
+
* @see [selectedFeatureItem](https://developers.arcgis.com/javascript/latest/references/core/popup/FeaturesModel/#selectedFeatureItem)
|
|
183
183
|
*/
|
|
184
184
|
get effectiveHeading(): string | null | undefined;
|
|
185
185
|
/**
|
|
186
|
-
* The number of selected [features](https://developers.arcgis.com/javascript/latest/references/core/popup/
|
|
186
|
+
* The number of selected [features](https://developers.arcgis.com/javascript/latest/references/core/popup/FeaturesModel/#features) available.
|
|
187
187
|
*
|
|
188
188
|
* @default 0
|
|
189
189
|
*/
|
|
@@ -191,15 +191,15 @@ export default class FeatureContentCollection extends FeatureContentCollectionSu
|
|
|
191
191
|
/** Defines the specific [FeatureAbilities](https://developers.arcgis.com/javascript/latest/references/core/popup/support/FeatureAbilities/) that can be used when querying and displaying content. */
|
|
192
192
|
get featureItemAbilities(): FeatureAbilities | null | undefined;
|
|
193
193
|
set featureItemAbilities(value: FeatureAbilitiesProperties | null | undefined);
|
|
194
|
-
/** An array of [
|
|
195
|
-
get featureItems():
|
|
196
|
-
/** The current page number in the feature browsing menu. If the feature menu is not open, this value is `null`. This value is dependent on the [featuresPerPage](https://developers.arcgis.com/javascript/latest/references/core/popup/
|
|
194
|
+
/** An array of [FeatureModel](https://developers.arcgis.com/javascript/latest/references/core/popup/FeatureModel/) items. */
|
|
195
|
+
get featureItems(): FeatureModel[];
|
|
196
|
+
/** The current page number in the feature browsing menu. If the feature menu is not open, this value is `null`. This value is dependent on the [featuresPerPage](https://developers.arcgis.com/javascript/latest/references/core/popup/FeaturesModel/#featuresPerPage). */
|
|
197
197
|
accessor featurePage: number | null | undefined;
|
|
198
198
|
/**
|
|
199
199
|
* An array of features. Each [Graphic](https://developers.arcgis.com/javascript/latest/references/core/Graphic/) in this array must have a valid [PopupTemplate](https://developers.arcgis.com/javascript/latest/references/core/PopupTemplate/) set. They may share the same [PopupTemplate](https://developers.arcgis.com/javascript/latest/references/core/PopupTemplate/) or have unique [PopupTemplates](https://developers.arcgis.com/javascript/latest/references/core/PopupTemplate/) depending on their attributes.
|
|
200
|
-
* The [content](https://developers.arcgis.com/javascript/latest/references/core/popup/
|
|
200
|
+
* The [content](https://developers.arcgis.com/javascript/latest/references/core/popup/FeaturesModel/#content) and [heading](https://developers.arcgis.com/javascript/latest/references/core/popup/FeaturesModel/#heading) properties are set based on the `content` and `title` properties of each graphic's respective [PopupTemplate](https://developers.arcgis.com/javascript/latest/references/core/PopupTemplate/).
|
|
201
201
|
*
|
|
202
|
-
* When more than one graphic exists in this array, the current content is set based on the value of the [selected feature](https://developers.arcgis.com/javascript/latest/references/core/popup/
|
|
202
|
+
* When more than one graphic exists in this array, the current content is set based on the value of the [selected feature](https://developers.arcgis.com/javascript/latest/references/core/popup/FeaturesModel/#selectedFeature).
|
|
203
203
|
*
|
|
204
204
|
* @example
|
|
205
205
|
* ```js
|
|
@@ -233,7 +233,7 @@ export default class FeatureContentCollection extends FeatureContentCollectionSu
|
|
|
233
233
|
* // Create an array of graphics and set this to the features property. The content and heading ofvwill be set depending on the PopupTemplate of the graphics.
|
|
234
234
|
* // Each graphic may share the same PopupTemplate or have a unique PopupTemplate.
|
|
235
235
|
* let graphics = [g1, g2, g3, g4, g5];
|
|
236
|
-
*
|
|
236
|
+
* featuresModel.features = graphics;
|
|
237
237
|
* ```
|
|
238
238
|
*/
|
|
239
239
|
accessor features: Graphic[];
|
|
@@ -250,7 +250,7 @@ export default class FeatureContentCollection extends FeatureContentCollectionSu
|
|
|
250
250
|
*/
|
|
251
251
|
accessor featureStream: AsyncGenerator<Graphic> | null | undefined;
|
|
252
252
|
/**
|
|
253
|
-
* The heading. This can be set to any string value no matter the features that are selected. If the [selected feature](https://developers.arcgis.com/javascript/latest/references/core/popup/
|
|
253
|
+
* The heading. This can be set to any string value no matter the features that are selected. If the [selected feature](https://developers.arcgis.com/javascript/latest/references/core/popup/FeaturesModel/#selectedFeature) has a [PopupTemplate](https://developers.arcgis.com/javascript/latest/references/core/PopupTemplate/), then the title set in the corresponding template is used here.
|
|
254
254
|
*
|
|
255
255
|
* @example
|
|
256
256
|
* ```js
|
|
@@ -267,16 +267,16 @@ export default class FeatureContentCollection extends FeatureContentCollectionSu
|
|
|
267
267
|
*/
|
|
268
268
|
accessor highlightEnabled: boolean;
|
|
269
269
|
/**
|
|
270
|
-
* Indicates whether or not to include [defaultActions](https://developers.arcgis.com/javascript/latest/references/core/popup/
|
|
270
|
+
* Indicates whether or not to include [defaultActions](https://developers.arcgis.com/javascript/latest/references/core/popup/FeaturesModel/#defaultActions).
|
|
271
271
|
*
|
|
272
272
|
* > [!WARNING]
|
|
273
273
|
* >
|
|
274
|
-
* > In order to disable any [default actions](https://developers.arcgis.com/javascript/latest/references/core/popup/
|
|
274
|
+
* > In order to disable any [default actions](https://developers.arcgis.com/javascript/latest/references/core/popup/FeaturesModel/#defaultActions), it is necessary to set [includeDefaultActions](https://developers.arcgis.com/javascript/latest/references/core/popup/FeaturesModel/#includeDefaultActions) to `false`.
|
|
275
275
|
*
|
|
276
276
|
* @default true
|
|
277
277
|
* @example
|
|
278
278
|
* // Removes the default actions
|
|
279
|
-
*
|
|
279
|
+
* featuresModel.includeDefaultActions = false;
|
|
280
280
|
*/
|
|
281
281
|
accessor includeDefaultActions: boolean;
|
|
282
282
|
/**
|
|
@@ -285,56 +285,56 @@ export default class FeatureContentCollection extends FeatureContentCollectionSu
|
|
|
285
285
|
*/
|
|
286
286
|
accessor initialDisplayMode: InitialDisplayOptions;
|
|
287
287
|
/**
|
|
288
|
-
* Geometry used to show the location of the feature. This is automatically set when selecting a feature. If displaying content not related to features in the map, such as the results from a task, then you must set this property before setting [open](https://developers.arcgis.com/javascript/latest/references/core/popup/
|
|
288
|
+
* Geometry used to show the location of the feature. This is automatically set when selecting a feature. If displaying content not related to features in the map, such as the results from a task, then you must set this property before setting [open](https://developers.arcgis.com/javascript/latest/references/core/popup/FeaturesModel/#open) to `true`.
|
|
289
289
|
*
|
|
290
290
|
* @see [Intro to popup component](https://developers.arcgis.com/javascript/latest/sample-code/intro-popup/)
|
|
291
291
|
* @example
|
|
292
292
|
* // Sets the location to the center of the view
|
|
293
|
-
*
|
|
294
|
-
*
|
|
293
|
+
* featuresModel.location = viewElement.center;
|
|
294
|
+
* featuresModel.open = true;
|
|
295
295
|
* @example
|
|
296
|
-
* // Display the
|
|
296
|
+
* // Display the featuresModel when and where the user clicks the view.
|
|
297
297
|
* reactiveUtils.on(()=>viewElement, "arcgisViewClick", ({ details: { mapPoint } })=>{
|
|
298
|
-
*
|
|
299
|
-
*
|
|
298
|
+
* featuresModel.location = mapPoint;
|
|
299
|
+
* featuresModel.open = true;
|
|
300
300
|
* });
|
|
301
301
|
*/
|
|
302
302
|
get location(): Point | null | undefined;
|
|
303
303
|
set location(value: PointProperties | null | undefined);
|
|
304
304
|
/**
|
|
305
|
-
* A map is required when the input [features](https://developers.arcgis.com/javascript/latest/references/core/popup/
|
|
305
|
+
* A map is required when the input [features](https://developers.arcgis.com/javascript/latest/references/core/popup/FeaturesModel/#features) have 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.
|
|
306
306
|
*
|
|
307
|
-
* Alternatively, the [view](https://developers.arcgis.com/javascript/latest/references/core/popup/
|
|
307
|
+
* Alternatively, the [view](https://developers.arcgis.com/javascript/latest/references/core/popup/FeaturesModel/#view) property can be used to provide the map instance for this property.
|
|
308
308
|
*
|
|
309
309
|
* @see [Type system](https://developers.arcgis.com/arcade/guide/types/#featuresetcollection)
|
|
310
310
|
* @see [Arcade Profiles: Popup](https://developers.arcgis.com/arcade/profiles/popup/)
|
|
311
311
|
*/
|
|
312
312
|
accessor map: EsriMap | null | undefined;
|
|
313
313
|
/**
|
|
314
|
-
* Indicates whether the component is open. This property is `true` when querying for results, even if it is not open. Use the [active](https://developers.arcgis.com/javascript/latest/references/core/popup/
|
|
314
|
+
* Indicates whether the component is open. This property is `true` when querying for results, even if it is not open. Use the [active](https://developers.arcgis.com/javascript/latest/references/core/popup/FeaturesModel/#active) property to check if the component is open and is not [waiting for results](https://developers.arcgis.com/javascript/latest/references/core/popup/FeaturesModel/#waitingForResult).
|
|
315
315
|
*
|
|
316
316
|
* @default false
|
|
317
|
-
* @see [active](https://developers.arcgis.com/javascript/latest/references/core/popup/
|
|
318
|
-
* @see [waitingForResult](https://developers.arcgis.com/javascript/latest/references/core/popup/
|
|
317
|
+
* @see [active](https://developers.arcgis.com/javascript/latest/references/core/popup/FeaturesModel/#active)
|
|
318
|
+
* @see [waitingForResult](https://developers.arcgis.com/javascript/latest/references/core/popup/FeaturesModel/#waitingForResult)
|
|
319
319
|
*/
|
|
320
320
|
accessor open: boolean;
|
|
321
|
-
/** The location supplied when opening a feature stream while waiting for the first feature. This is `null` after the first feature arrives or the stream ends. Unlike [location](https://developers.arcgis.com/javascript/latest/references/core/popup/
|
|
321
|
+
/** The location supplied when opening a feature stream while waiting for the first feature. This is `null` after the first feature arrives or the stream ends. Unlike [location](https://developers.arcgis.com/javascript/latest/references/core/popup/FeaturesModel/#location), it does not change the popup location while waiting. */
|
|
322
322
|
get pendingLocation(): Point | null | undefined;
|
|
323
323
|
/**
|
|
324
|
-
* The selected feature accessed. The [content](https://developers.arcgis.com/javascript/latest/references/core/popup/
|
|
324
|
+
* The selected feature accessed. The [content](https://developers.arcgis.com/javascript/latest/references/core/popup/FeaturesModel/#content) is
|
|
325
325
|
* determined based on the [PopupTemplate](https://developers.arcgis.com/javascript/latest/references/core/PopupTemplate/) assigned to
|
|
326
326
|
* this feature.
|
|
327
327
|
*/
|
|
328
328
|
get selectedFeature(): Graphic | null;
|
|
329
|
-
/** Index of the feature that is [selected](https://developers.arcgis.com/javascript/latest/references/core/popup/
|
|
329
|
+
/** Index of the feature that is [selected](https://developers.arcgis.com/javascript/latest/references/core/popup/FeaturesModel/#selectedFeature). When the [features](https://developers.arcgis.com/javascript/latest/references/core/popup/FeaturesModel/#features) property is set, the first index (`0`) is automatically selected. */
|
|
330
330
|
accessor selectedFeatureIndex: number;
|
|
331
|
-
/** The selected [
|
|
332
|
-
get selectedFeatureItem():
|
|
331
|
+
/** The selected [FeatureModel](https://developers.arcgis.com/javascript/latest/references/core/popup/FeatureModel/) item. */
|
|
332
|
+
get selectedFeatureItem(): FeatureModel;
|
|
333
333
|
/**
|
|
334
334
|
* The spatial reference used for [Arcade](https://developers.arcgis.com/arcade) operations.
|
|
335
335
|
* This property should be set if Arcade expressions are executed that contain [geometry functions](https://developers.arcgis.com/arcade/function-reference/geometry_functions/).
|
|
336
336
|
*
|
|
337
|
-
* Alternatively, the [view](https://developers.arcgis.com/javascript/latest/references/core/popup/
|
|
337
|
+
* Alternatively, the [view](https://developers.arcgis.com/javascript/latest/references/core/popup/FeaturesModel/#view) property can be used to provide the spatial reference instance for this property.
|
|
338
338
|
*
|
|
339
339
|
* @see [Type system](https://developers.arcgis.com/arcade/guide/types/#featuresetcollection)
|
|
340
340
|
* @see [Arcade Profiles: Popup](https://developers.arcgis.com/arcade/profiles/popup/)
|
|
@@ -355,7 +355,7 @@ export default class FeatureContentCollection extends FeatureContentCollectionSu
|
|
|
355
355
|
get streamingFeatures(): boolean;
|
|
356
356
|
/**
|
|
357
357
|
* Dates and times will be displayed in this time zone. By default this time zone is
|
|
358
|
-
* inherited from the associated [MapView](https://developers.arcgis.com/javascript/latest/references/core/views/MapView/#timeZone) or [SceneView](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/#timeZone) if the [view](https://developers.arcgis.com/javascript/latest/references/core/popup/
|
|
358
|
+
* inherited from the associated [MapView](https://developers.arcgis.com/javascript/latest/references/core/views/MapView/#timeZone) or [SceneView](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/#timeZone) if the [view](https://developers.arcgis.com/javascript/latest/references/core/popup/FeaturesModel/#view) property is set. When a view is not associated, then the property will fallback to the `system` time zone.
|
|
359
359
|
*
|
|
360
360
|
* **Possible Values**
|
|
361
361
|
*
|
|
@@ -368,7 +368,7 @@ export default class FeatureContentCollection extends FeatureContentCollectionSu
|
|
|
368
368
|
get timeZone(): TimeZone;
|
|
369
369
|
set timeZone(value: TimeZone | null | undefined);
|
|
370
370
|
/**
|
|
371
|
-
* Indicates whether to update the [location](https://developers.arcgis.com/javascript/latest/references/core/popup/
|
|
371
|
+
* Indicates whether to update the [location](https://developers.arcgis.com/javascript/latest/references/core/popup/FeaturesModel/#location) when the [selectedFeatureIndex](https://developers.arcgis.com/javascript/latest/references/core/popup/FeaturesModel/#selectedFeatureIndex) changes.
|
|
372
372
|
*
|
|
373
373
|
* @default false
|
|
374
374
|
*/
|
|
@@ -379,29 +379,29 @@ export default class FeatureContentCollection extends FeatureContentCollectionSu
|
|
|
379
379
|
* > [!WARNING]
|
|
380
380
|
* >
|
|
381
381
|
* > A view is required if the user expects it to display content in any of the following situations:
|
|
382
|
-
* > - The [features](https://developers.arcgis.com/javascript/latest/references/core/popup/
|
|
382
|
+
* > - The [features](https://developers.arcgis.com/javascript/latest/references/core/popup/FeaturesModel/#features) have a popupTemplate containing 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 [geometry functions](https://developers.arcgis.com/arcade/function-reference/geometry_functions/) or reference the `$map` profile variable (i.e. access data from layers within a map).
|
|
383
383
|
* > - Content is displayed from the popup template of an [aggregate feature](https://developers.arcgis.com/javascript/latest/references/core/Graphic/#isAggregate) (i.e. a [cluster](https://developers.arcgis.com/javascript/latest/references/core/layers/support/FeatureReductionCluster/) or [bin](https://developers.arcgis.com/javascript/latest/references/core/layers/support/FeatureReductionBinning/)).
|
|
384
384
|
* > - Values from `date` and `timestamp-offset` [fields](https://developers.arcgis.com/javascript/latest/references/core/layers/support/Field/#type) should respect the associated [MapView](https://developers.arcgis.com/javascript/latest/references/core/views/MapView/#timeZone) or [SceneView](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/#timeZone).
|
|
385
385
|
*/
|
|
386
386
|
accessor view: MapViewOrSceneView | null | undefined;
|
|
387
|
-
/** Indicates whether the
|
|
387
|
+
/** Indicates whether the FeaturesModel is waiting for content to be generated for any of the [feature items](https://developers.arcgis.com/javascript/latest/references/core/popup/FeaturesModel/#featureItems). This property is `true` when at least one feature item is waiting for content to be generated. When all feature items have content, this property becomes `false`. */
|
|
388
388
|
get waitingForContents(): boolean;
|
|
389
389
|
/**
|
|
390
390
|
* Indicates whether the current feature stream is waiting to yield its first feature. Previously displayed features remain available while this property is `true`. It becomes `false` when the current stream yields a feature or completes.
|
|
391
391
|
*
|
|
392
|
-
* @see [active](https://developers.arcgis.com/javascript/latest/references/core/popup/
|
|
392
|
+
* @see [active](https://developers.arcgis.com/javascript/latest/references/core/popup/FeaturesModel/#active)
|
|
393
393
|
*/
|
|
394
394
|
get waitingForResult(): boolean;
|
|
395
395
|
/**
|
|
396
|
-
* Number of levels of detail (LOD) to zoom in on the [selected feature](https://developers.arcgis.com/javascript/latest/references/core/popup/
|
|
396
|
+
* Number of levels of detail (LOD) to zoom in on the [selected feature](https://developers.arcgis.com/javascript/latest/references/core/popup/FeaturesModel/#selectedFeature).
|
|
397
397
|
*
|
|
398
398
|
* @default 4
|
|
399
399
|
* @example
|
|
400
400
|
* // Restricts the zooming to two LODS when the zoom in action is clicked.
|
|
401
|
-
*
|
|
401
|
+
* featuresModel.zoomFactor = 2;
|
|
402
402
|
*/
|
|
403
403
|
accessor zoomFactor: number;
|
|
404
|
-
/** Removes the [features](https://developers.arcgis.com/javascript/latest/references/core/popup/
|
|
404
|
+
/** Removes the [features](https://developers.arcgis.com/javascript/latest/references/core/popup/FeaturesModel/#features), [content](https://developers.arcgis.com/javascript/latest/references/core/popup/FeaturesModel/#content), [heading](https://developers.arcgis.com/javascript/latest/references/core/popup/FeaturesModel/#heading), [location](https://developers.arcgis.com/javascript/latest/references/core/popup/FeaturesModel/#location), and [activeFeature](https://developers.arcgis.com/javascript/latest/references/core/popup/FeaturesModel/#activeFeature). */
|
|
405
405
|
clear(): void;
|
|
406
406
|
/**
|
|
407
407
|
* Fetches feature(s) at a given screen location and updates the component's featureStream
|
|
@@ -410,14 +410,14 @@ export default class FeatureContentCollection extends FeatureContentCollectionSu
|
|
|
410
410
|
* @param options - The [options](https://developers.arcgis.com/javascript/latest/references/core/popup/types/#FetchFeaturesOptions)
|
|
411
411
|
* to pass into the `fetchFeatures` method.
|
|
412
412
|
* @returns A promise that resolves when feature fetching has been initiated and
|
|
413
|
-
* [featureStream](https://developers.arcgis.com/javascript/latest/references/core/popup/
|
|
413
|
+
* [featureStream](https://developers.arcgis.com/javascript/latest/references/core/popup/FeaturesModel/#featureStream) has been updated.
|
|
414
414
|
* @internal
|
|
415
415
|
*/
|
|
416
416
|
fetchFeatures(screenPointOrArea: ScreenPoint | ScreenRect | null | undefined, options?: FetchFeaturesOptions): Promise<void>;
|
|
417
417
|
/**
|
|
418
418
|
* Selects the feature at the next index in relation to the selected feature.
|
|
419
419
|
*
|
|
420
|
-
* @see [selectedFeatureIndex](https://developers.arcgis.com/javascript/latest/references/core/popup/
|
|
420
|
+
* @see [selectedFeatureIndex](https://developers.arcgis.com/javascript/latest/references/core/popup/FeaturesModel/#selectedFeatureIndex)
|
|
421
421
|
*/
|
|
422
422
|
next(): void;
|
|
423
423
|
/**
|
|
@@ -435,11 +435,11 @@ export default class FeatureContentCollection extends FeatureContentCollectionSu
|
|
|
435
435
|
/**
|
|
436
436
|
* Selects the feature at the previous index in relation to the selected feature.
|
|
437
437
|
*
|
|
438
|
-
* @see [selectedFeatureIndex](https://developers.arcgis.com/javascript/latest/references/core/popup/
|
|
438
|
+
* @see [selectedFeatureIndex](https://developers.arcgis.com/javascript/latest/references/core/popup/FeaturesModel/#selectedFeatureIndex)
|
|
439
439
|
*/
|
|
440
440
|
previous(): void;
|
|
441
441
|
/**
|
|
442
|
-
* Sets the view to a given target. If [goToOverride](https://developers.arcgis.com/javascript/latest/references/core/popup/
|
|
442
|
+
* Sets the view to a given target. If [goToOverride](https://developers.arcgis.com/javascript/latest/references/core/popup/FeaturesModel/#goToOverride) is set, `goToOverride()` will be called with the current view and specified `params`.
|
|
443
443
|
* Otherwise, the view will be set using the provided `params`.
|
|
444
444
|
*
|
|
445
445
|
* @param params - The parameters to pass to the `zoomTo()` method.
|
|
@@ -448,4 +448,4 @@ export default class FeatureContentCollection extends FeatureContentCollectionSu
|
|
|
448
448
|
*/
|
|
449
449
|
zoomTo(params: GoToParameters): Promise<void>;
|
|
450
450
|
}
|
|
451
|
-
declare const
|
|
451
|
+
declare const FeaturesModelSuperclass: typeof EventedAccessor & typeof GoTo
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../core/Error.js";import{EventedAccessor as n}from"../core/Evented.js";import r from"../core/Logger.js";import{abortMaybe as i}from"../core/maybe.js";import{debounce as a,logOnError as o,isAbortError as s}from"../core/promiseUtils.js";import{watch as c,when as l}from"../core/reactiveUtils.js";import{property as u,subclass as d}from"../core/accessorSupport/decorators.js";import f from"../geometry/Point.js";import{project as p}from"../geometry/projectionUtils.js";import m from"../geometry/SpatialReference.js";import{geographicToWebMercator as h}from"../geometry/support/webMercatorUtils.js";import{getGraphicLayer as g}from"../graphic/graphicOriginUtils.js";import{fallbackObjectIDAttribute as _}from"../layers/LayerConstants.js";import{ActionsCollection as v,createDefaultActions as y}from"./actions.js";import{getSelectedTarget as b}from"./actionUtils.js";import x from"./FeatureModel.js";import S from"./support/FeatureAbilities.js";import{getDisplayedSymbol as C}from"../symbols/support/symbolUtils.js";import{system as w}from"../time/constants.js";import{highlightsSupported as T}from"../views/support/layerViewUtils.js";import{GoTo as E}from"../widgets/support/GoTo.js";let D=null;function O(e,t){switch(e){case`building-scene`:case`map-image`:case`tile`:case`imagery`:return!0;case`imagery-tile`:return t===`2d`;default:return!1}}let k=class extends E(n){constructor(e){super(e),this._centerAtLocationController=null,this._locationUpdateController=null,this._highlightPromises={"highlight-active-feature":null,"highlight-selected-feature":null},this._defaultFeatureAbilities=new S,this._activeFeatureStream=null,this._featureStreamHasYielded=!1,this.actions=new v,this.activeFeature=null,this.aggregatedFeaturesEnabled=!1,this.defaultPopupTemplateEnabled=!1,this.diagnostics=null,this.featurePage=null,this.featuresPerPage=20,this.featureMenuOpen=!1,this.featureItemAbilities=null,this.featureItems=[],this.heading=null,this.highlightEnabled=!0,this.includeDefaultActions=!0,this.open=!1,this.updateLocationEnabled=!1,this.view=null,this.zoomFactor=4,this._debouncedLocationUpdate=a(async()=>{this._cancelLocationUpdate();let e=new AbortController,{signal:t}=e;this._locationUpdateController=e,await this._locationUpdate({signal:t}).catch(()=>{}).finally(()=>{this._locationUpdateController===e&&(this._locationUpdateController=null)})})}initialize(){this.addHandles([c(()=>this.view?.scale,()=>{this.open&&o(this._debouncedLocationUpdate(),r.getLogger(this))}),c(()=>[this.highlightEnabled,this.selectedFeature,this.open,this.view],()=>this._highlightSelectedFeature()),c(()=>[this.highlightEnabled,this.activeFeature,this.open,this.view],()=>this._highlightActiveFeature()),c(()=>this.location,e=>this._locationChange(e)),c(()=>this.selectedFeature,e=>this._selectedFeatureChange(e)),c(()=>[this.selectedFeatureIndex,this.featureCount,this.featuresPerPage],()=>this._selectedFeatureIndexChange()),c(()=>[this.featurePage,this.selectedFeatureIndex,this.featureCount,this.featuresPerPage,this.featureItems],()=>this._setGraphicOnFeatureItems()),c(()=>this.featureItems,()=>this._featureItemsChange()),c(()=>[this.featureItemAbilities?.attachmentsContent,this.featureItemAbilities?.chartAnimation,this.featureItemAbilities?.customContent,this.featureItemAbilities?.expressionContent,this.featureItemAbilities?.fieldsContent,this.featureItemAbilities?.mediaContent,this.featureItemAbilities?.relationshipContent,this.featureItemAbilities?.textContent,this.featureItemAbilities?.utilityNetworkAssociationsContent,this.actions,this.includeDefaultActions,this.features,this.map,this.spatialReference,this.timeZone],()=>this._updateFeatureItems()),l(()=>!this.open,()=>this.aggregatedFeaturesEnabled=!1)])}destroy(){this._cancelLocationUpdate(),this._cancelCenterAtLocation(),this._cancelFeatureStream(),this.aggregatedFeaturesEnabled=!1,this.view=null,this.map=null,this.spatialReference=null,this.timeZone=null}get defaultActions(){let e=this._get(`defaultActions`)||new v;return e.removeAll(),e.addMany(this.selectedFeatureItem?.defaultActions.toArray()??y()),e}get active(){return this.open&&!this.waitingForResult}set content(e){this.featureStream=null,this._set(`diagnostics`,null),this.features=[],this._set(`content`,e)}get effectiveHeading(){return this.selectedFeatureItem?.heading??this.heading}get featureCount(){return this.features.length}set features(e){if(this._get(`features`)===e)return;let t=e||[];this._set(`features`,t),this._syncSelectedFeatureIndex(t)}get featureStream(){return this._get(`featureStream`)||null}set featureStream(e){this._setFeatureStream(e)}_setFeatureStream(e,t,n){this._set(`diagnostics`,n??null),this._get(`featureStream`)!==e&&(this._set(`featureStream`,e),this._cancelFeatureStream(),e&&(this._featureStreamHasYielded=!1,this._set(`pendingLocation`,t??null),this._activeFeatureStream=e,this._consumeFeatureStream(e,t).catch(()=>{})))}get initialDisplayMode(){return this._initialDisplayMode??(this.view?.focusRegionEnabled?`list`:`feature`)}set initialDisplayMode(e){this._initialDisplayMode=e,this._syncSelectedFeatureIndex(this.features)}set location(e){let t=e?.spatialReference?.isWGS84&&this.spatialReference?.isWebMercator?h(e):e;this._set(`location`,t)}get map(){return this.view?.map??null}set map(e){this._override(`map`,e)}get pendingLocation(){return this._get(`pendingLocation`)??null}get streamingFeatures(){return this._activeFeatureStream!=null}get selectedFeature(){return this.selectedFeatureIndex===-1?null:this.features[this.selectedFeatureIndex]??null}get selectedFeatureIndex(){let e=this._get(`selectedFeatureIndex`);return typeof e==`number`?e:-1}set selectedFeatureIndex(e){let{featureCount:t}=this;(isNaN(e)||e<0||!t)&&(e=-1),this.activeFeature=null,this._set(`selectedFeatureIndex`,e)}get selectedFeatureItem(){return this.featureItems[this.selectedFeatureIndex]||null}get spatialReference(){return this.view?.spatialReference??null}set spatialReference(e){this._override(`spatialReference`,e)}get state(){return this.view?this.view.ready?`ready`:`disabled`:this.map?`ready`:`disabled`}get timeZone(){return this.view?.timeZone??w}set timeZone(e){this._overrideIfSome(`timeZone`,e)}get waitingForContents(){return this.featureItems.some(e=>e.waitingForContent)}get waitingForResult(){return this.streamingFeatures&&!this._featureStreamHasYielded}zoomTo(e){return this.callGoTo(e)}clear(){this._cancelFeatureStream(),this._set(`diagnostics`,null),this.set({featureStream:null,features:[],content:null,heading:null,location:null,activeFeature:null})}openFeatureStream(e){this._setFeatureStream(e.featureStream,e.location??null,e.diagnostics),this.open=!0}async fetchFeatures(e,n){let{view:r}=this;if(!r||!e)throw new t(`fetch-features:invalid-screenpoint-or-view`,`Cannot fetch features without a screen point/screen area and view.`,{screenPoint:e,view:r});let i={},a=r.fetchPopupFeatures(e,{diagnostics:i,pointerType:n?.event?.pointerType,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,signal:n?.signal});this._setFeatureStream(a,void 0,i)}next(){this.selectedFeatureIndex=this._getRoundRobinIndex(this.selectedFeatureIndex+1,this.featureCount)}previous(){this.selectedFeatureIndex=this._getRoundRobinIndex(this.selectedFeatureIndex-1,this.featureCount)}_syncSelectedFeatureIndex(e){let{selectedFeatureIndex:t}=this,n=this._activeFeatureStream!=null&&e.length>0;if(this.initialDisplayMode===`list`){n||(this.selectedFeatureIndex=-1);return}if(n&&t===-1){this.selectedFeatureIndex=0;return}n&&t!==-1||(this.selectedFeatureIndex=e.length?0:-1)}_centerAtLocation(){let{view:e}=this,n=b(this);this._cancelCenterAtLocation();let i=new AbortController,{signal:a}=i;return this._centerAtLocationController=i,!n||!e?Promise.reject(new t(`center-at-location:invalid-target-or-view`,`Cannot center at a location without a target and view.`,{target:n,view:e})):this.callGoTo({target:{target:n,scale:e.scale},options:{signal:a}}).catch(e=>{s(e)||r.getLogger(this).error(e)})}_getRoundRobinIndex(e,t){return(e+t)%t}_locationChange(e){let{selectedFeature:t,updateLocationEnabled:n,view:r}=this;r&&!this._locationUpdateController&&n&&e&&(!t||t.geometry)&&this._centerAtLocation()}_selectedFeatureIndexChange(){this.selectedFeatureIndex!==-1&&(this.featurePage=this.featureCount>0?Math.floor(this.selectedFeatureIndex/this.featuresPerPage)+1:null)}_featureItemsChange(){this.featurePage=this.featureCount>0?1:null}_setGraphicOnFeatureItems(){let{features:e,featureCount:t,featurePage:n,featuresPerPage:r,featureItems:i}=this;if(n==null)return;let a=((n-1)*r+t)%t,o=Math.min(a+r,i.length);for(let t=a;t<o;t++){let n=i[t];n&&(n.graphic??=e[t])}}async _selectedFeatureChange(e){let{location:t,updateLocationEnabled:n,view:r}=this;if(this.aggregatedFeaturesEnabled=!1,!e||!r)return;let i=g(e)?.type;if((i===`map-image`||i===`imagery`||i===`imagery-tile`)&&(e.symbol=await C(e)),(n||!t)&&e.geometry){if(e.geometry.type===`point`){this.location=e.geometry;return}let{labelPointExecute:t}=await import(`../geometry/operators/labelPointOperator.js`);this.location=t(e.geometry);return}if(n&&!e.geometry){await this._centerAtLocation();let e=r.center?.clone();e&&(this.location=e)}}_waitingForResultChange(){!this.featureCount&&this.featureStream&&(this.open=!1)}_destroyFeatureItems(){this.featureItems.forEach(e=>e&&!e.destroyed&&e.destroy()),this._set(`featureItems`,[])}_updateFeatureItems(){let e=this.selectedFeature,t=this.features,n=this.featureItems,r=this.view,i=this.spatialReference,a=this.map,o=this.timeZone,s=this.location,c=this.actions,l=this.includeDefaultActions,u=this.featureItemAbilities??this._defaultFeatureAbilities;if(!t?.length){this._destroyFeatureItems();return}let d=[],f=new Map,p=new Set;n.forEach(e=>{let t=e?.graphic;e&&t&&f.set(t,e)}),t.forEach((t,m)=>{if(!t)return;let h=n[m];if(h&&!p.has(h)&&(h.graphic==null||h.graphic===t)){h.abilities=u,h.actions=c,h.includeDefaultActions=l,d[m]=h,p.add(h);return}let g=f.get(t);if(g&&!p.has(g)){g.abilities=u,g.actions=c,g.includeDefaultActions=l,d[m]=g,p.add(g);return}let _=new x({actions:c,abilities:u,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,includeDefaultActions:l,spatialReference:i,graphic:t===e?t:null,location:s,map:a,view:r,timeZone:o});d[m]=_,p.add(_)}),n.forEach(e=>{e&&!p.has(e)&&!e.destroyed&&e.destroy()}),this._set(`featureItems`,d)}_cancelCenterAtLocation(){this._centerAtLocationController=i(this._centerAtLocationController)}_cancelFeatureStream(){let e=this._activeFeatureStream;this._activeFeatureStream=null,this._set(`pendingLocation`,null),this._get(`featureStream`)===e&&this._set(`featureStream`,null),e?.return&&e.return(void 0).catch(()=>{})}async _locationUpdate(e){let{spatialReference:t}=this,n=this.selectedFeature,i=n?.geometry?.type,a=this.location;if(i&&i!==`mesh`&&t&&a&&n){if(i===`point`){let{labelPointExecute:t}=await import(`../geometry/operators/labelPointOperator.js`);if(e?.signal?.aborted||this.selectedFeature!==n||!n.geometry)return;this.location=t(n.geometry);return}try{let r=n.geometry,i=this._getHighlightLayer(n),o=n.getObjectId();if(!i||!this.view)return;if(o!=null){let n=this.view?.allLayerViews.find(e=>e.layer.uid===i.uid);if(!n||!(`queryFeatures`in n))return;let a=n.createQuery();a.outSpatialReference=t,a.objectIds=[o],a.returnGeometry=!0;let{features:s}=await n.queryFeatures(a,e);if(e?.signal?.aborted)return;r=s[0]?.geometry}if(!r||r.type===`mesh`)return;r=p(r,t),D??=await Promise.all([import(`../geometry/operators/intersectsOperator.js`),import(`../geometry/operators/proximityOperator.js`)]);let[{intersectsExecute:s},{proximityGetNearestCoordinate:c}]=D;if(!s(r,a)){let e=c(r,a).coordinate??a;this.selectedFeature===n&&(this.location=e)}}catch(e){s(e)||r.getLogger(this).error(e)}}}_cancelLocationUpdate(){this._locationUpdateController=i(this._locationUpdateController)}async _getLayerView(e,t){return await e.when(),e.whenLayerView(t)}_getHighlightLayer(e){let t=g(e),{layer:n}=e;return t&&`layer`in t&&t.layer?t.layer:t?.type===`map-notes`||t?.type===`sketch`||t?.type===`subtype-group`?t:n??t}_getHighlightLayerView(e,t){return t.type===`subtype-sublayer`&&t.parent&&this._mapIncludesLayer(t.parent)?this._getLayerView(e,t.parent):t&&this._mapIncludesLayer(t)?this._getLayerView(e,t):null}_getHighlightTarget(e,t,n){if(O(t.type,n))return e;let r=e.getObjectId();if(r!=null)return r;let i=t.type===`imagery`?void 0:`objectIdField`in t?t.objectIdField||_:null,a=e.attributes;return a&&i&&a[i]||e}_mapIncludesLayer(e){return!!this.map?.allLayers?.includes(e)}async _highlightFeature(e,t){this.removeHandles(e);let n=this[t];if(!n)return;let{highlightEnabled:r,view:i,open:a}=this;if(!i||!r||!a)return;let o=this._getHighlightLayer(n);if(!o)return;let s=this._getHighlightLayerView(i,o);if(!s)return;this._highlightPromises[e]=s;let c=await s;if(!c||!T(c)||this._highlightPromises[e]!==s||!this[t]||!this.highlightEnabled)return;let l=c.highlight(this._getHighlightTarget(n,o,i.type));this.addHandles(l,e)}async _highlightActiveFeature(){return this._highlightFeature(`highlight-active-feature`,`activeFeature`)}async _highlightSelectedFeature(){return this._highlightFeature(`highlight-selected-feature`,`selectedFeature`)}async _consumeFeatureStream(e,t){try{for await(let n of e){if(e!==this._activeFeatureStream)return;let r=!this._featureStreamHasYielded;r&&(this.features=[]),t!==void 0&&(this.location=t,t=void 0),this._set(`pendingLocation`,null),this._addFeature(n),r&&(this._featureStreamHasYielded=!0)}}finally{this._activeFeatureStream===e&&(this._featureStreamHasYielded||(this.features=[]),this._activeFeatureStream=null,this._set(`pendingLocation`,null),this._waitingForResultChange())}}_addFeature(e){let{features:t}=this;t.includes(e)||(this.features=t.concat(e))}};e([u()],k.prototype,`_initialDisplayMode`,void 0),e([u()],k.prototype,`_activeFeatureStream`,void 0),e([u()],k.prototype,`_featureStreamHasYielded`,void 0),e([u({type:v})],k.prototype,`actions`,void 0),e([u({type:v,readOnly:!0})],k.prototype,`defaultActions`,null),e([u({readOnly:!0})],k.prototype,`active`,null),e([u()],k.prototype,`activeFeature`,void 0),e([u()],k.prototype,`aggregatedFeaturesEnabled`,void 0),e([u({value:null})],k.prototype,`content`,null),e([u({type:Boolean})],k.prototype,`defaultPopupTemplateEnabled`,void 0),e([u({readOnly:!0})],k.prototype,`diagnostics`,void 0),e([u({readOnly:!0})],k.prototype,`effectiveHeading`,null),e([u({readOnly:!0})],k.prototype,`featureCount`,null),e([u()],k.prototype,`featurePage`,void 0),e([u({value:[]})],k.prototype,`features`,null),e([u()],k.prototype,`featureStream`,null),e([u()],k.prototype,`featuresPerPage`,void 0),e([u()],k.prototype,`featureMenuOpen`,void 0),e([u({type:S})],k.prototype,`featureItemAbilities`,void 0),e([u({readOnly:!0})],k.prototype,`featureItems`,void 0),e([u()],k.prototype,`heading`,void 0),e([u()],k.prototype,`highlightEnabled`,void 0),e([u()],k.prototype,`includeDefaultActions`,void 0),e([u()],k.prototype,`initialDisplayMode`,null),e([u({type:f})],k.prototype,`location`,null),e([u()],k.prototype,`map`,null),e([u()],k.prototype,`open`,void 0),e([u({readOnly:!0})],k.prototype,`pendingLocation`,null),e([u({readOnly:!0})],k.prototype,`streamingFeatures`,null),e([u({value:null,readOnly:!0})],k.prototype,`selectedFeature`,null),e([u({value:-1})],k.prototype,`selectedFeatureIndex`,null),e([u({readOnly:!0})],k.prototype,`selectedFeatureItem`,null),e([u({type:m})],k.prototype,`spatialReference`,null),e([u({readOnly:!0})],k.prototype,`state`,null),e([u()],k.prototype,`timeZone`,null),e([u()],k.prototype,`updateLocationEnabled`,void 0),e([u()],k.prototype,`view`,void 0),e([u({readOnly:!0})],k.prototype,`waitingForContents`,null),e([u({readOnly:!0})],k.prototype,`waitingForResult`,null),e([u()],k.prototype,`zoomFactor`,void 0),k=e([d(`esri.popup.FeaturesModel`)],k);const A=k;export{A as default};
|
|
@@ -3,8 +3,10 @@ import type { EventedAccessor } from "../../core/Evented.js";
|
|
|
3
3
|
import type { DirectionalPadAngle, Vector } from "./types.js";
|
|
4
4
|
import type { GoTo, GoToProperties } from "../support/GoTo.js";
|
|
5
5
|
|
|
6
|
+
/** @deprecated since 5.2. Use the [Directional Pad component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-directional-pad/) instead. */
|
|
6
7
|
export interface DirectionalPadViewModelProperties extends GoToProperties, Partial<Pick<DirectionalPadViewModel, "disabled" | "rotation" | "view">> {}
|
|
7
8
|
|
|
9
|
+
/** @deprecated since 5.2. Use the [Directional Pad component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-directional-pad/) instead. */
|
|
8
10
|
export type DirectionalPadViewModelState = "ready" | "disabled" | "moving";
|
|
9
11
|
|
|
10
12
|
/**
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* An x/y coordinate pair. Could be used to represent a screen point or a
|
|
3
3
|
* vector.
|
|
4
4
|
*
|
|
5
|
+
* @deprecated since 5.2. Use the [Directional Pad component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-directional-pad/) instead.
|
|
5
6
|
* @since 5.0
|
|
6
7
|
*/
|
|
7
8
|
export interface Vector {
|
|
@@ -19,5 +20,8 @@ export interface Vector {
|
|
|
19
20
|
readonly y: number;
|
|
20
21
|
}
|
|
21
22
|
|
|
22
|
-
/**
|
|
23
|
+
/**
|
|
24
|
+
* @deprecated since 5.2. Use the [Directional Pad component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-directional-pad/) instead.
|
|
25
|
+
* @since 5.0
|
|
26
|
+
*/
|
|
23
27
|
export type DirectionalPadAngle = -45 | 0 | 45 | -90 | 90 | -135 | 180 | 135;
|
|
@@ -8,6 +8,7 @@ import type { WidgetProperties } from "./Widget.js";
|
|
|
8
8
|
import type { VisibleElementsProperties } from "./DirectionalPad/VisibleElements.js";
|
|
9
9
|
import type { DirectionalPadViewModelProperties } from "./DirectionalPad/DirectionalPadViewModel.js";
|
|
10
10
|
|
|
11
|
+
/** @deprecated since 5.2. Use the [Directional Pad component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-directional-pad/) instead. */
|
|
11
12
|
export interface DirectionalPadProperties extends WidgetProperties, Partial<Pick<DirectionalPad, "disabled" | "view" | "visualScale">> {
|
|
12
13
|
/**
|
|
13
14
|
* Icon which represents the widget. It is typically used when the widget is controlled by another
|
|
@@ -90,7 +90,7 @@ export type PopupViewModelContent = Content[] | string | HTMLElement | Widget;
|
|
|
90
90
|
/**
|
|
91
91
|
* Provides the logic for the [Feature](https://developers.arcgis.com/javascript/latest/references/core/widgets/Feature/) widget.
|
|
92
92
|
*
|
|
93
|
-
* @deprecated since 5.2. Use the [Feature (Next) component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-feature-next/) or the [
|
|
93
|
+
* @deprecated since 5.2. Use the [Feature (Next) component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-feature-next/) or the [FeatureModel](https://developers.arcgis.com/javascript/latest/references/core/popup/FeatureModel/) class instead.
|
|
94
94
|
* @since 4.7
|
|
95
95
|
* @see [Feature](https://developers.arcgis.com/javascript/latest/references/core/widgets/Feature/) widget- _Deprecated since 4.34. Use the [Feature (Next) component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-feature-next/) instead._
|
|
96
96
|
* @see [Feature (Next) component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-feature-next/)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../Graphic.js";import{FeatureSetQueryInterceptor as n}from"../../arcade/featureset/support/FeatureSetQueryInterceptor.js";import r from"../../core/Accessor.js";import{isSome as i}from"../../core/arrayUtils.js";import{createTask as a}from"../../core/asyncUtils.js";import o from"../../core/Collection.js";import{deprecatedModule as s}from"../../core/deprecate.js";import{IdentifiableMixin as c}from"../../core/Identifiable.js";import l from"../../core/Logger.js";import{abortMaybe as u}from"../../core/maybe.js";import{eachAlways as d,isAbortError as f,throwIfAborted as p}from"../../core/promiseUtils.js";import{watch as m,initial as h,when as ee,on as g}from"../../core/reactiveUtils.js";import{throttle as _}from"../../core/throttle.js";import{property as v,cast as y,subclass as b}from"../../core/accessorSupport/decorators.js";import x from"../../geometry/Point.js";import S from"../../geometry/SpatialReference.js";import C from"../../popup/content/TextContent.js";import{compileExpressionInfos as w,formatArcadeValue as te}from"../../popup/support/arcadeFeatureUtils.js";import{preLayerQueryCallback as ne,preRequestCallback as re,createFieldInfoMap as ie,getAllFieldInfos as T,getSourceLayer as E,querySourceLayer as D,queryUpdatedFeature as O,isRelatableFeatureSupportedLayer as k,isAssociatedFeatureSupportedLayer as A,substituteFieldsInLinksAndAttributes as j,isExpressionField as M,isRelatedField as N,formatEditInfo as P,graphicCallback as F,formatAttributes as I}from"../../popup/support/featureUtils.js";import{queryLayerInfos as L,queryRelatedFeatures as R,setRelatedFeatures as z,getRelatedFieldInfo as B,createRelatedInfo as V,updateRelatedInfo as H}from"../../popup/support/relatedFeatureUtils.js";import{system as U}from"../../time/constants.js";import W from"./FeatureAttachments/FeatureAttachmentsViewModel.js";import G from"./FeatureContent/FeatureContentViewModel.js";import K from"./FeatureExpression/FeatureExpressionViewModel.js";import q from"./FeatureFields/FeatureFieldsViewModel.js";import J from"./FeatureMedia/FeatureMediaViewModel.js";import ae from"./FeatureRelationship/FeatureRelationshipViewModel.js";import oe from"../support/UtilityNetworkAssociations/FeatureUtilityNetworkAssociationsViewModel.js";var Y;const X=`content-view-models`,Z=`relationship-view-models`,Q={attachmentsContent:!0,chartAnimation:!0,customContent:!0,expressionContent:!0,fieldsContent:!0,mediaContent:!0,textContent:!0,relationshipContent:!0,utilityNetworkAssociationsContent:!0};let $=class extends c(r){static{Y=this}constructor(e){super(e),this._error=null,this._graphicChangedTask=null,this._evaluateExpressionAttributesTask=null,this._associationVMAbortController=null,this._expressionAttributes=null,this._graphicExpressionAttributes=null,this.abilities={...Q},this.content=null,this.contentViewModels=[],this.description=null,this.defaultPopupTemplateEnabled=!1,this.formattedAttributes=null,this.graphic=null,this.lastEditInfo=null,this.location=null,this.relatedInfos=new Map,this.title=``,this.view=null,this._graphicChangedThrottled=_(this._graphicChanged,()=>this.notifyChange(`waitingForContent`),1,this),this._isAllowedContentType=e=>{let{abilities:t}=this;return e.type===`attachments`&&!!t.attachmentsContent||e.type===`custom`&&!!t.customContent||e.type===`fields`&&!!t.fieldsContent||e.type===`media`&&!!t.mediaContent||e.type===`text`&&!!t.textContent||e.type===`expression`&&!!t.expressionContent||e.type===`relationship`&&!!t.relationshipContent||e.type===`utility-network-associations`&&!!t.utilityNetworkAssociationsContent},this._evaluateExpressionAttributesThrottled=_(this._evaluateExpressionAttributes,()=>this.notifyChange(`waitingForContent`),1,this),e?.suppressDeprecationWarning||s(l.getLogger(this),`esri.widgets.Feature.FeatureViewModel`,{version:`5.2`,replacement:`Use the Feature (Next) component or the @arcgis/core/popup/FeatureContent module instead.`,warnOnce:!0}),this.addHandles([m(()=>[this.graphic,this._effectivePopupTemplate,this.abilities,this.timeZone],()=>this._graphicChangedThrottled(),h),ee(()=>{if(!this._graphicChangedTask?.finished||this._graphicChangedTask.value==null)return null;let e=this._graphicChangedTask.value,t=e?.expressionInfos?.dependencies;return[e,t?.has(`view-scale`)?this.view?.scale:null,t?.has(`view-time-extent`)?this.view?.timeExtent?.start:null,t?.has(`view-time-extent`)?this.view?.timeExtent?.end:null]},([e])=>this._evaluateExpressionAttributesThrottled(e))])}normalizeCtorArgs(e){let{suppressDeprecationWarning:t,...n}=e??{};return n}initialize(){this.addHandles([this._graphicChangedThrottled,this._evaluateExpressionAttributesThrottled])}destroy(){this._clear(),this._graphicChangedTask=u(this._graphicChangedTask),this._evaluateExpressionAttributesTask=u(this._evaluateExpressionAttributesTask),this._error=null,this.graphic=null,this._destroyContentViewModels(),this.relatedInfos.clear()}static{this.interceptor=new n(ne,re)}get _effectivePopupTemplate(){return this.graphic==null?null:this.graphic.getEffectivePopupTemplate(this.defaultPopupTemplateEnabled)}get _fieldInfoMap(){return ie(T(this._effectivePopupTemplate),this._sourceLayer)}get _sourceLayer(){return E(this.graphic)}castAbilities(e){return{...Q,...e}}get isFeatureFromTable(){return this._sourceLayer?.isTable||!1}get state(){return this.graphic?this._error?`error`:this.waitingForContent?`loading`:`ready`:`disabled`}get spatialReference(){return this.view?.spatialReference??null}set spatialReference(e){this._override(`spatialReference`,e)}get timeZone(){return this.view?.timeZone??U}set timeZone(e){this._overrideIfSome(`timeZone`,e)}get map(){return this.view?.map||null}set map(e){this._override(`map`,e)}get waitingForContent(){let{_graphicChangedThrottled:e,_evaluateExpressionAttributesThrottled:t,_graphicChangedTask:n,_evaluateExpressionAttributesTask:r,_associationVMAbortController:i}=this;return e.hasPendingUpdates()||t.hasPendingUpdates()||n!=null&&!n.finished||r!=null&&!r.finished||!!i}setActiveMedia(e,t){let n=this.contentViewModels[e];n instanceof J&&n.setActiveMedia(t)}nextMedia(e){let t=this.contentViewModels[e];t instanceof J&&t.next()}previousMedia(e){let t=this.contentViewModels[e];t instanceof J&&t.previous()}async updateGeometry(){let{graphic:e,spatialReference:t,_sourceLayer:n}=this;await n?.load();let r=n?.objectIdField;if(!r||!e||!n)return;let i=e?.attributes?.[r];if(i==null)return;let a=[i];if(!e.geometry){let r=(await D({layer:n,graphic:e,outFields:[],objectIds:a,returnGeometry:!0,spatialReference:t}))?.geometry;r&&(e.geometry=r)}}_clear(){this._set(`title`,``),this._set(`content`,null),this._set(`formattedAttributes`,null)}_graphicChanged(){this._evaluateExpressionAttributesTask=u(this._evaluateExpressionAttributesTask),this._graphicChangedTask=u(this._graphicChangedTask),this._graphicChangedTask=a(async e=>{this._error=null,this._clear();let{graphic:t}=this;try{if(!t)return null;let{_sourceLayer:n,_effectivePopupTemplate:r}=this,i=this.spatialReference;await O({graphic:t,popupTemplate:r,layer:n,spatialReference:i},{signal:e});let[{value:a},{value:o}]=await d([this._getContent(),this._getTitle()]),[,{value:s}]=await d([this._checkForRelatedFeatures({signal:e}),w(r?.expressionInfos,t)]);return{expressionInfos:s,content:a,title:o}}catch(e){throw f(e)||(this._error=e,l.getLogger(this).error(`error`,`The popupTemplate could not be displayed for this feature.`,{error:e,graphic:t,popupTemplate:this._effectivePopupTemplate})),e}})}_compileContentElement(e,t){if(e.type===`attachments`)return this._compileAttachments(e,t);if(e.type===`custom`)return this._compileCustom(e,t);if(e.type===`fields`)return this._compileFields(e,t);if(e.type===`media`)return this._compileMedia(e,t);if(e.type===`text`)return this._compileText(e,t);if(e.type===`expression`)return this._compileExpression(e,t);if(e.type===`relationship`)return this._compileRelationship(e,t);if(e.type===`utility-network-associations`)return this._compileUtilityNetworkAssociation(e,t)}_compileContent(e){if(this._destroyContentViewModels(),this.graphic)return Array.isArray(e)?e.filter(this._isAllowedContentType).map((e,t)=>this._compileContentElement(e,t)).filter(i):typeof e==`string`?this._compileText(new C({text:e}),0).text:e}_destroyContentViewModels(){this.removeHandles(Z),this.removeHandles(X),this.contentViewModels.forEach(e=>e&&!e.destroyed&&e.destroy()),this._set(`contentViewModels`,[])}_matchesFeature(e,t){let n=e?.graphic?.getObjectId(),r=t?.getObjectId();return n!=null&&r!=null&&n===r}_setRelatedFeaturesViewModels({relatedFeatureViewModels:e,relatedFeatures:t,map:n}){let{view:r,spatialReference:i,timeZone:a}=this;t?.filter(Boolean).forEach(t=>{e.some(e=>this._matchesFeature(e,t))||e.add(new Y({abilities:{relationshipContent:!1},map:n,view:r,spatialReference:i,timeZone:a,graphic:t,suppressDeprecationWarning:!0}))}),e.forEach(n=>{t?.find(e=>this._matchesFeature(n,e))||e.remove(n)})}_setExpressionContentVM(e,t){let n=this.formattedAttributes,{contentElement:r,contentElementViewModel:i}=e,a=r?.type;i&&a&&(a===`fields`&&(this._createFieldsFormattedAttributes({contentElement:r,contentElementIndex:t,formattedAttributes:n}),i.set(this._createFieldsVMParams(r,t))),a===`media`&&(this._createMediaFormattedAttributes({contentElement:r,contentElementIndex:t,formattedAttributes:n}),i.set(this._createMediaVMParams(r,t))),a===`text`&&i.set(this._createTextVMParams(r)))}_compileRelationship(e,t){let{displayCount:n,orderByFields:r,relationshipId:i,title:a,description:o}=e,{_sourceLayer:s,graphic:c,map:l}=this;if(!k(s))return;let u=new ae({displayCount:n,graphic:c,orderByFields:r,relationshipId:i,layer:s,map:l,...this._compileTitleAndDesc({title:a,description:o})});return this.contentViewModels[t]=u,this.addHandles(g(()=>u.relatedFeatures,`change`,()=>this._setRelatedFeaturesViewModels(u)),Z),e}_matchesGlobalFeature(e,t){return e.association.equals(t.association)}_setUpUtilityNetworkAssociationsViewModels(e,t,n){let{view:r,spatialReference:i,timeZone:a}=this;e.forEach((n,r)=>{let i=t.get(r);i?n.forEach(t=>{i.find(e=>this._matchesGlobalFeature(t,e))||(n.remove(t),n.length===0&&e.delete(r))}):(n.removeAll(),e.delete(r))}),t.forEach((t,s)=>{let c=e.get(s)||new o;t?.filter(Boolean).forEach((e,t)=>{if(!c.some(t=>this._matchesGlobalFeature(t,e))){let{association:o,feature:s,terminalName:l,title:u}=e;c.add({title:u,association:o,featureViewModel:new Y({abilities:{utilityNetworkAssociationsContent:!1},map:n,view:r,spatialReference:i,timeZone:a,graphic:s,suppressDeprecationWarning:!0}),terminalName:l},t)}}),e.set(s,c)})}_compileUtilityNetworkAssociation(e,t){let{displayCount:n,title:r,description:i,associationTypes:a}=e,{_sourceLayer:o,graphic:s,map:c}=this;if(!A(o))return;let l=new oe({graphic:s,displayCount:n,associationTypes:a,layer:o,map:c,...this._compileTitleAndDesc({title:r,description:i})});return this.contentViewModels[t]=l,this.addHandles([m(()=>l.associationFeatures.values(),()=>this._setUpUtilityNetworkAssociationsViewModels(l.associationViewModels,l.associationFeatures,l.map))],`association-view-models`),e}_compileExpression(e,t){let{expressionInfo:n}=e,{graphic:r,map:i,spatialReference:a,view:o,location:s}=this,c=new K({expressionInfo:n,graphic:r,interceptor:Y.interceptor,map:i,spatialReference:a,view:o,location:s});return this.contentViewModels[t]=c,this.addHandles(m(()=>c.contentElementViewModel,()=>this._setExpressionContentVM(c,t),h),X),e}_compileAttachments(e,t){let{graphic:n}=this,{description:r,title:i,orderByFields:a,attachmentKeywords:o,attachmentTypes:s}=e;return this.contentViewModels[t]=new W({attachmentKeywords:o,attachmentTypes:s,graphic:n,orderByFields:a,...this._compileTitleAndDesc({title:i,description:r})}),e}_compileCustom(e,t){let{graphic:n}=this,{creator:r,destroyer:i}=e;return this.contentViewModels[t]=new G({graphic:n,creator:r,destroyer:i}),e}_compileTitleAndDesc({title:e,description:t}){let{_fieldInfoMap:n,_sourceLayer:r,graphic:i,formattedAttributes:a}=this,o=i?.attributes,s=this._expressionAttributes,c=a.global;return{title:j({attributes:o,fieldInfoMap:n,globalAttributes:c,expressionAttributes:s,layer:r,text:e}),description:j({attributes:o,fieldInfoMap:n,globalAttributes:c,expressionAttributes:s,layer:r,text:t})}}_createFieldsVMParams(e,t){let n=this._effectivePopupTemplate,r=this.formattedAttributes,i={...r?.global,...r?.content[t]},a=!!e?.fieldInfos,o=(e?.fieldInfos||n?.fieldInfos)?.filter(({fieldName:e})=>!!e&&(M(e)||N(e)||i.hasOwnProperty(e))),s=n?.expressionInfos,{description:c,title:l}=e;return{attributes:i,expressionInfos:s,fieldInfos:o,isContentFieldInfos:a,graphic:this.graphic,layer:this._sourceLayer,...this._compileTitleAndDesc({title:l,description:c})}}_compileFields(e,t){let n=e.clone(),r=new q(this._createFieldsVMParams(e,t));return this.contentViewModels[t]=r,n.fieldInfos=r.formattedFieldInfos.slice(),n}_createMediaVMParams(e,t){let{abilities:n,graphic:r,_fieldInfoMap:i,_effectivePopupTemplate:a,relatedInfos:o,_sourceLayer:s,_expressionAttributes:c}=this,l=this.formattedAttributes,u=r?.attributes??{},{description:d,mediaInfos:f,title:p}=e;return{abilities:{chartAnimation:n.chartAnimation},activeMediaInfoIndex:e.activeMediaInfoIndex||0,attributes:u,graphic:r,layer:s,fieldInfoMap:i,formattedAttributes:{...l?.global,...l?.content[t]},expressionAttributes:c,mediaInfos:f,popupTemplate:a,relatedInfos:o,...this._compileTitleAndDesc({title:p,description:d})}}_compileMedia(e,t){let n=e.clone(),r=new J(this._createMediaVMParams(e,t));return n.mediaInfos=r.formattedMediaInfos.slice(),this.contentViewModels[t]=r,n}_createTextVMParams(e){let{graphic:t,_fieldInfoMap:n,_sourceLayer:r,_expressionAttributes:i}=this;if(e&&e.text){let a=t?.attributes??{},o=this.formattedAttributes?.global??{};e.text=j({attributes:a,fieldInfoMap:n,globalAttributes:o,expressionAttributes:i,layer:r,text:e.text})}return{graphic:t,creator:e.text}}_compileText(e,t){let n=e.clone();return this.contentViewModels[t]=new G(this._createTextVMParams(n)),n}_compileLastEditInfo(){let{_effectivePopupTemplate:e,_sourceLayer:t,graphic:n,timeZone:r}=this;if(!e)return;let{lastEditInfoEnabled:i}=e,a=t?.editFieldsInfo;if(i&&a)return P(a,n?.attributes,r,t)}_compileTitle(e){let{_fieldInfoMap:t,_sourceLayer:n,graphic:r,_expressionAttributes:i}=this,a=r?.attributes??{},o=this.formattedAttributes?.global??{};return j({attributes:a,fieldInfoMap:t,globalAttributes:o,expressionAttributes:i,layer:n,text:e})}async _getTitle(){let{_effectivePopupTemplate:e,graphic:t}=this;return t?F({type:`title`,value:e?.title,event:{graphic:t}}):null}async _getContent(){let{_effectivePopupTemplate:e,graphic:t}=this;return t?F({type:`content`,value:e?.content,event:{graphic:t}}):null}_evaluateExpressionAttributes({title:e,content:t,expressionInfos:n}){this._evaluateExpressionAttributesTask=u(this._evaluateExpressionAttributesTask),this._evaluateExpressionAttributesTask=a(async r=>{let{graphic:i,map:a,view:o,spatialReference:s,location:c}=this;try{if(!i)return;let l;if(n!=null){let e=[];for(let[t,l]of n.expressions.entries())l==null?e.push(Promise.resolve([t,void 0])):e.push(l.evaluate({graphic:i,interceptor:Y.interceptor,location:c,map:a,options:{signal:r},spatialReference:s,view:o}).then(e=>[t,typeof e==`string`?te(e):e]).catch(()=>[t,void 0]));l=Object.fromEntries(await Promise.all(e)),p(r)}this._expressionAttributes=l,this._graphicExpressionAttributes={...i.attributes,...l},this._set(`formattedAttributes`,this._createFormattedAttributes(t)),this._set(`title`,this._compileTitle(e)),this._set(`lastEditInfo`,this._compileLastEditInfo()||null),this._set(`content`,this._compileContent(t)||null)}catch(e){f(e)||(this._error=e,l.getLogger(this).error(`error`,`The popupTemplate could not be displayed for this feature.`,{error:e,graphic:i,popupTemplate:this._effectivePopupTemplate}))}})}_createMediaFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:n}){let{_effectivePopupTemplate:r,graphic:i,relatedInfos:a,_sourceLayer:o,_fieldInfoMap:s,_graphicExpressionAttributes:c,timeZone:l}=this;n.content[t]=I({attributes:{...c,...e.attributes},fieldInfoMap:s,fieldInfos:r?.fieldInfos,graphic:i,layer:o,relatedInfos:a,timeZone:l})}_createFieldsFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:n}){if(e.fieldInfos){let{graphic:r,relatedInfos:i,_sourceLayer:a,_fieldInfoMap:o,_graphicExpressionAttributes:s,timeZone:c}=this;n.content[t]=I({attributes:{...s,...e.attributes},fieldInfoMap:o,fieldInfos:e.fieldInfos,graphic:r,isContentFieldInfos:!0,layer:a,relatedInfos:i,timeZone:c})}}_createFormattedAttributes(e){let{_effectivePopupTemplate:t,graphic:n,relatedInfos:r,_sourceLayer:i,_fieldInfoMap:a,_graphicExpressionAttributes:o,timeZone:s}=this,c=t?.fieldInfos,l={global:I({attributes:o,fieldInfoMap:a,fieldInfos:c,graphic:n,layer:i,relatedInfos:r,timeZone:s}),content:[]};return Array.isArray(e)&&e.forEach((e,t)=>{e.type===`fields`&&this._createFieldsFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:l}),e.type===`media`&&this._createMediaFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:l})}),l}_checkForRelatedFeatures(e){let{graphic:t,_effectivePopupTemplate:n}=this;return this._queryRelatedInfos(t,T(n),e)}async _queryRelatedInfos(e,t,n){let{relatedInfos:r,_sourceLayer:i}=this;r.clear();let a=i?.associatedLayer==null?i:await i?.associatedLayer.load(n);if(!a||!e||!t.filter(e=>!!e.fieldName&&N(e.fieldName))?.length)return;t.forEach(e=>this._configureRelatedInfo(e,a));let o=await L({relatedInfos:r,layer:a},n);Object.keys(o).forEach(e=>{let t=r.get(e.toString()),n=o[e]?.value;t&&n&&(t.layerInfo=n.data)});let s=await R({graphic:e,relatedInfos:r,layer:a},n);Object.keys(s).forEach(e=>{z(s[e]?.value,r.get(e.toString()))})}_configureRelatedInfo(e,t){let{relatedInfos:n}=this,r=B(e.fieldName||``);if(!r)return;let{layerId:i,fieldName:a}=r;if(!i)return;let o=n.get(i.toString())||V(i,t);o&&(H({relatedInfo:o,fieldName:a,fieldInfo:e}),this.relatedInfos.set(i,o))}};e([v()],$.prototype,`_error`,void 0),e([v()],$.prototype,`_graphicChangedTask`,void 0),e([v()],$.prototype,`_evaluateExpressionAttributesTask`,void 0),e([v()],$.prototype,`_associationVMAbortController`,void 0),e([v({readOnly:!0})],$.prototype,`_effectivePopupTemplate`,null),e([v({readOnly:!0})],$.prototype,`_fieldInfoMap`,null),e([v({readOnly:!0})],$.prototype,`_sourceLayer`,null),e([v()],$.prototype,`abilities`,void 0),e([y(`abilities`)],$.prototype,`castAbilities`,null),e([v({readOnly:!0})],$.prototype,`content`,void 0),e([v({readOnly:!0})],$.prototype,`contentViewModels`,void 0),e([v()],$.prototype,`description`,void 0),e([v({type:Boolean})],$.prototype,`defaultPopupTemplateEnabled`,void 0),e([v({readOnly:!0})],$.prototype,`isFeatureFromTable`,null),e([v({readOnly:!0})],$.prototype,`state`,null),e([v({readOnly:!0})],$.prototype,`formattedAttributes`,void 0),e([v({type:t})],$.prototype,`graphic`,void 0),e([v({readOnly:!0})],$.prototype,`lastEditInfo`,void 0),e([v({type:x})],$.prototype,`location`,void 0),e([v({readOnly:!0})],$.prototype,`relatedInfos`,void 0),e([v({type:S})],$.prototype,`spatialReference`,null),e([v()],$.prototype,`timeZone`,null),e([v({readOnly:!0})],$.prototype,`title`,void 0),e([v()],$.prototype,`map`,null),e([v({readOnly:!0})],$.prototype,`waitingForContent`,null),e([v()],$.prototype,`view`,void 0),$=Y=e([b(`esri.widgets.Feature.FeatureViewModel`)],$);export{$ as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../Graphic.js";import{FeatureSetQueryInterceptor as n}from"../../arcade/featureset/support/FeatureSetQueryInterceptor.js";import r from"../../core/Accessor.js";import{isSome as i}from"../../core/arrayUtils.js";import{createTask as a}from"../../core/asyncUtils.js";import o from"../../core/Collection.js";import{deprecatedModule as s}from"../../core/deprecate.js";import{IdentifiableMixin as c}from"../../core/Identifiable.js";import l from"../../core/Logger.js";import{abortMaybe as u}from"../../core/maybe.js";import{eachAlways as d,isAbortError as f,throwIfAborted as p}from"../../core/promiseUtils.js";import{watch as m,initial as h,when as ee,on as g}from"../../core/reactiveUtils.js";import{throttle as _}from"../../core/throttle.js";import{property as v,cast as y,subclass as b}from"../../core/accessorSupport/decorators.js";import x from"../../geometry/Point.js";import S from"../../geometry/SpatialReference.js";import C from"../../popup/content/TextContent.js";import{compileExpressionInfos as w,formatArcadeValue as te}from"../../popup/support/arcadeFeatureUtils.js";import{preLayerQueryCallback as ne,preRequestCallback as re,createFieldInfoMap as ie,getAllFieldInfos as T,getSourceLayer as E,querySourceLayer as D,queryUpdatedFeature as O,isRelatableFeatureSupportedLayer as k,isAssociatedFeatureSupportedLayer as A,substituteFieldsInLinksAndAttributes as j,isExpressionField as M,isRelatedField as N,formatEditInfo as P,graphicCallback as F,formatAttributes as I}from"../../popup/support/featureUtils.js";import{queryLayerInfos as L,queryRelatedFeatures as R,setRelatedFeatures as z,getRelatedFieldInfo as B,createRelatedInfo as V,updateRelatedInfo as H}from"../../popup/support/relatedFeatureUtils.js";import{system as U}from"../../time/constants.js";import W from"./FeatureAttachments/FeatureAttachmentsViewModel.js";import G from"./FeatureContent/FeatureContentViewModel.js";import K from"./FeatureExpression/FeatureExpressionViewModel.js";import q from"./FeatureFields/FeatureFieldsViewModel.js";import J from"./FeatureMedia/FeatureMediaViewModel.js";import ae from"./FeatureRelationship/FeatureRelationshipViewModel.js";import oe from"../support/UtilityNetworkAssociations/FeatureUtilityNetworkAssociationsViewModel.js";var Y;const X=`content-view-models`,Z=`relationship-view-models`,Q={attachmentsContent:!0,chartAnimation:!0,customContent:!0,expressionContent:!0,fieldsContent:!0,mediaContent:!0,textContent:!0,relationshipContent:!0,utilityNetworkAssociationsContent:!0};let $=class extends c(r){static{Y=this}constructor(e){super(e),this._error=null,this._graphicChangedTask=null,this._evaluateExpressionAttributesTask=null,this._associationVMAbortController=null,this._expressionAttributes=null,this._graphicExpressionAttributes=null,this.abilities={...Q},this.content=null,this.contentViewModels=[],this.description=null,this.defaultPopupTemplateEnabled=!1,this.formattedAttributes=null,this.graphic=null,this.lastEditInfo=null,this.location=null,this.relatedInfos=new Map,this.title=``,this.view=null,this._graphicChangedThrottled=_(this._graphicChanged,()=>this.notifyChange(`waitingForContent`),1,this),this._isAllowedContentType=e=>{let{abilities:t}=this;return e.type===`attachments`&&!!t.attachmentsContent||e.type===`custom`&&!!t.customContent||e.type===`fields`&&!!t.fieldsContent||e.type===`media`&&!!t.mediaContent||e.type===`text`&&!!t.textContent||e.type===`expression`&&!!t.expressionContent||e.type===`relationship`&&!!t.relationshipContent||e.type===`utility-network-associations`&&!!t.utilityNetworkAssociationsContent},this._evaluateExpressionAttributesThrottled=_(this._evaluateExpressionAttributes,()=>this.notifyChange(`waitingForContent`),1,this),e?.suppressDeprecationWarning||s(l.getLogger(this),`esri.widgets.Feature.FeatureViewModel`,{version:`5.2`,replacement:`Use the Feature (Next) component or the @arcgis/core/popup/FeatureModel module instead.`,warnOnce:!0}),this.addHandles([m(()=>[this.graphic,this._effectivePopupTemplate,this.abilities,this.timeZone],()=>this._graphicChangedThrottled(),h),ee(()=>{if(!this._graphicChangedTask?.finished||this._graphicChangedTask.value==null)return null;let e=this._graphicChangedTask.value,t=e?.expressionInfos?.dependencies;return[e,t?.has(`view-scale`)?this.view?.scale:null,t?.has(`view-time-extent`)?this.view?.timeExtent?.start:null,t?.has(`view-time-extent`)?this.view?.timeExtent?.end:null]},([e])=>this._evaluateExpressionAttributesThrottled(e))])}normalizeCtorArgs(e){let{suppressDeprecationWarning:t,...n}=e??{};return n}initialize(){this.addHandles([this._graphicChangedThrottled,this._evaluateExpressionAttributesThrottled])}destroy(){this._clear(),this._graphicChangedTask=u(this._graphicChangedTask),this._evaluateExpressionAttributesTask=u(this._evaluateExpressionAttributesTask),this._error=null,this.graphic=null,this._destroyContentViewModels(),this.relatedInfos.clear()}static{this.interceptor=new n(ne,re)}get _effectivePopupTemplate(){return this.graphic==null?null:this.graphic.getEffectivePopupTemplate(this.defaultPopupTemplateEnabled)}get _fieldInfoMap(){return ie(T(this._effectivePopupTemplate),this._sourceLayer)}get _sourceLayer(){return E(this.graphic)}castAbilities(e){return{...Q,...e}}get isFeatureFromTable(){return this._sourceLayer?.isTable||!1}get state(){return this.graphic?this._error?`error`:this.waitingForContent?`loading`:`ready`:`disabled`}get spatialReference(){return this.view?.spatialReference??null}set spatialReference(e){this._override(`spatialReference`,e)}get timeZone(){return this.view?.timeZone??U}set timeZone(e){this._overrideIfSome(`timeZone`,e)}get map(){return this.view?.map||null}set map(e){this._override(`map`,e)}get waitingForContent(){let{_graphicChangedThrottled:e,_evaluateExpressionAttributesThrottled:t,_graphicChangedTask:n,_evaluateExpressionAttributesTask:r,_associationVMAbortController:i}=this;return e.hasPendingUpdates()||t.hasPendingUpdates()||n!=null&&!n.finished||r!=null&&!r.finished||!!i}setActiveMedia(e,t){let n=this.contentViewModels[e];n instanceof J&&n.setActiveMedia(t)}nextMedia(e){let t=this.contentViewModels[e];t instanceof J&&t.next()}previousMedia(e){let t=this.contentViewModels[e];t instanceof J&&t.previous()}async updateGeometry(){let{graphic:e,spatialReference:t,_sourceLayer:n}=this;await n?.load();let r=n?.objectIdField;if(!r||!e||!n)return;let i=e?.attributes?.[r];if(i==null)return;let a=[i];if(!e.geometry){let r=(await D({layer:n,graphic:e,outFields:[],objectIds:a,returnGeometry:!0,spatialReference:t}))?.geometry;r&&(e.geometry=r)}}_clear(){this._set(`title`,``),this._set(`content`,null),this._set(`formattedAttributes`,null)}_graphicChanged(){this._evaluateExpressionAttributesTask=u(this._evaluateExpressionAttributesTask),this._graphicChangedTask=u(this._graphicChangedTask),this._graphicChangedTask=a(async e=>{this._error=null,this._clear();let{graphic:t}=this;try{if(!t)return null;let{_sourceLayer:n,_effectivePopupTemplate:r}=this,i=this.spatialReference;await O({graphic:t,popupTemplate:r,layer:n,spatialReference:i},{signal:e});let[{value:a},{value:o}]=await d([this._getContent(),this._getTitle()]),[,{value:s}]=await d([this._checkForRelatedFeatures({signal:e}),w(r?.expressionInfos,t)]);return{expressionInfos:s,content:a,title:o}}catch(e){throw f(e)||(this._error=e,l.getLogger(this).error(`error`,`The popupTemplate could not be displayed for this feature.`,{error:e,graphic:t,popupTemplate:this._effectivePopupTemplate})),e}})}_compileContentElement(e,t){if(e.type===`attachments`)return this._compileAttachments(e,t);if(e.type===`custom`)return this._compileCustom(e,t);if(e.type===`fields`)return this._compileFields(e,t);if(e.type===`media`)return this._compileMedia(e,t);if(e.type===`text`)return this._compileText(e,t);if(e.type===`expression`)return this._compileExpression(e,t);if(e.type===`relationship`)return this._compileRelationship(e,t);if(e.type===`utility-network-associations`)return this._compileUtilityNetworkAssociation(e,t)}_compileContent(e){if(this._destroyContentViewModels(),this.graphic)return Array.isArray(e)?e.filter(this._isAllowedContentType).map((e,t)=>this._compileContentElement(e,t)).filter(i):typeof e==`string`?this._compileText(new C({text:e}),0).text:e}_destroyContentViewModels(){this.removeHandles(Z),this.removeHandles(X),this.contentViewModels.forEach(e=>e&&!e.destroyed&&e.destroy()),this._set(`contentViewModels`,[])}_matchesFeature(e,t){let n=e?.graphic?.getObjectId(),r=t?.getObjectId();return n!=null&&r!=null&&n===r}_setRelatedFeaturesViewModels({relatedFeatureViewModels:e,relatedFeatures:t,map:n}){let{view:r,spatialReference:i,timeZone:a}=this;t?.filter(Boolean).forEach(t=>{e.some(e=>this._matchesFeature(e,t))||e.add(new Y({abilities:{relationshipContent:!1},map:n,view:r,spatialReference:i,timeZone:a,graphic:t,suppressDeprecationWarning:!0}))}),e.forEach(n=>{t?.find(e=>this._matchesFeature(n,e))||e.remove(n)})}_setExpressionContentVM(e,t){let n=this.formattedAttributes,{contentElement:r,contentElementViewModel:i}=e,a=r?.type;i&&a&&(a===`fields`&&(this._createFieldsFormattedAttributes({contentElement:r,contentElementIndex:t,formattedAttributes:n}),i.set(this._createFieldsVMParams(r,t))),a===`media`&&(this._createMediaFormattedAttributes({contentElement:r,contentElementIndex:t,formattedAttributes:n}),i.set(this._createMediaVMParams(r,t))),a===`text`&&i.set(this._createTextVMParams(r)))}_compileRelationship(e,t){let{displayCount:n,orderByFields:r,relationshipId:i,title:a,description:o}=e,{_sourceLayer:s,graphic:c,map:l}=this;if(!k(s))return;let u=new ae({displayCount:n,graphic:c,orderByFields:r,relationshipId:i,layer:s,map:l,...this._compileTitleAndDesc({title:a,description:o})});return this.contentViewModels[t]=u,this.addHandles(g(()=>u.relatedFeatures,`change`,()=>this._setRelatedFeaturesViewModels(u)),Z),e}_matchesGlobalFeature(e,t){return e.association.equals(t.association)}_setUpUtilityNetworkAssociationsViewModels(e,t,n){let{view:r,spatialReference:i,timeZone:a}=this;e.forEach((n,r)=>{let i=t.get(r);i?n.forEach(t=>{i.find(e=>this._matchesGlobalFeature(t,e))||(n.remove(t),n.length===0&&e.delete(r))}):(n.removeAll(),e.delete(r))}),t.forEach((t,s)=>{let c=e.get(s)||new o;t?.filter(Boolean).forEach((e,t)=>{if(!c.some(t=>this._matchesGlobalFeature(t,e))){let{association:o,feature:s,terminalName:l,title:u}=e;c.add({title:u,association:o,featureViewModel:new Y({abilities:{utilityNetworkAssociationsContent:!1},map:n,view:r,spatialReference:i,timeZone:a,graphic:s,suppressDeprecationWarning:!0}),terminalName:l},t)}}),e.set(s,c)})}_compileUtilityNetworkAssociation(e,t){let{displayCount:n,title:r,description:i,associationTypes:a}=e,{_sourceLayer:o,graphic:s,map:c}=this;if(!A(o))return;let l=new oe({graphic:s,displayCount:n,associationTypes:a,layer:o,map:c,...this._compileTitleAndDesc({title:r,description:i})});return this.contentViewModels[t]=l,this.addHandles([m(()=>l.associationFeatures.values(),()=>this._setUpUtilityNetworkAssociationsViewModels(l.associationViewModels,l.associationFeatures,l.map))],`association-view-models`),e}_compileExpression(e,t){let{expressionInfo:n}=e,{graphic:r,map:i,spatialReference:a,view:o,location:s}=this,c=new K({expressionInfo:n,graphic:r,interceptor:Y.interceptor,map:i,spatialReference:a,view:o,location:s});return this.contentViewModels[t]=c,this.addHandles(m(()=>c.contentElementViewModel,()=>this._setExpressionContentVM(c,t),h),X),e}_compileAttachments(e,t){let{graphic:n}=this,{description:r,title:i,orderByFields:a,attachmentKeywords:o,attachmentTypes:s}=e;return this.contentViewModels[t]=new W({attachmentKeywords:o,attachmentTypes:s,graphic:n,orderByFields:a,...this._compileTitleAndDesc({title:i,description:r})}),e}_compileCustom(e,t){let{graphic:n}=this,{creator:r,destroyer:i}=e;return this.contentViewModels[t]=new G({graphic:n,creator:r,destroyer:i}),e}_compileTitleAndDesc({title:e,description:t}){let{_fieldInfoMap:n,_sourceLayer:r,graphic:i,formattedAttributes:a}=this,o=i?.attributes,s=this._expressionAttributes,c=a.global;return{title:j({attributes:o,fieldInfoMap:n,globalAttributes:c,expressionAttributes:s,layer:r,text:e}),description:j({attributes:o,fieldInfoMap:n,globalAttributes:c,expressionAttributes:s,layer:r,text:t})}}_createFieldsVMParams(e,t){let n=this._effectivePopupTemplate,r=this.formattedAttributes,i={...r?.global,...r?.content[t]},a=!!e?.fieldInfos,o=(e?.fieldInfos||n?.fieldInfos)?.filter(({fieldName:e})=>!!e&&(M(e)||N(e)||i.hasOwnProperty(e))),s=n?.expressionInfos,{description:c,title:l}=e;return{attributes:i,expressionInfos:s,fieldInfos:o,isContentFieldInfos:a,graphic:this.graphic,layer:this._sourceLayer,...this._compileTitleAndDesc({title:l,description:c})}}_compileFields(e,t){let n=e.clone(),r=new q(this._createFieldsVMParams(e,t));return this.contentViewModels[t]=r,n.fieldInfos=r.formattedFieldInfos.slice(),n}_createMediaVMParams(e,t){let{abilities:n,graphic:r,_fieldInfoMap:i,_effectivePopupTemplate:a,relatedInfos:o,_sourceLayer:s,_expressionAttributes:c}=this,l=this.formattedAttributes,u=r?.attributes??{},{description:d,mediaInfos:f,title:p}=e;return{abilities:{chartAnimation:n.chartAnimation},activeMediaInfoIndex:e.activeMediaInfoIndex||0,attributes:u,graphic:r,layer:s,fieldInfoMap:i,formattedAttributes:{...l?.global,...l?.content[t]},expressionAttributes:c,mediaInfos:f,popupTemplate:a,relatedInfos:o,...this._compileTitleAndDesc({title:p,description:d})}}_compileMedia(e,t){let n=e.clone(),r=new J(this._createMediaVMParams(e,t));return n.mediaInfos=r.formattedMediaInfos.slice(),this.contentViewModels[t]=r,n}_createTextVMParams(e){let{graphic:t,_fieldInfoMap:n,_sourceLayer:r,_expressionAttributes:i}=this;if(e&&e.text){let a=t?.attributes??{},o=this.formattedAttributes?.global??{};e.text=j({attributes:a,fieldInfoMap:n,globalAttributes:o,expressionAttributes:i,layer:r,text:e.text})}return{graphic:t,creator:e.text}}_compileText(e,t){let n=e.clone();return this.contentViewModels[t]=new G(this._createTextVMParams(n)),n}_compileLastEditInfo(){let{_effectivePopupTemplate:e,_sourceLayer:t,graphic:n,timeZone:r}=this;if(!e)return;let{lastEditInfoEnabled:i}=e,a=t?.editFieldsInfo;if(i&&a)return P(a,n?.attributes,r,t)}_compileTitle(e){let{_fieldInfoMap:t,_sourceLayer:n,graphic:r,_expressionAttributes:i}=this,a=r?.attributes??{},o=this.formattedAttributes?.global??{};return j({attributes:a,fieldInfoMap:t,globalAttributes:o,expressionAttributes:i,layer:n,text:e})}async _getTitle(){let{_effectivePopupTemplate:e,graphic:t}=this;return t?F({type:`title`,value:e?.title,event:{graphic:t}}):null}async _getContent(){let{_effectivePopupTemplate:e,graphic:t}=this;return t?F({type:`content`,value:e?.content,event:{graphic:t}}):null}_evaluateExpressionAttributes({title:e,content:t,expressionInfos:n}){this._evaluateExpressionAttributesTask=u(this._evaluateExpressionAttributesTask),this._evaluateExpressionAttributesTask=a(async r=>{let{graphic:i,map:a,view:o,spatialReference:s,location:c}=this;try{if(!i)return;let l;if(n!=null){let e=[];for(let[t,l]of n.expressions.entries())l==null?e.push(Promise.resolve([t,void 0])):e.push(l.evaluate({graphic:i,interceptor:Y.interceptor,location:c,map:a,options:{signal:r},spatialReference:s,view:o}).then(e=>[t,typeof e==`string`?te(e):e]).catch(()=>[t,void 0]));l=Object.fromEntries(await Promise.all(e)),p(r)}this._expressionAttributes=l,this._graphicExpressionAttributes={...i.attributes,...l},this._set(`formattedAttributes`,this._createFormattedAttributes(t)),this._set(`title`,this._compileTitle(e)),this._set(`lastEditInfo`,this._compileLastEditInfo()||null),this._set(`content`,this._compileContent(t)||null)}catch(e){f(e)||(this._error=e,l.getLogger(this).error(`error`,`The popupTemplate could not be displayed for this feature.`,{error:e,graphic:i,popupTemplate:this._effectivePopupTemplate}))}})}_createMediaFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:n}){let{_effectivePopupTemplate:r,graphic:i,relatedInfos:a,_sourceLayer:o,_fieldInfoMap:s,_graphicExpressionAttributes:c,timeZone:l}=this;n.content[t]=I({attributes:{...c,...e.attributes},fieldInfoMap:s,fieldInfos:r?.fieldInfos,graphic:i,layer:o,relatedInfos:a,timeZone:l})}_createFieldsFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:n}){if(e.fieldInfos){let{graphic:r,relatedInfos:i,_sourceLayer:a,_fieldInfoMap:o,_graphicExpressionAttributes:s,timeZone:c}=this;n.content[t]=I({attributes:{...s,...e.attributes},fieldInfoMap:o,fieldInfos:e.fieldInfos,graphic:r,isContentFieldInfos:!0,layer:a,relatedInfos:i,timeZone:c})}}_createFormattedAttributes(e){let{_effectivePopupTemplate:t,graphic:n,relatedInfos:r,_sourceLayer:i,_fieldInfoMap:a,_graphicExpressionAttributes:o,timeZone:s}=this,c=t?.fieldInfos,l={global:I({attributes:o,fieldInfoMap:a,fieldInfos:c,graphic:n,layer:i,relatedInfos:r,timeZone:s}),content:[]};return Array.isArray(e)&&e.forEach((e,t)=>{e.type===`fields`&&this._createFieldsFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:l}),e.type===`media`&&this._createMediaFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:l})}),l}_checkForRelatedFeatures(e){let{graphic:t,_effectivePopupTemplate:n}=this;return this._queryRelatedInfos(t,T(n),e)}async _queryRelatedInfos(e,t,n){let{relatedInfos:r,_sourceLayer:i}=this;r.clear();let a=i?.associatedLayer==null?i:await i?.associatedLayer.load(n);if(!a||!e||!t.filter(e=>!!e.fieldName&&N(e.fieldName))?.length)return;t.forEach(e=>this._configureRelatedInfo(e,a));let o=await L({relatedInfos:r,layer:a},n);Object.keys(o).forEach(e=>{let t=r.get(e.toString()),n=o[e]?.value;t&&n&&(t.layerInfo=n.data)});let s=await R({graphic:e,relatedInfos:r,layer:a},n);Object.keys(s).forEach(e=>{z(s[e]?.value,r.get(e.toString()))})}_configureRelatedInfo(e,t){let{relatedInfos:n}=this,r=B(e.fieldName||``);if(!r)return;let{layerId:i,fieldName:a}=r;if(!i)return;let o=n.get(i.toString())||V(i,t);o&&(H({relatedInfo:o,fieldName:a,fieldInfo:e}),this.relatedInfos.set(i,o))}};e([v()],$.prototype,`_error`,void 0),e([v()],$.prototype,`_graphicChangedTask`,void 0),e([v()],$.prototype,`_evaluateExpressionAttributesTask`,void 0),e([v()],$.prototype,`_associationVMAbortController`,void 0),e([v({readOnly:!0})],$.prototype,`_effectivePopupTemplate`,null),e([v({readOnly:!0})],$.prototype,`_fieldInfoMap`,null),e([v({readOnly:!0})],$.prototype,`_sourceLayer`,null),e([v()],$.prototype,`abilities`,void 0),e([y(`abilities`)],$.prototype,`castAbilities`,null),e([v({readOnly:!0})],$.prototype,`content`,void 0),e([v({readOnly:!0})],$.prototype,`contentViewModels`,void 0),e([v()],$.prototype,`description`,void 0),e([v({type:Boolean})],$.prototype,`defaultPopupTemplateEnabled`,void 0),e([v({readOnly:!0})],$.prototype,`isFeatureFromTable`,null),e([v({readOnly:!0})],$.prototype,`state`,null),e([v({readOnly:!0})],$.prototype,`formattedAttributes`,void 0),e([v({type:t})],$.prototype,`graphic`,void 0),e([v({readOnly:!0})],$.prototype,`lastEditInfo`,void 0),e([v({type:x})],$.prototype,`location`,void 0),e([v({readOnly:!0})],$.prototype,`relatedInfos`,void 0),e([v({type:S})],$.prototype,`spatialReference`,null),e([v()],$.prototype,`timeZone`,null),e([v({readOnly:!0})],$.prototype,`title`,void 0),e([v()],$.prototype,`map`,null),e([v({readOnly:!0})],$.prototype,`waitingForContent`,null),e([v()],$.prototype,`view`,void 0),$=Y=e([b(`esri.widgets.Feature.FeatureViewModel`)],$);export{$ as default};
|
|
@@ -102,7 +102,7 @@ export interface FeaturesViewModelProperties extends GoToProperties, Partial<Pic
|
|
|
102
102
|
timeZone?: TimeZone | null;
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
/** @deprecated since 5.2. Use the [Features (Next) component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-features-next/) or the [
|
|
105
|
+
/** @deprecated since 5.2. Use the [Features (Next) component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-features-next/) or the [FeaturesModel](https://developers.arcgis.com/javascript/latest/references/core/popup/FeaturesModel/) class instead. */
|
|
106
106
|
export interface FeaturesViewModelEvents {
|
|
107
107
|
/**
|
|
108
108
|
* Fires after the user clicks on an [action](https://developers.arcgis.com/javascript/latest/references/core/support/actions/ActionButton/) or [action toggle](https://developers.arcgis.com/javascript/latest/references/core/support/actions/ActionToggle/) in the action bar. This
|
|
@@ -198,7 +198,7 @@ export interface FeaturesViewModelEvents {
|
|
|
198
198
|
/**
|
|
199
199
|
* Provides the logic for the [Features](https://developers.arcgis.com/javascript/latest/references/core/widgets/Features/) widget.
|
|
200
200
|
*
|
|
201
|
-
* @deprecated since 5.2. Use the [Features (Next) component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-features-next/) or the [
|
|
201
|
+
* @deprecated since 5.2. Use the [Features (Next) component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-features-next/) or the [FeaturesModel](https://developers.arcgis.com/javascript/latest/references/core/popup/FeaturesModel/) class instead.
|
|
202
202
|
* @since 4.27
|
|
203
203
|
* @see [Features](https://developers.arcgis.com/javascript/latest/references/core/widgets/Features/) widget - _Deprecated since 4.34. Use the [Features (Next) component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-features-next/) instead._
|
|
204
204
|
* @see [Features (Next) component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-features-next/)
|