@arcgis/core 6.0.0-next.22 → 6.0.0-next.24
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/Graphic.d.ts +47 -14
- package/PopupTemplate.js +1 -1
- package/WebScene.d.ts +3 -0
- package/analysis/LineOfSightAnalysis.d.ts +1 -1
- package/analysis/LineOfSightAnalysisObserver.d.ts +5 -4
- package/analysis/LineOfSightAnalysisTarget.d.ts +4 -4
- package/analysis/Viewshed.d.ts +4 -4
- package/arcade/functions/string.js +1 -1
- package/arcgisGlobal.d.ts +0 -5
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{3c277a0f099d67090d07.js → 02335385b1476fe322eb.js} +1 -1
- package/assets/esri/core/workers/chunks/{db9921fbda556f142c4a.js → 04d55ed51e8b2683c4b4.js} +1 -1
- package/assets/esri/core/workers/chunks/{435b90168f79c5587a07.js → 04ecf15524ff3838c01c.js} +1 -1
- package/assets/esri/core/workers/chunks/{e2f42aec02bff33b25dd.js → 09300e74e5b014ce6269.js} +1 -1
- package/assets/esri/core/workers/chunks/{fcb86d24fc7e0666b564.js → 096b2bf1c0d69d27f20c.js} +1 -1
- package/assets/esri/core/workers/chunks/{612345f17f5eeb99ea8f.js → 0d9c4c6c571ce26d356b.js} +1 -1
- package/assets/esri/core/workers/chunks/{0f725cf79ce00e790a7d.js → 1168bc5c9f0a7e1f63a2.js} +1 -1
- package/assets/esri/core/workers/chunks/{4911ce62421a6c3320b0.js → 13c64087be3b2985a21b.js} +1 -1
- package/assets/esri/core/workers/chunks/{8e19629899a5becf8e19.js → 150e7a7bd5df25693da7.js} +1 -1
- package/assets/esri/core/workers/chunks/{12a7997a40c77f5c9160.js → 151e5799ede763a03ee2.js} +1 -1
- package/assets/esri/core/workers/chunks/{a64446a3328a7323e307.js → 173f89c55a5c79ff065b.js} +1 -1
- package/assets/esri/core/workers/chunks/{8715661a838361d4211a.js → 1b24a40c0fa197014873.js} +1 -1
- package/assets/esri/core/workers/chunks/{ca0d4ce453d8eb35467d.js → 277263466837e1673f56.js} +1 -1
- package/assets/esri/core/workers/chunks/{b1d989b72203113a06fe.js → 2a36fe3f3f257a779a1b.js} +1 -1
- package/assets/esri/core/workers/chunks/2c0cb214fedb29487eef.js +1 -0
- package/assets/esri/core/workers/chunks/{ffcb99693182a621a93e.js → 2cf8172be83b10b11bdc.js} +1 -1
- package/assets/esri/core/workers/chunks/{fcaf9450642fcef83286.js → 3048e74e6246324ce6fc.js} +1 -1
- package/assets/esri/core/workers/chunks/{95b82cbbe355266c65d7.js → 30af63b3b750142faadb.js} +1 -1
- package/assets/esri/core/workers/chunks/30dcf2cfb31cb70de7df.js +1 -0
- package/assets/esri/core/workers/chunks/{9f0a973a0dd28953ce25.js → 371e2ddb88cc6b9a41e8.js} +1 -1
- package/assets/esri/core/workers/chunks/3fd5c3cd8457ddc68798.js +1 -0
- package/assets/esri/core/workers/chunks/{62fec1816907f070f079.js → 3fe04f13215474accb09.js} +1 -1
- package/assets/esri/core/workers/chunks/{f47fe4433b05fca5c3ad.js → 42f6194633c2d879c8da.js} +1 -1
- package/assets/esri/core/workers/chunks/{cddc3e285f763ccf33c2.js → 4869e097261ded90b8bb.js} +1 -1
- package/assets/esri/core/workers/chunks/{d8a7eba588d374b2f961.js → 4bb9a5f4ca944d3fc206.js} +1 -1
- package/assets/esri/core/workers/chunks/{2e096537a3a5555a4a93.js → 4cb751dc8d00bdaeb04c.js} +1 -1
- package/assets/esri/core/workers/chunks/{8052da8be251c3ff2176.js → 4d93bed14945e3d34d5c.js} +1 -1
- package/assets/esri/core/workers/chunks/{65cb5e39c467a35621ca.js → 56e903ccef66cbe18f92.js} +1 -1
- package/assets/esri/core/workers/chunks/{44d5508042cacdfcac47.js → 58da3f8cf0f7f6a7e4fa.js} +1 -1
- package/assets/esri/core/workers/chunks/{bc915fb182d463d804e6.js → 5c04835b0b52461183cd.js} +1 -1
- package/assets/esri/core/workers/chunks/{7e8611cb709f105946f5.js → 6061232c96e11eb7b25d.js} +1 -1
- package/assets/esri/core/workers/chunks/{1e514e1c9aabefa04201.js → 64382363d6dc04ff1eac.js} +1 -1
- package/assets/esri/core/workers/chunks/{c82daefb193aae895bc0.js → 67e06d606c7fd2064adf.js} +1 -1
- package/assets/esri/core/workers/chunks/{434a8ba841a59e0deab9.js → 67e533748435253aaba6.js} +1 -1
- package/assets/esri/core/workers/chunks/{feb41abc03d677df6f73.js → 6b9961261241fdce0e94.js} +1 -1
- package/assets/esri/core/workers/chunks/{949bee7b304e625a7891.js → 6db0f8fe1402643fbe1a.js} +1 -1
- package/assets/esri/core/workers/chunks/{baed828b7846c0863289.js → 6f1d6453184e0a1530ad.js} +22 -18
- package/assets/esri/core/workers/chunks/6f897b4e7ddd1dd1672b.js +1 -0
- package/assets/esri/core/workers/chunks/{0049b66ccbfb168caa76.js → 7124ad8dc5ad40dc66f3.js} +1 -1
- package/assets/esri/core/workers/chunks/{6e107ce73633de8ac257.js → 72f4dad65e16a7d7c58f.js} +1 -1
- package/assets/esri/core/workers/chunks/{0df9a906f7823c23d426.js → 7566321c6a2913f2852b.js} +1 -1
- package/assets/esri/core/workers/chunks/{c4ddac23bd649d24f3f2.js → 75d551a449bba61ce238.js} +1 -1
- package/assets/esri/core/workers/chunks/{af349c7bc8ef41a0e1bd.js → 7748c2886d0122b40eeb.js} +1 -1
- package/assets/esri/core/workers/chunks/{b4c3ec081874b49ff89b.js → 78fbe330f16bdbdb886e.js} +1 -1
- package/assets/esri/core/workers/chunks/79483c05867ba1386f5a.js +1 -0
- package/assets/esri/core/workers/chunks/7b482afb9fd1229f5707.js +1 -0
- package/assets/esri/core/workers/chunks/7c631e2947243e2c9bde.js +1 -0
- package/assets/esri/core/workers/chunks/{814751e705c05099f864.js → 7c75a8ee266c36baa902.js} +1 -1
- package/assets/esri/core/workers/chunks/7db9e615e60d824eac1b.js +1 -0
- package/assets/esri/core/workers/chunks/{8a7b02037151767542f1.js → 7dbf4c7480bf9c72820d.js} +1 -1
- package/assets/esri/core/workers/chunks/{1b1d3f6916d2cb751435.js → 87177e0f82e8a6ae3189.js} +1 -1
- package/assets/esri/core/workers/chunks/{5cb26bbaa08114aec5ce.js → 89cc1a5539b82fb46216.js} +1 -1
- package/assets/esri/core/workers/chunks/8b5dcc4282772bf6b675.js +1 -0
- package/assets/esri/core/workers/chunks/{8c12269d26f5a4c753cb.js → 8ebaf5754e86a45b0497.js} +1 -1
- package/assets/esri/core/workers/chunks/{542e5640ea1b80ef801a.js → 9189dfe19a2a2ccd5173.js} +1 -1
- package/assets/esri/core/workers/chunks/{67a35155b8b4d36f171e.js → 926e0a3827eaf16ca8b4.js} +1 -1
- package/assets/esri/core/workers/chunks/{dc1761cba0454fda3cf9.js → 9630234267098115de4d.js} +1 -1
- package/assets/esri/core/workers/chunks/{10d80e793019dfb45ca2.js → 987424121cf30b0f3c50.js} +1 -1
- package/assets/esri/core/workers/chunks/9afc87474cef1fc4fe4a.js +1 -0
- package/assets/esri/core/workers/chunks/{facd1ff23203fed67686.js → 9b048f80c2d28d527373.js} +1 -1
- package/assets/esri/core/workers/chunks/9dd48e75b4e8d9811d81.js +1 -0
- package/assets/esri/core/workers/chunks/{ee08ae5b73439a1ff666.js → a163c6005aba3378edaa.js} +1 -1
- package/assets/esri/core/workers/chunks/a4b822ee45810c4c292a.js +1 -0
- package/assets/esri/core/workers/chunks/{092e311cb7aea92a6a26.js → acb265a22be5e12f38e5.js} +1 -1
- package/assets/esri/core/workers/chunks/{1a411ddae7a47015370c.js → acf4737ba509cbd73cce.js} +1 -1
- package/assets/esri/core/workers/chunks/ad96132bc89671e595f3.js +1 -0
- package/assets/esri/core/workers/chunks/{d247dd53788d512b9c9f.js → af3c6794334626b94f00.js} +1 -1
- package/assets/esri/core/workers/chunks/{532e9cda8ac3601d8892.js → b12acf1f694f82e00df9.js} +1 -1
- package/assets/esri/core/workers/chunks/{d08ff41e2a9bcd58b64a.js → ba3d5abff65aefcb8dee.js} +1 -1
- package/assets/esri/core/workers/chunks/{504184828048310a052c.js → bdc221d94300c225665a.js} +1 -1
- package/assets/esri/core/workers/chunks/c0eb27263f608dc3684b.js +1 -0
- package/assets/esri/core/workers/chunks/c2318c014e97ba519be8.js +1 -0
- package/assets/esri/core/workers/chunks/{7f8e327acad48c9e75ea.js → c62237c344e341619341.js} +1 -1
- package/assets/esri/core/workers/chunks/{a2ad3e620c98e2b2eb06.js → cd355baab983033c3ef0.js} +1 -1
- package/assets/esri/core/workers/chunks/{7be6d621a0d1e33dfff4.js → d070fcb73ce274ab80e4.js} +1 -1
- package/assets/esri/core/workers/chunks/{6d41444b46677aa762a7.js → db41490bd39d863305bf.js} +1 -1
- package/assets/esri/core/workers/chunks/{fc5a36e54929e03efa86.js → dba5f44c4e4a3f075df2.js} +1 -1
- package/assets/esri/core/workers/chunks/{3e30b96a8c75bd5b9ae2.js → ddc95cdac6c06fc4794c.js} +1 -1
- package/assets/esri/core/workers/chunks/{a5c8f9f5be4ef5063b42.js → df26ec0b508cf4716e0a.js} +1 -1
- package/assets/esri/core/workers/chunks/{f426da2210888cc264b4.js → e83f9abee611c5b80009.js} +1 -1
- package/assets/esri/core/workers/chunks/{8487727f1197cf7dbf50.js → ef12fa3574d4cbf8b084.js} +1 -1
- package/assets/esri/core/workers/chunks/f10c883eb26330e3421c.js +1 -0
- package/assets/esri/core/workers/chunks/f46e92c67986c8c09bdd.js +1 -0
- package/assets/esri/core/workers/chunks/{709e019885822b1f6f3e.js → f905f1a1aa4c123cbe83.js} +1 -1
- package/assets/esri/core/workers/chunks/{5b91e2dffdc84c006539.js → fb37f0848196c28b7fd7.js} +1 -1
- package/assets/esri/libs/librust-parquet/pkg/parquet_bg.wasm +0 -0
- package/assets/esri/libs/librust-text/pkg/text_bg.wasm +0 -0
- package/assets/esri/themes/base/_core.scss +0 -2
- 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/chunks/Component.glsl.js +9 -12
- package/chunks/DefaultMaterial.glsl.js +4 -5
- package/chunks/MultiPathImpl.js +1 -1
- package/chunks/OperatorProximityGeodesic.js +1 -1
- package/chunks/Path.glsl.js +2 -4
- package/chunks/RealisticTree.glsl.js +3 -3
- package/chunks/SSAO.glsl.js +1 -2
- package/chunks/basis_encoder.js +1 -1
- package/chunks/basis_transcoder.js +1 -1
- package/chunks/draco_mesh_decoder.js +1 -1
- package/chunks/dxt_encoder.js +1 -1
- package/chunks/i3s.js +1 -1
- package/chunks/lclayout.js +1 -1
- package/chunks/lerc-wasm.js +1 -1
- package/chunks/libtess-f32.js +1 -1
- package/chunks/libtess-f64.js +1 -1
- package/chunks/lyr3DMain.js +1 -1
- package/chunks/lyr3DWorker.js +1 -1
- package/chunks/parquet.js +1 -1
- package/chunks/qb3-wasm.js +1 -1
- package/chunks/rbush.js +1 -1
- package/chunks/text.js +1 -1
- package/chunks/vxlLayer.js +1 -1
- package/config.js +1 -1
- package/core/workers/WorkerFallback.js +4 -2
- package/core/workers/workerFactory.js +1 -1
- package/core/workers/workers.js +4 -2
- package/geometry/support/clipRay.js +1 -1
- package/geometry/support/labelPoint.js +1 -1
- package/geometry/support/plane.js +1 -1
- package/graphic/AnnotationFeatureGraphicOrigin.d.ts +49 -9
- package/graphic/BuildingGraphicOrigin.d.ts +49 -0
- package/graphic/CSVGraphicOrigin.d.ts +42 -9
- package/graphic/CatalogGraphicOrigin.d.ts +42 -9
- package/graphic/DimensionFeatureGraphicOrigin.d.ts +42 -9
- package/graphic/FeatureGraphicOrigin.d.ts +42 -9
- package/graphic/GeoJSONGraphicOrigin.d.ts +42 -9
- package/graphic/GeoRSSGraphicOrigin.d.ts +42 -9
- package/graphic/GraphicOrigin.d.ts +52 -12
- package/graphic/ImageryGraphicOrigin.d.ts +42 -9
- package/graphic/ImageryTileGraphicOrigin.d.ts +42 -9
- package/graphic/KMLGraphicOrigin.d.ts +47 -10
- package/graphic/KnowledgeGraphGraphicOrigin.d.ts +49 -1
- package/graphic/LinkChartGraphicOrigin.d.ts +49 -1
- package/graphic/MapImageGraphicOrigin.d.ts +49 -1
- package/graphic/MapNotesGraphicOrigin.d.ts +48 -1
- package/graphic/OGCFeatureGraphicOrigin.d.ts +42 -9
- package/graphic/OrientedImageryGraphicOrigin.d.ts +42 -9
- package/graphic/ParquetGraphicOrigin.d.ts +42 -9
- package/graphic/PointCloudGraphicOrigin.d.ts +43 -0
- package/graphic/SceneGraphicOrigin.d.ts +43 -0
- package/graphic/SketchGraphicOrigin.d.ts +43 -0
- package/graphic/StreamGraphicOrigin.d.ts +43 -0
- package/graphic/SubtypeGroupGraphicOrigin.d.ts +49 -1
- package/graphic/TileGraphicOrigin.d.ts +49 -1
- package/graphic/VectorTileGraphicOrigin.d.ts +43 -14
- package/graphic/VoxelGraphicOrigin.d.ts +43 -0
- package/graphic/WCSGraphicOrigin.d.ts +43 -0
- package/graphic/WFSGraphicOrigin.d.ts +42 -9
- package/graphic/getGraphicOriginTitle.d.ts +21 -3
- package/interfaces.d.ts +0 -55
- package/kernel.js +1 -1
- package/layers/ElevationLayer.d.ts +6 -2
- package/layers/GaussianSplatLayer.d.ts +2 -1
- package/layers/GeoJSONLayer.d.ts +2 -107
- package/layers/IntegratedMeshLayer.js +1 -1
- package/layers/ParquetLayer.d.ts +24 -1
- package/layers/ParquetLayer.js +1 -1
- package/layers/SceneLayer.d.ts +40 -16
- package/layers/ViewshedLayer.d.ts +10 -4
- package/layers/WMSLayer.d.ts +2 -69
- package/layers/mixins/ReloadableLayer.js +1 -1
- package/layers/mixins/TemporalLayer.d.ts +70 -48
- package/layers/mixins/TiledImagery.d.ts +0 -11
- package/layers/orientedImagery/transformations/utils.js +1 -1
- package/layers/save/featureLayerUtils.js +1 -1
- package/layers/save/imageryUtils.js +1 -1
- package/layers/save/mapImageLayerUtils.js +1 -1
- package/layers/save/mediaLayerUtils.js +1 -1
- package/layers/save/parquetLayerUtils.js +2 -0
- package/layers/save/streamLayerUtils.js +1 -1
- package/layers/support/LabelClass.d.ts +8 -2
- package/layers/support/layersMapping.js +1 -1
- package/layers/support/rasterJobHelper.js +1 -1
- package/layers/video/VideoController.js +5 -5
- package/package.json +2 -2
- package/popup/content.d.ts +38 -1
- package/popup/content.js +1 -1
- package/portal/schemas/definitions.js +1 -1
- package/portal/schemas/webScene.js +1 -1
- package/rest/query/operations/pbfDehydratedFeatureSet.js +1 -1
- package/rest/query/operations/pbfFlatFeatureSet.js +1 -1
- package/rest/query/operations/pbfJSONFeatureSet.js +1 -1
- package/smartMapping/popup/support/clusterUtils.js +1 -1
- package/smartMapping/popup/support/utils.js +2 -2
- package/smartMapping/renderers/size.js +1 -1
- package/smartMapping/renderers/support/regenerateUtils.js +1 -1
- package/support/timeUtils.d.ts +11 -0
- package/undoredo/support/ApplySet.js +1 -1
- package/views/2d/engine/flow/ProcessingTimeEstimate.js +1 -1
- package/views/2d/engine/vectorTiles/VectorTileContainer.js +1 -1
- package/views/2d/engine/vectorTiles/buckets/SymbolBucket.js +1 -1
- package/views/2d/engine/webgl/GlyphWorker.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerMeshWriter.js +1 -1
- package/views/2d/layers/features/Processor.js +1 -1
- package/views/2d/layers/features/aggregation/GeohashSpatialIndex.js +1 -1
- package/views/2d/layers/features/aggregation/GridSpatialIndex.js +1 -1
- package/views/2d/layers/features/layerAdapters/CatalogFootprintLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/FeatureLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/InMemoryLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/KnowledgeGraphSublayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/OGCFeatureLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/OrientedImageryLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/ParquetLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/StreamLayerAdapter.js +1 -1
- package/views/2d/layers/features/processor/AggregateStrategy.js +1 -1
- package/views/2d/layers/features/processor/FeatureUpdateStrategy.js +1 -1
- package/views/2d/layers/features/processor/bins/BinAdapter.js +1 -1
- package/views/2d/layers/features/processor/bins/BinLevelState.js +1 -1
- package/views/2d/layers/features/processor/clusters/ClusterAdapter.js +1 -1
- package/views/2d/layers/features/processor/clusters/ClusterLevelState.js +1 -1
- package/views/2d/layers/features/processor/tracks/TrackAdapter.js +1 -1
- package/views/2d/layers/features/processor/tracks/TrackLevelState.js +1 -1
- package/views/2d/layers/features/schema/processor/SimpleProcessorSchema.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/ASourceChunk.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/ByReferenceTileSourceChunk.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/FeatureSnapshotSourceChunk.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/Overrides.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/ParquetSnapshotSourceChunk.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/StreamSourceChunk.js +1 -1
- package/views/2d/layers/features/support/AttributeStore.js +1 -1
- package/views/2d/layers/features/support/FeatureFilterEvaluator.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
- package/views/2d/layers/features/support/GraphicsReader.js +1 -1
- package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
- package/views/3d/environment/SunLighting.d.ts +0 -1
- package/views/3d/environment/SunLighting.js +1 -1
- package/views/3d/environment/VirtualLighting.d.ts +0 -1
- package/views/3d/environment/VirtualLighting.js +1 -1
- package/views/3d/input/handlers/ground/GroundDoubleClickMove.js +1 -1
- package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
- package/views/3d/interactive/placementTools/GroundNavigationPlacementTool3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
- package/views/3d/layers/graphics/Deconflictor.js +1 -1
- package/views/3d/layers/graphics/ElevationAligners.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/LabelParameters.js +1 -1
- package/views/3d/layers/graphics/Labeler.js +1 -1
- package/views/3d/layers/graphics/elevationAlignmentUtils.js +1 -1
- package/views/3d/layers/graphics/pointUtils.js +1 -1
- package/views/3d/layers/i3s/I3SIndex.js +1 -1
- package/views/3d/layers/i3s/I3SOverrides.js +1 -1
- package/views/3d/layers/support/Tiles3DBVH.js +1 -1
- package/views/3d/layers/support/featureTileQuery3D.js +1 -1
- package/views/3d/state/controllers/ZoomControllerLocal.js +1 -1
- package/views/3d/state/controllers/ZoomStepControllerLocal.js +1 -1
- package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
- package/views/3d/state/utils/groundNavigationUtils.js +1 -1
- package/views/3d/state/utils/navigationUtils.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/Component.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/hud/HUD.glsl.js +1 -2
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ScreenSpaceRayMarching.glsl.js +1 -2
- package/views/3d/webgl-engine/effects/glow/applyEmissiveGlow.glsl.js +9 -4
- package/views/3d/webgl-engine/effects/magnifier/Magnifier.js +1 -1
- package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowCastRenderer.js +1 -1
- package/views/3d/webgl-engine/effects/snowcover/applySnow.glsl.js +18 -0
- package/views/3d/webgl-engine/lib/Intersector.js +1 -1
- package/views/3d/webgl-engine/lib/RenderingContext.js +1 -1
- package/views/3d/webgl-engine/lib/TextureRepository.js +1 -1
- package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
- package/views/3d/webgl-engine/lib/screenPolygonTriangleIntersections.js +1 -1
- package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/Path.glsl.js +1 -1
- package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/TriangleMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/internal/worldSizedRibbonLineIntersectionUtils.js +2 -0
- package/views/3d/webgl-engine/shaders/DefaultMaterial.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/RealisticTree.glsl.js +1 -1
- package/views/DOMContainer.js +1 -1
- package/views/draw/SegmentDrawAction.js +1 -1
- package/views/interactive/snapping/SnappingManagerPool.js +1 -1
- package/views/interactive/tooltip/content/TooltipContent.js +1 -1
- package/views/interactive/tooltip/fields/TooltipField.js +1 -1
- package/views/layers/LineOfSightLayerView.d.ts +2 -2
- package/views/layers/ViewshedLayerView.d.ts +2 -1
- package/views/support/LayerViewManager.js +1 -1
- package/views/support/ScheduledQueueProcessor.js +1 -1
- package/views/support/screenshotUtils.js +1 -1
- package/views/ui/UI.js +1 -1
- package/webdoc/support/webdocSaveUtils.js +1 -1
- package/webscene/Slide.d.ts +1 -2
- package/widgets/Editor/UpdateRecordWorkflow.js +1 -1
- package/widgets/Feature/FeatureExpression/FeatureExpressionViewModel.js +1 -1
- package/widgets/Feature/FeatureRelationship/FeatureRelationshipViewModel.js +1 -1
- package/widgets/FeatureForm/UtilityNetworkAssociationAddAssociationViewModel.js +1 -1
- package/widgets/FeatureTable/RelationshipColumn.js +1 -1
- package/widgets/FloorFilter/FloorFilterViewModel.js +1 -1
- package/widgets/Locate.d.ts +1 -1
- package/widgets/OrientedImageryViewer/ImageMeasurementWorker.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/imageMeasurementUtils.js +1 -1
- package/widgets/OrientedImageryViewer/services/ImageMeasurementService.js +1 -1
- package/widgets/Search/SearchViewModel.js +1 -1
- package/widgets/Search/support/layerSearchUtils.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/Sketch/support/PluginManager.js +1 -1
- package/widgets/UtilityNetworkTrace/UtilityNetworkTraceFeature.js +1 -1
- package/widgets/support/GeolocationPositioning.d.ts +1 -2
- package/assets/esri/core/workers/chunks/14d5d219e7fe017f23f0.js +0 -1
- package/assets/esri/core/workers/chunks/42045cf46497828cd3c0.js +0 -1
- package/assets/esri/core/workers/chunks/42753cf4965a94bc91ca.js +0 -1
- package/assets/esri/core/workers/chunks/42e985a576d7aaeed0cf.js +0 -1
- package/assets/esri/core/workers/chunks/5046214dd32029cb733d.js +0 -1
- package/assets/esri/core/workers/chunks/576248e9ae2654569420.js +0 -1
- package/assets/esri/core/workers/chunks/58865772bed48141a56a.js +0 -1
- package/assets/esri/core/workers/chunks/6059853ef3b6cddbe869.js +0 -1
- package/assets/esri/core/workers/chunks/72e6d594b7262430ae55.js +0 -1
- package/assets/esri/core/workers/chunks/7d11710e1586a3d75887.js +0 -1
- package/assets/esri/core/workers/chunks/8f74d92ac69714b9fd4e.js +0 -1
- package/assets/esri/core/workers/chunks/a09d2e1e2540921e4717.js +0 -1
- package/assets/esri/core/workers/chunks/a35c69a4751d28c39907.js +0 -1
- package/assets/esri/core/workers/chunks/a679207c3458cc0b1fec.js +0 -1
- package/assets/esri/core/workers/chunks/dfa5f1311806473e473f.js +0 -1
- package/assets/esri/core/workers/chunks/fc76aff0f7d95e517d8f.js +0 -1
- package/assets/esri/themes/base/widgets/_DirectionalPad.scss +0 -85
- package/assets/esri/widgets/DirectionalPad/t9n/messages.ar.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.bg.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.bs.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.ca.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.cs.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.da.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.de.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.el.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.en.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.es.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.et.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.fi.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.fr.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.he.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.hr.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.hu.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.id.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.it.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.ja.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.ko.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.lt.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.lv.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.nl.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.no.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.pl.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.pt-BR.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.pt-PT.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.ro.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.ru.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.sk.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.sl.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.sr.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.sv.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.th.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.tr.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.uk.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.vi.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.zh-CN.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.zh-HK.json +0 -1
- package/assets/esri/widgets/DirectionalPad/t9n/messages.zh-TW.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.ar.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.bg.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.bs.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.ca.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.cs.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.da.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.de.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.el.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.en.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.es.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.et.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.fi.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.fr.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.he.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.hr.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.hu.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.id.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.it.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.ja.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.ko.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.lt.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.lv.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.nl.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.no.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.pl.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.pt-BR.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.pt-PT.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.ro.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.ru.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.sk.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.sl.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.sr.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.sv.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.th.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.tr.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.uk.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.vi.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.zh-CN.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.zh-HK.json +0 -1
- package/assets/esri/widgets/Track/t9n/messages.zh-TW.json +0 -1
- package/views/2d/layers/features/FeatureSpatialIndex.js +0 -2
- package/views/2d/layers/features/support/FeatureSetReaderIndirect.js +0 -2
- package/views/3d/webgl-engine/effects/snowcover/SnowCover.glsl.js +0 -12
- package/widgets/DirectionalPad/DirectionalPadViewModel.d.ts +0 -85
- package/widgets/DirectionalPad/DirectionalPadViewModel.js +0 -2
- package/widgets/DirectionalPad/VisibleElements.d.ts +0 -40
- package/widgets/DirectionalPad/VisibleElements.js +0 -2
- package/widgets/DirectionalPad/constants.js +0 -2
- package/widgets/DirectionalPad/css.js +0 -2
- package/widgets/DirectionalPad/types.d.ts +0 -27
- package/widgets/DirectionalPad/utils.js +0 -2
- package/widgets/DirectionalPad.d.ts +0 -156
- package/widgets/DirectionalPad.js +0 -2
- package/widgets/Track/TrackViewModel.d.ts +0 -131
- package/widgets/Track/TrackViewModel.js +0 -2
- package/widgets/Track/types.d.ts +0 -6
- package/widgets/Track.d.ts +0 -278
- package/widgets/Track.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../core/Accessor.js";import n from"../../core/Error.js";import r from"../../core/Logger.js";import{someMap as i}from"../../core/MapUtils.js";import{createAbortError as a,isAbortError as o}from"../../core/promiseUtils.js";import s from"../../core/ReactiveMap.js";import{on as c,watch as l,syncAndInitial as u}from"../../core/reactiveUtils.js";import{schedule as d}from"../../core/scheduling.js";import{property as f,subclass as p}from"../../core/accessorSupport/decorators.js";import{get as m}from"../../core/accessorSupport/get.js";import{UpdatingHandles as h}from"../../core/support/UpdatingHandles.js";import{destroyMap as g}from"../../support/collectionUtils.js";import{LayerLayerViewInfo as _}from"./LayerLayerViewInfo.js";function v(e){return typeof e==`object`&&!!e&&`layerViews`in e}let y=class extends t{constructor(e){super(e),this._layerLayerViewInfoMap=new s,this._recyclingInfoMap=new s,this._watchUpdatingTracking=new h,this._preloadLayerViewModules=()=>{let e=this.view.map?.allLayers;if(e)for(let t of e)this.layerViewFilter?.(t)!==!1&&this.layerViewImporter.hasLayerViewModule(t)&&this.layerViewImporter.importLayerView(t)},this._reschedule=()=>this.destroyed?Promise.reject():(this._workPromise??(this._workPromise=Promise.withResolvers(),this._workPromise.promise.catch(()=>{})),this.removeHandles(`reschedule`),this.addHandles(d(this._doWork),`reschedule`),this._workPromise.promise),this._doWork=()=>{if(this.destroyed)return;let{map:e}=this.view;if(!e){this.clear();return}if(this._map!==e&&(this.clear(),this._map=e),this._workPromise==null)return;this.removeHandles(`reschedule`),this.removeHandles(`collection-change`);let t=new Set,n=[],r=this.view.ready,i=e=>{if(e!=null){for(let a of e)if(a){if(this.layerViewFilter?.(a)===!1)continue;t.add(a);let e=this._layerLayerViewInfoMap.get(a);e&&r?e.start():!e&&!this._recyclingInfoMap.has(a)&&n.push(a),`layers`in a&&a.layers&&i(a.layers)}}};for(let e of this._rootCollectionNames)i(m(this,e));let a=[],s=e=>{let t=e.tryRecycle(n);if(t){let n=e.layer;this._recyclingInfoMap.set(n,e),this._watchUpdatingTracking.consumePromise(t),t.then(()=>{this._recyclingInfoMap.get(n)===e&&e.promise===t&&(this._recyclingInfoMap.delete(n),this._layerLayerViewInfoMap.set(n,e),this._reschedule())}).catch(r=>{this._recyclingInfoMap.get(n)!==e||e.promise!==t||o(r)||(this._recyclingInfoMap.delete(n),e.destroy(),this._reschedule())})}else a.push(e)};for(let e of this._layerLayerViewInfoMap.values())t.has(e.layer)||(this._layerLayerViewInfoMap.delete(e.layer),s(e));for(let e of this._recyclingInfoMap.values())t.has(e.layer)||(this._recyclingInfoMap.delete(e.layer),s(e));for(let e of n)this._createLayerView(e);this._refreshCollections(),a.forEach(e=>e.destroy());let c=[e?.ground?.layers,e?.basemap?.baseLayers,e?.basemap?.groundLayers,e?.basemap?.referenceLayers,e?.layers].filter(e=>!!e);t.forEach(e=>`layers`in e&&c.push(e.layers)),this.addHandles(c.map(e=>this._watchUpdatingTracking.addOnCollectionChange(()=>e,this._reschedule)),`collection-change`),this._workPromise.resolve(),this._workPromise=null},this._layersToLayerViews=new Map(e.layerviewMapping)}initialize(){this.addHandles([c(()=>this.view?.map?.allLayers,`change`,this._preloadLayerViewModules,{onListenerAdd:this._preloadLayerViewModules}),l(()=>{let e=this.view,t=e?.map;return[t?.basemap,t?.ground,t?.layers,e?.ready]},()=>this._reschedule().catch(()=>{}),u)]),this._preloadLayerViewModules(),this._reschedule().catch(()=>{})}clearHandles(){this._watchUpdatingTracking.removeAll()}destroy(){this.clear(),g(this._recyclingInfoMap),g(this._layerLayerViewInfoMap),this._watchUpdatingTracking.destroy(),this._map=null,this._workPromise!=null&&(this._workPromise.reject(a()),this._workPromise=null)}get _rootCollectionNames(){return Array.from(this._layersToLayerViews.keys())}get updating(){return this._workPromise!=null||this._watchUpdatingTracking.updating||i(this._layerLayerViewInfoMap,e=>!e.done)||this._recyclingInfoMap.size>0}get updatingRemaining(){let e=0;for(let t of this._layerLayerViewInfoMap.values())t.done||++e;return e}clear(){this.destroyed||(this._clearCollections(),g(this._layerLayerViewInfoMap),g(this._recyclingInfoMap))}async whenLayerView(e){await this._reschedule();let t=this._layerLayerViewInfoMap.get(e)?.promise;if(!t){let t=this._recyclingInfoMap.get(e)?.promise;if(!t)throw new n(`view:no-layerview-for-layer`,`No layerview has been found for the layer`,{layer:e});return t}return t}isCreatingLayerViewsForLayer(e,t){let n=this._layerLayerViewInfoMap.get(e);if(!n?.done)return!0;let r=n.layerView;return r&&t&&r.parent!==t?!0:n.done&&r&&`layers`in e&&e.layers?.length?e.layers.some(e=>this.isCreatingLayerViewsForLayer(e,r)):!1}get allLayerViews(){let e=[];for(let t of this._layerLayerViewInfoMap.values())t.layerView&&e.push(t.layerView);for(let t of this._recyclingInfoMap.values())t.layerView&&e.push(t.layerView);return e}_refreshCollections(){for(let[e,t]of this._layersToLayerViews)this._populateLayerViewsOwners(m(this,e),m(this,t),this.view)}_clearCollections(){for(let e of this._layersToLayerViews.values())m(this,e)?.removeAll()}_populateLayerViewsOwners(e,t,n){if(!e||!t){t?.removeAll();return}let r=0;for(let i of e){let e=this._layerLayerViewInfoMap.get(i);if(!e?.layerView)continue;let{layerView:a}=e;a.layer=i,a.parent=n,t.at(r)!==a&&t.splice(r,0,a),`layers`in i&&v(a)&&this._populateLayerViewsOwners(i.layers,a.layerViews,a),++r}r<t.length&&t.splice(r)}_createLayerView(e){e.load().catch(()=>{}),this.layerViewImporter.hasLayerViewModule(e)&&this.layerViewImporter.importLayerView(e);let t=new _(e,this.view,this.layerViewImporter),n=t.promise?.then(()=>this._refreshCollections(),t=>{(!t||!o(t)&&t.name!==`cancelled:layerview-create`)&&r.getLogger(this).error(`Failed to create layerview for layer title:'${e.title??`no title`}', id:'${e.id??`no id`}' of type '${e.type}'.`,{layer:e,error:t})
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../core/Accessor.js";import n from"../../core/Error.js";import r from"../../core/Logger.js";import{someMap as i}from"../../core/MapUtils.js";import{createAbortError as a,isAbortError as o}from"../../core/promiseUtils.js";import s from"../../core/ReactiveMap.js";import{on as c,watch as l,syncAndInitial as u}from"../../core/reactiveUtils.js";import{schedule as d}from"../../core/scheduling.js";import{property as f,subclass as p}from"../../core/accessorSupport/decorators.js";import{get as m}from"../../core/accessorSupport/get.js";import{UpdatingHandles as h}from"../../core/support/UpdatingHandles.js";import{destroyMap as g}from"../../support/collectionUtils.js";import{LayerLayerViewInfo as _}from"./LayerLayerViewInfo.js";function v(e){return typeof e==`object`&&!!e&&`layerViews`in e}let y=class extends t{constructor(e){super(e),this._layerLayerViewInfoMap=new s,this._recyclingInfoMap=new s,this._watchUpdatingTracking=new h,this._preloadLayerViewModules=()=>{let e=this.view.map?.allLayers;if(e)for(let t of e)this.layerViewFilter?.(t)!==!1&&this.layerViewImporter.hasLayerViewModule(t)&&this.layerViewImporter.importLayerView(t)},this._reschedule=()=>this.destroyed?Promise.reject():(this._workPromise??(this._workPromise=Promise.withResolvers(),this._workPromise.promise.catch(()=>{})),this.removeHandles(`reschedule`),this.addHandles(d(this._doWork),`reschedule`),this._workPromise.promise),this._doWork=()=>{if(this.destroyed)return;let{map:e}=this.view;if(!e){this.clear();return}if(this._map!==e&&(this.clear(),this._map=e),this._workPromise==null)return;this.removeHandles(`reschedule`),this.removeHandles(`collection-change`);let t=new Set,n=[],r=this.view.ready,i=e=>{if(e!=null){for(let a of e)if(a){if(this.layerViewFilter?.(a)===!1)continue;t.add(a);let e=this._layerLayerViewInfoMap.get(a);e&&r?e.start():!e&&!this._recyclingInfoMap.has(a)&&n.push(a),`layers`in a&&a.layers&&i(a.layers)}}};for(let e of this._rootCollectionNames)i(m(this,e));let a=[],s=e=>{let t=e.tryRecycle(n);if(t){let n=e.layer;this._recyclingInfoMap.set(n,e),this._watchUpdatingTracking.consumePromise(t),t.then(()=>{this._recyclingInfoMap.get(n)===e&&e.promise===t&&(this._recyclingInfoMap.delete(n),this._layerLayerViewInfoMap.set(n,e),this._reschedule())}).catch(r=>{this._recyclingInfoMap.get(n)!==e||e.promise!==t||o(r)||(this._recyclingInfoMap.delete(n),e.destroy(),this._reschedule())})}else a.push(e)};for(let e of this._layerLayerViewInfoMap.values())t.has(e.layer)||(this._layerLayerViewInfoMap.delete(e.layer),s(e));for(let e of this._recyclingInfoMap.values())t.has(e.layer)||(this._recyclingInfoMap.delete(e.layer),s(e));for(let e of n)this._createLayerView(e);this._refreshCollections(),a.forEach(e=>e.destroy());let c=[e?.ground?.layers,e?.basemap?.baseLayers,e?.basemap?.groundLayers,e?.basemap?.referenceLayers,e?.layers].filter(e=>!!e);t.forEach(e=>`layers`in e&&c.push(e.layers)),this.addHandles(c.map(e=>this._watchUpdatingTracking.addOnCollectionChange(()=>e,this._reschedule)),`collection-change`),this._workPromise.resolve(),this._workPromise=null},this._layersToLayerViews=new Map(e.layerviewMapping)}initialize(){this.addHandles([c(()=>this.view?.map?.allLayers,`change`,this._preloadLayerViewModules,{onListenerAdd:this._preloadLayerViewModules}),l(()=>{let e=this.view,t=e?.map;return[t?.basemap,t?.ground,t?.layers,e?.ready]},()=>this._reschedule().catch(()=>{}),u)]),this._preloadLayerViewModules(),this._reschedule().catch(()=>{})}clearHandles(){this._watchUpdatingTracking.removeAll()}destroy(){this.clear(),g(this._recyclingInfoMap),g(this._layerLayerViewInfoMap),this._watchUpdatingTracking.destroy(),this._map=null,this._workPromise!=null&&(this._workPromise.reject(a()),this._workPromise=null)}get _rootCollectionNames(){return Array.from(this._layersToLayerViews.keys())}get updating(){return this._workPromise!=null||this._watchUpdatingTracking.updating||i(this._layerLayerViewInfoMap,e=>!e.done)||this._recyclingInfoMap.size>0}get updatingRemaining(){let e=0;for(let t of this._layerLayerViewInfoMap.values())t.done||++e;return e}clear(){this.destroyed||(this._clearCollections(),g(this._layerLayerViewInfoMap),g(this._recyclingInfoMap))}async whenLayerView(e){await this._reschedule();let t=this._layerLayerViewInfoMap.get(e)?.promise;if(!t){let t=this._recyclingInfoMap.get(e)?.promise;if(!t)throw new n(`view:no-layerview-for-layer`,`No layerview has been found for the layer`,{layer:e});return t}return t}isCreatingLayerViewsForLayer(e,t){let n=this._layerLayerViewInfoMap.get(e);if(!n?.done)return!0;let r=n.layerView;return r&&t&&r.parent!==t?!0:n.done&&r&&`layers`in e&&e.layers?.length?e.layers.some(e=>this.isCreatingLayerViewsForLayer(e,r)):!1}get allLayerViews(){let e=[];for(let t of this._layerLayerViewInfoMap.values())t.layerView&&e.push(t.layerView);for(let t of this._recyclingInfoMap.values())t.layerView&&e.push(t.layerView);return e}_refreshCollections(){for(let[e,t]of this._layersToLayerViews)this._populateLayerViewsOwners(m(this,e),m(this,t),this.view)}_clearCollections(){for(let e of this._layersToLayerViews.values())m(this,e)?.removeAll()}_populateLayerViewsOwners(e,t,n){if(!e||!t){t?.removeAll();return}let r=0;for(let i of e){let e=this._layerLayerViewInfoMap.get(i);if(!e?.layerView)continue;let{layerView:a}=e;a.layer=i,a.parent=n,t.at(r)!==a&&t.splice(r,0,a),`layers`in i&&v(a)&&this._populateLayerViewsOwners(i.layers,a.layerViews,a),++r}r<t.length&&t.splice(r)}_createLayerView(e){e.load().catch(()=>{}),this.layerViewImporter.hasLayerViewModule(e)&&this.layerViewImporter.importLayerView(e);let t=new _(e,this.view,this.layerViewImporter),n=t.promise?.then(()=>this._refreshCollections(),t=>{(!t||!o(t)&&t.name!==`cancelled:layerview-create`)&&r.getLogger(this).error(`Failed to create layerview for layer title:'${e.title??`no title`}', id:'${e.id??`no id`}' of type '${e.type}'.`,{layer:e,error:t}),this.destroyed||this._refreshCollections()});this._watchUpdatingTracking.consumePromise(n),this._layerLayerViewInfoMap.set(e,t),this.view.ready&&t.start()}};e([f()],y.prototype,`_workPromise`,void 0),e([f({readOnly:!0})],y.prototype,`_watchUpdatingTracking`,void 0),e([f({readOnly:!0})],y.prototype,`_layersToLayerViews`,void 0),e([f({constructOnly:!0})],y.prototype,`layerviewMapping`,void 0),e([f({readOnly:!0})],y.prototype,`_rootCollectionNames`,null),e([f({constructOnly:!0})],y.prototype,`layerViewFilter`,void 0),e([f()],y.prototype,`layerViewImporter`,void 0),e([f({readOnly:!0})],y.prototype,`updating`,null),e([f({readOnly:!0})],y.prototype,`updatingRemaining`,null),e([f({constructOnly:!0})],y.prototype,`view`,void 0),e([f({readOnly:!0})],y.prototype,`allLayerViews`,null),y=e([p(`esri.views.support.LayerViewManager`)],y);const b=y;export{b as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import"../../core/has.js";import{removeMaybe as e}from"../../core/maybe.js";import{onAbort as t,onAbortOrThrow as n,createAbortError as r,isPromiseLike as i}from"../../core/promiseUtils.js";import a from"../../core/Queue.js";import o from"../../core/ReactiveMap.js";import{schedule as s}from"../../core/scheduling.js";import{signal as c}from"../../core/signal.js";class l{constructor(e,t){this.item=e,this.controller=t,this.promise=null}}class u{constructor(e){this._schedule=null,this._task=null,this._deferreds=new o,this._controllers=new o,this._processingItems=new o,this._pausedSignal=c(!1),this.concurrency=1,e.concurrency&&(this.concurrency=e.concurrency),this._queue=new a(e.peeker),this.process=e.process;let t=e.scheduler;
|
|
2
|
+
import"../../core/has.js";import{removeMaybe as e}from"../../core/maybe.js";import{onAbort as t,onAbortOrThrow as n,createAbortError as r,isPromiseLike as i}from"../../core/promiseUtils.js";import a from"../../core/Queue.js";import o from"../../core/ReactiveMap.js";import{schedule as s}from"../../core/scheduling.js";import{signal as c}from"../../core/signal.js";class l{constructor(e,t){this.item=e,this.controller=t,this.promise=null}}class u{constructor(e){this._schedule=null,this._task=null,this._deferreds=new o,this._controllers=new o,this._processingItems=new o,this._pausedSignal=c(!1),this.concurrency=1,e.concurrency&&(this.concurrency=e.concurrency),this._queue=new a(e.peeker),this.process=e.process;let t=e.scheduler;this._scheduler=t??null,this._priority=e.priority??null}destroy(){this.clear(),this._schedule=e(this._schedule),this._task=e(this._task),this._scheduler=this._priority=null}get updating(){return!!this._task?.updating||this.readyToRun}get length(){return this._processingItems.size+this._queue.length}abort(e){let t=this._controllers.get(e);t&&t.abort()}clear(){this._queue.clear();let t=[];this._controllers.forEach(e=>t.push(e)),this._controllers.clear(),t.forEach(e=>e.abort()),this._processingItems.clear(),this._cancelNext(),this._task=e(this._task)}forEach(e){this._deferreds.forEach((t,n)=>e(n))}get(e){let t=this._deferreds.get(e);return t?t.promise:void 0}isOngoing(e){return this._processingItems.has(e)}has(e){return this._deferreds.has(e)}pause(){this._pausedSignal.value||(this._pausedSignal.value=!0,this._cancelNext())}push(i,a){let o=this.get(i);if(o)return o;let s=new AbortController,c=null;a&&(c=t(a,()=>s.abort()));let l=()=>{let e=this._processingItems.get(i);e&&e.controller.abort(),u(),f.reject(r())},u=()=>{d.remove(),c?.remove(),this._removeItem(i),this._queue.remove(i),this._scheduleNext(),this._queue.length||(this._task=e(this._task))},d=n(s.signal,l),f=Promise.withResolvers();return this._deferreds.set(i,f),this._controllers.set(i,s),f.promise.then(u,u),this._queue.push(i),this._scheduleNext(),f.promise}last(){return this._queue.last()}lastPromise(){let e=this.last();return e?this.get(e):null}peek(){return this._queue.peek()}popLast(){let e=this._queue.popLast();return e&&(this._deferreds.get(e)?.reject(r()),this._removeItem(e)),e}reset(){let e=Array.from(this._processingItems.values());this._processingItems.clear();for(let t of e)this._queue.push(t.item),t.controller.abort();this._scheduleNext()}resume(){this._pausedSignal.value&&(this._pausedSignal.value=!1,this._scheduleNext())}takeAll(){let e=[];for(;this._queue.length;)e.push(this._queue.pop());return this.clear(),e}get readyToRun(){return!this._pausedSignal.value&&this._queue.length>0&&this._processingItems.size<this.concurrency}runTask(e){for(;!e.done&&this._queue.length>0&&this._processingItems.size<this.concurrency;)this._process(this._queue.pop()),e.madeProgress()}_removeItem(e){this._deferreds.delete(e),this._controllers.delete(e),this._processingItems.delete(e)}_scheduleNext(){!this._queue.length||this._task||this._pausedSignal.value||this._schedule||(!this._task&&this._scheduler&&this._priority?this._task=this._scheduler.registerTask(this._priority,this):this._schedule=s(()=>{this._schedule=null,this._next()}))}_next(){for(;this._queue.length>0&&this._processingItems.size<this.concurrency;)this._process(this._queue.pop())}_cancelNext(){this._schedule&&=(this._schedule.remove(),null)}_processResult(e,t){this._canProcessFulfillment(e)&&(this._scheduleNext(),this._deferreds.get(e.item).resolve(t))}_processError(e,t){this._canProcessFulfillment(e)&&(this._scheduleNext(),this._deferreds.get(e.item).reject(t))}_canProcessFulfillment(e){return!(!this._deferreds.get(e.item)||this._processingItems.get(e.item)!==e)}_process(e){if(e==null)return;let t,n=new AbortController,r=new l(e,n);this._processingItems.set(e,r);try{t=this.process(e,n.signal)}catch(e){this._processError(r,e)}i(t)?(r.promise=t,t.then(e=>this._processResult(r,e),e=>this._processError(r,e))):this._processResult(r,t)}get test(){}}export{u as ScheduledQueueProcessor};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{clamp as e}from"../../core/mathUtils.js";import{createEmptyImageData as t}from"../../core/imageUtils.js";const n=2048;function r(t,n){let{format:r,quality:i,rotation:a,disableDecorations:o}=t||{},s=b(t,n.padding),c=_(t,{width:n.width-s.left-s.right,height:n.height-s.top-s.bottom}),{width:l,height:u}=g(t,c),d=x(r),f=E[d];return{format:d,quality:e(i??f,0,100),area:c,width:l,height:u,rotation:a,disableDecorations:!!o,ignoreBackground:!!t?.ignoreBackground,ignorePadding:!!t?.ignorePadding}}function i(e,t){let n=r(e,t),i=n.area,a=n.width/i.width,o=b(n,t.padding),s=o.left+o.right,c=o.top+o.bottom,l=t.width-s,u=t.height-c,d=Math.floor(l*a+s),f=Math.floor(u*a+c),p=e?.layers??[],m=n.ignoreBackground,h=n.ignorePadding;return{framebufferWidth:d,framebufferHeight:f,region:{x:Math.floor(i.x*a)+o.left,y:Math.floor(i.y*a)+o.top,width:n.width,height:n.height},format:n.format,quality:n.quality,rotation:n.rotation,pixelRatio:a,layers:p,disableDecorations:n.disableDecorations,ignoreBackground:m,ignorePadding:h,olidColor:!1}}function a(e,t,n){let{ctx:r,canvas:i}=s(e,n),a=r.getImageData(0,0,e.width,e.height),o=d(i,t);return c(i),{dataUrl:o,data:a}}function o(e,t){let{ctx:n,canvas:r}=s(e,t),i=n.getImageData(0,0,e.width,e.height);return c(r),i}function s(e,t){let n=l();t.premultipliedAlpha&&C(e),n.width=e.width,n.height=e.height;let r=n.getContext(`2d`,{willReadFrequently:!0});return r.putImageData(e,0,0),t.flipY&&S(r),{ctx:r,canvas:n}}function c(e){e.width=0,e.height=0}function l(){return u??=document.createElement(`canvas`),u}let u=null;function d(e,t){let n=w[t.format],r=t.quality/100;return e.toDataURL(n,r)}function f(t,n){let r=x(t),i=E[r];return{format:r,quality:e(n??i,0,100)}}function p(e,t){return t/Math.max(e[0],e[1])}function m(e,t,n,r=0,i=0,a=e.width-r,o=e.height-i,s=!1){let{data:c}=e,{width:l,height:u,data:d}=t,f=a/l,p=o/u,m=Math.ceil(f/2),h=Math.ceil(p/2),g=e.width;for(let e=0;e<u;e++)for(let t=0;t<l;t++){let a=(t+(s?u-e-1:e)*l)*4,o=0,_=0,v=0,y=0,b=0,x=0,S=(e+.5)*p;for(let a=Math.floor(e*p);a<(e+1)*p;a++){let e=Math.abs(S-(a+.5))/h,s=(t+.5)*f,l=e*e;for(let e=Math.floor(t*f);e<(t+1)*f;e++){let t=Math.abs(s-(e+.5))/m,u=Math.sqrt(l+t*t);if(u>=1)continue;let d=2*u*u*u-3*u*u+1,f=4*(r+e+(i+a)*g);x+=d*c[f+3],_+=d,!n&&c[f+3]<255&&(d=d*c[f+3]/255),v+=d*c[f],y+=d*c[f+1],b+=d*c[f+2],o+=d}}d[a]=v/o,d[a+1]=y/o,d[a+2]=b/o,d[a+3]=x/_}return t}function h(e,t,r){if(!t)return e;let{framebufferWidth:i,framebufferHeight:a,pixelRatio:o,region:s}=e,c=b(e,r),l=c.left+c.right,u=c.top+c.bottom,d=i-l,f=a-u,p=Math.min(8,Math.min((n-l)/d,(n-u)/f));return p<1.5?e:{...e,framebufferWidth:Math.round(d*p)+l,framebufferHeight:Math.round(f*p)+u,pixelRatio:o*p,resample:{region:{x:Math.round((s.x-c.left)*p)+c.left,y:Math.round((s.y-c.top)*p)+c.top,width:Math.round(s.width*p),height:Math.round(s.height*p)},width:i,height:a}}}function g(e,t){if(!e)return t;let n=e.width,r=e.height;if(n!=null&&r!=null)return{width:Math.floor(n),height:Math.floor(r)};if(n==null&&r==null)return t;let i=t.width/t.height;return r==null?{width:Math.floor(n),height:Math.floor(n/i)}:{width:Math.floor(r*i),height:Math.floor(r)}}function _(e,t){let n={x:0,y:0,width:t.width,height:t.height};if(e?.area){e.area.x!=null&&(n.x=Math.floor(e.area.x)),e.area.y!=null&&(n.y=Math.floor(e.area.y));let r=e.area.width==null?null:Math.floor(e.area.width),i=e.area.height==null?null:Math.floor(e.area.height);if(n.width=t.width-n.x,n.height=t.height-n.y,r!=null&&i!=null)n.width=Math.min(n.width,r),n.height=Math.min(n.height,i);else if(r==null&&i!=null){let e=Math.min(n.width,r);n.height=e/n.width*n.height,n.width=e}else if(r!=null&&i==null){let e=Math.min(n.height,i);n.width=e/n.height*n.width,n.height=e}}return v(y(n,e),t)}function v(e,t){let n=Math.floor(Math.max(e.x,0)),r=Math.floor(Math.max(e.y,0)),i={x:n,y:r,width:Math.floor(Math.min(e.width,t.width-n)),height:Math.floor(Math.min(e.height,t.height-r))},a=i.width/i.height,o=e.width/e.height;if(o===a)return i;if(o>a){let e=Math.floor(i.width/o),t=i.height-e;return{x:i.x,y:Math.floor(i.y+t/2),width:i.width,height:e}}let s=Math.floor(i.height*o),c=i.width-s;return{x:Math.floor(i.x+c/2),y:i.y,width:s,height:i.height}}function y(e,t){if(t?.width==null||t.height==null)return e;let n=t.width/t.height,r=e.width/e.height;if(r===n)return e;if(r<n){let t=Math.floor(e.height*n);return e.x-=(t-e.width)/2,e.width=t,e}let i=Math.floor(e.width/n);return e.y-=(i-e.height)/2,e.height=i,e}function b(e,t){return!t||e?.ignorePadding?D:t}function x(e){switch(e){case`png`:case`jpg`:case`jpeg`:return e;case null:case void 0:return T;default:return T}}function S(e){e.save(),e.globalCompositeOperation=`copy`,e.scale(1,-1),e.translate(0,-e.canvas.height),e.drawImage(e.canvas,0,0),e.restore()}function C(e){let t=e.data,n=t.length;for(let e=0;e<n;e+=4){let n=t[e+3];if(n!==255&&n>0){let r=255/n;t[e]=t[e]*r,t[e+1]=t[e+1]*r,t[e+2]=t[e+2]*r}}}const w={png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`},T=`png`,E={png:100,jpg:98,jpeg:98},D={top:0,right:0,bottom:0,left:0};export{r as completeUserSettings,t as createEmptyImageData,a as encode,o as encodeData,f as getFormatAndQuality,p as getMaximumResolutionScale,m as resampleHermite,h as screenshotSuperSampleSettings,d as toDataUrl,i as toRenderSettings};
|
|
2
|
+
import{clamp as e}from"../../core/mathUtils.js";import{createEmptyImageData as t}from"../../core/imageUtils.js";const n=2048;function r(t,n){let{format:r,quality:i,rotation:a,disableDecorations:o}=t||{},s=b(t,n.padding),c=_(t,{width:n.width-s.left-s.right,height:n.height-s.top-s.bottom}),{width:l,height:u}=g(t,c),d=x(r),f=E[d];return{format:d,quality:e(i??f,0,100),area:c,width:l,height:u,rotation:a,disableDecorations:!!o,ignoreBackground:!!t?.ignoreBackground,ignorePadding:!!t?.ignorePadding}}function i(e,t){let n=r(e,t),i=n.area,a=n.width/i.width,o=b(n,t.padding),s=o.left+o.right,c=o.top+o.bottom,l=t.width-s,u=t.height-c,d=Math.floor(l*a+s),f=Math.floor(u*a+c);(d<=0||f<=0)&&(d=i.width,f=i.height);let p=e?.layers??[],m=n.ignoreBackground,h=n.ignorePadding;return{framebufferWidth:d,framebufferHeight:f,region:{x:Math.floor(i.x*a)+o.left,y:Math.floor(i.y*a)+o.top,width:n.width,height:n.height},format:n.format,quality:n.quality,rotation:n.rotation,pixelRatio:a,layers:p,disableDecorations:n.disableDecorations,ignoreBackground:m,ignorePadding:h,olidColor:!1}}function a(e,t,n){let{ctx:r,canvas:i}=s(e,n),a=r.getImageData(0,0,e.width,e.height),o=d(i,t);return c(i),{dataUrl:o,data:a}}function o(e,t){let{ctx:n,canvas:r}=s(e,t),i=n.getImageData(0,0,e.width,e.height);return c(r),i}function s(e,t){let n=l();t.premultipliedAlpha&&C(e),n.width=e.width,n.height=e.height;let r=n.getContext(`2d`,{willReadFrequently:!0});return r.putImageData(e,0,0),t.flipY&&S(r),{ctx:r,canvas:n}}function c(e){e.width=0,e.height=0}function l(){return u??=document.createElement(`canvas`),u}let u=null;function d(e,t){let n=w[t.format],r=t.quality/100;return e.toDataURL(n,r)}function f(t,n){let r=x(t),i=E[r];return{format:r,quality:e(n??i,0,100)}}function p(e,t){return t/Math.max(e[0],e[1])}function m(e,t,n,r=0,i=0,a=e.width-r,o=e.height-i,s=!1){let{data:c}=e,{width:l,height:u,data:d}=t,f=a/l,p=o/u,m=Math.ceil(f/2),h=Math.ceil(p/2),g=e.width;for(let e=0;e<u;e++)for(let t=0;t<l;t++){let a=(t+(s?u-e-1:e)*l)*4,o=0,_=0,v=0,y=0,b=0,x=0,S=(e+.5)*p;for(let a=Math.floor(e*p);a<(e+1)*p;a++){let e=Math.abs(S-(a+.5))/h,s=(t+.5)*f,l=e*e;for(let e=Math.floor(t*f);e<(t+1)*f;e++){let t=Math.abs(s-(e+.5))/m,u=Math.sqrt(l+t*t);if(u>=1)continue;let d=2*u*u*u-3*u*u+1,f=4*(r+e+(i+a)*g);x+=d*c[f+3],_+=d,!n&&c[f+3]<255&&(d=d*c[f+3]/255),v+=d*c[f],y+=d*c[f+1],b+=d*c[f+2],o+=d}}d[a]=v/o,d[a+1]=y/o,d[a+2]=b/o,d[a+3]=x/_}return t}function h(e,t,r){if(!t)return e;let{framebufferWidth:i,framebufferHeight:a,pixelRatio:o,region:s}=e,c=b(e,r),l=c.left+c.right,u=c.top+c.bottom,d=i-l,f=a-u,p=Math.min(8,Math.min((n-l)/d,(n-u)/f));return p<1.5?e:{...e,framebufferWidth:Math.round(d*p)+l,framebufferHeight:Math.round(f*p)+u,pixelRatio:o*p,resample:{region:{x:Math.round((s.x-c.left)*p)+c.left,y:Math.round((s.y-c.top)*p)+c.top,width:Math.round(s.width*p),height:Math.round(s.height*p)},width:i,height:a}}}function g(e,t){if(!e)return t;let n=e.width,r=e.height;if(n!=null&&r!=null)return{width:Math.floor(n),height:Math.floor(r)};if(n==null&&r==null)return t;let i=t.width/t.height;return r==null?{width:Math.floor(n),height:Math.floor(n/i)}:{width:Math.floor(r*i),height:Math.floor(r)}}function _(e,t){let n={x:0,y:0,width:t.width,height:t.height};if(e?.area){e.area.x!=null&&(n.x=Math.floor(e.area.x)),e.area.y!=null&&(n.y=Math.floor(e.area.y));let r=e.area.width==null?null:Math.floor(e.area.width),i=e.area.height==null?null:Math.floor(e.area.height);if(n.width=t.width-n.x,n.height=t.height-n.y,r!=null&&i!=null)n.width=Math.min(n.width,r),n.height=Math.min(n.height,i);else if(r==null&&i!=null){let e=Math.min(n.width,r);n.height=e/n.width*n.height,n.width=e}else if(r!=null&&i==null){let e=Math.min(n.height,i);n.width=e/n.height*n.width,n.height=e}}return v(y(n,e),t)}function v(e,t){let n=Math.floor(Math.max(e.x,0)),r=Math.floor(Math.max(e.y,0)),i={x:n,y:r,width:t.width>0?Math.floor(Math.min(e.width,t.width-n)):e.width,height:t.height>0?Math.floor(Math.min(e.height,t.height-r)):e.height},a=i.width/i.height,o=e.width/e.height;if(o===a)return i;if(o>a){let e=Math.floor(i.width/o),t=i.height-e;return{x:i.x,y:Math.floor(i.y+t/2),width:i.width,height:e}}let s=Math.floor(i.height*o),c=i.width-s;return{x:Math.floor(i.x+c/2),y:i.y,width:s,height:i.height}}function y(e,t){if(t?.width==null||t.height==null)return e;let n=t.width/t.height,r=e.width>0&&e.height>0?e.width/e.height:0;if(r===0)return e.x=0,e.y=0,e.width=Math.floor(t.width),e.height=Math.floor(t.height),e;if(r===n)return e;if(r<n){let t=Math.floor(e.height*n);return e.x-=(t-e.width)/2,e.width=t,e}let i=Math.floor(e.width/n);return e.y-=(i-e.height)/2,e.height=i,e}function b(e,t){return!t||e?.ignorePadding?D:t}function x(e){switch(e){case`png`:case`jpg`:case`jpeg`:return e;case null:case void 0:return T;default:return T}}function S(e){e.save(),e.globalCompositeOperation=`copy`,e.scale(1,-1),e.translate(0,-e.canvas.height),e.drawImage(e.canvas,0,0),e.restore()}function C(e){let t=e.data,n=t.length;for(let e=0;e<n;e+=4){let n=t[e+3];if(n!==255&&n>0){let r=255/n;t[e]=t[e]*r,t[e+1]=t[e+1]*r,t[e+2]=t[e+2]*r}}}const w={png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`},T=`png`,E={png:100,jpg:98,jpeg:98},D={top:0,right:0,bottom:0,left:0};export{r as completeUserSettings,t as createEmptyImageData,a as encode,o as encodeData,f as getFormatAndQuality,p as getMaximumResolutionScale,m as resampleHermite,h as screenshotSuperSampleSettings,d as toDataUrl,i as toRenderSettings};
|
package/views/ui/UI.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{getLocale as t,onLocaleChange as n}from"../../intl.js";import r from"../../core/Accessor.js";import{isSome as i}from"../../core/arrayUtils.js";import{EventedAccessor as a}from"../../core/Evented.js";import{makeHandle as o}from"../../core/handleUtils.js";import{watch as s,initial as c}from"../../core/reactiveUtils.js";import{property as l,cast as u,subclass as d}from"../../core/accessorSupport/decorators.js";import{setCalciteModeClass as f}from"../../support/modeUtils.js";import p from"./Component.js";import{isRTL as m}from"../../widgets/support/widget.js";const h={left:0,top:0,bottom:0,right:0},g={bottom:30,top:15,right:15,left:15},_=`esri-ui`,v={ui:_,corner:`${_}-corner`,innerContainer:`${_}-inner-container`,manualContainer:`${_}-manual-container`,cornerContainer:`${_}-corner-container`,topLeft:`${_}-top-left`,topRight:`${_}-top-right`,bottomLeft:`${_}-bottom-left`,bottomRight:`${_}-bottom-right`};function y(e){return e&&!e._started&&typeof e.postMixInProperties==`function`&&typeof e.buildRendering==`function`&&typeof e.postCreate==`function`&&typeof e.startup==`function`}function b(e){return e===0?`0`:`${e}px`}function x(e){let t=typeof e==`object`&&!!e&&Object.getPrototypeOf(e);return(t===null||t===Object.prototype)&&(`component`in e||`index`in e||`position`in e)?e:null}function S(e,{top:t,bottom:n,left:r,right:i}){e.style.top=t,e.style.bottom=n,e.style.left=r,e.style.right=i}let C=class extends a{constructor(e){super(e),this._cornerNameToContainerLookup={},this._positionNameToContainerLookup={},this._components=[],this._componentMap=new Map,this._removeWidgetHandleKey=Symbol(`componentOnRemoveSymbol`),this._locale=t(),this.view=null,this._applyViewPadding=()=>{let e=this.container;e&&S(e,this._toPixelPosition(this._getViewPadding()))},this._applyUIPadding=()=>{let e=this._innerContainer;e&&S(e,this._toPixelPosition(this.padding))},this._initContainers()}initialize(){this.addHandles([s(()=>[this.view?.padding,this.container],this._applyViewPadding,c),s(()=>this.padding,this._applyUIPadding,c),s(()=>[this.container,this._locale],([e,t])=>{e&&e.setAttribute(`lang`,t)},c),n(e=>{this._locale=e})])}destroy(){this.removeAllHandles(),this.container=null;for(let e of this._components.slice())e.node?.remove(),e.destroy();this._components.length=0,this._componentMap.clear(),this._innerContainer=null,this._manualContainer=null,this._cornerNameToContainerLookup={},this._positionNameToContainerLookup={},this.view=null,this._set(`view`,null)}set container(e){let t=this._get(`container`);e!==t&&(e&&(e.classList.add(v.ui),f(e),this._attachContainers(e)),t&&(t.classList.remove(v.ui),S(t,{top:``,bottom:``,left:``,right:``}),t.textContent=``),this._set(`container`,e))}get height(){let e=this.view?.height??0;if(e===0)return e;let{top:t,bottom:n}=this._getViewPadding();return Math.max(e-t-n,0)}get padding(){return this._get(`padding`)}set padding(e){this._overrideIfSome(`padding`,e)}castPadding(e){return typeof e==`number`?{bottom:e,top:e,right:e,left:e}:{...g,...e}}get width(){let e=this.view?.width??0;if(e===0)return e;let{left:t,right:n}=this._getViewPadding();return Math.max(e-t-n,0)}add(e,t){let n,r,i;if(Array.isArray(e)){e.forEach(e=>this.add(e,t));return}let a=x(e);a&&({index:n,position:t,component:e,key:r}=a),t&&typeof t==`object`&&({index:n,key:r,position:t,internal:i}=t),!
|
|
2
|
+
import{__decorate as e}from"tslib";import{getLocale as t,onLocaleChange as n}from"../../intl.js";import r from"../../core/Accessor.js";import{isSome as i}from"../../core/arrayUtils.js";import{EventedAccessor as a}from"../../core/Evented.js";import{makeHandle as o}from"../../core/handleUtils.js";import{watch as s,initial as c}from"../../core/reactiveUtils.js";import{property as l,cast as u,subclass as d}from"../../core/accessorSupport/decorators.js";import{setCalciteModeClass as f}from"../../support/modeUtils.js";import p from"./Component.js";import{isRTL as m}from"../../widgets/support/widget.js";const h={left:0,top:0,bottom:0,right:0},g={bottom:30,top:15,right:15,left:15},_=`esri-ui`,v={ui:_,corner:`${_}-corner`,innerContainer:`${_}-inner-container`,manualContainer:`${_}-manual-container`,cornerContainer:`${_}-corner-container`,topLeft:`${_}-top-left`,topRight:`${_}-top-right`,bottomLeft:`${_}-bottom-left`,bottomRight:`${_}-bottom-right`};function y(e){return e&&!e._started&&typeof e.postMixInProperties==`function`&&typeof e.buildRendering==`function`&&typeof e.postCreate==`function`&&typeof e.startup==`function`}function b(e){return e===0?`0`:`${e}px`}function x(e){let t=typeof e==`object`&&!!e&&Object.getPrototypeOf(e);return(t===null||t===Object.prototype)&&(`component`in e||`index`in e||`position`in e)?e:null}function S(e,{top:t,bottom:n,left:r,right:i}){e.style.top=t,e.style.bottom=n,e.style.left=r,e.style.right=i}let C=class extends a{constructor(e){super(e),this._cornerNameToContainerLookup={},this._positionNameToContainerLookup={},this._components=[],this._componentMap=new Map,this._removeWidgetHandleKey=Symbol(`componentOnRemoveSymbol`),this._locale=t(),this.view=null,this._applyViewPadding=()=>{let e=this.container;e&&S(e,this._toPixelPosition(this._getViewPadding()))},this._applyUIPadding=()=>{let e=this._innerContainer;e&&S(e,this._toPixelPosition(this.padding))},this._initContainers()}initialize(){this.addHandles([s(()=>[this.view?.padding,this.container],this._applyViewPadding,c),s(()=>this.padding,this._applyUIPadding,c),s(()=>[this.container,this._locale],([e,t])=>{e&&e.setAttribute(`lang`,t)},c),n(e=>{this._locale=e})])}destroy(){this.removeAllHandles(),this.container=null;for(let e of this._components.slice())e.node?.remove(),e.destroy();this._components.length=0,this._componentMap.clear(),this._innerContainer=null,this._manualContainer=null,this._cornerNameToContainerLookup={},this._positionNameToContainerLookup={},this.view=null,this._set(`view`,null)}set container(e){let t=this._get(`container`);e!==t&&(e&&(e.classList.add(v.ui),f(e),this._attachContainers(e)),t&&(t.classList.remove(v.ui),S(t,{top:``,bottom:``,left:``,right:``}),t.textContent=``),this._set(`container`,e))}get height(){let e=this.view?.height??0;if(e===0)return e;let{top:t,bottom:n}=this._getViewPadding();return Math.max(e-t-n,0)}get padding(){return this._get(`padding`)}set padding(e){this._overrideIfSome(`padding`,e)}castPadding(e){return typeof e==`number`?{bottom:e,top:e,right:e,left:e}:{...g,...e}}get width(){let e=this.view?.width??0;if(e===0)return e;let{left:t,right:n}=this._getViewPadding();return Math.max(e-t-n,0)}add(e,t){let n,r,i;if(Array.isArray(e)){e.forEach(e=>this.add(e,t));return}let a=x(e);a&&({index:n,position:t,component:e,key:r}=a),t&&typeof t==`object`&&({index:n,key:r,position:t,internal:i}=t),!e||t&&!this._isValidPosition(t)||this._add(e,t,n??this._getNumComponentsAtPosition(t),r,i)}remove(e,t){if(!e)return;if(Array.isArray(e))return e.map(e=>this.remove(e,t));let n=this._find(e);if(n){let e=this._componentMap.get(n);if(!e||e.key!==t)return;let r=this._components.indexOf(n);return n.node.parentNode?.removeChild(n.node),this._componentMap.delete(n),n.widget?.removeHandlesReference(this._removeWidgetHandleKey),this._components.forEach(t=>{let n=this._componentMap.get(t);n&&n.position===e.position&&n.index>e.index&&n.index--}),this._components.splice(r,1)[0]}}empty(e,t={removeInternal:!1}){if(Array.isArray(e)){for(let n of e)this.empty(n,t);return}let n=this._positionNameToContainerLookup[e??`manual`],r=Array.prototype.slice.call(n.children).map(e=>this._findByNode(e)).filter(e=>e==null?!1:!(this._componentMap.get(e)?.internal??!1)||t.removeInternal);for(let e of r)this.remove(e)}move(e,t){if(Array.isArray(e)&&e.forEach(e=>this.move(e,t)),!e)return;let n,r=x(e)||x(t);if(r&&(n=r.index,t=r.position,e=r.component||e),t&&!this._isValidPosition(t))return;let i=this.remove(e);i&&this.add(i,{position:t,index:n})}find(e){if(!e)return null;let t=this._findById(e);return t&&(t.widget||t.node)}getComponents(e,t={includeInternal:!1}){return e?Array.isArray(e)?e.flatMap(e=>this._getComponentsAtPosition(e,t)):this._getComponentsAtPosition(e,t):this._components.filter(e=>t.includeInternal||!(this._componentMap.get(e)?.internal??!1)).map(({widget:e,node:t})=>e??t)}getPosition(e){for(let t in this._positionNameToContainerLookup)if(this._positionNameToContainerLookup[t].contains(e))return t;return null}_add(e,t,n,i,a){e instanceof p||(e=new p({node:e}));let{widget:s}=e;s!=null&&s instanceof r&&s.addHandles(o(()=>{queueMicrotask(()=>this.remove(e))}),this._removeWidgetHandleKey);let c=this._positionNameToContainerLookup[t];this._components.some(e=>{let t=this._componentMap.get(e)?.position,r=t?this._positionNameToContainerLookup[t]:null;return c===r&&this._componentMap.get(e)?.index===n})&&this._components.forEach(e=>{let t=this._componentMap.get(e),r=t?.position,i=r?this._positionNameToContainerLookup[r]:null;t&&i===c&&t.index>=n&&t.index++}),this._place({component:e,position:t,index:n}),this._components.push(e),this._componentMap.set(e,{key:i,position:t,internal:a,index:n})}_find(e){return e?e instanceof p?this._findByComponent(e):typeof e==`string`?this._findById(e):`domNode`in e?this._findByNode(e.domNode):this._findByNode(e):null}_getViewPadding(){return this.view?.padding??h}_attachContainers(e){e.appendChild(this._innerContainer),e.appendChild(this._manualContainer)}_initContainers(){let e=document.createElement(`div`);e.classList.add(v.innerContainer,v.cornerContainer);let t=document.createElement(`div`);t.classList.add(v.innerContainer,v.manualContainer);let n=document.createElement(`div`);n.classList.add(v.topLeft,v.corner),e.appendChild(n);let r=document.createElement(`div`);r.classList.add(v.topRight,v.corner),e.appendChild(r);let i=document.createElement(`div`);i.classList.add(v.bottomLeft,v.corner),e.appendChild(i);let a=document.createElement(`div`);a.classList.add(v.bottomRight,v.corner),e.appendChild(a),this._innerContainer=e,this._manualContainer=t;let o=m();this._cornerNameToContainerLookup={"top-left":n,"top-right":r,"bottom-left":i,"bottom-right":a,"top-leading":o?r:n,"top-trailing":o?n:r,"bottom-leading":o?a:i,"bottom-trailing":o?i:a},this._positionNameToContainerLookup={manual:t,...this._cornerNameToContainerLookup}}_isValidPosition(e){return!!this._positionNameToContainerLookup[e]}_place(e){let t=e.position??`manual`,{component:n,index:r}=e,i=this._positionNameToContainerLookup[t],a=r!=null&&r>-1;if(y(n.widget)&&n.widget.startup(),!a){i.appendChild(n.node);return}let o=Array.from(i.children);if(o.length===0)i.appendChild(n.node);else{for(let e of o){let t=this._findByNode(e);if(t&&r<(this._componentMap.get(t)?.index??0)){e.parentNode?.insertBefore(n.node,e);return}}i.appendChild(n.node)}}_toPixelPosition(e){return{top:b(e.top),left:b(e.left),right:b(e.right),bottom:b(e.bottom)}}_findByComponent(e){return this._components.find(t=>t===e)??null}_findById(e){return this._components.find(({id:t})=>t===e)??null}_findByNode(e){return e?this._components.find(({node:t})=>t===e):null}_getComponentsAtPosition(e,t){let n=this._positionNameToContainerLookup[e];return Array.prototype.slice.call(n.children).map(e=>this._findByNode(e)).filter(i).filter(e=>t.includeInternal||!(this._componentMap.get(e)?.internal??!1)).map(({widget:e,node:t})=>e??t)}_getNumComponentsAtPosition(e){return this._positionNameToContainerLookup[e]?.children.length??0}};e([l()],C.prototype,`_locale`,void 0),e([l()],C.prototype,`container`,null),e([l()],C.prototype,`height`,null),e([l({value:g})],C.prototype,`padding`,null),e([u(`padding`)],C.prototype,`castPadding`,null),e([l()],C.prototype,`view`,void 0),e([l()],C.prototype,`width`,null),C=e([d(`esri.views.ui.UI`)],C);const w=C;export{w as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import e from"../../core/Error.js";import{MultiOriginJSONSupport as t}from"../../core/MultiOriginJSONSupport.js";import{whenOnce as n}from"../../core/reactiveUtils.js";import{hasSameCanonicalPortal as r,urlToObject as i}from"../../core/urlUtils.js";import{updateOrigins as a}from"../../core/accessorSupport/originUtils.js";import o from"../../geometry/SpatialReference.js";import{webMercatorToGeographic as s}from"../../geometry/support/webMercatorUtils.js";import{isServerOrServicesAGOLUrl as c}from"../../layers/support/arcgisLayerUrl.js";import{isLayerWithFeatureLayerSource as l,isFeatureCollectionLayer as u}from"../../layers/support/layerUtils.js";import d from"../../portal/Portal.js";import f from"../../portal/PortalItem.js";import{createForItemWrite as ee}from"../../portal/support/jsonContext.js";import{removeTypeKeyword as p,
|
|
2
|
+
import e from"../../core/Error.js";import{MultiOriginJSONSupport as t}from"../../core/MultiOriginJSONSupport.js";import{whenOnce as n}from"../../core/reactiveUtils.js";import{hasSameCanonicalPortal as r,urlToObject as i}from"../../core/urlUtils.js";import{updateOrigins as a}from"../../core/accessorSupport/originUtils.js";import o from"../../geometry/SpatialReference.js";import{webMercatorToGeographic as s}from"../../geometry/support/webMercatorUtils.js";import{isServerOrServicesAGOLUrl as c}from"../../layers/support/arcgisLayerUrl.js";import{isLayerWithFeatureLayerSource as l,isFeatureCollectionLayer as u}from"../../layers/support/layerUtils.js";import d from"../../portal/Portal.js";import f from"../../portal/PortalItem.js";import{createForItemWrite as ee}from"../../portal/support/jsonContext.js";import{removeTypeKeyword as p,typeKeyword as m,addTypeKeyword as te,toggleTypeKeyword as h,hasTypeKeyword as g}from"../../portal/support/portalItemUtils.js";import{project as ne}from"../../rest/geometryService/project.js";import _ from"../../rest/support/ProjectParameters.js";import{hasDeveloperBasemapLayer as v,isDeveloperBasemapLayer as y}from"../../support/basemapUtils.js";import{saveResources as b}from"./resourceUtils.js";import{beforeSave as x,evaluateWriteErrors as S,hasCharts as re}from"./saveUtils.js";import{hasWebDocumentAsPrimaryContent as C,hasWebDocumentAsResource as w}from"./utils.js";const T=[`NatGeo_World_Map`,`Ocean_Basemap`,`USA_Topo_Maps`,`World_Imagery`,`World_Street_Map`,`World_Terrain_Base`,`World_Topo_Map`,`World_Hillshade`,`Canvas/World_Light_Gray_Base`,`Canvas/World_Light_Gray_Reference`,`Canvas/World_Dark_Gray_Base`,`Canvas/World_Dark_Gray_Reference`,`Ocean/World_Ocean_Base`,`Ocean/World_Ocean_Reference`,`Reference/World_Boundaries_and_Places`,`Reference/World_Reference_Overlay`,`Reference/World_Transportation`].map(e=>e.toLowerCase());async function E(e,t,r){r??={},k(e,t),await n(()=>!t.updatingFromView),await t.load(),await M(t),await x(t),await j(e,t);let i=t.portalItem,{json:a,jsonContext:o}=await D(t,i,e.origin,t.portalItemResourcePath);return S(o,{errorName:`${e.name}:save`},r),await N(t,i),await ue(e,t,i,a,o),await Promise.all([C(i)?t.updateItemThumbnail():null,b(t.resourceReferences,o)]),i}async function D(e,t,n,r){let i=w(t),a=i&&t.id===e.portalItem?.id&&r!==e.portalItemResourcePath,o=ee(t,n,{withResources:!0,forceNewItemContext:a});o.portalItemResourcePath=i?r:null;let s=e.write({},o);return await Promise.all(o.resources.pendingOperations),{json:s,jsonContext:o}}async function O(e,t,r,i){i??={};let a=t.portalItem,o=await ie(e,t,r,i);await n(()=>!t.updatingFromView),await t.load(),await M(t),await x(t),await j(e,t);let{json:s,jsonContext:c}=await D(t,o,e.origin,i.portalItemResourcePath);S(c,{errorName:`${e.name}:save`},i),await V(t,o);let l,u=C(o);return u&&(l=t.getThumbnailState()),await Y(e,t,o,s,c,i)&&(t.resourceReferences.portalItem=o),l&&t.restoreThumbnailFromState(l),await Promise.all([u?t.updateItemThumbnail(a):null,b(t.resourceReferences,c)]),o}function k(t,n){if(!n.portalItem)throw new e(`${t.name}:portal-item-not-set`,`Portal item to save to has not been set on the WebMap`);A(t,n.portalItem)}function A(t,n){let r=n.type,i=t.supportedItemTypes;if(!r||!i.has(r))throw new e(`${t.name}:portal-item-wrong-type`,`Portal item needs to have one of these types: '${Array.from(i).join(`', '`)}'`)}async function j(t,n){if(t.name!==`linkchart`&&!n.basemap?.baseLayers.length)throw new e(`${t.name}:save`,`Map does not have a valid basemap with a base layer.`)}async function ie(t,n,r,i){let a=f.from(r);a.id&&await a.load();let{portalItemResourcePath:o}=i,{name:s,primaryItemType:c}=t;if(w(a)){if(!o)throw new e(`${s}:missing-portal-item-resource-path`,`'portalItemResourcePath' is required to save a map to '${a.type}' item`);if(o===n.portalItemResourcePath&&a.id===n.portalItem?.id)throw new e(`${s}:invalid-portal-item-resource-path`,`Target 'portalItemResourcePath' should be different from '${s}.portalItemResourcePath'`);return a}if(o)throw new e(`${s}:portal-item-resource-path-not-supported`,`'portalItemResourcePath' is not supported when saving a map to '${c}' item`);return a.id&&(a=a.clone(),a.id=null),a.type||(a.type=c),a.portal||(a.portal=d.getDefault()),A(t,a),a}function M(e){let t=[];return e.basemap&&t.push(e.basemap.load()),e.ground&&t.push(e.ground.load()),Promise.allSettled(t).then(()=>{})}async function N(e,t){w(t)||(t.extent=await q(e.portalItem,e.initialViewProperties.viewpoint.targetGeometry),await H(e,t))}const P=m.JSAPI,F=`CollectorDisabled`,I=`OfflineDisabled`,L=`Workforce Project`,R=`Workforce Worker`,z=`Workforce Dispatcher`,B=m.DEVELOPER_BASEMAP;async function V(e,t){w(t)||(p(t,F),p(t,`FieldMapsDisabled`),p(t,m.METADATA),p(t,I),p(t,`Offline Map Areas`),p(t,z),p(t,L),p(t,R),await N(e,t))}async function H(e,t){te(t,P),await U(e),h(t,`Collector`,!g(t,F)&&!g(t,L)&&!g(t,R)&&!g(t,z)&&G(e)),h(t,`Data Editing`,G(e)),h(t,`Offline`,!g(t,I)&&K(e)),h(t,B,v(e.basemap)),h(t,`UtilityNetwork`,!!e.utilityNetworks?.length),h(t,`ParcelFabric`,!!e.parcelFabric),h(t,`IPS`,!!e.ipsInfo),h(t,m.CHARTS,re(e)),t.typeKeywords&&=t.typeKeywords.filter((e,t,n)=>n.indexOf(e)===t)}function U(e){let t=W(e).map(e=>e.load()).toArray();return Promise.allSettled(t).then(()=>{})}function W(e){return e.allLayers.concat(e.allTables)}function G(e){return W(e).some(e=>e.loaded&&l(e)&&e.capabilities.operations.supportsEditing&&`editingEnabled`in e&&e.editingEnabled&&(e.type!==`subtype-group`||e.sublayers.some(e=>e.editingEnabled)))}function K(e){return W(e).filter(e=>e.type!==`group`).every(t=>t.loaded&&oe(e,t))}async function q(e,t){let n=t.clone().normalize(),r;if(n.length>1)for(let e of n)r?e.width>r.width&&(r=e):r=e;else r=n[0];return J(e,r)}async function J(e,t){let n=t.spatialReference;if(n.isWGS84)return t.clone();if(n.isWebMercator)return s(t);let{getGeometryServiceURL:r}=await import(`../../portal/support/geometryServiceUtils.js`),i=await r(e),a=new _({geometries:[t],outSpatialReference:o.WGS84});return(await ne(i,a))[0]}function ae(e){return u(e)||e.type===`map-notes`||e.type===`route`||e.type===`sketch`}function oe(e,t){return l(t)&&t.capabilities.operations.supportsSync||ae(t)&&!t.portalItem||se(t)&&!ce(t)&&t.spatialReference.equals(e.initialViewProperties.spatialReference)}function se(e){return e.type===`imagery-tile`?e.supportsExportMapTiles():(e.type===`tile`||e.type===`vector-tile`)&&(e.capabilities.operations.supportsExportTiles||le(e)||y(e))}function ce(e){return e.type===`vector-tile`&&Object.keys(e.sourceNameToSource).length>1}function le(e){return e.type===`tile`&&c(e.url)&&T.some(t=>e.url?.toLowerCase().includes(`/`+t+`/`))}async function ue(e,t,n,r,i){C(n)?await n.update({data:r}):(await n.portal.signIn(),await n.resourceFromPath(t.portalItemResourcePath).update($(r))),Q(e,t,n,r,i)}async function Y(t,n,r,i,a,o){let s=n.portalItem,c={item:s,authenticated:!!(s?.id&&s.portal.user)},l=r.portal;await l.signIn();let{copyAllowed:u,itemReloaded:d}=await X(c,l);if(c.authenticated||=d,!u)throw new e(`${t.name}:save-as-copy-not-allowed`,`Owner of this map does not allow others to save a copy`);let f=!1;if(C(r))f=await Z(r,c,i,o);else{let e=r.resourceFromPath(o.portalItemResourcePath);await r.addResource(e,$(i))}return n.portalItem=r,n.portalItemResourcePath=o.portalItemResourcePath,Q(t,n,r,i,a),f}async function X(e,t){let{item:n,authenticated:r}=e;return n&&C(n)&&n.id&&n.typeKeywords?.includes(`useOnly`)?n.portal.portalHostname===t.portalHostname?(r||await n.reload(),{copyAllowed:n.itemControl===`admin`||n.itemControl===`update`,itemReloaded:!0}):{copyAllowed:!1,itemReloaded:!1}:{copyAllowed:!0,itemReloaded:!1}}async function Z(e,t,n,i){let a=e.portal,{item:o}=t,{folder:s,copyAllResources:c}=i,l=!1;if(c&&o?.id&&o.type===e.type&&r(o.portal.url,a.url)&&parseInt(o.portal.currentVersion,10)>=2023){let{total:e}=await o.fetchResources();l=!!e}if(l){let t=await o.copy({copyResources:`all`,folder:s});e.id=t.id,e.portal=t.portal;let r=e.toJSON();await e.load(),e.read(r),await e.update({data:n})}else await a.user.addItem({item:e,folder:s,data:n});return l}function Q(e,n,r,o,s){t.prototype.read.call(n,{version:o.version,authoringApp:o.authoringApp,authoringAppVersion:o.authoringAppVersion},{origin:e.origin,ignoreDefaults:!0,url:r.itemUrl?i(r.itemUrl):void 0}),a(s),n.resourceInfo=o}function $(e){return new Blob([JSON.stringify(e)],{type:`application/json`})}export{D as createJSON,Z as initializeNewItem,X as isCopyAllowed,E as save,O as saveAs};
|
package/webscene/Slide.d.ts
CHANGED
|
@@ -186,8 +186,7 @@ export default class Slide extends SlideSuperclass {
|
|
|
186
186
|
* @param options - Creation options. See properties below for object specifications.
|
|
187
187
|
* @returns When resolved, returns the created slide.
|
|
188
188
|
* @example
|
|
189
|
-
* // Creates a slide from the view and
|
|
190
|
-
* // adds it to the webscene
|
|
189
|
+
* // Creates a slide from the view and adds it to the webscene
|
|
191
190
|
* Slide.createFrom(view).then(function(slide){
|
|
192
191
|
* webscene.presentation.slides.add(slide);
|
|
193
192
|
* });
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../core/Collection.js";import n from"../../core/Error.js";import{makeHandle as r,abortHandle as i}from"../../core/handleUtils.js";import a from"../../core/Logger.js";import{isAborted as o}from"../../core/promiseUtils.js";import{property as s,subclass as c}from"../../core/accessorSupport/decorators.js";import l from"../../views/draw/support/HighlightHelper.js";import{temporaryHighlightName as u}from"../../views/support/HighlightDefaults.js";import d from"../BatchAttributeForm/BatchAttributeFormViewModel.js";import f from"./UpdateRecordWorkflowData.js";import p from"./Workflow.js";import{fetchFullFeatures as m,handleFormValuesChangeEvent as h}from"./workflowUtils.js";import{toEditAttachmentsPayload as g,toAttachmentEdit as _}from"./support/attachmentUtils.js";var v;const y={exit:Symbol()};let b=class extends p{static{v=this}constructor(e){super(e),this._highlightHelper=null,this.fullFeature=null,this.type=`update-table-record`}initialize(){let{data:e}=this,{edits:t}=e,{view:s}=e.viewModel,c=t.feature;s&&(this._highlightHelper=new l({view:s,highlightName:u}),this.addHandles(r(()=>this._highlightHelper?.removeAll())));let d=new AbortController;this.addHandles(i(d)),this._updatingHandles.consumePromise(m([c],c.sourceLayer,e.viewModel.view.spatialReference,d.signal).then(([e])=>{o(d)||(this._onFullFeatureLoaded(e),this._initializeFormViewModel())},e=>(a.getLogger(this).error(`initialize()`,`Failed to fetch full feature for update workflow.`,e),this.cancel({force:!0,error:new n(`editor:failed-to-fetch-full-feature`,`Failed to retrieve all information for this feature. The update cannot proceed.`,{detail:{error:e}})}))))}get allowSave(){return!this.data.readOnly&&this.hasPendingEdits&&!this.updating}get editorItem(){return this.data.editorItem}get formViewModel(){return this._formViewModel}get hasInvalidFormTemplate(){return this.data.editorItem.hasInvalidFormTemplate}get hasPendingEdits(){return this.data.edits.modified&&!this.data.readOnly}get layer(){return this.data.editorItem.layer}get parent(){return this.data.parent}get saveActionLabel(){return`update`}get shouldShowAttachments(){return this.editorItem.capabilities.attachments.enabled}get shouldAllowAttachmentEditing(){return this.editorItem.capabilities.update.attachments.enabled}get reliesOnOwnerAdminPrivileges(){let e=this.editorItem.capabilities;return e.update.reliesOnOwnerAdminPrivileges||e.delete.reliesOnOwnerAdminPrivileges}async enter(){}exit(e){this.removeHandles(y.exit)}async start(){return await super.start(),null}_initializeFormViewModel(){let{association:e,edits:n,viewModel:{view:r},readOnly:i,editorItem:a}=this.data,{fullFeature:o}=this,s=a.layerInfo?[a.layerInfo]:null,c=this._formViewModel=new d({activeFeatureIndex:0,attachmentsEnabled:!0,editType:`UPDATE`,features:new t([o]),highlightHelper:this._highlightHelper,layerInfos:s,readOnly:i,spatialReference:r.spatialReference,view:r,callbacks:this.data.formCallbacks});e&&c.setActiveAssociation(e);let{initialFeature:l}=n;l&&c.overrideOriginalFeature(o,l),this.addHandles([c.on(`values-change`,h({filter:e=>e===o,forEachFeature:()=>{n.updateAttributes(c.getValues(o)),o.attributes=n.feature.attributes}})),c.on(`attachments-change`,e=>n.setAttachmentEdits(e.attachmentEdits))])}_onFullFeatureLoaded(e){this.fullFeature=e;let{edits:t}=this.data;t.updateAttributes(e.attributes),t.trackChanges()}static async create(e){let t=new v({data:await f.create(e),onCommit:this._onCommitFactory(e.applyEdits,e.applyAttachmentEdits)});return t._set(`steps`,this._createWorkflowSteps(t)),t}static _createWorkflowSteps(e){return[{id:`editing-attributes`,async setUp(){},async tearDown(){}},{id:`adding-attachment`,async setUp(){},async tearDown(){}},{id:`editing-attachment`,async setUp(){},async tearDown(){}}]}static{this._onCommitFactory=(e,t)=>async n=>{let{edits:r,editorItem:i}=n,{feature:a}=r;if(!a)return;let o=a.sourceLayer,s=i.supportsGlobalIds&&`globalIdField`in o,c={},l;x(c,r,i),!r.stagedForDelete&&r.attachmentsModified&&s&&(l={globalIdUsed:!0},S(c,r))
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../core/Collection.js";import n from"../../core/Error.js";import{makeHandle as r,abortHandle as i}from"../../core/handleUtils.js";import a from"../../core/Logger.js";import{isAborted as o}from"../../core/promiseUtils.js";import{property as s,subclass as c}from"../../core/accessorSupport/decorators.js";import l from"../../views/draw/support/HighlightHelper.js";import{temporaryHighlightName as u}from"../../views/support/HighlightDefaults.js";import d from"../BatchAttributeForm/BatchAttributeFormViewModel.js";import f from"./UpdateRecordWorkflowData.js";import p from"./Workflow.js";import{fetchFullFeatures as m,handleFormValuesChangeEvent as h}from"./workflowUtils.js";import{toEditAttachmentsPayload as g,toAttachmentEdit as _}from"./support/attachmentUtils.js";var v;const y={exit:Symbol()};let b=class extends p{static{v=this}constructor(e){super(e),this._highlightHelper=null,this.fullFeature=null,this.type=`update-table-record`}initialize(){let{data:e}=this,{edits:t}=e,{view:s}=e.viewModel,c=t.feature;s&&(this._highlightHelper=new l({view:s,highlightName:u}),this.addHandles(r(()=>this._highlightHelper?.removeAll())));let d=new AbortController;this.addHandles(i(d)),this._updatingHandles.consumePromise(m([c],c.sourceLayer,e.viewModel.view.spatialReference,d.signal).then(([e])=>{o(d)||(this._onFullFeatureLoaded(e),this._initializeFormViewModel())},e=>(a.getLogger(this).error(`initialize()`,`Failed to fetch full feature for update workflow.`,e),this.cancel({force:!0,error:new n(`editor:failed-to-fetch-full-feature`,`Failed to retrieve all information for this feature. The update cannot proceed.`,{detail:{error:e}})}))))}get allowSave(){return!this.data.readOnly&&this.hasPendingEdits&&!this.updating}get editorItem(){return this.data.editorItem}get formViewModel(){return this._formViewModel}get hasInvalidFormTemplate(){return this.data.editorItem.hasInvalidFormTemplate}get hasPendingEdits(){return this.data.edits.modified&&!this.data.readOnly}get layer(){return this.data.editorItem.layer}get parent(){return this.data.parent}get saveActionLabel(){return`update`}get shouldShowAttachments(){return this.editorItem.capabilities.attachments.enabled}get shouldAllowAttachmentEditing(){return this.editorItem.capabilities.update.attachments.enabled}get reliesOnOwnerAdminPrivileges(){let e=this.editorItem.capabilities;return e.update.reliesOnOwnerAdminPrivileges||e.delete.reliesOnOwnerAdminPrivileges}async enter(){}exit(e){this.removeHandles(y.exit)}async start(){return await super.start(),null}_initializeFormViewModel(){let{association:e,edits:n,viewModel:{view:r},readOnly:i,editorItem:a}=this.data,{fullFeature:o}=this,s=a.layerInfo?[a.layerInfo]:null,c=this._formViewModel=new d({activeFeatureIndex:0,attachmentsEnabled:!0,editType:`UPDATE`,features:new t([o]),highlightHelper:this._highlightHelper,layerInfos:s,readOnly:i,spatialReference:r.spatialReference,view:r,callbacks:this.data.formCallbacks});e&&c.setActiveAssociation(e);let{initialFeature:l}=n;l&&c.overrideOriginalFeature(o,l),this.addHandles([c.on(`values-change`,h({filter:e=>e===o,forEachFeature:()=>{n.updateAttributes(c.getValues(o)),o.attributes=n.feature.attributes}})),c.on(`attachments-change`,e=>n.setAttachmentEdits(e.attachmentEdits))])}_onFullFeatureLoaded(e){this.fullFeature=e;let{edits:t}=this.data;t.updateAttributes(e.attributes),t.trackChanges()}static async create(e){let t=new v({data:await f.create(e),onCommit:this._onCommitFactory(e.applyEdits,e.applyAttachmentEdits)});return t._set(`steps`,this._createWorkflowSteps(t)),t}static _createWorkflowSteps(e){return[{id:`editing-attributes`,async setUp(){},async tearDown(){}},{id:`adding-attachment`,async setUp(){},async tearDown(){}},{id:`editing-attachment`,async setUp(){},async tearDown(){}}]}static{this._onCommitFactory=(e,t)=>async n=>{let{edits:r,editorItem:i}=n,{feature:a}=r;if(!a)return;let o=a.sourceLayer,s=i.supportsGlobalIds&&`globalIdField`in o,c={},l;x(c,r,i),!r.stagedForDelete&&r.attachmentsModified&&s&&(l={globalIdUsed:!0},S(c,r)),Object.keys(c).length>0&&!await e(o,c,l)||!r.stagedForDelete&&r.attachmentsModified&&!s&&await t(o,g(a,r.attachmentEdits))}}get test(){return{formViewModel:this._formViewModel}}};e([s()],b.prototype,`_formViewModel`,void 0),e([s()],b.prototype,`allowSave`,null),e([s()],b.prototype,`editorItem`,null),e([s()],b.prototype,`formViewModel`,null),e([s()],b.prototype,`fullFeature`,void 0),e([s()],b.prototype,`hasInvalidFormTemplate`,null),e([s()],b.prototype,`hasPendingEdits`,null),e([s()],b.prototype,`layer`,null),e([s()],b.prototype,`parent`,null),e([s()],b.prototype,`saveActionLabel`,null),e([s()],b.prototype,`shouldShowAttachments`,null),e([s()],b.prototype,`shouldAllowAttachmentEditing`,null),e([s()],b.prototype,`reliesOnOwnerAdminPrivileges`,null),b=v=e([c(`esri.widgets.Editor.UpdateRecordWorkflow`)],b);function x(e,t,n){let{feature:r,attributesModified:i,geometryModified:a,stagedForDelete:o}=t;if(!r||!(i||a||o))return;let s=r.sourceLayer,c=r.clone();if(!i||o){let e=s.objectIdField;if(c.attributes={[e]:r.getAttribute(e)},s.type===`scene`&&s.infoFor3D!=null){let e=s.associatedLayer?.globalIdField;e!=null&&c.setAttribute(e,r.getAttribute(e))}}if(n.supportsGlobalIds&&`globalIdField`in s){let e=s.globalIdField;e!=null&&c.setAttribute(e,r.getAttribute(e))}(!a||o)&&(c.geometry=null);let l=o?`deleteFeatures`:`updateFeatures`;e[l]=[c]}function S(e,t){let n=[],r=[],i=[];t.attachmentEdits.forEach(e=>{e.adds.forEach(e=>n.push(_(e))),e.updates.forEach(e=>r.push(_(e))),e.deletes.forEach(e=>i.push(e.globalId))}),n.length>0&&(e.addAttachments=n),r.length>0&&(e.updateAttachments=r),i.length>0&&(e.deleteAttachments=i)}export{b as UpdateRecordWorkflow,y as handleKeys};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import n from"../../../core/Accessor.js";import{createTask as r}from"../../../core/asyncUtils.js";import{abortMaybe as i}from"../../../core/maybe.js";import{throwIfAborted as a}from"../../../core/promiseUtils.js";import{watch as o,initial as s,when as c}from"../../../core/reactiveUtils.js";import{throttle as l}from"../../../core/throttle.js";import{property as u,subclass as d}from"../../../core/accessorSupport/decorators.js";import f from"../../../geometry/Point.js";import
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import n from"../../../core/Accessor.js";import{createTask as r}from"../../../core/asyncUtils.js";import{abortMaybe as i}from"../../../core/maybe.js";import{throwIfAborted as a}from"../../../core/promiseUtils.js";import{watch as o,initial as s,when as c}from"../../../core/reactiveUtils.js";import{throttle as l}from"../../../core/throttle.js";import{property as u,subclass as d}from"../../../core/accessorSupport/decorators.js";import f from"../../../geometry/Point.js";import p from"../../../popup/ElementExpressionInfo.js";import m from"../../../popup/content/FieldsContent.js";import h from"../../../popup/content/MediaContent.js";import g from"../../../popup/content/TextContent.js";import{compileExpression as _}from"../../../popup/support/arcadeFeatureUtils.js";import v from"../FeatureContent/FeatureContentViewModel.js";import y from"../FeatureFields/FeatureFieldsViewModel.js";import b from"../FeatureMedia/FeatureMediaViewModel.js";let x=class extends n{constructor(e){super(e),this._compileTask=null,this._evaluateTask=null,this.expressionInfo=null,this.graphic=null,this.contentElementViewModel=null,this.interceptor=null,this.location=null,this.view=null,this._createVM=()=>{let e=this.contentElement?.type;this.contentElementViewModel?.destroy();let t=e===`fields`?new y:e===`media`?new b:e===`text`?new v:null;this._set(`contentElementViewModel`,t)},this._compileThrottled=l(this._startCompile,()=>this.notifyChange(`state`),1,this),this._evaluateThrottled=l(this._startEvaluate,()=>this.notifyChange(`state`),1,this),this.addHandles([o(()=>[this.expressionInfo,this.graphic],()=>this._compileThrottled(),s),o(()=>[this.contentElement],()=>this._createVM(),s),c(()=>{if(!this._compileTask?.finished)return null;let e=this._compileTask.value,t=e?.dependencies;return[e,this.spatialReference,this.map,this.view,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._evaluateThrottled(e))])}initialize(){this.addHandles([this._compileThrottled,this._evaluateThrottled])}destroy(){this._compileTask=i(this._compileTask),this._evaluateTask=i(this._evaluateTask),this.contentElementViewModel?.destroy(),this._set(`contentElementViewModel`,null)}get contentElement(){return this._evaluateTask?.value}get spatialReference(){return this.view?.spatialReference??null}set spatialReference(e){this._override(`spatialReference`,e)}get state(){let{contentElement:e,contentElementViewModel:t}=this;return this._compileThrottled.hasPendingUpdates()||this._evaluateThrottled.hasPendingUpdates()||!this._compileTask?.finished||!this._evaluateTask?.finished?`loading`:!e&&!t?`disabled`:`ready`}get map(){return this.view?.map??null}set map(e){this._override(`map`,e)}_startCompile(){this._evaluateTask=i(this._evaluateTask),this._compileTask=i(this._compileTask),this._compileTask=r(async e=>{let{expressionInfo:t,graphic:n}=this,r=t?.expression;if(!r||!n)return null;let i=await _({expression:r,graphic:n});return a(e),i})}_startEvaluate(e){this._evaluateTask=i(this._evaluateTask),this._evaluateTask=r(async t=>{let{graphic:n}=this;if(!e||!n)return null;let{interceptor:r,spatialReference:i,map:o,location:s,view:c}=this,l=await e.evaluate({graphic:n,interceptor:r,location:s,map:o,options:{signal:t},spatialReference:i,view:c});a(t);let u=l;if(!u||u.declaredClass!==`esri.arcade.Dictionary`)return null;let d=await u.castAsJsonAsync(t);a(t);let f=d?.type,p=f===`media`?h.fromJSON(d):f===`text`?g.fromJSON(d):f===`fields`?m.fromJSON(d):null;return p.type===`media`&&!p.mediaInfos||p.type===`fields`&&!p.fieldInfos||p.type===`text`&&!p.text?null:p})}};e([u()],x.prototype,`_compileTask`,void 0),e([u()],x.prototype,`_evaluateTask`,void 0),e([u({type:p})],x.prototype,`expressionInfo`,void 0),e([u({type:t})],x.prototype,`graphic`,void 0),e([u({readOnly:!0})],x.prototype,`contentElement`,null),e([u({readOnly:!0})],x.prototype,`contentElementViewModel`,void 0),e([u()],x.prototype,`interceptor`,void 0),e([u({type:f})],x.prototype,`location`,void 0),e([u()],x.prototype,`spatialReference`,null),e([u({readOnly:!0})],x.prototype,`state`,null),e([u()],x.prototype,`map`,null),e([u()],x.prototype,`view`,void 0),x=e([d(`esri.widgets.Feature.FeatureExpression.FeatureExpressionViewModel`)],x);export{x as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import n from"../../../core/Accessor.js";import{isSome as r}from"../../../core/arrayUtils.js";import{ClonableMixin as i}from"../../../core/Clonable.js";import a from"../../../core/Collection.js";import{IdentifiableMixin as o}from"../../../core/Identifiable.js";import{ignoreAbortErrors as s,debounce as c}from"../../../core/promiseUtils.js";import{watch as l,initial as u}from"../../../core/reactiveUtils.js";import{property as d,subclass as f}from"../../../core/accessorSupport/decorators.js";import{getFixedFieldName as p,isRelatableFeatureSupportedLayer as m,findRelatedLayer as h}from"../../../popup/support/featureUtils.js";import g from"../../../rest/support/RelationshipQuery.js";import{getFieldsInTitleAndDesc as _}from"../../FeatureForm/featureFormUtils.js";let v=class extends i(o(n)){constructor(e){super(e),this._loaded=!1,this._queryAbortController=null,this._queryPageAbortController=null,this._queryFeatureCountAbortController=null,this.featuresPerPage=10,this.activeCategory=null,this.allCategories=null,this.description=null,this.graphic=null,this.layer=null,this.map=null,this.orderByFields=null,this.featureCount=0,this.relationshipId=null,this.showAllEnabled=!1,this.title=null,this._cancelQuery=()=>{let{_queryAbortController:e}=this;e&&e.abort(),this._queryAbortController=null},this._cancelQueryFeatureCount=()=>{let{_queryFeatureCountAbortController:e}=this;e&&e.abort(),this._queryFeatureCountAbortController=null},this._cancelQueryPage=()=>{let{_queryPageAbortController:e}=this;e&&e.abort(),this._queryPageAbortController=null},this._queryController=async()=>{this._cancelQuery();let e=new AbortController;this._queryAbortController=e,await s(this._query()),this._queryAbortController===e&&(this._queryAbortController=null)},this._queryFeatureCountController=async()=>{this._loaded=!1,this._cancelQueryFeatureCount();let e=new AbortController;this._queryFeatureCountAbortController=e,await s(this._queryFeatureCount()),this._queryFeatureCountAbortController===e&&(this._queryFeatureCountAbortController=null),this._loaded=!0},this._queryPageController=async()=>{let e=new AbortController;this._queryPageAbortController=e,await s(this._queryPage()),this._queryPageAbortController===e&&(this._queryPageAbortController=null)},this._queryDebounced=c(this._queryController,100),this._queryFeatureCountDebounced=c(this._queryFeatureCountController,100),this._queryPageDebounced=c(this._queryPageController,100),this._query=async()=>{let{_queryAbortController:e,relatedFeatures:t}=this;this.featureCount&&(this.relatedLayer?.type!==`subtype-group`||this.activeCategory)&&(this._destroyRelatedFeatureViewModels(),this.featurePage=1,t.destroyAll(),!this.destroyed&&t.addMany(this._sliceFeatures(await this._queryRelatedFeatures({signal:e?.signal}))))},this.addHandles([l(()=>[this.displayCount,this.graphic,this.layer,this.layer?.loaded,this.map,this.orderByFields,this.relationshipId,this.featuresPerPage,this.showAllEnabled,this.canQuery,this.featureCount,this.activeCategory],()=>this._queryDebounced().catch(()=>{}),u),l(()=>[this.featurePage,this.showAllEnabled],()=>this._queryPageDebounced().catch(()=>{})),l(()=>[this.layer,this.relationshipId,this.objectId,this.canQuery,this.activeCategory],()=>this._queryFeatureCountDebounced().catch(()=>{}))])}destroy(){this._destroyRelatedFeatureViewModels(),this.relatedFeatures.destroyAll(),this._cancelQuery(),this._cancelQueryFeatureCount(),this._cancelQueryPage()}set featurePage(e){let{featuresPerPage:t,featureCount:n}=this,r=Math.ceil(n/t)||1;this._set(`featurePage`,Math.min(Math.max(e,1),r))}get featurePage(){return this._get(`featurePage`)}get orderByFieldsFixedCasing(){let{orderByFields:e,relatedLayer:t}=this;return e&&t?.loaded?e.map(e=>{let n=e.clone();return n.field=p(e.field,t),n}):e??[]}get supportsCacheHint(){return!!this.layer?.capabilities?.queryRelated?.supportsCacheHint}get canLoad(){return!!this.map&&this.relationshipId!=null&&typeof this.objectId==`number`}get canQuery(){let e=this.layer?.capabilities?.queryRelated;return!!this.relatedLayer&&!!this.relationship&&this.relationshipId!=null&&this.objectId!=null&&!!e?.supportsCount&&!!e?.supportsPagination}get allCategoriesCount(){return this.allCategories?.length??0}get categories(){let{allCategories:e}=this;return this.showAllEnabled?e:e?.slice(0,this.displayCount)??null}set displayCount(e){this._set(`displayCount`,Math.min(Math.max(e??3,0),10))}get displayCount(){return this._get(`displayCount`)}get itemDescriptionFieldName(){return this.orderByFieldsFixedCasing[0]?.field||null}get objectId(){return(this.objectIdField&&this.graphic?.attributes?.[this.objectIdField])??null}get objectIdField(){return this.layer?.objectIdField||null}get relatedFeatures(){return this._get(`relatedFeatures`)||new a}get relatedLayer(){let{layer:e,map:t,relationship:n}=this;if(!e?.loaded||!t||!n)return null;let r=e.type===`subtype-sublayer`&&e.parent&&m(e.parent)?e.parent:e;return h(t,r,n)??null}get relatedLayerKeyField(){let{relatedLayer:e,relationshipId:t}=this;return e?.loaded&&t!=null?e.relationships?.find(e=>e.id===t)?.keyField:null}get relatedLayerKeyFields(){let{relatedLayer:e}=this;return e?.loaded?e.relationships?.map(e=>e.keyField).filter(r)??[]:[]}get relationship(){let{relationshipId:e,layer:t}=this;return e!=null&&t?.loaded?t.relationships?.find(({id:t})=>t===e)??null:null}get relationshipKey(){let{relationshipKeyField:e}=this;return(e&&this.graphic?.attributes?.[e])??null}get relationshipKeyField(){return this.relationship?.keyField||null}get relatedFeatureViewModels(){return this._get(`relatedFeatureViewModels`)||new a}get state(){let{_queryAbortController:e,_queryFeatureCountAbortController:t,_queryPageAbortController:n,canQuery:r,_loaded:i,canLoad:a}=this;return t||a&&!i?`loading`:e||n?`querying`:r?`ready`:`disabled`}getRelatedFeatureByObjectId(e){return this.relatedFeatures.find(t=>t.getObjectId()===e)}refresh(){this._queryFeatureCountDebounced().catch(()=>{})}_destroyRelatedFeatureViewModels(){this.relatedFeatureViewModels?.destroyAll()}async _queryFeatureCount(){let{layer:e,relatedLayer:t}=this;await e?.load(),await t?.load();let{_queryFeatureCountAbortController:n,activeCategory:i,canQuery:a,objectId:o,relatedLayerKeyField:s,relationshipId:c,relationshipKey:l,supportsCacheHint:u}=this;if(!a||!e||!t||o==null){this._set(`featureCount`,0),this._set(`allCategories`,null);return}if(t?.type===`subtype-group`&&!i){if(this._set(`featureCount`,0),this._destroyRelatedFeatureViewModels(),this.featurePage=1,this.relatedFeatures.destroyAll(),s&&l!=null){let{default:e}=await import(`../../../smartMapping/statistics/uniqueValues.js`),{uniqueValueInfos:i}=await e({layer:t,sqlWhere:`${s} = '${l}'`,field:t.subtypeField,signal:n?.signal}),a=i.map(({count:e,value:n})=>{let r=t.subtypes?.find(e=>e.code===n)?.name;return n!=null&&r?{count:e,value:n,name:r}:void 0}).filter(r);this._set(`allCategories`,a)}return}let{historicMoment:d,gdbVersion:f}=e,p=new g({cacheHint:u,gdbVersion:f,historicMoment:d,relationshipId:c,returnGeometry:!1,objectIds:[o],where:this._getRelationshipWhereClause(t)}),m=await e.queryRelatedFeaturesCount(p,{signal:n?.signal});this._set(`allCategories`,null),this._set(`featureCount`,m[o]||0)}_getRelationshipWhereClause(e){let{activeCategory:t}=this,n=e.createQuery(),r=`subtypeField`in e?e.subtypeField:void 0,i=t&&r?`${r} = ${t.value}`:void 0,a=n.where;return a&&i?`(${a}) AND (${i})`:a??i}_sliceFeatures(e){let{showAllEnabled:t,displayCount:n}=this;return t?e:n?e.slice(0,n):[]}async _queryPage(){let{relatedFeatures:e,featurePage:t,showAllEnabled:n,_queryPageAbortController:r,featureCount:i}=this;!n||t<2||!i||this.relatedLayer?.type===`subtype-group`&&!this.activeCategory||e.addMany(await this._queryRelatedFeatures({signal:r?.signal}))}async _queryRelatedFeatures(e){let{displayCount:t,featureCount:n,featurePage:r,featuresPerPage:i,layer:a,orderByFieldsFixedCasing:o,relatedLayer:s,relatedLayerKeyFields:c,relationshipId:l,showAllEnabled:u,supportsCacheHint:d}=this,{canQuery:f,objectId:p}=this;if(!f||!a||!s||p==null)return[];let m=u?((r-1)*i+n)%n:0,h=u?i:t,v=s.objectIdField,b=`subtypeField`in s?s.subtypeField:void 0,x=[...o.map(e=>e.field),..._(s),...c,v,b].filter(y),S=o.map(e=>`${e.field} ${e.order}`),{historicMoment:C,gdbVersion:w}=a,T=new g({orderByFields:S,start:m,num:h,outFields:x,cacheHint:d,historicMoment:C,gdbVersion:w,relationshipId:l,returnGeometry:!1,objectIds:[p],where:this._getRelationshipWhereClause(s)}),E=(await a.queryRelatedFeatures(T,{signal:e?.signal}))[p]?.features||[];return s.type===`subtype-group`&&b?E.forEach(e=>{let t=e.attributes[b],n=s.findSublayerForSubtypeCode?.(t);e.sourceLayer=n,e.layer=n}):E.forEach(e=>{e.sourceLayer=s,e.layer=s}),E}};e([d()],v.prototype,`_loaded`,void 0),e([d()],v.prototype,`_queryAbortController`,void 0),e([d()],v.prototype,`_queryPageAbortController`,void 0),e([d()],v.prototype,`_queryFeatureCountAbortController`,void 0),e([d({value:1})],v.prototype,`featurePage`,null),e([d()],v.prototype,`featuresPerPage`,void 0),e([d({readOnly:!0})],v.prototype,`orderByFieldsFixedCasing`,null),e([d({readOnly:!0})],v.prototype,`supportsCacheHint`,null),e([d({readOnly:!0})],v.prototype,`canLoad`,null),e([d({readOnly:!0})],v.prototype,`canQuery`,null),e([d()],v.prototype,`activeCategory`,void 0),e([d({readOnly:!0})],v.prototype,`allCategories`,void 0),e([d({readOnly:!0})],v.prototype,`allCategoriesCount`,null),e([d({readOnly:!0})],v.prototype,`categories`,null),e([d()],v.prototype,`description`,void 0),e([d({value:3})],v.prototype,`displayCount`,null),e([d({type:t})],v.prototype,`graphic`,void 0),e([d({readOnly:!0})],v.prototype,`itemDescriptionFieldName`,null),e([d()],v.prototype,`layer`,void 0),e([d()],v.prototype,`map`,void 0),e([d({readOnly:!0})],v.prototype,`objectId`,null),e([d({readOnly:!0})],v.prototype,`objectIdField`,null),e([d()],v.prototype,`orderByFields`,void 0),e([d({readOnly:!0})],v.prototype,`relatedFeatures`,null),e([d({readOnly:!0})],v.prototype,`relatedLayer`,null),e([d({readOnly:!0})],v.prototype,`relatedLayerKeyField`,null),e([d({readOnly:!0})],v.prototype,`relatedLayerKeyFields`,null),e([d({readOnly:!0})],v.prototype,`relationship`,null),e([d({readOnly:!0})],v.prototype,`relationshipKey`,null),e([d({readOnly:!0})],v.prototype,`relationshipKeyField`,null),e([d({readOnly:!0})],v.prototype,`featureCount`,void 0),e([d({readOnly:!0})],v.prototype,`relatedFeatureViewModels`,null),e([d()],v.prototype,`relationshipId`,void 0),e([d()],v.prototype,`showAllEnabled`,void 0),e([d()],v.prototype,`state`,null),e([d()],v.prototype,`title`,void 0),v=e([f(`esri.widgets.Feature.FeatureRelationship.FeatureRelationshipViewModel`)],v);function y(e){return e!=null&&e!==``}export{v as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import n from"../../../core/Accessor.js";import{isSome as r}from"../../../core/arrayUtils.js";import{ClonableMixin as i}from"../../../core/Clonable.js";import a from"../../../core/Collection.js";import{IdentifiableMixin as o}from"../../../core/Identifiable.js";import{ignoreAbortErrors as s,debounce as c}from"../../../core/promiseUtils.js";import{watch as l,initial as u}from"../../../core/reactiveUtils.js";import{property as d,subclass as f}from"../../../core/accessorSupport/decorators.js";import{getFixedFieldName as p,isRelatableFeatureSupportedLayer as m,findRelatedLayer as h}from"../../../popup/support/featureUtils.js";import g from"../../../rest/support/RelationshipQuery.js";import{getFieldsInTitleAndDesc as _}from"../../FeatureForm/featureFormUtils.js";let v=class extends i(o(n)){constructor(e){super(e),this._loaded=!1,this._queryAbortController=null,this._queryPageAbortController=null,this._queryFeatureCountAbortController=null,this.featuresPerPage=10,this.activeCategory=null,this.allCategories=null,this.description=null,this.graphic=null,this.layer=null,this.map=null,this.orderByFields=null,this.featureCount=0,this.relationshipId=null,this.showAllEnabled=!1,this.title=null,this._cancelQuery=()=>{let{_queryAbortController:e}=this;e&&e.abort(),this._queryAbortController=null},this._cancelQueryFeatureCount=()=>{let{_queryFeatureCountAbortController:e}=this;e&&e.abort(),this._queryFeatureCountAbortController=null},this._cancelQueryPage=()=>{let{_queryPageAbortController:e}=this;e&&e.abort(),this._queryPageAbortController=null},this._queryController=async()=>{this._cancelQuery();let e=new AbortController;this._queryAbortController=e,await s(this._query()),this._queryAbortController===e&&(this._queryAbortController=null)},this._queryFeatureCountController=async()=>{this._loaded=!1,this._cancelQueryFeatureCount();let e=new AbortController;this._queryFeatureCountAbortController=e,await s(this._queryFeatureCount()),this._queryFeatureCountAbortController===e&&(this._queryFeatureCountAbortController=null),this._loaded=!0},this._queryPageController=async()=>{let e=new AbortController;this._queryPageAbortController=e,await s(this._queryPage()),this._queryPageAbortController===e&&(this._queryPageAbortController=null)},this._queryDebounced=c(this._queryController,100),this._queryFeatureCountDebounced=c(this._queryFeatureCountController,100),this._queryPageDebounced=c(this._queryPageController,100),this._query=async()=>{let{_queryAbortController:e,relatedFeatures:t}=this;this.featureCount&&(this.relatedLayer?.type!==`subtype-group`||this.activeCategory)&&(this._destroyRelatedFeatureViewModels(),this.featurePage=1,t.destroyAll(),this.destroyed||t.addMany(this._sliceFeatures(await this._queryRelatedFeatures({signal:e?.signal}))))},this.addHandles([l(()=>[this.displayCount,this.graphic,this.layer,this.layer?.loaded,this.map,this.orderByFields,this.relationshipId,this.featuresPerPage,this.showAllEnabled,this.canQuery,this.featureCount,this.activeCategory],()=>this._queryDebounced().catch(()=>{}),u),l(()=>[this.featurePage,this.showAllEnabled],()=>this._queryPageDebounced().catch(()=>{})),l(()=>[this.layer,this.relationshipId,this.objectId,this.canQuery,this.activeCategory],()=>this._queryFeatureCountDebounced().catch(()=>{}))])}destroy(){this._destroyRelatedFeatureViewModels(),this.relatedFeatures.destroyAll(),this._cancelQuery(),this._cancelQueryFeatureCount(),this._cancelQueryPage()}set featurePage(e){let{featuresPerPage:t,featureCount:n}=this,r=Math.ceil(n/t)||1;this._set(`featurePage`,Math.min(Math.max(e,1),r))}get featurePage(){return this._get(`featurePage`)}get orderByFieldsFixedCasing(){let{orderByFields:e,relatedLayer:t}=this;return e&&t?.loaded?e.map(e=>{let n=e.clone();return n.field=p(e.field,t),n}):e??[]}get supportsCacheHint(){return!!this.layer?.capabilities?.queryRelated?.supportsCacheHint}get canLoad(){return!!this.map&&this.relationshipId!=null&&typeof this.objectId==`number`}get canQuery(){let e=this.layer?.capabilities?.queryRelated;return!!this.relatedLayer&&!!this.relationship&&this.relationshipId!=null&&this.objectId!=null&&!!e?.supportsCount&&!!e?.supportsPagination}get allCategoriesCount(){return this.allCategories?.length??0}get categories(){let{allCategories:e}=this;return this.showAllEnabled?e:e?.slice(0,this.displayCount)??null}set displayCount(e){this._set(`displayCount`,Math.min(Math.max(e??3,0),10))}get displayCount(){return this._get(`displayCount`)}get itemDescriptionFieldName(){return this.orderByFieldsFixedCasing[0]?.field||null}get objectId(){return(this.objectIdField&&this.graphic?.attributes?.[this.objectIdField])??null}get objectIdField(){return this.layer?.objectIdField||null}get relatedFeatures(){return this._get(`relatedFeatures`)||new a}get relatedLayer(){let{layer:e,map:t,relationship:n}=this;if(!e?.loaded||!t||!n)return null;let r=e.type===`subtype-sublayer`&&e.parent&&m(e.parent)?e.parent:e;return h(t,r,n)??null}get relatedLayerKeyField(){let{relatedLayer:e,relationshipId:t}=this;return e?.loaded&&t!=null?e.relationships?.find(e=>e.id===t)?.keyField:null}get relatedLayerKeyFields(){let{relatedLayer:e}=this;return e?.loaded?e.relationships?.map(e=>e.keyField).filter(r)??[]:[]}get relationship(){let{relationshipId:e,layer:t}=this;return e!=null&&t?.loaded?t.relationships?.find(({id:t})=>t===e)??null:null}get relationshipKey(){let{relationshipKeyField:e}=this;return(e&&this.graphic?.attributes?.[e])??null}get relationshipKeyField(){return this.relationship?.keyField||null}get relatedFeatureViewModels(){return this._get(`relatedFeatureViewModels`)||new a}get state(){let{_queryAbortController:e,_queryFeatureCountAbortController:t,_queryPageAbortController:n,canQuery:r,_loaded:i,canLoad:a}=this;return t||a&&!i?`loading`:e||n?`querying`:r?`ready`:`disabled`}getRelatedFeatureByObjectId(e){return this.relatedFeatures.find(t=>t.getObjectId()===e)}refresh(){this._queryFeatureCountDebounced().catch(()=>{})}_destroyRelatedFeatureViewModels(){this.relatedFeatureViewModels?.destroyAll()}async _queryFeatureCount(){let{layer:e,relatedLayer:t}=this;await e?.load(),await t?.load();let{_queryFeatureCountAbortController:n,activeCategory:i,canQuery:a,objectId:o,relatedLayerKeyField:s,relationshipId:c,relationshipKey:l,supportsCacheHint:u}=this;if(!a||!e||!t||o==null){this._set(`featureCount`,0),this._set(`allCategories`,null);return}if(t?.type===`subtype-group`&&!i){if(this._set(`featureCount`,0),this._destroyRelatedFeatureViewModels(),this.featurePage=1,this.relatedFeatures.destroyAll(),s&&l!=null){let{default:e}=await import(`../../../smartMapping/statistics/uniqueValues.js`),{uniqueValueInfos:i}=await e({layer:t,sqlWhere:`${s} = '${l}'`,field:t.subtypeField,signal:n?.signal}),a=i.map(({count:e,value:n})=>{let r=t.subtypes?.find(e=>e.code===n)?.name;return n!=null&&r?{count:e,value:n,name:r}:void 0}).filter(r);this._set(`allCategories`,a)}return}let{historicMoment:d,gdbVersion:f}=e,p=new g({cacheHint:u,gdbVersion:f,historicMoment:d,relationshipId:c,returnGeometry:!1,objectIds:[o],where:this._getRelationshipWhereClause(t)}),m=await e.queryRelatedFeaturesCount(p,{signal:n?.signal});this._set(`allCategories`,null),this._set(`featureCount`,m[o]||0)}_getRelationshipWhereClause(e){let{activeCategory:t}=this,n=e.createQuery(),r=`subtypeField`in e?e.subtypeField:void 0,i=t&&r?`${r} = ${t.value}`:void 0,a=n.where;return a&&i?`(${a}) AND (${i})`:a??i}_sliceFeatures(e){let{showAllEnabled:t,displayCount:n}=this;return t?e:n?e.slice(0,n):[]}async _queryPage(){let{relatedFeatures:e,featurePage:t,showAllEnabled:n,_queryPageAbortController:r,featureCount:i}=this;!n||t<2||!i||this.relatedLayer?.type===`subtype-group`&&!this.activeCategory||e.addMany(await this._queryRelatedFeatures({signal:r?.signal}))}async _queryRelatedFeatures(e){let{displayCount:t,featureCount:n,featurePage:r,featuresPerPage:i,layer:a,orderByFieldsFixedCasing:o,relatedLayer:s,relatedLayerKeyFields:c,relationshipId:l,showAllEnabled:u,supportsCacheHint:d}=this,{canQuery:f,objectId:p}=this;if(!f||!a||!s||p==null)return[];let m=u?((r-1)*i+n)%n:0,h=u?i:t,v=s.objectIdField,b=`subtypeField`in s?s.subtypeField:void 0,x=[...o.map(e=>e.field),..._(s),...c,v,b].filter(y),S=o.map(e=>`${e.field} ${e.order}`),{historicMoment:C,gdbVersion:w}=a,T=new g({orderByFields:S,start:m,num:h,outFields:x,cacheHint:d,historicMoment:C,gdbVersion:w,relationshipId:l,returnGeometry:!1,objectIds:[p],where:this._getRelationshipWhereClause(s)}),E=(await a.queryRelatedFeatures(T,{signal:e?.signal}))[p]?.features||[];return s.type===`subtype-group`&&b?E.forEach(e=>{let t=e.attributes[b],n=s.findSublayerForSubtypeCode?.(t);e.sourceLayer=n,e.layer=n}):E.forEach(e=>{e.sourceLayer=s,e.layer=s}),E}};e([d()],v.prototype,`_loaded`,void 0),e([d()],v.prototype,`_queryAbortController`,void 0),e([d()],v.prototype,`_queryPageAbortController`,void 0),e([d()],v.prototype,`_queryFeatureCountAbortController`,void 0),e([d({value:1})],v.prototype,`featurePage`,null),e([d()],v.prototype,`featuresPerPage`,void 0),e([d({readOnly:!0})],v.prototype,`orderByFieldsFixedCasing`,null),e([d({readOnly:!0})],v.prototype,`supportsCacheHint`,null),e([d({readOnly:!0})],v.prototype,`canLoad`,null),e([d({readOnly:!0})],v.prototype,`canQuery`,null),e([d()],v.prototype,`activeCategory`,void 0),e([d({readOnly:!0})],v.prototype,`allCategories`,void 0),e([d({readOnly:!0})],v.prototype,`allCategoriesCount`,null),e([d({readOnly:!0})],v.prototype,`categories`,null),e([d()],v.prototype,`description`,void 0),e([d({value:3})],v.prototype,`displayCount`,null),e([d({type:t})],v.prototype,`graphic`,void 0),e([d({readOnly:!0})],v.prototype,`itemDescriptionFieldName`,null),e([d()],v.prototype,`layer`,void 0),e([d()],v.prototype,`map`,void 0),e([d({readOnly:!0})],v.prototype,`objectId`,null),e([d({readOnly:!0})],v.prototype,`objectIdField`,null),e([d()],v.prototype,`orderByFields`,void 0),e([d({readOnly:!0})],v.prototype,`relatedFeatures`,null),e([d({readOnly:!0})],v.prototype,`relatedLayer`,null),e([d({readOnly:!0})],v.prototype,`relatedLayerKeyField`,null),e([d({readOnly:!0})],v.prototype,`relatedLayerKeyFields`,null),e([d({readOnly:!0})],v.prototype,`relationship`,null),e([d({readOnly:!0})],v.prototype,`relationshipKey`,null),e([d({readOnly:!0})],v.prototype,`relationshipKeyField`,null),e([d({readOnly:!0})],v.prototype,`featureCount`,void 0),e([d({readOnly:!0})],v.prototype,`relatedFeatureViewModels`,null),e([d()],v.prototype,`relationshipId`,void 0),e([d()],v.prototype,`showAllEnabled`,void 0),e([d()],v.prototype,`state`,null),e([d()],v.prototype,`title`,void 0),v=e([f(`esri.widgets.Feature.FeatureRelationship.FeatureRelationshipViewModel`)],v);function y(e){return e!=null&&e!==``}export{v as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../Graphic.js";import n from"../../core/Accessor.js";import{createTask as r}from"../../core/asyncUtils.js";import i from"../../core/Collection.js";import{abortMaybe as a}from"../../core/maybe.js";import{ignoreAbortErrors as o,debounce as s}from"../../core/promiseUtils.js";import{watch as c,initial as l}from"../../core/reactiveUtils.js";import{sqlAnd as u}from"../../core/sql.js";import{property as d,subclass as f}from"../../core/accessorSupport/decorators.js";import{UpdatingHandles as p}from"../../core/support/UpdatingHandles.js";import{getGraphicLayer as m}from"../../graphic/graphicOriginUtils.js";import{isLayerFromCatalog as h}from"../../layers/catalog/catalogUtils.js";import{isSubtypeGroupLayer as g,isKnowledgeGraphLayer as _,isMapImageLayer as v,isSubtypeSublayer as y}from"../../layers/support/layerUtils.js";import{isAssociatedFeatureSupportedLayer as b}from"../../popup/support/featureUtils.js";import{createAssociation as x}from"../support/UtilityNetworkAssociations/utils/createAssociation.js";import{getFeatureTitle as S}from"../support/UtilityNetworkAssociations/utils/getFeatureTitle.js";const C=`association-key`;let w=class extends n{constructor(e){super(e),this.graphic=null,this.layer=null,this.map=null,this.utilityNetwork=null,this.associationType=null,this.featureCount=0,this.featureSpatialItems=new i,this.highlightHelper=null,this._queryAbortController=null,this._queryPageAbortController=null,this._queryFeatureCountAbortController=null,this.featuresPerPage=30,this.selectedFeature=null,this.association=null,this.filterOptionsVisible=!1,this.filterWhereClause=null,this._rulesTable=null,this._canAssociate=!1,this._whereClause=null,this._setUpItemsTask=null,this._updatingHandlesSetUp=new p,this._queryFeaturesTask=null,this._updatingHandlesQueryFeatures=new p,this._validateAssociationTask=null,this._updatingHandlesAssociation=new p,this._featureIsNotSelected=e=>(this.globalIdField?e.attributes?.[this.globalIdField]??null:null)!==this.globalId,this._cancelQuery=()=>{let{_queryAbortController:e}=this;e&&e.abort(),this._queryAbortController=null},this._cancelQueryFeatureCount=()=>{let{_queryFeatureCountAbortController:e}=this;e&&e.abort(),this._queryFeatureCountAbortController=null},this._cancelQueryPage=()=>{let{_queryPageAbortController:e}=this;e&&e.abort(),this._queryPageAbortController=null},this._queryController=async()=>{this._cancelQuery();let e=new AbortController;this._queryAbortController=e,await o(this._query()).catch(()=>this._cancelQuery()),this._queryAbortController===e&&(this._queryAbortController=null)},this._queryFeatureCountController=async e=>{this._cancelQueryFeatureCount();let t=new AbortController;this._queryFeatureCountAbortController=t,await o(this._queryFeatureCount(e)).catch(()=>this._cancelQueryFeatureCount()),this._queryFeatureCountAbortController===t&&(this._queryFeatureCountAbortController=null)},this._queryPageController=async()=>{let e=new AbortController;this._queryPageAbortController=e,await o(this._queryPage()).catch(()=>this._cancelQueryPage()),this._queryPageAbortController===e&&(this._queryPageAbortController=null)},this._queryDebounced=s(this._queryController,100),this._queryFeatureCountDebounced=s(this._queryFeatureCountController,100),this._queryPageDebounced=s(this._queryPageController,100)}initialize(){this.addHandles([c(()=>[this.graphic,this.layer,this.map,this.utilityNetwork,this.globalId,this.associationType],()=>this._syncLayerItems(),l),c(()=>[this.selectedLayer,this.filterWhereClause,this.featuresPerPage],()=>{this.selectedLayer&&this._setUpFeatures()}),c(()=>this.selectedFeature,()=>{this._setUpAssociation()}),c(()=>this.featurePage,()=>this._queryPageDebounced())])}destroy(){this._setUpItemsTask=a(this._setUpItemsTask),this._updatingHandlesSetUp.destroy(),this._queryFeaturesTask=a(this._queryFeaturesTask),this._updatingHandlesQueryFeatures.destroy(),this._validateAssociationTask=a(this._validateAssociationTask),this._updatingHandlesAssociation.destroy(),this._cancelQuery(),this._cancelQueryFeatureCount(),this._cancelQueryPage()}get mapTables(){let{map:e}=this;if(!e)return null;let t=new Set;return e.allTables.forEach(e=>this._collectIfValidParent(e,t)),new i([...t])}get mapLayers(){let{map:e}=this;if(!e)return null;let t=new Set;return e.allLayers.forEach(e=>this._collectIfValidParent(e,t)),new i([...t])}get state(){let{canLoadLayers:e,_queryAbortController:t,_queryPageAbortController:n}=this;return e?t||n||this._updatingHandlesQueryFeatures.updating?`querying`:this._updatingHandlesSetUp.updating?`loading`:`ready`:`disabled`}get canAddAssociation(){return this.updating||!this.association?!1:this._canAssociate}get globalId(){return(this.globalIdField&&this.graphic?.attributes?.[this.globalIdField])??null}get globalIdField(){let{layer:e}=this;return e?.globalIdField??null}get layerItems(){return this._get(`layerItems`)||new i}get tableItems(){return this._get(`tableItems`)||new i}get featureItems(){return this._get(`featureItems`)||new i}set featurePage(e){let{featuresPerPage:t,featureCount:n,featureSpatialItems:r}=this,i=r.length||n,a=Math.ceil(i/t)||1;this._set(`featurePage`,Math.min(Math.max(e,1),a))}get featurePage(){return this._get(`featurePage`)}get canLoadLayers(){let{map:e,utilityNetwork:t,graphic:n,associationType:r}=this;return!!e&&!!t&&!!n&&!!r}get canQuery(){let{utilityNetwork:e,graphic:t,associationType:n,selectedLayer:r}=this;return!!e&&!!t&&!!n&&!!r}get updating(){return this._updatingHandlesSetUp.updating||this._updatingHandlesAssociation.updating}get selectedLayer(){return this._get(`selectedLayer`)}set selectedLayer(e){e!==this.selectedLayer&&(this.filterWhereClause=null),this._set(`selectedLayer`,e)}get queryWhereClause(){let{_whereClause:e,filterWhereClause:t}=this;return u(e,t)}async onSelectionComplete(e){let{associationType:t,featureSpatialItems:n,graphic:r,_rulesTable:i}=this,{selection:a}=e;if(n.removeAll(),!t||!r||!i||!a?.length)return;let o=this._convertTypeToDirection(t.type),s=a.filter(this._featureIsNotSelected),c=i.getFeaturesCanAssociateWith(r,s,o),l=await this._processFeatures(c);n.addMany(l)}reset(){this.highlightHelper?.removeAll(),this.featureSpatialItems.removeAll(),this.featurePage=1}_collectIfValidLayer(e,t){b(e)&&!g(e)&&t.add(e)}_collectIfValidParent(e,t){let n=e=>this._collectIfValidLayer(e,t);h(e)||e.type===`catalog-footprint`||(_(e)?(e.layers?.forEach(n),e.tables?.forEach(n)):v(e)?(e.sublayers?.forEach(n),e.subtables?.forEach(n)):g(e)?e.sublayers?.forEach(n):this._collectIfValidLayer(e,t))}async _queryFeatureCount(e){let{selectedLayer:t,_queryFeatureCountAbortController:n}=this;if(this._set(`featureCount`,0),!t)return;await t.load();let r=t.createQuery();r.returnGeometry=!1,r.where=u(r.where,e);let i=await t.queryFeatureCount(r,{signal:n?.signal});i>0&&this._set(`featureCount`,i)}async _query(){let{canQuery:e,queryWhereClause:t,_queryAbortController:n,featureItems:r}=this;e&&(this.featurePage=1,r.destroyAll(),this.featureCount&&!this.destroyed&&r.addMany(await this._queryAssociatedFeatures(t,{signal:n?.signal})))}async _queryPage(){let{canQuery:e,queryWhereClause:t,featurePage:n,_queryPageAbortController:r,featureCount:i,featureItems:a}=this;e&&(n<2||!i||a.addMany(await this._queryAssociatedFeatures(t,{signal:r?.signal})))}_convertTypeToDirection(e){switch(e){case`attachment`:return[{type:`attachment`,direction:`from`}];case`connectivity`:return[{type:`junction-junction-connectivity`},{type:`junction-edge-from-connectivity`},{type:`junction-edge-midspan-connectivity`},{type:`junction-edge-to-connectivity`}];case`container`:return[{type:`containment`,direction:`to`}];case`content`:return[{type:`containment`,direction:`from`}];case`structure`:return[{type:`attachment`,direction:`to`}]}}async getRulesTable(){let{utilityNetwork:e}=this;if(!e)return null;if(this._rulesTable)return this._rulesTable;let t=await e.getRulesTable();return await t?.load(),this._rulesTable=t,t}async _syncLayerItems(){a(this._setUpItemsTask);let{graphic:e,associationType:t,layerItems:n,tableItems:i,canLoadLayers:o}=this,s=r(async r=>{if(this.selectedLayer=null,n.removeAll(),i.removeAll(),!o)return;let a=this.mapLayers?.toArray(),s=this.mapTables?.toArray();if(!a&&!s||r.aborted)return;let c=await this.getRulesTable(),l=this._convertTypeToDirection(t.type);if(a?.length){let t=c?.getLayersCanAssociateWith(e,a,l);if(r.aborted)return;n.addMany(t||[])}if(s?.length){let t=c?.getLayersCanAssociateWith(e,s,l);if(r.aborted)return;i.addMany(t||[])}});this._updatingHandlesSetUp.consumePromise(s.promise),this._setUpItemsTask=s}async _setUpFeatures(){a(this._queryFeaturesTask);let{graphic:e,associationType:t,selectedLayer:n,canQuery:i}=this;if(!i)return;let o=r(async r=>{let i=await this.getRulesTable(),a=this._convertTypeToDirection(t.type),o=i?.getFeaturesCanAssociateWithClause(e,n,a);this._whereClause=o,!r.aborted&&(await this._queryFeatureCountDebounced(this.queryWhereClause),await this._queryDebounced())});this._updatingHandlesQueryFeatures.consumePromise(o.promise),this._queryFeaturesTask=o}_determineFromAndTo(e,t,n){return n===`from`?{fromFeature:e,toFeature:t}:{fromFeature:t,toFeature:e}}_determineJunctionEdgeConnectivity(e,t){let{utilityNetwork:n}=this,r=m(e),i=y(r)?r.parent:r,a=m(t),o=y(a)?a.parent:a;if(!n||!i||!(`layerId`in i)||!o||!(`layerId`in o))return{fromFeature:e,toFeature:t,type:`junction-junction-connectivity`};let s=n.getSourceIdByLayerId(i.layerId),c=n.getSourceIdByLayerId(o.layerId);if(!s||!c)return{fromFeature:e,toFeature:t,type:`junction-junction-connectivity`};let l=n.getSourceTypeById(s)===`junction`,u=n.getSourceTypeById(c)===`junction`;return l&&u?{fromFeature:e,toFeature:t,type:`junction-junction-connectivity`}:u?{fromFeature:t,toFeature:e,type:`junction-edge-midspan-connectivity`}:{fromFeature:e,toFeature:t,type:`junction-edge-midspan-connectivity`}}_setUpAssociationHandles(){this.removeHandles(C),this.association&&this.addHandles(c(()=>[this.association?.associationType,this.association?.fromNetworkElement,this.association?.fromNetworkElement?.terminalId,this.association?.toNetworkElement,this.association?.toNetworkElement?.terminalId],()=>this.validateAssociation(),l),C)}_setUpAssociation(){let{utilityNetwork:e,graphic:t,selectedFeature:n,associationType:r}=this;if(!e||!t||!n||!r){this.association=null;return}let i=this._convertTypeToDirection(r.type);if(i.length>1){let{fromFeature:r,toFeature:i,type:a}=this._determineJunctionEdgeConnectivity(t,n.feature);this.association=x({fromFeature:r,toFeature:i,utilityNetwork:e,associationType:a}),this._setUpAssociationHandles();return}let{fromFeature:a,toFeature:o}=this._determineFromAndTo(t,n.feature,i[0].direction);this.association=x({fromFeature:a,toFeature:o,utilityNetwork:e,associationType:i[0].type}),this._setUpAssociationHandles()}async _processFeatures(e){return Promise.all(e.map(async e=>{let{sourceLayer:t}=e;return t&&`getFeatureTitle`in t?{label:await t.getFeatureTitle(e)||S(e),feature:e}:{label:S(e),feature:e}}))}async _queryAssociatedFeatures(e,t){let{featuresPerPage:n,layer:r,featurePage:i,featureCount:a,selectedLayer:o}=this,{canQuery:s,globalId:c}=this;if(!s||!r||!o||c==null)return[];let l=((i-1)*n+a)%a,d=n,f=o.createQuery();f.where=u(f.where,e),f.start=l,f.num=d,f.returnGeometry=!1,f.outFields=[`*`];let p=await o.queryFeatures(f,{signal:t?.signal});return await this._processFeatures(p.features)}validateAssociation(){a(this._validateAssociationTask);let{utilityNetwork:e,association:t}=this,n=r(async()=>{e&&t&&(this._canAssociate=await e.canAddAssociation(t))});this._updatingHandlesAssociation.consumePromise(n.promise),this._validateAssociationTask=n}};e([d({type:t})],w.prototype,`graphic`,void 0),e([d()],w.prototype,`layer`,void 0),e([d()],w.prototype,`map`,void 0),e([d({readOnly:!0})],w.prototype,`mapTables`,null),e([d({readOnly:!0})],w.prototype,`mapLayers`,null),e([d()],w.prototype,`utilityNetwork`,void 0),e([d()],w.prototype,`associationType`,void 0),e([d()],w.prototype,`state`,null),e([d({readOnly:!0})],w.prototype,`canAddAssociation`,null),e([d({readOnly:!0})],w.prototype,`globalId`,null),e([d({readOnly:!0})],w.prototype,`globalIdField`,null),e([d()],w.prototype,`featureCount`,void 0),e([d({readOnly:!0})],w.prototype,`layerItems`,null),e([d({readOnly:!0})],w.prototype,`tableItems`,null),e([d({readOnly:!0})],w.prototype,`featureItems`,null),e([d()],w.prototype,`featureSpatialItems`,void 0),e([d()],w.prototype,`highlightHelper`,void 0),e([d()],w.prototype,`_queryAbortController`,void 0),e([d()],w.prototype,`_queryPageAbortController`,void 0),e([d()],w.prototype,`_queryFeatureCountAbortController`,void 0),e([d({value:1})],w.prototype,`featurePage`,null),e([d()],w.prototype,`featuresPerPage`,void 0),e([d({readOnly:!0})],w.prototype,`canLoadLayers`,null),e([d({readOnly:!0})],w.prototype,`canQuery`,null),e([d({readOnly:!0})],w.prototype,`updating`,null),e([d()],w.prototype,`selectedLayer`,null),e([d()],w.prototype,`selectedFeature`,void 0),e([d()],w.prototype,`association`,void 0),e([d()],w.prototype,`filterOptionsVisible`,void 0),e([d()],w.prototype,`filterWhereClause`,void 0),e([d()],w.prototype,`queryWhereClause`,null),e([d()],w.prototype,`_rulesTable`,void 0),e([d()],w.prototype,`_canAssociate`,void 0),e([d()],w.prototype,`_whereClause`,void 0),w=e([f(`esri.widgets.FeatureForm.UtilityNetworkAssociationAddAssociationViewModel`)],w);export{w as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../Graphic.js";import n from"../../core/Accessor.js";import{createTask as r}from"../../core/asyncUtils.js";import i from"../../core/Collection.js";import{abortMaybe as a}from"../../core/maybe.js";import{ignoreAbortErrors as o,debounce as s}from"../../core/promiseUtils.js";import{watch as c,initial as l}from"../../core/reactiveUtils.js";import{sqlAnd as u}from"../../core/sql.js";import{property as d,subclass as f}from"../../core/accessorSupport/decorators.js";import{UpdatingHandles as p}from"../../core/support/UpdatingHandles.js";import{getGraphicLayer as m}from"../../graphic/graphicOriginUtils.js";import{isLayerFromCatalog as h}from"../../layers/catalog/catalogUtils.js";import{isSubtypeGroupLayer as g,isKnowledgeGraphLayer as _,isMapImageLayer as v,isSubtypeSublayer as y}from"../../layers/support/layerUtils.js";import{isAssociatedFeatureSupportedLayer as b}from"../../popup/support/featureUtils.js";import{createAssociation as x}from"../support/UtilityNetworkAssociations/utils/createAssociation.js";import{getFeatureTitle as S}from"../support/UtilityNetworkAssociations/utils/getFeatureTitle.js";const C=`association-key`;let w=class extends n{constructor(e){super(e),this.graphic=null,this.layer=null,this.map=null,this.utilityNetwork=null,this.associationType=null,this.featureCount=0,this.featureSpatialItems=new i,this.highlightHelper=null,this._queryAbortController=null,this._queryPageAbortController=null,this._queryFeatureCountAbortController=null,this.featuresPerPage=30,this.selectedFeature=null,this.association=null,this.filterOptionsVisible=!1,this.filterWhereClause=null,this._rulesTable=null,this._canAssociate=!1,this._whereClause=null,this._setUpItemsTask=null,this._updatingHandlesSetUp=new p,this._queryFeaturesTask=null,this._updatingHandlesQueryFeatures=new p,this._validateAssociationTask=null,this._updatingHandlesAssociation=new p,this._featureIsNotSelected=e=>(this.globalIdField?e.attributes?.[this.globalIdField]??null:null)!==this.globalId,this._cancelQuery=()=>{let{_queryAbortController:e}=this;e&&e.abort(),this._queryAbortController=null},this._cancelQueryFeatureCount=()=>{let{_queryFeatureCountAbortController:e}=this;e&&e.abort(),this._queryFeatureCountAbortController=null},this._cancelQueryPage=()=>{let{_queryPageAbortController:e}=this;e&&e.abort(),this._queryPageAbortController=null},this._queryController=async()=>{this._cancelQuery();let e=new AbortController;this._queryAbortController=e,await o(this._query()).catch(()=>this._cancelQuery()),this._queryAbortController===e&&(this._queryAbortController=null)},this._queryFeatureCountController=async e=>{this._cancelQueryFeatureCount();let t=new AbortController;this._queryFeatureCountAbortController=t,await o(this._queryFeatureCount(e)).catch(()=>this._cancelQueryFeatureCount()),this._queryFeatureCountAbortController===t&&(this._queryFeatureCountAbortController=null)},this._queryPageController=async()=>{let e=new AbortController;this._queryPageAbortController=e,await o(this._queryPage()).catch(()=>this._cancelQueryPage()),this._queryPageAbortController===e&&(this._queryPageAbortController=null)},this._queryDebounced=s(this._queryController,100),this._queryFeatureCountDebounced=s(this._queryFeatureCountController,100),this._queryPageDebounced=s(this._queryPageController,100)}initialize(){this.addHandles([c(()=>[this.graphic,this.layer,this.map,this.utilityNetwork,this.globalId,this.associationType],()=>this._syncLayerItems(),l),c(()=>[this.selectedLayer,this.filterWhereClause,this.featuresPerPage],()=>{this.selectedLayer&&this._setUpFeatures()}),c(()=>this.selectedFeature,()=>{this._setUpAssociation()}),c(()=>this.featurePage,()=>this._queryPageDebounced())])}destroy(){this._setUpItemsTask=a(this._setUpItemsTask),this._updatingHandlesSetUp.destroy(),this._queryFeaturesTask=a(this._queryFeaturesTask),this._updatingHandlesQueryFeatures.destroy(),this._validateAssociationTask=a(this._validateAssociationTask),this._updatingHandlesAssociation.destroy(),this._cancelQuery(),this._cancelQueryFeatureCount(),this._cancelQueryPage()}get mapTables(){let{map:e}=this;if(!e)return null;let t=new Set;return e.allTables.forEach(e=>this._collectIfValidParent(e,t)),new i([...t])}get mapLayers(){let{map:e}=this;if(!e)return null;let t=new Set;return e.allLayers.forEach(e=>this._collectIfValidParent(e,t)),new i([...t])}get state(){let{canLoadLayers:e,_queryAbortController:t,_queryPageAbortController:n}=this;return e?t||n||this._updatingHandlesQueryFeatures.updating?`querying`:this._updatingHandlesSetUp.updating?`loading`:`ready`:`disabled`}get canAddAssociation(){return this.updating||!this.association?!1:this._canAssociate}get globalId(){return(this.globalIdField&&this.graphic?.attributes?.[this.globalIdField])??null}get globalIdField(){let{layer:e}=this;return e?.globalIdField??null}get layerItems(){return this._get(`layerItems`)||new i}get tableItems(){return this._get(`tableItems`)||new i}get featureItems(){return this._get(`featureItems`)||new i}set featurePage(e){let{featuresPerPage:t,featureCount:n,featureSpatialItems:r}=this,i=r.length||n,a=Math.ceil(i/t)||1;this._set(`featurePage`,Math.min(Math.max(e,1),a))}get featurePage(){return this._get(`featurePage`)}get canLoadLayers(){let{map:e,utilityNetwork:t,graphic:n,associationType:r}=this;return!!e&&!!t&&!!n&&!!r}get canQuery(){let{utilityNetwork:e,graphic:t,associationType:n,selectedLayer:r}=this;return!!e&&!!t&&!!n&&!!r}get updating(){return this._updatingHandlesSetUp.updating||this._updatingHandlesAssociation.updating}get selectedLayer(){return this._get(`selectedLayer`)}set selectedLayer(e){e!==this.selectedLayer&&(this.filterWhereClause=null),this._set(`selectedLayer`,e)}get queryWhereClause(){let{_whereClause:e,filterWhereClause:t}=this;return u(e,t)}async onSelectionComplete(e){let{associationType:t,featureSpatialItems:n,graphic:r,_rulesTable:i}=this,{selection:a}=e;if(n.removeAll(),!t||!r||!i||!a?.length)return;let o=this._convertTypeToDirection(t.type),s=a.filter(this._featureIsNotSelected),c=i.getFeaturesCanAssociateWith(r,s,o),l=await this._processFeatures(c);n.addMany(l)}reset(){this.highlightHelper?.removeAll(),this.featureSpatialItems.removeAll(),this.featurePage=1}_collectIfValidLayer(e,t){b(e)&&!g(e)&&t.add(e)}_collectIfValidParent(e,t){let n=e=>this._collectIfValidLayer(e,t);h(e)||e.type===`catalog-footprint`||(_(e)?(e.layers?.forEach(n),e.tables?.forEach(n)):v(e)?(e.sublayers?.forEach(n),e.subtables?.forEach(n)):g(e)?e.sublayers?.forEach(n):this._collectIfValidLayer(e,t))}async _queryFeatureCount(e){let{selectedLayer:t,_queryFeatureCountAbortController:n}=this;if(this._set(`featureCount`,0),!t)return;await t.load();let r=t.createQuery();r.returnGeometry=!1,r.where=u(r.where,e);let i=await t.queryFeatureCount(r,{signal:n?.signal});i>0&&this._set(`featureCount`,i)}async _query(){let{canQuery:e,queryWhereClause:t,_queryAbortController:n,featureItems:r}=this;e&&(this.featurePage=1,r.destroyAll(),this.featureCount&&!this.destroyed&&r.addMany(await this._queryAssociatedFeatures(t,{signal:n?.signal})))}async _queryPage(){let{canQuery:e,queryWhereClause:t,featurePage:n,_queryPageAbortController:r,featureCount:i,featureItems:a}=this;e&&(n<2||!i||a.addMany(await this._queryAssociatedFeatures(t,{signal:r?.signal})))}_convertTypeToDirection(e){switch(e){case`attachment`:return[{type:`attachment`,direction:`from`}];case`connectivity`:return[{type:`junction-junction-connectivity`},{type:`junction-edge-from-connectivity`},{type:`junction-edge-midspan-connectivity`},{type:`junction-edge-to-connectivity`}];case`container`:return[{type:`containment`,direction:`to`}];case`content`:return[{type:`containment`,direction:`from`}];case`structure`:return[{type:`attachment`,direction:`to`}]}}async getRulesTable(){let{utilityNetwork:e}=this;if(!e)return null;if(this._rulesTable)return this._rulesTable;let t=await e.getRulesTable();return await t?.load(),this._rulesTable=t,t}async _syncLayerItems(){a(this._setUpItemsTask);let{graphic:e,associationType:t,layerItems:n,tableItems:i,canLoadLayers:o}=this,s=r(async r=>{if(this.selectedLayer=null,n.removeAll(),i.removeAll(),!o)return;let a=this.mapLayers?.toArray(),s=this.mapTables?.toArray();if(!a&&!s||r.aborted)return;let c=await this.getRulesTable(),l=this._convertTypeToDirection(t.type);if(a?.length){let t=c?.getLayersCanAssociateWith(e,a,l);if(r.aborted)return;n.addMany(t||[])}if(s?.length){let t=c?.getLayersCanAssociateWith(e,s,l);if(r.aborted)return;i.addMany(t||[])}});this._updatingHandlesSetUp.consumePromise(s.promise),this._setUpItemsTask=s}async _setUpFeatures(){a(this._queryFeaturesTask);let{graphic:e,associationType:t,selectedLayer:n,canQuery:i}=this;if(!i)return;let o=r(async r=>{let i=await this.getRulesTable(),a=this._convertTypeToDirection(t.type),o=i?.getFeaturesCanAssociateWithClause(e,n,a);this._whereClause=o,r.aborted||(await this._queryFeatureCountDebounced(this.queryWhereClause),await this._queryDebounced())});this._updatingHandlesQueryFeatures.consumePromise(o.promise),this._queryFeaturesTask=o}_determineFromAndTo(e,t,n){return n===`from`?{fromFeature:e,toFeature:t}:{fromFeature:t,toFeature:e}}_determineJunctionEdgeConnectivity(e,t){let{utilityNetwork:n}=this,r=m(e),i=y(r)?r.parent:r,a=m(t),o=y(a)?a.parent:a;if(!n||!i||!(`layerId`in i)||!o||!(`layerId`in o))return{fromFeature:e,toFeature:t,type:`junction-junction-connectivity`};let s=n.getSourceIdByLayerId(i.layerId),c=n.getSourceIdByLayerId(o.layerId);if(!s||!c)return{fromFeature:e,toFeature:t,type:`junction-junction-connectivity`};let l=n.getSourceTypeById(s)===`junction`,u=n.getSourceTypeById(c)===`junction`;return l&&u?{fromFeature:e,toFeature:t,type:`junction-junction-connectivity`}:u?{fromFeature:t,toFeature:e,type:`junction-edge-midspan-connectivity`}:{fromFeature:e,toFeature:t,type:`junction-edge-midspan-connectivity`}}_setUpAssociationHandles(){this.removeHandles(C),this.association&&this.addHandles(c(()=>[this.association?.associationType,this.association?.fromNetworkElement,this.association?.fromNetworkElement?.terminalId,this.association?.toNetworkElement,this.association?.toNetworkElement?.terminalId],()=>this.validateAssociation(),l),C)}_setUpAssociation(){let{utilityNetwork:e,graphic:t,selectedFeature:n,associationType:r}=this;if(!e||!t||!n||!r){this.association=null;return}let i=this._convertTypeToDirection(r.type);if(i.length>1){let{fromFeature:r,toFeature:i,type:a}=this._determineJunctionEdgeConnectivity(t,n.feature);this.association=x({fromFeature:r,toFeature:i,utilityNetwork:e,associationType:a}),this._setUpAssociationHandles();return}let{fromFeature:a,toFeature:o}=this._determineFromAndTo(t,n.feature,i[0].direction);this.association=x({fromFeature:a,toFeature:o,utilityNetwork:e,associationType:i[0].type}),this._setUpAssociationHandles()}async _processFeatures(e){return Promise.all(e.map(async e=>{let{sourceLayer:t}=e;return t&&`getFeatureTitle`in t?{label:await t.getFeatureTitle(e)||S(e),feature:e}:{label:S(e),feature:e}}))}async _queryAssociatedFeatures(e,t){let{featuresPerPage:n,layer:r,featurePage:i,featureCount:a,selectedLayer:o}=this,{canQuery:s,globalId:c}=this;if(!s||!r||!o||c==null)return[];let l=((i-1)*n+a)%a,d=n,f=o.createQuery();f.where=u(f.where,e),f.start=l,f.num=d,f.returnGeometry=!1,f.outFields=[`*`];let p=await o.queryFeatures(f,{signal:t?.signal});return await this._processFeatures(p.features)}validateAssociation(){a(this._validateAssociationTask);let{utilityNetwork:e,association:t}=this,n=r(async()=>{e&&t&&(this._canAssociate=await e.canAddAssociation(t))});this._updatingHandlesAssociation.consumePromise(n.promise),this._validateAssociationTask=n}};e([d({type:t})],w.prototype,`graphic`,void 0),e([d()],w.prototype,`layer`,void 0),e([d()],w.prototype,`map`,void 0),e([d({readOnly:!0})],w.prototype,`mapTables`,null),e([d({readOnly:!0})],w.prototype,`mapLayers`,null),e([d()],w.prototype,`utilityNetwork`,void 0),e([d()],w.prototype,`associationType`,void 0),e([d()],w.prototype,`state`,null),e([d({readOnly:!0})],w.prototype,`canAddAssociation`,null),e([d({readOnly:!0})],w.prototype,`globalId`,null),e([d({readOnly:!0})],w.prototype,`globalIdField`,null),e([d()],w.prototype,`featureCount`,void 0),e([d({readOnly:!0})],w.prototype,`layerItems`,null),e([d({readOnly:!0})],w.prototype,`tableItems`,null),e([d({readOnly:!0})],w.prototype,`featureItems`,null),e([d()],w.prototype,`featureSpatialItems`,void 0),e([d()],w.prototype,`highlightHelper`,void 0),e([d()],w.prototype,`_queryAbortController`,void 0),e([d()],w.prototype,`_queryPageAbortController`,void 0),e([d()],w.prototype,`_queryFeatureCountAbortController`,void 0),e([d({value:1})],w.prototype,`featurePage`,null),e([d()],w.prototype,`featuresPerPage`,void 0),e([d({readOnly:!0})],w.prototype,`canLoadLayers`,null),e([d({readOnly:!0})],w.prototype,`canQuery`,null),e([d({readOnly:!0})],w.prototype,`updating`,null),e([d()],w.prototype,`selectedLayer`,null),e([d()],w.prototype,`selectedFeature`,void 0),e([d()],w.prototype,`association`,void 0),e([d()],w.prototype,`filterOptionsVisible`,void 0),e([d()],w.prototype,`filterWhereClause`,void 0),e([d()],w.prototype,`queryWhereClause`,null),e([d()],w.prototype,`_rulesTable`,void 0),e([d()],w.prototype,`_canAssociate`,void 0),e([d()],w.prototype,`_whereClause`,void 0),w=e([f(`esri.widgets.FeatureForm.UtilityNetworkAssociationAddAssociationViewModel`)],w);export{w as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{property as t,subclass as n}from"../../core/accessorSupport/decorators.js";import{substitute as r}from"../../intl/substitute.js";import i from"./Grid/Column.js";import{css as a}from"./Grid/ColumnCSS.js";import{isIFeatureTableSupportedLayerWithRelationships as o,findRelationship as s}from"./support/tableUtils.js";const c={showRecordsButton:`esri-column__show-related-records-button`};let l=class extends i{constructor(e){super(e),this.flexGrow=1,this.icon=`relationship-class`,this.layer=null,this.relatedLayer=null,this.relationshipId=null,this.renderFunction=({root:e,rowData:t})=>{if(!t)return;let n=t.item,{layer:i,relatedLayer:s}=this;if(!n?.feature||!o(i)||!o(s))return;let{messages:l}=this,{index:u}=t,{feature:d,objectId:f}=n,{collapsed:p,showRelatedTableCallback:m,relationshipId:h}=this,g=n.relatedRecords?.find(e=>e.relationshipId===h)?.count??0,_=!p&&m&&l?.recordsCount?r(l.recordsCount,{count:g}):`${g}`,v=e=>{e.preventDefault()
|
|
2
|
+
import{__decorate as e}from"tslib";import{property as t,subclass as n}from"../../core/accessorSupport/decorators.js";import{substitute as r}from"../../intl/substitute.js";import i from"./Grid/Column.js";import{css as a}from"./Grid/ColumnCSS.js";import{isIFeatureTableSupportedLayerWithRelationships as o,findRelationship as s}from"./support/tableUtils.js";const c={showRecordsButton:`esri-column__show-related-records-button`};let l=class extends i{constructor(e){super(e),this.flexGrow=1,this.icon=`relationship-class`,this.layer=null,this.relatedLayer=null,this.relationshipId=null,this.renderFunction=({root:e,rowData:t})=>{if(!t)return;let n=t.item,{layer:i,relatedLayer:s}=this;if(!n?.feature||!o(i)||!o(s))return;let{messages:l}=this,{index:u}=t,{feature:d,objectId:f}=n,{collapsed:p,showRelatedTableCallback:m,relationshipId:h}=this,g=n.relatedRecords?.find(e=>e.relationshipId===h)?.count??0,_=!p&&m&&l?.recordsCount?r(l.recordsCount,{count:g}):`${g}`,v=e=>{e.preventDefault(),p||this.showRelatedTableCallback?.({feature:d,index:u,layer:i,objectId:f,relatedLayer:s,relationshipId:h})},y=p?void 0:`chevron-right`;if(e.firstChild){let t=e.firstChild;t.textContent=_,t.onclick=v,y&&(t.iconEnd=y);return}let b=this.createCalciteButton({className:`${c.showRecordsButton} ${a.contentFull}`,iconEnd:y,iconFlipRtl:`both`,scale:`m`,textContent:_,title:_,onclick:v});this.removeCellContent(e),e.appendChild(b)},this.resizable=!0,this.showRelatedTableCallback=null,this.textAlign=`center`,this.width=`200px`}get _relationshipLabel(){return this.label||this.originRelationship?.name||this.layer.title||``}get collapsed(){return this._get(`collapsed`)||!1}set collapsed(e){e?this.set({flexGrow:0,resizable:!1,width:`80px`}):this.set({flexGrow:1,resizable:!0,width:`200px`}),this._set(`collapsed`,e)}get effectiveLabel(){return this.collapsed?``:this._relationshipLabel}get iconNode(){let{icon:e}=this;return e?this.createCalciteIcon({icon:e,textLabel:this._relationshipLabel}):null}get originRelationship(){let e=this.relationshipId;return this.relatedLayer.relationships?.find(({id:t})=>t===e)}get relationship(){return s(this.layer,this.relationshipId)}};e([t()],l.prototype,`_relationshipLabel`,null),e([t()],l.prototype,`collapsed`,null),e([t()],l.prototype,`effectiveLabel`,null),e([t()],l.prototype,`flexGrow`,void 0),e([t()],l.prototype,`icon`,void 0),e([t()],l.prototype,`iconNode`,null),e([t()],l.prototype,`layer`,void 0),e([t()],l.prototype,`originRelationship`,null),e([t()],l.prototype,`relatedLayer`,void 0),e([t()],l.prototype,`relationship`,null),e([t()],l.prototype,`relationshipId`,void 0),e([t()],l.prototype,`renderFunction`,void 0),e([t()],l.prototype,`resizable`,void 0),e([t()],l.prototype,`showRelatedTableCallback`,void 0),e([t()],l.prototype,`textAlign`,void 0),e([t()],l.prototype,`width`,void 0),l=e([n(`esri.widgets.FeatureTable.RelationshipColumn`)],l);const u=l;export{u as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../core/Accessor.js";import{createTask as n}from"../../core/asyncUtils.js";import r from"../../core/Collection.js";import i from"../../core/Error.js";import a from"../../core/Logger.js";import{throwIfAborted as o}from"../../core/promiseUtils.js";import{watch as s,initial as c,syncAndInitial as l}from"../../core/reactiveUtils.js";import{Milliseconds as u}from"../../core/time.js";import{isBlobProtocol as d}from"../../core/urlUtils.js";import{property as f,subclass as p}from"../../core/accessorSupport/decorators.js";import m from"../../geometry/Polygon.js";import h from"../../webdoc/Widgets.js";import g from"../../webdoc/widgets/FloorFilter.js";import{isWebMap as _}from"../../webmap/utils.js";import{GoTo as v}from"../support/GoTo.js";function y(e){return e.declaredClass===`esri.WebScene`}let b=class extends v(t){constructor(e){super(e),this.filterMenuOpen=!1,this.filterMenuType=`site`,this.filterMode=`base-floors`,this.levelsExpanded=!0,this.searchTerm=null,this.view=null,this._updateFloorFilterTask=null,this._viewHeightBreakpoint=null,this._viewWidthBreakpoint=null}initialize(){this.addHandles([s(()=>this.view?.map,e=>{this._updateFloorFilterTask!=null&&(this._updateFloorFilterTask.abort(),this._updateFloorFilterTask=null),this._updateFloorFilterTask=n(async t=>{await this._updateFloorFilterFromMap(e),o(t),this._setInitialViewState(e)}),this._watchMapLayers(e)},c),s(()=>this.view,(e,t)=>{this._unregisterWidget(t),this._registerWidget(e),this._watchSearchResults(e)},l),s(()=>this.mediaLayer,e=>{this._watchLayerVisibility(e)},l),s(()=>this.view?.widthBreakpoint??null,e=>{this._viewWidthBreakpoint=e}),s(()=>this.view?.heightBreakpoint??null,e=>{this._viewHeightBreakpoint=e}),s(()=>this.facility,()=>void this.getOverlays()),s(()=>this.level,e=>this._updateMediaLayer(e))])}destroy(){if(this._unregisterWidget(this.view),this.mediaLayer&&this.view?.map.remove(this.mediaLayer),this.overlaysByLevel){for(let e of this.overlaysByLevel.values()){let t=e.image.image;d(t)&&URL.revokeObjectURL(t)}this.overlaysByFacility?.clear(),this.overlaysByLevel.clear()}this.view=null,this._updateFloorFilterTask!=null&&(this._updateFloorFilterTask.abort(),this._updateFloorFilterTask=null)}set enabled(e){this._callOverride(`enabled`,e)}set facility(e){if(e&&this._isOverridden(`facility`)){let t=this.getFacility(e);this.hasMultipleSites&&(this.site=t?.siteId||null)}this._callOverride(`facility`,e)}set filterFeatures(e){this._callOverride(`filterFeatures`,e)}set filterLayers(e){this._callOverride(`filterLayers`,e)}get floorVisibilityMode(){return this.view&&y(this.view?.map)?this.view.map.widgets?.floorFilter?.floorVisibilityMode??`belowSelected`:`belowSelected`}get hasFacilities(){return this.filterLayers?.facilityLayer!=null&&this.filterFeatures?.facilities?.facilitiesInfo?.length>0}get hasLevels(){return this.filterLayers?.levelLayer!=null&&this.filterFeatures?.levels?.levelsInfo?.length>0}get hasMultipleSites(){return this.filterLayers?.siteLayer!=null&&this.filterFeatures?.sites?.sitesInfo?.length>1}get isNormalMode(){let e=!0,t=this._viewWidthBreakpoint;return(this._viewHeightBreakpoint===`xsmall`||t===`xsmall`)&&(e=!1),e}set level(e){if(!e){this._callOverride(`level`,e),this.facility=null,this.site=null,this.setFloors(null);return}let t=null,n=null,r=e?.split(`--`);r?.length>1&&r[0]===`all`?(n=r[1],t={id:e,facilityId:n,shortName:null,longName:null,levelNumber:null,verticalOrder:null}):(t=this.getLevel(e),n=t?.facilityId??null),this.level===e&&!this.isNormalMode&&!this.levelsExpanded?this.getFacilityLevels(n)?.length>1&&(this.levelsExpanded=!0):(t&&this.hasFacilities&&this.hasLevels?(this.facility=n,this.hasMultipleSites&&(this.site=this.getFacility(n)?.siteId||null),this.setFloors(t)):this._isOverridden(`level`)&&(this.facility=null,this.site=null,this.hasMultipleSites&&(this.filterMenuType=`site`),this.setFloors(null)),this._callOverride(`level`,e))}set longNames(e){this._callOverride(`longNames`,e)}set minimized(e){this._callOverride(`minimized`,e)}set pinnedLevels(e){this._callOverride(`pinnedLevels`,e)}get selectedVerticalOrder(){return _(this.view?.map)?this.view.map.resourceInfo?.widgets?.floorFilter?.selectedVerticalOrder??null:null}set site(e){this._callOverride(`site`,e)}get state(){return this.view&&this.filterFeatures&&this.hasFacilities&&this.hasLevels?`ready`:this.view&&!this.filterFeatures?`loading`:`disabled`}get useVerticalOrder(){return this.view?.map==null?!1:_(this.view?.map)||y(this.view.map)?this.view.map.widgets?.floorFilter?.useVerticalOrder??!1:!1}filterFacilities(e){let t=e;return this.searchTerm&&(this.searchTerm=this.searchTerm.trim(),t=e.filter(e=>{let{name:t}=e;return t.toLowerCase().includes(this.searchTerm?.toLowerCase())})),this.site&&(t=t.filter(e=>e.siteId===this.site)),t.sort((e,t)=>{let n=e.name,r=t.name;return n.localeCompare(r,void 0,{sensitivity:`base`})})}filterSites(e){let t=e;return this.searchTerm&&(this.searchTerm=this.searchTerm.trim(),t=e.filter(e=>{let{name:t}=e;return t.toLowerCase().includes(this.searchTerm?.toLowerCase())})),t.sort((e,t)=>{let n=e.name,r=t.name;return n.localeCompare(r,void 0,{sensitivity:`base`})})}getBaseLevel(e){let t=this.filterFeatures?.levels?.levelsInfo,n=null;if(e){let{id:r}=e;if(t&&t.length>0&&(t.forEach(e=>{e.verticalOrder===0&&e.facilityId===r&&(n=e)}),!n)){let e=null;t.forEach(t=>{t.facilityId===r&&(e?(t.verticalOrder??0)>=0?e.verticalOrder!=null&&(e.verticalOrder<0||(t.verticalOrder??0)<e.verticalOrder)&&(e=t):e.verticalOrder!=null&&t.verticalOrder!=null&&e.verticalOrder<0&&t.verticalOrder>e.verticalOrder&&(e=t):e=t)}),e&&(n=e)}}return n}getFacility(e){return this.filterFeatures?.facilities?.facilitiesInfo?.find(t=>t.id===e)??null}getFacilityLevels(e){return!e||!this.filterFeatures?.levels?.levelsInfo?[]:this.filterFeatures.levels.levelsInfo.filter(t=>t.facilityId===e).sort((e,t)=>{let n=e.verticalOrder??0,r=t.verticalOrder??0;return n>r?-1:n===r?0:1})}getLevel(e){return this.filterFeatures?.levels?.levelsInfo?.find(t=>t.id===e)??null}async getOverlays(e=!1){let{facility:t,level:n,mediaLayer:i,overlaysByFacility:a,overlaysByLevel:o,view:s}=this;if(_(s?.map)&&i){if((i?.source).elements.removeAll(),t?.length&&(!a?.has(t)||e)){a?.set(t,new r);let e=s.map.floorInfo?.levelLayer?.layerId,n=s.map.findLayerById(e??``);if(!n||s.type!==`2d`)return;let i=await this._getAttachments(n,t),{default:c}=await import(`../../request.js`),l=Object.keys(i).map(async e=>{let r=i[e],s=r.find(e=>e.contentType===`application/json`);if(!s?.url)return;let l=new URL(s.url);n.gdbVersion?.length&&l.searchParams.set(`gdbVersion`,n.gdbVersion);let{data:u}=await c(l.toString(),{responseType:`json`}),d=r.find(e=>e.name===u.name),f=d?.url??``;if(f?.length>0){let e=new URL(f);e.searchParams.delete(`token`),n.gdbVersion?.length&&e.searchParams.set(`gdbVersion`,n.gdbVersion);let{default:r}=await import(`../../layers/support/ControlPointsGeoreference.js`),i=r.fromJSON(u.georeference),c=await this.toImageElement(e.toString(),i,u.opacity,u.clipImage,u.geometry);await c.load();let l={...u,attachments:[s,d],facilityId:t,image:c,source:JSON.stringify(u),url:e.toString()};o?.set(l.levelId,l),a?.get(t)?.push(l)}});await Promise.all(l)}this._updateMediaLayer(n)}}getSite(e){return this.filterFeatures?.sites?.sitesInfo?.find(t=>t.id===e)??null}async goTo(e){let{view:t}=this;if(!t||!e)return;let{geometry:n}=e;if(n?.extent){let e=e=>{this.callGoTo({target:e,options:{duration:u(1e3),easing:`quad-in-out-coast`}})};if(n.hasZ&&n.spatialReference?.vcsWkid!==t.spatialReference?.vcsWkid){let{projectIsLoaded:r,projectLoad:i,projectExecute:a}=await import(`../../geometry/operators/projectOperator.js`);r()||await i();let o=a(n.extent,t.spatialReference.clone(),{zConversionDisabled:!0});o&&e(o)}else e(n.extent)}}setFloors(e){let{view:t}=this;t&&(t?.map?.allLayers?.forEach(e=>{e.type===`feature`&&this._computeViewAllModeFloors(e)}),t.floors=new r(this._computeFloors(e)))}async toImageElement(e,t,n,r,i){let{default:o}=await import(`../../layers/support/ImageElement.js`),{facility:s}=this,c=()=>new o({image:e,georeference:t,opacity:n});if(r)try{let r=i?m.fromJSON(i):this.getFacility(s)?.geometry;if(r==null)return c();let{pixelRings:a,width:l,height:u}=await this._polygonToImagePixels(t,r),d=await this._imagePolygonToBlob(e,a,l,u);return new o({image:URL.createObjectURL(d),georeference:t,opacity:n})}catch(e){return a.getLogger(this).warn(`Unable to clip image; using full image instead: ${e.message}`,e),c()}return c()}updateWebDocument(e){if(_(e)||y(e)){let t={enabled:this.enabled,longNames:this.longNames,minimized:this.minimized,pinnedLevels:this.pinnedLevels,site:this.site??null,facility:this.facility??null,level:this.level??null,useVerticalOrder:this.useVerticalOrder,selectedVerticalOrder:this.selectedVerticalOrder};y(e)&&(t.floorVisibilityMode=this.floorVisibilityMode);let n=new g(t);e.widgets??=new h,e.widgets.floorFilter=n}}_computeFloors(e){if(this.filterMode===`single-floor`)this._computeSingleFloor(e);else if(this.filterMode===`base-floors`)return this.view?.type===`3d`?this._computeBaseFloors3D(e):this._computeBaseFloors(e);return this._computeEmptyFloors()}_computeSingleFloor(e){if(!e)return this._computeEmptyFloors();let t=[];return e?.id===`all`?this.getFacilityLevels(e.facilityId).forEach(e=>{e.id&&t.push(e.id)}):e&&t.push(e.id),t}_computeBaseFloors(e){let t=this.filterFeatures?.levels?.levelsInfo;if(!t?.length)return this._computeEmptyFloors();let n=[];e?.id===`all`?this.getFacilityLevels(e.facilityId).forEach(e=>{e.id&&n.push(e.id)}):e&&n.push(e.id);let r=e?.facilityId,i=e?.verticalOrder,a=(e,t)=>{e===0&&n.push(t)};return t.forEach(e=>{let{id:t,facilityId:o,verticalOrder:s}=e;!r&&!n.includes(t)?a(s,t):o!==r&&!n.includes(t)&&(this.useVerticalOrder?s===i&&n.push(t):a(s,t))}),n}_computeBaseFloors3D(e){let t=this.filterFeatures?.levels?.levelsInfo;if(!t?.length)return this._computeEmptyFloors();let n=[],r=e?.id.split(`--`)??[],i=r?.length>1&&r[0]===`all`;i?this.getFacilityLevels(e?.facilityId).forEach(e=>{e.id&&n.push(e.id)}):e&&n.push(e.id);let a=e?.facilityId,o=e?.verticalOrder;return t.forEach(e=>{let{id:t,facilityId:r,verticalOrder:s}=e;if(!a&&!n.includes(t))n.push(t);else if(!n.includes(t)){let{floorVisibilityMode:e,useVerticalOrder:c}=this,l=s<=o;r===a?e===`belowSelected`&&l&&n.push(t):(i||!c||e===`selectedOnly`&&s===o||e===`belowSelected`&&l)&&n.push(t)}}),n}_computeEmptyFloors(){return[]}async _setFilterLayers(){let{view:e}=this;if(e&&!this._isOverridden(`filterLayers`)){if(!_(e.map)&&!y(e.map))throw new i(`floorfilter:unsupported-map`,`Map must be a webmap or webscene`);{let t=e.map,n=t?.allLayers;if(n?.items?.length>0){let e={siteLayer:null,facilityLayer:null,levelLayer:null},r=t.floorInfo?.siteLayer?.layerId,i=t.floorInfo?.facilityLayer?.layerId,a=t.floorInfo?.levelLayer?.layerId,o=t.floorInfo?.siteLayer?.sublayerId||t.floorInfo?.facilityLayer?.sublayerId||t.floorInfo?.levelLayer?.sublayerId;if(!i||!a)return;let s=n.items.filter(e=>e.type===`feature`||e.type===`scene`),c=n.items.filter(e=>e.type===`map-image`);if(c?.length>0&&o){await Promise.all(c.map(e=>e.load()));let n=t.floorInfo?.siteLayer?.sublayerId,o=t.floorInfo?.facilityLayer?.sublayerId,s=t.floorInfo?.levelLayer?.sublayerId;c.forEach(t=>{let c=t.id,l=t?.allSublayers,u=l?.items;(c===r||c===i||c===a)&&u?.length>0&&l.items.forEach(t=>{let i=t.id;c===r&&i===n?e.siteLayer=t:i===o?e.facilityLayer=t:i===s&&(e.levelLayer=t)})})}s?.length>0&&s.forEach(t=>{let n=t.id;n===r?e.siteLayer=t:n===i?e.facilityLayer=t:n===a&&(e.levelLayer=t)}),this.filterLayers=e}}}}async _getAttachments(e,t){let{view:n}=this;if(_(n?.map)){let{facilityIdField:r}=n.map.floorInfo?.levelLayer??{};if(e&&n.type===`2d`&&t?.length>0&&e.capabilities.data.supportsAttachment)return e.queryAttachments({returnMetadata:!0,where:`${r} = '${t}'`})}return{}}async _getFilterFeatures(){if(this._isOverridden(`filterFeatures`))return this.filterFeatures;let[e,t,n]=await Promise.all([this._getSites(),this._getFacilities(),this._getLevels()]);return{sites:e,facilities:t,levels:n}}async _getSites(){let e={sitesInfo:[]},{filterLayers:t,view:n}=this,r=n?.map,{siteLayer:i}=t;if(!i||!r?.floorInfo?.siteLayer)return e;let a=i.createQuery();a.returnGeometry=!0,a.outFields=[`*`],a.returnZ=!0,`type`in i&&i.type===`scene`&&(a.multipatchOption=`xyFootprint`);let{siteIdField:o,nameField:s}=r.floorInfo.siteLayer,c=await i.queryFeatures(a);if(c?.features?.length>0){let t=c.features,n=i?.fieldsIndex.get(o)?.name||o,r=i?.fieldsIndex.get(s)?.name||s;n!=null&&r!=null&&t.forEach(t=>{let i=t.attributes,a=t.geometry,o=i[n],s=i[r];o&&s&&e.sitesInfo.push({id:o,name:s,geometry:a})})}return e}async _getFacilities(){let{filterLayers:e,view:t}=this,n=t?.map,{facilityLayer:r}=e,i={facilitiesInfo:[]};if(!r||!n?.floorInfo?.facilityLayer)return i;let a=r.createQuery();a.returnGeometry=!0,a.outFields=[`*`],a.returnZ=!0,`type`in r&&r.type===`scene`&&(a.multipatchOption=`xyFootprint`);let{facilityIdField:o,siteIdField:s,nameField:c}=n.floorInfo.facilityLayer,l=await r.queryFeatures(a);if(l?.features?.length>0){let e=l.features,t=r?.fieldsIndex.get(o)?.name||o,n=r?.fieldsIndex.get(s)?.name||s,a=r?.fieldsIndex.get(c)?.name||c;t&&n&&a&&e.forEach(e=>{let r=e.attributes,o=e.geometry,s=r[t],c=r[n],l=r[a];s&&l&&i.facilitiesInfo.push({id:s,siteId:c,name:l,geometry:o})})}return i}async _getLevels(){let{filterLayers:e,view:t}=this,n=t?.map,{levelLayer:r}=e,i={levelsInfo:[]};if(!r||!n?.floorInfo?.levelLayer)return i;let a=r.createQuery();a.returnGeometry=!0,a.outFields=[`*`],a.returnZ=!0;let{levelIdField:o,facilityIdField:s,longNameField:c,shortNameField:l,levelNumberField:u,verticalOrderField:d}=n.floorInfo.levelLayer,f=await r.queryFeatures(a);if(f?.features?.length>0){let e=f.features,t=r?.fieldsIndex.get(o)?.name||o,n=r?.fieldsIndex.get(s)?.name||s,a=r?.fieldsIndex.get(c)?.name||c,p=r?.fieldsIndex.get(l)?.name||l,m=r?.fieldsIndex.get(u)?.name||u,h=r?.fieldsIndex.get(d)?.name||d;t&&n&&a&&p&&m&&h&&e.forEach(e=>{let r=e.attributes,o=r[t],s=r[n],c=r[a],l=r[p],u=r[m],d=r[h];o&&s&&c&&l&&typeof u==`number`&&typeof d==`number`&&i.levelsInfo.push({id:o,facilityId:s,longName:c,shortName:l,levelNumber:u,verticalOrder:d})})}return i}async _imagePolygonToBlob(e,t,n,r){let{getImageData:a}=await import(`../../core/imageUtils.js`),o=await a(e),s=new OffscreenCanvas(n,r),c=s.getContext(`2d`);if(!c)throw new i(`floorfilter:floor-plan-overlay`,`Unable to obtain a rendering context from the canvas.`);let l=new Path2D;for(let e of t)if(!(e.length<3)){l.moveTo(e[0].x,e[0].y);for(let t=1;t<e.length;t++)l.lineTo(e[t].x,e[t].y);l.closePath()}return c.save(),c.clip(l,`evenodd`),c.drawImage(o,0,0,n,r),c.restore(),await s.convertToBlob({type:`image/png`})}async _polygonToImagePixels(e,t){if(e?.type!==`control-points`)throw new i(`floorfilter:floor-plan-overlay`,"Expected a `ControlPointsGeoreference`.");let{default:n}=await import(`../../geometry/Point.js`);return{pixelRings:t.rings.map(r=>r.map(([r,a])=>{let o=new n({x:r,y:a,spatialReference:t.spatialReference}),s=e.toSource(o);if(!s)throw new i(`floorfilter:floor-plan-overlay`,`toSource() returned null; check spatial references and projectOperator.`);return{x:s.x,y:s.y}})),width:e.width,height:e.height}}_registerWidget(e){e?.registerComponent(this)}_unregisterWidget(e){e?.unregisterComponent(this)}_watchLayerVisibility(e){if(this.filterLayers?.levelLayer?.type===`feature`&&e){let t=this.filterLayers?.levelLayer;this.addHandles(s(()=>t.visible,t=>{e.visible=t},l))}}_watchMapLayers(e){this.removeHandles(`layers-handle`),e&&this.addHandles(e.allLayers.on(`after-remove`,t=>{if(t.item){let r=e.floorInfo,i=r?.siteLayer?.layerId??``,a=r?.facilityLayer?.layerId??``,s=r?.levelLayer?.layerId??``;(t.item.id===a||t.item.id===s||t.item.id===i)&&(this._updateFloorFilterTask!=null&&(this._updateFloorFilterTask.abort(),this._updateFloorFilterTask=null),this._updateFloorFilterTask=n(async t=>{o(t),this.level=null,this.filterMenuOpen=!1,this._clearOverride(`filterLayers`),this._clearOverride(`filterFeatures`),this._setInitialViewState(e)}))}}),`layers-handle`)}_watchSearchResults(e){e?.on(`select-result-floor`,e=>{let t=this.getLevel(e);t&&this.level!==e&&(this.level=e,this.setFloors(t))})}async _setInitialViewState(e){if(this.view)try{await this.view.when(),await this._setFilterLayers();let t=await this._getFilterFeatures();if(!t)return;if(this.filterFeatures=t,!this.hasFacilities||!this.hasLevels){a.getLogger(this).error(`Facilities and Levels are required for the Floor Filter widget`);return}if(this.hasMultipleSites||(this.filterMenuType=`facility`),this.facility&&this.level){this.filterMenuType=`facility`;let e=this.getFacility(this.facility),t=this.getLevel(this.level);this.site||=e?.siteId||void 0,this.setFloors(t)}else if(this.facility&&!this.level){this.filterMenuType=`facility`;let e=this.getFacility(this.facility),t=this.getBaseLevel(e);this.site||=e?.siteId||void 0,this.level=t?.id||void 0,this.setFloors(t)}else if(!this.facility&&this.level){this.filterMenuType=`facility`;let e=this.getLevel(this.level),t=this.getFacility(e?.facilityId);this.facility=t?.id||void 0,this.site||=t?.siteId||void 0,this.setFloors(e)}else if(this.site&&!this.facility&&!this.level)this.filterMenuType=`site`,this.setFloors(null);else{if(!e||!_(e)){this.setFloors(null);return}let t=e?.widgets?.floorFilter;if(!t){this.setFloors(null);return}t.site&&!this.site&&(this.site=t.site,this.filterMenuType=`facility`),this.setFloors(null)}if(this.filterLayers?.levelLayer?.type===`feature`&&this.filterLayers.levelLayer.capabilities.data.supportsAttachment&&this.mediaLayer==null){let{levelLayer:e}=this.filterLayers,{default:t}=await import(`../../layers/MediaLayer.js`);this.mediaLayer=new t({blendMode:`normal`,listMode:`hide`,maxScale:e.maxScale,minScale:e.minScale,spatialReference:this.view.spatialReference.clone(),title:`floor-filter-media-layer`,visible:e.visible}),this.overlaysByFacility=new Map,this.overlaysByLevel=new Map,this.view.map.add(this.mediaLayer),this.getOverlays(!0)}}catch(e){a.getLogger(this).error(`Couldn't retrieve sites, facilities, and levels`,e)}}_callOverride(e,t){this._override(e,t)}async _updateFloorFilterFromMap(e){if(!e||!_(e))return;await this.view?.when();let t=e?.widgets?.floorFilter;t&&(this._isOverridden(`enabled`)||(this.enabled=t.enabled),this._isOverridden(`longNames`)||(this.longNames=t.longNames),this._isOverridden(`minimized`)||(this.minimized=t.minimized),this._isOverridden(`pinnedLevels`)||(this.pinnedLevels=t.pinnedLevels),this._isOverridden(`site`)||(this.site=t.site),this._isOverridden(`facility`)||(this.facility=t.facility),this._isOverridden(`level`)||(this.level=t.level))}_updateMediaLayer(e){let{mediaLayer:t,overlaysByLevel:n}=this;if(t&&n&&e?.length){let r=t.source;r.elements.removeAll(),n.get(e)?.visible===!0&&r.elements.push(n.get(e)?.image)}}_computeViewAllModeFloors(e){let{filterFeatures:t}=this;if(e.floorInfo?.viewAllMode&&this.hasLevels&&this.hasFacilities&&this.filterMode===`base-floors`){let{level:n,facility:i}=this,a=[];t.levels.levelsInfo.forEach(e=>{let{id:t,facilityId:r}=e;i&&r===i?n&&t===n&&a.push(t):a.push(t)}),e.floorInfo.viewAllLevelIds=new r(a)}}};e([f({value:!1})],b.prototype,`enabled`,null),e([f({value:void 0})],b.prototype,`facility`,null),e([f({value:null})],b.prototype,`filterFeatures`,null),e([f({value:null})],b.prototype,`filterLayers`,null),e([f()],b.prototype,`filterMenuOpen`,void 0),e([f()],b.prototype,`filterMenuType`,void 0),e([f()],b.prototype,`filterMode`,void 0),e([f({readOnly:!0,value:`belowSelected`})],b.prototype,`floorVisibilityMode`,null),e([f()],b.prototype,`hasFacilities`,null),e([f()],b.prototype,`hasLevels`,null),e([f()],b.prototype,`hasMultipleSites`,null),e([f({readOnly:!0})],b.prototype,`isNormalMode`,null),e([f({value:void 0})],b.prototype,`level`,null),e([f({value:!1})],b.prototype,`longNames`,null),e([f()],b.prototype,`levelsExpanded`,void 0),e([f()],b.prototype,`mediaLayer`,void 0),e([f({value:!1})],b.prototype,`minimized`,null),e([f()],b.prototype,`overlaysByFacility`,void 0),e([f()],b.prototype,`overlaysByLevel`,void 0),e([f({value:!1})],b.prototype,`pinnedLevels`,null),e([f()],b.prototype,`searchTerm`,void 0),e([f({readOnly:!0})],b.prototype,`selectedVerticalOrder`,null),e([f({value:void 0})],b.prototype,`site`,null),e([f({readOnly:!0})],b.prototype,`state`,null),e([f({readOnly:!0,value:!1})],b.prototype,`useVerticalOrder`,null),e([f()],b.prototype,`view`,void 0),e([f()],b.prototype,`_viewHeightBreakpoint`,void 0),e([f()],b.prototype,`_viewWidthBreakpoint`,void 0),e([f()],b.prototype,`updateWebDocument`,null),b=e([p(`esri.widgets.FloorFilter.FloorFilterViewModel`)],b);const x=b;export{x as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../core/Accessor.js";import{createTask as n}from"../../core/asyncUtils.js";import r from"../../core/Collection.js";import i from"../../core/Error.js";import a from"../../core/Logger.js";import{throwIfAborted as o}from"../../core/promiseUtils.js";import{watch as s,initial as c,syncAndInitial as l}from"../../core/reactiveUtils.js";import{Milliseconds as u}from"../../core/time.js";import{isBlobProtocol as d}from"../../core/urlUtils.js";import{property as f,subclass as p}from"../../core/accessorSupport/decorators.js";import m from"../../geometry/Polygon.js";import h from"../../webdoc/Widgets.js";import g from"../../webdoc/widgets/FloorFilter.js";import{isWebMap as _}from"../../webmap/utils.js";import{GoTo as v}from"../support/GoTo.js";function y(e){return e.declaredClass===`esri.WebScene`}let b=class extends v(t){constructor(e){super(e),this.filterMenuOpen=!1,this.filterMenuType=`site`,this.filterMode=`base-floors`,this.levelsExpanded=!0,this.searchTerm=null,this.view=null,this._updateFloorFilterTask=null,this._viewHeightBreakpoint=null,this._viewWidthBreakpoint=null}initialize(){this.addHandles([s(()=>this.view?.map,e=>{this._updateFloorFilterTask!=null&&(this._updateFloorFilterTask.abort(),this._updateFloorFilterTask=null),this._updateFloorFilterTask=n(async t=>{await this._updateFloorFilterFromMap(e),o(t),this._setInitialViewState(e)}),this._watchMapLayers(e)},c),s(()=>this.view,(e,t)=>{this._unregisterWidget(t),this._registerWidget(e),this._watchSearchResults(e)},l),s(()=>this.mediaLayer,e=>{this._watchLayerVisibility(e)},l),s(()=>this.view?.widthBreakpoint??null,e=>{this._viewWidthBreakpoint=e}),s(()=>this.view?.heightBreakpoint??null,e=>{this._viewHeightBreakpoint=e}),s(()=>this.facility,()=>void this.getOverlays()),s(()=>this.level,e=>this._updateMediaLayer(e))])}destroy(){if(this._unregisterWidget(this.view),this.mediaLayer&&this.view?.map.remove(this.mediaLayer),this.overlaysByLevel){for(let e of this.overlaysByLevel.values()){let t=e.image.image;d(t)&&URL.revokeObjectURL(t)}this.overlaysByFacility?.clear(),this.overlaysByLevel.clear()}this.view=null,this._updateFloorFilterTask!=null&&(this._updateFloorFilterTask.abort(),this._updateFloorFilterTask=null)}set enabled(e){this._callOverride(`enabled`,e)}set facility(e){if(e&&this._isOverridden(`facility`)){let t=this.getFacility(e);this.hasMultipleSites&&(this.site=t?.siteId||null)}this._callOverride(`facility`,e)}set filterFeatures(e){this._callOverride(`filterFeatures`,e)}set filterLayers(e){this._callOverride(`filterLayers`,e)}get floorVisibilityMode(){return this.view&&y(this.view?.map)?this.view.map.widgets?.floorFilter?.floorVisibilityMode??`belowSelected`:`belowSelected`}get hasFacilities(){return this.filterLayers?.facilityLayer!=null&&this.filterFeatures?.facilities?.facilitiesInfo?.length>0}get hasLevels(){return this.filterLayers?.levelLayer!=null&&this.filterFeatures?.levels?.levelsInfo?.length>0}get hasMultipleSites(){return this.filterLayers?.siteLayer!=null&&this.filterFeatures?.sites?.sitesInfo?.length>1}get isNormalMode(){let e=!0,t=this._viewWidthBreakpoint;return(this._viewHeightBreakpoint===`xsmall`||t===`xsmall`)&&(e=!1),e}set level(e){if(!e){this._callOverride(`level`,e),this.facility=null,this.site=null,this.setFloors(null);return}let t=null,n=null,r=e?.split(`--`);r?.length>1&&r[0]===`all`?(n=r[1],t={id:e,facilityId:n,shortName:null,longName:null,levelNumber:null,verticalOrder:null}):(t=this.getLevel(e),n=t?.facilityId??null),this.level===e&&!this.isNormalMode&&!this.levelsExpanded?this.getFacilityLevels(n)?.length>1&&(this.levelsExpanded=!0):(t&&this.hasFacilities&&this.hasLevels?(this.facility=n,this.hasMultipleSites&&(this.site=this.getFacility(n)?.siteId||null),this.setFloors(t)):this._isOverridden(`level`)&&(this.facility=null,this.site=null,this.hasMultipleSites&&(this.filterMenuType=`site`),this.setFloors(null)),this._callOverride(`level`,e))}set longNames(e){this._callOverride(`longNames`,e)}set minimized(e){this._callOverride(`minimized`,e)}set pinnedLevels(e){this._callOverride(`pinnedLevels`,e)}get selectedVerticalOrder(){return _(this.view?.map)?this.view.map.resourceInfo?.widgets?.floorFilter?.selectedVerticalOrder??null:null}set site(e){this._callOverride(`site`,e)}get state(){return this.view&&this.filterFeatures&&this.hasFacilities&&this.hasLevels?`ready`:this.view&&!this.filterFeatures?`loading`:`disabled`}get useVerticalOrder(){return this.view?.map==null?!1:_(this.view?.map)||y(this.view.map)?this.view.map.widgets?.floorFilter?.useVerticalOrder??!1:!1}filterFacilities(e){let t=e;return this.searchTerm&&(this.searchTerm=this.searchTerm.trim(),t=e.filter(e=>{let{name:t}=e;return t.toLowerCase().includes(this.searchTerm?.toLowerCase())})),this.site&&(t=t.filter(e=>e.siteId===this.site)),t.sort((e,t)=>{let n=e.name,r=t.name;return n.localeCompare(r,void 0,{sensitivity:`base`})})}filterSites(e){let t=e;return this.searchTerm&&(this.searchTerm=this.searchTerm.trim(),t=e.filter(e=>{let{name:t}=e;return t.toLowerCase().includes(this.searchTerm?.toLowerCase())})),t.sort((e,t)=>{let n=e.name,r=t.name;return n.localeCompare(r,void 0,{sensitivity:`base`})})}getBaseLevel(e){let t=this.filterFeatures?.levels?.levelsInfo,n=null;if(e){let{id:r}=e;if(t&&t.length>0&&(t.forEach(e=>{e.verticalOrder===0&&e.facilityId===r&&(n=e)}),!n)){let e=null;t.forEach(t=>{t.facilityId===r&&(e?(t.verticalOrder??0)>=0?e.verticalOrder!=null&&(e.verticalOrder<0||(t.verticalOrder??0)<e.verticalOrder)&&(e=t):e.verticalOrder!=null&&t.verticalOrder!=null&&e.verticalOrder<0&&t.verticalOrder>e.verticalOrder&&(e=t):e=t)}),e&&(n=e)}}return n}getFacility(e){return this.filterFeatures?.facilities?.facilitiesInfo?.find(t=>t.id===e)??null}getFacilityLevels(e){return!e||!this.filterFeatures?.levels?.levelsInfo?[]:this.filterFeatures.levels.levelsInfo.filter(t=>t.facilityId===e).sort((e,t)=>{let n=e.verticalOrder??0,r=t.verticalOrder??0;return n>r?-1:n===r?0:1})}getLevel(e){return this.filterFeatures?.levels?.levelsInfo?.find(t=>t.id===e)??null}async getOverlays(e=!1){let{facility:t,level:n,mediaLayer:i,overlaysByFacility:a,overlaysByLevel:o,view:s}=this;if(_(s?.map)&&i){if((i?.source).elements.removeAll(),t?.length&&(!a?.has(t)||e)){a?.set(t,new r);let e=s.map.floorInfo?.levelLayer?.layerId,n=s.map.findLayerById(e??``);if(!n||s.type!==`2d`)return;let i=await this._getAttachments(n,t),{default:c}=await import(`../../request.js`),l=Object.keys(i).map(async e=>{let r=i[e],s=r.find(e=>e.contentType===`application/json`);if(!s?.url)return;let l=new URL(s.url);n.gdbVersion?.length&&l.searchParams.set(`gdbVersion`,n.gdbVersion);let{data:u}=await c(l.toString(),{responseType:`json`}),d=r.find(e=>e.name===u.name),f=d?.url??``;if(f?.length>0){let e=new URL(f);e.searchParams.delete(`token`),n.gdbVersion?.length&&e.searchParams.set(`gdbVersion`,n.gdbVersion);let{default:r}=await import(`../../layers/support/ControlPointsGeoreference.js`),i=r.fromJSON(u.georeference),c=await this.toImageElement(e.toString(),i,u.opacity,u.clipImage,u.geometry);await c.load();let l={...u,attachments:[s,d],facilityId:t,image:c,source:JSON.stringify(u),url:e.toString()};o?.set(l.levelId,l),a?.get(t)?.push(l)}});await Promise.all(l)}this._updateMediaLayer(n)}}getSite(e){return this.filterFeatures?.sites?.sitesInfo?.find(t=>t.id===e)??null}async goTo(e){let{view:t}=this;if(!t||!e)return;let{geometry:n}=e;if(n?.extent){let e=e=>{this.callGoTo({target:e,options:{duration:u(1e3),easing:`quad-in-out-coast`}})};if(n.hasZ&&n.spatialReference?.vcsWkid!==t.spatialReference?.vcsWkid){let{projectIsLoaded:r,projectLoad:i,projectExecute:a}=await import(`../../geometry/operators/projectOperator.js`);r()||await i();let o=a(n.extent,t.spatialReference.clone(),{zConversionDisabled:!0});o&&e(o)}else e(n.extent)}}setFloors(e){let{view:t}=this;t&&(t?.map?.allLayers?.forEach(e=>{e.type===`feature`&&this._computeViewAllModeFloors(e)}),t.floors=new r(this._computeFloors(e)))}async toImageElement(e,t,n,r,i){let{default:o}=await import(`../../layers/support/ImageElement.js`),{facility:s}=this,c=()=>new o({image:e,georeference:t,opacity:n});if(r)try{let r=i?m.fromJSON(i):this.getFacility(s)?.geometry;if(r==null)return c();let{pixelRings:a,width:l,height:u}=await this._polygonToImagePixels(t,r),d=await this._imagePolygonToBlob(e,a,l,u);return new o({image:URL.createObjectURL(d),georeference:t,opacity:n})}catch(e){return a.getLogger(this).warn(`Unable to clip image; using full image instead: ${e.message}`,e),c()}return c()}updateWebDocument(e){if(_(e)||y(e)){let t={enabled:this.enabled,longNames:this.longNames,minimized:this.minimized,pinnedLevels:this.pinnedLevels,site:this.site??null,facility:this.facility??null,level:this.level??null,useVerticalOrder:this.useVerticalOrder,selectedVerticalOrder:this.selectedVerticalOrder};y(e)&&(t.floorVisibilityMode=this.floorVisibilityMode);let n=new g(t);e.widgets??=new h,e.widgets.floorFilter=n}}_computeFloors(e){if(this.filterMode===`single-floor`)this._computeSingleFloor(e);else if(this.filterMode===`base-floors`)return this.view?.type===`3d`?this._computeBaseFloors3D(e):this._computeBaseFloors(e);return this._computeEmptyFloors()}_computeSingleFloor(e){if(!e)return this._computeEmptyFloors();let t=[];return e?.id===`all`?this.getFacilityLevels(e.facilityId).forEach(e=>{e.id&&t.push(e.id)}):e&&t.push(e.id),t}_computeBaseFloors(e){let t=this.filterFeatures?.levels?.levelsInfo;if(!t?.length)return this._computeEmptyFloors();let n=[];e?.id===`all`?this.getFacilityLevels(e.facilityId).forEach(e=>{e.id&&n.push(e.id)}):e&&n.push(e.id);let r=e?.facilityId,i=e?.verticalOrder,a=(e,t)=>{e===0&&n.push(t)};return t.forEach(e=>{let{id:t,facilityId:o,verticalOrder:s}=e;!r&&!n.includes(t)?a(s,t):o!==r&&!n.includes(t)&&(this.useVerticalOrder?s===i&&n.push(t):a(s,t))}),n}_computeBaseFloors3D(e){let t=this.filterFeatures?.levels?.levelsInfo;if(!t?.length)return this._computeEmptyFloors();let n=[],r=e?.id.split(`--`)??[],i=r?.length>1&&r[0]===`all`;i?this.getFacilityLevels(e?.facilityId).forEach(e=>{e.id&&n.push(e.id)}):e&&n.push(e.id);let a=e?.facilityId,o=e?.verticalOrder;return t.forEach(e=>{let{id:t,facilityId:r,verticalOrder:s}=e;if(!a&&!n.includes(t))n.push(t);else if(!n.includes(t)){let{floorVisibilityMode:e,useVerticalOrder:c}=this,l=s<=o;r===a?e===`belowSelected`&&l&&n.push(t):(i||!c||e===`selectedOnly`&&s===o||e===`belowSelected`&&l)&&n.push(t)}}),n}_computeEmptyFloors(){return[]}async _setFilterLayers(){let{view:e}=this;if(e&&!this._isOverridden(`filterLayers`)){if(!_(e.map)&&!y(e.map))throw new i(`floorfilter:unsupported-map`,`Map must be a webmap or webscene`);{let t=e.map,n=t?.allLayers;if(n?.items?.length>0){let e={siteLayer:null,facilityLayer:null,levelLayer:null},r=t.floorInfo?.siteLayer?.layerId,i=t.floorInfo?.facilityLayer?.layerId,a=t.floorInfo?.levelLayer?.layerId,o=t.floorInfo?.siteLayer?.sublayerId||t.floorInfo?.facilityLayer?.sublayerId||t.floorInfo?.levelLayer?.sublayerId;if(!i||!a)return;let s=n.items.filter(e=>e.type===`feature`||e.type===`scene`),c=n.items.filter(e=>e.type===`map-image`);if(c?.length>0&&o){await Promise.all(c.map(e=>e.load()));let n=t.floorInfo?.siteLayer?.sublayerId,o=t.floorInfo?.facilityLayer?.sublayerId,s=t.floorInfo?.levelLayer?.sublayerId;c.forEach(t=>{let c=t.id,l=t?.allSublayers,u=l?.items;(c===r||c===i||c===a)&&u?.length>0&&l.items.forEach(t=>{let i=t.id;c===r&&i===n?e.siteLayer=t:i===o?e.facilityLayer=t:i===s&&(e.levelLayer=t)})})}s?.length>0&&s.forEach(t=>{let n=t.id;n===r?e.siteLayer=t:n===i?e.facilityLayer=t:n===a&&(e.levelLayer=t)}),this.filterLayers=e}}}}async _getAttachments(e,t){let{view:n}=this;if(_(n?.map)){let{facilityIdField:r}=n.map.floorInfo?.levelLayer??{};if(e&&n.type===`2d`&&t?.length>0&&e.capabilities.data.supportsAttachment)return e.queryAttachments({returnMetadata:!0,where:`${r} = '${t}'`})}return{}}async _getFilterFeatures(){if(this._isOverridden(`filterFeatures`))return this.filterFeatures;let[e,t,n]=await Promise.all([this._getSites(),this._getFacilities(),this._getLevels()]);return{sites:e,facilities:t,levels:n}}async _getSites(){let e={sitesInfo:[]},{filterLayers:t,view:n}=this,r=n?.map,{siteLayer:i}=t;if(!i||!r?.floorInfo?.siteLayer)return e;let a=i.createQuery();a.returnGeometry=!0,a.outFields=[`*`],a.returnZ=!0,`type`in i&&i.type===`scene`&&(a.multipatchOption=`xyFootprint`);let{siteIdField:o,nameField:s}=r.floorInfo.siteLayer,c=await x(i,a);if(c.features.length>0){let t=c.features,n=i?.fieldsIndex.get(o)?.name||o,r=i?.fieldsIndex.get(s)?.name||s;n!=null&&r!=null&&t.forEach(t=>{let i=t.attributes,a=t.geometry,o=i[n],s=i[r];o&&s&&e.sitesInfo.push({id:o,name:s,geometry:a})})}return e}async _getFacilities(){let{filterLayers:e,view:t}=this,n=t?.map,{facilityLayer:r}=e,i={facilitiesInfo:[]};if(!r||!n?.floorInfo?.facilityLayer)return i;let a=r.createQuery();a.returnGeometry=!0,a.outFields=[`*`],a.returnZ=!0,`type`in r&&r.type===`scene`&&(a.multipatchOption=`xyFootprint`);let{facilityIdField:o,siteIdField:s,nameField:c}=n.floorInfo.facilityLayer,l=await x(r,a);if(l.features.length>0){let e=l.features,t=r?.fieldsIndex.get(o)?.name||o,n=r?.fieldsIndex.get(s)?.name||s,a=r?.fieldsIndex.get(c)?.name||c;t&&n&&a&&e.forEach(e=>{let r=e.attributes,o=e.geometry,s=r[t],c=r[n],l=r[a];s&&l&&i.facilitiesInfo.push({id:s,siteId:c,name:l,geometry:o})})}return i}async _getLevels(){let{filterLayers:e,view:t}=this,n=t?.map,{levelLayer:r}=e,i={levelsInfo:[]};if(!r||!n?.floorInfo?.levelLayer)return i;let a=r.createQuery();a.returnGeometry=!0,a.outFields=[`*`],a.returnZ=!0;let{levelIdField:o,facilityIdField:s,longNameField:c,shortNameField:l,levelNumberField:u,verticalOrderField:d}=n.floorInfo.levelLayer,f=await x(r,a);if(f.features.length>0){let e=f.features,t=r?.fieldsIndex.get(o)?.name||o,n=r?.fieldsIndex.get(s)?.name||s,a=r?.fieldsIndex.get(c)?.name||c,p=r?.fieldsIndex.get(l)?.name||l,m=r?.fieldsIndex.get(u)?.name||u,h=r?.fieldsIndex.get(d)?.name||d;t&&n&&a&&p&&m&&h&&e.forEach(e=>{let r=e.attributes,o=r[t],s=r[n],c=r[a],l=r[p],u=r[m],d=r[h];o&&s&&c&&l&&typeof u==`number`&&typeof d==`number`&&i.levelsInfo.push({id:o,facilityId:s,longName:c,shortName:l,levelNumber:u,verticalOrder:d})})}return i}async _imagePolygonToBlob(e,t,n,r){let{getImageData:a}=await import(`../../core/imageUtils.js`),o=await a(e),s=new OffscreenCanvas(n,r),c=s.getContext(`2d`);if(!c)throw new i(`floorfilter:floor-plan-overlay`,`Unable to obtain a rendering context from the canvas.`);let l=new Path2D;for(let e of t)if(!(e.length<3)){l.moveTo(e[0].x,e[0].y);for(let t=1;t<e.length;t++)l.lineTo(e[t].x,e[t].y);l.closePath()}return c.save(),c.clip(l,`evenodd`),c.drawImage(o,0,0,n,r),c.restore(),await s.convertToBlob({type:`image/png`})}async _polygonToImagePixels(e,t){if(e?.type!==`control-points`)throw new i(`floorfilter:floor-plan-overlay`,"Expected a `ControlPointsGeoreference`.");let{default:n}=await import(`../../geometry/Point.js`);return{pixelRings:t.rings.map(r=>r.map(([r,a])=>{let o=new n({x:r,y:a,spatialReference:t.spatialReference}),s=e.toSource(o);if(!s)throw new i(`floorfilter:floor-plan-overlay`,`toSource() returned null; check spatial references and projectOperator.`);return{x:s.x,y:s.y}})),width:e.width,height:e.height}}_registerWidget(e){e?.registerComponent(this)}_unregisterWidget(e){e?.unregisterComponent(this)}_watchLayerVisibility(e){if(this.filterLayers?.levelLayer?.type===`feature`&&e){let t=this.filterLayers?.levelLayer;this.addHandles(s(()=>t.visible,t=>{e.visible=t},l))}}_watchMapLayers(e){this.removeHandles(`layers-handle`),e&&this.addHandles(e.allLayers.on(`after-remove`,t=>{if(t.item){let r=e.floorInfo,i=r?.siteLayer?.layerId??``,a=r?.facilityLayer?.layerId??``,s=r?.levelLayer?.layerId??``;(t.item.id===a||t.item.id===s||t.item.id===i)&&(this._updateFloorFilterTask!=null&&(this._updateFloorFilterTask.abort(),this._updateFloorFilterTask=null),this._updateFloorFilterTask=n(async t=>{o(t),this.level=null,this.filterMenuOpen=!1,this._clearOverride(`filterLayers`),this._clearOverride(`filterFeatures`),this._setInitialViewState(e)}))}}),`layers-handle`)}_watchSearchResults(e){e?.on(`select-result-floor`,e=>{let t=this.getLevel(e);t&&this.level!==e&&(this.level=e,this.setFloors(t))})}async _setInitialViewState(e){if(this.view)try{await this.view.when(),await this._setFilterLayers();let t=await this._getFilterFeatures();if(!t)return;if(this.filterFeatures=t,!this.hasFacilities||!this.hasLevels){a.getLogger(this).error(`Facilities and Levels are required for the Floor Filter widget`);return}if(this.hasMultipleSites||(this.filterMenuType=`facility`),this.facility&&this.level){this.filterMenuType=`facility`;let e=this.getFacility(this.facility),t=this.getLevel(this.level);this.site||=e?.siteId||void 0,this.setFloors(t)}else if(this.facility&&!this.level){this.filterMenuType=`facility`;let e=this.getFacility(this.facility),t=this.getBaseLevel(e);this.site||=e?.siteId||void 0,this.level=t?.id||void 0,this.setFloors(t)}else if(!this.facility&&this.level){this.filterMenuType=`facility`;let e=this.getLevel(this.level),t=this.getFacility(e?.facilityId);this.facility=t?.id||void 0,this.site||=t?.siteId||void 0,this.setFloors(e)}else if(this.site&&!this.facility&&!this.level)this.filterMenuType=`site`,this.setFloors(null);else{if(!e||!_(e)){this.setFloors(null);return}let t=e?.widgets?.floorFilter;if(!t){this.setFloors(null);return}t.site&&!this.site&&(this.site=t.site,this.filterMenuType=`facility`),this.setFloors(null)}if(this.filterLayers?.levelLayer?.type===`feature`&&this.filterLayers.levelLayer.capabilities.data.supportsAttachment&&this.mediaLayer==null){let{levelLayer:e}=this.filterLayers,{default:t}=await import(`../../layers/MediaLayer.js`);this.mediaLayer=new t({blendMode:`normal`,listMode:`hide`,maxScale:e.maxScale,minScale:e.minScale,spatialReference:this.view.spatialReference.clone(),title:`floor-filter-media-layer`,visible:e.visible}),this.mediaLayer.persistenceEnabled=!1,this.overlaysByFacility=new Map,this.overlaysByLevel=new Map;let n=e.parent?.type===`group`,r=e.parent,i=(n?r.layers:this.view.map.layers).indexOf(e);n?i>-1?r.add(this.mediaLayer,i+1):r.add(this.mediaLayer):i>-1?this.view.map.add(this.mediaLayer,i+1):this.view.map.add(this.mediaLayer),this.getOverlays(!0)}}catch(e){a.getLogger(this).error(`Couldn't retrieve sites, facilities, and levels`,e)}}_callOverride(e,t){this._override(e,t)}async _updateFloorFilterFromMap(e){if(!e||!_(e))return;await this.view?.when();let t=e?.widgets?.floorFilter;t&&(this._isOverridden(`enabled`)||(this.enabled=t.enabled),this._isOverridden(`longNames`)||(this.longNames=t.longNames),this._isOverridden(`minimized`)||(this.minimized=t.minimized),this._isOverridden(`pinnedLevels`)||(this.pinnedLevels=t.pinnedLevels),this._isOverridden(`site`)||(this.site=t.site),this._isOverridden(`facility`)||(this.facility=t.facility),this._isOverridden(`level`)||(this.level=t.level))}_updateMediaLayer(e){let{mediaLayer:t,overlaysByLevel:n}=this;if(t&&n&&e?.length){let r=t.source;r.elements.removeAll(),n.get(e)?.visible===!0&&r.elements.push(n.get(e)?.image)}}_computeViewAllModeFloors(e){let{filterFeatures:t}=this;if(e.floorInfo?.viewAllMode&&this.hasLevels&&this.hasFacilities&&this.filterMode===`base-floors`){let{level:n,facility:i}=this,a=[];t.levels.levelsInfo.forEach(e=>{let{id:t,facilityId:r}=e;i&&r===i?n&&t===n&&a.push(t):a.push(t)}),e.floorInfo.viewAllLevelIds=new r(a)}}};e([f({value:!1})],b.prototype,`enabled`,null),e([f({value:void 0})],b.prototype,`facility`,null),e([f({value:null})],b.prototype,`filterFeatures`,null),e([f({value:null})],b.prototype,`filterLayers`,null),e([f()],b.prototype,`filterMenuOpen`,void 0),e([f()],b.prototype,`filterMenuType`,void 0),e([f()],b.prototype,`filterMode`,void 0),e([f({readOnly:!0,value:`belowSelected`})],b.prototype,`floorVisibilityMode`,null),e([f()],b.prototype,`hasFacilities`,null),e([f()],b.prototype,`hasLevels`,null),e([f()],b.prototype,`hasMultipleSites`,null),e([f({readOnly:!0})],b.prototype,`isNormalMode`,null),e([f({value:void 0})],b.prototype,`level`,null),e([f({value:!1})],b.prototype,`longNames`,null),e([f()],b.prototype,`levelsExpanded`,void 0),e([f()],b.prototype,`mediaLayer`,void 0),e([f({value:!1})],b.prototype,`minimized`,null),e([f()],b.prototype,`overlaysByFacility`,void 0),e([f()],b.prototype,`overlaysByLevel`,void 0),e([f({value:!1})],b.prototype,`pinnedLevels`,null),e([f()],b.prototype,`searchTerm`,void 0),e([f({readOnly:!0})],b.prototype,`selectedVerticalOrder`,null),e([f({value:void 0})],b.prototype,`site`,null),e([f({readOnly:!0})],b.prototype,`state`,null),e([f({readOnly:!0,value:!1})],b.prototype,`useVerticalOrder`,null),e([f()],b.prototype,`view`,void 0),e([f()],b.prototype,`_viewHeightBreakpoint`,void 0),e([f()],b.prototype,`_viewWidthBreakpoint`,void 0),e([f()],b.prototype,`updateWebDocument`,null),b=e([p(`esri.widgets.FloorFilter.FloorFilterViewModel`)],b);async function x(e,t,n){let r={features:[]};await e.load();let i=(e.type===`sublayer`?e.sourceJSON?.maxRecordCount:e.capabilities.query.maxRecordCount)||2e3,a=async()=>{let n=t.clone();return await e.queryObjectIds(n,void 0)},o=async n=>{let r=t.clone();r.where=null,r.objectIds=n.objectIds,n.features=(await e.queryFeatures(r,void 0))?.features??null},s=await a(),c=i,l=[],u=[];for(let e=0,t=s.length;e<t;e+=c){let t=s.slice(e,e+c);t.length>0&&l.push({objectIds:t,features:null})}for(let e=0,t=l.length;e<t;e+=3){let t=l.slice(e,e+3);t.length>0&&u.push({pages:t})}for await(let e of u){let t=[];for(let n of e.pages)t.push(o(n));t.length>0&&await Promise.all(t)}for(let e of l)e.features?.length&&r.features.push(...e.features);return r}const S=b;export{S as default};
|
package/widgets/Locate.d.ts
CHANGED
|
@@ -71,7 +71,7 @@ export interface LocateEvents extends LocateViewModelEvents {}
|
|
|
71
71
|
* >
|
|
72
72
|
* > **Known Limitation**
|
|
73
73
|
* >
|
|
74
|
-
* > The Locate widget does not work concurrently with the [Track](https://developers.arcgis.com/javascript/latest/references/
|
|
74
|
+
* > The Locate widget does not work concurrently with the [Track component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-track/).
|
|
75
75
|
* > Only one of the widgets can be used at a time.
|
|
76
76
|
*
|
|
77
77
|
* You can use the view's [DefaultUI](https://developers.arcgis.com/javascript/latest/references/core/views/ui/DefaultUI/) to add widgets
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{generateCombinationsPanoramic as e,generateCombinations as t}from"./imageMeasurementUtils.js";function n(e){return t(e.imageToWorldProps,e.accuracyParameters)}function r(t){return e(t.imageToWorldProps,t.accuracyParameters)}export{r as generateCombinationsPanoramicWorker,n as generateCombinationsWorker};
|
|
2
|
+
import{generateCombinationsPanoramic as e,generateCombinations as t}from"./imageMeasurementUtils.js";function n(e){return t(e.imageToWorldProps,e.accuracyParameters,e.cameraHeading)}function r(t){return e(t.imageToWorldProps,t.accuracyParameters)}export{r as generateCombinationsPanoramicWorker,n as generateCombinationsWorker};
|