@arcgis/core 5.2.0-next.154 → 5.2.0-next.156
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/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{d994bcf0a65d1c07160f.js → 0320cbd825f9a4222042.js} +1 -1
- package/assets/esri/core/workers/chunks/0590857215c547e63b51.js +1 -0
- package/assets/esri/core/workers/chunks/08fe248e412bb170210d.js +1 -0
- package/assets/esri/core/workers/chunks/0cb50bc2b2125c5fedf2.js +1 -0
- package/assets/esri/core/workers/chunks/1201b8c5852830836eac.js +1 -0
- package/assets/esri/core/workers/chunks/129e04d24ced77c9bb6d.js +1 -0
- package/assets/esri/core/workers/chunks/15e1117a706a98b17ad5.js +1 -0
- package/assets/esri/core/workers/chunks/164e74d586297946a717.js +1 -0
- package/assets/esri/core/workers/chunks/168a523bdc3653081f8a.js +1 -0
- package/assets/esri/core/workers/chunks/{6f4e6022a52de0c54aab.js → 172cfeb5f415e4662432.js} +1 -1
- package/assets/esri/core/workers/chunks/1aa4f5394a596e544aeb.js +1 -0
- package/assets/esri/core/workers/chunks/22b01fe31bbf0bdc48db.js +1 -0
- package/assets/esri/core/workers/chunks/27c2da2e779def2ee08b.js +1 -0
- package/assets/esri/core/workers/chunks/28b74bc77f7c13080074.js +1 -0
- package/assets/esri/core/workers/chunks/{481589c3eddad6e026ad.js → 369780276b2755361f7d.js} +1 -1
- package/assets/esri/core/workers/chunks/3914d96147642a9d4b01.js +1 -0
- package/assets/esri/core/workers/chunks/{731018c0deffc41ffc97.js → 3e3e076fa5e8d5d5f33f.js} +1 -1
- package/assets/esri/core/workers/chunks/43cf862577bf37344ff4.js +1 -0
- package/assets/esri/core/workers/chunks/4932773663469919d10a.js +1 -0
- package/assets/esri/core/workers/chunks/4996869b9cbd8c8ddcfa.js +1 -0
- package/assets/esri/core/workers/chunks/4c389472b8cdb0c55154.js +1 -0
- package/assets/esri/core/workers/chunks/4e4f747de424941a0bfa.js +1 -0
- package/assets/esri/core/workers/chunks/{eb815148ae65388dd733.js → 544070198d2ca556103a.js} +1 -1
- package/assets/esri/core/workers/chunks/5736feefa261589b6273.js +1 -0
- package/assets/esri/core/workers/chunks/{aeaaff7a4b1a99540f52.js → 5cb26bbaa08114aec5ce.js} +1 -1
- package/assets/esri/core/workers/chunks/5f4feca26102088ea565.js +1 -0
- package/assets/esri/core/workers/chunks/{407f1e8176f3b0af73b4.js → 66867e523cc82f8fe35b.js} +1 -1
- package/assets/esri/core/workers/chunks/6f73e41e14817acfaead.js +1 -0
- package/assets/esri/core/workers/chunks/{320e5942a098dd104366.js → 74137ffec5265628c33b.js} +1 -1
- package/assets/esri/core/workers/chunks/7446d0dfebf93e86c098.js +1 -0
- package/assets/esri/core/workers/chunks/{688f2dbf784e66082308.js → 74c866e0b66e61751861.js} +1 -1
- package/assets/esri/core/workers/chunks/7711ae5612f685078fc8.js +1 -0
- package/assets/esri/core/workers/chunks/{5116b569a8dbda4910c8.js → 784a2fba3e18286958d1.js} +1 -1
- package/assets/esri/core/workers/chunks/{693873b3eb99fba58fa9.js → 78c4e43cfa1eda06b4d9.js} +1 -1
- package/assets/esri/core/workers/chunks/{f6e62d2d279a328cbed7.js → 7bcedf479b07a4b4a234.js} +1 -1
- package/assets/esri/core/workers/chunks/81cad8d2f62a5f671c55.js +1 -0
- package/assets/esri/core/workers/chunks/{588e677f33df86a595bf.js → 820c8aaf3632edb0150c.js} +1 -1
- package/assets/esri/core/workers/chunks/842893e75696428d536f.js +1 -0
- package/assets/esri/core/workers/chunks/8e19629899a5becf8e19.js +1 -0
- package/assets/esri/core/workers/chunks/950d4578dc450467404c.js +1 -0
- package/assets/esri/core/workers/chunks/{68be3fb88ca61f82fb90.js → 95dbbddac6581b9d671f.js} +1 -1
- package/assets/esri/core/workers/chunks/{a4162a8660bf763d542d.js → 967b4992b400517ee712.js} +1 -1
- package/assets/esri/core/workers/chunks/{adf25e5ed99615b83c68.js → a62c12925303ff802c3d.js} +1 -1
- package/assets/esri/core/workers/chunks/{900181f68449d8f82eeb.js → aa1ac7954e4f0fefe15b.js} +1 -1
- package/assets/esri/core/workers/chunks/ac24b4370dc7194a3107.js +1 -0
- package/assets/esri/core/workers/chunks/acdfd275dbf8533a67f3.js +1 -0
- package/assets/esri/core/workers/chunks/ace2e0a9d9013edd8624.js +1 -0
- package/assets/esri/core/workers/chunks/b1d5d236d5268fcbc74b.js +1 -0
- package/assets/esri/core/workers/chunks/b3007aedbf731dacaff1.js +1 -0
- package/assets/esri/core/workers/chunks/{53e2f2b922116a45fe8f.js → b573df59391ca41ee5a7.js} +1 -1
- package/assets/esri/core/workers/chunks/bac8c32665e982896ecc.js +1 -0
- package/assets/esri/core/workers/chunks/{f3da30d7300b92bd8bb0.js → befa32b9e7b3fbdd431e.js} +1 -1
- package/assets/esri/core/workers/chunks/c19f238b55ff2893f7c2.js +1 -0
- package/assets/esri/core/workers/chunks/c5ed67fdf261cbb1624b.js +1 -0
- package/assets/esri/core/workers/chunks/c72a904e01dc8c17d992.js +1 -0
- package/assets/esri/core/workers/chunks/d9b1aed88b205689cec6.js +1 -0
- package/assets/esri/core/workers/chunks/de6081df29183bf80787.js +1 -0
- package/assets/esri/core/workers/chunks/{c598b22f78ccc57f9d6d.js → dfd2dc5cdc97ffba8926.js} +1 -1
- package/assets/esri/core/workers/chunks/e1b7806ab3e1967b15f0.js +1 -0
- package/assets/esri/core/workers/chunks/e653c81ffb3d818645dd.js +1 -0
- package/assets/esri/core/workers/chunks/eaddffcc7004101fc230.js +1 -0
- package/assets/esri/core/workers/chunks/eb2652ec48faa78de3c5.js +1 -0
- package/assets/esri/core/workers/chunks/{c62738f84c914671b143.js → f4a7aa3cdbc0c429c359.js} +1 -1
- package/assets/esri/core/workers/chunks/fda83bcb8e40e8044c24.js +1 -0
- package/assets/esri/libs/pdfjs/wasm/openjpeg_nowasm_fallback.js +1 -0
- package/assets/esri/themes/base/widgets/_OrientedImageryViewer.scss +4 -0
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/widgets/support/uriUtils/t9n/messages.fr.json +1 -1
- package/config.d.ts +2 -0
- package/config.js +1 -1
- package/core/ObjectPool.js +1 -1
- package/core/PooledArray.js +1 -1
- package/core/accessorSupport/tracking/SimpleTrackingTarget.js +1 -1
- package/geometry/support/buffer/BufferPool.js +1 -1
- package/geometry/support/coordsUtils.js +1 -1
- package/geometry/support/curves/ellipticArc7Utils.js +1 -1
- package/geometry/support/curves/mathUtils.js +1 -1
- package/interfaces.d.ts +18 -9
- package/kernel.js +1 -1
- package/layers/AnnotationFeatureLayer.d.ts +2 -2
- package/layers/AnnotationFeatureLayer.js +1 -1
- package/layers/CatalogLayer.d.ts +2 -2
- package/layers/CatalogLayer.js +1 -1
- package/layers/DimensionFeatureLayer.d.ts +2 -2
- package/layers/DimensionFeatureLayer.js +1 -1
- package/layers/FeatureLayer.d.ts +2 -2
- package/layers/FeatureLayer.js +1 -1
- package/layers/SubtypeGroupLayer.d.ts +2 -2
- package/layers/SubtypeGroupLayer.js +1 -1
- package/layers/geospatialPDF/GeospatialPDFFrame.js +1 -1
- package/layers/geospatialPDF/GeospatialPDFLayerWorker.js +9 -9
- package/layers/geospatialPDF/GeospatialPDFWorkerClient.js +1 -1
- package/layers/geospatialPDF/LGIDictMapFrame.js +1 -1
- package/layers/geospatialPDF/ViewportMeasureFrame.js +1 -1
- package/layers/geospatialPDF/geospatialPDFParserUtils.js +1 -1
- package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
- package/layers/graphics/sources/GeoJSONSource.js +1 -1
- package/layers/graphics/sources/geojson/GeoJSONSourceWorker.js +1 -1
- package/layers/graphics/sources/parquet/FileProvider.js +1 -1
- package/layers/graphics/sources/support/MemorySourceWorker.js +1 -1
- package/layers/graphics/sources/support/clientSideDefaults.js +1 -1
- package/layers/graphics/sources/support/sourceUtils.js +1 -1
- package/layers/mixins/{FeatureLayerReload.d.ts → ReloadableLayer.d.ts} +5 -3
- package/layers/mixins/ReloadableLayer.js +2 -0
- package/layers/orientedImagery/core/coverageUtils.js +1 -1
- package/layers/raster/datasets/BaseRaster.js +1 -1
- package/layers/raster/datasets/GeospatialPDFRaster.js +1 -1
- package/layers/raster/datasets/ImageAuxRaster.js +1 -1
- package/layers/raster/datasets/ImageServerRaster.js +1 -1
- package/layers/raster/datasets/MRFRaster.js +1 -1
- package/layers/raster/datasets/TIFFRaster.js +1 -1
- package/layers/raster/datasets/WCSRaster.js +1 -1
- package/layers/raster/formats/ImageCanvasDecoder.js +1 -1
- package/layers/raster/formats/RasterCodec.js +1 -1
- package/layers/raster/formats/TiffDecoder.js +1 -1
- package/layers/raster/formats/Zlib.js +1 -1
- package/layers/support/RasterWorker.js +1 -1
- package/layers/support/fieldUtils.js +1 -1
- package/layers/support/vectorTileLayerLoader.js +1 -1
- package/package.json +2 -2
- package/popup/FeatureModel.js +1 -1
- package/popup/FeaturesModel.js +1 -1
- package/portal/schemas/definitions.js +1 -1
- package/request/process.js +1 -1
- package/request/types.d.ts +7 -0
- package/symbols/cim/cimAnalyzer.js +1 -1
- package/views/2d/engine/vectorTiles/TileHandler.js +1 -1
- package/views/2d/engine/vectorTiles/style/GeoJSONVectorTileSource.js +1 -1
- package/views/2d/engine/vectorTiles/style/GeoJSONVectorTileSourceWorker.js +1 -1
- package/views/2d/engine/vectorTiles/style/geoJSONVectorTileUtils.js +2 -0
- package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueBackground.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueFill.js +1 -1
- package/views/2d/layers/VectorTileLayerView2D.js +1 -1
- package/views/2d/layers/features/schema/processor/symbols/ComplexSymbolSchema.js +1 -1
- package/views/3d/analysis/DirectLineMeasurementAnalysisView3D.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightItemTool.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightObserverPlugin.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightPlacementController.js +1 -1
- package/views/3d/analysis/LineOfSight/{LineOfSightRootPlugin.js → LineOfSightPlacementRootPlugin.js} +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightTargetPlugin.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedPlacementPointPlugin.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
- package/views/3d/interactive/editingTools/ManipulatedObject3DGraphic.js +1 -1
- package/views/3d/support/MemoryController.js +1 -1
- package/views/3d/webgl-engine/effects/RenderPluginManager.js +1 -1
- package/views/3d/webgl-engine/effects/geometry/RenderOccluded.js +1 -1
- package/views/3d/webgl-engine/lib/PathBuilder.js +1 -1
- package/views/3d/webgl-engine/lib/PathCapBuilder.js +1 -1
- package/views/3d/webgl-engine/lib/PathEvaluator.js +1 -1
- package/views/3d/webgl-engine/lib/PathExtruder.js +1 -1
- package/views/3d/webgl-engine/lib/PathProfile.js +1 -1
- package/views/3d/webgl-engine/lib/pathGeometryUtils.js +1 -1
- package/views/draw/DrawTool.js +1 -1
- package/views/draw/support/PluginContext.js +1 -1
- package/views/draw/support/managers/TooltipManager.js +1 -1
- package/views/draw/support/types.d.ts +5 -2
- package/webdoc/applicationProperties/SearchLayerField.d.ts +7 -1
- package/webdoc/applicationProperties/SearchLayerField.js +1 -1
- package/webdoc/applicationProperties/SearchTableField.d.ts +7 -1
- package/webdoc/applicationProperties/SearchTableField.js +1 -1
- package/webdoc/applicationProperties/searchMode.js +2 -0
- package/widgets/BatchAttributeForm/inputs/support/DynamicChoiceController.js +1 -1
- package/widgets/BatchAttributeForm/inputs/support/inputUtils.js +1 -1
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/Editor/EditorViewModel.d.ts +10 -1
- package/widgets/Editor.d.ts +10 -1
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FeatureTable/support/FeatureStore.js +1 -1
- package/widgets/HistogramRangeSlider.d.ts +2 -2
- package/widgets/HistogramRangeSlider.js +1 -1
- package/widgets/Legend.d.ts +1 -0
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer.js +2 -2
- package/widgets/PanoramicViewer/PanoramicVideoViewerViewModel.js +1 -1
- package/widgets/ScaleRangeSlider/ScaleRangeSliderViewModel.d.ts +5 -2
- package/widgets/ScaleRangeSlider/ScaleRangeSliderViewModel.js +1 -1
- package/widgets/ScaleRangeSlider.js +1 -1
- package/widgets/Search/LayerSearchSource.d.ts +23 -1
- package/widgets/Search/LayerSearchSource.js +1 -1
- package/widgets/Search/support/layerSearchUtils.js +1 -1
- package/widgets/Search/types.d.ts +7 -0
- package/widgets/ValuePicker/ValuePickerBaseComponent.d.ts +5 -1
- package/widgets/ValuePicker/ValuePickerCollection.d.ts +2 -0
- package/widgets/ValuePicker/ValuePickerCombobox.d.ts +7 -1
- package/widgets/ValuePicker/ValuePickerLabel.d.ts +7 -1
- package/widgets/ValuePicker/ValuePickerSlider.d.ts +2 -0
- package/widgets/ValuePicker/ValuePickerSliderVisibleElements.d.ts +5 -1
- package/widgets/ValuePicker/ValuePickerVisibleElements.d.ts +5 -1
- package/widgets/ValuePicker/types.d.ts +2 -0
- package/widgets/support/forms/formUtils.js +1 -1
- package/widgets/support/forms/types.d.ts +1 -1
- package/assets/esri/core/workers/chunks/03261b9451e293a0fac8.js +0 -1
- package/assets/esri/core/workers/chunks/03afeefb9d16b6f1d844.js +0 -1
- package/assets/esri/core/workers/chunks/09b9a886363bc1197785.js +0 -1
- package/assets/esri/core/workers/chunks/0ad0484ffcbe4ad21bd3.js +0 -1
- package/assets/esri/core/workers/chunks/19743dedaa40446259ec.js +0 -1
- package/assets/esri/core/workers/chunks/1c65ab9ed611c322ce27.js +0 -1
- package/assets/esri/core/workers/chunks/1f339247b68b061ab0a4.js +0 -1
- package/assets/esri/core/workers/chunks/251921cd10ecfbc89451.js +0 -1
- package/assets/esri/core/workers/chunks/3252b1fae363bb0129a0.js +0 -1
- package/assets/esri/core/workers/chunks/408e81c8f1eff8a7b379.js +0 -1
- package/assets/esri/core/workers/chunks/4fc337240e7cddd0e988.js +0 -1
- package/assets/esri/core/workers/chunks/50036a323c2e7f155311.js +0 -1
- package/assets/esri/core/workers/chunks/55dcbf296d8d0092e473.js +0 -1
- package/assets/esri/core/workers/chunks/5732fdf6d8b87739aeea.js +0 -1
- package/assets/esri/core/workers/chunks/5924ec3167a2941ebb1f.js +0 -1
- package/assets/esri/core/workers/chunks/59b216b60464611742d4.js +0 -1
- package/assets/esri/core/workers/chunks/5bfea0c55aca826de536.js +0 -1
- package/assets/esri/core/workers/chunks/5fa1ec357c3ad1f91bc7.js +0 -1
- package/assets/esri/core/workers/chunks/60d3056a31d982c9cad0.js +0 -1
- package/assets/esri/core/workers/chunks/6558488ea96620439f34.js +0 -1
- package/assets/esri/core/workers/chunks/6aebf7cfd294e88bf926.js +0 -1
- package/assets/esri/core/workers/chunks/6b43bb78f9839ed43135.js +0 -1
- package/assets/esri/core/workers/chunks/6c83398cf586ecea0eb1.js +0 -1
- package/assets/esri/core/workers/chunks/7267b17de212207142c9.js +0 -1
- package/assets/esri/core/workers/chunks/7d1fd2df579a4b535e0e.js +0 -1
- package/assets/esri/core/workers/chunks/7e0cf70c0eb5a2ddfcec.js +0 -1
- package/assets/esri/core/workers/chunks/879b2de825c1dfc8849d.js +0 -1
- package/assets/esri/core/workers/chunks/912080c90b5cc2e817cf.js +0 -1
- package/assets/esri/core/workers/chunks/917f53833b853898facc.js +0 -1
- package/assets/esri/core/workers/chunks/937824bc7948f7bc7845.js +0 -1
- package/assets/esri/core/workers/chunks/a97d85774f9a417202df.js +0 -1
- package/assets/esri/core/workers/chunks/aff32980d91dab07dfb7.js +0 -1
- package/assets/esri/core/workers/chunks/b132ffa7e8bb461b6786.js +0 -1
- package/assets/esri/core/workers/chunks/b1b4066e8d1c0c9656e5.js +0 -1
- package/assets/esri/core/workers/chunks/b6ba66a05030d3815dfd.js +0 -1
- package/assets/esri/core/workers/chunks/bbec9d2e3b75a5c59681.js +0 -1
- package/assets/esri/core/workers/chunks/bf69024804ac51c8f733.js +0 -1
- package/assets/esri/core/workers/chunks/d938987344bce83cc660.js +0 -1
- package/assets/esri/core/workers/chunks/db1ab9b9c8bf5c7635d3.js +0 -1
- package/assets/esri/core/workers/chunks/e01aeac34474540f61ee.js +0 -1
- package/assets/esri/core/workers/chunks/e15ba90af0faf873b42d.js +0 -1
- package/assets/esri/core/workers/chunks/fd9663952d5a94f3a83f.js +0 -1
- package/layers/mixins/FeatureLayerReload.js +0 -2
- /package/views/3d/analysis/LineOfSight/{lineOfSightPlacementUtils.js → placementUtils.js} +0 -0
package/popup/FeatureModel.js
CHANGED
|
@@ -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{IdentifiableMixin as o}from"../core/Identifiable.js";import s from"../core/Logger.js";import{abortMaybe as c}from"../core/maybe.js";import{eachAlways as l,isAbortError as u,throwIfAborted as d}from"../core/promiseUtils.js";import{watch as f,initial as p,when as m}from"../core/reactiveUtils.js";import{throttle as h}from"../core/throttle.js";import{property as g,subclass as _}from"../core/accessorSupport/decorators.js";import v from"../geometry/Point.js";import y from"../geometry/SpatialReference.js";import{ActionsCollection as b,createDefaultAggregateActions as x,createDefaultActions as S}from"./actions.js";import C from"./content/TextContent.js";import{compileExpressionInfos as w,formatArcadeValue as T}from"./support/arcadeFeatureUtils.js";import E from"./support/FeatureAbilities.js";import{preLayerQueryCallback as D,preRequestCallback as O,getPopupLayer as k,createFieldInfoMap as A,getAllFieldInfos as j,querySourceLayer as M,queryUpdatedFeature as N,isRelatableFeatureSupportedLayer as P,isAssociatedFeatureSupportedLayer as F,formatEditInfo as I,substituteFieldsInLinksAndAttributes as L,graphicCallback as R,formatAttributes as z,isRelatedField as B}from"./support/featureUtils.js";import{queryLayerInfos as V,queryRelatedFeatures as H,setRelatedFeatures as U,getRelatedFieldInfo as W,createRelatedInfo as G,updateRelatedInfo as K}from"./support/relatedFeatureUtils.js";import{system as q}from"../time/constants.js";var J;let Y=class extends o(r){static{J=this}constructor(e){super(e),this._error=null,this._graphicChangedTask=null,this._evaluateExpressionAttributesTask=null,this._graphicExpressionAttributes=null,this.abilities=new E,this.content=null,this.description=null,this.actions=new b,this.includeDefaultActions=!1,this.defaultPopupTemplateEnabled=!1,this.expressionAttributes=null,this.formattedAttributes=null,this.graphic=null,this.lastEditInfo=null,this.location=null,this.relatedInfos=new Map,this.heading=``,this.view=null,this._graphicChangedThrottled=h(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=h(this._evaluateExpressionAttributes,()=>this.notifyChange(`waitingForContent`),1,this),this.addHandles([f(()=>[this._effectivePopupTemplate,this.abilities.attachmentsContent,this.abilities.chartAnimation,this.abilities.customContent,this.abilities.expressionContent,this.abilities.fieldsContent,this.abilities.mediaContent,this.abilities.relationshipContent,this.abilities.textContent,this.abilities.utilityNetworkAssociationsContent,this.graphic,this.timeZone],()=>this._graphicChangedThrottled(),p),m(()=>{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))])}initialize(){this.addHandles([this._graphicChangedThrottled,this._evaluateExpressionAttributesThrottled])}destroy(){this._clear(),this._graphicChangedTask=c(this._graphicChangedTask),this._evaluateExpressionAttributesTask=c(this._evaluateExpressionAttributesTask),this._error=null,this.graphic=null,this.relatedInfos.clear()}static{this.interceptor=new n(D,O)}get _effectivePopupTemplate(){return this.graphic?.getEffectivePopupTemplate(this.defaultPopupTemplateEnabled)??null}get _fieldInfoMap(){let e=k(this.graphic);return A(j(this._effectivePopupTemplate),e)}get defaultActions(){let e=this._get(`defaultActions`)||new b;return e.removeAll(),e.addMany(this.graphic?.isAggregate?x():S()),e}get allActions(){let e=this._get(`allActions`)||new b,{actions:t,defaultPopupTemplateEnabled:n,includeDefaultActions:r,graphic:a}=this,o=[];if(a){let e=r?this.defaultActions.concat(t):t,s=typeof a.getEffectivePopupTemplate==`function`&&a.getEffectivePopupTemplate(n)||a.popupTemplate,c=s?.actions;o=(s?.overwriteActions?c:c?.concat(e)??e)?.filter(i).toArray()??[]}let s=e.toArray();return(s.length!==o.length||s.some((e,t)=>e!==o[t]))&&(e.removeAll(),e.addMany(o)),e}get isFeatureFromTable(){return k(this.graphic)?.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??q}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}=this;return e.hasPendingUpdates()||t.hasPendingUpdates()||n!=null&&!n.finished||r!=null&&!r.finished}async updateGeometry(){let{graphic:e,spatialReference:t}=this,n=k(e);await n?.load();let r=n?.objectIdField;if(!r||!e)return;let i=e.attributes?.[r];if(i==null)return;let a=(await M({layer:n,graphic:e,outFields:[],objectIds:[i],returnGeometry:!0,spatialReference:t}))?.geometry;a&&(e.geometry=a)}_clear(){this._set(`heading`,``),this._set(`content`,null),this._set(`formattedAttributes`,null),this._set(`expressionAttributes`,null)}_graphicChanged(){this._evaluateExpressionAttributesTask=c(this._evaluateExpressionAttributesTask),this._graphicChangedTask=c(this._graphicChangedTask),this._graphicChangedTask=a(async e=>{this._error=null,this._clear();let{graphic:t}=this;try{if(!t)return null;let{_effectivePopupTemplate:n}=this,r=k(t),i=this.spatialReference;await N({graphic:t,popupTemplate:n,layer:r,spatialReference:i},{signal:e});let[{value:a},{value:o}]=await l([this._getContent(),this._getTitle()]),[,{value:s}]=await l([this._checkForRelatedFeatures({signal:e}),w(n?.expressionInfos,t)]);return{expressionInfos:s,content:a,heading:o}}catch(e){throw u(e)||(this._error=e,s.getLogger(this).error(`error`,`The popupTemplate could not be displayed for this feature.`,{error:e,graphic:t,popupTemplate:this._effectivePopupTemplate})),e}})}_compileContentElement(e){let t=k(this.graphic);return e.type===`relationship`?P(t)?e:void 0:e.type===`utility-network-associations`?F(t)?e:void 0:e}_compileContent(e){if(this.graphic)return Array.isArray(e)?e.filter(this._isAllowedContentType).map(e=>this._compileContentElement(e)).filter(i):typeof e==`string`?new C({text:e}).text:e}_compileLastEditInfo(){let{_effectivePopupTemplate:e,graphic:t,timeZone:n}=this,r=k(t);if(!e)return;let{lastEditInfoEnabled:i}=e,a=r?.editFieldsInfo;if(i&&a)return I(a,t?.attributes,n,r)}_compileHeading(e){let{_fieldInfoMap:t,graphic:n,expressionAttributes:r}=this,i=k(n),a=n?.attributes??{},o=this.formattedAttributes?.global??{};return L({attributes:a,fieldInfoMap:t,globalAttributes:o,expressionAttributes:r,layer:i,text:e})}async _getTitle(){let{_effectivePopupTemplate:e,graphic:t}=this;return t?R({type:`title`,value:e?.title,event:{graphic:t}}):null}async _getContent(){let{_effectivePopupTemplate:e,graphic:t}=this;return t?R({type:`content`,value:e?.content,event:{graphic:t}}):null}_evaluateExpressionAttributes({heading:e,content:t,expressionInfos:n}){this._evaluateExpressionAttributesTask=c(this._evaluateExpressionAttributesTask),this._evaluateExpressionAttributesTask=a(async r=>{let{graphic:i,map:a,view:o,spatialReference:c,location:l}=this;try{if(!i)return;let s;if(n!=null){let e=[];for(let[t,s]of n.expressions.entries())s==null?e.push(Promise.resolve([t,void 0])):e.push(s.evaluate({graphic:i,interceptor:J.interceptor,location:l,map:a,options:{signal:r},spatialReference:c,view:o}).then(e=>[t,typeof e==`string`?T(e):e]).catch(()=>[t,void 0]));s=Object.fromEntries(await Promise.all(e)),d(r)}this._set(`expressionAttributes`,s??null),this._graphicExpressionAttributes={...i.attributes,...s},this._set(`formattedAttributes`,this._createFormattedAttributes(t)),this._set(`heading`,this._compileHeading(e)),this._set(`lastEditInfo`,this._compileLastEditInfo()||null),this._set(`content`,this._compileContent(t)||null)}catch(e){u(e)||(this._error=e,s.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,_fieldInfoMap:o,_graphicExpressionAttributes:s,timeZone:c}=this,l=k(i);n.content[t]=z({attributes:{...s,...e.attributes},fieldInfoMap:o,fieldInfos:r?.fieldInfos,graphic:i,layer:l,relatedInfos:a,timeZone:c})}_createFieldsFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:n}){if(e.fieldInfos){let{graphic:r,relatedInfos:i,_fieldInfoMap:a,_graphicExpressionAttributes:o,timeZone:s}=this,c=k(r);n.content[t]=z({attributes:{...o,...e.attributes},fieldInfoMap:a,fieldInfos:e.fieldInfos,graphic:r,isContentFieldInfos:!0,layer:c,relatedInfos:i,timeZone:s})}}_createFormattedAttributes(e){let{_effectivePopupTemplate:t,graphic:n,relatedInfos:r,_fieldInfoMap:i,_graphicExpressionAttributes:a,timeZone:o}=this,s=k(n),c=t?.fieldInfos,l={global:z({attributes:a,fieldInfoMap:i,fieldInfos:c,graphic:n,layer:s,relatedInfos:r,timeZone:o}),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,j(n),e)}async _queryRelatedInfos(e,t,n){let{relatedInfos:r}=this,i=k(e);r.clear();let a=await i?.associatedLayer?.load(n)??i;if(!a||!e||!t.filter(e=>!!e.fieldName&&B(e.fieldName))?.length)return;t.forEach(e=>this._configureRelatedInfo(e,a));let o=await V({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 H({graphic:e,relatedInfos:r,layer:a},n);Object.keys(s).forEach(e=>{U(s[e]?.value,r.get(e.toString()))})}_configureRelatedInfo(e,t){let{relatedInfos:n}=this,r=W(e.fieldName||``);if(!r)return;let{layerId:i,fieldName:a}=r;if(!i)return;let o=n.get(i.toString())||G(i,t);o&&(K({relatedInfo:o,fieldName:a,fieldInfo:e}),this.relatedInfos.set(i,o))}};e([g()],Y.prototype,`_error`,void 0),e([g()],Y.prototype,`_graphicChangedTask`,void 0),e([g()],Y.prototype,`_evaluateExpressionAttributesTask`,void 0),e([g({readOnly:!0})],Y.prototype,`_effectivePopupTemplate`,null),e([g({readOnly:!0})],Y.prototype,`_fieldInfoMap`,null),e([g({type:E})],Y.prototype,`abilities`,void 0),e([g({readOnly:!0})],Y.prototype,`content`,void 0),e([g()],Y.prototype,`description`,void 0),e([g({type:b,readOnly:!0})],Y.prototype,`defaultActions`,null),e([g({type:b})],Y.prototype,`actions`,void 0),e([g()],Y.prototype,`includeDefaultActions`,void 0),e([g({type:b,readOnly:!0})],Y.prototype,`allActions`,null),e([g({type:Boolean})],Y.prototype,`defaultPopupTemplateEnabled`,void 0),e([g({readOnly:!0})],Y.prototype,`expressionAttributes`,void 0),e([g({readOnly:!0})],Y.prototype,`isFeatureFromTable`,null),e([g({readOnly:!0})],Y.prototype,`state`,null),e([g({readOnly:!0})],Y.prototype,`formattedAttributes`,void 0),e([g({type:t})],Y.prototype,`graphic`,void 0),e([g({readOnly:!0})],Y.prototype,`lastEditInfo`,void 0),e([g({type:v})],Y.prototype,`location`,void 0),e([g({readOnly:!0})],Y.prototype,`relatedInfos`,void 0),e([g({type:y})],Y.prototype,`spatialReference`,null),e([g()],Y.prototype,`timeZone`,null),e([g({readOnly:!0})],Y.prototype,`heading`,void 0),e([g()],Y.prototype,`map`,null),e([g({readOnly:!0})],Y.prototype,`waitingForContent`,null),e([g()],Y.prototype,`view`,void 0),Y=J=e([_(`esri.popup.FeatureModel`)],Y);const X=Y;export{X 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{IdentifiableMixin as o}from"../core/Identifiable.js";import s from"../core/Logger.js";import{abortMaybe as c}from"../core/maybe.js";import{eachAlways as l,isAbortError as u,throwIfAborted as d}from"../core/promiseUtils.js";import{watch as f,initial as p,when as m}from"../core/reactiveUtils.js";import{throttle as h}from"../core/throttle.js";import{property as g,subclass as _}from"../core/accessorSupport/decorators.js";import v from"../geometry/Point.js";import y from"../geometry/SpatialReference.js";import{ActionsCollection as b,createDefaultAggregateActions as x,createDefaultActions as S}from"./actions.js";import C from"./content/TextContent.js";import{compileExpressionInfos as w,formatArcadeValue as T}from"./support/arcadeFeatureUtils.js";import E from"./support/FeatureAbilities.js";import{preLayerQueryCallback as D,preRequestCallback as O,getPopupLayer as k,createFieldInfoMap as A,getAllFieldInfos as j,querySourceLayer as M,queryUpdatedFeature as N,isRelatableFeatureSupportedLayer as P,isAssociatedFeatureSupportedLayer as F,formatEditInfo as I,substituteFieldsInLinksAndAttributes as L,graphicCallback as R,formatAttributes as z,isRelatedField as B}from"./support/featureUtils.js";import{queryLayerInfos as V,queryRelatedFeatures as H,setRelatedFeatures as U,getRelatedFieldInfo as W,createRelatedInfo as G,updateRelatedInfo as K}from"./support/relatedFeatureUtils.js";import{system as q}from"../time/constants.js";var J;let Y=class extends o(r){static{J=this}constructor(e){super(e),this._error=null,this._graphicChangedTask=null,this._evaluateExpressionAttributesTask=null,this._graphicExpressionAttributes=null,this.abilities=new E,this.content=null,this.description=null,this.actions=new b,this.includeDefaultActions=!1,this.defaultPopupTemplateEnabled=!1,this.expressionAttributes=null,this.formattedAttributes=null,this.graphic=null,this.lastEditInfo=null,this.location=null,this.relatedInfos=new Map,this.heading=``,this.view=null,this._graphicChangedThrottled=h(this._graphicChanged,()=>{this._evaluateExpressionAttributesThrottled.remove(),this._evaluateExpressionAttributesTask=c(this._evaluateExpressionAttributesTask),this._graphicChangedTask=c(this._graphicChangedTask),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=h(this._evaluateExpressionAttributes,()=>this.notifyChange(`waitingForContent`),1,this),this.addHandles([f(()=>[this._effectivePopupTemplate,this.abilities.attachmentsContent,this.abilities.chartAnimation,this.abilities.customContent,this.abilities.expressionContent,this.abilities.fieldsContent,this.abilities.mediaContent,this.abilities.relationshipContent,this.abilities.textContent,this.abilities.utilityNetworkAssociationsContent,this.graphic,this.timeZone],()=>this._graphicChangedThrottled(),p),m(()=>{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))])}initialize(){this.addHandles([this._graphicChangedThrottled,this._evaluateExpressionAttributesThrottled])}destroy(){this._clear(),this._graphicChangedTask=c(this._graphicChangedTask),this._evaluateExpressionAttributesTask=c(this._evaluateExpressionAttributesTask),this._error=null,this.graphic=null,this.relatedInfos.clear()}static{this.interceptor=new n(D,O)}get _effectivePopupTemplate(){return this.graphic?.getEffectivePopupTemplate(this.defaultPopupTemplateEnabled)??null}get _fieldInfoMap(){let e=k(this.graphic);return A(j(this._effectivePopupTemplate),e)}get defaultActions(){let e=this._get(`defaultActions`)||new b;return e.removeAll(),e.addMany(this.graphic?.isAggregate?x():S()),e}get allActions(){let e=this._get(`allActions`)||new b,{actions:t,defaultPopupTemplateEnabled:n,includeDefaultActions:r,graphic:a}=this,o=[];if(a){let e=r?this.defaultActions.concat(t):t,s=typeof a.getEffectivePopupTemplate==`function`&&a.getEffectivePopupTemplate(n)||a.popupTemplate,c=s?.actions;o=(s?.overwriteActions?c:c?.concat(e)??e)?.filter(i).toArray()??[]}let s=e.toArray();return(s.length!==o.length||s.some((e,t)=>e!==o[t]))&&(e.removeAll(),e.addMany(o)),e}get isFeatureFromTable(){return k(this.graphic)?.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??q}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}=this;return e.hasPendingUpdates()||t.hasPendingUpdates()||n!=null&&!n.finished||r!=null&&!r.finished}async updateGeometry(){let{graphic:e,spatialReference:t}=this,n=k(e);await n?.load();let r=n?.objectIdField;if(!r||!e)return;let i=e.attributes?.[r];if(i==null)return;let a=(await M({layer:n,graphic:e,outFields:[],objectIds:[i],returnGeometry:!0,spatialReference:t}))?.geometry;a&&(e.geometry=a)}_clear(){this._set(`heading`,``),this._set(`content`,null),this._set(`formattedAttributes`,null),this._set(`expressionAttributes`,null)}_graphicChanged(){this._graphicChangedTask=a(async e=>{this._error=null;let{graphic:t}=this;try{if(!t)return this._clear(),null;let{_effectivePopupTemplate:n}=this,r=k(t),i=this.spatialReference;await N({graphic:t,popupTemplate:n,layer:r,spatialReference:i},{signal:e});let[{value:a},{value:o}]=await l([this._getContent(),this._getTitle()]),[,{value:s}]=await l([this._checkForRelatedFeatures({signal:e}),w(n?.expressionInfos,t)]);return{expressionInfos:s,content:a,heading:o}}catch(n){throw!u(n)&&!e.aborted&&(this._clear(),this._error=n,s.getLogger(this).error(`error`,`The popupTemplate could not be displayed for this feature.`,{error:n,graphic:t,popupTemplate:this._effectivePopupTemplate})),n}})}_compileContentElement(e){let t=k(this.graphic);return e.type===`relationship`?P(t)?e:void 0:e.type===`utility-network-associations`?F(t)?e:void 0:e}_compileContent(e){if(this.graphic)return Array.isArray(e)?e.filter(this._isAllowedContentType).map(e=>this._compileContentElement(e)).filter(i):typeof e==`string`?new C({text:e}).text:e}_compileLastEditInfo(){let{_effectivePopupTemplate:e,graphic:t,timeZone:n}=this,r=k(t);if(!e)return;let{lastEditInfoEnabled:i}=e,a=r?.editFieldsInfo;if(i&&a)return I(a,t?.attributes,n,r)}_compileHeading(e){let{_fieldInfoMap:t,graphic:n,expressionAttributes:r}=this,i=k(n),a=n?.attributes??{},o=this.formattedAttributes?.global??{};return L({attributes:a,fieldInfoMap:t,globalAttributes:o,expressionAttributes:r,layer:i,text:e})}async _getTitle(){let{_effectivePopupTemplate:e,graphic:t}=this;return t?R({type:`title`,value:e?.title,event:{graphic:t}}):null}async _getContent(){let{_effectivePopupTemplate:e,graphic:t}=this;return t?R({type:`content`,value:e?.content,event:{graphic:t}}):null}_evaluateExpressionAttributes({heading:e,content:t,expressionInfos:n}){this._evaluateExpressionAttributesTask=c(this._evaluateExpressionAttributesTask),this._evaluateExpressionAttributesTask=a(async r=>{let{graphic:i,map:a,view:o,spatialReference:c,location:l}=this;try{if(!i)return;let s;if(n!=null){let e=[];for(let[t,s]of n.expressions.entries())s==null?e.push(Promise.resolve([t,void 0])):e.push(s.evaluate({graphic:i,interceptor:J.interceptor,location:l,map:a,options:{signal:r},spatialReference:c,view:o}).then(e=>[t,typeof e==`string`?T(e):e]).catch(()=>[t,void 0]));s=Object.fromEntries(await Promise.all(e)),d(r)}this._set(`expressionAttributes`,s??null),this._graphicExpressionAttributes={...i.attributes,...s},this._set(`formattedAttributes`,this._createFormattedAttributes(t)),this._set(`heading`,this._compileHeading(e)),this._set(`lastEditInfo`,this._compileLastEditInfo()||null),this._set(`content`,this._compileContent(t)||null)}catch(e){!u(e)&&!r.aborted&&(this._clear(),this._error=e,s.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,_fieldInfoMap:o,_graphicExpressionAttributes:s,timeZone:c}=this,l=k(i);n.content[t]=z({attributes:{...s,...e.attributes},fieldInfoMap:o,fieldInfos:r?.fieldInfos,graphic:i,layer:l,relatedInfos:a,timeZone:c})}_createFieldsFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:n}){if(e.fieldInfos){let{graphic:r,relatedInfos:i,_fieldInfoMap:a,_graphicExpressionAttributes:o,timeZone:s}=this,c=k(r);n.content[t]=z({attributes:{...o,...e.attributes},fieldInfoMap:a,fieldInfos:e.fieldInfos,graphic:r,isContentFieldInfos:!0,layer:c,relatedInfos:i,timeZone:s})}}_createFormattedAttributes(e){let{_effectivePopupTemplate:t,graphic:n,relatedInfos:r,_fieldInfoMap:i,_graphicExpressionAttributes:a,timeZone:o}=this,s=k(n),c=t?.fieldInfos,l={global:z({attributes:a,fieldInfoMap:i,fieldInfos:c,graphic:n,layer:s,relatedInfos:r,timeZone:o}),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,j(n),e)}async _queryRelatedInfos(e,t,n){let{relatedInfos:r}=this,i=k(e);r.clear();let a=await i?.associatedLayer?.load(n)??i;if(!a||!e||!t.filter(e=>!!e.fieldName&&B(e.fieldName))?.length)return;t.forEach(e=>this._configureRelatedInfo(e,a));let o=await V({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 H({graphic:e,relatedInfos:r,layer:a},n);Object.keys(s).forEach(e=>{U(s[e]?.value,r.get(e.toString()))})}_configureRelatedInfo(e,t){let{relatedInfos:n}=this,r=W(e.fieldName||``);if(!r)return;let{layerId:i,fieldName:a}=r;if(!i)return;let o=n.get(i.toString())||G(i,t);o&&(K({relatedInfo:o,fieldName:a,fieldInfo:e}),this.relatedInfos.set(i,o))}};e([g()],Y.prototype,`_error`,void 0),e([g()],Y.prototype,`_graphicChangedTask`,void 0),e([g()],Y.prototype,`_evaluateExpressionAttributesTask`,void 0),e([g({readOnly:!0})],Y.prototype,`_effectivePopupTemplate`,null),e([g({readOnly:!0})],Y.prototype,`_fieldInfoMap`,null),e([g({type:E})],Y.prototype,`abilities`,void 0),e([g({readOnly:!0})],Y.prototype,`content`,void 0),e([g()],Y.prototype,`description`,void 0),e([g({type:b,readOnly:!0})],Y.prototype,`defaultActions`,null),e([g({type:b})],Y.prototype,`actions`,void 0),e([g()],Y.prototype,`includeDefaultActions`,void 0),e([g({type:b,readOnly:!0})],Y.prototype,`allActions`,null),e([g({type:Boolean})],Y.prototype,`defaultPopupTemplateEnabled`,void 0),e([g({readOnly:!0})],Y.prototype,`expressionAttributes`,void 0),e([g({readOnly:!0})],Y.prototype,`isFeatureFromTable`,null),e([g({readOnly:!0})],Y.prototype,`state`,null),e([g({readOnly:!0})],Y.prototype,`formattedAttributes`,void 0),e([g({type:t})],Y.prototype,`graphic`,void 0),e([g({readOnly:!0})],Y.prototype,`lastEditInfo`,void 0),e([g({type:v})],Y.prototype,`location`,void 0),e([g({readOnly:!0})],Y.prototype,`relatedInfos`,void 0),e([g({type:y})],Y.prototype,`spatialReference`,null),e([g()],Y.prototype,`timeZone`,null),e([g({readOnly:!0})],Y.prototype,`heading`,void 0),e([g()],Y.prototype,`map`,null),e([g({readOnly:!0})],Y.prototype,`waitingForContent`,null),e([g()],Y.prototype,`view`,void 0),Y=J=e([_(`esri.popup.FeatureModel`)],Y);const X=Y;export{X as default};
|
package/popup/FeaturesModel.js
CHANGED
|
@@ -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"../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{throttle as u}from"../core/throttle.js";import{property as d,subclass as f}from"../core/accessorSupport/decorators.js";import p from"../geometry/Point.js";import{project as m}from"../geometry/projectionUtils.js";import h from"../geometry/SpatialReference.js";import{geographicToWebMercator as g}from"../geometry/support/webMercatorUtils.js";import{getGraphicLayer as _}from"../graphic/graphicOriginUtils.js";import{fallbackObjectIDAttribute as v}from"../layers/LayerConstants.js";import{ActionsCollection as y,createDefaultActions as b}from"./actions.js";import{getSelectedTarget as x}from"./actionUtils.js";import S from"./FeatureModel.js";import C from"./support/FeatureAbilities.js";import{getDisplayedSymbol as w}from"../symbols/support/symbolUtils.js";import{system as T}from"../time/constants.js";import{highlightsSupported as E}from"../views/support/layerViewUtils.js";import{GoTo as D}from"../widgets/support/GoTo.js";const O=Symbol(`feature-stream-flush`);let k=null;function A(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 j=class extends D(n){constructor(e){super(e),this._centerAtLocationController=null,this._locationUpdateController=null,this._highlightPromises={"highlight-active-feature":null,"highlight-selected-feature":null},this._defaultFeatureAbilities=new C,this._activeFeatureStream=null,this._featureStreamHasYielded=!1,this.actions=new y,this.activeFeature=null,this.aggregatedFeaturesEnabled=!1,this.defaultPopupTemplateEnabled=!1,this.diagnostics=null,this.featuresPerPage=20,this.featureMenuOpen=!1,this.featureItemAbilities=null,this.featureModels=[],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.featurePage,this.selectedFeatureIndex,this.featuresPerPage,this.featureMenuOpen,this.open,this.initialDisplayMode,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.defaultPopupTemplateEnabled,this.includeDefaultActions,this.features,this.map,this.spatialReference,this.timeZone],()=>this._updateFeatureModels(),{initial:!0}),l(()=>!this.open,()=>this.aggregatedFeaturesEnabled=!1)])}destroy(){this._cancelLocationUpdate(),this._cancelCenterAtLocation(),this._cancelFeatureStream(),this._destroyFeatureModels(),this.aggregatedFeaturesEnabled=!1,this.view=null,this.map=null,this.spatialReference=null,this.timeZone=null}get defaultActions(){let e=this._get(`defaultActions`)||new y;return e.removeAll(),e.addMany(this.selectedFeatureItem?.defaultActions.toArray()??b()),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}get featurePage(){return this._get(`featurePage`)}set featurePage(e){if(e==null){this.featureCount||this._set(`featurePage`,null);return}!Number.isInteger(e)||e<1||e>Math.ceil(this.featureCount/this.featuresPerPage)||e!==1&&e!==(this.featurePage??0)+1||this._set(`featurePage`,e)}set features(e){if(this._get(`features`)===e)return;let t=e||[];this._set(`features`,t),(!this._activeFeatureStream||!t.length||this.featurePage==null)&&(this.featurePage=t.length?1:null),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?.focusRegionVisible?`list`:`feature`)}set initialDisplayMode(e){this._initialDisplayMode=e,this._syncSelectedFeatureIndex(this.features)}set location(e){let t=e?.spatialReference?.isWGS84&&this.spatialReference?.isWebMercator?g(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.featureModels[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??T}set timeZone(e){this._overrideIfSome(`timeZone`,e)}get waitingForContents(){return this.featureModels.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=x(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()}async _selectedFeatureChange(e){let{location:t,updateLocationEnabled:n,view:r}=this;if(this.aggregatedFeaturesEnabled=!1,!e||!r)return;let i=_(e)?.type;if((i===`map-image`||i===`imagery`||i===`imagery-tile`)&&(e.symbol=await w(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)}_destroyFeatureModels(){this.featureModels.forEach(e=>e&&!e.destroyed&&e.destroy()),this._set(`featureModels`,[])}_reconcileFeatureModels(e){let t=[],n=new Map,r=[];if(this.featureModels.forEach((i,a)=>{let o=i?.graphic;!o||i.destroyed?i.destroy():e[a]===o?t[a]=i:(r.push(i),n.has(o)||n.set(o,[]))}),r.length){for(let r=e.length-1;r>=0;r--)t[r]||n.get(e[r])?.push(r);r.forEach(e=>{let r=n.get(e.graphic)?.pop();r==null?e.destroy():t[r]=e})}return t}_updateFeatureModels(){let{selectedFeature:e,features:t}=this;if(!t.length){this._destroyFeatureModels();return}let n={abilities:this.featureItemAbilities??this._defaultFeatureAbilities,actions:this.actions,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,includeDefaultActions:this.includeDefaultActions,spatialReference:this.spatialReference,location:this.location,map:this.map,view:this.view,timeZone:this.timeZone},r=this._reconcileFeatureModels(t);r.forEach(e=>e.set(n));let i=e=>{let i=t[e];i&&!r[e]&&(r[e]=new S({...n,graphic:i}))};if(e&&i(this.selectedFeatureIndex),(this.featurePage??0)>1||this.open&&(this.featureMenuOpen||this.initialDisplayMode===`list`)){let e=Math.min((this.featurePage??0)*this.featuresPerPage,t.length);for(let t=0;t<e;t++)i(t)}this._set(`featureModels`,r)}_cancelCenterAtLocation(){this._centerAtLocationController=i(this._centerAtLocationController)}_cancelFeatureStream(){this.removeHandles(O);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=m(r,t),k??=await Promise.all([import(`../geometry/operators/intersectsOperator.js`),import(`../geometry/operators/proximityOperator.js`)]);let[{intersectsExecute:s},{proximityGetNearestCoordinate:c}]=k;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=_(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(A(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||v: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||!E(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){if(e!==this._activeFeatureStream)return;let n=[],r=u(()=>{let t=n;n=[],e===this._activeFeatureStream&&t.length&&this._addFeatures(t)},16);this.addHandles({remove:()=>{r.remove(),n=[]}},O);try{for await(let i of e){if(e!==this._activeFeatureStream)return;let a=!this._featureStreamHasYielded;a&&(this.features=[]),t!==void 0&&(this.location=t,t=void 0),this._set(`pendingLocation`,null),a?(this._addFeatures([i]),e===this._activeFeatureStream&&(this._featureStreamHasYielded=!0)):(n.push(i),r())}}finally{this._activeFeatureStream===e&&r.forceUpdate(),this._activeFeatureStream===e&&(this.removeHandles(O),this._featureStreamHasYielded||(this.features=[]),this._activeFeatureStream=null,this._set(`pendingLocation`,null),this._waitingForResultChange())}}_addFeatures(e){let{features:t}=this,n=new Set(t),r=e.filter(e=>!n.has(e)&&(n.add(e),!0));r.length&&(this.features=t.concat(r))}};e([d()],j.prototype,`_initialDisplayMode`,void 0),e([d()],j.prototype,`_activeFeatureStream`,void 0),e([d()],j.prototype,`_featureStreamHasYielded`,void 0),e([d({type:y})],j.prototype,`actions`,void 0),e([d({type:y,readOnly:!0})],j.prototype,`defaultActions`,null),e([d({readOnly:!0})],j.prototype,`active`,null),e([d()],j.prototype,`activeFeature`,void 0),e([d()],j.prototype,`aggregatedFeaturesEnabled`,void 0),e([d({value:null})],j.prototype,`content`,null),e([d({type:Boolean})],j.prototype,`defaultPopupTemplateEnabled`,void 0),e([d({readOnly:!0})],j.prototype,`diagnostics`,void 0),e([d({readOnly:!0})],j.prototype,`effectiveHeading`,null),e([d({readOnly:!0})],j.prototype,`featureCount`,null),e([d({value:null})],j.prototype,`featurePage`,null),e([d({value:[]})],j.prototype,`features`,null),e([d()],j.prototype,`featureStream`,null),e([d()],j.prototype,`featuresPerPage`,void 0),e([d()],j.prototype,`featureMenuOpen`,void 0),e([d({type:C})],j.prototype,`featureItemAbilities`,void 0),e([d({readOnly:!0})],j.prototype,`featureModels`,void 0),e([d()],j.prototype,`heading`,void 0),e([d()],j.prototype,`highlightEnabled`,void 0),e([d()],j.prototype,`includeDefaultActions`,void 0),e([d()],j.prototype,`initialDisplayMode`,null),e([d({type:p})],j.prototype,`location`,null),e([d()],j.prototype,`map`,null),e([d()],j.prototype,`open`,void 0),e([d({readOnly:!0})],j.prototype,`pendingLocation`,null),e([d({readOnly:!0})],j.prototype,`streamingFeatures`,null),e([d({value:null,readOnly:!0})],j.prototype,`selectedFeature`,null),e([d({value:-1})],j.prototype,`selectedFeatureIndex`,null),e([d({readOnly:!0})],j.prototype,`selectedFeatureItem`,null),e([d({type:h})],j.prototype,`spatialReference`,null),e([d({readOnly:!0})],j.prototype,`state`,null),e([d()],j.prototype,`timeZone`,null),e([d()],j.prototype,`updateLocationEnabled`,void 0),e([d()],j.prototype,`view`,void 0),e([d({readOnly:!0})],j.prototype,`waitingForContents`,null),e([d({readOnly:!0})],j.prototype,`waitingForResult`,null),e([d()],j.prototype,`zoomFactor`,void 0),j=e([f(`esri.popup.FeaturesModel`)],j);const M=j;export{M as default};
|
|
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{throttle as u}from"../core/throttle.js";import{property as d,subclass as f}from"../core/accessorSupport/decorators.js";import p from"../geometry/Point.js";import{project as m}from"../geometry/projectionUtils.js";import h from"../geometry/SpatialReference.js";import{geographicToWebMercator as g}from"../geometry/support/webMercatorUtils.js";import{getGraphicLayer as _}from"../graphic/graphicOriginUtils.js";import{fallbackObjectIDAttribute as v}from"../layers/LayerConstants.js";import{ActionsCollection as y,createDefaultActions as b}from"./actions.js";import{getSelectedTarget as x}from"./actionUtils.js";import S from"./FeatureModel.js";import C from"./support/FeatureAbilities.js";import{getDisplayedSymbol as w}from"../symbols/support/symbolUtils.js";import{system as T}from"../time/constants.js";import{highlightsSupported as E}from"../views/support/layerViewUtils.js";import{GoTo as D}from"../widgets/support/GoTo.js";const O=Symbol(`feature-stream-flush`);let k=null;function A(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 j=class extends D(n){constructor(e){super(e),this._centerAtLocationController=null,this._locationUpdateController=null,this._highlightPromises={"highlight-active-feature":null,"highlight-selected-feature":null},this._defaultFeatureAbilities=new C,this._activeFeatureStream=null,this._featureStreamHasYielded=!1,this.actions=new y,this.activeFeature=null,this.aggregatedFeaturesEnabled=!1,this.defaultPopupTemplateEnabled=!1,this.diagnostics=null,this.featuresPerPage=20,this.featureMenuOpen=!1,this.featureItemAbilities=null,this.featureModels=[],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.featurePage,this.selectedFeatureIndex,this.featuresPerPage,this.featureMenuOpen,this.open,this.initialDisplayMode,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.defaultPopupTemplateEnabled,this.includeDefaultActions,this.features,this.map,this.spatialReference,this.timeZone],(e,t)=>this._updateFeatureModels(t?.[1]??-1),{initial:!0}),l(()=>!this.open,()=>this.aggregatedFeaturesEnabled=!1)])}destroy(){this._cancelLocationUpdate(),this._cancelCenterAtLocation(),this._cancelFeatureStream(),this._destroyFeatureModels(),this.aggregatedFeaturesEnabled=!1,this.view=null,this.map=null,this.spatialReference=null,this.timeZone=null}get defaultActions(){let e=this._get(`defaultActions`)||new y;return e.removeAll(),e.addMany(this.selectedFeatureItem?.defaultActions.toArray()??b()),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}get featurePage(){return this._get(`featurePage`)}set featurePage(e){if(e==null){this.featureCount||this._set(`featurePage`,null);return}!Number.isInteger(e)||e<1||e>Math.ceil(this.featureCount/this.featuresPerPage)||e!==1&&e!==(this.featurePage??0)+1||this._set(`featurePage`,e)}set features(e){if(this._get(`features`)===e)return;let t=e||[];this._set(`features`,t),(!this._activeFeatureStream||!t.length||this.featurePage==null)&&(this.featurePage=t.length?1:null),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?.focusRegionVisible?`list`:`feature`)}set initialDisplayMode(e){this._initialDisplayMode=e,this._syncSelectedFeatureIndex(this.features)}set location(e){let t=e?.spatialReference?.isWGS84&&this.spatialReference?.isWebMercator?g(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.featureModels[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??T}set timeZone(e){this._overrideIfSome(`timeZone`,e)}get waitingForContents(){return this.featureModels.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=x(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()}async _selectedFeatureChange(e){let{location:t,updateLocationEnabled:n,view:r}=this;if(this.aggregatedFeaturesEnabled=!1,!e||!r)return;let i=_(e)?.type;if((i===`map-image`||i===`imagery`||i===`imagery-tile`)&&(e.symbol=await w(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)}_destroyFeatureModels(){this.featureModels.forEach(e=>e&&!e.destroyed&&e.destroy()),this._set(`featureModels`,[])}_reconcileFeatureModels(e,t){let n=[],r=new Map;if(this.featureModels.forEach((t,i)=>{let a=t?.graphic;if(!a||t.destroyed)t.destroy();else if(e[i]===a)n[i]=t;else{let e=r.get(a);e?e.push(t):r.set(a,[t])}}),!r.size)return n;for(let e of r.values())e.reverse();for(let t=0;t<e.length&&r.size;t++){if(n[t])continue;let i=e[t],a=r.get(i);a&&(n[t]=a.pop(),a.length||r.delete(i))}let i=this.selectedFeatureIndex,a=e[i],o=this.featureModels[t],s=null;for(let e of r.values())for(let t of e)t===o?s=t:t.destroy();return s&&(a&&!n[i]?(s.graphic=a,n[i]=s):s.destroy()),n}_updateFeatureModels(e){let{selectedFeature:t,features:n}=this;if(!n.length){this._destroyFeatureModels();return}let r={abilities:this.featureItemAbilities??this._defaultFeatureAbilities,actions:this.actions,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,includeDefaultActions:this.includeDefaultActions,spatialReference:this.spatialReference,location:this.location,map:this.map,view:this.view,timeZone:this.timeZone},i=this._reconcileFeatureModels(n,e);i.forEach(e=>e.set(r));let a=e=>{let t=n[e];t&&!i[e]&&(i[e]=new S({...r,graphic:t}))};if(t&&a(this.selectedFeatureIndex),(this.featurePage??0)>1||this.open&&(this.featureMenuOpen||this.initialDisplayMode===`list`)){let e=Math.min((this.featurePage??0)*this.featuresPerPage,n.length);for(let t=0;t<e;t++)a(t)}this._set(`featureModels`,i)}_cancelCenterAtLocation(){this._centerAtLocationController=i(this._centerAtLocationController)}_cancelFeatureStream(){this.removeHandles(O);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=m(r,t),k??=await Promise.all([import(`../geometry/operators/intersectsOperator.js`),import(`../geometry/operators/proximityOperator.js`)]);let[{intersectsExecute:s},{proximityGetNearestCoordinate:c}]=k;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=_(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(A(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||v: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||!E(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){if(e!==this._activeFeatureStream)return;let n=[],r=u(()=>{let t=n;n=[],e===this._activeFeatureStream&&t.length&&this._addFeatures(t)},16);this.addHandles({remove:()=>{r.remove(),n=[]}},O);try{for await(let i of e){if(e!==this._activeFeatureStream)return;let a=!this._featureStreamHasYielded;a&&(this.features=[]),t!==void 0&&(this.location=t,t=void 0),this._set(`pendingLocation`,null),a?(this._addFeatures([i]),e===this._activeFeatureStream&&(this._featureStreamHasYielded=!0)):(n.push(i),r())}}finally{this._activeFeatureStream===e&&r.forceUpdate(),this._activeFeatureStream===e&&(this.removeHandles(O),this._featureStreamHasYielded||(this.features=[]),this._activeFeatureStream=null,this._set(`pendingLocation`,null),this._waitingForResultChange())}}_addFeatures(e){let{features:t}=this,n=new Set(t),r=e.filter(e=>!n.has(e)&&(n.add(e),!0));r.length&&(this.features=t.concat(r))}};e([d()],j.prototype,`_initialDisplayMode`,void 0),e([d()],j.prototype,`_activeFeatureStream`,void 0),e([d()],j.prototype,`_featureStreamHasYielded`,void 0),e([d({type:y})],j.prototype,`actions`,void 0),e([d({type:y,readOnly:!0})],j.prototype,`defaultActions`,null),e([d({readOnly:!0})],j.prototype,`active`,null),e([d()],j.prototype,`activeFeature`,void 0),e([d()],j.prototype,`aggregatedFeaturesEnabled`,void 0),e([d({value:null})],j.prototype,`content`,null),e([d({type:Boolean})],j.prototype,`defaultPopupTemplateEnabled`,void 0),e([d({readOnly:!0})],j.prototype,`diagnostics`,void 0),e([d({readOnly:!0})],j.prototype,`effectiveHeading`,null),e([d({readOnly:!0})],j.prototype,`featureCount`,null),e([d({value:null})],j.prototype,`featurePage`,null),e([d({value:[]})],j.prototype,`features`,null),e([d()],j.prototype,`featureStream`,null),e([d()],j.prototype,`featuresPerPage`,void 0),e([d()],j.prototype,`featureMenuOpen`,void 0),e([d({type:C})],j.prototype,`featureItemAbilities`,void 0),e([d({readOnly:!0})],j.prototype,`featureModels`,void 0),e([d()],j.prototype,`heading`,void 0),e([d()],j.prototype,`highlightEnabled`,void 0),e([d()],j.prototype,`includeDefaultActions`,void 0),e([d()],j.prototype,`initialDisplayMode`,null),e([d({type:p})],j.prototype,`location`,null),e([d()],j.prototype,`map`,null),e([d()],j.prototype,`open`,void 0),e([d({readOnly:!0})],j.prototype,`pendingLocation`,null),e([d({readOnly:!0})],j.prototype,`streamingFeatures`,null),e([d({value:null,readOnly:!0})],j.prototype,`selectedFeature`,null),e([d({value:-1})],j.prototype,`selectedFeatureIndex`,null),e([d({readOnly:!0})],j.prototype,`selectedFeatureItem`,null),e([d({type:h})],j.prototype,`spatialReference`,null),e([d({readOnly:!0})],j.prototype,`state`,null),e([d()],j.prototype,`timeZone`,null),e([d()],j.prototype,`updateLocationEnabled`,void 0),e([d()],j.prototype,`view`,void 0),e([d({readOnly:!0})],j.prototype,`waitingForContents`,null),e([d({readOnly:!0})],j.prototype,`waitingForResult`,null),e([d()],j.prototype,`zoomFactor`,void 0),j=e([f(`esri.popup.FeaturesModel`)],j);const M=j;export{M as default};
|