@arcgis/core 4.24.0-next.20220329 → 4.24.0-next.20220401
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/PopupTemplate.js +1 -1
- package/WebMap.js +1 -1
- package/WebScene.js +1 -1
- package/analysis/LineOfSightAnalysisObserver.js +1 -1
- package/analysis/LineOfSightAnalysisTarget.js +1 -1
- package/arcade/featureset/actions/Adapted.js +1 -1
- package/arcade/featureset/sources/FeatureLayerDynamic.js +1 -1
- package/arcade/featureset/sources/FeatureLayerMemory.js +1 -1
- package/arcade/featureset/sources/FeatureLayerRelated.js +1 -1
- package/arcade/featureset/support/FeatureSet.js +1 -1
- package/arcade/featureset/support/RecentlyUsedCache.js +1 -1
- package/arcade/featureset/support/shared.js +1 -1
- package/arcade/functions/convertdirection.js +1 -1
- package/arcade/lib/character.js +1 -1
- package/arcade/lib/scanner.js +1 -1
- package/arcade/lib/tokenizer.js +1 -1
- package/arcade/request.js +1 -1
- package/arcade/treeAnalysis.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/0bfedb1dbdff8205e468.js +1 -0
- package/assets/esri/core/workers/chunks/{5e472c89a38d6a42b84d.js → 0e29250c24a3a7b1ce13.js} +1 -1
- package/assets/esri/core/workers/chunks/0eb9c9477d36cd212f8b.js +1 -0
- package/assets/esri/core/workers/chunks/10779a256841c37f2429.js +1 -0
- package/assets/esri/core/workers/chunks/10a119889d1ab13402a3.js +1 -0
- package/assets/esri/core/workers/chunks/125b14c2ccd96d7c20c2.js +1 -0
- package/assets/esri/core/workers/chunks/23ec33a30db201e8b2c3.js +1 -0
- package/assets/esri/core/workers/chunks/2530e8ccf6e12787ce76.js +1 -0
- package/assets/esri/core/workers/chunks/2d9e97ba5b50aec4dd01.js +1 -0
- package/assets/esri/core/workers/chunks/365dc146398420f13f82.js +1 -0
- package/assets/esri/core/workers/chunks/3ae2827e8d55d6713d20.js +1 -0
- package/assets/esri/core/workers/chunks/3e3eebaa0844742db2f2.js +1 -0
- package/assets/esri/core/workers/chunks/3fd5b2d6eccd9098d492.js +1 -0
- package/assets/esri/core/workers/chunks/404f1d7bce014c7e6965.js +1 -0
- package/assets/esri/core/workers/chunks/411b7777bb5e943c156f.js +1 -0
- package/assets/esri/core/workers/chunks/{12ca192a5233bb2875d0.js → 4312902ab6e42fbe119b.js} +1 -1
- package/assets/esri/core/workers/chunks/{4ef07f50da39f8607c1c.js → 44e95e87bd9e820aeb53.js} +1 -1
- package/assets/esri/core/workers/chunks/{4d4c5e535d8b9ceb865a.js → 4810edf605838d07e5c5.js} +1 -1
- package/assets/esri/core/workers/chunks/4bce446391176a9d4588.js +1 -0
- package/assets/esri/core/workers/chunks/52a0e387073ea264e194.js +1 -0
- package/assets/esri/core/workers/chunks/560234694f3e53802aff.js +1 -0
- package/assets/esri/core/workers/chunks/5633710daeb3bbb79bcf.js +1 -0
- package/assets/esri/core/workers/chunks/5682039666f874836451.js +1 -0
- package/assets/esri/core/workers/chunks/6f01905936396fe87865.js +1 -0
- package/assets/esri/core/workers/chunks/6f7917da7166e8c6854b.js +1 -0
- package/assets/esri/core/workers/chunks/7388824eac8da01ea03d.js +1 -0
- package/assets/esri/core/workers/chunks/7745efef7d5119d0b087.js +1 -0
- package/assets/esri/core/workers/chunks/794b47764ebb0257ed41.js +1 -0
- package/assets/esri/core/workers/chunks/{da64dedf9270b64f42b2.js → 79bdb26244ec7b4472fe.js} +1 -1
- package/assets/esri/core/workers/chunks/79ec28b3e3c57fe026aa.js +1 -0
- package/assets/esri/core/workers/chunks/81e9d860a044acec74ce.js +1 -0
- package/assets/esri/core/workers/chunks/831dc0187f71e658550c.js +1 -0
- package/assets/esri/core/workers/chunks/86ad6b020c01850d9095.js +1 -0
- package/assets/esri/core/workers/chunks/{fb7397da8d4ec2ae4587.js → 87458fbf395338511662.js} +1 -1
- package/assets/esri/core/workers/chunks/{1a859be598ad96bb4719.js → 8771296b537f366596c4.js} +18 -18
- package/assets/esri/core/workers/chunks/8958cd555f4887526e8b.js +1 -0
- package/assets/esri/core/workers/chunks/{e57b71ba70f088a3a052.js → 90dcd86cdef90099abfa.js} +1 -1
- package/assets/esri/core/workers/chunks/93067e27eea5844edc6c.js +1 -0
- package/assets/esri/core/workers/chunks/{9fbee2d9bf50c4c148c6.js → 9a146c9e9b4bf7fba88f.js} +1 -1
- package/assets/esri/core/workers/chunks/9b9821772b6cbe189fe0.js +1 -0
- package/assets/esri/core/workers/chunks/{6c4ce530b493c6f7c430.js → 9df2f9f7c28b31866be8.js} +1 -1
- package/assets/esri/core/workers/chunks/{d0620ce99b620621d8bc.js → a0552044e123a3c51ddf.js} +1 -1
- package/assets/esri/core/workers/chunks/acc1a4acd57f5657e782.js +1 -0
- package/assets/esri/core/workers/chunks/b055ae7c54796751b64c.js +1 -0
- package/assets/esri/core/workers/chunks/{acc2cfb116fee7f82ae9.js → b26bd8fde2fc65bb67fb.js} +1 -1
- package/assets/esri/core/workers/chunks/{9b45b94c4dbdc8d2c5fd.js → b34ba22c7a5adce8a7a2.js} +1 -1
- package/assets/esri/core/workers/chunks/b75665d0bf417c6ef24a.js +1 -0
- package/assets/esri/core/workers/chunks/bd50ec30688463b821d1.js +1 -0
- package/assets/esri/core/workers/chunks/c28f7ae4756ad1ba94bd.js +1 -0
- package/assets/esri/core/workers/chunks/c4f713959d4115b87c6c.js +1 -0
- package/assets/esri/core/workers/chunks/c58aa209492bd94b7aad.js +1 -0
- package/assets/esri/core/workers/chunks/{9b117097b7be0efd21d4.js → c59b0b58e24e6a60cf3e.js} +1 -1
- package/assets/esri/core/workers/chunks/c7bd5a4d318299388645.js +1 -0
- package/assets/esri/core/workers/chunks/c7cee13a962396b23a5e.js +1 -0
- package/assets/esri/core/workers/chunks/{3bbff5ea1ea0e955c592.js → cd3679fa86129ebabfdf.js} +1 -1
- package/assets/esri/core/workers/chunks/{1a36dc0daffd536ea44d.js → cee7ce362860717713bf.js} +1 -1
- package/assets/esri/core/workers/chunks/cf463d6309f14df2f2fa.js +1 -0
- package/assets/esri/core/workers/chunks/{224c0e64160bdc170051.js → d076627bb7dadea89e89.js} +1 -1
- package/assets/esri/core/workers/chunks/{fff4200bc61b82dd6193.js → d1d1c45243af614f2e74.js} +1 -1
- package/assets/esri/core/workers/chunks/{1e0498dc9836658d9aba.js → d5fd12ea541c1a6b7fce.js} +1 -1
- package/assets/esri/core/workers/chunks/{10322d990cda5aedf2f0.js → d6e32ca237ad9309c76a.js} +1 -1
- package/assets/esri/core/workers/chunks/e06ad3a3d71154fed654.js +1 -0
- package/assets/esri/core/workers/chunks/{7a77d4cd27c30f1a5cae.js → ee3387a43dfbb3df23e1.js} +1 -1
- package/assets/esri/core/workers/chunks/{5d5fa2b1fc48a17eb9ab.js → f4fc165420d449e442b8.js} +1 -1
- package/assets/esri/core/workers/chunks/{3d6d9906a534ddd8fa37.js → f5ee03f3fca7a75192de.js} +1 -1
- package/assets/esri/themes/base/widgets/_Daylight.scss +1 -1
- package/assets/esri/themes/base/widgets/_ElevationProfile.scss +1 -1
- package/assets/esri/themes/base/widgets/_Weather.scss +1 -1
- package/assets/esri/themes/base/widgets/_Widget.scss +12 -0
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/dark-blue/main.css +1 -1
- package/assets/esri/themes/dark-green/main.css +1 -1
- package/assets/esri/themes/dark-purple/main.css +1 -1
- package/assets/esri/themes/dark-red/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/themes/light-blue/main.css +1 -1
- package/assets/esri/themes/light-green/main.css +1 -1
- package/assets/esri/themes/light-purple/main.css +1 -1
- package/assets/esri/themes/light-red/main.css +1 -1
- package/chunks/ComponentShader.glsl.js +25 -25
- package/chunks/HighlightApply.glsl.js +36 -0
- package/chunks/HighlightBlur.glsl.js +26 -0
- package/chunks/HighlightDownsample.glsl.js +12 -0
- package/chunks/ImageMaterial.glsl.js +8 -8
- package/chunks/LineCallout.glsl.js +1 -1
- package/chunks/Pattern.glsl.js +2 -2
- package/chunks/SimpleAtmosphere.glsl.js +7 -7
- package/chunks/Stars.glsl.js +1 -1
- package/chunks/arcade.js +1 -1
- package/chunks/color.js +1 -1
- package/chunks/languageUtils.js +1 -1
- package/chunks/mat3.js +1 -1
- package/copyright.txt +2 -2
- package/core/AsyncUpdate.js +1 -1
- package/core/Evented.js +1 -1
- package/core/PooledArray.js +1 -1
- package/core/accessorSupport/diffUtils.js +1 -1
- package/core/accessorSupport/get.js +1 -1
- package/core/accessorSupport/read.js +1 -1
- package/core/accessorSupport/set.js +1 -1
- package/core/accessorSupport/tracking.js +1 -1
- package/core/accessorSupport/utils.js +1 -1
- package/core/arrayUtils.js +1 -1
- package/core/libs/gl-matrix-2/mat3.js +1 -1
- package/core/libs/gl-matrix-2/math/mat3.js +1 -1
- package/core/number.js +1 -1
- package/core/object.js +1 -1
- package/core/string.js +1 -1
- package/core/unitUtils.js +1 -1
- package/core/watchUtils.js +1 -1
- package/core/workers/RemoteClient.js +1 -1
- package/exports/csv.js +1 -1
- package/geometry/support/heightModelInfoUtils.js +1 -1
- package/geometry/support/meshUtils/exporters/gltf/geometry.js +1 -1
- package/geometry/support/normalizeUtils.js +1 -1
- package/identity/IdentityManagerBase.js +1 -1
- package/interfaces.d.ts +155 -20
- package/layers/ImageryLayer.js +1 -1
- package/layers/MapImageLayer.js +1 -1
- package/layers/RouteLayer.js +1 -1
- package/layers/SceneLayer.js +1 -1
- package/layers/SubtypeGroupLayer.js +1 -1
- package/layers/TileLayer.js +1 -1
- package/layers/VectorTileLayer.js +1 -1
- package/layers/WMSLayer.js +1 -1
- package/layers/WMTSLayer.js +1 -1
- package/layers/WebTileLayer.js +1 -1
- package/layers/graphics/data/AttributesBuilder.js +1 -1
- package/layers/graphics/data/QueryEngine.js +1 -1
- package/layers/graphics/editingSupport.js +1 -1
- package/layers/graphics/sources/connections/GeoEventConnection.js +1 -1
- package/layers/graphics/sources/support/MemorySourceWorker.js +1 -1
- package/layers/graphics/sources/support/inferenceUtils.js +1 -1
- package/layers/mixins/ArcGISCachedService.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/layers/ogc/ogcFeatureUtils.js +1 -1
- package/layers/support/ExportImageServiceParameters.js +1 -1
- package/layers/support/PixelBlock.js +1 -1
- package/layers/support/RasterJobHandler.js +1 -1
- package/layers/support/SpriteSource.js +1 -1
- package/layers/support/Sublayer.js +1 -1
- package/layers/support/TilemapCache.js +1 -1
- package/layers/support/WMTSSublayer.js +1 -1
- package/layers/support/arcgisLayerUrl.js +1 -1
- package/layers/support/fieldUtils.js +1 -1
- package/layers/support/kmlUtils.js +1 -1
- package/layers/support/layerUtils.js +1 -1
- package/layers/support/rasterDatasets/ImageAuxRaster.js +1 -1
- package/layers/support/rasterDatasets/ImageServerRaster.js +1 -1
- package/layers/support/rasterDatasets/RasterFactory.js +1 -1
- package/layers/support/rasterDatasets/WCSRaster.js +1 -1
- package/layers/support/rasterDatasets/multipartParser.js +1 -1
- package/layers/support/rasterDatasets/wcsCoverageParser.js +1 -1
- package/layers/support/rasterDatasets/xmlUtilities.js +1 -1
- package/layers/support/rasterFormats/RasterCodec.js +1 -1
- package/layers/support/rasterFormats/TiffDecoder.js +1 -1
- package/layers/support/rasterFunctions/pixelUtils.js +1 -1
- package/layers/support/vectorTileLayerLoader.js +1 -1
- package/layers/support/wmsUtils.js +1 -1
- package/layers/support/wmtsUtils.js +1 -1
- package/libs/i3s/I3SModule.js +1 -1
- package/libs/vxl/VxlModule.js +1 -1
- package/package.json +1 -1
- package/portal/Portal.js +1 -1
- package/portal/PortalItem.js +1 -1
- package/portal/schemas/definitions.js +1 -1
- package/portal/support/layersLoader.js +1 -1
- package/portal/support/portalItemUtils.js +1 -1
- package/portal/support/portalLayers.js +1 -1
- package/renderers/support/AuthoringInfoVisualVariable.js +1 -1
- package/renderers/support/DictionaryLoader.js +1 -1
- package/renderers/support/RasterSymbolizer.js +1 -1
- package/renderers/support/numberUtils.js +1 -1
- package/renderers/support/rasterRendererHelper.js +1 -1
- package/renderers/support/utils.js +1 -1
- package/request.js +1 -1
- package/rest/imageService.js +1 -1
- package/rest/operations/find.js +1 -1
- package/rest/query/operations/query.js +1 -1
- package/rest/query/operations/queryRelatedRecords.js +1 -1
- package/rest/query/operations/queryTopFeatures.js +1 -1
- package/rest/support/DirectionLine.js +1 -1
- package/rest/support/DirectionPoint.js +1 -1
- package/rest/support/PointBarrier.js +1 -1
- package/rest/support/PolygonBarrier.js +1 -1
- package/rest/support/PolylineBarrier.js +1 -1
- package/rest/support/RouteInfo.js +1 -1
- package/rest/support/Stop.js +1 -1
- package/smartMapping/labels/clusters.js +1 -1
- package/smartMapping/popup/dotDensity.js +1 -1
- package/smartMapping/popup/support/clusterUtils.js +1 -1
- package/smartMapping/popup/support/utils.js +1 -1
- package/smartMapping/raster/support/utils.js +1 -1
- package/smartMapping/renderers/color.js +1 -1
- package/smartMapping/renderers/location.js +1 -1
- package/smartMapping/renderers/predominance.js +1 -1
- package/smartMapping/renderers/relationship.js +1 -1
- package/smartMapping/renderers/size.js +1 -1
- package/smartMapping/renderers/support/utils.js +1 -1
- package/smartMapping/renderers/type.js +1 -1
- package/smartMapping/renderers/univariateColorSize.js +1 -1
- package/smartMapping/statistics/summaryStatisticsForAge.js +1 -1
- package/smartMapping/statistics/support/ageUtils.js +1 -1
- package/smartMapping/statistics/support/utils.js +1 -1
- package/smartMapping/support/adapters/SceneLayerAdapter.js +1 -1
- package/smartMapping/support/adapters/support/utils.js +1 -1
- package/smartMapping/support/utils.js +1 -1
- package/smartMapping/symbology/support/Theme.js +1 -1
- package/smartMapping/symbology/support/colorRamps.js +1 -1
- package/smartMapping/symbology/support/symbologyUtils.js +1 -1
- package/smartMapping/symbology/support/utils.js +1 -1
- package/statistics/utils.js +1 -1
- package/support/basemapDefinitions.js +1 -1
- package/support/basemapUtils.js +1 -1
- package/support/elevationInfoUtils.js +1 -1
- package/support/popupUtils.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/CIMSymbolRasterizer.js +1 -1
- package/symbols/cim/cimAnalyzer.js +1 -1
- package/symbols/cim/utils.js +1 -1
- package/symbols/support/previewSymbol3D.js +1 -1
- package/symbols/support/renderUtils.js +1 -1
- package/symbols/support/symbolLayerUtils.js +1 -1
- package/views/2d/engine/Bitmap.js +1 -1
- package/views/2d/engine/flow/FlowDisplayObject.js +1 -1
- package/views/2d/engine/imagery/RasterBitmap.js +1 -1
- package/views/2d/engine/imagery/RasterVFDisplayObject.js +1 -1
- package/views/2d/engine/vectorTiles/TextShaping.js +1 -1
- package/views/2d/engine/vectorTiles/TileParser.js +1 -1
- package/views/2d/engine/vectorTiles/buckets/SymbolBucket.js +1 -1
- package/views/2d/engine/vectorTiles/expression/expression.js +1 -1
- package/views/2d/engine/vectorTiles/shaders/VTLMaterial.js +1 -1
- package/views/2d/engine/webgl/Profiler.js +1 -1
- package/views/2d/engine/webgl/Utils.js +1 -1
- package/views/2d/engine/webgl/brushes/WGLGeometryBrush.js +1 -1
- package/views/2d/engine/webgl/definitions.js +1 -1
- package/views/2d/engine/webgl/effects/HittestEffect.js +1 -1
- package/views/2d/engine/webgl/effects/HittestEffectVTL.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/WGLTemplateStore.js +1 -1
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/2d/engine/webgl/util/Lock.js +1 -1
- package/views/2d/layers/RouteLayerView2D.js +1 -1
- package/views/2d/layers/features/schemaUtils.js +1 -1
- package/views/2d/layers/features/sources/SnapshotFeatureSource.js +1 -1
- package/views/2d/layers/features/support/AttributeStore.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderPBF.js +1 -1
- package/views/2d/layers/features/tileRenderers/SymbolTileRenderer.js +1 -1
- package/views/2d/layers/support/webStyleUtils.js +1 -1
- package/views/2d/support/Timeline.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightIntersectionResult.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightRayIntersector.js +1 -1
- package/views/3d/analysis/Slice/SliceController.js +1 -1
- package/views/3d/environment/PanoramicAtmosphere.js +1 -1
- package/views/3d/environment/SceneViewAtmosphere.js +1 -1
- package/views/3d/environment/StarsTechnique.js +1 -1
- package/views/3d/externalRenderers/ExternalRendererStore.js +1 -1
- package/views/3d/glTF/loader.js +1 -1
- package/views/3d/interactive/analysisTools/lineOfSight/LineOfSightTool.js +1 -1
- package/views/3d/interactive/analysisTools/slice/SliceTool.js +1 -1
- package/views/3d/layers/BuildingComponentSublayerView3D.js +1 -1
- package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/ImageryLayerView3D.js +1 -1
- package/views/3d/layers/LayerView3D.js +1 -1
- package/views/3d/layers/PointCloudLayerView3D.js +1 -1
- package/views/3d/layers/RouteLayerView3D.js +1 -1
- package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
- package/views/3d/layers/VectorTileLayerView3D.js +1 -1
- package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
- package/views/3d/layers/i3s/I3SIndex.js +1 -1
- package/views/3d/layers/i3s/I3SMeshViewFilter.js +1 -1
- package/views/3d/layers/i3s/I3SNodeLoader.js +1 -1
- package/views/3d/layers/i3s/I3SUtil.js +1 -1
- package/views/3d/layers/i3s/IDBMockCache.js +5 -0
- package/views/3d/layers/i3s/PointCloudWorkerUtil.js +1 -1
- package/views/3d/layers/support/PopupSceneLayerView.js +1 -1
- package/views/3d/state/ViewStateManager.js +1 -1
- package/views/3d/state/controllers/RotateController.js +1 -1
- package/views/3d/state/controllers/global/PinchAndPanController.js +1 -1
- package/views/3d/state/controllers/global/ZoomController.js +1 -1
- package/views/3d/state/controllers/global/ZoomStepController.js +1 -1
- package/views/3d/state/controllers/local/PinchAndPanController.js +1 -1
- package/views/3d/state/controllers/local/ZoomController.js +1 -1
- package/views/3d/support/HighlightOptions.js +1 -1
- package/views/3d/support/buffer/InterleavedLayout.js +1 -1
- package/views/3d/support/debugFlags.js +1 -1
- package/views/3d/support/orientedBoundingBox.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/webgl-engine/Stage.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
- package/views/3d/webgl-engine/collections/Component/DepthRange.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/ForwardLinearDepth.glsl.js +3 -3
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexPosition.glsl.js +5 -5
- package/views/3d/webgl-engine/core/shaderModules/ShaderBuilder.js +1 -1
- package/views/3d/webgl-engine/lib/HighlightHelper.js +1 -1
- package/views/3d/webgl-engine/lib/Object3D.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeShaderParameters.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/InstanceData.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
- package/views/3d/webgl-engine/materials/WaterTechnique.js +1 -1
- package/views/3d/webgl-engine/parts/ScreenshotManager.js +1 -1
- package/views/3d/webgl-engine/shaders/HighlightApply.glsl.js +5 -0
- package/views/3d/webgl-engine/shaders/HighlightApplyTechnique.js +5 -0
- package/views/3d/webgl-engine/shaders/HighlightBlur.glsl.js +5 -0
- package/views/3d/webgl-engine/shaders/HighlightBlurTechnique.js +5 -0
- package/views/3d/webgl-engine/shaders/HighlightDownsample.glsl.js +5 -0
- package/views/3d/webgl-engine/shaders/HighlightDownsampleTechnique.js +5 -0
- package/views/3d/webgl-engine/shaders/HighlightOptions.js +4 -0
- package/views/3d/webgl-engine/shaders/HighlightPassParameters.js +5 -0
- package/views/3d/webgl-engine/shaders/ImageMaterial.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/ImageMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/NativeLineTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/PatternTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/sources/edgeRenderer/AdjustProjectedPosition.glsl.js +5 -7
- package/views/3d/webgl-engine/shaders/sources/edgeRenderer/EdgeUtil.glsl.js +14 -14
- package/views/SceneView.js +1 -1
- package/views/draw/support/GraphicMover.js +1 -1
- package/views/input/InputHandler.js +1 -1
- package/views/input/InputManager.js +1 -1
- package/views/layers/ImageryTileLayerView.js +1 -1
- package/views/layers/MapImageLayerView.js +1 -1
- package/views/layers/TileLayerView.js +1 -1
- package/views/layers/support/popupUtils.js +1 -1
- package/views/support/DefaultsFromMap.js +1 -1
- package/views/support/Scheduler.js +1 -1
- package/views/support/screenshotUtils.js +1 -1
- package/views/ui/DefaultUI.js +1 -1
- package/views/webgl/ShaderTranspiler.js +1 -1
- package/webscene/Slide.js +1 -1
- package/webscene/spec-certification/spec.js +1 -1
- package/widgets/AreaMeasurement3D/AreaMeasurement3DViewModel.js +1 -1
- package/widgets/Attachments/support/attachmentUtils.js +1 -1
- package/widgets/Attachments.js +1 -1
- package/widgets/Attribution.js +1 -1
- package/widgets/BasemapLayerList.js +1 -1
- package/widgets/Bookmarks/BookmarksViewModel.js +1 -1
- package/widgets/Bookmarks.js +1 -1
- package/widgets/BuildingExplorer/support/filterUtils.js +1 -1
- package/widgets/CoordinateConversion/CoordinateConversionViewModel.js +1 -1
- package/widgets/CoordinateConversion/support/coordinateConversionUtils.js +1 -1
- package/widgets/CoordinateConversion/support/formatUtils.js +1 -1
- package/widgets/DirectLineMeasurement3D/DirectLineMeasurement3DViewModel.js +1 -1
- package/widgets/Directions/DirectionsViewModel.js +1 -1
- package/widgets/Directions.js +1 -1
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Editor/workflowUtils.js +1 -1
- package/widgets/Editor.js +1 -1
- package/widgets/ElevationProfile/ElevationProfileViewModel.js +1 -1
- package/widgets/Feature/FeatureMedia.js +1 -1
- package/widgets/Feature/support/featureUtils.js +1 -1
- package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
- package/widgets/FeatureForm/InputField.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FeatureTable/Grid/Grid.js +1 -1
- package/widgets/FeatureTable/support/FeatureStore.js +1 -1
- package/widgets/FeatureTemplates.js +1 -1
- package/widgets/FloorFilter/FloorFilterViewModel.js +1 -1
- package/widgets/LayerList/ListItemPanel.js +1 -1
- package/widgets/LayerList.js +1 -1
- package/widgets/Legend/LegendViewModel.js +1 -1
- package/widgets/Legend/styles/Card.js +1 -1
- package/widgets/Legend/styles/Classic.js +1 -1
- package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
- package/widgets/Legend/support/colorRampUtils.js +1 -1
- package/widgets/Legend/support/relationshipRampUtils.js +1 -1
- package/widgets/Legend/support/sizeRampUtils.js +1 -1
- package/widgets/Popup/PopupViewModel.js +1 -1
- package/widgets/Popup/actionUtils.js +1 -1
- package/widgets/Print/PrintViewModel.js +1 -1
- package/widgets/Print.js +1 -1
- package/widgets/ScaleBar/ScaleBarViewModel.js +1 -1
- package/widgets/Search/SearchViewModel.js +1 -1
- package/widgets/Search/support/layerSearchUtils.js +1 -1
- package/widgets/Slider.js +1 -1
- package/widgets/Swipe.js +1 -1
- package/widgets/TableList.js +1 -1
- package/widgets/TimeSlider/TimeSliderViewModel.js +1 -1
- package/widgets/TimeSlider.js +1 -1
- package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
- package/widgets/support/DatePicker.js +1 -1
- package/widgets/support/Popover.js +1 -1
- package/widgets/support/SnappingControls.js +1 -1
- package/widgets/support/TimePicker.js +1 -1
- package/widgets/support/timeWidgetUtils.js +1 -1
- package/assets/esri/core/workers/chunks/083a5d10f8e243641cb9.js +0 -1
- package/assets/esri/core/workers/chunks/0872812ce4d0ec8faf8f.js +0 -1
- package/assets/esri/core/workers/chunks/0bc26899780c33637746.js +0 -1
- package/assets/esri/core/workers/chunks/113362697da1b69deaed.js +0 -1
- package/assets/esri/core/workers/chunks/11a2f9708938eac98815.js +0 -1
- package/assets/esri/core/workers/chunks/11a45709b703be84caaf.js +0 -1
- package/assets/esri/core/workers/chunks/1c1294ff1ebbd8f774f7.js +0 -1
- package/assets/esri/core/workers/chunks/1c915cc9a9d5729b6f17.js +0 -1
- package/assets/esri/core/workers/chunks/31786756b3d44540f8c0.js +0 -1
- package/assets/esri/core/workers/chunks/36a6f34fe40785beff5d.js +0 -1
- package/assets/esri/core/workers/chunks/373c16f8b8093d001064.js +0 -1
- package/assets/esri/core/workers/chunks/382a331a592abb61267f.js +0 -1
- package/assets/esri/core/workers/chunks/3bf106fe34e3992032c4.js +0 -1
- package/assets/esri/core/workers/chunks/3dcec610f1c1497d87bc.js +0 -1
- package/assets/esri/core/workers/chunks/46495e726d8739260d44.js +0 -1
- package/assets/esri/core/workers/chunks/4a82a6a473b3d540d0be.js +0 -1
- package/assets/esri/core/workers/chunks/4b6719377a95ac10fa43.js +0 -1
- package/assets/esri/core/workers/chunks/4d2ef57ff3a5cfc1313f.js +0 -1
- package/assets/esri/core/workers/chunks/4fd2b8153d62592210a2.js +0 -1
- package/assets/esri/core/workers/chunks/56e6a1079269e2964b02.js +0 -1
- package/assets/esri/core/workers/chunks/5b4d9786c010d265346c.js +0 -1
- package/assets/esri/core/workers/chunks/604637e1c3937b376a0d.js +0 -1
- package/assets/esri/core/workers/chunks/60f83257e361f87fa6fd.js +0 -1
- package/assets/esri/core/workers/chunks/6d3f80be6fceb2c18b5d.js +0 -1
- package/assets/esri/core/workers/chunks/6f827a32646bab0a8777.js +0 -1
- package/assets/esri/core/workers/chunks/70bd2ab42e3801ef5974.js +0 -1
- package/assets/esri/core/workers/chunks/746222184b361b50d6ba.js +0 -1
- package/assets/esri/core/workers/chunks/7fb72b2d11e8d840f982.js +0 -1
- package/assets/esri/core/workers/chunks/85bb6a1a7704fcdcbec2.js +0 -1
- package/assets/esri/core/workers/chunks/8b4c76cebb100e6c06f8.js +0 -1
- package/assets/esri/core/workers/chunks/9586a6b320edb1922926.js +0 -1
- package/assets/esri/core/workers/chunks/99638697ffda9022ce92.js +0 -1
- package/assets/esri/core/workers/chunks/a9da1cb118ca62a9581d.js +0 -1
- package/assets/esri/core/workers/chunks/aaa41a5013eef713c032.js +0 -1
- package/assets/esri/core/workers/chunks/ac321f939dd488ff6ce4.js +0 -1
- package/assets/esri/core/workers/chunks/add6027a96398ecf69de.js +0 -1
- package/assets/esri/core/workers/chunks/b75206b46ba81606087c.js +0 -1
- package/assets/esri/core/workers/chunks/bf8456828e38a768eba3.js +0 -1
- package/assets/esri/core/workers/chunks/c0720d0d8adcba6738d4.js +0 -1
- package/assets/esri/core/workers/chunks/c5bb712d5cf8c05a4e13.js +0 -1
- package/assets/esri/core/workers/chunks/d343f05a3366f95e0494.js +0 -1
- package/assets/esri/core/workers/chunks/d8b1f00075983d769985.js +0 -1
- package/chunks/Highlight.glsl.js +0 -88
- package/views/3d/webgl-engine/shaders/Highlight.glsl.js +0 -5
- package/views/3d/webgl-engine/shaders/HighlightTechnique.js +0 -5
- package/views/3d/webgl-engine/shaders/HighlightTechniqueConfiguration.js +0 -5
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../Color.js";import{isSymbol3D as l}from"../../../symbols.js";import{round as t,numDigits as n,percentChange as o}from"../../../renderers/support/numberUtils.js";import{applyCIMSymbolColor as i}from"../../../symbols/support/cimSymbolUtils.js";import{isVolumetricSymbol as s,getSymbolOutlineSize as r}from"../../../symbols/support/utils.js";import{createStopLabel as a,getSymbolForFlowRenderer as u}from"./utils.js";import{isDarkTheme as c}from"../../support/widgetThemeUtils.js";const m=30,f=12,p=[255,255,255],y=[200,200,200],b=[128,128,128],d=20,h=5;function v(e){return"esri.symbols.SimpleMarkerSymbol"===e.declaredClass}function g(e){return"esri.symbols.PictureMarkerSymbol"===e.declaredClass}function w(e){return"esri.symbols.SimpleLineSymbol"===e.declaredClass}function S(e){return"esri.symbols.TextSymbol"===e.declaredClass}function z(e,l){const t=e.length-1;return e.map(((e,n)=>a(e,n,t,l)))}async function
|
|
5
|
+
import e from"../../../Color.js";import{isSymbol3D as l}from"../../../symbols.js";import{round as t,numDigits as n,percentChange as o}from"../../../renderers/support/numberUtils.js";import{applyCIMSymbolColor as i}from"../../../symbols/support/cimSymbolUtils.js";import{isVolumetricSymbol as s,getSymbolOutlineSize as r}from"../../../symbols/support/utils.js";import{createStopLabel as a,getSymbolForFlowRenderer as u}from"./utils.js";import{isDarkTheme as c}from"../../support/widgetThemeUtils.js";const m=30,f=12,p=[255,255,255],y=[200,200,200],b=[128,128,128],d=20,h=5;function v(e){return"esri.symbols.SimpleMarkerSymbol"===e.declaredClass}function g(e){return"esri.symbols.PictureMarkerSymbol"===e.declaredClass}function w(e){return"esri.symbols.SimpleLineSymbol"===e.declaredClass}function S(e){return"esri.symbols.TextSymbol"===e.declaredClass}function z(e,l){const t=e.length-1;return e.map(((e,n)=>a(e,n,t,l)))}async function V(e,l,n,o,i,a){var u,c;const m=l.legendOptions,f=m&&m.customValues,p=await k(e,n),y=!!p,b=!!f,d=null!=l.minSize&&null!=l.maxSize,h=l.stops&&l.stops.length>1,v=!!l.target;if(!y||!b&&!(d||h&&!v))return;const g=s(p);let w=null,S=null,V=null;S=g&&!h?t([l.minDataValue,l.maxDataValue]):f||await U(l,p,o,i);const L=null==e?void 0:e.authoringInfo,C="univariate-color-size"===(null==L?void 0:L.type),I=C&&"above-and-below"===(null==L?void 0:L.univariateTheme);if(!S&&h&&(S=l.stops.map((e=>e.value)),w=l.stops.some((e=>!!e.label)),"flow"===e.type&&(S=t(S)),w&&(V=l.stops.map((e=>e.label)))),g&&(null==(u=S)?void 0:u.length)>2&&!I&&(S=[S[0],S[S.length-1]]),!S)return null;C&&5!==(null==(c=S)?void 0:c.length)&&(S=D({minSize:S[0],maxSize:S[S.length-1]}));const M=g?x(e,S):null,T=r(p),B=w?null:z(S,a);return(await Promise.all(S.map((async(t,n)=>{const s=g?M[n]:await E(l,p,t,o,i);return{value:t,symbol:q(I&&"class-breaks"===e.type?j(e,n):p,s),label:w?V[n]:B[n],size:s,outlineSize:T}})))).reverse()}function x(e,l){const t=null==e?void 0:e.authoringInfo,n="univariate-color-size"===(null==t?void 0:t.type);let o=[f,m];if(n){const e=l[0],t=l[l.length-1],n=f,i=m;o=l.map((l=>n+(l-e)/(t-e)*(i-n)))}return n&&"below"===(null==t?void 0:t.univariateTheme)&&o.reverse(),o}function j(e,l){const t=e.classBreakInfos,n=t.length,o=n<2||!(l>=2)?t[0].symbol.clone():t[n-1].symbol.clone();return e.visualVariables.some((e=>"color"===e.type))&&(o.type.includes("3d")?C(o):I(o)),o}async function k(e,l){if("flow"===e.type)return u(e,l);let t=null,n=null;if("simple"===e.type)t=e.symbol;else if("class-breaks"===e.type){const l=e.classBreakInfos;t=l&&l[0]&&l[0].symbol,n=l.length>1}else if("unique-value"===e.type){const l=e.uniqueValueInfos;t=l&&l[0]&&l[0].symbol,n=l.length>1}return!t||L(t)?null:(t=t.clone(),(l||n)&&(t.type.includes("3d")?C(t):I(t)),t)}function L(e){if(e){if(l(e)){return!!e.symbolLayers&&e.symbolLayers.some((e=>e&&"fill"===e.type))}return e.type.includes("fill")}return!1}function C(e){"line-3d"===e.type?e.symbolLayers.forEach((e=>{e.material={color:b}})):e.symbolLayers.forEach((e=>{"icon"!==e.type||e.resource&&e.resource.href?e.material={color:y}:(e.material={color:p},e.outline={color:b,size:1.5})}))}function I(l){const t=c();if("cim"===l.type)i(l,new e(y));else if(l.type.includes("line"))l.color=b;else if(l.color=t?b:p,"simple-marker"===l.type)if(l.outline){var n,o;"#ffffff"===(null==(n=l.outline)||null==(o=n.color)?void 0:o.toHex())&&(l.outline.color=b)}else l.outline={color:b,width:1.5}}async function U(e,l,n,o){const i=(await import("../../../renderers/visualVariables/support/visualVariableUtils.js")).getSizeRangeAtScale(e,n,o),s=i&&D(i);if(!i&&!s)return;let r=s.map((l=>M(l,e,i)));r=t(r);for(let t=1;t<r.length-1;t++){const i=await T(e,l,r[t],r[t-1],n,o);i&&(r[t]=i[0],s[t]=i[1])}return r}function D(e){const l=e.minSize,t=e.maxSize,n=h,o=(t-l)/(n-1),i=[];for(let s=0;s<n;s++)i.push(l+o*s);return i}function M(e,l,t){const n=t.minSize,o=t.maxSize,i=l.minDataValue,s=l.maxDataValue;let r=null;if(e<=n)r=i;else if(e>=o)r=s;else{r=(e-n)/(o-n)*(s-i)+i}return r}async function T(e,l,i,s,r,a){const u=await E(e,l,i,r,a),c=await E(e,l,s,r,a),m=n(i),f=m.fractional,p=d;let y=m.integer,b=null,h=null;i>0&&i<1&&(b=10**f,y=n(i*=b).integer);for(let n=y-1;n>=0;n--){const s=10**n;let m=Math.floor(i/s)*s,f=Math.ceil(i/s)*s;null!=b&&(m/=b,f/=b);let y=(m+f)/2;[,y]=t([m,y,f],{indexes:[1]});const d=await E(e,l,m,r,a),v=await E(e,l,f,r,a),g=await E(e,l,y,r,a),w=o(u,d,c,null),S=o(u,v,c,null),z=o(u,g,c,null);let V=w.previous<=p,x=S.previous<=p;if(V&&x&&(w.previous<=S.previous?(V=!0,x=!1):(x=!0,V=!1)),V?h=[m,d]:x?h=[f,v]:z.previous<=p&&(h=[y,g]),h)break}return h}async function E(e,l,t,n,o){const{getSize:i}=await import("../../../renderers/visualVariables/support/visualVariableUtils.js");return i(e,t,{scale:n,view:o,shape:"simple-marker"===l.type?l.style:null})}function q(e,t){const n=e.clone();if(l(n))s(n)||n.symbolLayers.forEach((e=>{"fill"!==e.type&&(e.size=t)}));else if(v(n))n.size=t;else if(g(n)){const e=n.width,l=n.height;n.height=t,n.width=t*(e/l)}else w(n)?n.width=t:S(n)&&n.font&&(n.font.size=t);return n}export{m as REAL_WORLD_MAX_SIZE,f as REAL_WORLD_MIN_SIZE,V as getRampStops};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../Graphic.js";import"../../symbols.js";import s from"../../core/Collection.js";import i from"../../core/Error.js";import o from"../../core/Handles.js";import r from"../../core/Logger.js";import{unwrap as n,isNone as a}from"../../core/maybe.js";import{init as l,watch as u,whenFalse as h}from"../../core/watchUtils.js";import{property as c}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";import{geographicToWebMercator as d}from"../../geometry/support/webMercatorUtils.js";import g from"../../layers/Layer.js";import f from"../../support/actions/ActionBase.js";import m from"../../support/actions/ActionButton.js";import y from"../../support/actions/ActionToggle.js";import{getDisplayedSymbol as w}from"../../symbols/support/symbolUtils.js";import{ViewEventPriorities as v}from"../../views/input/InputManager.js";import{highlightsSupported as F}from"../../views/support/layerViewUtils.js";import _ from"../Feature/FeatureViewModel.js";import{zoomToClusteredFeatures as b,browseClusteredFeatures as C,zoomToFeature as P}from"./actions.js";import{triggerAction as E,getSelectedTarget as A,removeClusteredFeaturesForBrowsing as M,displayClusterExtent as j,browseAggregateFeatures as V}from"./actionUtils.js";import O from"../support/AnchorElementViewModel.js";import{GoToMixin as x}from"../support/GoTo.js";import I from"../../symbols/SimpleFillSymbol.js";import L from"../../geometry/Point.js";const T=s.ofType({key:"type",defaultKeyValue:"button",base:f,typeMap:{button:m,toggle:y}}),S=()=>[P.clone()],B=()=>[b.clone(),C.clone()],R="esri.widgets.Popup.PopupViewModel",G=r.getLogger(R);let z=class extends(x(O)){constructor(e){super(e),this._handles=new o,this._pendingPromises=new Set,this._fetchFeaturesController=null,this._selectedClusterFeature=null,this.featurePage=null,this.actions=new T,this.defaultPopupTemplateEnabled=!1,this.autoCloseEnabled=!1,this.autoOpenEnabled=!0,this.browseClusterEnabled=!1,this.content=null,this.featuresPerPage=20,this.featureViewModelAbilities=null,this.featureViewModels=[],this.highlightEnabled=!0,this.includeDefaultActions=!0,this.selectedClusterBoundaryFeature=new t({symbol:new I({outline:{width:1.5,color:"cyan"},style:"none"})}),this.title=null,this.updateLocationEnabled=!1,this.view=null,this.visible=!1,this.zoomFactor=4,this.zoomToLocation=null}get isLoadingFeature(){return this.featureViewModels.some((e=>e.waitingForContent))}initialize(){this._handles.add([l(this,["autoOpenEnabled","view"],(()=>this._autoOpenEnabledChange())),this.on("view-change",(()=>this._autoClose())),u(this,["highlightEnabled","selectedFeature","visible","view"],(()=>this._highlightFeature())),u(this,"view.animation.state",(e=>this._animationStateChange(e))),u(this,"location",(e=>this._locationChange(e))),u(this,"selectedFeature",(e=>this._selectedFeatureChange(e))),u(this,["selectedFeatureIndex","featureCount","featuresPerPage"],(()=>this._selectedFeatureIndexChange())),u(this,["featurePage","selectedFeatureIndex","featureCount","featuresPerPage, featureViewModels"],(()=>this._setGraphicOnFeatureViewModels())),u(this,"featureViewModels",(()=>this._featureViewModelsChange())),this.on("trigger-action",(e=>E({event:e,view:this.view}))),h(this,"waitingForResult",(()=>this._waitingForResultChange()),!0),u(this,["features","view","view.map","view.spatialReference"],(()=>this._updateFeatureVMs())),u(this,["view.scale"],this._viewScaleChange),h(this,"visible",(()=>this.browseClusterEnabled=!1)),u(this,"browseClusterEnabled",(e=>e?this.enableClusterBrowsing():this.disableClusterBrowsing()))])}destroy(){this._cancelFetchingFeatures(),this._handles.destroy(),this._handles=null,this._pendingPromises.clear(),this.browseClusterEnabled=!1,this.view=null}get active(){return!(!this.visible||this.waitingForResult)}get allActions(){const e=this._get("allActions")||new T;e.removeAll();const{actions:t,defaultActions:s,defaultPopupTemplateEnabled:i,includeDefaultActions:o,selectedFeature:r}=this,n=o?s.concat(t):t,a=r&&("function"==typeof r.getEffectivePopupTemplate&&r.getEffectivePopupTemplate(i)||r.popupTemplate),l=a&&a.actions,u=a&&a.overwriteActions?l:l?l.concat(n):n;return u&&u.filter(Boolean).forEach((t=>e.add(t))),e}get defaultActions(){var e;const t=this._get("defaultActions")||new T;return t.removeAll(),t.addMany(null!=(e=this.selectedFeature)&&e.isAggregate?B():S()),t}get featureCount(){return this.features.length}get features(){return this._get("features")||[]}set features(e){const t=e||[];this._set("features",t);const{pendingPromisesCount:s,promiseCount:i,selectedFeatureIndex:o}=this,r=i&&t.length;r&&s&&-1===o?this.selectedFeatureIndex=0:r&&-1!==o||(this.selectedFeatureIndex=t.length?0:-1)}get location(){return this._get("location")||null}set location(e){const t=this.get("view.spatialReference.isWebMercator");e&&e.get("spatialReference.isWGS84")&&t&&(e=d(e)),this._set("location",e)}get pendingPromisesCount(){return this._pendingPromises.size}get waitingForResult(){return!(!(!!this._fetchFeaturesController||this.pendingPromisesCount>0)||0!==this.featureCount)}get promiseCount(){return this.promises.length}get promises(){return this._get("promises")||[]}set promises(e){if(this._pendingPromises.clear(),this.features=[],!Array.isArray(e)||!e.length)return this._set("promises",[]),void this.notifyChange("pendingPromisesCount");this._set("promises",e),(e=e.slice(0)).forEach((e=>{this._pendingPromises.add(e);const t=t=>{this._pendingPromises.has(e)&&this._updateFeatures(t),this._updatePendingPromises(e)},s=()=>this._updatePendingPromises(e);e.then(t,s)})),this.notifyChange("pendingPromisesCount")}get selectedFeature(){const{features:e,selectedFeatureIndex:t}=this;if(-1===t)return null;return e[t]||null}get selectedFeatureIndex(){const e=this._get("selectedFeatureIndex");return"number"==typeof e?e:-1}set selectedFeatureIndex(e){const{featureCount:t}=this;e=isNaN(e)||e<-1||!t?-1:(e+t)%t,this._set("selectedFeatureIndex",e)}get selectedFeatureViewModel(){return this.featureViewModels[this.selectedFeatureIndex]||null}get state(){return this.get("view.ready")?"ready":"disabled"}centerAtLocation(){const{view:e}=this,t=A(this);if(!t){const s=new i("center-at-location:invalid-target-or-view","Cannot center at a location without a target and view.",{target:t,view:e});return G.error(s),Promise.reject(s)}return this.callGoTo({target:{target:t,scale:e.scale}})}clear(){this.set({promises:[],features:[],content:null,title:null,location:null})}fetchFeatures(e,t){const{view:s}=this;if(!s||!e){const t=new i("fetch-features:invalid-screenpoint-or-view","Cannot fetch features without a screenPoint and view.",{screenPoint:e,view:s});return G.error(t),Promise.reject(t)}return s.fetchPopupFeatures(e,{event:t&&t.event,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,signal:t&&t.signal})}open(e){const t={updateLocationEnabled:!1,promises:[],fetchFeatures:!1,...e,visible:!0},{fetchFeatures:s}=t;delete t.fetchFeatures,s&&this._setFetchFeaturesPromises(t.location);const i=["actionsMenuOpen","collapsed","featureMenuOpen"];for(const o of i)delete t[o];this.set(t)}triggerAction(e){const t=this.allActions.getItemAt(e);t&&!t.disabled&&this.emit("trigger-action",{action:t})}next(){return this.selectedFeatureIndex=this.selectedFeatureIndex+1,this}previous(){return this.selectedFeatureIndex=this.selectedFeatureIndex-1,this}disableClusterBrowsing(){M(this),this._clearBrowsedClusterGraphics()}async enableClusterBrowsing(){await j(this),await V(this)}_animationStateChange(e){this.zoomToLocation||(P.disabled="waiting-for-target"===e)}_clearBrowsedClusterGraphics(){var e;const t=null==(e=this.view)?void 0:e.graphics;t&&(t.remove(this.selectedClusterBoundaryFeature),t.remove(this._selectedClusterFeature)),this._selectedClusterFeature=null,this.selectedClusterBoundaryFeature.geometry=null}_viewScaleChange(){var e;if(null!=(e=this.selectedFeature)&&e.isAggregate)return this.browseClusterEnabled=!1,this.visible=!1,void this.clear();this.browseClusterEnabled&&(this.browseClusterEnabled=!1,this.features=[this.selectedFeature])}_locationChange(e){const{selectedFeature:t,updateLocationEnabled:s}=this;s&&e&&(!t||t.geometry)&&this.centerAtLocation()}_selectedFeatureIndexChange(){this.featurePage=this.featureCount>1?Math.floor(this.selectedFeatureIndex/this.featuresPerPage)+1:null}_featureViewModelsChange(){this.featurePage=this.featureCount>1?1:null}_setGraphicOnFeatureViewModels(){const{features:e,featureCount:t,featurePage:s,featuresPerPage:i,featureViewModels:o}=this;if(null===s)return;const r=((s-1)*i+t)%t,n=r+i;o.slice(r,n).forEach(((t,s)=>{t&&!t.graphic&&(t.graphic=e[r+s])}))}async _selectedFeatureChange(e){if(!e)return;const{location:t,updateLocationEnabled:s,view:i}=this;if(this.browseClusterEnabled){if(this._selectedClusterFeature&&(i.graphics.remove(this._selectedClusterFeature),this._selectedClusterFeature=null),e.isAggregate)return;return e.symbol=await w(e),this._selectedClusterFeature=e,void i.graphics.add(this._selectedClusterFeature)}!s&&t||!e.geometry?s&&!e.geometry&&this.centerAtLocation().then((()=>{this.location=i.center.clone()})):this.location=n(this._getPointFromGeometry(e.geometry))}_waitingForResultChange(){!this.featureCount&&this.promises&&(this.visible=!1)}_setFetchFeaturesPromises(e){return this._fetchFeaturesWithController(this._getScreenPoint(e||this.location)).then((e=>{const{clientOnlyGraphics:t,promisesPerLayerView:s}=e,i=Promise.resolve(t),o=s.map((e=>e.promise));this.promises=[i,...o]}))}_destroyFeatureVMs(){this.featureViewModels.forEach((e=>e&&!e.destroyed&&e.destroy())),this._set("featureViewModels",[])}_updateFeatureVMs(){const{selectedFeature:e,features:t,featureViewModels:s}=this;if(null!=e&&e.isAggregate||(this.browseClusterEnabled=!1),this._destroyFeatureVMs(),!t||!t.length)return;const i=s.slice(0),o=[];t.forEach(((t,s)=>{if(!t)return;let r=null;if(i.some(((e,s)=>(e&&e.graphic===t&&(r=e,i.splice(s,1)),!!r))),r)o[s]=r;else{var n,a;const i=new _({abilities:this.featureViewModelAbilities,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,spatialReference:null==(n=this.view)?void 0:n.spatialReference,graphic:t===e?t:null,map:null==(a=this.view)?void 0:a.map,view:this.view});o[s]=i}})),i.forEach((e=>e&&!e.destroyed&&e.destroy())),this._set("featureViewModels",o)}_getScreenPoint(e){const{view:t}=this;return t&&e&&"function"==typeof t.toScreen?t.toScreen(e):null}_autoOpenEnabledChange(){const e="auto-fetch-features",{_handles:t,autoOpenEnabled:s}=this;if(t.remove(e),s&&this.view){const s=this.view.on("click",(e=>{"mouse"===e.pointerType&&0!==e.button||this._fetchFeaturesAndOpen(e)}),v.WIDGET);t.add(s,e)}}_cancelFetchingFeatures(){const e=this._fetchFeaturesController;e&&e.abort(),this._fetchFeaturesController=null,this.notifyChange("waitingForResult")}_fetchFeaturesWithController(e,t){this._cancelFetchingFeatures();const s=new AbortController,{signal:i}=s;this._fetchFeaturesController=s,this.notifyChange("waitingForResult");const o=this.fetchFeatures(e,{signal:i,event:t});return o.catch((()=>{})).then((()=>{this._fetchFeaturesController=null,this.notifyChange("waitingForResult")})),o}_fetchFeaturesAndOpen(e){const{screenPoint:t,mapPoint:s}=e,{view:i}=this;this._fetchFeaturesWithController(t,e).then((e=>{const{clientOnlyGraphics:t,promisesPerLayerView:o,location:r}=e,n=[Promise.resolve(t),...o.map((e=>e.promise))];return i.popup.open({location:r||s,promises:n}),e}))}_updatePendingPromises(e){e&&this._pendingPromises.has(e)&&(this._pendingPromises.delete(e),this.notifyChange("pendingPromisesCount"))}_autoClose(){this.autoCloseEnabled&&(this.visible=!1)}_getPointFromGeometry(e){return a(e)?null:"point"===e.type?e:"extent"===e.type?e.center:"polygon"===e.type?e.centroid:"multipoint"===e.type||"polyline"===e.type?e.extent.center:null}async _getLayerView(e,t){return await e.when(),e.whenLayerView(t)}async _highlightFeature(){const e="highlight";this._handles.remove(e);const{selectedFeature:t,highlightEnabled:s,view:i,visible:o}=this;if(!(t&&i&&s&&o))return;let{layer:r,sourceLayer:n}=t;if("map-notes"!==(null==n?void 0:n.type)&&"subtype-group"!==(null==n?void 0:n.type)||(r=n),!(r&&r instanceof g))return;const a=this._getLayerView(i,r);this._highlightPromise=a;const l=await a;if(!(l&&F(l)&&this._highlightPromise===a&&this.selectedFeature&&this.highlightEnabled&&this.visible))return;const u="imagery"===r.type?void 0:"objectIdField"in r&&r.objectIdField,h=t.attributes,c=h&&u&&h[u],p=l.highlight(c||t);this._handles.add(p,e)}_updateFeatures(e){const{features:t}=this;if(!e||!e.length)return;if(!t.length)return void(this.features=e);const s=e.filter((e=>-1===t.indexOf(e)));this.features=t.concat(s)}};e([c()],z.prototype,"featurePage",void 0),e([c()],z.prototype,"isLoadingFeature",null),e([c({type:T})],z.prototype,"actions",void 0),e([c({readOnly:!0})],z.prototype,"active",null),e([c({readOnly:!0})],z.prototype,"allActions",null),e([c({type:Boolean})],z.prototype,"defaultPopupTemplateEnabled",void 0),e([c()],z.prototype,"autoCloseEnabled",void 0),e([c()],z.prototype,"autoOpenEnabled",void 0),e([c()],z.prototype,"browseClusterEnabled",void 0),e([c()],z.prototype,"content",void 0),e([c({type:T,readOnly:!0})],z.prototype,"defaultActions",null),e([c({readOnly:!0})],z.prototype,"featureCount",null),e([c()],z.prototype,"features",null),e([c()],z.prototype,"featuresPerPage",void 0),e([c()],z.prototype,"featureViewModelAbilities",void 0),e([c({readOnly:!0})],z.prototype,"featureViewModels",void 0),e([c()],z.prototype,"highlightEnabled",void 0),e([c()],z.prototype,"includeDefaultActions",void 0),e([c({type:L})],z.prototype,"location",null),e([c({readOnly:!0})],z.prototype,"pendingPromisesCount",null),e([c({readOnly:!0})],z.prototype,"selectedClusterBoundaryFeature",void 0),e([c({readOnly:!0})],z.prototype,"waitingForResult",null),e([c({readOnly:!0})],z.prototype,"promiseCount",null),e([c()],z.prototype,"promises",null),e([c({value:null,readOnly:!0})],z.prototype,"selectedFeature",null),e([c({value:-1})],z.prototype,"selectedFeatureIndex",null),e([c({readOnly:!0})],z.prototype,"selectedFeatureViewModel",null),e([c({readOnly:!0})],z.prototype,"state",null),e([c()],z.prototype,"title",void 0),e([c()],z.prototype,"updateLocationEnabled",void 0),e([c()],z.prototype,"view",void 0),e([c()],z.prototype,"visible",void 0),e([c()],z.prototype,"zoomFactor",void 0),e([c()],z.prototype,"zoomToLocation",void 0),e([c()],z.prototype,"centerAtLocation",null),z=e([p(R)],z);const U=z;export{U as default};
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../Graphic.js";import"../../symbols.js";import s from"../../core/Collection.js";import i from"../../core/Error.js";import o from"../../core/Handles.js";import r from"../../core/Logger.js";import{unwrap as n,isNone as a}from"../../core/maybe.js";import{init as l,watch as u,whenFalse as h}from"../../core/watchUtils.js";import{property as c}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";import{geographicToWebMercator as d}from"../../geometry/support/webMercatorUtils.js";import g from"../../layers/Layer.js";import f from"../../support/actions/ActionBase.js";import m from"../../support/actions/ActionButton.js";import y from"../../support/actions/ActionToggle.js";import{getDisplayedSymbol as w}from"../../symbols/support/symbolUtils.js";import{ViewEventPriorities as v}from"../../views/input/InputManager.js";import{highlightsSupported as F}from"../../views/support/layerViewUtils.js";import _ from"../Feature/FeatureViewModel.js";import{zoomToClusteredFeatures as b,browseClusteredFeatures as C,zoomToFeature as P}from"./actions.js";import{triggerAction as E,getSelectedTarget as A,removeClusteredFeaturesForBrowsing as M,displayClusterExtent as j,browseAggregateFeatures as V}from"./actionUtils.js";import O from"../support/AnchorElementViewModel.js";import{GoToMixin as x}from"../support/GoTo.js";import I from"../../symbols/SimpleFillSymbol.js";import L from"../../geometry/Point.js";const T=s.ofType({key:"type",defaultKeyValue:"button",base:f,typeMap:{button:m,toggle:y}}),S=()=>[P.clone()],B=()=>[b.clone(),C.clone()],R="esri.widgets.Popup.PopupViewModel",G=r.getLogger(R);let z=class extends(x(O)){constructor(e){super(e),this._handles=new o,this._pendingPromises=new Set,this._fetchFeaturesController=null,this._selectedClusterFeature=null,this.featurePage=null,this.actions=new T,this.defaultPopupTemplateEnabled=!1,this.autoCloseEnabled=!1,this.autoOpenEnabled=!0,this.browseClusterEnabled=!1,this.content=null,this.featuresPerPage=20,this.featureViewModelAbilities=null,this.featureViewModels=[],this.highlightEnabled=!0,this.includeDefaultActions=!0,this.selectedClusterBoundaryFeature=new t({symbol:new I({outline:{width:1.5,color:"cyan"},style:"none"})}),this.title=null,this.updateLocationEnabled=!1,this.view=null,this.visible=!1,this.zoomFactor=4,this.zoomToLocation=null}get isLoadingFeature(){return this.featureViewModels.some((e=>e.waitingForContent))}initialize(){this._handles.add([l(this,["autoOpenEnabled","view"],(()=>this._autoOpenEnabledChange())),this.on("view-change",(()=>this._autoClose())),u(this,["highlightEnabled","selectedFeature","visible","view"],(()=>this._highlightFeature())),u(this,"view.animation.state",(e=>this._animationStateChange(e))),u(this,"location",(e=>this._locationChange(e))),u(this,"selectedFeature",(e=>this._selectedFeatureChange(e))),u(this,["selectedFeatureIndex","featureCount","featuresPerPage"],(()=>this._selectedFeatureIndexChange())),u(this,["featurePage","selectedFeatureIndex","featureCount","featuresPerPage, featureViewModels"],(()=>this._setGraphicOnFeatureViewModels())),u(this,"featureViewModels",(()=>this._featureViewModelsChange())),this.on("trigger-action",(e=>E({event:e,view:this.view}))),h(this,"waitingForResult",(()=>this._waitingForResultChange()),!0),u(this,["features","view","view.map","view.spatialReference"],(()=>this._updateFeatureVMs())),u(this,["view.scale"],this._viewScaleChange),h(this,"visible",(()=>this.browseClusterEnabled=!1)),u(this,"browseClusterEnabled",(e=>e?this.enableClusterBrowsing():this.disableClusterBrowsing()))])}destroy(){this._cancelFetchingFeatures(),this._handles.destroy(),this._handles=null,this._pendingPromises.clear(),this.browseClusterEnabled=!1,this.view=null}get active(){return!(!this.visible||this.waitingForResult)}get allActions(){const e=this._get("allActions")||new T;e.removeAll();const{actions:t,defaultActions:s,defaultPopupTemplateEnabled:i,includeDefaultActions:o,selectedFeature:r}=this,n=o?s.concat(t):t,a=r&&("function"==typeof r.getEffectivePopupTemplate&&r.getEffectivePopupTemplate(i)||r.popupTemplate),l=a&&a.actions,u=a&&a.overwriteActions?l:l?l.concat(n):n;return u&&u.filter(Boolean).forEach((t=>e.add(t))),e}get defaultActions(){var e;const t=this._get("defaultActions")||new T;return t.removeAll(),t.addMany(null!=(e=this.selectedFeature)&&e.isAggregate?B():S()),t}get featureCount(){return this.features.length}get features(){return this._get("features")||[]}set features(e){const t=e||[];this._set("features",t);const{pendingPromisesCount:s,promiseCount:i,selectedFeatureIndex:o}=this,r=i&&t.length;r&&s&&-1===o?this.selectedFeatureIndex=0:r&&-1!==o||(this.selectedFeatureIndex=t.length?0:-1)}get location(){return this._get("location")||null}set location(e){const t=this.get("view.spatialReference.isWebMercator");e&&e.get("spatialReference.isWGS84")&&t&&(e=d(e)),this._set("location",e)}get pendingPromisesCount(){return this._pendingPromises.size}get waitingForResult(){return!(!(!!this._fetchFeaturesController||this.pendingPromisesCount>0)||0!==this.featureCount)}get promiseCount(){return this.promises.length}get promises(){return this._get("promises")||[]}set promises(e){if(this._pendingPromises.clear(),this.features=[],!Array.isArray(e)||!e.length)return this._set("promises",[]),void this.notifyChange("pendingPromisesCount");this._set("promises",e),(e=e.slice(0)).forEach((e=>{this._pendingPromises.add(e);const t=t=>{this._pendingPromises.has(e)&&this._updateFeatures(t),this._updatePendingPromises(e)},s=()=>this._updatePendingPromises(e);e.then(t,s)})),this.notifyChange("pendingPromisesCount")}get selectedFeature(){const{features:e,selectedFeatureIndex:t}=this;if(-1===t)return null;return e[t]||null}get selectedFeatureIndex(){const e=this._get("selectedFeatureIndex");return"number"==typeof e?e:-1}set selectedFeatureIndex(e){const{featureCount:t}=this;e=isNaN(e)||e<-1||!t?-1:(e+t)%t,this._set("selectedFeatureIndex",e)}get selectedFeatureViewModel(){return this.featureViewModels[this.selectedFeatureIndex]||null}get state(){return this.get("view.ready")?"ready":"disabled"}centerAtLocation(){const{view:e}=this,t=A(this);if(!t){const s=new i("center-at-location:invalid-target-or-view","Cannot center at a location without a target and view.",{target:t,view:e});return G.error(s),Promise.reject(s)}return this.callGoTo({target:{target:t,scale:e.scale}})}clear(){this.set({promises:[],features:[],content:null,title:null,location:null})}fetchFeatures(e,t){const{view:s}=this;if(!s||!e){const t=new i("fetch-features:invalid-screenpoint-or-view","Cannot fetch features without a screenPoint and view.",{screenPoint:e,view:s});return G.error(t),Promise.reject(t)}return s.fetchPopupFeatures(e,{event:t&&t.event,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,signal:t&&t.signal})}open(e){const t={updateLocationEnabled:!1,promises:[],fetchFeatures:!1,...e,visible:!0},{fetchFeatures:s}=t;delete t.fetchFeatures,s&&this._setFetchFeaturesPromises(t.location);const i=["actionsMenuOpen","collapsed","featureMenuOpen"];for(const o of i)delete t[o];this.set(t)}triggerAction(e){const t=this.allActions.getItemAt(e);t&&!t.disabled&&this.emit("trigger-action",{action:t})}next(){return this.selectedFeatureIndex=this.selectedFeatureIndex+1,this}previous(){return this.selectedFeatureIndex=this.selectedFeatureIndex-1,this}disableClusterBrowsing(){M(this),this._clearBrowsedClusterGraphics()}async enableClusterBrowsing(){await j(this),await V(this)}_animationStateChange(e){this.zoomToLocation||(P.disabled="waiting-for-target"===e)}_clearBrowsedClusterGraphics(){var e;const t=null==(e=this.view)?void 0:e.graphics;t&&(t.remove(this.selectedClusterBoundaryFeature),t.remove(this._selectedClusterFeature)),this._selectedClusterFeature=null,this.selectedClusterBoundaryFeature.geometry=null}_viewScaleChange(){var e;if(null!=(e=this.selectedFeature)&&e.isAggregate)return this.browseClusterEnabled=!1,this.visible=!1,void this.clear();this.browseClusterEnabled&&(this.browseClusterEnabled=!1,this.features=[this.selectedFeature])}_locationChange(e){const{selectedFeature:t,updateLocationEnabled:s}=this;s&&e&&(!t||t.geometry)&&this.centerAtLocation()}_selectedFeatureIndexChange(){this.featurePage=this.featureCount>1?Math.floor(this.selectedFeatureIndex/this.featuresPerPage)+1:null}_featureViewModelsChange(){this.featurePage=this.featureCount>1?1:null}_setGraphicOnFeatureViewModels(){const{features:e,featureCount:t,featurePage:s,featuresPerPage:i,featureViewModels:o}=this;if(null===s)return;const r=((s-1)*i+t)%t,n=r+i;o.slice(r,n).forEach(((t,s)=>{t&&!t.graphic&&(t.graphic=e[r+s])}))}async _selectedFeatureChange(e){if(!e)return;const{location:t,updateLocationEnabled:s,view:i}=this;if(this.browseClusterEnabled){if(this._selectedClusterFeature&&(i.graphics.remove(this._selectedClusterFeature),this._selectedClusterFeature=null),e.isAggregate)return;return e.symbol=await w(e),this._selectedClusterFeature=e,void i.graphics.add(this._selectedClusterFeature)}!s&&t||!e.geometry?s&&!e.geometry&&this.centerAtLocation().then((()=>{this.location=i.center.clone()})):this.location=n(this._getPointFromGeometry(e.geometry))}_waitingForResultChange(){!this.featureCount&&this.promises&&(this.visible=!1)}_setFetchFeaturesPromises(e){return this._fetchFeaturesWithController(this._getScreenPoint(e||this.location)).then((e=>{const{clientOnlyGraphics:t,promisesPerLayerView:s}=e,i=Promise.resolve(t),o=s.map((e=>e.promise));this.promises=[i,...o]}))}_destroyFeatureVMs(){this.featureViewModels.forEach((e=>e&&!e.destroyed&&e.destroy())),this._set("featureViewModels",[])}_updateFeatureVMs(){const{selectedFeature:e,features:t,featureViewModels:s}=this;if(null!=e&&e.isAggregate||(this.browseClusterEnabled=!1),this._destroyFeatureVMs(),!t||!t.length)return;const i=s.slice(0),o=[];t.forEach(((t,s)=>{if(!t)return;let r=null;if(i.some(((e,s)=>(e&&e.graphic===t&&(r=e,i.splice(s,1)),!!r))),r)o[s]=r;else{var n,a;const i=new _({abilities:this.featureViewModelAbilities,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,spatialReference:null==(n=this.view)?void 0:n.spatialReference,graphic:t===e?t:null,map:null==(a=this.view)?void 0:a.map,view:this.view});o[s]=i}})),i.forEach((e=>e&&!e.destroyed&&e.destroy())),this._set("featureViewModels",o)}_getScreenPoint(e){const{view:t}=this;return t&&e&&"function"==typeof t.toScreen?t.toScreen(e):null}_autoOpenEnabledChange(){const e="auto-fetch-features",{_handles:t,autoOpenEnabled:s}=this;if(t.remove(e),s&&this.view){const s=this.view.on("click",(e=>{"mouse"===e.pointerType&&0!==e.button||this._fetchFeaturesAndOpen(e)}),v.WIDGET);t.add(s,e)}}_cancelFetchingFeatures(){const e=this._fetchFeaturesController;e&&e.abort(),this._fetchFeaturesController=null,this.notifyChange("waitingForResult")}_fetchFeaturesWithController(e,t){this._cancelFetchingFeatures();const s=new AbortController,{signal:i}=s;this._fetchFeaturesController=s,this.notifyChange("waitingForResult");const o=this.fetchFeatures(e,{signal:i,event:t});return o.catch((()=>{})).then((()=>{this._fetchFeaturesController=null,this.notifyChange("waitingForResult")})),o}_fetchFeaturesAndOpen(e){const{screenPoint:t,mapPoint:s}=e,{view:i}=this;this._fetchFeaturesWithController(t,e).then((e=>{const{clientOnlyGraphics:t,promisesPerLayerView:o,location:r}=e,n=[Promise.resolve(t),...o.map((e=>e.promise))];return i.popup.open({location:r||s,promises:n}),e}))}_updatePendingPromises(e){e&&this._pendingPromises.has(e)&&(this._pendingPromises.delete(e),this.notifyChange("pendingPromisesCount"))}_autoClose(){this.autoCloseEnabled&&(this.visible=!1)}_getPointFromGeometry(e){return a(e)?null:"point"===e.type?e:"extent"===e.type?e.center:"polygon"===e.type?e.centroid:"multipoint"===e.type||"polyline"===e.type?e.extent.center:null}async _getLayerView(e,t){return await e.when(),e.whenLayerView(t)}async _highlightFeature(){const e="highlight";this._handles.remove(e);const{selectedFeature:t,highlightEnabled:s,view:i,visible:o}=this;if(!(t&&i&&s&&o))return;let{layer:r,sourceLayer:n}=t;if("map-notes"!==(null==n?void 0:n.type)&&"subtype-group"!==(null==n?void 0:n.type)||(r=n),!(r&&r instanceof g))return;const a=this._getLayerView(i,r);this._highlightPromise=a;const l=await a;if(!(l&&F(l)&&this._highlightPromise===a&&this.selectedFeature&&this.highlightEnabled&&this.visible))return;const u="imagery"===r.type?void 0:"objectIdField"in r&&r.objectIdField,h=t.attributes,c=h&&u&&h[u],p=l.highlight(c||t);this._handles.add(p,e)}_updateFeatures(e){const{features:t}=this;if(!e||!e.length)return;if(!t.length)return void(this.features=e);const s=e.filter((e=>!t.includes(e)));this.features=t.concat(s)}};e([c()],z.prototype,"featurePage",void 0),e([c()],z.prototype,"isLoadingFeature",null),e([c({type:T})],z.prototype,"actions",void 0),e([c({readOnly:!0})],z.prototype,"active",null),e([c({readOnly:!0})],z.prototype,"allActions",null),e([c({type:Boolean})],z.prototype,"defaultPopupTemplateEnabled",void 0),e([c()],z.prototype,"autoCloseEnabled",void 0),e([c()],z.prototype,"autoOpenEnabled",void 0),e([c()],z.prototype,"browseClusterEnabled",void 0),e([c()],z.prototype,"content",void 0),e([c({type:T,readOnly:!0})],z.prototype,"defaultActions",null),e([c({readOnly:!0})],z.prototype,"featureCount",null),e([c()],z.prototype,"features",null),e([c()],z.prototype,"featuresPerPage",void 0),e([c()],z.prototype,"featureViewModelAbilities",void 0),e([c({readOnly:!0})],z.prototype,"featureViewModels",void 0),e([c()],z.prototype,"highlightEnabled",void 0),e([c()],z.prototype,"includeDefaultActions",void 0),e([c({type:L})],z.prototype,"location",null),e([c({readOnly:!0})],z.prototype,"pendingPromisesCount",null),e([c({readOnly:!0})],z.prototype,"selectedClusterBoundaryFeature",void 0),e([c({readOnly:!0})],z.prototype,"waitingForResult",null),e([c({readOnly:!0})],z.prototype,"promiseCount",null),e([c()],z.prototype,"promises",null),e([c({value:null,readOnly:!0})],z.prototype,"selectedFeature",null),e([c({value:-1})],z.prototype,"selectedFeatureIndex",null),e([c({readOnly:!0})],z.prototype,"selectedFeatureViewModel",null),e([c({readOnly:!0})],z.prototype,"state",null),e([c()],z.prototype,"title",void 0),e([c()],z.prototype,"updateLocationEnabled",void 0),e([c()],z.prototype,"view",void 0),e([c()],z.prototype,"visible",void 0),e([c()],z.prototype,"zoomFactor",void 0),e([c()],z.prototype,"zoomToLocation",void 0),e([c()],z.prototype,"centerAtLocation",null),z=e([p(R)],z);const U=z;export{U as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../core/Error.js";import t from"../../core/Logger.js";import{throwIfNotAbortError as r}from"../../core/promiseUtils.js";import{zoomToFeature as i,zoomToClusteredFeatures as o,browseClusteredFeatures as n,removeSelectedFeature as a}from"./actions.js";const s="esri.widgets.Popup.PopupViewModel",c=t.getLogger(s),u=function(t){const{event:s,view:c}=t,{action:u}=s,d=c&&c.popup;if(!u)return Promise.reject(new e("trigger-action:missing-arguments","Event has no action"));if(!d)return Promise.reject(new e("trigger-action:missing-arguments","view.popup is missing"));const{disabled:l,id:v}=u;if(!v)return Promise.reject(new e("trigger-action:invalid-action","action.id is missing"));if(l)return Promise.reject(new e("trigger-action:invalid-action","Action is disabled"));if(v===i.id)return g(d.viewModel).catch(r);if(v===o.id)return w(d.viewModel);if(v===n.id)return d.featureMenuOpen=!d.featureMenuOpen,d.viewModel.browseClusterEnabled=!d.viewModel.browseClusterEnabled,Promise.resolve();if(d.viewModel.browseClusterEnabled=!1,v===a.id){d.close();const{selectedFeature:t}=d;if(!t)return Promise.reject(new e(`trigger-action:${a.id}`,"selectedFeature is required",{selectedFeature:t}));const{sourceLayer:r}=t;return r?r.remove(t):c.graphics.remove(t),Promise.resolve()}return Promise.resolve()};function d(e){const{selectedFeature:t,location:r,view:i}=e;if(!i)return null;if("3d"===i.type)return t||r;return e.get("selectedFeature.geometry")||r}function l(t,r){if("3d"!==(null==r?void 0:r.type)||!t||"esri.Graphic"!==t.declaredClass)return!0;const i=r.getViewForGraphic(t);if(i&&"whenGraphicBounds"in i){let r=!1;return i.whenGraphicBounds(t,{useViewElevation:!0}).then((e=>{r=!e||!e.boundingBox||e.boundingBox[0]===e.boundingBox[3]&&e.boundingBox[1]===e.boundingBox[4]&&e.boundingBox[2]===e.boundingBox[5]})).catch((()=>{const r=new e("zoom-to:invalid-graphic","Could not zoom to the location of the graphic.",{graphic:t});c.error(r)})),r}return!0}async function g(t){const{location:r,selectedFeature:o,view:n,zoomFactor:a}=t,s=d(t);if(!s){const t=new e("zoom-to:invalid-target-or-view","Cannot zoom to location without a target and view.",{target:s,view:n});
|
|
5
|
+
import e from"../../core/Error.js";import t from"../../core/Logger.js";import{throwIfNotAbortError as r}from"../../core/promiseUtils.js";import{zoomToFeature as i,zoomToClusteredFeatures as o,browseClusteredFeatures as n,removeSelectedFeature as a}from"./actions.js";const s="esri.widgets.Popup.PopupViewModel",c=t.getLogger(s),u=function(t){const{event:s,view:c}=t,{action:u}=s,d=c&&c.popup;if(!u)return Promise.reject(new e("trigger-action:missing-arguments","Event has no action"));if(!d)return Promise.reject(new e("trigger-action:missing-arguments","view.popup is missing"));const{disabled:l,id:v}=u;if(!v)return Promise.reject(new e("trigger-action:invalid-action","action.id is missing"));if(l)return Promise.reject(new e("trigger-action:invalid-action","Action is disabled"));if(v===i.id)return g(d.viewModel).catch(r);if(v===o.id)return w(d.viewModel);if(v===n.id)return d.featureMenuOpen=!d.featureMenuOpen,d.viewModel.browseClusterEnabled=!d.viewModel.browseClusterEnabled,Promise.resolve();if(d.viewModel.browseClusterEnabled=!1,v===a.id){d.close();const{selectedFeature:t}=d;if(!t)return Promise.reject(new e(`trigger-action:${a.id}`,"selectedFeature is required",{selectedFeature:t}));const{sourceLayer:r}=t;return r?r.remove(t):c.graphics.remove(t),Promise.resolve()}return Promise.resolve()};function d(e){const{selectedFeature:t,location:r,view:i}=e;if(!i)return null;if("3d"===i.type)return t||r;return e.get("selectedFeature.geometry")||r}function l(t,r){if("3d"!==(null==r?void 0:r.type)||!t||"esri.Graphic"!==t.declaredClass)return!0;const i=r.getViewForGraphic(t);if(i&&"whenGraphicBounds"in i){let r=!1;return i.whenGraphicBounds(t,{useViewElevation:!0}).then((e=>{r=!e||!e.boundingBox||e.boundingBox[0]===e.boundingBox[3]&&e.boundingBox[1]===e.boundingBox[4]&&e.boundingBox[2]===e.boundingBox[5]})).catch((()=>{const r=new e("zoom-to:invalid-graphic","Could not zoom to the location of the graphic.",{graphic:t});c.error(r)})),r}return!0}async function g(t){const{location:r,selectedFeature:o,view:n,zoomFactor:a}=t,s=d(t);if(!s){const t=new e("zoom-to:invalid-target-or-view","Cannot zoom to location without a target and view.",{target:s,view:n});throw c.error(t),t}const u=n.scale/a,g=t.get("selectedFeature.geometry")||r,w=g&&"point"===g.type&&l(o,n);i.active=!0,i.disabled=!0;try{await t.view.goTo({target:s,scale:w?u:void 0})}finally{i.active=!1,i.disabled=!1,t.zoomToLocation=null,w&&(t.location=g)}}async function w(t){const{selectedFeature:r,view:i}=t;if("2d"!==(null==i?void 0:i.type)){const t=new e("zoomToCluster:invalid-view","View must be 2d MapView.",{view:i});throw c.error(t),t}if(!r.isAggregate){const t=new e("zoomToCluster:invalid-selectedFeature","Selected feature must represent an aggregate/cluster graphic.",{selectedFeature:r});throw c.error(t),t}const n=r.sourceLayer,a=await i.whenLayerView(n),s=a.createQuery();s.aggregateIds=[r.getObjectId()],o.active=!0,o.disabled=!0;const{extent:u}=await a.queryExtent(s);await i.goTo({target:u}),o.active=!1,o.disabled=!1}async function v(t){const{selectedFeature:r,view:i}=t;if("2d"!==(null==i?void 0:i.type)){const t=new e("displayClusterExtent:invalid-view","View must be 2d MapView.",{view:i});throw c.error(t),t}if(!r.isAggregate){const t=new e("zoomToCluster:invalid-selectedFeature","Selected feature must represent an aggregate/cluster graphic.",{selectedFeature:r});throw c.error(t),t}const o=r.sourceLayer,n=await i.whenLayerView(o),a=n.createQuery();a.aggregateIds=[r.getObjectId()];const{extent:s}=await n.queryExtent(a);t.selectedClusterBoundaryFeature.geometry=s,i.graphics.add(t.selectedClusterBoundaryFeature)}async function p(t){const{selectedFeature:r,view:i}=t;if("2d"!==(null==i?void 0:i.type)){const t=new e("browseAggregateFeatures:invalid-view","View must be 2d MapView.",{view:i});throw c.error(t),t}if(!r.isAggregate){const t=new e("browseAggregateFeatures:invalid-selectedFeature","Selected feature must represent an aggregate/cluster graphic.",{selectedFeature:r});throw c.error(t),t}const o=r.sourceLayer,a=await i.whenLayerView(o),s=a.createQuery();s.aggregateIds=[r.getObjectId()],n.active=!0,n.disabled=!0;const{features:u}=await a.queryFeatures(s);n.active=!1,n.disabled=!1,i.popup.open({features:[r].concat(u),featureMenuOpen:!0})}function f(e){var t;null!=(t=e.selectedFeature)&&t.isAggregate&&(e.features=e.features.filter((e=>e.isAggregate)))}export{p as browseAggregateFeatures,v as displayClusterExtent,d as getSelectedTarget,l as isZoomScreenSize,f as removeClusteredFeaturesForBrowsing,u as triggerAction,w as zoomToClusterExtent,g as zoomToLocation};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import"../../intl.js";import t from"../../request.js";import r from"../../core/Collection.js";import{deprecatedProperty as o}from"../../core/deprecate.js";import s from"../../core/Error.js";import i from"../../core/Handles.js";import{clone as
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import"../../intl.js";import t from"../../request.js";import r from"../../core/Collection.js";import{deprecatedProperty as o}from"../../core/deprecate.js";import s from"../../core/Error.js";import i from"../../core/Handles.js";import{clone as l}from"../../core/lang.js";import a from"../../core/Loadable.js";import n from"../../core/Logger.js";import{unwrap as p}from"../../core/maybe.js";import{property as c}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import{subclass as m}from"../../core/accessorSupport/decorators/subclass.js";import u from"../../portal/Portal.js";import{execute as d}from"../../rest/geoprocessor/execute.js";import"../../rest/geoprocessor/GPOptions.js";import"../../core/has.js";import"../../geometry/support/normalizeUtils.js";import"../../layers/support/Field.js";import"../../layers/support/MapImage.js";import"../../core/urlUtils.js";import"../../core/unitUtils.js";import"../../rest/support/DataFile.js";import"../../rest/support/FeatureSet.js";import"../../rest/support/LinearUnit.js";import"../../rest/support/ParameterValue.js";import"../../rest/support/RasterData.js";import"../../rest/support/JobInfo.js";import{execute as f}from"../../rest/print.js";import{fromJSON as h}from"../../rest/support/fileFormat.js";import{fromJSON as y}from"../../rest/support/layoutTemplate.js";import v from"../../rest/support/PrintParameters.js";import T from"../../rest/support/PrintTemplate.js";import w from"./CustomTemplate.js";import{formatDate as j,convertDateFormatToIntlOptions as x}from"../../intl/date.js";const g=6e4,E=r.ofType(w);function S(e){e.layoutOptions||(e.layoutOptions={}),e.layoutOptions.customTextElements||(e.layoutOptions.customTextElements=[]);const t="date";if(!e.layoutOptions.customTextElements.find((e=>t in e))){const{customTextElements:t}=e.layoutOptions;t.push({date:j(Date.now(),x("short-date"))})}}let b=class extends a{constructor(e){super(e),this._handles=new i,this.allowedFormats="all",this.allowedLayouts="all",this.defaultTemplates=new E,this.extraParameters=null,this.includeDefaultTemplates=!0,this.effectivePrintServiceUrl=null,this.error=null,this.portal=u.getDefault(),this.printServiceUrl=null,this.templatesInfo=null,this.updateDelay=1e3,this.view=null,this.templateCustomTextElements=null,this.print=this.print.bind(this)}destroy(){this._handles.destroy(),this._handles=null,this.view=null}get effectiveTemplateCustomTextElements(){if(!this._serviceTemplateCustomTextElements)return{};const e=l(this._serviceTemplateCustomTextElements);return this.templateCustomTextElements&&Object.keys(this.templateCustomTextElements).forEach((t=>{const r=e[t];if(r){const e=this.templateCustomTextElements[t];r.forEach((t=>{const[r]=Object.entries(t)[0];e.find((e=>{const[o,s]=Object.entries(e)[0];r===o&&(t[r]=s)}))}))}})),Object.freeze(e)}get state(){return"loading"===this.loadStatus?"initializing":this.error||"failed"===this.loadStatus?"error":this.get("view.ready")&&"loaded"===this.loadStatus?"ready":"disabled"}set scaleEnabled(e){o(n.getLogger(this.declaredClass),"scaleEnabled",{version:"4.22"}),this.set("scaleEnabled",e)}async load(e){return this.addResolvingPromise(this._loadResources(e).catch((e=>this.error=e))),this}async print(e){const{view:t,extraParameters:r,updateDelay:o}=this;if(!t)throw new s("print:view-required","view is not set");S(e);const i=new v({view:t,template:e,extraParameters:r,updateDelay:o});try{return await f(this.effectivePrintServiceUrl,i)}catch(l){throw new s("print:export-error","An error occurred while exporting the web map.",{error:l})}}toPrintTemplate({attributionEnabled:e,author:t,copyright:r,customTextElements:o,dpi:s,forceFeatureAttributes:i,format:l,height:a,layout:n,legendEnabled:p,title:c,scale:m,scaleEnabled:u,width:d}){const f=new T({attributionVisible:e,layoutOptions:{authorText:t||"",copyrightText:r||"",customTextElements:o,titleText:c||""},forceFeatureAttributes:i,format:l,layout:n,scalePreserved:u,outScale:m});return d&&(f.exportOptions.width=d),a&&(f.exportOptions.height=a),s&&(f.exportOptions.dpi=s),p||(f.layoutOptions.legendLayers=[]),f}async _loadResources(e){let t=[];const{printServiceUrl:r}=this;if(!r){var o;if(this.destroyed)return;const{portal:r}=this;try{await r.load(e)}catch(l){throw new s("print:could-not-load-portal","Cannot load print resource information from portal",{url:this.effectivePrintServiceUrl})}const a=null==(o=r.helperServices)?void 0:o.printTask;var i;if(a)this._set("effectivePrintServiceUrl",a.url),t=(null!=(i=null==a?void 0:a.templates)?i:[]).map((e=>w.fromJSON(e)))}t.length>0&&this.defaultTemplates.addMany(t);if(-1===this.effectivePrintServiceUrl.toLowerCase().split("/").indexOf("gpserver"))throw new s("print:invalid-print-service-url","Can't fetch print templates information from provided URL",{url:this.effectivePrintServiceUrl});this._serviceTemplateCustomTextElements=await this._getTemplateToCustomTextElements(e),await this._loadServiceDescription(e)}async _loadServiceDescription(e){const t=await this._getPrintTemplatesFromService(e);this._set("templatesInfo",t)}async _getTemplateToCustomTextElements(e){const t={};try{const r=this.effectivePrintServiceUrl.replace(/(\/GPServer\/).+/i,"$1Get%20Layout%20Templates%20Info"),{results:[o]}=await d(r,null,null,p(e));o.value.forEach((({layoutTemplate:e,layoutOptions:{customTextElements:r}})=>t[y(e)]=r))}catch(r){}return Object.freeze(t)}async _getPrintTemplatesFromService(e){return t(this.effectivePrintServiceUrl,{...e,query:{f:"json"},timeout:g}).then((e=>{const t=e&&e.data,r=t&&t.parameters;let o=null,s=null;r.forEach((e=>{let t,r=e.choiceList&&e.choiceList.slice();r&&r.length&&e.defaultValue&&(t=r.indexOf(e.defaultValue)),t>-1&&(r.splice(t,1),r.unshift(e.defaultValue));const i=(e,t)=>{const r="all"===t?e:e.filter((e=>t.includes(e)));return 0===r.length?e:r};if("Format"===e.name){const t=i(r.map(h),this.allowedFormats),s=h(e.defaultValue);o={defaultValue:t.includes(s)?s:t[0],choiceList:t}}else if("Layout_Template"===e.name){let t,o;r=r.filter((e=>"map_only"!==e.toLowerCase())),r.some(((e,r)=>{const o=e.toLowerCase();return o.includes("letter")&&o.includes("landscape")?(t=r,!0):!(!o.includes("a4")||!o.includes("landscape"))&&(t=r,!1)})),t&&(o=r[t],r.splice(t,1),r.unshift(o));const l=i(r.map(y),this.allowedLayouts),a=y(e.defaultValue);s={defaultValue:l.includes(a)?a:l[0],choiceList:l}}})),this.error=null;return{format:o,layout:s}})).catch((e=>{throw new s("print:unavailable-service-info","Can't fetch templates info from service",{error:e})}))}};e([c()],b.prototype,"_serviceTemplateCustomTextElements",void 0),e([c()],b.prototype,"allowedFormats",void 0),e([c()],b.prototype,"allowedLayouts",void 0),e([c({type:E})],b.prototype,"defaultTemplates",void 0),e([c()],b.prototype,"extraParameters",void 0),e([c()],b.prototype,"includeDefaultTemplates",void 0),e([c({aliasOf:{source:"printServiceUrl",overridable:!0},readOnly:!0})],b.prototype,"effectivePrintServiceUrl",void 0),e([c()],b.prototype,"effectiveTemplateCustomTextElements",null),e([c()],b.prototype,"error",void 0),e([c({type:u})],b.prototype,"portal",void 0),e([c()],b.prototype,"printServiceUrl",void 0),e([c({readOnly:!0})],b.prototype,"state",null),e([c()],b.prototype,"scaleEnabled",null),e([c({readOnly:!0})],b.prototype,"templatesInfo",void 0),e([c()],b.prototype,"updateDelay",void 0),e([c()],b.prototype,"view",void 0),e([c()],b.prototype,"templateCustomTextElements",void 0),b=e([m("esri.widgets.Print.PrintViewModel")],b);const P=b;export{P as default};
|
package/widgets/Print.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Collection.js";import{on as i,eventKey as a}from"../core/events.js";import{clone as n}from"../core/lang.js";import s from"../core/Logger.js";import{addProxy as o,hasSameOrigin as l}from"../core/urlUtils.js";import{init as r}from"../core/watchUtils.js";import{aliasOf as p}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/accessorSupport/ensureType.js";import{property as d}from"../core/accessorSupport/decorators/property.js";import{subclass as c}from"../core/accessorSupport/decorators/subclass.js";import u from"./Widget.js";import h from"./Print/FileLink.js";import m from"./Print/PrintViewModel.js";import _ from"./Print/TemplateOptions.js";import{Heading as b}from"./support/Heading.js";import v from"./support/Popover.js";import{isActivationKey as y,keepMenuItemWithinView as g}from"./support/widgetUtils.js";import{messageBundle as f}from"./support/decorators/messageBundle.js";import"../core/has.js";import{tsx as T}from"./support/jsxFactory.js";const w=t.ofType(h),O="MAP_ONLY";var x;!function(e){e.layout="layoutTab",e.mapOnly="mapOnlyTab"}(x||(x={}));const C={base:"esri-print",headerTitle:"esri-print__header-title",inputText:"esri-print__input-text",layoutTabList:"esri-print__layout-tab-list",layoutTab:"esri-print__layout-tab",layoutSection:"esri-print__layout-section",mapOnlySection:"esri-print__map-only-section",scaleInput:"esri-print__scale-input",templateList:"esri-print__template-list",templateListScroller:"esri-print__template-list-scroller",templateListFooter:"esri-print__template-list-footer",loader:"esri-print__loader",advancedOptionsButton:"esri-print__advanced-options-button",advancedOptionsButtonContainer:"esri-print__advanced-options-button-container",advancedOptionsButtonTitle:"esri-print__advanced-options-button-title",advancedOptionsButtonIconOpened:"esri-print__advanced-options-button-icon--opened",advancedOptionsButtonIconClosed:"esri-print__advanced-options-button-icon--closed",advancedOptionsButtonIconClosed_RTL:"esri-print__advanced-options-button-icon--closed-rtl",refreshButton:"esri-print__refresh-button",swapButton:"esri-print__swap-button",linkButton:"esri-print__link-button",printButton:"esri-print__export-button",templateButton:"esri-print__template-button",formSectionContainer:"esri-print__form-section-container",advancedOptionsSection:"esri-print__advanced-options-section",advancedOptionsContainer:"esri-print__advanced-options-container",authorInfoContainer:"esri-print__author-info-container",copyrightInfoContainer:"esri-print__copyright-info-container",exportedFilesContainer:"esri-print__export-panel-container",exportedFilesTitle:"esri-print__export-title",exportedFile:"esri-print__exported-file",exportedFileLink:"esri-widget__anchor esri-print__exported-file-link",exportedFileLinkTitle:"esri-print__exported-file-link-title",heightContainer:"esri-print__height-container",legendInfoContainer:"esri-print__legend-info-container",printWidgetContainer:"esri-print__container",panelContainer:"esri-print__panel-container",scaleInfoContainer:"esri-print__scale-info-container",scaleInputContainer:"esri-print__scale-input-container",sizeContainer:"esri-print__size-container",widthContainer:"esri-print__width-container",widget:"esri-widget",panel:"esri-widget--panel",widgetButton:"esri-widget--button",button:"esri-button",buttonSecondary:"esri-button--secondary",buttonTertiary:"esri-button--tertiary",select:"esri-select",input:"esri-input",disabled:"esri-disabled",anchorDisabled:"esri-widget__anchor--disabled",buttonDisabled:"esri-button--disabled",panelError:"esri-print__panel--error",exportedFileError:"esri-print__exported-file--error",hide:"esri-hidden",rotate:"esri-rotating",anchor:"esri-widget__anchor",menu:"esri-menu",menuList:"esri-menu__list",menuItem:"esri-menu__list-item",menuItemFocus:"esri-menu__list-item--focus",menuHeader:"esri-menu__header",iconCheckMark:"esri-icon-check-mark",iconDownload:"esri-icon-download",iconLaunchLink:"esri-icon-launch-link-external",iconError:"esri-icon-error",iconPrinter:"esri-icon-printer",iconRightTriangleArrow:"esri-icon-right-triangle-arrow",iconLeftTriangleArrow:"esri-icon-left-triangle-arrow",iconDownArrow:"esri-icon-down-arrow",iconRefresh:"esri-icon-refresh",iconSpinner:"esri-icon-loading-indicator",iconSwap:"esri-icon-swap",iconLinked:"esri-icon-link-horizontal",iconUnlinked:"esri-icon-unlocked-link-horizontal",widgetIcon:"esri-icon-printer"},L="esri.widgets.Print",I=s.getLogger(L),S="User sets an invalid layout, resetting it to the default valid one...",k="User sets an invalid format, resetting it to the default valid one...";function F(e){const t=8.3333,i=11.4583;return{width:Math.round(e*t),height:Math.round(e*i)}}function M(e){return!isNaN(e)&&e>0}function E(e){return(null==e?void 0:e.toUpperCase())===O}let V=class extends u{constructor(e,t){super(e,t),this._activeTabFocusRequested=!1,this._advancedOptionsVisibleForLayout=!1,this._advancedOptionsVisibleForMapOnly=!1,this._awaitingServerResponse=!1,this._exportedFileNameMap={},this._focusedTemplateIndex=0,this._layoutTabSelected=!0,this._pendingExportScroll=!1,this._rootNode=null,this._selectTemplateNode=null,this._templateListPopover=new v({owner:this,placement:"top",offset:[0,-100],anchorElement:()=>this._selectTemplateNode,renderContentFunction:this.renderTemplateList}),this.allowedFormats=null,this.allowedLayouts=null,this.exportedLinks=new w,this.extraParameters=null,this.headingLevel=3,this.iconClass=C.widgetIcon,this.includeDefaultTemplates=null,this.label=void 0,this.portal=null,this.printServiceUrl=null,this.templateCustomTextElements=null,this.templateOptions=new _,this.view=null,this.viewModel=new m,this.handleTemplateListCreation=e=>e.focus(),this.handleTemplateChildBlur=e=>{var t;(null==(t=e.relatedTarget)?void 0:t.closest(`.${C.templateList}`))||this.handleCloseTemplateSelection()},this.handleCloseTemplateSelection=()=>{this._focusedTemplateIndex=0,this._templateListPopover.open=!1,this._selectTemplateNode.focus()},this.handleSelectTemplateClick=()=>{this._focusedTemplateIndex=0,this._templateListPopover.open=!0},this.handleTemplateListClick=e=>{const t=e.target;this.applyTemplate(t["data-template"])},this.handleTemplateListKeyDown=e=>{if(y(e.key))return this.applyTemplate(this.viewModel.defaultTemplates.getItemAt(this._focusedTemplateIndex)),void e.preventDefault();if("ArrowDown"===e.key||"ArrowUp"===e.key){const{defaultTemplates:t}=this.viewModel,i="ArrowDown"===e.key?1:-1,a=(this._focusedTemplateIndex+i)%t.length;this._focusedTemplateIndex=a<0?t.length-1:a;const n=e.currentTarget;g(n.querySelectorAll(`.${C.menuItem}`)[this._focusedTemplateIndex],n.parentElement),e.preventDefault()}"Escape"===e.key&&this.handleCloseTemplateSelection()},this._removeLink=e=>{const t=e.currentTarget["data-item"];t&&"error"===t.state&&this.exportedLinks.remove(t)},this._focusOnTabChange=this._focusOnTabChange.bind(this)}initialize(){this.own([r(this,"viewModel.templatesInfo",(e=>{const{format:t,layout:i}=this.templateOptions;if(e){const a=i===e.layout.defaultValue||E(i)||e.layout.choiceList&&e.layout.choiceList.indexOf(i)>-1,n=t===e.format.defaultValue||e.format.choiceList&&e.format.choiceList.indexOf(t)>-1;a||(i&&I.warn(S),this.templateOptions.layout=e.layout.defaultValue),n||(t&&I.warn(k),this.templateOptions.format=e.format.defaultValue),E(i)&&(this._layoutTabSelected=!1)}})),r(this,"templateOptions.format",(e=>{const{viewModel:{templatesInfo:t}}=this;if(t&&e){let i=!1;t.format.choiceList&&t.format.choiceList.forEach((t=>{t.toUpperCase()===e.toUpperCase()&&(this.templateOptions.format=t,i=!0)})),i||(this.templateOptions.format=t.format.defaultValue,I.warn(k)),this.scheduleRender()}})),r(this,"templateOptions.layout",(e=>{const{viewModel:{templatesInfo:t}}=this;if(t&&e){this._layoutTabSelected=!E(e);let i=!this._layoutTabSelected;i||t.layout.choiceList&&t.layout.choiceList.forEach((t=>{t.toUpperCase()===e.toUpperCase()&&(this.templateOptions.layout=t,i=!0)})),i||(this.templateOptions.layout=t.layout.defaultValue,I.warn(S));const a=this.viewModel.effectiveTemplateCustomTextElements[this.templateOptions.layout];this.templateOptions.customTextElements=a?n(a):null,this.scheduleRender()}})),r(this,"templateOptions.dpi",(e=>{e<=0?this.templateOptions.dpi=1:this.scheduleRender()})),r(this,"viewModel.view.scale",(e=>{const{scale:t,scaleEnabled:i}=this.templateOptions;i&&t||(this.templateOptions.scale=e)}))]);const{height:e,width:t}=this.templateOptions;this.templateOptions.width=t||800,this.templateOptions.height=e||1100;const i=setTimeout((()=>{this._awaitingServerResponse=!0,this.scheduleRender()}),500);this.viewModel.load().then((()=>clearTimeout(i)))}render(){const{attributionEnabled:e,author:t,copyright:i,dpi:a,format:n,height:s,layout:o,legendEnabled:l,scaleEnabled:r,scale:p,width:d}=this.templateOptions,c="ready"!==this.get("viewModel.state"),u=this.renderTitleOrFileNameSection(),{includeDefaultTemplates:h,messages:m,viewModel:_}=this,v=this.get("viewModel.templatesInfo.format.choiceList")||[],y=v.length>0?v.map((e=>T("option",{key:e,selected:e===n,value:e},e.toUpperCase()))):T("option",{key:"format-default-option"},m.formatDefaultOption),g=T("div",{class:C.formSectionContainer},T("label",null,m.fileFormatTitle,T("select",{class:C.select,onchange:this._updateFromOption,"data-target-property":"format",bind:this},y))),f=this.get("viewModel.templatesInfo.layout.choiceList")||[],w=f.length>0?f.map((e=>{const t=e===o,i=m[e]||e;return T("option",{key:e,selected:t,value:e},i)})):T("option",{key:"layout-default-option"},m.layoutDefaultOption),O=T("div",{class:C.formSectionContainer},T("label",null,m.layoutTitle,T("select",{class:C.select,onchange:this._updateFromOption,"data-target-property":"layout",bind:this},w))),L=T("div",{class:C.formSectionContainer},T("label",null,m.dpi,T("input",{type:"number",class:this.classes(C.inputText,C.input),"data-input-name":"dpi",onchange:this._handleDPIChange,value:`${a}`,min:"1",tabIndex:0,bind:this}))),I=T("div",{class:this.classes(C.scaleInfoContainer,C.formSectionContainer)},T("label",null,T("input",{"data-option-name":"scaleEnabled",checked:r,type:"checkbox",tabIndex:0,onchange:this._toggleInputValue,bind:this}),m.scale),T("div",{class:C.scaleInputContainer},T("input",{"aria-label":m.scaleLabel,"aria-valuenow":`${p}`,role:"spinbutton",type:"number",class:this.classes(C.inputText,C.input,C.scaleInput),tabIndex:0,"data-input-name":"scale",onchange:this._updateInputValue,disabled:!r,value:`${p}`,bind:this}),T("button",{type:"button","aria-label":m.reset,class:this.classes(C.widgetButton,C.refreshButton,C.iconRefresh),tabIndex:0,onclick:this._resetToCurrentScale,bind:this}))),S=this._advancedOptionsVisibleForLayout?T("div",{"aria-labelledby":`${this.id}__advancedOptionsForLayout`,class:C.advancedOptionsContainer},I,T("div",{class:this.classes(C.authorInfoContainer,C.formSectionContainer)},T("label",null,m.author,T("input",{type:"text",value:t,class:this.classes(C.inputText,C.input),tabIndex:0,"data-input-name":"author",onchange:this._updateInputValue,bind:this}))),T("div",{class:this.classes(C.copyrightInfoContainer,C.formSectionContainer)},T("label",null,m.copyright,T("input",{type:"text",class:this.classes(C.inputText,C.input),tabIndex:0,value:i,"data-input-name":"copyright",onchange:this._updateInputValue,bind:this}))),L,T("div",{class:this.classes(C.legendInfoContainer,C.formSectionContainer)},T("label",null,T("input",{type:"checkbox","data-option-name":"legendEnabled",tabIndex:0,checked:l,onchange:this._toggleInputValue,bind:this}),m.legend)),this.renderCustomTextElementSection()):null,k=this._advancedOptionsVisibleForMapOnly?T("div",{"aria-labelledby":`${this.id}__advancedOptionsForMapOnly`,class:C.advancedOptionsContainer},I,L,T("div",{class:C.formSectionContainer},T("label",null,T("input",{"data-option-name":"attributionEnabled",type:"checkbox",onchange:this._toggleInputValue,tabIndex:0,checked:e,bind:this}),m.attribution)),this.renderCustomTextElementSection()):null,F=this._layoutTabSelected?T("section",{key:"esri-print__layoutContent",id:`${this.id}__layoutContent`,"aria-labelledby":`${this.id}__layoutTab`,class:C.layoutSection,role:"tabpanel","aria-selected":this._layoutTabSelected.toString()},T("div",{class:C.panelContainer},u,O,this._layoutTabSelected?g:null),T("div",{class:this.classes(C.panelContainer,C.advancedOptionsSection)},T("button",{"aria-label":m.advancedOptions,"aria-expanded":this._advancedOptionsVisibleForLayout?"true":"false",class:C.advancedOptionsButton,onclick:this._showAdvancedOptions,bind:this,type:"button"},T("div",{class:C.advancedOptionsButtonContainer},T("span",{"aria-hidden":"true",class:this.classes(C.iconRightTriangleArrow,C.advancedOptionsButtonIconClosed)}),T("span",{"aria-hidden":"true",class:this.classes(C.iconLeftTriangleArrow,C.advancedOptionsButtonIconClosed_RTL)}),T("span",{"aria-hidden":"true",class:this.classes(C.iconDownArrow,C.advancedOptionsButtonIconOpened)}),T("span",{class:C.advancedOptionsButtonTitle},m.advancedOptions))),S)):T("section",{key:"esri-print__mapOnlyContent",id:`${this.id}__mapOnlyContent`,"aria-selected":(!this._layoutTabSelected).toString(),"aria-labelledby":`${this.id}__mapOnlyTab`,class:C.mapOnlySection,role:"tabpanel"},T("div",{class:C.panelContainer},u,this._layoutTabSelected?null:g,T("div",{class:this.classes(C.sizeContainer,C.formSectionContainer)},T("div",{class:C.widthContainer},T("label",null,m.width,T("input",{type:"number",class:this.classes(C.inputText,C.input),"data-input-name":"width",onchange:this._updateInputValue,value:`${d}`,tabIndex:0,bind:this}))),T("div",{class:C.heightContainer},T("label",null,m.height,T("input",{type:"number",class:this.classes(C.inputText,C.input),"data-input-name":"height",onchange:this._updateInputValue,value:`${s}`,tabIndex:0,bind:this}))),T("button",{type:"button","aria-label":m.swap,class:this.classes(C.widgetButton,C.swapButton,C.iconSwap),onclick:this._switchInput,tabIndex:0,bind:this})),T("div",{class:this.classes(C.panelContainer,C.advancedOptionsSection)},T("button",{"aria-label":m.advancedOptions,"aria-expanded":this._advancedOptionsVisibleForMapOnly?"true":"false",type:"button",class:C.advancedOptionsButton,onclick:this._showAdvancedOptions,bind:this},T("div",{class:C.advancedOptionsButtonContainer},T("span",{"aria-hidden":"true",class:this.classes(C.iconRightTriangleArrow,C.advancedOptionsButtonIconClosed)}),T("span",{"aria-hidden":"true",class:this.classes(C.iconLeftTriangleArrow,C.advancedOptionsButtonIconClosed_RTL)}),T("span",{"aria-hidden":"true",class:this.classes(C.iconDownArrow,C.advancedOptionsButtonIconOpened)}),T("span",{class:C.advancedOptionsButtonTitle},m.advancedOptions))),k))),M=this.exportedLinks.toArray(),E=this._renderExportedLink(M),V={[C.buttonDisabled]:c||!o&&!n},B=null!=this.get("view")&&"2d"!==this.get("view.type"),A=T("div",{class:C.panelError},B?m.sceneViewError:m.serviceError),P=T("div",null,T("ul",{class:C.layoutTabList,role:"tablist",onclick:this._toggleLayoutPanel,onkeydown:this._handleLayoutPanelKeyDown,bind:this},T("li",{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,id:`${this.id}__layoutTab`,"data-tab-id":x.layout,class:C.layoutTab,role:"tab",tabIndex:0,"aria-selected":`${this._layoutTabSelected}`},m.layoutTab),T("li",{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,id:`${this.id}__mapOnlyTab`,"data-tab-id":x.mapOnly,class:C.layoutTab,role:"tab",tabIndex:0,"aria-selected":`${!this._layoutTabSelected}`},m.mapOnlyTab)),F,T("button",{"aria-label":m.exportDescription,type:"button",class:this.classes(C.printButton,C.button,V),disabled:c,tabIndex:0,onclick:this._handlePrintMap,bind:this},m.export),h&&_.defaultTemplates.length>0?this.renderTemplateSectionTrigger():null,T("div",{class:C.exportedFilesContainer,afterUpdate:this._scrollExportIntoView,bind:this},T(b,{class:C.exportedFilesTitle,level:this.headingLevel},m.exportText),M.length>0?null:T("div",null,T("div",null,m.exportHint)),E)),D=T("div",{class:C.printWidgetContainer},T("header",{class:C.headerTitle},m.export),this.error||B||!this.view?A:P),N="initializing"===this.get("viewModel.state")?this._renderLoader():D;return T("div",{afterCreate:this._handleRootAfterCreate,bind:this,class:this.classes(C.base,C.widget,C.panel)},N)}renderTemplateSectionTrigger(){const{messages:e,_templateListPopover:t}=this,i=t.open;return T("button",{afterCreate:e=>this._selectTemplateNode=e,"aria-controls":i?`${this.id}__template-selection`:"","aria-label":e.selectTemplateDescription,"aria-pressed":i.toString(),class:this.classes(C.button,C.buttonTertiary,C.templateButton),onclick:this.handleSelectTemplateClick,title:e.selectTemplateDescription,type:"button"},e.selectTemplate)}renderCustomTextElementSection(){const{templateOptions:{customTextElements:e}}=this;return e?T("div",{class:C.formSectionContainer,key:"custom-text-elements"},e.map((e=>{const[t,i]=Object.entries(e)[0];return"date"===t?null:T("label",{key:t},t,T("input",{bind:this,class:this.classes(C.inputText,C.input),"data-input-custom":!0,"data-input-name":t,onchange:this._updateInputValue,type:"text",value:i}))}))):null}renderTemplateList(){const{messages:e,messagesCommon:t,viewModel:i}=this,{defaultTemplates:a}=i,n=e.selectTemplateDescription,s=`${this.id}__template-selection`;return T("div",{class:this.classes(C.templateList,C.widget,C.panel),id:s},T(b,{class:C.menuHeader,level:this.headingLevel},e.selectTemplate),T("div",{class:C.templateListScroller},T("ul",{afterCreate:this.handleTemplateListCreation,"aria-activedescendant":`${this.id}__template-item--${this._focusedTemplateIndex}`,"aria-label":n,class:C.menuList,key:"templates",onblur:this.handleTemplateChildBlur,onclick:this.handleTemplateListClick,onkeydown:this.handleTemplateListKeyDown,role:"listbox",tabIndex:0,title:n},a.toArray().map(((t,i)=>{const{description:a}=t,n=i===this._focusedTemplateIndex,s=t.label;return T("li",{"aria-label":a,class:this.classes(C.menuItem,{[C.menuItemFocus]:n}),"data-template":t,id:`${this.id}__template-item--${i}`,key:s,title:a},E(s)?e.mapOnlyTab:s)})))),T("div",{class:C.templateListFooter},T("button",{type:"button",class:this.classes(C.button,C.buttonSecondary),onblur:this.handleTemplateChildBlur,onclick:this.handleCloseTemplateSelection},t.done)))}applyTemplate(e){var t;const{format:i,layout:a,layoutOptions:n}=e,{templateOptions:s}=this;this._templateListPopover.open=!1,this._toggleTab("map-only"===a?x.mapOnly:x.layout,!1),i&&(s.format=i),a&&(s.layout=a),this._focusedTemplateIndex=null,s.legendEnabled=null!=(t=null==n?void 0:n.legend)?t:s.legendEnabled,this.handleCloseTemplateSelection()}renderTitleOrFileNameSection(){const{templateOptions:e,messages:t}=this;let i,a,n,s;return this._layoutTabSelected?(i=t.title,a=t.titlePlaceHolder,n=e.title,s="title"):(i=t.fileName,a=t.fileNamePlaceHolder,n=e.fileName,s="fileName"),T("div",{class:C.formSectionContainer,key:s},T("label",null,i,T("input",{type:"text",tabIndex:0,placeholder:a,class:this.classes(C.inputText,C.input),value:n,"data-input-name":s,onchange:this._updateInputValue,bind:this})))}_handleRootAfterCreate(e){this._rootNode=e,this.own(i(e,"scroll",(()=>{this._templateListPopover.open&&this.handleCloseTemplateSelection()})))}_focusOnTabChange(e){if(!this._activeTabFocusRequested)return;const t=e.getAttribute("data-tab-id");("layoutTab"===t&&this._layoutTabSelected||"mapOnlyTab"===t&&!this._layoutTabSelected)&&(e.focus(),this._activeTabFocusRequested=!1)}_renderLoader(){const e={[C.loader]:this._awaitingServerResponse};return T("div",{class:this.classes(e),key:"loader"})}_createFileLink(e,t){const i=t||this.messages.untitled,a=e.format.toLowerCase(),n=a.indexOf("png")>-1?"png":a,s=i+n;return void 0!==this._exportedFileNameMap[s]?this._exportedFileNameMap[s]++:this._exportedFileNameMap[s]=0,new h({name:i,extension:n,count:this._exportedFileNameMap[s]})}_resetToCurrentScale(){this.templateOptions.scale=this.viewModel.view.scale}_updateCustomTextElementValue(e,t,i){e.find((e=>{const[i]=Object.entries(e)[0];return i===t}))[t]=i}_updateInputValue(e){const t=e.target,i=t.getAttribute("data-input-name"),a=!!t["data-input-custom"],{templateOptions:n}=this;if(a)return void this._updateCustomTextElementValue(n.customTextElements,i,t.value);let s;if("number"===t.type){if(!M(t.valueAsNumber)){const e=n[i];return void(t.value=`${e}`)}s=t.valueAsNumber}else s=t.value;n[i]=s}_handleDPIChange(e){this._updateInputValue(e);const t=e.currentTarget.valueAsNumber,{height:i,width:a}=F(t),{templateOptions:n}=this;n.height=i,n.width=a}_handlePrintMap(){this._pendingExportScroll=!0;const{templateOptions:e}=this,t=this.viewModel.toPrintTemplate(e),i=this._layoutTabSelected?t.layoutOptions.titleText:e.fileName,a=this._createFileLink(t,i);this.exportedLinks.add(a),this.emit("submit",{link:a}),this.viewModel.print(t).then((e=>{a.set({url:e&&e.url,state:"ready"})})).catch((e=>{a.set({error:e,state:"error"})})).then((()=>{this.emit("complete",{link:a}),this.scheduleRender()}))}_updateFromOption(e){const t=e.target,i=t.selectedOptions?t.selectedOptions.item(0).value:t.options[t.selectedIndex].value,a=t.getAttribute("data-target-property");this.templateOptions[a]=i}_switchInput(){[this.templateOptions.width,this.templateOptions.height]=[this.templateOptions.height,this.templateOptions.width]}_showAdvancedOptions(){this._layoutTabSelected?this._advancedOptionsVisibleForLayout=!this._advancedOptionsVisibleForLayout:this._advancedOptionsVisibleForMapOnly=!this._advancedOptionsVisibleForMapOnly}_scrollExportIntoView(){if(this._pendingExportScroll){this._pendingExportScroll=!1;const{_rootNode:e,_rootNode:{clientHeight:t,scrollHeight:i}}=this,a=i-t;a>0&&(e.scrollTop=a)}}_toggleInputValue(e){const t=e.target,i=t.getAttribute("data-option-name");this.templateOptions[i]=t.checked,"scaleEnabled"===i&&(this.templateOptions[i]||this._resetToCurrentScale())}_renderExportedLink(e){const t=this.messages;return e.map((e=>{const{error:i,url:a,formattedName:n,state:s}=e,r="error"===s,p="pending"===s,d="ready"===s,c={[C.anchorDisabled]:p||r};let u=a||null;u&&(u=o(u));const h=l(a,location.href),m={[C.iconSpinner]:p,[C.rotate]:p,[C.iconDownload]:h&&d,[C.iconLaunchLink]:!h&&d,[C.iconError]:r,[C.exportedFileError]:r},_={[C.exportedFileError]:r};let b;b=p?t.pending:d?t.ready:t.errorMessage;const v=r?"print-task:cim-symbol-unsupported"===i.name?t.exportWebMapCIMError:t.exportWebMapError:"";return T("div",{"aria-label":b,class:C.exportedFile,"data-item":e,key:n,onclick:this._removeLink,title:v},T("a",{"aria-label":`${n}. ${t.linkReady}`,download:n,href:u,rel:"noreferrer",tabIndex:0,target:"_blank",class:this.classes(C.exportedFileLink,c)},T("span",{class:this.classes(m)}),T("span",{class:this.classes(C.exportedFileLinkTitle,_)},n)))}))}_toggleLayoutPanel(e){const t=e.target;this._toggleTab(t.getAttribute("data-tab-id"))}_toggleTab(e,t=!0){if(this._layoutTabSelected=e===x.layout,this._layoutTabSelected){const e=this.get("viewModel.templatesInfo.layout.choiceList");this.templateOptions.layout=e&&e[0]}else this.templateOptions.layout=O;t&&(this._activeTabFocusRequested=!0)}_handleLayoutPanelKeyDown(e){const t=a(e),i=e.target.getAttribute("data-tab-id");if(y(t))return this._toggleTab(i),e.preventDefault(),void e.stopPropagation();"ArrowLeft"!==t&&"ArrowRight"!==t||(this._toggleTab(i===x.layout?x.mapOnly:x.layout),e.preventDefault(),e.stopPropagation())}};e([p("viewModel.allowedFormats")],V.prototype,"allowedFormats",void 0),e([p("viewModel.allowedLayouts")],V.prototype,"allowedLayouts",void 0),e([p("viewModel.error")],V.prototype,"error",void 0),e([d({type:w})],V.prototype,"exportedLinks",void 0),e([p("viewModel.extraParameters")],V.prototype,"extraParameters",void 0),e([d()],V.prototype,"headingLevel",void 0),e([d()],V.prototype,"iconClass",void 0),e([p("viewModel.includeDefaultTemplates")],V.prototype,"includeDefaultTemplates",void 0),e([d({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],V.prototype,"label",void 0),e([d(),f("esri/widgets/Print/t9n/Print")],V.prototype,"messages",void 0),e([d(),f("esri/t9n/common")],V.prototype,"messagesCommon",void 0),e([p("viewModel.portal")],V.prototype,"portal",void 0),e([p("viewModel.printServiceUrl")],V.prototype,"printServiceUrl",void 0),e([p("viewModel.templateCustomTextElements")],V.prototype,"templateCustomTextElements",void 0),e([d({type:_})],V.prototype,"templateOptions",void 0),e([p("viewModel.view")],V.prototype,"view",void 0),e([d({type:m})],V.prototype,"viewModel",void 0),V=e([c("esri.widgets.Print")],V);const B=V;export{B as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Collection.js";import{on as i,eventKey as a}from"../core/events.js";import{clone as n}from"../core/lang.js";import s from"../core/Logger.js";import{addProxy as o,hasSameOrigin as l}from"../core/urlUtils.js";import{init as r}from"../core/watchUtils.js";import{aliasOf as p}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/accessorSupport/ensureType.js";import{property as d}from"../core/accessorSupport/decorators/property.js";import{subclass as c}from"../core/accessorSupport/decorators/subclass.js";import u from"./Widget.js";import h from"./Print/FileLink.js";import m from"./Print/PrintViewModel.js";import _ from"./Print/TemplateOptions.js";import{Heading as b}from"./support/Heading.js";import v from"./support/Popover.js";import{isActivationKey as y,keepMenuItemWithinView as g}from"./support/widgetUtils.js";import{messageBundle as f}from"./support/decorators/messageBundle.js";import"../core/has.js";import{tsx as T}from"./support/jsxFactory.js";const w=t.ofType(h),O="MAP_ONLY";var x;!function(e){e.layout="layoutTab",e.mapOnly="mapOnlyTab"}(x||(x={}));const C={base:"esri-print",headerTitle:"esri-print__header-title",inputText:"esri-print__input-text",layoutTabList:"esri-print__layout-tab-list",layoutTab:"esri-print__layout-tab",layoutSection:"esri-print__layout-section",mapOnlySection:"esri-print__map-only-section",scaleInput:"esri-print__scale-input",templateList:"esri-print__template-list",templateListScroller:"esri-print__template-list-scroller",templateListFooter:"esri-print__template-list-footer",loader:"esri-print__loader",advancedOptionsButton:"esri-print__advanced-options-button",advancedOptionsButtonContainer:"esri-print__advanced-options-button-container",advancedOptionsButtonTitle:"esri-print__advanced-options-button-title",advancedOptionsButtonIconOpened:"esri-print__advanced-options-button-icon--opened",advancedOptionsButtonIconClosed:"esri-print__advanced-options-button-icon--closed",advancedOptionsButtonIconClosed_RTL:"esri-print__advanced-options-button-icon--closed-rtl",refreshButton:"esri-print__refresh-button",swapButton:"esri-print__swap-button",linkButton:"esri-print__link-button",printButton:"esri-print__export-button",templateButton:"esri-print__template-button",formSectionContainer:"esri-print__form-section-container",advancedOptionsSection:"esri-print__advanced-options-section",advancedOptionsContainer:"esri-print__advanced-options-container",authorInfoContainer:"esri-print__author-info-container",copyrightInfoContainer:"esri-print__copyright-info-container",exportedFilesContainer:"esri-print__export-panel-container",exportedFilesTitle:"esri-print__export-title",exportedFile:"esri-print__exported-file",exportedFileLink:"esri-widget__anchor esri-print__exported-file-link",exportedFileLinkTitle:"esri-print__exported-file-link-title",heightContainer:"esri-print__height-container",legendInfoContainer:"esri-print__legend-info-container",printWidgetContainer:"esri-print__container",panelContainer:"esri-print__panel-container",scaleInfoContainer:"esri-print__scale-info-container",scaleInputContainer:"esri-print__scale-input-container",sizeContainer:"esri-print__size-container",widthContainer:"esri-print__width-container",widget:"esri-widget",panel:"esri-widget--panel",widgetButton:"esri-widget--button",button:"esri-button",buttonSecondary:"esri-button--secondary",buttonTertiary:"esri-button--tertiary",select:"esri-select",input:"esri-input",disabled:"esri-disabled",anchorDisabled:"esri-widget__anchor--disabled",buttonDisabled:"esri-button--disabled",panelError:"esri-print__panel--error",exportedFileError:"esri-print__exported-file--error",hide:"esri-hidden",rotate:"esri-rotating",anchor:"esri-widget__anchor",menu:"esri-menu",menuList:"esri-menu__list",menuItem:"esri-menu__list-item",menuItemFocus:"esri-menu__list-item--focus",menuHeader:"esri-menu__header",iconCheckMark:"esri-icon-check-mark",iconDownload:"esri-icon-download",iconLaunchLink:"esri-icon-launch-link-external",iconError:"esri-icon-error",iconPrinter:"esri-icon-printer",iconRightTriangleArrow:"esri-icon-right-triangle-arrow",iconLeftTriangleArrow:"esri-icon-left-triangle-arrow",iconDownArrow:"esri-icon-down-arrow",iconRefresh:"esri-icon-refresh",iconSpinner:"esri-icon-loading-indicator",iconSwap:"esri-icon-swap",iconLinked:"esri-icon-link-horizontal",iconUnlinked:"esri-icon-unlocked-link-horizontal",widgetIcon:"esri-icon-printer"},L="esri.widgets.Print",I=s.getLogger(L),S="User sets an invalid layout, resetting it to the default valid one...",k="User sets an invalid format, resetting it to the default valid one...";function F(e){const t=8.3333,i=11.4583;return{width:Math.round(e*t),height:Math.round(e*i)}}function M(e){return!isNaN(e)&&e>0}function E(e){return(null==e?void 0:e.toUpperCase())===O}let V=class extends u{constructor(e,t){super(e,t),this._activeTabFocusRequested=!1,this._advancedOptionsVisibleForLayout=!1,this._advancedOptionsVisibleForMapOnly=!1,this._awaitingServerResponse=!1,this._exportedFileNameMap={},this._focusedTemplateIndex=0,this._layoutTabSelected=!0,this._pendingExportScroll=!1,this._rootNode=null,this._selectTemplateNode=null,this._templateListPopover=new v({owner:this,placement:"top",offset:[0,-100],anchorElement:()=>this._selectTemplateNode,renderContentFunction:this.renderTemplateList}),this.allowedFormats=null,this.allowedLayouts=null,this.exportedLinks=new w,this.extraParameters=null,this.headingLevel=3,this.iconClass=C.widgetIcon,this.includeDefaultTemplates=null,this.label=void 0,this.portal=null,this.printServiceUrl=null,this.templateCustomTextElements=null,this.templateOptions=new _,this.view=null,this.viewModel=new m,this.handleTemplateListCreation=e=>e.focus(),this.handleTemplateChildBlur=e=>{var t;(null==(t=e.relatedTarget)?void 0:t.closest(`.${C.templateList}`))||this.handleCloseTemplateSelection()},this.handleCloseTemplateSelection=()=>{this._focusedTemplateIndex=0,this._templateListPopover.open=!1,this._selectTemplateNode.focus()},this.handleSelectTemplateClick=()=>{this._focusedTemplateIndex=0,this._templateListPopover.open=!0},this.handleTemplateListClick=e=>{const t=e.target;this.applyTemplate(t["data-template"])},this.handleTemplateListKeyDown=e=>{if(y(e.key))return this.applyTemplate(this.viewModel.defaultTemplates.getItemAt(this._focusedTemplateIndex)),void e.preventDefault();if("ArrowDown"===e.key||"ArrowUp"===e.key){const{defaultTemplates:t}=this.viewModel,i="ArrowDown"===e.key?1:-1,a=(this._focusedTemplateIndex+i)%t.length;this._focusedTemplateIndex=a<0?t.length-1:a;const n=e.currentTarget;g(n.querySelectorAll(`.${C.menuItem}`)[this._focusedTemplateIndex],n.parentElement),e.preventDefault()}"Escape"===e.key&&this.handleCloseTemplateSelection()},this._removeLink=e=>{const t=e.currentTarget["data-item"];t&&"error"===t.state&&this.exportedLinks.remove(t)},this._focusOnTabChange=this._focusOnTabChange.bind(this)}initialize(){this.own([r(this,"viewModel.templatesInfo",(e=>{const{format:t,layout:i}=this.templateOptions;if(e){const a=i===e.layout.defaultValue||E(i)||e.layout.choiceList&&e.layout.choiceList.includes(i),n=t===e.format.defaultValue||e.format.choiceList&&e.format.choiceList.includes(t);a||(i&&I.warn(S),this.templateOptions.layout=e.layout.defaultValue),n||(t&&I.warn(k),this.templateOptions.format=e.format.defaultValue),E(i)&&(this._layoutTabSelected=!1)}})),r(this,"templateOptions.format",(e=>{const{viewModel:{templatesInfo:t}}=this;if(t&&e){let i=!1;t.format.choiceList&&t.format.choiceList.forEach((t=>{t.toUpperCase()===e.toUpperCase()&&(this.templateOptions.format=t,i=!0)})),i||(this.templateOptions.format=t.format.defaultValue,I.warn(k)),this.scheduleRender()}})),r(this,"templateOptions.layout",(e=>{const{viewModel:{templatesInfo:t}}=this;if(t&&e){this._layoutTabSelected=!E(e);let i=!this._layoutTabSelected;i||t.layout.choiceList&&t.layout.choiceList.forEach((t=>{t.toUpperCase()===e.toUpperCase()&&(this.templateOptions.layout=t,i=!0)})),i||(this.templateOptions.layout=t.layout.defaultValue,I.warn(S));const a=this.viewModel.effectiveTemplateCustomTextElements[this.templateOptions.layout];this.templateOptions.customTextElements=a?n(a):null,this.scheduleRender()}})),r(this,"templateOptions.dpi",(e=>{e<=0?this.templateOptions.dpi=1:this.scheduleRender()})),r(this,"viewModel.view.scale",(e=>{const{scale:t,scaleEnabled:i}=this.templateOptions;i&&t||(this.templateOptions.scale=e)}))]);const{height:e,width:t}=this.templateOptions;this.templateOptions.width=t||800,this.templateOptions.height=e||1100;const i=setTimeout((()=>{this._awaitingServerResponse=!0,this.scheduleRender()}),500);this.viewModel.load().then((()=>clearTimeout(i)))}render(){const{attributionEnabled:e,author:t,copyright:i,dpi:a,format:n,height:s,layout:o,legendEnabled:l,scaleEnabled:r,scale:p,width:d}=this.templateOptions,c="ready"!==this.get("viewModel.state"),u=this.renderTitleOrFileNameSection(),{includeDefaultTemplates:h,messages:m,viewModel:_}=this,v=this.get("viewModel.templatesInfo.format.choiceList")||[],y=v.length>0?v.map((e=>T("option",{key:e,selected:e===n,value:e},e.toUpperCase()))):T("option",{key:"format-default-option"},m.formatDefaultOption),g=T("div",{class:C.formSectionContainer},T("label",null,m.fileFormatTitle,T("select",{class:C.select,onchange:this._updateFromOption,"data-target-property":"format",bind:this},y))),f=this.get("viewModel.templatesInfo.layout.choiceList")||[],w=f.length>0?f.map((e=>{const t=e===o,i=m[e]||e;return T("option",{key:e,selected:t,value:e},i)})):T("option",{key:"layout-default-option"},m.layoutDefaultOption),O=T("div",{class:C.formSectionContainer},T("label",null,m.layoutTitle,T("select",{class:C.select,onchange:this._updateFromOption,"data-target-property":"layout",bind:this},w))),L=T("div",{class:C.formSectionContainer},T("label",null,m.dpi,T("input",{type:"number",class:this.classes(C.inputText,C.input),"data-input-name":"dpi",onchange:this._handleDPIChange,value:`${a}`,min:"1",tabIndex:0,bind:this}))),I=T("div",{class:this.classes(C.scaleInfoContainer,C.formSectionContainer)},T("label",null,T("input",{"data-option-name":"scaleEnabled",checked:r,type:"checkbox",tabIndex:0,onchange:this._toggleInputValue,bind:this}),m.scale),T("div",{class:C.scaleInputContainer},T("input",{"aria-label":m.scaleLabel,"aria-valuenow":`${p}`,role:"spinbutton",type:"number",class:this.classes(C.inputText,C.input,C.scaleInput),tabIndex:0,"data-input-name":"scale",onchange:this._updateInputValue,disabled:!r,value:`${p}`,bind:this}),T("button",{type:"button","aria-label":m.reset,class:this.classes(C.widgetButton,C.refreshButton,C.iconRefresh),tabIndex:0,onclick:this._resetToCurrentScale,bind:this}))),S=this._advancedOptionsVisibleForLayout?T("div",{"aria-labelledby":`${this.id}__advancedOptionsForLayout`,class:C.advancedOptionsContainer},I,T("div",{class:this.classes(C.authorInfoContainer,C.formSectionContainer)},T("label",null,m.author,T("input",{type:"text",value:t,class:this.classes(C.inputText,C.input),tabIndex:0,"data-input-name":"author",onchange:this._updateInputValue,bind:this}))),T("div",{class:this.classes(C.copyrightInfoContainer,C.formSectionContainer)},T("label",null,m.copyright,T("input",{type:"text",class:this.classes(C.inputText,C.input),tabIndex:0,value:i,"data-input-name":"copyright",onchange:this._updateInputValue,bind:this}))),L,T("div",{class:this.classes(C.legendInfoContainer,C.formSectionContainer)},T("label",null,T("input",{type:"checkbox","data-option-name":"legendEnabled",tabIndex:0,checked:l,onchange:this._toggleInputValue,bind:this}),m.legend)),this.renderCustomTextElementSection()):null,k=this._advancedOptionsVisibleForMapOnly?T("div",{"aria-labelledby":`${this.id}__advancedOptionsForMapOnly`,class:C.advancedOptionsContainer},I,L,T("div",{class:C.formSectionContainer},T("label",null,T("input",{"data-option-name":"attributionEnabled",type:"checkbox",onchange:this._toggleInputValue,tabIndex:0,checked:e,bind:this}),m.attribution)),this.renderCustomTextElementSection()):null,F=this._layoutTabSelected?T("section",{key:"esri-print__layoutContent",id:`${this.id}__layoutContent`,"aria-labelledby":`${this.id}__layoutTab`,class:C.layoutSection,role:"tabpanel","aria-selected":this._layoutTabSelected.toString()},T("div",{class:C.panelContainer},u,O,this._layoutTabSelected?g:null),T("div",{class:this.classes(C.panelContainer,C.advancedOptionsSection)},T("button",{"aria-label":m.advancedOptions,"aria-expanded":this._advancedOptionsVisibleForLayout?"true":"false",class:C.advancedOptionsButton,onclick:this._showAdvancedOptions,bind:this,type:"button"},T("div",{class:C.advancedOptionsButtonContainer},T("span",{"aria-hidden":"true",class:this.classes(C.iconRightTriangleArrow,C.advancedOptionsButtonIconClosed)}),T("span",{"aria-hidden":"true",class:this.classes(C.iconLeftTriangleArrow,C.advancedOptionsButtonIconClosed_RTL)}),T("span",{"aria-hidden":"true",class:this.classes(C.iconDownArrow,C.advancedOptionsButtonIconOpened)}),T("span",{class:C.advancedOptionsButtonTitle},m.advancedOptions))),S)):T("section",{key:"esri-print__mapOnlyContent",id:`${this.id}__mapOnlyContent`,"aria-selected":(!this._layoutTabSelected).toString(),"aria-labelledby":`${this.id}__mapOnlyTab`,class:C.mapOnlySection,role:"tabpanel"},T("div",{class:C.panelContainer},u,this._layoutTabSelected?null:g,T("div",{class:this.classes(C.sizeContainer,C.formSectionContainer)},T("div",{class:C.widthContainer},T("label",null,m.width,T("input",{type:"number",class:this.classes(C.inputText,C.input),"data-input-name":"width",onchange:this._updateInputValue,value:`${d}`,tabIndex:0,bind:this}))),T("div",{class:C.heightContainer},T("label",null,m.height,T("input",{type:"number",class:this.classes(C.inputText,C.input),"data-input-name":"height",onchange:this._updateInputValue,value:`${s}`,tabIndex:0,bind:this}))),T("button",{type:"button","aria-label":m.swap,class:this.classes(C.widgetButton,C.swapButton,C.iconSwap),onclick:this._switchInput,tabIndex:0,bind:this})),T("div",{class:this.classes(C.panelContainer,C.advancedOptionsSection)},T("button",{"aria-label":m.advancedOptions,"aria-expanded":this._advancedOptionsVisibleForMapOnly?"true":"false",type:"button",class:C.advancedOptionsButton,onclick:this._showAdvancedOptions,bind:this},T("div",{class:C.advancedOptionsButtonContainer},T("span",{"aria-hidden":"true",class:this.classes(C.iconRightTriangleArrow,C.advancedOptionsButtonIconClosed)}),T("span",{"aria-hidden":"true",class:this.classes(C.iconLeftTriangleArrow,C.advancedOptionsButtonIconClosed_RTL)}),T("span",{"aria-hidden":"true",class:this.classes(C.iconDownArrow,C.advancedOptionsButtonIconOpened)}),T("span",{class:C.advancedOptionsButtonTitle},m.advancedOptions))),k))),M=this.exportedLinks.toArray(),E=this._renderExportedLink(M),V={[C.buttonDisabled]:c||!o&&!n},B=null!=this.get("view")&&"2d"!==this.get("view.type"),A=T("div",{class:C.panelError},B?m.sceneViewError:m.serviceError),P=T("div",null,T("ul",{class:C.layoutTabList,role:"tablist",onclick:this._toggleLayoutPanel,onkeydown:this._handleLayoutPanelKeyDown,bind:this},T("li",{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,id:`${this.id}__layoutTab`,"data-tab-id":x.layout,class:C.layoutTab,role:"tab",tabIndex:0,"aria-selected":`${this._layoutTabSelected}`},m.layoutTab),T("li",{afterCreate:this._focusOnTabChange,afterUpdate:this._focusOnTabChange,id:`${this.id}__mapOnlyTab`,"data-tab-id":x.mapOnly,class:C.layoutTab,role:"tab",tabIndex:0,"aria-selected":`${!this._layoutTabSelected}`},m.mapOnlyTab)),F,T("button",{"aria-label":m.exportDescription,type:"button",class:this.classes(C.printButton,C.button,V),disabled:c,tabIndex:0,onclick:this._handlePrintMap,bind:this},m.export),h&&_.defaultTemplates.length>0?this.renderTemplateSectionTrigger():null,T("div",{class:C.exportedFilesContainer,afterUpdate:this._scrollExportIntoView,bind:this},T(b,{class:C.exportedFilesTitle,level:this.headingLevel},m.exportText),M.length>0?null:T("div",null,T("div",null,m.exportHint)),E)),D=T("div",{class:C.printWidgetContainer},T("header",{class:C.headerTitle},m.export),this.error||B||!this.view?A:P),N="initializing"===this.get("viewModel.state")?this._renderLoader():D;return T("div",{afterCreate:this._handleRootAfterCreate,bind:this,class:this.classes(C.base,C.widget,C.panel)},N)}renderTemplateSectionTrigger(){const{messages:e,_templateListPopover:t}=this,i=t.open;return T("button",{afterCreate:e=>this._selectTemplateNode=e,"aria-controls":i?`${this.id}__template-selection`:"","aria-label":e.selectTemplateDescription,"aria-pressed":i.toString(),class:this.classes(C.button,C.buttonTertiary,C.templateButton),onclick:this.handleSelectTemplateClick,title:e.selectTemplateDescription,type:"button"},e.selectTemplate)}renderCustomTextElementSection(){const{templateOptions:{customTextElements:e}}=this;return e?T("div",{class:C.formSectionContainer,key:"custom-text-elements"},e.map((e=>{const[t,i]=Object.entries(e)[0];return"date"===t?null:T("label",{key:t},t,T("input",{bind:this,class:this.classes(C.inputText,C.input),"data-input-custom":!0,"data-input-name":t,onchange:this._updateInputValue,type:"text",value:i}))}))):null}renderTemplateList(){const{messages:e,messagesCommon:t,viewModel:i}=this,{defaultTemplates:a}=i,n=e.selectTemplateDescription,s=`${this.id}__template-selection`;return T("div",{class:this.classes(C.templateList,C.widget,C.panel),id:s},T(b,{class:C.menuHeader,level:this.headingLevel},e.selectTemplate),T("div",{class:C.templateListScroller},T("ul",{afterCreate:this.handleTemplateListCreation,"aria-activedescendant":`${this.id}__template-item--${this._focusedTemplateIndex}`,"aria-label":n,class:C.menuList,key:"templates",onblur:this.handleTemplateChildBlur,onclick:this.handleTemplateListClick,onkeydown:this.handleTemplateListKeyDown,role:"listbox",tabIndex:0,title:n},a.toArray().map(((t,i)=>{const{description:a}=t,n=i===this._focusedTemplateIndex,s=t.label;return T("li",{"aria-label":a,class:this.classes(C.menuItem,{[C.menuItemFocus]:n}),"data-template":t,id:`${this.id}__template-item--${i}`,key:s,title:a},E(s)?e.mapOnlyTab:s)})))),T("div",{class:C.templateListFooter},T("button",{type:"button",class:this.classes(C.button,C.buttonSecondary),onblur:this.handleTemplateChildBlur,onclick:this.handleCloseTemplateSelection},t.done)))}applyTemplate(e){var t;const{format:i,layout:a,layoutOptions:n}=e,{templateOptions:s}=this;this._templateListPopover.open=!1,this._toggleTab("map-only"===a?x.mapOnly:x.layout,!1),i&&(s.format=i),a&&(s.layout=a),this._focusedTemplateIndex=null,s.legendEnabled=null!=(t=null==n?void 0:n.legend)?t:s.legendEnabled,this.handleCloseTemplateSelection()}renderTitleOrFileNameSection(){const{templateOptions:e,messages:t}=this;let i,a,n,s;return this._layoutTabSelected?(i=t.title,a=t.titlePlaceHolder,n=e.title,s="title"):(i=t.fileName,a=t.fileNamePlaceHolder,n=e.fileName,s="fileName"),T("div",{class:C.formSectionContainer,key:s},T("label",null,i,T("input",{type:"text",tabIndex:0,placeholder:a,class:this.classes(C.inputText,C.input),value:n,"data-input-name":s,onchange:this._updateInputValue,bind:this})))}_handleRootAfterCreate(e){this._rootNode=e,this.own(i(e,"scroll",(()=>{this._templateListPopover.open&&this.handleCloseTemplateSelection()})))}_focusOnTabChange(e){if(!this._activeTabFocusRequested)return;const t=e.getAttribute("data-tab-id");("layoutTab"===t&&this._layoutTabSelected||"mapOnlyTab"===t&&!this._layoutTabSelected)&&(e.focus(),this._activeTabFocusRequested=!1)}_renderLoader(){const e={[C.loader]:this._awaitingServerResponse};return T("div",{class:this.classes(e),key:"loader"})}_createFileLink(e,t){const i=t||this.messages.untitled,a=e.format.toLowerCase(),n=a.includes("png")?"png":a,s=i+n;return void 0!==this._exportedFileNameMap[s]?this._exportedFileNameMap[s]++:this._exportedFileNameMap[s]=0,new h({name:i,extension:n,count:this._exportedFileNameMap[s]})}_resetToCurrentScale(){this.templateOptions.scale=this.viewModel.view.scale}_updateCustomTextElementValue(e,t,i){e.find((e=>{const[i]=Object.entries(e)[0];return i===t}))[t]=i}_updateInputValue(e){const t=e.target,i=t.getAttribute("data-input-name"),a=!!t["data-input-custom"],{templateOptions:n}=this;if(a)return void this._updateCustomTextElementValue(n.customTextElements,i,t.value);let s;if("number"===t.type){if(!M(t.valueAsNumber)){const e=n[i];return void(t.value=`${e}`)}s=t.valueAsNumber}else s=t.value;n[i]=s}_handleDPIChange(e){this._updateInputValue(e);const t=e.currentTarget.valueAsNumber,{height:i,width:a}=F(t),{templateOptions:n}=this;n.height=i,n.width=a}_handlePrintMap(){this._pendingExportScroll=!0;const{templateOptions:e}=this,t=this.viewModel.toPrintTemplate(e),i=this._layoutTabSelected?t.layoutOptions.titleText:e.fileName,a=this._createFileLink(t,i);this.exportedLinks.add(a),this.emit("submit",{link:a}),this.viewModel.print(t).then((e=>{a.set({url:e&&e.url,state:"ready"})})).catch((e=>{a.set({error:e,state:"error"})})).then((()=>{this.emit("complete",{link:a}),this.scheduleRender()}))}_updateFromOption(e){const t=e.target,i=t.selectedOptions?t.selectedOptions.item(0).value:t.options[t.selectedIndex].value,a=t.getAttribute("data-target-property");this.templateOptions[a]=i}_switchInput(){[this.templateOptions.width,this.templateOptions.height]=[this.templateOptions.height,this.templateOptions.width]}_showAdvancedOptions(){this._layoutTabSelected?this._advancedOptionsVisibleForLayout=!this._advancedOptionsVisibleForLayout:this._advancedOptionsVisibleForMapOnly=!this._advancedOptionsVisibleForMapOnly}_scrollExportIntoView(){if(this._pendingExportScroll){this._pendingExportScroll=!1;const{_rootNode:e,_rootNode:{clientHeight:t,scrollHeight:i}}=this,a=i-t;a>0&&(e.scrollTop=a)}}_toggleInputValue(e){const t=e.target,i=t.getAttribute("data-option-name");this.templateOptions[i]=t.checked,"scaleEnabled"===i&&(this.templateOptions[i]||this._resetToCurrentScale())}_renderExportedLink(e){const t=this.messages;return e.map((e=>{const{error:i,url:a,formattedName:n,state:s}=e,r="error"===s,p="pending"===s,d="ready"===s,c={[C.anchorDisabled]:p||r};let u=a||null;u&&(u=o(u));const h=l(a,location.href),m={[C.iconSpinner]:p,[C.rotate]:p,[C.iconDownload]:h&&d,[C.iconLaunchLink]:!h&&d,[C.iconError]:r,[C.exportedFileError]:r},_={[C.exportedFileError]:r};let b;b=p?t.pending:d?t.ready:t.errorMessage;const v=r?"print-task:cim-symbol-unsupported"===i.name?t.exportWebMapCIMError:t.exportWebMapError:"";return T("div",{"aria-label":b,class:C.exportedFile,"data-item":e,key:n,onclick:this._removeLink,title:v},T("a",{"aria-label":`${n}. ${t.linkReady}`,download:n,href:u,rel:"noreferrer",tabIndex:0,target:"_blank",class:this.classes(C.exportedFileLink,c)},T("span",{class:this.classes(m)}),T("span",{class:this.classes(C.exportedFileLinkTitle,_)},n)))}))}_toggleLayoutPanel(e){const t=e.target;this._toggleTab(t.getAttribute("data-tab-id"))}_toggleTab(e,t=!0){if(this._layoutTabSelected=e===x.layout,this._layoutTabSelected){const e=this.get("viewModel.templatesInfo.layout.choiceList");this.templateOptions.layout=e&&e[0]}else this.templateOptions.layout=O;t&&(this._activeTabFocusRequested=!0)}_handleLayoutPanelKeyDown(e){const t=a(e),i=e.target.getAttribute("data-tab-id");if(y(t))return this._toggleTab(i),e.preventDefault(),void e.stopPropagation();"ArrowLeft"!==t&&"ArrowRight"!==t||(this._toggleTab(i===x.layout?x.mapOnly:x.layout),e.preventDefault(),e.stopPropagation())}};e([p("viewModel.allowedFormats")],V.prototype,"allowedFormats",void 0),e([p("viewModel.allowedLayouts")],V.prototype,"allowedLayouts",void 0),e([p("viewModel.error")],V.prototype,"error",void 0),e([d({type:w})],V.prototype,"exportedLinks",void 0),e([p("viewModel.extraParameters")],V.prototype,"extraParameters",void 0),e([d()],V.prototype,"headingLevel",void 0),e([d()],V.prototype,"iconClass",void 0),e([p("viewModel.includeDefaultTemplates")],V.prototype,"includeDefaultTemplates",void 0),e([d({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],V.prototype,"label",void 0),e([d(),f("esri/widgets/Print/t9n/Print")],V.prototype,"messages",void 0),e([d(),f("esri/t9n/common")],V.prototype,"messagesCommon",void 0),e([p("viewModel.portal")],V.prototype,"portal",void 0),e([p("viewModel.printServiceUrl")],V.prototype,"printServiceUrl",void 0),e([p("viewModel.templateCustomTextElements")],V.prototype,"templateCustomTextElements",void 0),e([d({type:_})],V.prototype,"templateOptions",void 0),e([p("viewModel.view")],V.prototype,"view",void 0),e([d({type:m})],V.prototype,"viewModel",void 0),V=e([c("esri.widgets.Print")],V);const B=V;export{B as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../core/Accessor.js";import{isNone as r}from"../../core/maybe.js";import{createScreenPoint as
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../core/Accessor.js";import{isNone as r}from"../../core/maybe.js";import{createScreenPoint as s}from"../../core/screenUtils.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import{isSupported as n,geodesicLengths as a}from"../../geometry/support/geodesicUtils.js";import{straightLineDensify as c}from"../../geometry/support/normalizeUtils.js";import{getInfo as m}from"../../geometry/support/spatialReferenceUtils.js";import{webMercatorToGeographic as l}from"../../geometry/support/webMercatorUtils.js";import p from"../../geometry/support/WKIDUnitConversion.js";import u from"../../geometry/SpatialReference.js";import d from"../../geometry/Polyline.js";import f from"../../geometry/Point.js";function g(e){const{wkid:t}=e;if(null!=p[t])return p.values[p[t]];const{wkt:r}=e,s=r.lastIndexOf(",")+1,o=r.lastIndexOf("]]");return parseFloat(r.substring(s,o))}function h(e,t){return e&&e.includes(t)}function w(e,t){const{x:r,y:s}="decimal-degrees"===e?l(t,!0):t;return[r,s]}function y({state:{paddedViewState:e},spatialReference:t,width:r}){return t.isWrappable&&e.worldScreenWidth<r}let S=class extends t{constructor(e){super(e),this.scaleComputedFrom=s(),this.view=null}get state(){return this.get("view.ready")&&"2d"===this.get("view.type")?"ready":"disabled"}getScaleBarProperties(e,t){if("disabled"===this.state||isNaN(e)||!t)return null;const s=this._getDistanceInKm(this.view,this.scaleComputedFrom);if(r(s))return null;if("metric"===t)return this._getScaleBarProps(e,s,"metric");const o=s/1.609;return this._getScaleBarProps(e,o,"non-metric")}_getLocationUnit(){const e=this.get("view.spatialReference"),{isWebMercator:t,wkid:r,wkt:s}=e;return t||h(s,"WGS_1984_Web_Mercator")?"decimal-degrees":null!=p[r]||h(s,"PROJCS")?"linear-unit":"unknown"}_getDistanceInKm(e,t){const{state:r,spatialReference:s}=e,o=this._getLocationUnit();if("linear-unit"===o){const e=1e3;return r.extent.width*g(s)/e}const[i,m]=this._getScaleMeasuringPoints(e,t),l="decimal-degrees"===o||s.isGeographic&&!n(s)?u.WGS84:s,p=new d({paths:[[w(o,i),w(o,m)]],spatialReference:l}),f=c(p,10);let h;try{[h]=a([f],"kilometers")}catch{return null}return h}_getScaleMeasuringPoints(e,t){const{width:r,height:o,position:i,spatialReference:n}=e;if(y(e)){const{valid:e}=m(n);return[new f(e[0],0,n),new f(e[1],0,n)]}let a=t.y-i[1];a>o?a=o:a<0&&(a=0);const c=s(0,a),l=s(r,a);return[e.toMap(c),e.toMap(l)]}_getScaleBarProps(e,t,r){const{view:s}=this;let o=e*t/(y(s)?s.state.paddedViewState.worldScreenWidth:s.width),i="metric"===r?"km":"mi";if(o<.1)if("mi"===i){o*=5280,i="ft"}else if("km"===i){o*=1e3,i="m"}let n=0;for(;o>=1;)o/=10,n++;const a=this._getConstraints(o);if(!a)return null;const{min:c,max:m}=a,l=m/o>=o/c?c:m;return{length:e*(l/o),value:10**n*l,unit:i}}_getConstraints(e){return e>.5?{min:.5,max:1}:e>.3?{min:.3,max:.5}:e>.2?{min:.2,max:.3}:e>.15?{min:.15,max:.2}:e>=.1?{min:.15,max:.1}:void 0}};e([o()],S.prototype,"scaleComputedFrom",void 0),e([o({readOnly:!0})],S.prototype,"state",null),e([o()],S.prototype,"view",void 0),S=e([i("esri.widgets.Scalebar.ScaleBarViewModel")],S);const j=S;export{j as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import{getAssetUrl as t}from"../../assets.js";import r from"../../config.js";import s from"../../Graphic.js";import o from"../../PopupTemplate.js";import"../../symbols.js";import l from"../../core/Accessor.js";import i from"../../core/Collection.js";import{deprecatedProperty as a}from"../../core/deprecate.js";import n from"../../core/Error.js";import u from"../../core/Evented.js";import c from"../../core/Handles.js";import h from"../../core/has.js";import p from"../../core/Logger.js";import{unwrap as d,isSome as g,isNone as m}from"../../core/maybe.js";import{eachAlways as y,after as f}from"../../core/promiseUtils.js";import{whenOnce as S}from"../../core/reactiveUtils.js";import{init as v}from"../../core/watchUtils.js";import{property as _}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/accessorSupport/ensureType.js";import{subclass as b}from"../../core/accessorSupport/decorators/subclass.js";import w from"../../geometry/Point.js";import x from"../../geometry/SpatialReference.js";import{onLocaleChange as I}from"../../intl/locale.js";import{fetchMessageBundle as j}from"../../intl/messages.js";import P from"../../portal/Portal.js";import{highlightsSupported as T}from"../../views/support/layerViewUtils.js";import R from"./LayerSearchSource.js";import L from"./LocatorSearchSource.js";import E from"./SearchSource.js";import{getPointFromGeometry as F,getPointWithElevation as A}from"./support/geometryUtils.js";import{isArcGISWorldGeocoder as C,meteredArcGISLocatorUrl as G,isProxiedArcGISWorldGeocoder as O,isMeteredArcGISWorldGeocoder as N}from"./support/locatorUtils.js";import{supported as D,getCurrentPosition as M,positionToPoint as V}from"../support/geolocationUtils.js";import{GoToMixin as k}from"../support/GoTo.js";import B from"../../symbols/PictureMarkerSymbol.js";import J from"../../symbols/SimpleLineSymbol.js";import U from"../../symbols/SimpleFillSymbol.js";import H from"../../symbols/TextSymbol.js";function Q(e,t){return e.hasOwnProperty(t)&&null!=e[t]&&""!==e[t]}const Z=()=>j("esri/widgets/Search/t9n/Search"),q="esri.widgets.Search.SearchViewModel",z=p.getLogger(q),K="highlight",W=i.ofType({key:e=>e.layer?"layer":"locator",base:E,typeMap:{layer:R,locator:L}}),X=x.WGS84,Y="esri/images/search/search-symbol-32.svg",$="esri/images/search/search-symbol-32.png",ee=/<(?:.|\s)*?>/g,te=-1;let re=class extends(k(u.EventedMixin(l))){constructor(e){super(e),this._handles=new c,this._gotoController=null,this._searching=null,this.autoNavigate=!0,this.autoSelect=!0,this.defaultPopupTemplate=null,this.defaultSources=new W,this.defaultSymbols={point:new B({url:t(h("trident")?$:Y),size:24,width:24,height:24}),polyline:new J({color:[130,130,130,1],width:2}),polygon:new U({color:[235,235,235,.4],outline:{color:[130,130,130,1],width:2}})},this.includeDefaultSources=!0,this.maxInputLength=128,this.maxResults=6,this.maxSuggestions=6,this.messages=null,this.minSuggestCharacters=3,this.popupEnabled=!0,this.popupTemplate=null,this.portal=P.getDefault(),this.resultCount=null,this.resultGraphicEnabled=!0,this.resultGraphic=null,this.results=null,this.selectedSuggestion=null,this.searchAllEnabled=!0,this.selectedResult=null,this.sources=new W,this.suggestionDelay=350,this.suggestionCount=null,this.suggestions=null,this.suggestionsEnabled=!0,this.view=null}initialize(){const e=async()=>{const e=await Z();this.messages=e,this.defaultPopupTemplate=new o({title:e.searchResult,content:"{Match_addr}"})};e(),this._handles.add([v(this,["includeDefaultSources","view","portal"],(()=>this._update())),I(e)])}destroy(){this._abortGoTo(),this.clearGraphics(),this._handles.destroy(),this._handles=null}get activeSource(){return this.allSources.getItemAt(this.activeSourceIndex)||null}get activeSourceIndex(){return 1===this.allSources.length||!this.searchAllEnabled?0:te}set activeSourceIndex(e){void 0!==e?this._override("activeSourceIndex",e):this._clearOverride("activeSourceIndex")}get allPlaceholder(){var e;return null==(e=this.messages)?void 0:e.allPlaceholder}set allPlaceholder(e){e?this._override("allPlaceholder",e):this._clearOverride("allPlaceholder")}get allSources(){const{sources:e,defaultSources:t,includeDefaultSources:r}=this,s="function"==typeof r?r.call(null,{sources:e,defaultSources:t}):r?t.concat(e):e,o=this._get("allSources")||new W;return o.removeAll(),o.addMany(s.filter(Boolean)),o}get defaultSymbol(){return a(z,"defaultSymbol",{replacement:"defaultSymbols",version:"4.22"}),this._get("defaultSymbol")}set defaultSymbol(e){a(z,"defaultSymbol",{replacement:"defaultSymbols",version:"4.22"}),this._set("defaultSymbol",e)}get locationEnabled(){return this._get("locationEnabled")||D()}set locationEnabled(e){if(void 0===e)return void this._clearOverride("locationEnabled");const t=D();if(e&&!t){const e=new n("locationEnabled:geolocation-unsupported","Geolocation API is unsupported.",{geolocation:navigator.geolocation});z.error(e)}this._override("locationEnabled",e&&t)}get placeholder(){const{allSources:e,activeSourceIndex:t,allPlaceholder:r}=this;if(t===te)return r;const s=e.getItemAt(t);return s?s.placeholder:""}set searchTerm(e){this._set("searchTerm",e||""),this.clearGraphics(),this.selectedSuggestion&&this.selectedSuggestion.text!==e&&this._set("selectedSuggestion",null),""===e&&this._clear()}get searchTerm(){return this._get("searchTerm")||""}get state(){return this._searching?"searching":this.updating?"loading":0===this.allSources.length?"disabled":"ready"}get updating(){return null!=this._updatingPromise}clear(){this.searchTerm=""}clearGraphics(){this._removeHighlight(),this._closePopup(),this.view&&this.view.graphics.remove(this.resultGraphic),this._set("resultGraphic",null)}search(e,t){this.emit("search-start"),this.clearGraphics();const r=this._createSuggestionForSearch(e),s=this.when().then((()=>this._getResultsFromSources(r,t).then((e=>{var s;if(null!=(s=d(null==t?void 0:t.signal))&&s.aborted)return null;const o={activeSourceIndex:this.activeSourceIndex,searchTerm:r.text,numResults:0,numErrors:0,errors:[],results:[]};this._formatResponse(o,e,r);const l=this._getFirstResult(o.results),i=(r.location&&l?l.name:r.text).replace(ee,"");return this._set("searchTerm",i),(r.key&&"number"==typeof r.sourceIndex||r.location)&&this._set("selectedSuggestion",r),this._set("results",o.results),this._set("resultCount",o.results.reduce(((e,t)=>e+t.results.length),0)),this.emit("search-complete",o),this._selectFirstResult(l).then((()=>o))})))).then((e=>(this._clearSearching(),e)),(e=>{throw this._clearSearching(),e}));return this._searching=s,s}searchNearby(e){if(!this.locationEnabled){const e=new n("searchNearby:geolocation-unsupported","Geolocation API is unsupported.",{geolocation:navigator.geolocation});return z.error(e),Promise.reject(e)}const t=M().then((t=>V({position:t,view:this.view},e))).then((t=>this.search(t,e)));return this._searching=t,t.catch((()=>{})).then((()=>this._clearSearching())),t}select(e){if(this.clearGraphics(),!e){const t=new n("select:missing-parameter","Cannot select without a searchResult.",{searchResult:e});return z.error(t),Promise.reject(t)}const{view:t}=this,r=Q(e,"sourceIndex")?e.sourceIndex:this._getSourceIndexOfResult(e),o=this.allSources.getItemAt(r);if(!o){const e=new n("select:missing-source","Cannot select without a source.",{source:o});return z.error(e),Promise.reject(e)}const l=o instanceof R?this._getLayerSourcePopupTemplate(o):o.popupTemplate,i=o.resultSymbol||this._getDefaultSymbol(e),a=Q(o,"resultGraphicEnabled")?o.resultGraphicEnabled:this.resultGraphicEnabled,u=Q(o,"autoNavigate")?o.autoNavigate:this.autoNavigate,c=Q(o,"popupEnabled")?o.popupEnabled:this.popupEnabled,h=c?l||this.popupTemplate||this.defaultPopupTemplate:null,{feature:p}=e;if(!p){const e=new n("select:missing-feature","Cannot select without a feature.",{feature:p});return z.error(e),Promise.reject(e)}const{attributes:d,geometry:m,layer:f,sourceLayer:S}=p,v=F(m),_={layerViewQuery:this._getLayerView(p),elevationQuery:t&&g(v)?A(v,t).catch((()=>v)):Promise.resolve(v)};return y(_).then((l=>{const n=l.layerViewQuery.value,y=l.elevationQuery.value;i instanceof H&&(i.text=e.name);const v=t&&u?e.target||e.extent:null;return(g(v)?this._goToSearchResult(v):Promise.resolve()).then((()=>{var l;const u=n?p:new s({geometry:m,symbol:i,attributes:d,layer:f,sourceLayer:S,popupTemplate:h}),g=c&&(null==(l=this.view)?void 0:l.popup),v=g&&u.getEffectivePopupTemplate(g.defaultPopupTemplateEnabled);return v&&t.popup.open({features:[u],location:y}),n&&T(n)&&!v&&this._highlightFeature({graphic:u,layerView:n}),!n&&a&&t&&t.graphics.push(u),this._setResultFloor(e),this._set("selectedResult",e),this._set("resultGraphic",u),this.emit("select-result",{result:e,source:o,sourceIndex:r}),e}))}))}suggest(e,t,r){const s=e||this.searchTerm;return this.emit("suggest-start",{searchTerm:s}),this._suggestTimer(t,r).then((()=>this._suggestImmediate(s,r).then((e=>(this._set("suggestions",e.results),this._set("suggestionCount",e.results.reduce(((e,t)=>e+t.results.length),0)),this.emit("suggest-complete",e),e)))))}async when(){await S((()=>!this.updating))}async _update(){const{portal:e,view:t}=this;if(this.includeDefaultSources){const r=this._updatingPromise=y([null==e?void 0:e.load(),null==t?void 0:t.when()]);if(this.destroyed)return;if(await r,r!==this._updatingPromise)return}await S((()=>this.messages)),this.destroyed||this._updateDefaultSources(),this._updatingPromise=null}_clearSearching(){this._searching=null}_convertHelperServices(){var e,t;const s=null==(e=this.portal)||null==(t=e.helperServices)?void 0:t.geocode;if(!s)return[];return s.map((e=>{if(!1===e.placefinding)return;const t=r.apiKey&&C(e.url)?{url:G}:null,s=L.fromJSON({...e,...t}),o=s.url;if(C(o)||O(o)||N(o)){const e=s.outFields||["Addr_type","Match_addr","StAddr","City"],t=s.placeholder||this.messages.placeholder,r="number"==typeof s.defaultZoomScale?s.defaultZoomScale:2500;s.set({singleLineFieldName:"SingleLine",outFields:e,placeholder:t,defaultZoomScale:r})}return s.singleLineFieldName?s:void 0})).filter(Boolean)}_getLayerSources(e,t){var r;const s=null==(r=this.view)?void 0:r.map;return e.map((e=>{const r=s.findLayerById(e.id);if(!r)return;const o=this._getLayerJSON(e),l=R.fromJSON(o);return l.placeholder=t,this._getLayer(r,o).then((e=>{l.layer=e})),l})).filter(Boolean).toArray()}_getTableSources(e,t){var r;const s=null==(r=this.view)?void 0:r.map;return e.map((e=>{const r=s.findTableById(e.id);if(!r)return;const o=this._getLayerJSON(e),l=R.fromJSON(o);return l.placeholder=t,this._getLayer(r,o).then((e=>{l.layer=e})),l})).filter(Boolean).toArray()}_convertApplicationProperties(){var e,t,r;const s=null==(e=this.view)?void 0:e.map,o=null==s||null==(t=s.applicationProperties)||null==(r=t.viewing)?void 0:r.search;if(!o)return[];const{enabled:l,hintText:i,layers:a,tables:n}=o;if(!l)return[];return[...this._getLayerSources(a,i),...this._getTableSources(n,i)]}_getSubLayer(e,t){return e.load().then((()=>{if(!e.allSublayers)return Promise.reject();const r=e.allSublayers.find((e=>e.id===t.subLayer));return r?r.createFeatureLayer():Promise.reject()}))}async _getBuildingSubLayer(e,t){await e.load();const r=e.allSublayers.find((e=>e.id===t.subLayer));return"building-component"!==(null==r?void 0:r.type)?Promise.reject():(await r.load(),null==r.associatedLayer?Promise.reject():(await r.associatedLayer.load(),r))}_getLayer(e,t){return"feature"===e.type||"scene"===e.type||"csv"===e.type||"geojson"===e.type||"ogc-feature"===e.type?Promise.resolve(e):"map-image"===e.type?this._getSubLayer(e,t).catch((()=>{const t=new n("search:create-featurelayer","Could not create a FeatureLayer from the MapImageLayer",{layer:e});return z.error(t),null})):"building-scene"===e.type?this._getBuildingSubLayer(e,t):Promise.resolve(null)}_getLayerJSON(e){return"function"==typeof e.toJSON?e.toJSON():e}_updateDefaultSources(){const{defaultSources:e,includeDefaultSources:t}=this;e.removeAll(),t&&e.addMany([...this._convertApplicationProperties(),...this._convertHelperServices()])}_abortGoTo(){this._gotoController&&this._gotoController.abort(),this._gotoController=null}_clear(){this._abortGoTo(),this._set("resultCount",null),this._set("results",null),this._set("suggestions",null),this._set("suggestionCount",null),this._set("selectedResult",null),this._set("selectedSuggestion",null),this.emit("search-clear")}_closePopup(){var e;const t=null==(e=this.view)?void 0:e.popup,{resultGraphic:r}=this;if(!t||!r)return;const{selectedFeature:s}=t;s&&s===r&&t.close()}_suggestTimer(e,t){const r=null!=e?e:this.suggestionDelay;return f(r,null,t&&t.signal)}_createLocationForSearch(e){return e instanceof s?F(e.geometry):e instanceof w?e:Array.isArray(e)&&2===e.length?new w({longitude:e[0],latitude:e[1]}):null}_createSuggestionForSearch(e){if(e&&Q(e,"key")&&Q(e,"text")&&Q(e,"sourceIndex"))return e;const t=this._createLocationForSearch(e),r="string"==typeof e?e:this.searchTerm,{selectedSuggestion:s,selectedResult:o}=this,l=!e&&s&&o,i=l&&s.key===o.key&&s.sourceIndex===o.sourceIndex,a=l&&s.location;return i||a?s:{location:d(t),text:t?"":r,sourceIndex:null,key:null}}_getFirstResult(e){let t=null;return e&&e.some((e=>{const{results:r}=e,s=r[0],o=!!s;return o&&(t=s),o})),t}_selectFirstResult(e){return this.autoSelect&&e?this.select(e):Promise.resolve(null)}_suggestImmediate(e,t){return this.when().then((()=>this._getSuggestionsFromSources(e,t))).then((r=>{var s;if(null!=(s=d(null==t?void 0:t.signal))&&s.aborted)return null;const o={activeSourceIndex:this.activeSourceIndex,searchTerm:e,numResults:0,numErrors:0,errors:[],results:[]};return this._formatResponse(o,r),o}))}_formatSourceResponse(e,t,r){const s=t&&t.value||[],o=t&&t.error,l=this.allSources.getItemAt(r);if(o){const t={sourceIndex:r,source:l,error:o};e.errors.push(t),z.error(o),e.numErrors++}else{const t={sourceIndex:r,source:l,results:s};e.results.push(t),e.numResults+=s.length}}_formatResponse(e,t,r){if(t)if(e.activeSourceIndex===te){const s=r&&Q(r,"sourceIndex")&&-1!==r.sourceIndex?r.sourceIndex:void 0;t.forEach(((t,r)=>{const o=void 0!==s?s:r;this._formatSourceResponse(e,t,o)}))}else this._formatSourceResponse(e,t[0],e.activeSourceIndex)}_getResultsFromSources(e,t){const{allSources:r}=this,s=!e.location&&Q(e,"sourceIndex")?e.sourceIndex:this.activeSourceIndex,o=[];if(!r.length){const e=new n("search:no-sources-defined","At least one source is required.",{allSources:r});return z.error(e),Promise.reject(e)}return s===te?r.forEach(((r,s)=>{o.push(this._getResultsFromSource(e,s,t))})):o.push(this._getResultsFromSource(e,s,t)),y(o)}_getSuggestionsFromSources(e,t){const{allSources:r,activeSourceIndex:s}=this,o=[];if(!r.length){const e=new n("suggest:no-sources-defined","At least one source is required.",{allSources:r});return z.error(e),Promise.reject(e)}return s===te?r.forEach(((r,s)=>{o.push(this._getSuggestionsFromSource(e,s,t))})):o.push(this._getSuggestionsFromSource(e,s,t)),y(o)}_getResultsFromSource(e,t,r){var s;const o=this.allSources.getItemAt(t),{location:l=null}=e,i=(null==(s=this.view)?void 0:s.spatialReference)||X,a=Q(o,"maxResults")?o.maxResults:this.maxResults,n=!!(o instanceof R&&Q(o,"exactMatch"))&&o.exactMatch,{view:u}=this;return o.getResults({view:u,sourceIndex:t,location:l,suggestResult:e,spatialReference:i,exactMatch:n,maxResults:a},r)}_getSuggestionsFromSource(e,t,r){const s=this.allSources.getItemAt(t),o=Q(s,"suggestionsEnabled")?s.suggestionsEnabled:this.suggestionsEnabled,l=e.length,i=Q(s,"minSuggestCharacters")?s.minSuggestCharacters:this.minSuggestCharacters;if(o&&e.trim()&&l>=i){var a;const o=(null==(a=this.view)?void 0:a.spatialReference)||X,l=Q(s,"maxSuggestions")?s.maxSuggestions:this.maxSuggestions,{view:i}=this,n=!!(s instanceof R&&Q(s,"exactMatch"))&&s.exactMatch;return s.getSuggestions({view:i,sourceIndex:t,suggestTerm:e,spatialReference:o,maxSuggestions:l,exactMatch:n},r)}return Promise.resolve(null)}_getLayerSourcePopupTemplate(e){const{layer:t}=e;if(t)return Q(e,"popupTemplate")?e.popupTemplate:t.popupTemplate}_getSourceIndexOfResult(e){const t=this.results;let r=null;return t.some((t=>t.results.some((s=>s===e&&(r=t.sourceIndex,!0))))),r}async _goToSearchResult(e){const t=!!e;this._abortGoTo();const r=new AbortController;this._gotoController=r;const s={target:{target:e},options:{animate:t,signal:r.signal}};await this.callGoTo(s),this._gotoController=null}_getDefaultSymbol(e){var t;const{defaultSymbols:r}=this,s=null==(t=e.feature)?void 0:t.geometry;if(m(s))return null;const o=this._get("defaultSymbol");if(o&&("point"===s.type||"multipoint"===s.type))return o;switch(s.type){case"point":case"multipoint":return r.point;case"polyline":return r.polyline;case"extent":case"polygon":return r.polygon;default:return null}}_removeHighlight(){this._handles.remove(K)}async _getLayerView(e){const{view:t}=this;if(!e||!t||"building-component"===e.layer.type||"subtype-sublayer"===e.layer.type)return Promise.resolve(null);const{layer:r}=e;return await t.when(),t.whenLayerView(r)}_highlightFeature(e){const{graphic:t,layerView:r}=e,{attributes:s,layer:o}=t,{objectIdField:l}=o,i=s&&s[l],a=r.highlight(i||t);this._handles.add(a,K)}_setResultFloor(e){var t,r,s;const{view:o}=this,l=null==(t=e.feature)?void 0:t.attributes,i=null==(r=e.feature)?void 0:r.sourceLayer;if(i&&"floorInfo"in i&&null!=i&&null!=(s=i.floorInfo)&&s.floorField&&l){const e=l[i.floorInfo.floorField];o.emit("select-result-floor",e)}}};re.ALL_INDEX=te,e([_()],re.prototype,"_searching",void 0),e([_()],re.prototype,"_updatingPromise",void 0),e([_({readOnly:!0,value:null})],re.prototype,"activeSource",null),e([_()],re.prototype,"activeSourceIndex",null),e([_()],re.prototype,"allPlaceholder",null),e([_({readOnly:!0})],re.prototype,"allSources",null),e([_()],re.prototype,"autoNavigate",void 0),e([_()],re.prototype,"autoSelect",void 0),e([_()],re.prototype,"defaultPopupTemplate",void 0),e([_({readOnly:!0})],re.prototype,"defaultSources",void 0),e([_()],re.prototype,"defaultSymbol",null),e([_()],re.prototype,"defaultSymbols",void 0),e([_()],re.prototype,"includeDefaultSources",void 0),e([_()],re.prototype,"locationEnabled",null),e([_()],re.prototype,"maxInputLength",void 0),e([_()],re.prototype,"maxResults",void 0),e([_()],re.prototype,"maxSuggestions",void 0),e([_()],re.prototype,"messages",void 0),e([_()],re.prototype,"minSuggestCharacters",void 0),e([_({readOnly:!0})],re.prototype,"placeholder",null),e([_()],re.prototype,"popupEnabled",void 0),e([_({type:o})],re.prototype,"popupTemplate",void 0),e([_({type:P})],re.prototype,"portal",void 0),e([_()],re.prototype,"resultCount",void 0),e([_()],re.prototype,"resultGraphicEnabled",void 0),e([_({readOnly:!0})],re.prototype,"resultGraphic",void 0),e([_({readOnly:!0})],re.prototype,"results",void 0),e([_({readOnly:!0})],re.prototype,"selectedSuggestion",void 0),e([_()],re.prototype,"searchAllEnabled",void 0),e([_({readOnly:!0})],re.prototype,"selectedResult",void 0),e([_()],re.prototype,"searchTerm",null),e([_({type:W})],re.prototype,"sources",void 0),e([_({readOnly:!0})],re.prototype,"state",null),e([_()],re.prototype,"suggestionDelay",void 0),e([_()],re.prototype,"suggestionCount",void 0),e([_({readOnly:!0})],re.prototype,"suggestions",void 0),e([_()],re.prototype,"suggestionsEnabled",void 0),e([_({readOnly:!0})],re.prototype,"updating",null),e([_()],re.prototype,"view",void 0),e([_()],re.prototype,"clear",null),re=e([b(q)],re);const se=re;export{se as default};
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import{getAssetUrl as t}from"../../assets.js";import r from"../../config.js";import s from"../../Graphic.js";import o from"../../PopupTemplate.js";import"../../symbols.js";import l from"../../core/Accessor.js";import i from"../../core/Collection.js";import{deprecatedProperty as a}from"../../core/deprecate.js";import n from"../../core/Error.js";import u from"../../core/Evented.js";import c from"../../core/Handles.js";import h from"../../core/has.js";import p from"../../core/Logger.js";import{unwrap as d,isSome as g,isNone as m}from"../../core/maybe.js";import{eachAlways as y,after as f}from"../../core/promiseUtils.js";import{whenOnce as S}from"../../core/reactiveUtils.js";import{init as v}from"../../core/watchUtils.js";import{property as _}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/accessorSupport/ensureType.js";import{subclass as b}from"../../core/accessorSupport/decorators/subclass.js";import w from"../../geometry/Point.js";import x from"../../geometry/SpatialReference.js";import{onLocaleChange as I}from"../../intl/locale.js";import{fetchMessageBundle as j}from"../../intl/messages.js";import T from"../../portal/Portal.js";import{highlightsSupported as R}from"../../views/support/layerViewUtils.js";import P from"./LayerSearchSource.js";import E from"./LocatorSearchSource.js";import L from"./SearchSource.js";import{getPointFromGeometry as F,getPointWithElevation as A}from"./support/geometryUtils.js";import{isArcGISWorldGeocoder as C,meteredArcGISLocatorUrl as G,isProxiedArcGISWorldGeocoder as O,isMeteredArcGISWorldGeocoder as N}from"./support/locatorUtils.js";import{supported as D,getCurrentPosition as M,positionToPoint as V}from"../support/geolocationUtils.js";import{GoToMixin as k}from"../support/GoTo.js";import B from"../../symbols/PictureMarkerSymbol.js";import J from"../../symbols/SimpleLineSymbol.js";import U from"../../symbols/SimpleFillSymbol.js";import H from"../../symbols/TextSymbol.js";function Q(e,t){return e.hasOwnProperty(t)&&null!=e[t]&&""!==e[t]}const Z=()=>j("esri/widgets/Search/t9n/Search"),q="esri.widgets.Search.SearchViewModel",z=p.getLogger(q),K="highlight",W=i.ofType({key:e=>e.layer?"layer":"locator",base:L,typeMap:{layer:P,locator:E}}),X=x.WGS84,Y="esri/images/search/search-symbol-32.svg",$="esri/images/search/search-symbol-32.png",ee=/<(?:.|\s)*?>/g,te=-1;let re=class extends(k(u.EventedMixin(l))){constructor(e){super(e),this._handles=new c,this._gotoController=null,this._searching=null,this.autoNavigate=!0,this.autoSelect=!0,this.defaultPopupTemplate=null,this.defaultSources=new W,this.defaultSymbols={point:new B({url:t(h("trident")?$:Y),size:24,width:24,height:24}),polyline:new J({color:[130,130,130,1],width:2}),polygon:new U({color:[235,235,235,.4],outline:{color:[130,130,130,1],width:2}})},this.includeDefaultSources=!0,this.maxInputLength=128,this.maxResults=6,this.maxSuggestions=6,this.messages=null,this.minSuggestCharacters=3,this.popupEnabled=!0,this.popupTemplate=null,this.portal=T.getDefault(),this.resultCount=null,this.resultGraphicEnabled=!0,this.resultGraphic=null,this.results=null,this.selectedSuggestion=null,this.searchAllEnabled=!0,this.selectedResult=null,this.sources=new W,this.suggestionDelay=350,this.suggestionCount=null,this.suggestions=null,this.suggestionsEnabled=!0,this.view=null}initialize(){const e=async()=>{const e=await Z();this.messages=e,this.defaultPopupTemplate=new o({title:e.searchResult,content:"{Match_addr}"})};e(),this._handles.add([v(this,["includeDefaultSources","view","portal"],(()=>this._update())),I(e)])}destroy(){this._abortGoTo(),this.clearGraphics(),this._handles.destroy(),this._handles=null}get activeSource(){return this.allSources.getItemAt(this.activeSourceIndex)||null}get activeSourceIndex(){return 1===this.allSources.length||!this.searchAllEnabled?0:te}set activeSourceIndex(e){void 0!==e?this._override("activeSourceIndex",e):this._clearOverride("activeSourceIndex")}get allPlaceholder(){var e;return null==(e=this.messages)?void 0:e.allPlaceholder}set allPlaceholder(e){e?this._override("allPlaceholder",e):this._clearOverride("allPlaceholder")}get allSources(){const{sources:e,defaultSources:t,includeDefaultSources:r}=this,s="function"==typeof r?r.call(null,{sources:e,defaultSources:t}):r?t.concat(e):e,o=this._get("allSources")||new W;return o.removeAll(),o.addMany(s.filter(Boolean)),o}get defaultSymbol(){return a(z,"defaultSymbol",{replacement:"defaultSymbols",version:"4.22"}),this._get("defaultSymbol")}set defaultSymbol(e){a(z,"defaultSymbol",{replacement:"defaultSymbols",version:"4.22"}),this._set("defaultSymbol",e)}get locationEnabled(){return this._get("locationEnabled")||D()}set locationEnabled(e){if(void 0===e)return void this._clearOverride("locationEnabled");const t=D();if(e&&!t){const e=new n("locationEnabled:geolocation-unsupported","Geolocation API is unsupported.",{geolocation:navigator.geolocation});z.error(e)}this._override("locationEnabled",e&&t)}get placeholder(){const{allSources:e,activeSourceIndex:t,allPlaceholder:r}=this;if(t===te)return r;const s=e.getItemAt(t);return s?s.placeholder:""}set searchTerm(e){this._set("searchTerm",e||""),this.clearGraphics(),this.selectedSuggestion&&this.selectedSuggestion.text!==e&&this._set("selectedSuggestion",null),""===e&&this._clear()}get searchTerm(){return this._get("searchTerm")||""}get state(){return this._searching?"searching":this.updating?"loading":0===this.allSources.length?"disabled":"ready"}get updating(){return null!=this._updatingPromise}clear(){this.searchTerm=""}clearGraphics(){this._removeHighlight(),this._closePopup(),this.view&&this.view.graphics.remove(this.resultGraphic),this._set("resultGraphic",null)}search(e,t){this.emit("search-start"),this.clearGraphics();const r=this._createSuggestionForSearch(e),s=this.when().then((()=>this._getResultsFromSources(r,t).then((e=>{var s;if(null!=(s=d(null==t?void 0:t.signal))&&s.aborted)return null;const o={activeSourceIndex:this.activeSourceIndex,searchTerm:r.text,numResults:0,numErrors:0,errors:[],results:[]};this._formatResponse(o,e,r);const l=this._getFirstResult(o.results),i=(r.location&&l?l.name:r.text).replace(ee,"");return this._set("searchTerm",i),(r.key&&"number"==typeof r.sourceIndex||r.location)&&this._set("selectedSuggestion",r),this._set("results",o.results),this._set("resultCount",o.results.reduce(((e,t)=>e+t.results.length),0)),this.emit("search-complete",o),this._selectFirstResult(l).then((()=>o))})))).then((e=>(this._clearSearching(),e)),(e=>{throw this._clearSearching(),e}));return this._searching=s,s}searchNearby(e){if(!this.locationEnabled){const e=new n("searchNearby:geolocation-unsupported","Geolocation API is unsupported.",{geolocation:navigator.geolocation});return z.error(e),Promise.reject(e)}const t=M().then((t=>V({position:t,view:this.view},e))).then((t=>this.search(t,e)));return this._searching=t,t.catch((()=>{})).then((()=>this._clearSearching())),t}select(e){if(this.clearGraphics(),!e){const t=new n("select:missing-parameter","Cannot select without a searchResult.",{searchResult:e});return z.error(t),Promise.reject(t)}const{view:t}=this,r=Q(e,"sourceIndex")?e.sourceIndex:this._getSourceIndexOfResult(e),o=this.allSources.getItemAt(r);if(!o){const e=new n("select:missing-source","Cannot select without a source.",{source:o});return z.error(e),Promise.reject(e)}const l=o instanceof P?this._getLayerSourcePopupTemplate(o):o.popupTemplate,i=o.resultSymbol||this._getDefaultSymbol(e),a=Q(o,"resultGraphicEnabled")?o.resultGraphicEnabled:this.resultGraphicEnabled,u=Q(o,"autoNavigate")?o.autoNavigate:this.autoNavigate,c=Q(o,"popupEnabled")?o.popupEnabled:this.popupEnabled,h=c?l||this.popupTemplate||this.defaultPopupTemplate:null,{feature:p}=e;if(!p){const e=new n("select:missing-feature","Cannot select without a feature.",{feature:p});return z.error(e),Promise.reject(e)}const{attributes:d,geometry:m,layer:f,sourceLayer:S}=p,v=F(m),_={layerViewQuery:this._getLayerView(p),elevationQuery:t&&g(v)?A(v,t).catch((()=>v)):Promise.resolve(v)};return y(_).then((l=>{const n=l.layerViewQuery.value,y=l.elevationQuery.value;i instanceof H&&(i.text=e.name);const v=t&&u?e.target||e.extent:null;return(g(v)?this._goToSearchResult(v):Promise.resolve()).then((()=>{var l;const u=n?p:new s({geometry:m,symbol:i,attributes:d,layer:f,sourceLayer:S,popupTemplate:h}),g=c&&(null==(l=this.view)?void 0:l.popup),v=g&&u.getEffectivePopupTemplate(g.defaultPopupTemplateEnabled);return v&&t.popup.open({features:[u],location:y}),n&&R(n)&&!v&&this._highlightFeature({graphic:u,layerView:n}),!n&&a&&t&&t.graphics.push(u),this._setResultFloor(e),this._set("selectedResult",e),this._set("resultGraphic",u),this.emit("select-result",{result:e,source:o,sourceIndex:r}),e}))}))}suggest(e,t,r){const s=e||this.searchTerm;return this.emit("suggest-start",{searchTerm:s}),this._suggestTimer(t,r).then((()=>this._suggestImmediate(s,r).then((e=>(this._set("suggestions",e.results),this._set("suggestionCount",e.results.reduce(((e,t)=>e+t.results.length),0)),this.emit("suggest-complete",e),e)))))}async when(){await S((()=>!this.updating))}async _update(){const{portal:e,view:t}=this;if(this.includeDefaultSources){const r=this._updatingPromise=y([null==e?void 0:e.load(),null==t?void 0:t.when()]);if(this.destroyed)return;if(await r,r!==this._updatingPromise)return}await S((()=>this.messages)),this.destroyed||this._updateDefaultSources(),this._updatingPromise=null}_clearSearching(){this._searching=null}_convertHelperServices(){var e,t;const s=null==(e=this.portal)||null==(t=e.helperServices)?void 0:t.geocode;if(!s)return[];return s.map((e=>{if(!1===e.placefinding)return;const t=r.apiKey&&C(e.url)?{url:G}:null,s=E.fromJSON({...e,...t}),o=s.url;if(C(o)||O(o)||N(o)){const e=s.outFields||["Addr_type","Match_addr","StAddr","City"],t=s.placeholder||this.messages.placeholder,r="number"==typeof s.defaultZoomScale?s.defaultZoomScale:2500;s.set({singleLineFieldName:"SingleLine",outFields:e,placeholder:t,defaultZoomScale:r})}return s.singleLineFieldName?s:void 0})).filter(Boolean)}_getLayerSources(e,t){var r;const s=null==(r=this.view)?void 0:r.map;return e.map((e=>{const r=s.findLayerById(e.id);if(!r)return;const o=this._getLayerJSON(e),l=P.fromJSON(o);return l.placeholder=t,this._getLayer(r,o).then((e=>{l.layer=e})),l})).filter(Boolean).toArray()}_getTableSources(e,t){var r;const s=null==(r=this.view)?void 0:r.map;return e.map((e=>{const r=s.findTableById(e.id);if(!r)return;const o=this._getLayerJSON(e),l=P.fromJSON(o);return l.placeholder=t,this._getLayer(r,o).then((e=>{l.layer=e})),l})).filter(Boolean).toArray()}_convertApplicationProperties(){var e,t,r;const s=null==(e=this.view)?void 0:e.map,o=null==s||null==(t=s.applicationProperties)||null==(r=t.viewing)?void 0:r.search;if(!o)return[];const{enabled:l,hintText:i,layers:a,tables:n}=o;if(!l)return[];return[...this._getLayerSources(a,i),...this._getTableSources(n,i)]}_getSubLayer(e,t){return e.load().then((()=>{if(!e.allSublayers)throw new Error;const r=e.allSublayers.find((e=>e.id===t.subLayer));if(!r)throw new Error;return r.createFeatureLayer()}))}async _getBuildingSubLayer(e,t){await e.load();const r=e.allSublayers.find((e=>e.id===t.subLayer));if("building-component"!==(null==r?void 0:r.type))throw new Error;if(await r.load(),null==r.associatedLayer)throw new Error;return await r.associatedLayer.load(),r}_getLayer(e,t){return"feature"===e.type||"scene"===e.type||"csv"===e.type||"geojson"===e.type||"ogc-feature"===e.type?Promise.resolve(e):"map-image"===e.type?this._getSubLayer(e,t).catch((()=>{const t=new n("search:create-featurelayer","Could not create a FeatureLayer from the MapImageLayer",{layer:e});return z.error(t),null})):"building-scene"===e.type?this._getBuildingSubLayer(e,t):Promise.resolve(null)}_getLayerJSON(e){return"function"==typeof e.toJSON?e.toJSON():e}_updateDefaultSources(){const{defaultSources:e,includeDefaultSources:t}=this;e.removeAll(),t&&e.addMany([...this._convertApplicationProperties(),...this._convertHelperServices()])}_abortGoTo(){this._gotoController&&this._gotoController.abort(),this._gotoController=null}_clear(){this._abortGoTo(),this._set("resultCount",null),this._set("results",null),this._set("suggestions",null),this._set("suggestionCount",null),this._set("selectedResult",null),this._set("selectedSuggestion",null),this.emit("search-clear")}_closePopup(){var e;const t=null==(e=this.view)?void 0:e.popup,{resultGraphic:r}=this;if(!t||!r)return;const{selectedFeature:s}=t;s&&s===r&&t.close()}_suggestTimer(e,t){const r=null!=e?e:this.suggestionDelay;return f(r,null,t&&t.signal)}_createLocationForSearch(e){return e instanceof s?F(e.geometry):e instanceof w?e:Array.isArray(e)&&2===e.length?new w({longitude:e[0],latitude:e[1]}):null}_createSuggestionForSearch(e){if(e&&Q(e,"key")&&Q(e,"text")&&Q(e,"sourceIndex"))return e;const t=this._createLocationForSearch(e),r="string"==typeof e?e:this.searchTerm,{selectedSuggestion:s,selectedResult:o}=this,l=!e&&s&&o,i=l&&s.key===o.key&&s.sourceIndex===o.sourceIndex,a=l&&s.location;return i||a?s:{location:d(t),text:t?"":r,sourceIndex:null,key:null}}_getFirstResult(e){let t=null;return e&&e.some((e=>{const{results:r}=e,s=r[0],o=!!s;return o&&(t=s),o})),t}_selectFirstResult(e){return this.autoSelect&&e?this.select(e):Promise.resolve(null)}_suggestImmediate(e,t){return this.when().then((()=>this._getSuggestionsFromSources(e,t))).then((r=>{var s;if(null!=(s=d(null==t?void 0:t.signal))&&s.aborted)return null;const o={activeSourceIndex:this.activeSourceIndex,searchTerm:e,numResults:0,numErrors:0,errors:[],results:[]};return this._formatResponse(o,r),o}))}_formatSourceResponse(e,t,r){const s=t&&t.value||[],o=t&&t.error,l=this.allSources.getItemAt(r);if(o){const t={sourceIndex:r,source:l,error:o};e.errors.push(t),z.error(o),e.numErrors++}else{const t={sourceIndex:r,source:l,results:s};e.results.push(t),e.numResults+=s.length}}_formatResponse(e,t,r){if(t)if(e.activeSourceIndex===te){const s=r&&Q(r,"sourceIndex")&&-1!==r.sourceIndex?r.sourceIndex:void 0;t.forEach(((t,r)=>{const o=void 0!==s?s:r;this._formatSourceResponse(e,t,o)}))}else this._formatSourceResponse(e,t[0],e.activeSourceIndex)}_getResultsFromSources(e,t){const{allSources:r}=this,s=!e.location&&Q(e,"sourceIndex")?e.sourceIndex:this.activeSourceIndex,o=[];if(!r.length){const e=new n("search:no-sources-defined","At least one source is required.",{allSources:r});return z.error(e),Promise.reject(e)}return s===te?r.forEach(((r,s)=>{o.push(this._getResultsFromSource(e,s,t))})):o.push(this._getResultsFromSource(e,s,t)),y(o)}_getSuggestionsFromSources(e,t){const{allSources:r,activeSourceIndex:s}=this,o=[];if(!r.length){const e=new n("suggest:no-sources-defined","At least one source is required.",{allSources:r});return z.error(e),Promise.reject(e)}return s===te?r.forEach(((r,s)=>{o.push(this._getSuggestionsFromSource(e,s,t))})):o.push(this._getSuggestionsFromSource(e,s,t)),y(o)}_getResultsFromSource(e,t,r){var s;const o=this.allSources.getItemAt(t),{location:l=null}=e,i=(null==(s=this.view)?void 0:s.spatialReference)||X,a=Q(o,"maxResults")?o.maxResults:this.maxResults,n=!!(o instanceof P&&Q(o,"exactMatch"))&&o.exactMatch,{view:u}=this;return o.getResults({view:u,sourceIndex:t,location:l,suggestResult:e,spatialReference:i,exactMatch:n,maxResults:a},r)}_getSuggestionsFromSource(e,t,r){const s=this.allSources.getItemAt(t),o=Q(s,"suggestionsEnabled")?s.suggestionsEnabled:this.suggestionsEnabled,l=e.length,i=Q(s,"minSuggestCharacters")?s.minSuggestCharacters:this.minSuggestCharacters;if(o&&e.trim()&&l>=i){var a;const o=(null==(a=this.view)?void 0:a.spatialReference)||X,l=Q(s,"maxSuggestions")?s.maxSuggestions:this.maxSuggestions,{view:i}=this,n=!!(s instanceof P&&Q(s,"exactMatch"))&&s.exactMatch;return s.getSuggestions({view:i,sourceIndex:t,suggestTerm:e,spatialReference:o,maxSuggestions:l,exactMatch:n},r)}return Promise.resolve(null)}_getLayerSourcePopupTemplate(e){const{layer:t}=e;if(t)return Q(e,"popupTemplate")?e.popupTemplate:t.popupTemplate}_getSourceIndexOfResult(e){const t=this.results;let r=null;return t.some((t=>t.results.some((s=>s===e&&(r=t.sourceIndex,!0))))),r}async _goToSearchResult(e){const t=!!e;this._abortGoTo();const r=new AbortController;this._gotoController=r;const s={target:{target:e},options:{animate:t,signal:r.signal}};await this.callGoTo(s),this._gotoController=null}_getDefaultSymbol(e){var t;const{defaultSymbols:r}=this,s=null==(t=e.feature)?void 0:t.geometry;if(m(s))return null;const o=this._get("defaultSymbol");if(o&&("point"===s.type||"multipoint"===s.type))return o;switch(s.type){case"point":case"multipoint":return r.point;case"polyline":return r.polyline;case"extent":case"polygon":return r.polygon;default:return null}}_removeHighlight(){this._handles.remove(K)}async _getLayerView(e){const{view:t}=this;if(!e||!t||"building-component"===e.layer.type||"subtype-sublayer"===e.layer.type)return null;const{layer:r}=e;return await t.when(),t.whenLayerView(r)}_highlightFeature(e){const{graphic:t,layerView:r}=e,{attributes:s,layer:o}=t,{objectIdField:l}=o,i=s&&s[l],a=r.highlight(i||t);this._handles.add(a,K)}_setResultFloor(e){var t,r,s;const{view:o}=this,l=null==(t=e.feature)?void 0:t.attributes,i=null==(r=e.feature)?void 0:r.sourceLayer;if(i&&"floorInfo"in i&&null!=i&&null!=(s=i.floorInfo)&&s.floorField&&l){const e=l[i.floorInfo.floorField];o.emit("select-result-floor",e)}}};re.ALL_INDEX=te,e([_()],re.prototype,"_searching",void 0),e([_()],re.prototype,"_updatingPromise",void 0),e([_({readOnly:!0,value:null})],re.prototype,"activeSource",null),e([_()],re.prototype,"activeSourceIndex",null),e([_()],re.prototype,"allPlaceholder",null),e([_({readOnly:!0})],re.prototype,"allSources",null),e([_()],re.prototype,"autoNavigate",void 0),e([_()],re.prototype,"autoSelect",void 0),e([_()],re.prototype,"defaultPopupTemplate",void 0),e([_({readOnly:!0})],re.prototype,"defaultSources",void 0),e([_()],re.prototype,"defaultSymbol",null),e([_()],re.prototype,"defaultSymbols",void 0),e([_()],re.prototype,"includeDefaultSources",void 0),e([_()],re.prototype,"locationEnabled",null),e([_()],re.prototype,"maxInputLength",void 0),e([_()],re.prototype,"maxResults",void 0),e([_()],re.prototype,"maxSuggestions",void 0),e([_()],re.prototype,"messages",void 0),e([_()],re.prototype,"minSuggestCharacters",void 0),e([_({readOnly:!0})],re.prototype,"placeholder",null),e([_()],re.prototype,"popupEnabled",void 0),e([_({type:o})],re.prototype,"popupTemplate",void 0),e([_({type:T})],re.prototype,"portal",void 0),e([_()],re.prototype,"resultCount",void 0),e([_()],re.prototype,"resultGraphicEnabled",void 0),e([_({readOnly:!0})],re.prototype,"resultGraphic",void 0),e([_({readOnly:!0})],re.prototype,"results",void 0),e([_({readOnly:!0})],re.prototype,"selectedSuggestion",void 0),e([_()],re.prototype,"searchAllEnabled",void 0),e([_({readOnly:!0})],re.prototype,"selectedResult",void 0),e([_()],re.prototype,"searchTerm",null),e([_({type:W})],re.prototype,"sources",void 0),e([_({readOnly:!0})],re.prototype,"state",null),e([_()],re.prototype,"suggestionDelay",void 0),e([_()],re.prototype,"suggestionCount",void 0),e([_({readOnly:!0})],re.prototype,"suggestions",void 0),e([_()],re.prototype,"suggestionsEnabled",void 0),e([_({readOnly:!0})],re.prototype,"updating",null),e([_()],re.prototype,"view",void 0),e([_()],re.prototype,"clear",null),re=e([b(q)],re);const se=re;export{se as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../intl.js";import e from"../../../core/Error.js";import{clone as t}from"../../../core/lang.js";import r from"../../../core/Logger.js";import{isSome as i}from"../../../core/maybe.js";import{getMetersPerUnitForSR as n}from"../../../core/unitUtils.js";import l from"../../../geometry/Polygon.js";import{createExtentFromGeometry as o,scaleExtent as s}from"./geometryUtils.js";import{substitute as u}from"../../../intl/substitute.js";import{formatDate as a}from"../../../intl/date.js";const c=/https?:\/\/services.*\.arcgis\.com/i,d=/(?:\{([^}]+)\})/g,f=r.getLogger("esri.widgets.Search.support.layerSearchUtils");function m(t,r){const{exactMatch:i=!1,location:l,maxResults:o,spatialReference:s,source:u,sourceIndex:a,suggestResult:c,view:d}=t,{layer:m,filter:g,zoomScale:v}=u,b=d&&d.scale,j=p(u,d),T=r&&r.signal;return h(m).then((()=>{const e=m.popupTemplate;return e?e.getRequiredFields(m.fieldsIndex):null})).then((t=>{var r,p,h;const{objectIdField:R,returnZ:S}=m,D=x(u);if(!$(m,D))throw f.error("invalid-field: displayField is invalid."),new e("getResults():invalid-field","displayField is invalid.");const E=t&&t.length?t:[D],M=u.outFields||E,
|
|
5
|
+
import"../../../intl.js";import e from"../../../core/Error.js";import{clone as t}from"../../../core/lang.js";import r from"../../../core/Logger.js";import{isSome as i}from"../../../core/maybe.js";import{getMetersPerUnitForSR as n}from"../../../core/unitUtils.js";import l from"../../../geometry/Polygon.js";import{createExtentFromGeometry as o,scaleExtent as s}from"./geometryUtils.js";import{substitute as u}from"../../../intl/substitute.js";import{formatDate as a}from"../../../intl/date.js";const c=/https?:\/\/services.*\.arcgis\.com/i,d=/(?:\{([^}]+)\})/g,f=r.getLogger("esri.widgets.Search.support.layerSearchUtils");function m(t,r){const{exactMatch:i=!1,location:l,maxResults:o,spatialReference:s,source:u,sourceIndex:a,suggestResult:c,view:d}=t,{layer:m,filter:g,zoomScale:v}=u,b=d&&d.scale,j=p(u,d),T=r&&r.signal;return h(m).then((()=>{const e=m.popupTemplate;return e?e.getRequiredFields(m.fieldsIndex):null})).then((t=>{var r,p,h;const{objectIdField:R,returnZ:S}=m,D=x(u);if(!$(m,D))throw f.error("invalid-field: displayField is invalid."),new e("getResults():invalid-field","displayField is invalid.");const E=t&&t.length?t:[D],M=u.outFields||E,C=y(M);M.includes(R)||C||M.push(R),null!=(r=m.floorInfo)&&r.floorField&&M.push(m.floorInfo.floorField);if(!(C||w(m,M)))throw f.error("invalid-field: outField is invalid."),new e("getResults():invalid-field","outField is invalid.");const N=m.createQuery(),{orderByFields:k}=u;if(k&&(N.orderByFields=k),s){N.outSpatialReference=s;const e=1/n(s);e&&(N.maxAllowableOffset=e)}const q="mesh"===m.geometryType||"multipatch"===m.geometryType,A=(null==(p=m.capabilities)||null==(h=p.data)?void 0:h.supportsZ)&&!q;if(N.returnZ=A&&!1!==S,N.returnGeometry=!0,N.multipatchOption=q?"xyFootprint":null,M&&(N.outFields=M),l)N.geometry=l;else if(c.key)N.objectIds=[c.key];else{const t=u.searchFields||[D];if(!w(m,t))throw f.error("invalid-field: search field is invalid."),new e("getResults():invalid-field","search field is invalid.");F(m)&&(N.num=o),j&&(N.geometry=j);if(!c.text.trim())return[];const{prefix:r="",suffix:n=""}=u,l=L({searchTerm:I(`${r}${c.text}${n}`),layer:m,searchFields:t,filter:g,exactMatch:i,type:"search"});if(!l)return[];N.where=l}return m.queryFeatures(N,{signal:T}).then((e=>U(e,d,u,a,D,b,v)))}))}function g(t,r){const{source:i,spatialReference:n,view:l,suggestTerm:o,maxSuggestions:s,sourceIndex:u,exactMatch:a}=t,{layer:c,filter:m}=i,g=r&&r.signal,v=p(i,l);return h(c).then((()=>{if(!F(c))return[];const t=x(i),r=i.searchFields||[t],l=[];i.suggestionTemplate?i.suggestionTemplate.replace(d,((e,t)=>(l.push(t),e))):l.push(t);const p=y(l);l.includes(c.objectIdField)||p||l.push(c.objectIdField);const h=$(c,t),b=p||w(c,l),j=w(c,r);if(!h)throw f.error("invalid-field: displayField is invalid."),new e("getSuggestions():invalid-field","displayField is invalid.");if(!b)throw f.error("invalid-field: outField is invalid."),new e("getSuggestions():invalid-field","outField is invalid.");if(!j)throw f.error("invalid-field: search field is invalid."),new e("getSuggestions():invalid-field","search field is invalid.");const T=c.createQuery(),{orderByFields:R}=i;R&&(T.orderByFields=R),T.outSpatialReference=n,T.returnGeometry=!1,T.num=s,T.outFields=l,v&&(T.geometry=v);if(!o.trim())return[];const{prefix:S="",suffix:D=""}=i,E=L({searchTerm:I(`${S}${o}${D}`),layer:c,searchFields:r,filter:m,exactMatch:a,type:"suggest"});return E?(T.where=E,c.queryFeatures(T,{signal:g}).then((e=>N(e,i,u,t)))):[]}))}function p(e,t){const{filter:r,withinViewEnabled:i}=e,n=t&&t.extent;return r&&r.geometry||(i&&n?n:void 0)}function y(e){return e&&e.includes("*")}async function h(e){e&&await e.load()}function F(e){var t,r,i;return null!=(t=null==e||null==(r=e.capabilities)||null==(i=r.query)?void 0:i.supportsPagination)&&t}function v(e){var t,r,i,n;return null!=(t=null==e||null==(r=e.fieldsIndex)||null==(i=r.fields)||null==(n=i.find((e=>"string"===e.type)))?void 0:n.name)?t:""}function x(e){return e.displayField||e.layer.displayField||v(e.layer)}function w(e,t){return!(!e||!t)&&t.every((t=>$(e,t)))}function $(e,t){return!!e.getField(t)}function b(e){for(let t=0;t<e.length;t++)if(e.charCodeAt(t)>255)return!0;return!1}function j(e,t,r){let i=null;const{codedValues:n}=e;return n&&n.some((e=>{const n=e.name,l=r?n:n.toLowerCase();return(r?t:t.toLowerCase())===l&&(i=e.code.toString(),!0)})),i}function I(e){return e.replace(/\'/g,"''")}function T(e,t){const r=t&&t.where;return r?`(${e}) AND (${r})`:e}function R({currentTerm:e,field:t,filter:r,exactMatch:i,url:n,type:l}){const o=t.type,s=t.name;if("string"===o||"date"===o||"global-id"===o){const t=c.test(n),o=t&&b(e)?"N":"";if(i&&"search"===l)return T(`${s} = ${o}'${e}'`,r);const u=t?s:`UPPER(${s})`,a=t?e:e.toUpperCase();return T(`${u} LIKE ${o}${i?`'${a}%'`:`'%${a}%'`}`,r)}if("oid"===o||"small-integer"===o||"integer"===o||"single"===o||"double"===o){const t=Number(e);return isNaN(t)?null:T(`${s} = ${t}`,r)}return T(`${s} = ${e}`,r)}function S(e,t){return e?` OR (${t})`:`(${t})`}function L({searchTerm:e,layer:t,searchFields:r,filter:i,exactMatch:n,type:l}){const{definitionExpression:o,url:s}=t;let u="";return e&&r&&r.forEach((r=>{const o=t.getField(r),a="function"==typeof t.getFieldDomain&&t.getFieldDomain(r),c=(a&&"coded-value"===a.type?j(a,e,n):null)||e||null;if(null!==c){const e=R({currentTerm:c,field:o,filter:i,exactMatch:n,url:s,type:l});e&&(u+=S(u,e))}})),o?`(${o}) AND (${u})`:u}function D(e,t){let r=null;const{codedValues:i}=e;return i&&i.length&&i.some((e=>e.code===t&&(r=e.name,!0))),r}function E(e,t){return e[Object.keys(e).find((e=>e.toLowerCase()===t.toLowerCase()))]}function M(e,t,r){const i=e.sourceLayer,{attributes:n}=e,l="function"==typeof i.getFieldDomain&&i.getFieldDomain(r);if(t)return u(t,n);if(r&&n){const e=i.getField(r),t=E(n,r);return null==t?"":l&&"coded-value"===l.type?D(l,t):"date"===(null==e?void 0:e.type)?a(new Date(t)):"number"==typeof t?t.toString():"string"!=typeof t?"":t.trim()}return""}function C(e,t,r,i){const n=e.sourceLayer,{attributes:l}=e,{objectIdField:o}=n,s=l[o];return{text:M(e,t.suggestionTemplate,i),key:s,sourceIndex:r}}function N(e,t,r,i){return e.features.map((e=>C(e,t,r,i)))}function k(e,r,n,u,a,c,d){const f=e.clone(),m=e.sourceLayer,g=m&&m.objectIdField,p=g&&e.attributes[g],y=M(e,n.searchTemplate,a),h=o(f.geometry,r,c),F="number"==typeof d?s(t(h),r,d):h,v=e.clone();return i(F)&&(v.geometry=l.fromExtent(F)),{extent:F,target:v,feature:f,key:p,name:y,sourceIndex:u}}function U(e,t,r,i,n,l,o){return e.features.map((e=>k(e,t,r,i,n,l,o)))}export{m as getResults,g as getSuggestions};
|