@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
package/widgets/LayerList.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{eventKey as i}from"../core/events.js";import s from"../core/Handles.js";import o from"../core/has.js";import{on as n,init as l}from"../core/watchUtils.js";import{aliasOf as r}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import{cast as a}from"../core/accessorSupport/decorators/cast.js";import{property as c}from"../core/accessorSupport/decorators/property.js";import{subclass as d}from"../core/accessorSupport/decorators/subclass.js";import h from"./Widget.js";import m from"./LayerList/LayerListViewModel.js";import g from"./LayerList/ListItem.js";import{findSelectedItem as u,sortLayersToIds as p,sortChildLayersToIds as _,canSortSublayers as b}from"./LayerList/support/layerListUtils.js";import{accessibleHandler as y}from"./support/decorators/accessibleHandler.js";import{messageBundle as v}from"./support/decorators/messageBundle.js";import"../core/Logger.js";import{vmEvent as I}from"./support/decorators/vmEvent.js";import{tsx as f}from"./support/jsxFactory.js";import"./support/widgetUtils.js";import A from"sortablejs";function w(e,t,i){e.splice(i,0,e.splice(t,1)[0])}const C="esri-layerlist-new-ui",S=t.ofType(g),L="data-sort-filter",k="data-layer-uid",M="layerUid",T={base:"esri-layer-list esri-widget esri-widget--panel",newUI:"esri-layer-list--new-ui",noItems:"esri-layer-list__no-items",list:"esri-layer-list__list",listRoot:"esri-layer-list__list--root",listExclusive:"esri-layer-list__list--exclusive",listInherited:"esri-layer-list__list--inherited",listIndependent:"esri-layer-list__list--independent",item:"esri-layer-list__item",itemContent:"esri-layer-list__item-content",itemMessage:"esri-layer-list__item--has-message",itemInvisible:"esri-layer-list__item--invisible",itemInvisibleAtScale:"esri-layer-list__item--invisible-at-scale",itemUpdating:"esri-layer-list__item--updating",itemChildren:"esri-layer-list__item--has-children",itemSelectable:"esri-layer-list__item--selectable",itemContainer:"esri-layer-list__item-container",actionsMenu:"esri-layer-list__item-actions-menu",actionsMenuItem:"esri-layer-list__item-actions-menu-item",actionsMenuItemActive:"esri-layer-list__item-actions-menu-item--active",actions:"esri-layer-list__item-actions",actionsList:"esri-layer-list__item-actions-list",action:"esri-layer-list__item-action",actionIcon:"esri-layer-list__item-action-icon",actionImage:"esri-layer-list__item-action-image",actionTitle:"esri-layer-list__item-action-title",actionToggle:"esri-layer-list__action-toggle",actionToggleOn:"esri-layer-list__action-toggle--on",label:"esri-layer-list__item-label",message:"esri-layer-list__item-message",title:"esri-layer-list__item-title",toggleVisible:"esri-layer-list__item-toggle",toggleVisibleIcon:"esri-layer-list__item-toggle-icon",toggleIcon:"esri-layer-list__item-toggle-icon",radioIcon:"esri-layer-list__item-radio-icon",childToggle:"esri-layer-list__child-toggle",childToggleOpen:"esri-layer-list__child-toggle--open",childOpened:"esri-layer-list__child-toggle-icon--opened",childClosed:"esri-layer-list__child-toggle-icon--closed",childClosed_RTL:"esri-layer-list__child-toggle-icon--closed-rtl",sortableChosen:"esri-layer-list--chosen",disabled:"esri-disabled",disabledElement:"esri-disabled-element",hidden:"esri-hidden",rotating:"esri-rotating",iconEllipses:"esri-icon-handle-horizontal",iconVisible:"esri-icon-visible",iconInvisible:"esri-icon-non-visible",iconRadioSelected:"esri-icon-radio-checked",iconRadioUnselected:"esri-icon-radio-unchecked",iconNoticeTriangle:"esri-icon-notice-triangle",iconChildrenOpen:"esri-icon-down-arrow",iconDownArrow:"esri-icon-down-arrow",iconRightArrow:"esri-icon-right-triangle-arrow",iconLeftArrow:"esri-icon-left-triangle-arrow",iconLoading:"esri-icon-loading-indicator",iconDefaultAction:"esri-icon-default-action",widgetIcon:"esri-icon-layers"},E={actions:"actions",actionSection:"action-section",items:"items"},R={exclusive:"exclusive",inherited:"inherited",independent:"independent"};function x(e){const{actionsOpen:t,children:i}=e;t&&(e.actionsOpen=!1),i.forEach((e=>x(e)))}const U="root",O={statusIndicators:!0};let N=class extends h{constructor(e,t){super(e,t),this._handles=new s,this._sortableNodes=new Map,this._sortableMap=new Map,this._focusSortUid=null,this._newUI=o(C),this._tooltipReferenceMap=new Map,this.visibleItems=null,this.iconClass=T.widgetIcon,this.label=void 0,this.listItemCanGiveFunction=null,this.listItemCanReceiveFunction=null,this.listItemCreatedFunction=null,this.messages=null,this.messagesCommon=null,this.multipleSelectionEnabled=!1,this.operationalItems=null,this.selectionEnabled=!1,this.selectedItems=new S,this.view=null,this.viewModel=new m,this.visibleElements={...O},this._onSortableSort=({to:e,from:t,item:i,newIndex:s})=>{t&&e&&(t===e?this._sortLayers(this._sortableMap.get(t.dataset.group)):this._moveLayerFromChildList({to:e,from:t,item:i,newIndex:s}))},this._sortableCanSort=(e,t)=>!(!e.el.dataset.group||!t.el.dataset.group),this._sortableCanPull=(e,t,i)=>{const{listItemCanGiveFunction:s}=this,o={selected:i["data-item"],from:t.el["data-item"],to:e.el["data-item"]};return!this._sortableCanSort(e,t)||"function"!=typeof s||s.call(null,o)},this._sortableCanPut=(e,t,i)=>{const{listItemCanReceiveFunction:s}=this,o={selected:i["data-item"],from:t.el["data-item"],to:e.el["data-item"]};return!this._sortableCanSort(e,t)||"function"!=typeof s||s.call(null,o)},this._onSortableEnd=({oldIndex:e,from:t,to:i,item:s})=>{t!==i&&t.insertBefore(s,t.children[e])}}initialize(){const e=this.operationalItems;this._setVisibleItems(e),this.own(n(this,"operationalItems","change",(()=>this._itemsChanged(e))),l(this,"selectionEnabled",(()=>this._toggleAllSorting())))}loadDependencies(){return Promise.all([import("@esri/calcite-components/dist/components/calcite-tooltip-manager.js"),import("@esri/calcite-components/dist/components/calcite-tooltip.js")])}destroy(){this._destroySortables(),this._tooltipReferenceMap.clear(),this._handles.destroy(),this._handles=null}castVisibleElements(e){return{...O,...e}}triggerAction(e,t){this.viewModel.triggerAction(e,t)}render(){var e;const{visibleItems:t,_newUI:i}=this,s=null==(e=this.viewModel)?void 0:e.state,o={[T.newUI]:i,[T.hidden]:"loading"===s,[T.disabled]:"disabled"===s},n=this.renderItemTooltips(),l=this.renderItems();return f("div",{class:this.classes(T.base,o)},null!=t&&t.length?[n,n.length?f("calcite-tooltip-manager",null,l):l]:this.renderNoItems())}renderItemTooltip(e){const{_tooltipReferenceMap:t,messages:i}=this;return e?f("calcite-tooltip",{label:i.layerIncompatible,referenceElement:t.get(e.uid)},i.layerIncompatibleTooltip):null}renderItemTooltipNodes(e){const{incompatible:t,children:i}=e;return[t?this.renderItemTooltip(e):null,...t?[]:null==i?void 0:i.toArray().map((e=>this.renderItemTooltipNodes(e)))]}renderItemTooltips(){return this.visibleItems.toArray().map((e=>this.renderItemTooltipNodes(e)))}renderNoItems(){return f("div",{class:T.noItems},this.messages.noItemsToDisplay)}renderItems(){const{visibleItems:e,selectionEnabled:t,messages:i}=this;return f("ul",{"aria-label":i.widgetLabel,role:t?"listbox":void 0,afterCreate:this._sortNodeCreated,afterUpdate:this._sortNodeCreated,afterRemoved:this._sortNodeRemoved,"data-group":U,bind:this,class:this.classes(T.list,T.listRoot,T.listIndependent)},null==e?void 0:e.map((e=>this.renderItem(e,null))).toArray())}renderActionsMenuIcon(e,t){const{messagesCommon:i}=this,s={[T.actionsMenuItemActive]:e.actionsOpen};return f("div",{key:"actions-menu-toggle","data-item":e,bind:this,onclick:this._toggleActionsOpen,onkeydown:this._toggleActionsOpen,class:this.classes(T.actionsMenuItem,s),tabindex:"0",role:"button","aria-controls":t,"aria-label":i.options,title:i.options},f("span",{"aria-hidden":"true",class:T.iconEllipses}))}renderActionsMenu(e,t,i,s){const{panel:o}=e,n=o&&o.visible?this.renderPanelButton(o):null,l=1===i&&this._getSingleActionButton(t),r=l?this.renderAction({item:e,action:l,singleAction:!0}):null,a=!l&&i?this.renderActionsMenuIcon(e,s):null;return a||n||l?f("div",{key:"actions-menu",class:T.actionsMenu},n,r,a):null}renderChildList(e,t){var i;const{selectionEnabled:s}=this,{visibilityMode:o,children:n}=e,l=this._hasChildren(e),r=!l&&s&&"group"===(null==(i=e.layer)?void 0:i.type),{exclusive:a,inherited:c}=R,d={[T.listExclusive]:o===a,[T.listInherited]:o===c,[T.listIndependent]:o!==c&&o!==a};return l||r?f("ul",{bind:this,key:"list-items",id:t,"data-group":e.uid,"data-item":e,afterCreate:this._sortNodeCreated,afterUpdate:this._sortNodeCreated,afterRemoved:this._sortNodeRemoved,class:this.classes(T.list,d),"aria-expanded":e.open?"true":"false",role:s?"listbox":o===a?"radiogroup":"group",hidden:!e.open&&!r||null},null==n?void 0:n.map((t=>this.renderItem(t,e))).toArray()):null}renderChildrenToggle(e,t){const{messagesCommon:i}=this,s=this._hasChildren(e),o={[T.childToggleOpen]:e.open},n=e.open?i.collapse:i.expand;return s?f("span",{onclick:this._toggleChildrenClick,onkeydown:this._toggleChildrenClick,"data-item":e,key:"toggle-children",class:this.classes(T.childToggle,o),tabindex:"0",role:"button","aria-controls":t,"aria-label":n,title:n},f("span",{"aria-hidden":"true",class:this.classes(T.childClosed,T.iconRightArrow)}),f("span",{"aria-hidden":"true",class:this.classes(T.childOpened,T.iconDownArrow)}),f("span",{"aria-hidden":"true",class:this.classes(T.childClosed_RTL,T.iconLeftArrow)})):null}renderItemMessage(e){return e.error?f("div",{key:"esri-layer-list__error",class:T.message,role:"alert"},f("span",{"aria-hidden":"true",class:T.iconNoticeTriangle}),this.messages.layerError):e.incompatible?f("div",{key:"esri-layer-list__incompatible",class:T.message,role:"alert"},f("span",{bind:this,tabIndex:0,"aria-hidden":"true",class:T.iconNoticeTriangle,afterCreate:t=>this._setTooltipReference(t,e)}),this.messages.layerIncompatible):null}renderItemContent(e,t,i){const{id:s}=this,o=`${s}_${e.uid}`,n=`${o}_actions`,l=`${o}__list`,{panel:r}=e,a=this._filterActions(e.actionsSections),c=this._countActions(a);return[f("div",{key:"list-item-container",class:T.itemContainer},this.renderChildrenToggle(e,l),this.renderLabel(e,t,i),this.renderActionsMenu(e,a,c,n)),this.renderItemMessage(e),c?this.renderActionsSections(e,a,n):null,r&&r.open?r.render():null,this.renderChildList(e,l)]}renderItem(e,t){const{_newUI:i,id:s,selectionEnabled:o,selectedItems:n,visibleElements:l}=this,r=`${`${s}_${e.uid}`}__title`,a=this._hasMessage(e),c=this._hasChildren(e),d={[T.itemChildren]:c,[T.itemMessage]:!!a,[T.itemUpdating]:e.updating&&!t&&l.statusIndicators,[T.itemInvisible]:i&&!e.visible,[T.itemInvisibleAtScale]:!e.visibleAtCurrentScale,[T.itemSelectable]:o};if(o){var h;const i={[k]:null==(h=e.layer)?void 0:h.uid,[L]:(!e.sortable).toString()};return f("li",{key:`item-with-selection-${e.uid}`,bind:this,afterCreate:this._focusListItem,afterUpdate:this._focusListItem,class:this.classes(T.item,d),"aria-labelledby":r,onclick:this._toggleSelection,onkeydown:this._selectionKeydown,"data-item":e,"data-group":t?t.uid:U,tabIndex:0,"aria-selected":u(e,n)?"true":"false",role:"option",...i},this.renderItemContent(e,t,r))}return f("li",{key:`item-no-selection-${e.uid}`,bind:this,afterCreate:this._focusListItem,afterUpdate:this._focusListItem,class:this.classes(T.item,d),"aria-labelledby":r},this.renderItemContent(e,t,r))}renderItemTitle(e,t){const{messages:i}=this,s=e.title||i.untitledLayer,o=e.visibleAtCurrentScale?s:`${s} (${i.layerInvisibleAtScale})`;return f("span",{key:"layer-title-container",id:t,title:o,"aria-label":o,class:T.title},s)}renderItemToggleIcon(e,t){const{_newUI:i}=this,{exclusive:s}=R,o=t&&t.visibilityMode,n={[T.toggleVisibleIcon]:i,[T.toggleIcon]:i&&o!==s,[T.radioIcon]:i&&o===s,[T.iconRadioSelected]:o===s&&e.visible,[T.iconRadioUnselected]:o===s&&!e.visible,[T.iconVisible]:o!==s&&e.visible,[T.iconInvisible]:o!==s&&!e.visible};return f("span",{key:"item-toggle-icon",class:this.classes(n),"aria-hidden":"true"})}renderItemToggle(e,t,i){const{selectionEnabled:s,messages:o}=this,{exclusive:n}=R,l=t&&t.visibilityMode,r=l===n?"radio":"switch";return f("span",s?{key:"item-toggle-selection-enabled",class:T.toggleVisible,bind:this,onclick:this._toggleVisibility,onkeydown:this._toggleVisibility,"data-item":e,"data-parent-visibility":l,tabIndex:0,title:e.visible?o.hideLayer:o.showLayer,"aria-checked":e.visible?"true":"false",role:r,"aria-labelledby":i}:{key:"item-toggle",class:T.toggleVisible},this.renderItemToggleIcon(e,t))}renderLabel(e,t,i){const{selectionEnabled:s,_newUI:o,messages:n}=this,{inherited:l,exclusive:r}=R,a=null==t?void 0:t.visibilityMode,c=a===r?"radio":"switch",d=[this.renderItemToggle(e,t,i),this.renderItemTitle(e,i)];o&&d.reverse();const h=f("div",s?{key:`item-label-no-selection-${e.uid}`,class:T.label}:{key:`item-label-with-selection-${e.uid}`,class:T.label,bind:this,onclick:this._toggleVisibility,onkeydown:this._toggleVisibility,"data-item":e,"data-parent-visibility":a,tabIndex:0,"aria-checked":e.visible?"true":"false",title:e.visible?n.hideLayer:n.showLayer,role:c,"aria-labelledby":i},d);return a===l||e.error?f("div",{key:`item-label-container-${e.uid}`,class:T.label},this.renderItemTitle(e,i)):h}renderPanelButton(e){const{className:t,open:i,title:s,image:o}=e,n=o||t?t:T.iconDefaultAction,l=this._getIconImageStyles(e),r={[T.actionsMenuItemActive]:i},a={[T.actionImage]:!!l["background-image"]};return n&&(a[n]=!!n),f("div",{key:`panel-${e.uid}`,bind:this,"data-panel":e,onclick:this._triggerPanel,onkeydown:this._triggerPanel,class:this.classes(T.actionsMenuItem,r),role:"button",tabindex:"0",title:s,"aria-label":s},f("span",{class:this.classes(a),styles:l}))}renderActionsSections(e,t,i){const s=t.toArray().map(((t,i)=>f("ul",{key:`${e}-action-section-${i}`,class:T.actionsList},this.renderActionSection(e,t))));return f("div",{role:"group","aria-expanded":e.actionsOpen?"true":"false",key:"actions-section",id:i,class:T.actions,hidden:!e.actionsOpen||null},s)}renderActionSection(e,t){return(t&&t.toArray()).map((t=>this.renderAction({item:e,action:t})))}renderActionIcon(e){const{active:t,className:i}=e,s=this._getIconImageStyles(e),o="button"!==e.type||e.image||i?i:T.iconDefaultAction,n={[T.actionImage]:!t&&!!s["background-image"],[T.iconLoading]:t,[T.rotating]:t};return o&&!t&&(n[o]=!0),f("span",{key:"action-icon","aria-hidden":"true",class:this.classes(T.actionIcon,n),styles:s})}renderActionTitle(e,t){return t?null:f("span",{key:"action-title",class:T.actionTitle},e)}renderAction(e){const{item:t,action:i,singleAction:s}=e,{active:o,disabled:n,title:l}=i,r={[T.actionsMenuItem]:s&&"button"===i.type,[T.action]:o||!s&&"toggle"!==i.type,[T.actionToggle]:!o&&"toggle"===i.type,[T.actionToggleOn]:!o&&"toggle"===i.type&&i.value,[T.disabledElement]:n},a=[this.renderActionIcon(i),this.renderActionTitle(l,s)];return s?f("div",{bind:this,"data-item":t,"data-action":i,role:"button",key:`single-action-${i.uid}`,onclick:this._triggerAction,onkeydown:this._triggerAction,classes:r,tabindex:"0",title:l,"aria-label":l},a):f("li",{bind:this,"data-item":t,"data-action":i,key:`action-${i.uid}`,onclick:this._triggerAction,onkeydown:this._triggerAction,classes:r,tabindex:"0",role:"button",title:l,"aria-label":l},a)}_setTooltipReference(e,t){this._tooltipReferenceMap.set(t.uid,e),this.scheduleRender()}_hasMessage(e){return!!e.error||e.incompatible}_hasChildren(e){return!!e.children.length&&!this._hasMessage(e)}_sortNodeRemoved(e){const{_sortableMap:t}=this,i=e.dataset.group,s=t.get(i);s&&s.destroy(),t.delete(i)}_destroySortables(){const{_sortableMap:e,_sortableNodes:t}=this;e.forEach((e=>e&&e.destroy())),e.clear(),t.clear()}_moveLayerFromChildList({to:e,from:t,item:i,newIndex:s}){const o=i["data-item"],n=e["data-item"],l=t["data-item"];this.viewModel.moveListItem(o,l,n,s)}_sortLayers(e){if(!e)return;const t=e.el["data-item"],i=e.toArray();var s,o;t?_(t,i):p(null==(s=this.view)||null==(o=s.map)?void 0:o.layers,i)}_toggleSorting(e,t){const{_sortableMap:i,selectionEnabled:s}=this,o=i.get(t),n=e["data-item"],l=(t===U||n.childrenSortable&&b(n))&&s;if(o)o.option("disabled",!l);else if(l){const s=A.create(e,{dataIdAttr:k,group:{name:t,pull:this._sortableCanPull,put:this._sortableCanPut},filter:`[${L}="true"]`,fallbackTolerance:4,onSort:this._onSortableSort,onEnd:this._onSortableEnd,disabled:!l,chosenClass:T.sortableChosen});i.set(t,s)}}_toggleAllSorting(){this._sortableNodes.forEach(((e,t)=>this._toggleSorting(e,t)))}_sortNodeCreated(e){const t=e.dataset.group;t&&(this._sortableNodes.set(t,e),this._toggleSorting(e,t))}_setVisibleItems(e){this._tooltipReferenceMap.clear(),this.visibleItems=null==e?void 0:e.filter((e=>this.errorsVisible||!e.error))}_getSingleActionButton(e){return e.reduce((e=>e)).filter((e=>e&&"button"===e.type)).getItemAt(0)}_focusListItem(e){var t;const{_focusSortUid:i}=this;if(!e||!i)return;(null==(t=e["data-item"].layer)?void 0:t.uid)===i&&(e.focus(),this._focusSortUid=null)}_watchActionSectionChanges(e,t){const i=E.actionSection+t;this._handles.add(e.on("change",this.scheduleRender.bind(this)),i),e.forEach((e=>this._renderOnActionChanges(e,t)))}_renderOnActionChanges(e,t){const i=E.actions+t;"toggle"!==e.type?"slider"!==e.type?this._handles.add([l(e,["className","image","id","title","visible"],(()=>this.scheduleRender()))],i):this._handles.add([l(e,["className","id","title","visible","value","displayValueEnabled","max","min","step"],(()=>this.scheduleRender()))],i):this._handles.add([l(e,["className","image","id","title","visible","value"],(()=>this.scheduleRender()))],i)}_renderOnItemChanges(e){const t=e.uid,i=E.items+t;this._handles.add([l(e,["actionsOpen","visible","open","updating","title","visibleAtCurrentScale","error","visibilityMode","panel","panel.title","panel.content","panel.className","sortable","childrenSortable"],(()=>this.scheduleRender())),e.actionsSections.on("change",(()=>this.scheduleRender())),e.children.on("change",(()=>this.scheduleRender()))],i),e.children.forEach((e=>this._renderOnItemChanges(e))),e.actionsSections.forEach((e=>this._watchActionSectionChanges(e,t)))}_itemsChanged(e){this._handles.removeAll(),e.forEach((e=>this._renderOnItemChanges(e))),this._setVisibleItems(e),this.scheduleRender()}_filterActions(e){return e.map((e=>e.filter((e=>e.visible))))}_countActions(e){return e.reduce(((e,t)=>e+t.length),0)}_getIconImageStyles(e){const t="esri.widgets.LayerList.ListItemPanel"===e.declaredClass||"esri.support.Action.ActionButton"===e.declaredClass||"esri.support.Action.ActionToggle"===e.declaredClass?e.image:null;return{"background-image":t?`url("${t}")`:null}}_selectionKeydown(e){const t=["ArrowDown","ArrowUp"],s=i(e);if(-1===t.indexOf(s))return void this._toggleSelection(e);e.stopPropagation();const o=e.currentTarget,n=o["data-item"],{_sortableMap:l,selectedItems:r}=this,a=o.dataset.group,c=l.get(a);if(!c)return;const d=u(n,r),h=c.toArray(),m=e.target,g=h.indexOf(m.dataset[M]);if(-1!==g){if("ArrowDown"===s){const e=g+1;if(e>=h.length)return;var p,_;if(d)w(h,g,e),c.sort(h),this._sortLayers(c),this._focusSortUid=null==(p=n.layer)?void 0:p.uid;else this._focusSortUid=null==(_=n.layer)?void 0:_.uid,this.scheduleRender()}if("ArrowUp"===s){const e=g-1;if(e<=-1)return;var b,y;if(d)w(h,g,e),c.sort(h),this._sortLayers(c),this._focusSortUid=null==(b=n.layer)?void 0:b.uid;else this._focusSortUid=null==(y=n.layer)?void 0:y.uid,this.scheduleRender()}}}_toggleActionsOpen(e){const t=e.currentTarget["data-item"],{actionsOpen:i}=t,s=!i;s&&this.operationalItems.forEach((e=>x(e))),t.actionsOpen=s,e.stopPropagation()}_triggerPanel(e){const t=e.currentTarget["data-panel"];t&&(t.open=!t.open),e.stopPropagation()}_triggerAction(e){const t=e.currentTarget,i=t["data-action"],s=t["data-item"];"toggle"===i.type&&(i.value=!i.value),this.triggerAction(i,s),e.stopPropagation()}_toggleVisibility(e){const t=e.currentTarget,i=t.getAttribute("data-parent-visibility"),s=t["data-item"];i===R.exclusive&&s.visible||(s.visible=!s.visible),e.stopPropagation()}_toggleChildrenClick(e){const t=e.currentTarget["data-item"];t.open=!t.open,e.stopPropagation()}_toggleSelection(e){e.stopPropagation();const{multipleSelectionEnabled:t,selectedItems:i}=this,s=e.currentTarget["data-item"],o=u(s,i),{length:n}=i;if(!t)return n&&!(o&&1===n)?(i.removeAll(),void i.add(s)):void(o?null==i.remove||i.remove(o):i.add(s));o?null==i.remove||i.remove(o):i.add(s)}};e([c()],N.prototype,"visibleItems",void 0),e([c()],N.prototype,"iconClass",void 0),e([c()],N.prototype,"errorsVisible",void 0),e([c({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],N.prototype,"label",void 0),e([c()],N.prototype,"listItemCanGiveFunction",void 0),e([c()],N.prototype,"listItemCanReceiveFunction",void 0),e([r("viewModel.listItemCreatedFunction")],N.prototype,"listItemCreatedFunction",void 0),e([c(),v("esri/widgets/LayerList/t9n/LayerList")],N.prototype,"messages",void 0),e([c(),v("esri/t9n/common")],N.prototype,"messagesCommon",void 0),e([c()],N.prototype,"multipleSelectionEnabled",void 0),e([r("viewModel.operationalItems")],N.prototype,"operationalItems",void 0),e([c()],N.prototype,"selectionEnabled",void 0),e([c()],N.prototype,"selectedItems",void 0),e([r("viewModel.view")],N.prototype,"view",void 0),e([I("trigger-action"),c({type:m})],N.prototype,"viewModel",void 0),e([c()],N.prototype,"visibleElements",void 0),e([a("visibleElements")],N.prototype,"castVisibleElements",null),e([r("viewModel.triggerAction")],N.prototype,"triggerAction",null),e([y()],N.prototype,"_toggleActionsOpen",null),e([y()],N.prototype,"_triggerPanel",null),e([y()],N.prototype,"_triggerAction",null),e([y()],N.prototype,"_toggleVisibility",null),e([y()],N.prototype,"_toggleChildrenClick",null),e([y()],N.prototype,"_toggleSelection",null),N=e([d("esri.widgets.LayerList")],N);const j=N;export{j as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Collection.js";import{eventKey as i}from"../core/events.js";import s from"../core/Handles.js";import o from"../core/has.js";import{on as n,init as l}from"../core/watchUtils.js";import{aliasOf as r}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import{cast as a}from"../core/accessorSupport/decorators/cast.js";import{property as c}from"../core/accessorSupport/decorators/property.js";import{subclass as d}from"../core/accessorSupport/decorators/subclass.js";import h from"./Widget.js";import m from"./LayerList/LayerListViewModel.js";import g from"./LayerList/ListItem.js";import{findSelectedItem as u,sortLayersToIds as p,sortChildLayersToIds as _,canSortSublayers as b}from"./LayerList/support/layerListUtils.js";import{accessibleHandler as y}from"./support/decorators/accessibleHandler.js";import{messageBundle as v}from"./support/decorators/messageBundle.js";import"../core/Logger.js";import{vmEvent as I}from"./support/decorators/vmEvent.js";import{tsx as f}from"./support/jsxFactory.js";import"./support/widgetUtils.js";import A from"sortablejs";function w(e,t,i){e.splice(i,0,e.splice(t,1)[0])}const C="esri-layerlist-new-ui",S=t.ofType(g),L="data-sort-filter",k="data-layer-uid",M="layerUid",T={base:"esri-layer-list esri-widget esri-widget--panel",newUI:"esri-layer-list--new-ui",noItems:"esri-layer-list__no-items",list:"esri-layer-list__list",listRoot:"esri-layer-list__list--root",listExclusive:"esri-layer-list__list--exclusive",listInherited:"esri-layer-list__list--inherited",listIndependent:"esri-layer-list__list--independent",item:"esri-layer-list__item",itemContent:"esri-layer-list__item-content",itemMessage:"esri-layer-list__item--has-message",itemInvisible:"esri-layer-list__item--invisible",itemInvisibleAtScale:"esri-layer-list__item--invisible-at-scale",itemUpdating:"esri-layer-list__item--updating",itemChildren:"esri-layer-list__item--has-children",itemSelectable:"esri-layer-list__item--selectable",itemContainer:"esri-layer-list__item-container",actionsMenu:"esri-layer-list__item-actions-menu",actionsMenuItem:"esri-layer-list__item-actions-menu-item",actionsMenuItemActive:"esri-layer-list__item-actions-menu-item--active",actions:"esri-layer-list__item-actions",actionsList:"esri-layer-list__item-actions-list",action:"esri-layer-list__item-action",actionIcon:"esri-layer-list__item-action-icon",actionImage:"esri-layer-list__item-action-image",actionTitle:"esri-layer-list__item-action-title",actionToggle:"esri-layer-list__action-toggle",actionToggleOn:"esri-layer-list__action-toggle--on",label:"esri-layer-list__item-label",message:"esri-layer-list__item-message",title:"esri-layer-list__item-title",toggleVisible:"esri-layer-list__item-toggle",toggleVisibleIcon:"esri-layer-list__item-toggle-icon",toggleIcon:"esri-layer-list__item-toggle-icon",radioIcon:"esri-layer-list__item-radio-icon",childToggle:"esri-layer-list__child-toggle",childToggleOpen:"esri-layer-list__child-toggle--open",childOpened:"esri-layer-list__child-toggle-icon--opened",childClosed:"esri-layer-list__child-toggle-icon--closed",childClosed_RTL:"esri-layer-list__child-toggle-icon--closed-rtl",sortableChosen:"esri-layer-list--chosen",disabled:"esri-disabled",disabledElement:"esri-disabled-element",hidden:"esri-hidden",rotating:"esri-rotating",iconEllipses:"esri-icon-handle-horizontal",iconVisible:"esri-icon-visible",iconInvisible:"esri-icon-non-visible",iconRadioSelected:"esri-icon-radio-checked",iconRadioUnselected:"esri-icon-radio-unchecked",iconNoticeTriangle:"esri-icon-notice-triangle",iconChildrenOpen:"esri-icon-down-arrow",iconDownArrow:"esri-icon-down-arrow",iconRightArrow:"esri-icon-right-triangle-arrow",iconLeftArrow:"esri-icon-left-triangle-arrow",iconLoading:"esri-icon-loading-indicator",iconDefaultAction:"esri-icon-default-action",widgetIcon:"esri-icon-layers"},E={actions:"actions",actionSection:"action-section",items:"items"},R={exclusive:"exclusive",inherited:"inherited",independent:"independent"};function x(e){const{actionsOpen:t,children:i}=e;t&&(e.actionsOpen=!1),i.forEach((e=>x(e)))}const U="root",O={statusIndicators:!0};let N=class extends h{constructor(e,t){super(e,t),this._handles=new s,this._sortableNodes=new Map,this._sortableMap=new Map,this._focusSortUid=null,this._newUI=o(C),this._tooltipReferenceMap=new Map,this.visibleItems=null,this.iconClass=T.widgetIcon,this.label=void 0,this.listItemCanGiveFunction=null,this.listItemCanReceiveFunction=null,this.listItemCreatedFunction=null,this.messages=null,this.messagesCommon=null,this.multipleSelectionEnabled=!1,this.operationalItems=null,this.selectionEnabled=!1,this.selectedItems=new S,this.view=null,this.viewModel=new m,this.visibleElements={...O},this._onSortableSort=({to:e,from:t,item:i,newIndex:s})=>{t&&e&&(t===e?this._sortLayers(this._sortableMap.get(t.dataset.group)):this._moveLayerFromChildList({to:e,from:t,item:i,newIndex:s}))},this._sortableCanSort=(e,t)=>!(!e.el.dataset.group||!t.el.dataset.group),this._sortableCanPull=(e,t,i)=>{const{listItemCanGiveFunction:s}=this,o={selected:i["data-item"],from:t.el["data-item"],to:e.el["data-item"]};return!this._sortableCanSort(e,t)||"function"!=typeof s||s.call(null,o)},this._sortableCanPut=(e,t,i)=>{const{listItemCanReceiveFunction:s}=this,o={selected:i["data-item"],from:t.el["data-item"],to:e.el["data-item"]};return!this._sortableCanSort(e,t)||"function"!=typeof s||s.call(null,o)},this._onSortableEnd=({oldIndex:e,from:t,to:i,item:s})=>{t!==i&&t.insertBefore(s,t.children[e])}}initialize(){const e=this.operationalItems;this._setVisibleItems(e),this.own(n(this,"operationalItems","change",(()=>this._itemsChanged(e))),l(this,"selectionEnabled",(()=>this._toggleAllSorting())))}loadDependencies(){return Promise.all([import("@esri/calcite-components/dist/components/calcite-tooltip-manager.js"),import("@esri/calcite-components/dist/components/calcite-tooltip.js")])}destroy(){this._destroySortables(),this._tooltipReferenceMap.clear(),this._handles.destroy(),this._handles=null}castVisibleElements(e){return{...O,...e}}triggerAction(e,t){this.viewModel.triggerAction(e,t)}render(){var e;const{visibleItems:t,_newUI:i}=this,s=null==(e=this.viewModel)?void 0:e.state,o={[T.newUI]:i,[T.hidden]:"loading"===s,[T.disabled]:"disabled"===s},n=this.renderItemTooltips(),l=this.renderItems();return f("div",{class:this.classes(T.base,o)},null!=t&&t.length?[n,n.length?f("calcite-tooltip-manager",null,l):l]:this.renderNoItems())}renderItemTooltip(e){const{_tooltipReferenceMap:t,messages:i}=this;return e?f("calcite-tooltip",{label:i.layerIncompatible,referenceElement:t.get(e.uid)},i.layerIncompatibleTooltip):null}renderItemTooltipNodes(e){const{incompatible:t,children:i}=e;return[t?this.renderItemTooltip(e):null,...t?[]:null==i?void 0:i.toArray().map((e=>this.renderItemTooltipNodes(e)))]}renderItemTooltips(){return this.visibleItems.toArray().map((e=>this.renderItemTooltipNodes(e)))}renderNoItems(){return f("div",{class:T.noItems},this.messages.noItemsToDisplay)}renderItems(){const{visibleItems:e,selectionEnabled:t,messages:i}=this;return f("ul",{"aria-label":i.widgetLabel,role:t?"listbox":void 0,afterCreate:this._sortNodeCreated,afterUpdate:this._sortNodeCreated,afterRemoved:this._sortNodeRemoved,"data-group":U,bind:this,class:this.classes(T.list,T.listRoot,T.listIndependent)},null==e?void 0:e.map((e=>this.renderItem(e,null))).toArray())}renderActionsMenuIcon(e,t){const{messagesCommon:i}=this,s={[T.actionsMenuItemActive]:e.actionsOpen};return f("div",{key:"actions-menu-toggle","data-item":e,bind:this,onclick:this._toggleActionsOpen,onkeydown:this._toggleActionsOpen,class:this.classes(T.actionsMenuItem,s),tabindex:"0",role:"button","aria-controls":t,"aria-label":i.options,title:i.options},f("span",{"aria-hidden":"true",class:T.iconEllipses}))}renderActionsMenu(e,t,i,s){const{panel:o}=e,n=o&&o.visible?this.renderPanelButton(o):null,l=1===i&&this._getSingleActionButton(t),r=l?this.renderAction({item:e,action:l,singleAction:!0}):null,a=!l&&i?this.renderActionsMenuIcon(e,s):null;return a||n||l?f("div",{key:"actions-menu",class:T.actionsMenu},n,r,a):null}renderChildList(e,t){var i;const{selectionEnabled:s}=this,{visibilityMode:o,children:n}=e,l=this._hasChildren(e),r=!l&&s&&"group"===(null==(i=e.layer)?void 0:i.type),{exclusive:a,inherited:c}=R,d={[T.listExclusive]:o===a,[T.listInherited]:o===c,[T.listIndependent]:o!==c&&o!==a};return l||r?f("ul",{bind:this,key:"list-items",id:t,"data-group":e.uid,"data-item":e,afterCreate:this._sortNodeCreated,afterUpdate:this._sortNodeCreated,afterRemoved:this._sortNodeRemoved,class:this.classes(T.list,d),"aria-expanded":e.open?"true":"false",role:s?"listbox":o===a?"radiogroup":"group",hidden:!e.open&&!r||null},null==n?void 0:n.map((t=>this.renderItem(t,e))).toArray()):null}renderChildrenToggle(e,t){const{messagesCommon:i}=this,s=this._hasChildren(e),o={[T.childToggleOpen]:e.open},n=e.open?i.collapse:i.expand;return s?f("span",{onclick:this._toggleChildrenClick,onkeydown:this._toggleChildrenClick,"data-item":e,key:"toggle-children",class:this.classes(T.childToggle,o),tabindex:"0",role:"button","aria-controls":t,"aria-label":n,title:n},f("span",{"aria-hidden":"true",class:this.classes(T.childClosed,T.iconRightArrow)}),f("span",{"aria-hidden":"true",class:this.classes(T.childOpened,T.iconDownArrow)}),f("span",{"aria-hidden":"true",class:this.classes(T.childClosed_RTL,T.iconLeftArrow)})):null}renderItemMessage(e){return e.error?f("div",{key:"esri-layer-list__error",class:T.message,role:"alert"},f("span",{"aria-hidden":"true",class:T.iconNoticeTriangle}),this.messages.layerError):e.incompatible?f("div",{key:"esri-layer-list__incompatible",class:T.message,role:"alert"},f("span",{bind:this,tabIndex:0,"aria-hidden":"true",class:T.iconNoticeTriangle,afterCreate:t=>this._setTooltipReference(t,e)}),this.messages.layerIncompatible):null}renderItemContent(e,t,i){const{id:s}=this,o=`${s}_${e.uid}`,n=`${o}_actions`,l=`${o}__list`,{panel:r}=e,a=this._filterActions(e.actionsSections),c=this._countActions(a);return[f("div",{key:"list-item-container",class:T.itemContainer},this.renderChildrenToggle(e,l),this.renderLabel(e,t,i),this.renderActionsMenu(e,a,c,n)),this.renderItemMessage(e),c?this.renderActionsSections(e,a,n):null,r&&r.open?r.render():null,this.renderChildList(e,l)]}renderItem(e,t){const{_newUI:i,id:s,selectionEnabled:o,selectedItems:n,visibleElements:l}=this,r=`${`${s}_${e.uid}`}__title`,a=this._hasMessage(e),c=this._hasChildren(e),d={[T.itemChildren]:c,[T.itemMessage]:!!a,[T.itemUpdating]:e.updating&&!t&&l.statusIndicators,[T.itemInvisible]:i&&!e.visible,[T.itemInvisibleAtScale]:!e.visibleAtCurrentScale,[T.itemSelectable]:o};if(o){var h;const i={[k]:null==(h=e.layer)?void 0:h.uid,[L]:(!e.sortable).toString()};return f("li",{key:`item-with-selection-${e.uid}`,bind:this,afterCreate:this._focusListItem,afterUpdate:this._focusListItem,class:this.classes(T.item,d),"aria-labelledby":r,onclick:this._toggleSelection,onkeydown:this._selectionKeydown,"data-item":e,"data-group":t?t.uid:U,tabIndex:0,"aria-selected":u(e,n)?"true":"false",role:"option",...i},this.renderItemContent(e,t,r))}return f("li",{key:`item-no-selection-${e.uid}`,bind:this,afterCreate:this._focusListItem,afterUpdate:this._focusListItem,class:this.classes(T.item,d),"aria-labelledby":r},this.renderItemContent(e,t,r))}renderItemTitle(e,t){const{messages:i}=this,s=e.title||i.untitledLayer,o=e.visibleAtCurrentScale?s:`${s} (${i.layerInvisibleAtScale})`;return f("span",{key:"layer-title-container",id:t,title:o,"aria-label":o,class:T.title},s)}renderItemToggleIcon(e,t){const{_newUI:i}=this,{exclusive:s}=R,o=t&&t.visibilityMode,n={[T.toggleVisibleIcon]:i,[T.toggleIcon]:i&&o!==s,[T.radioIcon]:i&&o===s,[T.iconRadioSelected]:o===s&&e.visible,[T.iconRadioUnselected]:o===s&&!e.visible,[T.iconVisible]:o!==s&&e.visible,[T.iconInvisible]:o!==s&&!e.visible};return f("span",{key:"item-toggle-icon",class:this.classes(n),"aria-hidden":"true"})}renderItemToggle(e,t,i){const{selectionEnabled:s,messages:o}=this,{exclusive:n}=R,l=t&&t.visibilityMode,r=l===n?"radio":"switch";return f("span",s?{key:"item-toggle-selection-enabled",class:T.toggleVisible,bind:this,onclick:this._toggleVisibility,onkeydown:this._toggleVisibility,"data-item":e,"data-parent-visibility":l,tabIndex:0,title:e.visible?o.hideLayer:o.showLayer,"aria-checked":e.visible?"true":"false",role:r,"aria-labelledby":i}:{key:"item-toggle",class:T.toggleVisible},this.renderItemToggleIcon(e,t))}renderLabel(e,t,i){const{selectionEnabled:s,_newUI:o,messages:n}=this,{inherited:l,exclusive:r}=R,a=null==t?void 0:t.visibilityMode,c=a===r?"radio":"switch",d=[this.renderItemToggle(e,t,i),this.renderItemTitle(e,i)];o&&d.reverse();const h=f("div",s?{key:`item-label-no-selection-${e.uid}`,class:T.label}:{key:`item-label-with-selection-${e.uid}`,class:T.label,bind:this,onclick:this._toggleVisibility,onkeydown:this._toggleVisibility,"data-item":e,"data-parent-visibility":a,tabIndex:0,"aria-checked":e.visible?"true":"false",title:e.visible?n.hideLayer:n.showLayer,role:c,"aria-labelledby":i},d);return a===l||e.error?f("div",{key:`item-label-container-${e.uid}`,class:T.label},this.renderItemTitle(e,i)):h}renderPanelButton(e){const{className:t,open:i,title:s,image:o}=e,n=o||t?t:T.iconDefaultAction,l=this._getIconImageStyles(e),r={[T.actionsMenuItemActive]:i},a={[T.actionImage]:!!l["background-image"]};return n&&(a[n]=!!n),f("div",{key:`panel-${e.uid}`,bind:this,"data-panel":e,onclick:this._triggerPanel,onkeydown:this._triggerPanel,class:this.classes(T.actionsMenuItem,r),role:"button",tabindex:"0",title:s,"aria-label":s},f("span",{class:this.classes(a),styles:l}))}renderActionsSections(e,t,i){const s=t.toArray().map(((t,i)=>f("ul",{key:`${e}-action-section-${i}`,class:T.actionsList},this.renderActionSection(e,t))));return f("div",{role:"group","aria-expanded":e.actionsOpen?"true":"false",key:"actions-section",id:i,class:T.actions,hidden:!e.actionsOpen||null},s)}renderActionSection(e,t){return(t&&t.toArray()).map((t=>this.renderAction({item:e,action:t})))}renderActionIcon(e){const{active:t,className:i}=e,s=this._getIconImageStyles(e),o="button"!==e.type||e.image||i?i:T.iconDefaultAction,n={[T.actionImage]:!t&&!!s["background-image"],[T.iconLoading]:t,[T.rotating]:t};return o&&!t&&(n[o]=!0),f("span",{key:"action-icon","aria-hidden":"true",class:this.classes(T.actionIcon,n),styles:s})}renderActionTitle(e,t){return t?null:f("span",{key:"action-title",class:T.actionTitle},e)}renderAction(e){const{item:t,action:i,singleAction:s}=e,{active:o,disabled:n,title:l}=i,r={[T.actionsMenuItem]:s&&"button"===i.type,[T.action]:o||!s&&"toggle"!==i.type,[T.actionToggle]:!o&&"toggle"===i.type,[T.actionToggleOn]:!o&&"toggle"===i.type&&i.value,[T.disabledElement]:n},a=[this.renderActionIcon(i),this.renderActionTitle(l,s)];return s?f("div",{bind:this,"data-item":t,"data-action":i,role:"button",key:`single-action-${i.uid}`,onclick:this._triggerAction,onkeydown:this._triggerAction,classes:r,tabindex:"0",title:l,"aria-label":l},a):f("li",{bind:this,"data-item":t,"data-action":i,key:`action-${i.uid}`,onclick:this._triggerAction,onkeydown:this._triggerAction,classes:r,tabindex:"0",role:"button",title:l,"aria-label":l},a)}_setTooltipReference(e,t){this._tooltipReferenceMap.set(t.uid,e),this.scheduleRender()}_hasMessage(e){return!!e.error||e.incompatible}_hasChildren(e){return!!e.children.length&&!this._hasMessage(e)}_sortNodeRemoved(e){const{_sortableMap:t}=this,i=e.dataset.group,s=t.get(i);s&&s.destroy(),t.delete(i)}_destroySortables(){const{_sortableMap:e,_sortableNodes:t}=this;e.forEach((e=>e&&e.destroy())),e.clear(),t.clear()}_moveLayerFromChildList({to:e,from:t,item:i,newIndex:s}){const o=i["data-item"],n=e["data-item"],l=t["data-item"];this.viewModel.moveListItem(o,l,n,s)}_sortLayers(e){if(!e)return;const t=e.el["data-item"],i=e.toArray();var s,o;t?_(t,i):p(null==(s=this.view)||null==(o=s.map)?void 0:o.layers,i)}_toggleSorting(e,t){const{_sortableMap:i,selectionEnabled:s}=this,o=i.get(t),n=e["data-item"],l=(t===U||n.childrenSortable&&b(n))&&s;if(o)o.option("disabled",!l);else if(l){const s=A.create(e,{dataIdAttr:k,group:{name:t,pull:this._sortableCanPull,put:this._sortableCanPut},filter:`[${L}="true"]`,fallbackTolerance:4,onSort:this._onSortableSort,onEnd:this._onSortableEnd,disabled:!l,chosenClass:T.sortableChosen});i.set(t,s)}}_toggleAllSorting(){this._sortableNodes.forEach(((e,t)=>this._toggleSorting(e,t)))}_sortNodeCreated(e){const t=e.dataset.group;t&&(this._sortableNodes.set(t,e),this._toggleSorting(e,t))}_setVisibleItems(e){this._tooltipReferenceMap.clear(),this.visibleItems=null==e?void 0:e.filter((e=>this.errorsVisible||!e.error))}_getSingleActionButton(e){return e.reduce((e=>e)).filter((e=>e&&"button"===e.type)).getItemAt(0)}_focusListItem(e){var t;const{_focusSortUid:i}=this;if(!e||!i)return;(null==(t=e["data-item"].layer)?void 0:t.uid)===i&&(e.focus(),this._focusSortUid=null)}_watchActionSectionChanges(e,t){const i=E.actionSection+t;this._handles.add(e.on("change",this.scheduleRender.bind(this)),i),e.forEach((e=>this._renderOnActionChanges(e,t)))}_renderOnActionChanges(e,t){const i=E.actions+t;"toggle"!==e.type?"slider"!==e.type?this._handles.add([l(e,["className","image","id","title","visible"],(()=>this.scheduleRender()))],i):this._handles.add([l(e,["className","id","title","visible","value","displayValueEnabled","max","min","step"],(()=>this.scheduleRender()))],i):this._handles.add([l(e,["className","image","id","title","visible","value"],(()=>this.scheduleRender()))],i)}_renderOnItemChanges(e){const t=e.uid,i=E.items+t;this._handles.add([l(e,["actionsOpen","visible","open","updating","title","visibleAtCurrentScale","error","visibilityMode","panel","panel.title","panel.content","panel.className","sortable","childrenSortable"],(()=>this.scheduleRender())),e.actionsSections.on("change",(()=>this.scheduleRender())),e.children.on("change",(()=>this.scheduleRender()))],i),e.children.forEach((e=>this._renderOnItemChanges(e))),e.actionsSections.forEach((e=>this._watchActionSectionChanges(e,t)))}_itemsChanged(e){this._handles.removeAll(),e.forEach((e=>this._renderOnItemChanges(e))),this._setVisibleItems(e),this.scheduleRender()}_filterActions(e){return e.map((e=>e.filter((e=>e.visible))))}_countActions(e){return e.reduce(((e,t)=>e+t.length),0)}_getIconImageStyles(e){const t="esri.widgets.LayerList.ListItemPanel"===e.declaredClass||"esri.support.Action.ActionButton"===e.declaredClass||"esri.support.Action.ActionToggle"===e.declaredClass?e.image:null;return{"background-image":t?`url("${t}")`:null}}_selectionKeydown(e){const t=["ArrowDown","ArrowUp"],s=i(e);if(!t.includes(s))return void this._toggleSelection(e);e.stopPropagation();const o=e.currentTarget,n=o["data-item"],{_sortableMap:l,selectedItems:r}=this,a=o.dataset.group,c=l.get(a);if(!c)return;const d=u(n,r),h=c.toArray(),m=e.target,g=h.indexOf(m.dataset[M]);if(-1!==g){if("ArrowDown"===s){const e=g+1;if(e>=h.length)return;var p,_;if(d)w(h,g,e),c.sort(h),this._sortLayers(c),this._focusSortUid=null==(p=n.layer)?void 0:p.uid;else this._focusSortUid=null==(_=n.layer)?void 0:_.uid,this.scheduleRender()}if("ArrowUp"===s){const e=g-1;if(e<=-1)return;var b,y;if(d)w(h,g,e),c.sort(h),this._sortLayers(c),this._focusSortUid=null==(b=n.layer)?void 0:b.uid;else this._focusSortUid=null==(y=n.layer)?void 0:y.uid,this.scheduleRender()}}}_toggleActionsOpen(e){const t=e.currentTarget["data-item"],{actionsOpen:i}=t,s=!i;s&&this.operationalItems.forEach((e=>x(e))),t.actionsOpen=s,e.stopPropagation()}_triggerPanel(e){const t=e.currentTarget["data-panel"];t&&(t.open=!t.open),e.stopPropagation()}_triggerAction(e){const t=e.currentTarget,i=t["data-action"],s=t["data-item"];"toggle"===i.type&&(i.value=!i.value),this.triggerAction(i,s),e.stopPropagation()}_toggleVisibility(e){const t=e.currentTarget,i=t.getAttribute("data-parent-visibility"),s=t["data-item"];i===R.exclusive&&s.visible||(s.visible=!s.visible),e.stopPropagation()}_toggleChildrenClick(e){const t=e.currentTarget["data-item"];t.open=!t.open,e.stopPropagation()}_toggleSelection(e){e.stopPropagation();const{multipleSelectionEnabled:t,selectedItems:i}=this,s=e.currentTarget["data-item"],o=u(s,i),{length:n}=i;if(!t)return n&&!(o&&1===n)?(i.removeAll(),void i.add(s)):void(o?null==i.remove||i.remove(o):i.add(s));o?null==i.remove||i.remove(o):i.add(s)}};e([c()],N.prototype,"visibleItems",void 0),e([c()],N.prototype,"iconClass",void 0),e([c()],N.prototype,"errorsVisible",void 0),e([c({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],N.prototype,"label",void 0),e([c()],N.prototype,"listItemCanGiveFunction",void 0),e([c()],N.prototype,"listItemCanReceiveFunction",void 0),e([r("viewModel.listItemCreatedFunction")],N.prototype,"listItemCreatedFunction",void 0),e([c(),v("esri/widgets/LayerList/t9n/LayerList")],N.prototype,"messages",void 0),e([c(),v("esri/t9n/common")],N.prototype,"messagesCommon",void 0),e([c()],N.prototype,"multipleSelectionEnabled",void 0),e([r("viewModel.operationalItems")],N.prototype,"operationalItems",void 0),e([c()],N.prototype,"selectionEnabled",void 0),e([c()],N.prototype,"selectedItems",void 0),e([r("viewModel.view")],N.prototype,"view",void 0),e([I("trigger-action"),c({type:m})],N.prototype,"viewModel",void 0),e([c()],N.prototype,"visibleElements",void 0),e([a("visibleElements")],N.prototype,"castVisibleElements",null),e([r("viewModel.triggerAction")],N.prototype,"triggerAction",null),e([y()],N.prototype,"_toggleActionsOpen",null),e([y()],N.prototype,"_triggerPanel",null),e([y()],N.prototype,"_triggerAction",null),e([y()],N.prototype,"_toggleVisibility",null),e([y()],N.prototype,"_toggleChildrenClick",null),e([y()],N.prototype,"_toggleSelection",null),N=e([d("esri.widgets.LayerList")],N);const j=N;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"../../intl.js";import i from"../../core/Accessor.js";import r from"../../core/Collection.js";import
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import"../../intl.js";import i from"../../core/Accessor.js";import r from"../../core/Collection.js";import s from"../../core/Handles.js";import{init as t,watch as a,whenTrue as n}from"../../core/watchUtils.js";import{property as l}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";import y from"./support/ActiveLayerInfo.js";import{onLocaleChange as d}from"../../intl/locale.js";const h={state:"state",view:"view",allLayerViews:"all-layer-views",legendProperties:"legend-properties"},c=r.ofType(y),L=["esri.layers.BuildingSceneLayer","esri.layers.CSVLayer","esri.layers.FeatureLayer","esri.layers.GeoJSONLayer","esri.layers.GeoRSSLayer","esri.layers.GroupLayer","esri.layers.HeatmapLayer","esri.layers.ImageryLayer","esri.layers.ImageryTileLayer","esri.layers.MapImageLayer","esri.layers.OGCFeatureLayer","esri.layers.PointCloudLayer","esri.layers.StreamLayer","esri.layers.SceneLayer","esri.layers.TileLayer","esri.layers.VoxelLayer","esri.layers.WFSLayer","esri.layers.WMSLayer","esri.layers.WMTSLayer","esri.layers.WCSLayer"],_="view.basemapView.baseLayerViews",f="view.groundView.layerViews",v="view.basemapView.referenceLayerViews",u=[_,f,"view.layerViews",v];let p=class extends i{constructor(e){super(e),this._handles=new s,this._layerViewByLayerId={},this._layerInfosByLayerViewId={},this._activeLayerInfosByLayerViewId={},this._activeLayerInfosWithNoParent=new r,this.activeLayerInfos=new c,this.basemapLegendVisible=!1,this.groundLegendVisible=!1,this.hideLayersNotInCurrentView=!1,this.keepCacheOnDestroy=!1,this.respectLayerVisibility=!0,this.layerInfos=[],this.view=null}initialize(){this._handles.add(t(this,"view",this._viewHandles),h.view),this._handles.add(d((()=>this._refresh())))}destroy(){this._destroyViewActiveLayerInfos(),this._handles.destroy(),this._handles=null,this.view=null}get state(){return this.get("view.ready")?"ready":"disabled"}_viewHandles(){this._handles.remove(h.state),this.view&&this._handles.add(t(this,"state",this._stateHandles),h.state)}_stateHandles(){this._resetAll(),"ready"===this.state&&this._watchPropertiesAndAllLayerViews()}_resetAll(){this._handles.remove([h.allLayerViews,h.legendProperties]),this._destroyViewActiveLayerInfos(),this.activeLayerInfos.removeAll()}_destroyViewActiveLayerInfos(){Object.keys(this._activeLayerInfosByLayerViewId).forEach(this._destroyViewActiveLayerInfo,this)}_destroyViewActiveLayerInfo(e){this._handles.remove(e);const i=this._activeLayerInfosByLayerViewId[e];delete this._activeLayerInfosByLayerViewId[e],i&&i.parent&&i.parent.children.remove(i)}_watchPropertiesAndAllLayerViews(){const{allLayerViews:e}=this.view;e.length&&this._refresh(),this._handles.add(e.on("change",this._allLayerViewsChangeHandle.bind(this)),h.allLayerViews),this._handles.add(a(this,"layerInfos, basemapLegendVisible, groundLegendVisible",this._propertiesChangeHandle.bind(this)),h.legendProperties)}_allLayerViewsChangeHandle(e){e.removed.forEach((e=>this._destroyViewActiveLayerInfo(e.uid))),this._refresh()}_propertiesChangeHandle(){this._destroyViewActiveLayerInfos(),this._refresh()}_refresh(){this._layerInfosByLayerViewId={},this.activeLayerInfos.removeAll(),this._generateLayerViews().filter(this._filterLayerViewsByLayerInfos,this).filter(this._isLayerViewSupported,this).forEach(this._generateActiveLayerInfo,this),this._sortActiveLayerInfos(this.activeLayerInfos)}_sortActiveLayerInfos(e){if(e.length<2)return;const i=[];e.forEach((r=>{if(!r.parent){const s=r.layer.parent,t=s&&"uid"in s&&this._layerViewByLayerId[s.uid],a=t&&this._activeLayerInfosByLayerViewId[t.uid];a&&e.includes(a)&&(i.push(r),r.parent=a,a.children.add(r),this._sortActiveLayerInfos(a.children))}})),e.removeMany(i);const r={};this.view.allLayerViews.forEach(((e,i)=>r[e.layer.uid]=i)),e.sort(((e,i)=>{const s=r[e.layer.uid]||0;return(r[i.layer.uid]||0)-s}))}_generateLayerViews(){const e=[];return u.filter(this._filterLayerViews,this).map(this.get,this).filter((e=>null!=e)).forEach(this._collectLayerViews("layerViews",e)),e}_filterLayerViews(e){const i=!this.basemapLegendVisible&&(e===_||e===v),r=!this.groundLegendVisible&&e===f;return!i&&!r}_collectLayerViews(e,i){const r=s=>(s&&s.forEach((s=>{i.push(s),r(s[e])})),i);return r}_filterLayerViewsByLayerInfos(e){const i=this.layerInfos;return!i||!i.length||i.some((i=>this._hasLayerInfo(i,e)))}_hasLayerInfo(e,i){const r=this._isLayerUIDMatching(e.layer,i.layer.uid);return r&&(this._layerInfosByLayerViewId[i.uid]=e),r}_isLayerUIDMatching(e,i){return e&&(e.uid===i||this._hasLayerUID(e.layers,i))}_hasLayerUID(e,i){return e&&e.some((e=>this._isLayerUIDMatching(e,i)))}_isLayerViewSupported(e){return!!L.includes(e.layer.declaredClass)&&(this._layerViewByLayerId[e.layer.uid]=e,!0)}_generateActiveLayerInfo(e){this._isLayerActive(e)?this._buildActiveLayerInfo(e):(this._handles.remove(e.uid),this._handles.add(a(e,"legendEnabled, layer.legendEnabled",(()=>this._layerActiveHandle(e))),e.uid))}_layerActiveHandle(e){this._isLayerActive(e)&&(this._handles.remove(e.uid),this._buildActiveLayerInfo(e))}_isLayerActive(e){return!this.respectLayerVisibility||e.legendEnabled&&e.get("layer.legendEnabled")}_buildActiveLayerInfo(e){var i;const r=e.layer,s=e.uid,t=this._layerInfosByLayerViewId[s];let l=this._activeLayerInfosByLayerViewId[s];if(!l){const i=t&&void 0!==t.title&&t.layer.uid===r.uid;l=new y({layer:r,layerView:e,title:i?t.title:r.title,view:this.view,respectLayerVisibility:this.respectLayerVisibility,hideLayersNotInCurrentView:this.hideLayersNotInCurrentView,keepCacheOnDestroy:this.keepCacheOnDestroy,sublayerIds:t&&t.sublayerIds||[]}),this._activeLayerInfosByLayerViewId[s]=l}const o=r.parent&&"uid"in r.parent&&this._layerViewByLayerId[null==(i=r.parent)?void 0:i.uid];if(l.parent=this._activeLayerInfosByLayerViewId[null==o?void 0:o.uid],!this._handles.has(s)){const i=[a(r,"title",(e=>this._titleHandle(e,l))),a(r,"renderer?, opacity, pointSymbol?, lineSymbol?, polygonSymbol?",(()=>this._constructLegendElements(l))),n(this.view,"stationary",(()=>this._scaleHandle(l))),a(e,"_effectiveRenderer",(()=>this._constructLegendElements(l))),a(r,"effect",(()=>this._constructLegendElements(l)))];if(this.respectLayerVisibility){const s=a(e,"legendEnabled",(e=>this._legendEnabledHandle(e,l))),t=a(r,"legendEnabled",(e=>this._legendEnabledHandle(e,l)));i.push(s,t)}this._handles.add(i,s)}l.isScaleDriven||this._constructLegendElements(l),this._addActiveLayerInfo(l)}_titleHandle(e,i){i.title=e,this._constructLegendElements(i)}_legendEnabledHandle(e,i){e?this._addActiveLayerInfo(i):this._removeActiveLayerInfo(i)}_scaleHandle(e){(e.isScaleDriven||e.hideLayersNotInCurrentView)&&this._constructLegendElements(e)}_addActiveLayerInfo(e){const{layerView:i,layer:r}=e;if(this._isLayerActive(i)&&!this.activeLayerInfos.includes(e)){const i=e.parent;if(i)i.children.includes(e)||i.children.push(e),this._sortActiveLayerInfos(i.children);else{var s;const i=null==(s=this.layerInfos)?void 0:s.some((e=>e.layer.uid===r.uid));r.parent&&"uid"in r.parent&&!i?this._activeLayerInfosWithNoParent.add(e):(this.activeLayerInfos.add(e),this._sortActiveLayerInfos(this.activeLayerInfos))}if(this._activeLayerInfosWithNoParent.length){const e=[];this._activeLayerInfosWithNoParent.forEach((i=>{const r=i.layer.parent,s=r&&"uid"in r&&this._layerViewByLayerId[null==r?void 0:r.uid],t=this._activeLayerInfosByLayerViewId[null==s?void 0:s.uid];t&&(e.push(i),i.parent=t)})),e.length&&(this._activeLayerInfosWithNoParent.removeMany(e),e.forEach((e=>this._addActiveLayerInfo(e))))}}}_removeActiveLayerInfo(e){const i=e.parent;i?i.children.remove(e):this.activeLayerInfos.remove(e)}_constructLegendElements(e){const i=e.layer;"featureCollections"in i&&i.featureCollections?e.buildLegendElementsForFeatureCollections(i.featureCollections):"renderer"in i&&i.renderer?e.buildLegendElementsForRenderer(i.renderer):"url"in i&&i.url?e.buildLegendElementsForTools():e.children.forEach((e=>this._constructLegendElements(e)))}};e([l({type:c})],p.prototype,"activeLayerInfos",void 0),e([l()],p.prototype,"basemapLegendVisible",void 0),e([l()],p.prototype,"groundLegendVisible",void 0),e([l()],p.prototype,"hideLayersNotInCurrentView",void 0),e([l()],p.prototype,"keepCacheOnDestroy",void 0),e([l()],p.prototype,"respectLayerVisibility",void 0),e([l()],p.prototype,"layerInfos",void 0),e([l({readOnly:!0})],p.prototype,"state",null),e([l()],p.prototype,"view",void 0),p=e([o("esri.widgets.Legend.LegendViewModel")],p);const I=p;export{I 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"../../../intl.js";import t from"../../../core/Handles.js";import{pt2px as s}from"../../../core/screenUtils.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as r}from"../../../core/accessorSupport/decorators/subclass.js";import{renderSVG as a}from"../../../symbols/support/svgUtils.js";import{getCSSFilterFromEffectList as o}from"../../../symbols/support/utils.js";import l from"../../Widget.js";import{renderRelationshipRamp as n}from"./support/relationshipUtils.js";import{getUnivariateAboveAndBelowRampElements as c,getUnivariateSizeRampSize as d,getUnivariateColorRampSize as p,getUnivariateColorRampPreview as m,getUnivariateColorRampMargin as h,getUnivariateColorSizeRampElements as y}from"./support/univariateUtils.js";import{getTitle as g,attachToNode as _,isImageryStretchedLegend as v}from"../support/styleUtils.js";import{Heading as u,incrementHeadingLevel as f}from"../../support/Heading.js";import{accessibleHandler as b}from"../../support/decorators/accessibleHandler.js";import{messageBundle as w}from"../../support/decorators/messageBundle.js";import"../../../core/Logger.js";import{tsx as L}from"../../support/jsxFactory.js";import{isRTL as C}from"../../support/widgetUtils.js";import{substitute as x}from"../../../intl/substitute.js";const S={activated:"esri-legend--card__carousel-indicator--activated",base:"esri-legend--card",stacked:"esri-legend--stacked",carouselTitle:"esri-legend--card__carousel-title",indicator:"esri-legend--card__carousel-indicator",intervalSeparator:"esri-legend--card__interval-separator",imageryLayerStretchedImage:"esri-legend--card__imagery-layer-image--stretched",imageLabel:"esri-legend--card__image-label",layerCaption:"esri-legend--card__layer-caption",labelElement:"esri-legend--card__label-element",layerRow:"esri-legend--card__layer-row",labelCell:"esri-legend--card__label-cell",message:"esri-legend--card__message",rampLabel:"esri-legend--card__ramp-label",section:"esri-legend--card__section",relationshipSection:"esri-legend--card__relationship-section",serviceCaptionText:"esri-legend--card__service-caption-text",serviceContent:"esri-legend--card__service-content",service:"esri-legend--card__service",groupLayer:"esri-legend--card__group-layer",groupLayerChild:"esri-legend--card__group-layer-child",symbol:"esri-legend--card__symbol",sizeRampRow:"esri-legend--card__size-ramp-row",symbolRow:"esri-legend--card__symbol-row",symbolCell:"esri-legend--card__symbol-cell",indicatorContainer:"esri-legend--card__carousel-indicator-container",intervalSeparatorsContainer:"esri-legend--card__interval-separators-container",relationshipLabelContainer:"esri-legend--card__relationship-label-container",labelContainer:"esri-legend--card__label-container",serviceCaptionContainer:"esri-legend--card__service-caption-container",symbolContainer:"esri-legend--card__symbol-container",sizeRampContainer:"esri-legend--card__size-ramp-container",sizeRampPreview:"esri-legend--card__size-ramp-preview",rampContainer:"esri-legend__ramps",sizeRampHorizontal:"esri-legend__size-ramp--horizontal",rampLabelsContainer:"esri-legend__ramp-labels",layerInfo:"esri-legend__layer-cell esri-legend__layer-cell--info",univariateAboveAndBelowColorRamp:"esri-univariate-above-and-below-ramp__color--card",hidden:"esri-hidden"},R=25,z=25,$=768,I=100;var k;!function(e){e.Auto="auto",e.Stack="stack",e.SideBySide="side-by-side"}(k||(k={}));const A="#ddd",N=window.devicePixelRatio;function j(e){if(e){if(e.type.indexOf("3d")>-1){const t=e.symbolLayers&&e.symbolLayers.length;if(!t)return;const s=e.symbolLayers.getItemAt(t-1),i=s.resource&&s.resource.primitive;return"circle"===i||"cross"===i||"kite"===i||"sphere"===i||"cube"===i||"diamond"===i}{const t=e.style;return"circle"===t||"diamond"===t||"cross"===t}}}function E(e){if(e){if(e.type.indexOf("3d")>-1){const t=e.symbolLayers&&e.symbolLayers.length;if(!t)return;const s=e.symbolLayers.getItemAt(t-1).get("resource.primitive");return"triangle"===s||"cone"===s||"tetrahedron"===s}return"triangle"===e.style}}let F=class extends l{constructor(e,s){super(e,s),this._handles=new t,this._hasIndicators=!1,this._selectedSectionName=null,this._sectionNames=[],this._sectionMap=new Map,this.activeLayerInfos=null,this.headingLevel=3,this.layout=k.Stack,this.messages=null,this.messagesCommon=null,this.type="card",this.view=null}initialize(){this.own([this.watch("activeLayerInfos",(e=>{this._handles.removeAll(),this._watchForSectionChanges(e)}))])}destroy(){this._handles.destroy(),this._handles=null}render(){this._hasIndicators=this.layout===k.Auto&&this.view.container.clientWidth<=$||this.layout===k.Stack;const e=this.activeLayerInfos,t=e&&e.toArray().map((e=>this._renderLegendForLayer(e))).filter((e=>!!e));this._hasIndicators?this._selectedSectionName&&-1!==this._sectionNames.indexOf(this._selectedSectionName)||(this._selectedSectionName=this._sectionNames&&this._sectionNames[0]):this._selectedSectionName=null;const s=this._sectionNames.length,i=this._sectionNames.map(((e,t)=>{const i=x(this.messagesCommon.pagination.pageText,{index:t+1,total:s});return L("div",{key:e,role:"tab",id:e,"aria-label":i,"aria-controls":`${e}-panel`,"aria-selected":(this._selectedSectionName===e).toString(),tabIndex:this._selectedSectionName===e?0:-1,title:i,onclick:this._selectSection,onkeydown:this._focusSection,bind:this,class:this.classes(S.indicator,{[S.activated]:this._selectedSectionName===e}),"data-section-name":e})})),r=this._hasIndicators&&s>1?L("div",{class:S.indicatorContainer,key:"carousel-navigation",role:"tablist"},i):null,a=this._hasIndicators?this._sectionMap.get(this._selectedSectionName):t&&t.length?t:null,o={[S.stacked]:this._hasIndicators};return L("div",{class:this.classes(S.base,o)},a||L("div",{class:S.message},this.messages.noLegend),r)}_selectSection(e){const t=e.target.getAttribute("data-section-name");t&&(this._selectedSectionName=t)}_focusSection(e){switch(e.key){case"ArrowLeft":case"ArrowRight":this._switchSectionOnArrowPress(e);break;case"Enter":case" ":this._selectSection(e)}}_switchSectionOnArrowPress(e){const t=e.key,s="ArrowLeft"===t?-1:1,i=e.target.getAttribute("data-section-name"),r=this._sectionNames.indexOf(i),a=this._sectionNames;let o=null;-1!==r&&(a[r+s]?o=document.getElementById(a[r+s]):"ArrowLeft"===t?o=document.getElementById(a[a.length-1]):"ArrowRight"===t&&(o=document.getElementById(a[0])),o&&o.focus())}_watchForSectionChanges(e){if(this._generateSectionNames(),e){e.forEach((e=>{const t=`activeLayerInfo-${e.layer.uid}-version-change`;this._handles.remove(t),this._watchForSectionChanges(e.children),this._handles.add(e.watch("version",(()=>this._generateSectionNames())),t)}));const t="activeLayerInfos-collection-change";this._handles.remove(t),this._handles.add(e.on("change",(()=>this._watchForSectionChanges(e))),t)}}_generateSectionNames(){this._sectionNames.length=0,this._selectedSectionName=null,this.activeLayerInfos&&this.activeLayerInfos.forEach(this._generateSectionNamesForActiveLayerInfo,this)}_getSectionName(e,t,s){return`${this.id}${e.uid}-type-${t.type}-${s}`}_generateSectionNamesForActiveLayerInfo(e){e.children.forEach(this._generateSectionNamesForActiveLayerInfo,this),e.legendElements&&e.legendElements.forEach(((t,s)=>{this._sectionNames.push(this._getSectionName(e.layer,t,s))}))}_renderLegendForLayer(e){if(!e.ready)return null;if(e.children.length){const t=e.children.map((e=>this._renderLegendForLayer(e))).toArray();return L("div",{key:e.layer.uid,class:this.classes(S.service,S.groupLayer)},L("div",{class:S.serviceCaptionContainer},e.title),t)}{const t=e.legendElements;if(t&&!t.length)return null;const s=t.some((e=>"relationship-ramp"===e.type)),i=t.map(((t,i)=>this._renderLegendForElement(t,e,i,s))).filter((e=>!!e));if(!i.length)return null;const r={[S.groupLayerChild]:!!e.parent};return L("div",{key:e.layer.uid,class:this.classes(S.service,r)},L("div",{class:S.serviceCaptionContainer},L("div",{class:S.serviceCaptionText},e.title)),L("div",{class:S.serviceContent},i))}}_renderLegendForElement(e,t,s,i=!1){const r="color-ramp"===e.type,a="opacity-ramp"===e.type,o="size-ramp"===e.type,l=t.layer;let c=null;if("string"==typeof e.title)c=e.title;else if(e.title){const t=e.title,s=g(this.messages,t,r||a);c=t.title?`${t.title} (${s})`:s}const d=this._getSectionName(l,e,s),p=this._hasIndicators?L("div",null,L(u,{level:this.headingLevel,class:S.carouselTitle},t.title),L(u,{level:f(this.headingLevel),class:S.layerCaption},c)):c?L(u,{level:this.headingLevel,class:S.layerCaption},c):null,m=t.effectList;let h=null;if("symbol-table"===e.type){const s=e.infos.map(((s,i)=>this._renderLegendForElementInfo(s,t,e.legendType,i))).filter((e=>!!e));if(s.length){const e=s[0].properties.classes&&s[0].properties.classes[S.symbolRow],t={[S.labelContainer]:!e&&!i,[S.relationshipLabelContainer]:i};h=L("div",{class:this.classes(t)},s)}}else"color-ramp"===e.type||"opacity-ramp"===e.type||"heatmap-ramp"===e.type?h=this._renderLegendForRamp(e,l.opacity,m):o?h=this._renderSizeRamp(e,l.opacity):"relationship-ramp"===e.type?h=n(e,this.id,l.opacity,m):"univariate-above-and-below-ramp"===e.type?h=this._renderUnivariateAboveAndBelowRamp(e,l.opacity,m):"univariate-color-size-ramp"===e.type&&(h=this._renderUnivariateColorSizeRamp(e,l.opacity,m));if(!h)return null;const y=L("div",{key:d,class:S.section,id:`${d}-panel`,role:"tabpanel","aria-labelledby":d,tabIndex:0},[p,h]);return this._sectionMap.set(d,y),y}_renderUnivariateAboveAndBelowRamp(e,t,s){const{sizeRampElement:i,colorRampElement:r}=c(e,t,"horizontal");if(!i)return null;const a=d(i,"full",!0,"horizontal"),o=p(i,"above",!0,"horizontal"),l=p(i,"below",!0,"horizontal"),n=12,y=m(r,{width:o,height:n,rampAlignment:"horizontal",opacity:t,type:"above",effectList:s}),g=m(r,{width:l,height:n,rampAlignment:"horizontal",opacity:t,type:"below",effectList:s}),v=h(i,"card"),u=i.infos.map((e=>e.label)),f=u.length-1,b=u.map(((e,t)=>0===t||t===f?L("div",{key:t},e):null)),w={display:"flex",flexDirection:"column"},x={display:"flex",flexDirection:"row"},R={marginTop:"3px",display:"flex"};C(this.container)?R.marginRight=`${v}px`:R.marginLeft=`${v}px`;const z={width:`${a}px`,display:"flex",flexDirection:"row",justifyContent:"space-between"};return L("div",{class:S.layerRow,key:"size-ramp-preview",styles:w},L("div",{class:this.classes(S.symbolContainer,S.sizeRampHorizontal),styles:x},i.infos.map(((e,t)=>L("div",{key:t,class:S.symbol,bind:e.preview,afterCreate:_})))),y?L("div",{class:S.univariateAboveAndBelowColorRamp,styles:R,key:"color-ramp-preview"},L("div",{bind:y,afterCreate:_}),L("div",{bind:g,afterCreate:_})):null,L("div",{class:S.layerInfo},L("div",{class:S.rampLabelsContainer,styles:z},b)))}_renderUnivariateColorSizeRamp(e,t,s){const{sizeRampElement:i,colorRampElement:r}=y(e,"horizontal");if(!i)return null;const a=d(i,"full",!1,"horizontal"),o=p(i,"full",!1,"horizontal"),l=m(r,{width:o,height:12,rampAlignment:"horizontal",opacity:t,type:"full",effectList:s}),n=h(i,"card"),c=i.infos.length-1,g=i.infos.map(((e,t)=>0===t||t===c?L("div",{key:t},e.label):null)),v={display:"flex",flexDirection:"column"},u={display:"flex",flexDirection:"row"},f={marginTop:"3px",display:"flex"};C(this.container)?f.marginRight=`${n}px`:f.marginLeft=`${n}px`;const b={width:`${a}px`,display:"flex",flexDirection:"row",justifyContent:"space-between"};return L("div",{class:S.layerRow,key:"size-ramp-preview",styles:v},L("div",{class:this.classes(S.symbolContainer,S.sizeRampHorizontal),styles:u},i.infos.map(((e,t)=>L("div",{key:t,class:S.symbol,bind:e.preview,afterCreate:_})))),L("div",{class:S.univariateAboveAndBelowColorRamp,styles:f,key:"color-ramp-preview"},L("div",{bind:l,afterCreate:_})),L("div",{class:S.layerInfo},L("div",{class:S.rampLabelsContainer,styles:b},g)))}_renderLegendForElementInfo(e,t,s,i){const r=t.layer;if(e.type)return this._renderLegendForElement(e,t,i);const a=v(r,s);if(e.preview){var l,n;if(!e.symbol||-1===e.symbol.type.indexOf("simple-fill")){if(!e.label)return L("div",{key:i,bind:e.preview,afterCreate:_});const t={[S.symbolCell]:this._hasIndicators};return L("div",{key:i,class:this.classes(S.layerRow,{[S.symbolRow]:this._hasIndicators})},L("div",{class:this.classes(t),bind:e.preview,afterCreate:_}),L("div",{class:this.classes(S.imageLabel,{[S.labelCell]:this._hasIndicators})},g(this.messages,e.label,!1)||""))}let s=255,a=255,c=255,d=0,p=255,m=255,h=255,y=0;const v=e.symbol.color&&e.symbol.color.a,u=e.symbol.outline&&e.symbol.outline.color&&e.symbol.outline.color.a;v&&(s=e.symbol.color.r,a=e.symbol.color.g,c=e.symbol.color.b,d=e.symbol.color.a*r.opacity),u&&(p=e.symbol.outline.color.r,m=e.symbol.outline.color.g,h=e.symbol.outline.color.b,y=e.symbol.outline.color.a*r.opacity);const f=null==(l=null==(n=e.symbol.color)?void 0:n.isBright)||l,b=f?"rgba(255, 255, 255, .6)":"rgba(0, 0, 0, .6)",w={background:v?`rgba(${s}, ${a}, ${c}, ${d})`:"none",color:f?"black":"white",textShadow:`-1px -1px 0 ${b},\n 1px -1px 0 ${b},\n -1px 1px 0 ${b},\n 1px 1px 0 ${b}`,border:u?`1px solid rgba(${p}, ${m}, ${h}, ${y})`:"none",filter:o(t.effectList)};return L("div",{key:i,class:S.layerRow},L("div",{class:S.labelElement,styles:w}," ",e.label," "))}if(e.src){const t=this._renderImage(e,r,a);return L("div",{key:i,class:S.layerRow},t,L("div",{class:S.imageLabel},e.label||""))}}_renderImage(e,t,s){const{label:i,src:r,opacity:a}=e,o={[S.imageryLayerStretchedImage]:s,[S.symbol]:!s},l={opacity:`${null!=a?a:t.opacity}`};return L("img",{alt:g(this.messages,i,!1),src:r,border:0,width:e.width,height:e.height,class:this.classes(o),styles:l})}_renderSizeRampLines(e){const t=e.infos,i=t[0],r=t[t.length-1],a=i.symbol,o=this._hasIndicators,l=s(i.size+i.outlineSize)*N,n=s(r.size+r.outlineSize)*N,c=o?l:l+50*N,d=o?l/2+50*N:l,p=E(a),m=j(a),h=document.createElement("canvas");h.width=c,h.height=d,h.style.width=h.width/N+"px",h.style.height=h.height/N+"px";const y=h.getContext("2d");if(o){y.beginPath();const e=0,t=0,s=c/2-n/2,i=d;y.moveTo(e,t),y.lineTo(s,i);const r=c,a=0,o=c/2+n/2,l=d;y.moveTo(r,a),y.lineTo(o,l)}else{y.beginPath();const e=0,t=d/2-n/2,s=c,i=0;y.moveTo(e,t),y.lineTo(s,i);const r=0,a=d/2+n/2,o=c,l=d;y.moveTo(r,a),y.lineTo(o,l)}return y.strokeStyle=A,y.stroke(),L("div",{bind:h,afterCreate:_,styles:o?{display:"flex",marginTop:`-${p?0:m?l/2:0}px`,marginBottom:`-${p?n:m?n/2:0}px`}:{display:"flex",marginRight:`-${p?0:m?l/2:0}px`,marginLeft:`-${p?0:m?n/2:0}px`}})}_renderSizeRamp(e,t){const s=e.infos,i=s[0].label,r=s[s.length-1].label;let a=s[0].preview,o=s[s.length-1].preview;const l=this._hasIndicators,n={"flex-direction":l?"column":"row-reverse"};a&&(a=a.cloneNode(!0),a.style.display="flex"),o&&(o=o.cloneNode(!0),o.style.display="flex");const c={opacity:null!=t?`${t}`:""};return L("div",{class:this.classes(S.layerRow,{[S.sizeRampRow]:l})},L("div",{class:S.rampLabel},l?i:r),L("div",{class:S.sizeRampContainer,styles:n},L("div",{bind:a,afterCreate:_,class:S.sizeRampPreview,styles:c}),this._renderSizeRampLines(e),L("div",{bind:o,afterCreate:_,class:S.sizeRampContainer,styles:c})),L("div",{class:S.rampLabel},l?r:i))}_renderLegendForRamp(e,t,s){const i=e.infos,r="heatmap-ramp"===e.type,l=i.length-1,n=z,c=l>2&&!r?R*l:I,d=c+20,p=10,m=i.slice(0).reverse();m.forEach(((e,t)=>{e.offset=r?e.ratio:t/l}));const h=m.length-1,y=m.length%2!=0&&m[m.length/2|0],g=y&&L("div",{class:S.intervalSeparatorsContainer},L("div",{class:S.intervalSeparator},"|"),L("div",{class:S.rampLabel},y.label)),_=i[i.length-1].label,v=i[0].label,u=[[{shape:{type:"path",path:`M0 ${n/2} L${p} 0 L${p} ${n} Z`},fill:m[0].color,stroke:{width:0}},{shape:{type:"rect",x:p,y:0,width:c,height:n},fill:{type:"linear",x1:p,y1:0,x2:c+p,y2:0,colors:m},stroke:{width:0}},{shape:{type:"path",path:`M${c+p} 0 L${d} ${n/2} L${c+p} ${n} Z`},fill:m[h].color,stroke:{width:0}}]],f=a(u,d,n),{messages:b}=this,w={filter:o(s),opacity:null==t?null:`${t}`},C={justifyContent:"center"};return L("div",{class:S.layerRow,styles:C},L("div",{class:S.rampLabel},r?b[_]:_),L("div",{class:S.symbolContainer},L("div",{styles:w},f),g),L("div",{class:S.rampLabel},r?b[v]:v))}};e([i()],F.prototype,"activeLayerInfos",void 0),e([i()],F.prototype,"headingLevel",void 0),e([i()],F.prototype,"layout",void 0),e([i(),w("esri/widgets/Legend/t9n/Legend")],F.prototype,"messages",void 0),e([i(),w("esri/t9n/common")],F.prototype,"messagesCommon",void 0),e([i({readOnly:!0})],F.prototype,"type",void 0),e([i()],F.prototype,"view",void 0),e([b()],F.prototype,"_selectSection",null),F=e([r("esri.widgets.Legend.styles.Card")],F);const T=F;export{T as default};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../intl.js";import t from"../../../core/Handles.js";import{pt2px as s}from"../../../core/screenUtils.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as r}from"../../../core/accessorSupport/decorators/subclass.js";import{renderSVG as a}from"../../../symbols/support/svgUtils.js";import{getCSSFilterFromEffectList as o}from"../../../symbols/support/utils.js";import l from"../../Widget.js";import{renderRelationshipRamp as n}from"./support/relationshipUtils.js";import{getUnivariateAboveAndBelowRampElements as c,getUnivariateSizeRampSize as d,getUnivariateColorRampSize as p,getUnivariateColorRampPreview as m,getUnivariateColorRampMargin as h,getUnivariateColorSizeRampElements as y}from"./support/univariateUtils.js";import{getTitle as g,attachToNode as _,isImageryStretchedLegend as v}from"../support/styleUtils.js";import{Heading as u,incrementHeadingLevel as f}from"../../support/Heading.js";import{accessibleHandler as b}from"../../support/decorators/accessibleHandler.js";import{messageBundle as w}from"../../support/decorators/messageBundle.js";import"../../../core/Logger.js";import{tsx as L}from"../../support/jsxFactory.js";import{isRTL as C}from"../../support/widgetUtils.js";import{substitute as x}from"../../../intl/substitute.js";const S={activated:"esri-legend--card__carousel-indicator--activated",base:"esri-legend--card",stacked:"esri-legend--stacked",carouselTitle:"esri-legend--card__carousel-title",indicator:"esri-legend--card__carousel-indicator",intervalSeparator:"esri-legend--card__interval-separator",imageryLayerStretchedImage:"esri-legend--card__imagery-layer-image--stretched",imageLabel:"esri-legend--card__image-label",layerCaption:"esri-legend--card__layer-caption",labelElement:"esri-legend--card__label-element",layerRow:"esri-legend--card__layer-row",labelCell:"esri-legend--card__label-cell",message:"esri-legend--card__message",rampLabel:"esri-legend--card__ramp-label",section:"esri-legend--card__section",relationshipSection:"esri-legend--card__relationship-section",serviceCaptionText:"esri-legend--card__service-caption-text",serviceContent:"esri-legend--card__service-content",service:"esri-legend--card__service",groupLayer:"esri-legend--card__group-layer",groupLayerChild:"esri-legend--card__group-layer-child",symbol:"esri-legend--card__symbol",sizeRampRow:"esri-legend--card__size-ramp-row",symbolRow:"esri-legend--card__symbol-row",symbolCell:"esri-legend--card__symbol-cell",indicatorContainer:"esri-legend--card__carousel-indicator-container",intervalSeparatorsContainer:"esri-legend--card__interval-separators-container",relationshipLabelContainer:"esri-legend--card__relationship-label-container",labelContainer:"esri-legend--card__label-container",serviceCaptionContainer:"esri-legend--card__service-caption-container",symbolContainer:"esri-legend--card__symbol-container",sizeRampContainer:"esri-legend--card__size-ramp-container",sizeRampPreview:"esri-legend--card__size-ramp-preview",rampContainer:"esri-legend__ramps",sizeRampHorizontal:"esri-legend__size-ramp--horizontal",rampLabelsContainer:"esri-legend__ramp-labels",layerInfo:"esri-legend__layer-cell esri-legend__layer-cell--info",univariateAboveAndBelowColorRamp:"esri-univariate-above-and-below-ramp__color--card",hidden:"esri-hidden"},R=25,z=25,$=768,I=100;var k;!function(e){e.Auto="auto",e.Stack="stack",e.SideBySide="side-by-side"}(k||(k={}));const A="#ddd",N=window.devicePixelRatio;function j(e){if(e){if(e.type.includes("3d")){const t=e.symbolLayers&&e.symbolLayers.length;if(!t)return;const s=e.symbolLayers.getItemAt(t-1),i=s.resource&&s.resource.primitive;return"circle"===i||"cross"===i||"kite"===i||"sphere"===i||"cube"===i||"diamond"===i}{const t=e.style;return"circle"===t||"diamond"===t||"cross"===t}}}function E(e){if(e){if(e.type.includes("3d")){const t=e.symbolLayers&&e.symbolLayers.length;if(!t)return;const s=e.symbolLayers.getItemAt(t-1).get("resource.primitive");return"triangle"===s||"cone"===s||"tetrahedron"===s}return"triangle"===e.style}}let F=class extends l{constructor(e,s){super(e,s),this._handles=new t,this._hasIndicators=!1,this._selectedSectionName=null,this._sectionNames=[],this._sectionMap=new Map,this.activeLayerInfos=null,this.headingLevel=3,this.layout=k.Stack,this.messages=null,this.messagesCommon=null,this.type="card",this.view=null}initialize(){this.own([this.watch("activeLayerInfos",(e=>{this._handles.removeAll(),this._watchForSectionChanges(e)}))])}destroy(){this._handles.destroy(),this._handles=null}render(){this._hasIndicators=this.layout===k.Auto&&this.view.container.clientWidth<=$||this.layout===k.Stack;const e=this.activeLayerInfos,t=e&&e.toArray().map((e=>this._renderLegendForLayer(e))).filter((e=>!!e));this._hasIndicators?this._selectedSectionName&&this._sectionNames.includes(this._selectedSectionName)||(this._selectedSectionName=this._sectionNames&&this._sectionNames[0]):this._selectedSectionName=null;const s=this._sectionNames.length,i=this._sectionNames.map(((e,t)=>{const i=x(this.messagesCommon.pagination.pageText,{index:t+1,total:s});return L("div",{key:e,role:"tab",id:e,"aria-label":i,"aria-controls":`${e}-panel`,"aria-selected":(this._selectedSectionName===e).toString(),tabIndex:this._selectedSectionName===e?0:-1,title:i,onclick:this._selectSection,onkeydown:this._focusSection,bind:this,class:this.classes(S.indicator,{[S.activated]:this._selectedSectionName===e}),"data-section-name":e})})),r=this._hasIndicators&&s>1?L("div",{class:S.indicatorContainer,key:"carousel-navigation",role:"tablist"},i):null,a=this._hasIndicators?this._sectionMap.get(this._selectedSectionName):t&&t.length?t:null,o={[S.stacked]:this._hasIndicators};return L("div",{class:this.classes(S.base,o)},a||L("div",{class:S.message},this.messages.noLegend),r)}_selectSection(e){const t=e.target.getAttribute("data-section-name");t&&(this._selectedSectionName=t)}_focusSection(e){switch(e.key){case"ArrowLeft":case"ArrowRight":this._switchSectionOnArrowPress(e);break;case"Enter":case" ":this._selectSection(e)}}_switchSectionOnArrowPress(e){const t=e.key,s="ArrowLeft"===t?-1:1,i=e.target.getAttribute("data-section-name"),r=this._sectionNames.indexOf(i),a=this._sectionNames;let o=null;-1!==r&&(a[r+s]?o=document.getElementById(a[r+s]):"ArrowLeft"===t?o=document.getElementById(a[a.length-1]):"ArrowRight"===t&&(o=document.getElementById(a[0])),o&&o.focus())}_watchForSectionChanges(e){if(this._generateSectionNames(),e){e.forEach((e=>{const t=`activeLayerInfo-${e.layer.uid}-version-change`;this._handles.remove(t),this._watchForSectionChanges(e.children),this._handles.add(e.watch("version",(()=>this._generateSectionNames())),t)}));const t="activeLayerInfos-collection-change";this._handles.remove(t),this._handles.add(e.on("change",(()=>this._watchForSectionChanges(e))),t)}}_generateSectionNames(){this._sectionNames.length=0,this._selectedSectionName=null,this.activeLayerInfos&&this.activeLayerInfos.forEach(this._generateSectionNamesForActiveLayerInfo,this)}_getSectionName(e,t,s){return`${this.id}${e.uid}-type-${t.type}-${s}`}_generateSectionNamesForActiveLayerInfo(e){e.children.forEach(this._generateSectionNamesForActiveLayerInfo,this),e.legendElements&&e.legendElements.forEach(((t,s)=>{this._sectionNames.push(this._getSectionName(e.layer,t,s))}))}_renderLegendForLayer(e){if(!e.ready)return null;if(e.children.length){const t=e.children.map((e=>this._renderLegendForLayer(e))).toArray();return L("div",{key:e.layer.uid,class:this.classes(S.service,S.groupLayer)},L("div",{class:S.serviceCaptionContainer},e.title),t)}{const t=e.legendElements;if(t&&!t.length)return null;const s=t.some((e=>"relationship-ramp"===e.type)),i=t.map(((t,i)=>this._renderLegendForElement(t,e,i,s))).filter((e=>!!e));if(!i.length)return null;const r={[S.groupLayerChild]:!!e.parent};return L("div",{key:e.layer.uid,class:this.classes(S.service,r)},L("div",{class:S.serviceCaptionContainer},L("div",{class:S.serviceCaptionText},e.title)),L("div",{class:S.serviceContent},i))}}_renderLegendForElement(e,t,s,i=!1){const r="color-ramp"===e.type,a="opacity-ramp"===e.type,o="size-ramp"===e.type,l=t.layer;let c=null;if("string"==typeof e.title)c=e.title;else if(e.title){const t=e.title,s=g(this.messages,t,r||a);c=t.title?`${t.title} (${s})`:s}const d=this._getSectionName(l,e,s),p=this._hasIndicators?L("div",null,L(u,{level:this.headingLevel,class:S.carouselTitle},t.title),L(u,{level:f(this.headingLevel),class:S.layerCaption},c)):c?L(u,{level:this.headingLevel,class:S.layerCaption},c):null,m=t.effectList;let h=null;if("symbol-table"===e.type){const s=e.infos.map(((s,i)=>this._renderLegendForElementInfo(s,t,e.legendType,i))).filter((e=>!!e));if(s.length){const e=s[0].properties.classes&&s[0].properties.classes[S.symbolRow],t={[S.labelContainer]:!e&&!i,[S.relationshipLabelContainer]:i};h=L("div",{class:this.classes(t)},s)}}else"color-ramp"===e.type||"opacity-ramp"===e.type||"heatmap-ramp"===e.type?h=this._renderLegendForRamp(e,l.opacity,m):o?h=this._renderSizeRamp(e,l.opacity):"relationship-ramp"===e.type?h=n(e,this.id,l.opacity,m):"univariate-above-and-below-ramp"===e.type?h=this._renderUnivariateAboveAndBelowRamp(e,l.opacity,m):"univariate-color-size-ramp"===e.type&&(h=this._renderUnivariateColorSizeRamp(e,l.opacity,m));if(!h)return null;const y=L("div",{key:d,class:S.section,id:`${d}-panel`,role:"tabpanel","aria-labelledby":d,tabIndex:0},[p,h]);return this._sectionMap.set(d,y),y}_renderUnivariateAboveAndBelowRamp(e,t,s){const{sizeRampElement:i,colorRampElement:r}=c(e,t,"horizontal");if(!i)return null;const a=d(i,"full",!0,"horizontal"),o=p(i,"above",!0,"horizontal"),l=p(i,"below",!0,"horizontal"),n=12,y=m(r,{width:o,height:n,rampAlignment:"horizontal",opacity:t,type:"above",effectList:s}),g=m(r,{width:l,height:n,rampAlignment:"horizontal",opacity:t,type:"below",effectList:s}),v=h(i,"card"),u=i.infos.map((e=>e.label)),f=u.length-1,b=u.map(((e,t)=>0===t||t===f?L("div",{key:t},e):null)),w={display:"flex",flexDirection:"column"},x={display:"flex",flexDirection:"row"},R={marginTop:"3px",display:"flex"};C(this.container)?R.marginRight=`${v}px`:R.marginLeft=`${v}px`;const z={width:`${a}px`,display:"flex",flexDirection:"row",justifyContent:"space-between"};return L("div",{class:S.layerRow,key:"size-ramp-preview",styles:w},L("div",{class:this.classes(S.symbolContainer,S.sizeRampHorizontal),styles:x},i.infos.map(((e,t)=>L("div",{key:t,class:S.symbol,bind:e.preview,afterCreate:_})))),y?L("div",{class:S.univariateAboveAndBelowColorRamp,styles:R,key:"color-ramp-preview"},L("div",{bind:y,afterCreate:_}),L("div",{bind:g,afterCreate:_})):null,L("div",{class:S.layerInfo},L("div",{class:S.rampLabelsContainer,styles:z},b)))}_renderUnivariateColorSizeRamp(e,t,s){const{sizeRampElement:i,colorRampElement:r}=y(e,"horizontal");if(!i)return null;const a=d(i,"full",!1,"horizontal"),o=p(i,"full",!1,"horizontal"),l=m(r,{width:o,height:12,rampAlignment:"horizontal",opacity:t,type:"full",effectList:s}),n=h(i,"card"),c=i.infos.length-1,g=i.infos.map(((e,t)=>0===t||t===c?L("div",{key:t},e.label):null)),v={display:"flex",flexDirection:"column"},u={display:"flex",flexDirection:"row"},f={marginTop:"3px",display:"flex"};C(this.container)?f.marginRight=`${n}px`:f.marginLeft=`${n}px`;const b={width:`${a}px`,display:"flex",flexDirection:"row",justifyContent:"space-between"};return L("div",{class:S.layerRow,key:"size-ramp-preview",styles:v},L("div",{class:this.classes(S.symbolContainer,S.sizeRampHorizontal),styles:u},i.infos.map(((e,t)=>L("div",{key:t,class:S.symbol,bind:e.preview,afterCreate:_})))),L("div",{class:S.univariateAboveAndBelowColorRamp,styles:f,key:"color-ramp-preview"},L("div",{bind:l,afterCreate:_})),L("div",{class:S.layerInfo},L("div",{class:S.rampLabelsContainer,styles:b},g)))}_renderLegendForElementInfo(e,t,s,i){const r=t.layer;if(e.type)return this._renderLegendForElement(e,t,i);const a=v(r,s);if(e.preview){var l,n;if(!e.symbol||!e.symbol.type.includes("simple-fill")){if(!e.label)return L("div",{key:i,bind:e.preview,afterCreate:_});const t={[S.symbolCell]:this._hasIndicators};return L("div",{key:i,class:this.classes(S.layerRow,{[S.symbolRow]:this._hasIndicators})},L("div",{class:this.classes(t),bind:e.preview,afterCreate:_}),L("div",{class:this.classes(S.imageLabel,{[S.labelCell]:this._hasIndicators})},g(this.messages,e.label,!1)||""))}let s=255,a=255,c=255,d=0,p=255,m=255,h=255,y=0;const v=e.symbol.color&&e.symbol.color.a,u=e.symbol.outline&&e.symbol.outline.color&&e.symbol.outline.color.a;v&&(s=e.symbol.color.r,a=e.symbol.color.g,c=e.symbol.color.b,d=e.symbol.color.a*r.opacity),u&&(p=e.symbol.outline.color.r,m=e.symbol.outline.color.g,h=e.symbol.outline.color.b,y=e.symbol.outline.color.a*r.opacity);const f=null==(l=null==(n=e.symbol.color)?void 0:n.isBright)||l,b=f?"rgba(255, 255, 255, .6)":"rgba(0, 0, 0, .6)",w={background:v?`rgba(${s}, ${a}, ${c}, ${d})`:"none",color:f?"black":"white",textShadow:`-1px -1px 0 ${b},\n 1px -1px 0 ${b},\n -1px 1px 0 ${b},\n 1px 1px 0 ${b}`,border:u?`1px solid rgba(${p}, ${m}, ${h}, ${y})`:"none",filter:o(t.effectList)};return L("div",{key:i,class:S.layerRow},L("div",{class:S.labelElement,styles:w}," ",e.label," "))}if(e.src){const t=this._renderImage(e,r,a);return L("div",{key:i,class:S.layerRow},t,L("div",{class:S.imageLabel},e.label||""))}}_renderImage(e,t,s){const{label:i,src:r,opacity:a}=e,o={[S.imageryLayerStretchedImage]:s,[S.symbol]:!s},l={opacity:`${null!=a?a:t.opacity}`};return L("img",{alt:g(this.messages,i,!1),src:r,border:0,width:e.width,height:e.height,class:this.classes(o),styles:l})}_renderSizeRampLines(e){const t=e.infos,i=t[0],r=t[t.length-1],a=i.symbol,o=this._hasIndicators,l=s(i.size+i.outlineSize)*N,n=s(r.size+r.outlineSize)*N,c=o?l:l+50*N,d=o?l/2+50*N:l,p=E(a),m=j(a),h=document.createElement("canvas");h.width=c,h.height=d,h.style.width=h.width/N+"px",h.style.height=h.height/N+"px";const y=h.getContext("2d");if(o){y.beginPath();const e=0,t=0,s=c/2-n/2,i=d;y.moveTo(e,t),y.lineTo(s,i);const r=c,a=0,o=c/2+n/2,l=d;y.moveTo(r,a),y.lineTo(o,l)}else{y.beginPath();const e=0,t=d/2-n/2,s=c,i=0;y.moveTo(e,t),y.lineTo(s,i);const r=0,a=d/2+n/2,o=c,l=d;y.moveTo(r,a),y.lineTo(o,l)}return y.strokeStyle=A,y.stroke(),L("div",{bind:h,afterCreate:_,styles:o?{display:"flex",marginTop:`-${p?0:m?l/2:0}px`,marginBottom:`-${p?n:m?n/2:0}px`}:{display:"flex",marginRight:`-${p?0:m?l/2:0}px`,marginLeft:`-${p?0:m?n/2:0}px`}})}_renderSizeRamp(e,t){const s=e.infos,i=s[0].label,r=s[s.length-1].label;let a=s[0].preview,o=s[s.length-1].preview;const l=this._hasIndicators,n={"flex-direction":l?"column":"row-reverse"};a&&(a=a.cloneNode(!0),a.style.display="flex"),o&&(o=o.cloneNode(!0),o.style.display="flex");const c={opacity:null!=t?`${t}`:""};return L("div",{class:this.classes(S.layerRow,{[S.sizeRampRow]:l})},L("div",{class:S.rampLabel},l?i:r),L("div",{class:S.sizeRampContainer,styles:n},L("div",{bind:a,afterCreate:_,class:S.sizeRampPreview,styles:c}),this._renderSizeRampLines(e),L("div",{bind:o,afterCreate:_,class:S.sizeRampContainer,styles:c})),L("div",{class:S.rampLabel},l?r:i))}_renderLegendForRamp(e,t,s){const i=e.infos,r="heatmap-ramp"===e.type,l=i.length-1,n=z,c=l>2&&!r?R*l:I,d=c+20,p=10,m=i.slice(0).reverse();m.forEach(((e,t)=>{e.offset=r?e.ratio:t/l}));const h=m.length-1,y=m.length%2!=0&&m[m.length/2|0],g=y&&L("div",{class:S.intervalSeparatorsContainer},L("div",{class:S.intervalSeparator},"|"),L("div",{class:S.rampLabel},y.label)),_=i[i.length-1].label,v=i[0].label,u=[[{shape:{type:"path",path:`M0 ${n/2} L${p} 0 L${p} ${n} Z`},fill:m[0].color,stroke:{width:0}},{shape:{type:"rect",x:p,y:0,width:c,height:n},fill:{type:"linear",x1:p,y1:0,x2:c+p,y2:0,colors:m},stroke:{width:0}},{shape:{type:"path",path:`M${c+p} 0 L${d} ${n/2} L${c+p} ${n} Z`},fill:m[h].color,stroke:{width:0}}]],f=a(u,d,n),{messages:b}=this,w={filter:o(s),opacity:null==t?null:`${t}`},C={justifyContent:"center"};return L("div",{class:S.layerRow,styles:C},L("div",{class:S.rampLabel},r?b[_]:_),L("div",{class:S.symbolContainer},L("div",{styles:w},f),g),L("div",{class:S.rampLabel},r?b[v]:v))}};e([i()],F.prototype,"activeLayerInfos",void 0),e([i()],F.prototype,"headingLevel",void 0),e([i()],F.prototype,"layout",void 0),e([i(),w("esri/widgets/Legend/t9n/Legend")],F.prototype,"messages",void 0),e([i(),w("esri/t9n/common")],F.prototype,"messagesCommon",void 0),e([i({readOnly:!0})],F.prototype,"type",void 0),e([i()],F.prototype,"view",void 0),e([b()],F.prototype,"_selectSection",null),F=e([r("esri.widgets.Legend.styles.Card")],F);const T=F;export{T 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"../../../intl.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import a from"../../Widget.js";import{renderRelationshipRamp as s}from"./support/relationshipUtils.js";import{getUnivariateAboveAndBelowRampElements as t,getUnivariateColorRampSize as i,getUnivariateColorRampPreview as n,getUnivariateColorRampMargin as o,getUnivariateColorSizeRampElements as p}from"./support/univariateUtils.js";import{getTitle as d,isRendererTitle as
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../intl.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import a from"../../Widget.js";import{renderRelationshipRamp as s}from"./support/relationshipUtils.js";import{getUnivariateAboveAndBelowRampElements as t,getUnivariateColorRampSize as i,getUnivariateColorRampPreview as n,getUnivariateColorRampMargin as o,getUnivariateColorSizeRampElements as p}from"./support/univariateUtils.js";import{getTitle as d,isRendererTitle as c,attachToNode as y,isImageryStretchedLegend as m}from"../support/styleUtils.js";import{Heading as g}from"../../support/Heading.js";import"../../support/widgetUtils.js";import{messageBundle as v}from"../../support/decorators/messageBundle.js";import"../../../core/Logger.js";import{tsx as h}from"../../support/jsxFactory.js";import{formatNumber as b}from"../../../intl/number.js";const u={service:"esri-legend__service",label:"esri-legend__service-label",layer:"esri-legend__layer",groupLayer:"esri-legend__group-layer",groupLayerChild:"esri-legend__group-layer-child",layerTable:"esri-legend__layer-table",layerTableSizeRamp:"esri-legend__layer-table--size-ramp",layerChildTable:"esri-legend__layer-child-table",layerCaption:"esri-legend__layer-caption",layerBody:"esri-legend__layer-body",layerRow:"esri-legend__layer-row",layerCell:"esri-legend__layer-cell",layerInfo:"esri-legend__layer-cell esri-legend__layer-cell--info",imageryLayerStretchedImage:"esri-legend__imagery-layer-image--stretched",imageryLayerCellStretched:"esri-legend__imagery-layer-cell--stretched",imageryLayerInfoStretched:"esri-legend__imagery-layer-info--stretched",symbolContainer:"esri-legend__layer-cell esri-legend__layer-cell--symbols",symbol:"esri-legend__symbol",rampContainer:"esri-legend__ramps",sizeRamp:"esri-legend__size-ramp",colorRamp:"esri-legend__color-ramp",opacityRamp:"esri-legend__opacity-ramp",borderlessRamp:"esri-legend__borderless-ramp",rampTick:"esri-legend__ramp-tick",rampFirstTick:"esri-legend__ramp-tick-first",rampLastTick:"esri-legend__ramp-tick-last",rampLabelsContainer:"esri-legend__ramp-labels",rampLabel:"esri-legend__ramp-label",univariateAboveAndBelowSymbol:"esri-univariate-above-and-below-ramp__symbol",univariateAboveAndBelowLabel:"esri-univariate-above-and-below-ramp__label",message:"esri-legend__message",header:"esri-widget__heading",hidden:"esri-hidden"},_="esri-legend__",f=24,L={display:"flex",alignItems:"flex-start"},w={marginLeft:"3px"},C={display:"table-cell",verticalAlign:"middle"};let R=class extends a{constructor(e,r){super(e,r),this.activeLayerInfos=null,this.headingLevel=3,this.messages=null,this.type="classic"}render(){const e=this.activeLayerInfos,r=e&&e.toArray().map((e=>this._renderLegendForLayer(e))).filter((e=>!!e));return h("div",null,r&&r.length?r:h("div",{class:u.message},this.messages.noLegend))}_renderLegendForLayer(e){if(!e.ready)return null;const r=!!e.children.length,l=`${_}${e.layer.uid}-version-${e.version}`,a=e.title?g({level:this.headingLevel,class:this.classes(u.header,u.label)},e.title):null;if(r){const r=e.children.map((e=>this._renderLegendForLayer(e))).toArray();return h("div",{key:l,class:this.classes(u.service,u.groupLayer)},a,r)}{const r=e.legendElements;if(r&&!r.length)return null;const s=r.map((r=>this._renderLegendForElement(r,e.layer,e.effectList))).filter((e=>!!e));if(!s.length)return null;const t={[u.groupLayerChild]:!!e.parent};return h("div",{key:l,class:this.classes(u.service,t),tabIndex:0},a,h("div",{class:u.layer},s))}}_renderLegendForElement(e,r,l,a){const t="color-ramp"===e.type,i="opacity-ramp"===e.type,n="size-ramp"===e.type;let o=null;if("symbol-table"===e.type||n){const a=e.infos.map((a=>this._renderLegendForElementInfo(a,r,l,n,e.legendType))).filter((e=>!!e));a.length&&(o=h("div",{class:u.layerBody},a))}else"color-ramp"===e.type||"opacity-ramp"===e.type||"heatmap-ramp"===e.type||"stretch-ramp"===e.type?o=this._renderLegendForRamp(e,r.opacity):"relationship-ramp"===e.type?o=s(e,this.id,r.opacity,l):"univariate-above-and-below-ramp"===e.type?o=this._renderUnivariateAboveAndBelowRamp(e,r.opacity,l):"univariate-color-size-ramp"===e.type&&(o=this._renderUnivariateColorSizeRamp(e,r.opacity,l));if(!o)return null;const p=e.title;let y=null;if("string"==typeof p)y=p;else if(p){const e=d(this.messages,p,t||i);y=c(p,t||i)&&p.title?`${p.title} (${e})`:e}const m=a?u.layerChildTable:u.layerTable,g=y?h("div",{class:u.layerCaption},y):null,v={[u.layerTableSizeRamp]:n||!a};return h("div",{class:this.classes(m,v)},g,o)}_renderUnivariateAboveAndBelowRamp(e,r,l){const{sizeRampElement:a,colorRampElement:s}=t(e,r);if(!a)return null;const p=i(a,"above",!0),d=i(a,"below",!0),c=12,m=n(s,{width:c,height:p,rampAlignment:"vertical",opacity:r,type:"above",effectList:l}),g=n(s,{width:c,height:d,rampAlignment:"vertical",opacity:r,type:"below",effectList:l}),v=o(a),b=a.infos.map((e=>e.label)),_=b.map(((e,r)=>{const l=2===r;return 0===r?h("div",{key:r,class:e?m?u.univariateAboveAndBelowLabel:u.rampLabel:null},e):l?h("div",null):null})),f=b.length-1,R=Math.floor(b.length/2),A=b.map(((e,r)=>r===R||r===f?h("div",{key:r,class:e?m?u.univariateAboveAndBelowLabel:u.rampLabel:null},e):null)),S={display:"table-cell",verticalAlign:"middle"},j={marginTop:`${v}px`},I={height:`${p}px`},k={height:`${d}px`};return h("div",{key:"univariate-above-and-below-ramp-preview",styles:L},h("div",{class:u.layerBody},a.infos.map(((e,r)=>h("div",{class:this.classes(u.layerRow,u.sizeRamp)},h("div",{class:u.symbol,styles:S,bind:e.preview,afterCreate:y}),m||r%2!=0?null:h("div",{class:u.layerInfo},b[r]))))),m?h("div",{styles:j,key:"color-ramp-preview"},h("div",{styles:w},h("div",{styles:C},h("div",{class:u.rampContainer,bind:m,afterCreate:y})),h("div",{styles:C},h("div",{class:u.rampLabelsContainer,styles:I},_))),h("div",{styles:w},h("div",{styles:C},h("div",{class:u.rampContainer,bind:g,afterCreate:y})),h("div",{styles:C},h("div",{class:u.rampLabelsContainer,styles:k},A)))):null)}_renderUnivariateColorSizeRamp(e,r,l){const{sizeRampElement:a,colorRampElement:s}=p(e);if(!a)return null;const t=o(a),d=12,c=i(a,"full",!1),m=n(s,{width:d,height:c,rampAlignment:"vertical",opacity:r,type:"full",effectList:l}),g=a.infos.length-1,v=a.infos.map(((e,r)=>0===r||r===g?h("div",{key:r,class:e.label?s?u.univariateAboveAndBelowLabel:u.rampLabel:null},e.label):null)),b={display:"table-cell",verticalAlign:"middle"},_={marginTop:`${t}px`},f={height:`${c}px`};return h("div",{key:"univariate-above-and-below-ramp-preview",styles:L},h("div",{class:u.layerBody},a.infos.map((e=>h("div",{class:this.classes(u.layerRow,u.sizeRamp)},h("div",{class:u.symbol,styles:b,bind:e.preview,afterCreate:y}))))),h("div",{styles:_,key:"color-ramp-preview"},h("div",{styles:w},h("div",{styles:C},h("div",{class:u.rampContainer,bind:m,afterCreate:y})),h("div",{styles:C},h("div",{class:u.rampLabelsContainer,styles:f},v)))))}_renderLegendForRamp(e,r){const l=e.infos,a="opacity-ramp"===e.type,s="heatmap-ramp"===e.type,t="stretch-ramp"===e.type,i=e.preview,n=a?u.opacityRamp:"";i.className=`${u.colorRamp} ${n}`,null!=r&&(i.style.opacity=r.toString());const o=l.map((e=>h("div",{class:e.label?u.rampLabel:null},s?this.messages[e.label]:t?this._getStretchStopLabel(e):e.label))),p={width:`${f}px`},d={height:i.style.height};return h("div",{class:u.layerRow},h("div",{class:u.symbolContainer,styles:p},h("div",{class:u.rampContainer,bind:i,afterCreate:y})),h("div",{class:u.layerInfo},h("div",{class:u.rampLabelsContainer,styles:d},o)))}_getStretchStopLabel(e){return e.label?this.messages[e.label]+": "+("string"==typeof e.value?e.value:b(e.value,{style:"decimal",notation:e.value.toString().includes("e")?"scientific":"standard"})):""}_renderLegendForElementInfo(e,r,l,a,s){if(e.type)return this._renderLegendForElement(e,r,l,!0);let t=null;const i=m(r,s);if(e.preview?t=h("div",{class:u.symbol,bind:e.preview,afterCreate:y}):e.src&&(t=this._renderImage(e,r,i)),!t)return null;const n={[u.imageryLayerInfoStretched]:i},o={[u.imageryLayerInfoStretched]:i,[u.sizeRamp]:!i&&a};return h("div",{class:u.layerRow},h("div",{class:this.classes(u.symbolContainer,o)},t),h("div",{class:this.classes(u.layerInfo,n)},d(this.messages,e.label,!1)||""))}_renderImage(e,r,l){const{label:a,src:s,opacity:t}=e,i={[u.imageryLayerStretchedImage]:l,[u.symbol]:!l},n={opacity:`${null!=t?t:r.opacity}`};return h("img",{alt:d(this.messages,a,!1),src:s,border:0,width:e.width,height:e.height,class:this.classes(i),styles:n})}};e([r()],R.prototype,"activeLayerInfos",void 0),e([r()],R.prototype,"headingLevel",void 0),e([r(),v("esri/widgets/Legend/t9n/Legend")],R.prototype,"messages",void 0),e([r({readOnly:!0})],R.prototype,"type",void 0),R=e([l("esri.widgets.Legend.styles.Classic")],R);const A=R;export{A 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 t from"../../../Color.js";import{addTokenParameter as l}from"../../../kernel.js";import s from"../../../request.js";import"../../../symbols.js";import r from"../../../core/Accessor.js";import n from"../../../core/Collection.js";import i from"../../../core/Handles.js";import{JSONMap as a}from"../../../core/jsonMap.js";import o from"../../../core/Logger.js";import{unwrap as u,isSome as c}from"../../../core/maybe.js";import{eachAlways as d,debounce as y}from"../../../core/promiseUtils.js";import{px2pt as h}from"../../../core/screenUtils.js";import{addQueryParameters as m}from"../../../core/urlUtils.js";import{on as p,init as f,whenFalseOnce as g,watch as b}from"../../../core/watchUtils.js";import{property as S}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as _}from"../../../core/accessorSupport/decorators/subclass.js";import{OriginId as v}from"../../../core/accessorSupport/PropertyOrigin.js";import{EffectView as w}from"../../../layers/effects/EffectView.js";import{effectFunctionsFromJSON as L}from"../../../layers/effects/jsonUtils.js";import{ExportImageParameters as E}from"../../../layers/support/ExportImageParameters.js";import{isDateField as I}from"../../../layers/support/fieldUtils.js";import{fromJSON as C}from"../../../renderers/support/jsonUtils.js";import{isSupportedRenderer3D as R}from"../../../renderers/support/rendererConversion.js";import F from"../../../renderers/visualVariables/support/SizeVariableLegendOptions.js";import{applyCIMSymbolColor as V}from"../../../symbols/support/cimSymbolUtils.js";import{SymbolSizeDefaults as T}from"../../../symbols/support/previewUtils.js";import{renderSymbol as z}from"../../../symbols/support/renderUtils.js";import{renderColorRampPreviewHTML as x,renderDotDensityPreviewHTML as j,renderPreviewHTML as O}from"../../../symbols/support/symbolUtils.js";import{isVolumetricSymbol as D}from"../../../symbols/support/utils.js";import{getClusterSizeVariable as M}from"./clusterUtils.js";import{getColorFromPointCloudStops as P,getRampStopsForPointCloud as A,getStrectchRampStops as U,getRampStops as B}from"./colorRampUtils.js";import{getHeatmapRampStops as k}from"./heatmapRampUtils.js";import{getRotationAngleForFocus as N,getRelationshipRampElement as q}from"./relationshipRampUtils.js";import{getRampStops as W,REAL_WORLD_MAX_SIZE as $,REAL_WORLD_MIN_SIZE as G}from"./sizeRampUtils.js";import{SPECIAL_CHARS_LESS_THAN as J,SPECIAL_CHARS_GREATER_THAN as Q,getSymbolForFlowRenderer as H,getMedianColor as X,RGB_IMG_SOURCE as K}from"./utils.js";import{formatNumberLabel as Y}from"../../smartMapping/support/utils.js";import Z from"../../../symbols/SimpleMarkerSymbol.js";import ee from"../../../symbols/SimpleFillSymbol.js";const te=o.getLogger("esri.widgets.Legend.support.ActiveLayerInfo"),le="https://utility.arcgis.com/sharing/tools/legend",se="esri.layers.ImageryLayer",re="esri.layers.ImageryTileLayer",ne="esri.layers.WCSLayer",ie=/^\s*(return\s+)?\$view\.scale\s*(;)?\s*$/i,ae=new a({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon",esriGeometryMultiPatch:"multipatch"}),oe={u1:[0,1],u2:[0,3],u4:[0,15],u8:[0,255],s8:[-128,127],u16:[0,65535],s16:[-32768,32767],u32:[0,4294967295],s32:[-2147483648,2147483647],f32:[-34e38,34e38],f64:[-Number.MAX_VALUE,Number.MAX_VALUE]},ue=new Z({size:6,outline:{color:[128,128,128,.5],width:.5}}),ce=new ee({style:"solid"});function de(e){return"flow"===e.type}function ye(e){return"vector-field"===e.type}function he(e){return"raster-colormap"===e.type}function me(e){return"raster-stretch"===e.type}function pe(e){return"raster-shaded-relief"===e.type}function fe(e){return"esri.renderers.SimpleRenderer"===e.declaredClass}function ge(e){return"esri.renderers.ClassBreaksRenderer"===e.declaredClass}function be(e){return"esri.renderers.UniqueValueRenderer"===e.declaredClass}function Se(e){return"esri.renderers.HeatmapRenderer"===e.declaredClass}function _e(e){return we(e)||Le(e)||Ee(e)||ve(e)}function ve(e){return"esri.renderers.PointCloudRGBRenderer"===e.declaredClass}function we(e){return"esri.renderers.PointCloudClassBreaksRenderer"===e.declaredClass}function Le(e){return"esri.renderers.PointCloudStretchRenderer"===e.declaredClass}function Ee(e){return"esri.renderers.PointCloudUniqueValueRenderer"===e.declaredClass}function Ie(e){return"esri.renderers.DotDensityRenderer"===e.declaredClass}function Ce(e,t){return fe(e)||ge(e)||be(e)||Se(e)||Ie(e)?"2d"===t.type||R(e):me(e)||he(e)||pe(e)||we(e)||Le(e)||Ee(e)||ye(e)||de(e)}function Re(e){return"esri.layers.BuildingSceneLayer"===e.declaredClass}function Fe(e){return"esri.layers.VoxelLayer"===e.declaredClass}function Ve(e){return"esri.layers.WMSLayer"===e.declaredClass}function Te(e){return"esri.layers.WMTSLayer"===e.declaredClass}function ze(e){return"esri.layers.MapImageLayer"===e.declaredClass}function xe(e){return"esri.layers.TileLayer"===e.declaredClass}function je(e){return"esri.layers.FeatureLayer"===e.declaredClass}function Oe(e){return e.declaredClass===se}function De(e){return e.declaredClass===re}function Me(e){return e.declaredClass===ne}function Pe(e){return"stretch-ramp"===e.type}function Ae(e){const t="authoringInfo"in e&&(null==e?void 0:e.authoringInfo);return"univariate-color-size"===(null==t?void 0:t.type)}function Ue(e){const t="authoringInfo"in e&&(null==e?void 0:e.authoringInfo);return"univariate-color-size"===(null==t?void 0:t.type)&&"above-and-below"===(null==t?void 0:t.univariateTheme)}const Be=new Z({style:"path",path:"M10,5 L5,0 0,5 M5,0 L5,15",size:15,outline:{width:1,color:[85,85,85,1]}});let ke={},Ne=class extends r{constructor(e){super(e),this._handles=new i,this._hasColorRamp=!1,this._hasOpacityRamp=!1,this._hasSizeRamp=!1,this._webStyleSymbolCache=new Map,this._dotDensityUrlCache=new Map,this._scaleDrivenSizeVariable=null,this._hasClusterSizeVariable=!1,this.children=new n,this.layerView=null,this.layer=null,this.legendElements=[],this.parent=null,this.hideLayersNotInCurrentView=!1,this.keepCacheOnDestroy=!1,this.respectLayerVisibility=!0,this.sublayerIds=[],this.title=null,this.view=null}initialize(){const e=()=>this.notifyChange("ready");this._handles.add([p(this,"children","change",(t=>{const{added:l,removed:s}=t,r=this._handles;l.forEach((t=>{const l=`activeLayerInfo-ready-watcher-${t.layer.uid}`;r.add(f(t,"ready",e),l)})),s.forEach((e=>r.remove(e.layer.uid))),e()}))]),this.keepCacheOnDestroy||(ke={})}destroy(){this._handles.destroy(),this._handles=null,this._webStyleSymbolCache=null,this._dotDensityUrlCache=null,this._scaleDrivenSizeVariable=null,this.keepCacheOnDestroy||(ke=null)}get effectList(){const e=this.layer;let t=null;return"effect"in e&&e.effect&&(t=new w,t.effect=e.effect,t.end(),t.scale=this.scale),t}get opacity(){var e;const t=this.layer.opacity,l=null==(e=this.parent)?void 0:e.opacity,s=this.layer.parent,r=s&&"uid"in s?this._getParentLayerOpacity(s):null;return null!=l?l*t:null!=r?r*t:t}get ready(){return null===this.layer||(this.children.length>0?this._isGroupActive():this.legendElements.length>0)}get scale(){return this.view&&this.view.scale}get isScaleDriven(){const e=this.layer;if(null===e)return!1;if("effect"in e&&e.effect&&Array.isArray(e.effect))return!0;if("featureReduction"in e&&e.featureReduction&&"cluster"===e.featureReduction.type)return!0;if("renderer"in e&&e.renderer){if("dot-density"===e.renderer.type)return!0;const t=e.get("renderer.valueExpression");if(ie.test(t))return!0;const l=e.get("renderer.visualVariables");if(l)return l.some((e=>this._isScaleDrivenSizeVariable(e)))}return this._isLayerScaleDriven(this.layer)}get version(){return this._get("version")+1}async buildLegendElementsForFeatureCollections(e){if(!(!this.hideLayersNotInCurrentView||await this._isLayerInCurrentView()))return this.legendElements=[],void this.notifyChange("ready");const t=Array.from(e,(e=>{if(je(e))return this._getRendererLegendElements(e.renderer,{title:e.title});if(e.featureSet&&e.featureSet.features.length){const t=e.layerDefinition,l=t&&t.drawingInfo,s=l&&C(l.renderer),r=ae.read(t.geometryType);return s?this._getRendererLegendElements(s,{title:e.name,geometryType:r}):(te.warn("drawingInfo not available!"),null)}return null}));try{const e=[];await d(t).then((t=>{t.forEach((({value:t})=>t&&e.push(...t)))})),this.legendElements=e,this.notifyChange("ready")}catch(l){te.warn("error while building legend for layer!",l)}}async buildLegendElementsForRenderer(e){try{const t=!this.hideLayersNotInCurrentView||await this._isLayerInCurrentView();this.legendElements=t?await this._getRendererLegendElements(e):[],this.notifyChange("ready")}catch(t){te.warn("error while building legend for layer!",t)}}async buildLegendElementsForTools(){const e=this.layer;if(Fe(e))this._constructLegendElementsForVoxellayer();else if(Te(e))this._constructLegendElementsForWMTSlayer();else if(Ve(e))await this._constructLegendElementsForWMSSublayers();else if(Re(e))await this._constructLegendElementsForBuildingSceneLayer();else if(ze(e)||xe(e)||Re(e))await this._constructLegendElementsForSublayers();else{this._handles.remove("imageryLayers-watcher");let s="default";if(Oe(e)){var t,l;const r=e;s=((null==r||null==(t=r.renderingRule)?void 0:t.functionName)||"default")+"_"+(null!=(l=e.bandIds)&&l.length?e.bandIds.join(""):"###")}await this._getLegendLayers(`${e.uid}-${s}`).then((async t=>{this.legendElements=[],this.notifyChange("ready");const l=t.map((async t=>{if(Oe(e)||De(e)){const t=e.watch(["renderingRule","bandIds"],(()=>y((async()=>{ke.default=null,e.renderer?await this.buildLegendElementsForRenderer(e.renderer):await this.buildLegendElementsForTools()}))()));this._handles.add(t,"imageryLayers-watcher")}const l=this._generateSymbolTableElementForLegendLayer(t);l&&l.infos.length&&(Oe(e)&&(l.title=e.title),this.legendElements.push(l)),this.notifyChange("ready")}));await d(l)})).catch((e=>{te.warn("Request to server for legend has failed!",e)}))}}async _isLayerInCurrentView(){const e=this.layer,t=this.layerView,l=t&&"createQuery"in t&&"queryFeatureCount"in t;if(!l&&!(t&&"createQuery"in e&&"queryFeatureCount"in e))return!0;await g(t,"updating");const s=l?"createQuery"in t&&t.createQuery():"createQuery"in e&&e.createQuery();s.geometry=this.view.extent;return 0!==(l?"queryFeatureCount"in t&&await t.queryFeatureCount(s):"queryFeatureCount"in e&&await e.queryFeatureCount(s))}_getParentLayerOpacity(e){let t=1;const l=e.parent;return l&&"uid"in l&&(t=this._getParentLayerOpacity(l)),e.opacity*t}_isGroupActive(){const e=this.children;return!!e.length&&e.some((e=>e.ready))}_isScaleDrivenSizeVariable(e){if(e&&"size"!==e.type)return!1;const t=e,l=t.minSize,s=t.maxSize;return"object"==typeof l&&l?this._isScaleDrivenSizeVariable(l):"object"==typeof s&&s?this._isScaleDrivenSizeVariable(s):!!t.expression||ie.test(t.valueExpression)}_isLayerScaleDriven(e){if("minScale"in e&&e.minScale>0||"maxScale"in e&&e.maxScale>0)return!0;if("sublayers"in e&&e.sublayers)return e.sublayers.some((e=>this._isLayerScaleDriven(e)));const t=e.parent;if(!1===e.loaded&&t&&ze(t)&&"source"in e&&e.source&&"map-layer"===e.source.type)for(const l of t.sourceJSON.layers)if(l.id===e.source.mapLayerId&&(l.minScale>0||l.maxScale>0))return!0;return!1}async _constructLegendElementsForVoxellayer(){this.legendElements=[],this._handles.remove("voxel-style-watcher");const e=this.layer;this._handles.add(b(e,"style",(()=>this._constructLegendElementsForVoxellayer())),"voxel-style-watcher");const t=u(e.getVariableStyle(null)),l=[];var s;if(t)if(null!=(s=t.uniqueValues)&&s.length){const e=[];t.uniqueValues.forEach((t=>{t.enabled&&e.push({label:t.label||`${t.value}`,value:t.value,symbol:new ee({color:t.color,outline:null})})})),e.length&&l.push({type:"symbol-table",title:t.label,infos:e})}else if(t.transferFunction){const{colorStops:e,stretchRange:s}=t.transferFunction,r=e.toArray().reverse(),n=s.map(((e,t)=>`${0===t?J:Q} ${Y(e)}`)).reverse(),i=r.map((e=>({color:e.color,value:null,label:null})));i[0].label=n[0],i[i.length-1].label=n[1],l.push({type:"color-ramp",title:t.label,infos:i,preview:x(r.map((e=>e.color)))})}const r=e.opacity,n=l.reduce(((e,t)=>e.concat(this._getAllInfos(t))),[]).filter((e=>!(null==e||!e.symbol))).map((e=>this._getSymbolPreview(e,r)));await d(n),this.legendElements=l,this.notifyChange("ready")}_constructLegendElementsForWMTSlayer(){this.legendElements=[],this._handles.remove("wmts-activeLayer-watcher");const e=this.layer.activeLayer;if(this._handles.add(b(this.layer,"activeLayer",(()=>this._constructLegendElementsForWMTSlayer())),"wmts-activeLayer-watcher"),e.styleId&&e.styles){let t=null;e.styles.some((l=>e.styleId===l.id&&(t=l.legendUrl,!0))),t&&(this.legendElements=[{type:"symbol-table",title:e.title,infos:[{src:t,opacity:this.opacity}]}])}this.notifyChange("ready")}async _constructLegendElementsForWMSSublayers(){this.legendElements=[],this._handles.remove("wms-sublayers-watcher");const e=this.layer;let t=null;(e.customParameters||e.customLayerParameters)&&(t={...e.customParameters,...e.customLayerParameters}),this._handles.add(b(this.layer,"sublayers",(()=>this._constructLegendElementsForWMSSublayers())),"wms-sublayers-watcher"),this.legendElements=await this._generateLegendElementsForWMSSublayers(e.sublayers,t),this.notifyChange("ready")}async _generateLegendElementsForWMSSublayers(e,t){const l=[];this._handles.add(e.on("change",(()=>this._constructLegendElementsForWMSSublayers())),"wms-sublayers-watcher");const s=e.toArray();for(const r of s){const e=r.watch(["title","visible","legendEnabled"],(()=>this._constructLegendElementsForWMSSublayers()));if(this._handles.add(e,"wms-sublayers-watcher"),!this.respectLayerVisibility||r.visible&&r.legendEnabled){const e=await this._generateSymbolTableElementForWMSSublayer(r,t);e&&e.infos.length&&l.unshift(e)}}return l}async _generateSymbolTableElementForWMSSublayer(e,t){if(!e.legendUrl&&e.sublayers){const l=(await this._generateLegendElementsForWMSSublayers(e.sublayers,t)).filter((e=>e));return{type:"symbol-table",title:e.title,infos:l}}return this._generateSymbolTableElementForLegendUrl(e,t)}async _generateSymbolTableElementForLegendUrl(e,t){var l;let r=e.legendUrl;if(!r)return;const n={type:"symbol-table",title:e.title||e.name||e.id&&e.id+"",infos:[]};t&&(r=m(r,t));let i=null;const a=null==(l=e.layer)?void 0:l.opacity;try{i=(await s(r,{responseType:"image"})).data,i&&(i.style.opacity=a)}catch{}return n.infos.push({src:r,preview:i,opacity:a}),n}_getLegendLayers(e,t){const l=ke&&ke[e];return l?Promise.resolve(l):this._legendRequest(t).then((t=>{const l=t.layers;return ke[e]=l,l}))}_legendRequest(e){const t=this.layer;let l={f:"json",dynamicLayers:e};if(Oe(t)){const e=t.exportImageServiceParameters.renderingRule;if(e&&(l.renderingRule=JSON.stringify(e.rasterFunctionDefinition||e.toJSON())),t.bandIds&&(l.bandIds=t.bandIds.join()),t.raster||t.viewId||t.customParameters){const{raster:e,viewId:s,customParameters:r}=t;l={raster:e,viewId:s,...l,...r}}}let r=t.url.replace(/(\/)+$/,"");if("version"in t&&t.version>=10.01){const e=r.indexOf("?");e>-1?r=r.substring(0,e)+"/legend"+r.substring(e):r+="/legend"}else{const e=r.toLowerCase().indexOf("/rest/"),t=r.substring(0,e)+r.substring(e+5,r.length);r=le+"?soapUrl="+encodeURI(t)+"&returnbytes=true"}return s(r,{query:l}).then((e=>e.data))}async _constructLegendElementsForBuildingSceneLayer(){this.legendElements=[],this._handles.remove("sublayers-watcher");const e=this.layer;this._handles.add(b(e,"sublayers",(()=>this._constructLegendElementsForBuildingSceneLayer())),"sublayers-watcher");try{this.legendElements=await this._generateLegendElementsForBuildingSublayers(e.sublayers,this.opacity),this.notifyChange("ready")}catch(t){te.warn("Request to server for legend has failed!",t)}}async _generateLegendElementsForBuildingSublayers(e,t){let l=[];this._handles.add(e.on("change",(()=>this._constructLegendElementsForBuildingSceneLayer())),"sublayers-watcher");const s=e.toArray();for(const r of s){const e=r.watch(["renderer","opacity","title","visible"],(()=>this._constructLegendElementsForBuildingSceneLayer()));if(this._handles.add(e,"sublayers-watcher"),!this.respectLayerVisibility||r.visible){const e=r&&null!=r.opacity?r.opacity:null,s=null!=e?e*t:t;if("building-group"===r.type){const e={type:"symbol-table",title:r.title,infos:[]},t=await this._generateLegendElementsForBuildingSublayers(r.sublayers,s);e.infos.push(...t),l=[e,...l]}else if(r.renderer){l=[...await this._getRendererLegendElements(r.renderer,{title:r.title,opacity:s,sublayer:r}),...l]}}}return l.filter((e=>!!e&&(!("infos"in e)||e.infos.length>0)))}async _constructLegendElementsForSublayers(){this.legendElements=[],this._handles.remove("sublayers-watcher");const e=this.layer;this._handles.add(b(e,"sublayers",(()=>this._constructLegendElementsForSublayers)),"sublayers-watcher");try{this.legendElements=await this._generateLegendElementsForSublayers(e.sublayers,this.opacity),this.notifyChange("ready")}catch(t){te.warn("Request to server for legend has failed!",t)}}async _generateLegendElementsForSublayers(e,t,l){const s=this.layer;let r=[];this._handles.add(e.on("change",(()=>this._constructLegendElementsForSublayers())),"sublayers-watcher");let n=e.toArray();!l&&this.sublayerIds&&this.sublayerIds.length&&(n=this.sublayerIds.map((e=>s.findSublayerById(e))).filter(Boolean));for(const i of n){const e=i.watch("renderer, opacity, title, visible, legendEnabled",(()=>this._constructLegendElementsForSublayers()));if(this._handles.add(e,"sublayers-watcher"),!this.respectLayerVisibility||i.visible&&i.legendEnabled&&this._isSublayerInScale(i)){const e=i&&null!=i.opacity?i.opacity:null,s=null!=e?e*t:t;if(i.renderer&&!i.sublayers&&i.originIdOf("renderer")>v.SERVICE){await i.load();r=[...await this._getRendererLegendElements(i.renderer,{title:i.title,opacity:s,sublayer:i}),...r]}else{const e=await this._generateSymbolTableElementForSublayer(i,s,l);e&&r.unshift(e)}}}return r.filter((e=>!!e&&(!("infos"in e)||e.infos.length>0)))}async _generateSymbolTableElementForSublayer(e,t,l){if(!l){l=new Map;const t=this.layer,s=e.source;let r=null;if(!(!s||"map-layer"===s.type&&s.mapLayerId===e.id&&(!s.gdbVersion||s.gdbVersion===("gdbVersion"in t&&t.gdbVersion)))||e.originIdOf("renderer")>v.SERVICE||e.originIdOf("labelingInfo")>v.SERVICE||e.originIdOf("labelsVisible")>v.SERVICE){const e=new E({layer:this.layer});r=e.hasDynamicLayers?e.dynamicLayers:null,e.destroy()}const n=r||`${t.uid}-default`;(await this._getLegendLayers(n,r)).forEach((e=>l.set(e.layerId,e)))}const s=l.get(e.id);if((!s||null!=s&&s.subLayerIds&&s.defaultVisibility)&&e.sublayers){const s=await this._generateLegendElementsForSublayers(e.sublayers,t,l);return{type:"symbol-table",title:e.title,infos:s}}return this._generateSymbolTableElementForLegendLayer(s,e,t)}_generateSymbolTableElementForLegendLayer(e,t,l){var s;if(!e||!e.legend||this.respectLayerVisibility&&!this._isLegendLayerInScale(e,t))return null;const r=null==t?void 0:t.renderer;let n=(null==t?void 0:t.title)||e.layerName;if(r&&(!t||(null==t?void 0:t.originIdOf("renderer"))>v.SERVICE)){const e=(null==t?void 0:t.title)||this._getRendererTitle(r,t);e&&(n&&"string"!=typeof e&&"title"in e&&(e.title=n),n=e)}const i={type:"symbol-table",title:n,legendType:e.legendType?e.legendType:null,infos:[]},a=t?this._sanitizeLegendForSublayer(e.legend.slice(),t):e.legend;return(null==(s=e.legendGroups)?void 0:s.length)>0?e.legendGroups.forEach((t=>{var s;const r={type:"symbol-table",title:t.heading,legendType:e.legendType?e.legendType:null,infos:this._generateSymbolTableElementInfosForLegendLayer(a.filter((e=>e.groupId===t.id)),e.layerId,l)};(null==(s=r.infos)?void 0:s.length)>0&&i.infos.push(r)})):i.infos=this._generateSymbolTableElementInfosForLegendLayer(a,e.layerId,l),i.infos.length>0?i:null}_generateSymbolTableElementInfosForLegendLayer(e,t,s){return e.map((e=>{let r=e.url;if(e.imageData&&e.imageData.length>0)r=`data:image/png;base64,${e.imageData}`;else{if(0===r.indexOf("http"))return null;r=l(`${this.layer.url}/${t}/images/${r}`)}return{label:e.label,src:r,opacity:null==s?this.opacity:s,width:e.width,height:e.height}})).filter((e=>!!e))}_isSublayerInScale(e){const t=e.minScale||0,l=e.maxScale||0;return!(t>0&&t<this.scale||l>this.scale)}_isLegendLayerInScale(e,t){const l=t||this.layer;let s=null,r=null,n=!0;return!l.minScale&&0!==l.minScale||!l.maxScale&&0!==l.maxScale?(0===e.minScale&&l.tileInfo&&(s=l.tileInfo.lods[0].scale),0===e.maxScale&&l.tileInfo&&(r=l.tileInfo.lods[l.tileInfo.lods.length-1].scale)):(s=Math.min(l.minScale,e.minScale)||l.minScale||e.minScale,r=Math.max(l.maxScale,e.maxScale)),(s>0&&s<this.scale||r>this.scale)&&(n=!1),n}_sanitizeLegendForSublayer(e,t){if("version"in this.layer&&this.layer.version<10.1||0===e.length)return e;const l=t.renderer,s=e.some((e=>e.values));let r=null,n=null;return s&&e.some(((e,t)=>(e.values||(r=t,n=e,n.label||(n.label="others")),null!=n))),l?"unique-value"===l.type?n&&(e.splice(r,1),e.push(n)):"class-breaks"===l.type&&(n&&e.splice(r,1),e.reverse(),n&&e.push(n)):n&&(e.splice(r,1),e.push(n)),e}async _getRendererLegendElements(e,t={}){return Ce(e,this.view)?_e(e)?this._constructPointCloudRendererLegendElements(e,t):Ie(e)?this._constructDotDensityRendererLegendElements(e):this._constructRendererLegendElements(e,t):(te.warn(`Renderer of type '${e.type}' not supported!`),[])}_getPointCloudRendererTitle(e){return e.legendOptions&&e.legendOptions.title||e.field}_constructPointCloudRendererLegendElements(e,t={}){const l=t.title,s=[];let r=null,n=null;if(we(e))r={type:"symbol-table",title:l||this._getPointCloudRendererTitle(e),infos:[]},e.colorClassBreakInfos.forEach((e=>{r.infos.unshift({label:e.label||e.minValue+" - "+e.maxValue,value:[e.minValue,e.maxValue],symbol:this._getAppliedCloneSymbol(ue,e.color)})}));else if(Le(e)){const t=e.stops;let s=null;if(t.length&&(1===t.length&&(s=t[0].color),!s)){const e=t[0].value,l=t[t.length-1].value;if(null!=e&&null!=l){s=P(e+(l-e)/2,t)}}r={type:"symbol-table",title:null,infos:[{label:null,value:null,symbol:this._getAppliedCloneSymbol(ue,s||ue.color)}]};const i=A(e.stops);n={type:"color-ramp",title:l||this._getPointCloudRendererTitle(e),infos:i,preview:x(i.map((e=>e.color)))}}else Ee(e)&&(r={type:"symbol-table",title:l||this._getPointCloudRendererTitle(e),infos:[]},e.colorUniqueValueInfos.forEach((e=>{r.infos.push({label:e.label||e.values.join(", "),value:e.values.join(", "),symbol:this._getAppliedCloneSymbol(ue,e.color)})})));r&&r.infos.length&&s.push(r),n&&n.infos.length&&s.push(n);const i=s.reduce(((e,t)=>e.concat(t.infos)),[]).filter((e=>!!e.symbol)).map((t=>this._getSymbolPreview(t,this.opacity,{symbolConfig:{applyColorModulation:!!e.colorModulation}})));return d(i).then((()=>s))}_getElementInfoForDotDensity(e,t){const{backgroundColor:l,outline:s,dotSize:r}=e,n=this.effectList,i=null==n?void 0:n.effects.map((e=>e.toJSON())),a=L(i),o=r+"-"+t+"-"+l+"-"+(s&&JSON.stringify(s.toJSON()))+"-"+a,u=this._dotDensityUrlCache,c=u.has(o)?u.get(o):j(e,t);u.set(o,c);const d={shape:{type:"image",x:0,y:0,width:c.width,height:c.height,src:c.src},fill:null,stroke:null,offset:[0,0]},y=z([[d]],[c.width,c.height],{effectView:this.effectList});return{opacity:1,src:c.src,preview:y,width:c.width,height:c.height}}_constructDotDensityRendererLegendElements(e){const t=e.calculateDotValue(this.view.scale),l=e.legendOptions&&e.legendOptions.unit,s={type:"symbol-table",title:{value:t&&Math.round(t),unit:l||""},infos:[]};return e.attributes.forEach((t=>{const l=this._getElementInfoForDotDensity(e,t.color);l.label=t.label||t.valueExpressionTitle||t.field,s.infos.push(l)})),Promise.resolve([s])}async _constructRendererLegendElements(e,t={}){const{title:l,sublayer:s}=t,r=s||this.layer;let n=await this._loadRenderer(e);this._hasColorRamp=!1,this._hasOpacityRamp=!1,this._hasSizeRamp=!1,this._scaleDrivenSizeVariable=null;const i=await this._getVisualVariableLegendElements(n,r)||[],a={type:"symbol-table",title:l||this._getRendererTitle(n,r),infos:[]};let o=null,c=!1;const y=new Set;if(de(n)&&!this._hasSizeRamp){const e=await H(n);a.infos.push({label:null,symbol:e})}else if(Ae(n)){let e=l;const t=Ue(n)?"univariate-above-and-below-ramp":"univariate-color-size-ramp",s=i.findIndex((e=>"color-ramp"===e.type)),r=-1!==s?i.splice(s,1)[0]:null,a=i.findIndex((e=>"size-ramp"===e.type)),o=-1!==a?i.splice(a,1)[0]:null,u=[];r&&(e=r.title,u.push(r)),o&&(e=o.title,u.push(o)),u.length>0&&i.push({type:t,title:e,infos:u})}else if(Se(n)){const e=k(n);i.push({type:"heatmap-ramp",title:l,infos:e,preview:x(e.map((e=>e.color)),{effectList:this.effectList})})}else if(be(n)){const e=n&&n.authoringInfo;if(e&&"relationship"===e.type){const{focus:t,numClasses:l,field1:s,field2:o}=e;if(l&&s&&o){const e=[s,o];let u=N(t)||0;for(const t of e){const{field:e,normalizationField:l,label:s}=t,n=s||{field:this._getFieldAlias(e,r),normField:l&&this._getFieldAlias(l,r)},i=Be.clone();i.angle=u,a.infos.push({label:n,symbol:i}),y.add(i),u+=90}const c=q({focus:t,numClasses:l,infos:n.uniqueValueInfos});i.unshift(c)}}else{const e=n.field;n.uniqueValueInfos.forEach((t=>{t.symbol&&a.infos.push({label:t.label||this._getDomainName(e,t.value,r)||t.value,value:t.value,symbol:t.symbol})}))}n.defaultSymbol&&(a.infos.push({label:n.defaultLabel||"others",symbol:n.defaultSymbol}),c=!0)}else if(ge(n)){o=this._isUnclassedRenderer(n);(!o||!this._hasSizeRamp)&&(n.classBreakInfos.forEach((e=>{e.symbol&&a.infos.unshift({label:e.label||(o?null:e.minValue+" - "+e.maxValue),value:[e.minValue,e.maxValue],symbol:e.symbol})})),o&&(a.title=null),this._updateInfosforClassedSizeRenderer(n,a.infos)),n.defaultSymbol&&!o&&(a.infos.push({label:n.defaultLabel||"others",symbol:n.defaultSymbol}),c=!0)}else if(me(n))if(De(this.layer)||Me(this.layer)){const e=this._constructTileImageryStretchRendererElements(n);Pe(e)?i.push(e):a.infos=e}else{const e=this.layer;let t,l;n.statistics&&n.statistics.length&&(t=null!=n.statistics[0].min?n.statistics[0].min:n.statistics[0][0],l=null!=n.statistics[0].max?n.statistics[0].max:n.statistics[0][1]);let s=[];const r=u(e.renderingRule?await e.generateRasterInfo(e.renderingRule):e.serviceRasterInfo),o=r.keyProperties.BandProperties,c=oe[e.rasterInfo.pixelType.toLowerCase()];1===r.bandCount||e.bandIds&&1===e.bandIds.length?(t=null!=t?t:r.statistics?r.statistics[e.bandIds[0]].min:c[0],l=null!=l?l:r.statistics?r.statistics[e.bandIds[0]].max:c[1],t||l?i.push(this._getStretchLegendElements(n,{min:t,max:l})):this._getServerSideLegend()):r.bandCount>=3?o&&o.length>=r.bandCount?e.bandIds&&3===e.bandIds.length?(s=e.bandIds.map((e=>o[e].BandName)),a.infos=this._createSymbolTableElementMultiBand(s)):"lerc"===e.format?(s=[0,1,2].map((e=>o[e].BandName)),a.infos=this._createSymbolTableElementMultiBand(s)):this._getServerSideLegend():"lerc"===e.format?(s=["band1","band2","band3"],a.infos=this._createSymbolTableElementMultiBand(s)):this._getServerSideLegend():this._getServerSideLegend()}else if(he(n))n.colormapInfos.forEach((e=>{a.infos.push({label:e.label,value:e.value,symbol:this._getAppliedCloneSymbol(ce,e.color)})}));else if(fe(n)){let e=n.symbol;switch(t.geometryType){case"point":e="pointSymbol"in r&&r.pointSymbol;break;case"polyline":e="lineSymbol"in r&&r.lineSymbol;break;case"polygon":e="polygonSymbol"in r&&r.polygonSymbol}n.symbol&&!this._hasSizeRamp&&a.infos.push({label:n.label,symbol:e})}else if(ye(n)){n.outputUnit&&(this.title="("+n.toJSON().outputUnit+")"),a.title=n.attributeField;const e=n.getClassBreakInfos();null!=e&&e.length?e.forEach((e=>{a.infos.push({label:e.minValue+" - "+e.maxValue,symbol:e.symbol})})):a.infos.push({label:n.attributeField,symbol:n.getDefaultSymbol()})}else pe(n)&&i.push(this._getStretchLegendElements(n,{min:0,max:255}));const h=n.defaultSymbol;!h||c||fe(n)||o&&!this._hasColorRamp&&!this._hasSizeRamp&&!this._hasOpacityRamp||i.push({type:"symbol-table",infos:[{label:n.defaultLabel||"others",symbol:h}]}),a.infos.length&&i.unshift(a);const m=null==t.opacity?this.opacity:t.opacity,p=this._isTallSymbol("visualVariables"in n&&n.visualVariables),f=Oe(this.layer)||De(this.layer),g=i.reduce(((e,t)=>e.concat(this._getAllInfos(t))),[]).filter((e=>!(null==e||!e.symbol))).map((e=>this._getSymbolPreview(e,m,{isDefault:e.symbol===h,applyScaleDrivenSize:!y.has(e.symbol),symbolConfig:{isTall:p,isSquareFill:f},effectList:y.has(e.symbol)?null:this.effectList})));return n=null,await d(g),i}_getServerSideLegend(){setTimeout((()=>this.buildLegendElementsForTools()),0)}_getAllInfos(e){const t=null==e?void 0:e.infos;return t?t.reduce(((e,t)=>e.concat(this._getAllInfos(t))),[]):[e]}_constructTileImageryStretchRendererElements(e){var t,l;const s=this.layer,r=s.rasterInfo,n=r.bandCount||e.statistics.length;let i,a,o=[];const u=r.keyProperties&&r.keyProperties.BandProperties,c=null!=e&&null!=(t=e.statistics)&&t.length?e.statistics:null==r?void 0:r.statistics;if(c)i=void 0!==c[0].min?c[0].min:c[0][0],a=c[0].max||c[0][1];else{const e=oe[s.rasterInfo.pixelType.toLowerCase()];i=e[0],a=e[1]}if(s.hasStandardTime()&&(i=s.getStandardTimeValue(i),a=s.getStandardTimeValue(a)),1===r.bandCount||1===(null==(l=s.bandIds)?void 0:l.length))return this._getStretchLegendElements(e,{min:i,max:a});function d(e){var t;const l=(null!=s&&null!=(t=s.bandIds)&&t.length?s.bandIds:Array.from(Array(Math.min(r.bandCount,3)).keys())).map((t=>e&&e[t]&&e[t].BandName||"band"+(t+1)));return l.length<3?l.push(l[1]):l.length>3&&l.splice(3),l}return o=u&&u.length>=n?d(u):d(),this._createSymbolTableElementMultiBand(o)}_getStretchLegendElements(e,t){const l=e.colorRamp,s=U(l,t);return{type:"stretch-ramp",title:"",infos:s,preview:x(s.map((e=>e.color)))}}async _getSizeLegendElement(e,t,l,s){return{type:"size-ramp",title:this._hasClusterSizeVariable?this._getClusterTitle(t):e,infos:await W(l,t,await X(l),this.scale,this.view.type,s)}}_createSymbolTableElementMultiBand(e){const t=[],l=["red","green","blue"];return e.forEach(((e,s)=>{t.push({label:{colorName:l[s],bandName:e},src:K[s],opacity:1})})),t}_updateInfosforClassedSizeRenderer(e,t){const l=e.authoringInfo&&"class-breaks-size"===e.authoringInfo.type,s=e.classBreakInfos.some((e=>D(e.symbol)));if(l&&s){const l=$,s=G,r=e.classBreakInfos.length,n=(l-s)/(r>1?r-1:r);t.forEach(((e,t)=>{e.size=l-n*t}))}}_isTallSymbol(e){let t=!1,l=!1;if(e)for(let s=0;s<e.length&&(!t||!l);s++){const r=e[s];"size"===r.type&&("height"===r.axis&&(t=!0),"width-and-depth"===r.axis&&(l=!0))}return t&&l}async _getSymbolPreview(e,t,l){let s=null!=l&&l.isDefault||null!=e.size||!this._hasSizeRamp?e.size:h(T.size);if(this._scaleDrivenSizeVariable&&null!=l&&l.applyScaleDrivenSize){const{getSize:t}=await import("../../../renderers/visualVariables/support/visualVariableUtils.js");s=t(this._scaleDrivenSizeVariable,null,{view:this.view.type,scale:this.scale,shape:"simple-marker"===e.symbol.type?e.symbol.style:null})}return O(e.symbol,{size:s,opacity:t,scale:!1,symbolConfig:null==l?void 0:l.symbolConfig,effectView:null==l?void 0:l.effectList}).then((t=>(e.preview=t,e))).catch((()=>(e.preview=null,e)))}async _loadRenderer(e){var t,l;const s=[],r=this.layer;e=e.clone(),this._hasClusterSizeVariable=!1;const n="visualVariables"in e&&(null==(t=e.visualVariables)?void 0:t.some((e=>"size"===e.type&&"outline"!==e.target&&!ie.test(e.valueExpression))));if(e&&"visualVariables"in e&&!n&&"featureReduction"in r&&"cluster"===(null==(l=r.featureReduction)?void 0:l.type)){const t=this.layerView._effectiveRenderer,l=u(M(t,this.view));if(l){const t=r.featureReduction;if("clusterMinSize"in t&&"clusterMaxSize"in t){const{clusterMinSize:e,clusterMaxSize:s}=t;l.legendOptions=new F({showLegend:e!==s})}const s=e.visualVariables||[];e.visualVariables=s.concat([l]),this._hasClusterSizeVariable=!0}}const i=await X(e);if(ge(e)||be(e)){const t=(e.classBreakInfos||e.uniqueValueInfos).map((e=>this._fetchSymbol(e.symbol,i).then((t=>{e.symbol=t})).catch((()=>{e.symbol=null}))));Array.prototype.push.apply(s,t)}return s.push(this._fetchSymbol(e.symbol||e.defaultSymbol,e.defaultSymbol?null:i).then((t=>{this._applySymbolToRenderer(e,t,fe(e))})).catch((()=>{this._applySymbolToRenderer(e,null,fe(e))}))),d(s).then((()=>e))}_applySymbolToRenderer(e,t,l){l?e.symbol=t:e.defaultSymbol=t}_fetchSymbol(e,t){if(!e)return Promise.reject();if("web-style"===e.type){const l=e.portal,s=l&&l.url,r=l&&l.user&&l.user.username,n=e.name+"-"+e.styleName+"-"+e.styleUrl+"-"+s+"-"+r,i=this._webStyleSymbolCache;return i.has(n)||("2d"===this.view.type?i.set(n,e.fetchCIMSymbol()):i.set(n,e.fetchSymbol())),i.get(n).then((e=>this._getAppliedCloneSymbol(e,t))).catch((()=>(te.warn("Fetching web-style failed!"),Promise.reject())))}return Promise.resolve(this._getAppliedCloneSymbol(e,t))}_getAppliedCloneSymbol(e,l){if(!e||!l)return e;const s=e.clone(),r=l&&l.toRgba();return s.type.indexOf("3d")>-1?this._applyColorTo3dSymbol(s,r):"cim"===s.type?V(s,l):s.color&&(s.color=new t(r||s.color)),s}_applyColorTo3dSymbol(e,l){l&&e.symbolLayers.forEach((e=>{e&&(e.material||(e.material={}),e.material.color=new t(l))}))}async _getVisualVariableLegendElements(e,t){if(!("visualVariables"in e)||!e.visualVariables||"vector-field"===e.type)return null;const l=e.visualVariables,s=[],r=[],n=[];for(const c of l)"color"===c.type?s.push(c):"size"===c.type?r.push(c):"opacity"===c.type&&n.push(c);const i=[...s,...r,...n];let a,o;if(0===s.length&&ge(e)&&e.classBreakInfos&&1===e.classBreakInfos.length){const t=e.classBreakInfos[0];a=t&&t.symbol}if(0===s.length&&fe(e)&&(a=e.symbol),a)if(a.type.indexOf("3d")>-1){const e=a.symbolLayers.getItemAt(0);"water"===e.type?c(e.color)&&(o=e.color):c(e.material)&&c(e.material.color)&&(o=e.material.color)}else a.url||(o=a.color);const u=this.effectList;return(await Promise.all(i.map((async l=>{if(!l.legendOptions||!1!==l.legendOptions.showLegend){const s=de(e)?l.field:this._getRampTitle(l,t);let r=null;const n="getField"in t&&t.getField&&t.getField(l.field),i=n&&I(n);if("color"===l.type){const e=await B(l,null,i);r={type:"color-ramp",title:s,infos:e,preview:x(e.map((e=>e.color)),{effectList:u})},this._hasColorRamp||(this._hasColorRamp=!(null==r.infos||!r.infos.length))}else if("size"===l.type&&"outline"!==l.target)ie.test(l.valueExpression)?this._hasClusterSizeVariable||(this._scaleDrivenSizeVariable=l):(r=await this._getSizeLegendElement(s,l,e,i),this._hasSizeRamp||(this._hasSizeRamp=!(null==r.infos||!r.infos.length)));else if("opacity"===l.type){const e=await B(l,o,i);r={type:"opacity-ramp",title:s,infos:e,preview:x(e.map((e=>e.color)),{effectList:u})},this._hasOpacityRamp||(this._hasOpacityRamp=!(null==r.infos||!r.infos.length))}return r&&r.infos?r:null}})))).filter((e=>!!e))}_getDomainName(e,t,l){if(e&&"function"!=typeof e){const s="getField"in l&&l.getField&&l.getField(e),r=s&&"getFieldDomain"in l&&l.getFieldDomain?l.getFieldDomain(s.name):null;return r&&"coded-value"===r.type?r.getName(t):null}return null}_getClusterTitle(e){const t=this.layer,l=e.field;if("featureReduction"in t&&t.featureReduction&&"cluster"===t.featureReduction.type){const e=t.featureReduction,s="popupTemplate"in e&&e.popupTemplate,r=s&&s.fieldInfos;if(r)for(const t of r)if(t.fieldName===l)return"cluster_count"===l?t.label||{showCount:!0}:t.label}return{showCount:!0}}_getRampTitle(e,t){let l=e.field,s=e.normalizationField,r=!1,n=!1,i=!1,a=null;l="function"==typeof l?null:l,s="function"==typeof s?null:s;const o=e.legendOptions&&e.legendOptions.title;if(null!=o)a=o;else if(e.valueExpressionTitle)a=e.valueExpressionTitle;else{if("renderer"in t&&t.renderer&&"authoringInfo"in t.renderer&&t.renderer.authoringInfo&&t.renderer.authoringInfo.visualVariables){const e=t.renderer.authoringInfo.visualVariables;for(let t=0;t<e.length;t++){const l=e[t];if("color"===l.type){if("ratio"===l.style){r=!0;break}if("percent"===l.style){n=!0;break}if("percent-of-total"===l.style){i=!0;break}}}}a={field:l&&this._getFieldAlias(l,t),normField:s&&this._getFieldAlias(s,t),ratio:r,ratioPercent:n,ratioPercentTotal:i}}return a}_getRendererTitle(e,t){const l=e;if(l.legendOptions&&l.legendOptions.title)return l.legendOptions.title;if(l.valueExpressionTitle)return l.valueExpressionTitle;let s=l.field,r=null,n=null;ge(l)&&(r=l.normalizationField,n="percent-of-total"===l.normalizationType),s="function"==typeof s?null:s,r="function"==typeof r?null:r;let i=null;return(s||r)&&(i={field:s&&this._getFieldAlias(s,t),normField:r&&this._getFieldAlias(r,t),normByPct:n}),i}_getFieldAlias(e,t){const l="popupTemplate"in t&&t.popupTemplate,s=l&&l.fieldInfos;let r=null;s&&s.some((t=>e===t.fieldName&&(r=t,!0)));let n=null;"getField"in t&&t.getField?n=t.getField(e):"fieldsIndex"in t&&t.fieldsIndex&&(n=t.fieldsIndex.get(e));const i=r||n;let a=null;return i&&(a=r&&r.label||n&&n.alias||"name"in i&&i.name||"fieldName"in i&&i.fieldName),a}_isUnclassedRenderer(e){const t=e.visualVariables;let l=!1;return ge(e)&&e.classBreakInfos&&1===e.classBreakInfos.length&&t&&(l=e.field?t.some((t=>!(!t||e.field!==t.field||(e.normalizationField||t.normalizationField)&&e.normalizationField!==t.normalizationField))):!!t.length),l}};e([S()],Ne.prototype,"children",void 0),e([S({readOnly:!0})],Ne.prototype,"effectList",null),e([S()],Ne.prototype,"layerView",void 0),e([S()],Ne.prototype,"layer",void 0),e([S()],Ne.prototype,"legendElements",void 0),e([S({readOnly:!0})],Ne.prototype,"opacity",null),e([S()],Ne.prototype,"parent",void 0),e([S({readOnly:!0,dependsOn:[]})],Ne.prototype,"ready",null),e([S()],Ne.prototype,"hideLayersNotInCurrentView",void 0),e([S()],Ne.prototype,"keepCacheOnDestroy",void 0),e([S()],Ne.prototype,"respectLayerVisibility",void 0),e([S({readOnly:!0})],Ne.prototype,"scale",null),e([S()],Ne.prototype,"sublayerIds",void 0),e([S({readOnly:!0})],Ne.prototype,"isScaleDriven",null),e([S()],Ne.prototype,"title",void 0),e([S({readOnly:!0,dependsOn:["ready"],value:0})],Ne.prototype,"version",null),e([S()],Ne.prototype,"view",void 0),Ne=e([_("esri.widgets.Legend.support.ActiveLayerInfo")],Ne);const qe=Ne;export{qe as default};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import{addTokenParameter as l}from"../../../kernel.js";import s from"../../../request.js";import"../../../symbols.js";import r from"../../../core/Accessor.js";import n from"../../../core/Collection.js";import i from"../../../core/Handles.js";import{JSONMap as a}from"../../../core/jsonMap.js";import o from"../../../core/Logger.js";import{unwrap as u,isSome as c}from"../../../core/maybe.js";import{eachAlways as d,debounce as y}from"../../../core/promiseUtils.js";import{px2pt as h}from"../../../core/screenUtils.js";import{addQueryParameters as m}from"../../../core/urlUtils.js";import{on as p,init as f,whenFalseOnce as g,watch as b}from"../../../core/watchUtils.js";import{property as S}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as _}from"../../../core/accessorSupport/decorators/subclass.js";import{OriginId as v}from"../../../core/accessorSupport/PropertyOrigin.js";import{EffectView as w}from"../../../layers/effects/EffectView.js";import{effectFunctionsFromJSON as L}from"../../../layers/effects/jsonUtils.js";import{ExportImageParameters as E}from"../../../layers/support/ExportImageParameters.js";import{isDateField as I}from"../../../layers/support/fieldUtils.js";import{fromJSON as C}from"../../../renderers/support/jsonUtils.js";import{isSupportedRenderer3D as R}from"../../../renderers/support/rendererConversion.js";import F from"../../../renderers/visualVariables/support/SizeVariableLegendOptions.js";import{applyCIMSymbolColor as V}from"../../../symbols/support/cimSymbolUtils.js";import{SymbolSizeDefaults as T}from"../../../symbols/support/previewUtils.js";import{renderSymbol as z}from"../../../symbols/support/renderUtils.js";import{renderColorRampPreviewHTML as x,renderDotDensityPreviewHTML as j,renderPreviewHTML as D}from"../../../symbols/support/symbolUtils.js";import{isVolumetricSymbol as O}from"../../../symbols/support/utils.js";import{getClusterSizeVariable as M}from"./clusterUtils.js";import{getColorFromPointCloudStops as P,getRampStopsForPointCloud as A,getStrectchRampStops as U,getRampStops as B}from"./colorRampUtils.js";import{getHeatmapRampStops as k}from"./heatmapRampUtils.js";import{getRotationAngleForFocus as N,getRelationshipRampElement as q}from"./relationshipRampUtils.js";import{getRampStops as W,REAL_WORLD_MAX_SIZE as $,REAL_WORLD_MIN_SIZE as G}from"./sizeRampUtils.js";import{SPECIAL_CHARS_LESS_THAN as J,SPECIAL_CHARS_GREATER_THAN as Q,getSymbolForFlowRenderer as H,getMedianColor as X,RGB_IMG_SOURCE as K}from"./utils.js";import{formatNumberLabel as Y}from"../../smartMapping/support/utils.js";import Z from"../../../symbols/SimpleMarkerSymbol.js";import ee from"../../../symbols/SimpleFillSymbol.js";const te=o.getLogger("esri.widgets.Legend.support.ActiveLayerInfo"),le="https://utility.arcgis.com/sharing/tools/legend",se="esri.layers.ImageryLayer",re="esri.layers.ImageryTileLayer",ne="esri.layers.WCSLayer",ie=/^\s*(return\s+)?\$view\.scale\s*(;)?\s*$/i,ae=new a({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon",esriGeometryMultiPatch:"multipatch"}),oe={u1:[0,1],u2:[0,3],u4:[0,15],u8:[0,255],s8:[-128,127],u16:[0,65535],s16:[-32768,32767],u32:[0,4294967295],s32:[-2147483648,2147483647],f32:[-34e38,34e38],f64:[-Number.MAX_VALUE,Number.MAX_VALUE]},ue=new Z({size:6,outline:{color:[128,128,128,.5],width:.5}}),ce=new ee({style:"solid"});function de(e){return"flow"===e.type}function ye(e){return"vector-field"===e.type}function he(e){return"raster-colormap"===e.type}function me(e){return"raster-stretch"===e.type}function pe(e){return"raster-shaded-relief"===e.type}function fe(e){return"esri.renderers.SimpleRenderer"===e.declaredClass}function ge(e){return"esri.renderers.ClassBreaksRenderer"===e.declaredClass}function be(e){return"esri.renderers.UniqueValueRenderer"===e.declaredClass}function Se(e){return"esri.renderers.HeatmapRenderer"===e.declaredClass}function _e(e){return we(e)||Le(e)||Ee(e)||ve(e)}function ve(e){return"esri.renderers.PointCloudRGBRenderer"===e.declaredClass}function we(e){return"esri.renderers.PointCloudClassBreaksRenderer"===e.declaredClass}function Le(e){return"esri.renderers.PointCloudStretchRenderer"===e.declaredClass}function Ee(e){return"esri.renderers.PointCloudUniqueValueRenderer"===e.declaredClass}function Ie(e){return"esri.renderers.DotDensityRenderer"===e.declaredClass}function Ce(e,t){return fe(e)||ge(e)||be(e)||Se(e)||Ie(e)?"2d"===t.type||R(e):me(e)||he(e)||pe(e)||we(e)||Le(e)||Ee(e)||ye(e)||de(e)}function Re(e){return"esri.layers.BuildingSceneLayer"===e.declaredClass}function Fe(e){return"esri.layers.VoxelLayer"===e.declaredClass}function Ve(e){return"esri.layers.WMSLayer"===e.declaredClass}function Te(e){return"esri.layers.WMTSLayer"===e.declaredClass}function ze(e){return"esri.layers.MapImageLayer"===e.declaredClass}function xe(e){return"esri.layers.TileLayer"===e.declaredClass}function je(e){return"esri.layers.FeatureLayer"===e.declaredClass}function De(e){return e.declaredClass===se}function Oe(e){return e.declaredClass===re}function Me(e){return e.declaredClass===ne}function Pe(e){return"stretch-ramp"===e.type}function Ae(e){const t="authoringInfo"in e&&(null==e?void 0:e.authoringInfo);return"univariate-color-size"===(null==t?void 0:t.type)}function Ue(e){const t="authoringInfo"in e&&(null==e?void 0:e.authoringInfo);return"univariate-color-size"===(null==t?void 0:t.type)&&"above-and-below"===(null==t?void 0:t.univariateTheme)}const Be=new Z({style:"path",path:"M10,5 L5,0 0,5 M5,0 L5,15",size:15,outline:{width:1,color:[85,85,85,1]}});let ke={},Ne=class extends r{constructor(e){super(e),this._handles=new i,this._hasColorRamp=!1,this._hasOpacityRamp=!1,this._hasSizeRamp=!1,this._webStyleSymbolCache=new Map,this._dotDensityUrlCache=new Map,this._scaleDrivenSizeVariable=null,this._hasClusterSizeVariable=!1,this.children=new n,this.layerView=null,this.layer=null,this.legendElements=[],this.parent=null,this.hideLayersNotInCurrentView=!1,this.keepCacheOnDestroy=!1,this.respectLayerVisibility=!0,this.sublayerIds=[],this.title=null,this.view=null}initialize(){const e=()=>this.notifyChange("ready");this._handles.add([p(this,"children","change",(t=>{const{added:l,removed:s}=t,r=this._handles;l.forEach((t=>{const l=`activeLayerInfo-ready-watcher-${t.layer.uid}`;r.add(f(t,"ready",e),l)})),s.forEach((e=>r.remove(e.layer.uid))),e()}))]),this.keepCacheOnDestroy||(ke={})}destroy(){this._handles.destroy(),this._handles=null,this._webStyleSymbolCache=null,this._dotDensityUrlCache=null,this._scaleDrivenSizeVariable=null,this.keepCacheOnDestroy||(ke=null)}get effectList(){const e=this.layer;let t=null;return"effect"in e&&e.effect&&(t=new w,t.effect=e.effect,t.end(),t.scale=this.scale),t}get opacity(){var e;const t=this.layer.opacity,l=null==(e=this.parent)?void 0:e.opacity,s=this.layer.parent,r=s&&"uid"in s?this._getParentLayerOpacity(s):null;return null!=l?l*t:null!=r?r*t:t}get ready(){return null===this.layer||(this.children.length>0?this._isGroupActive():this.legendElements.length>0)}get scale(){return this.view&&this.view.scale}get isScaleDriven(){const e=this.layer;if(null===e)return!1;if("effect"in e&&e.effect&&Array.isArray(e.effect))return!0;if("featureReduction"in e&&e.featureReduction&&"cluster"===e.featureReduction.type)return!0;if("renderer"in e&&e.renderer){if("dot-density"===e.renderer.type)return!0;const t=e.get("renderer.valueExpression");if(ie.test(t))return!0;const l=e.get("renderer.visualVariables");if(l)return l.some((e=>this._isScaleDrivenSizeVariable(e)))}return this._isLayerScaleDriven(this.layer)}get version(){return this._get("version")+1}async buildLegendElementsForFeatureCollections(e){if(!(!this.hideLayersNotInCurrentView||await this._isLayerInCurrentView()))return this.legendElements=[],void this.notifyChange("ready");const t=Array.from(e,(e=>{if(je(e))return this._getRendererLegendElements(e.renderer,{title:e.title});if(e.featureSet&&e.featureSet.features.length){const t=e.layerDefinition,l=t&&t.drawingInfo,s=l&&C(l.renderer),r=ae.read(t.geometryType);return s?this._getRendererLegendElements(s,{title:e.name,geometryType:r}):(te.warn("drawingInfo not available!"),null)}return null}));try{const e=[];await d(t).then((t=>{t.forEach((({value:t})=>t&&e.push(...t)))})),this.legendElements=e,this.notifyChange("ready")}catch(l){te.warn("error while building legend for layer!",l)}}async buildLegendElementsForRenderer(e){try{const t=!this.hideLayersNotInCurrentView||await this._isLayerInCurrentView();this.legendElements=t?await this._getRendererLegendElements(e):[],this.notifyChange("ready")}catch(t){te.warn("error while building legend for layer!",t)}}async buildLegendElementsForTools(){const e=this.layer;if(Fe(e))this._constructLegendElementsForVoxellayer();else if(Te(e))this._constructLegendElementsForWMTSlayer();else if(Ve(e))await this._constructLegendElementsForWMSSublayers();else if(Re(e))await this._constructLegendElementsForBuildingSceneLayer();else if(ze(e)||xe(e)||Re(e))await this._constructLegendElementsForSublayers();else{this._handles.remove("imageryLayers-watcher");let s="default";if(De(e)){var t,l;const r=e;s=((null==r||null==(t=r.renderingRule)?void 0:t.functionName)||"default")+"_"+(null!=(l=e.bandIds)&&l.length?e.bandIds.join(""):"###")}await this._getLegendLayers(`${e.uid}-${s}`).then((async t=>{this.legendElements=[],this.notifyChange("ready");const l=t.map((async t=>{if(De(e)||Oe(e)){const t=e.watch(["renderingRule","bandIds"],(()=>y((async()=>{ke.default=null,e.renderer?await this.buildLegendElementsForRenderer(e.renderer):await this.buildLegendElementsForTools()}))()));this._handles.add(t,"imageryLayers-watcher")}const l=this._generateSymbolTableElementForLegendLayer(t);l&&l.infos.length&&(De(e)&&(l.title=e.title),this.legendElements.push(l)),this.notifyChange("ready")}));await d(l)})).catch((e=>{te.warn("Request to server for legend has failed!",e)}))}}async _isLayerInCurrentView(){const e=this.layer,t=this.layerView,l=t&&"createQuery"in t&&"queryFeatureCount"in t;if(!l&&!(t&&"createQuery"in e&&"queryFeatureCount"in e))return!0;await g(t,"updating");const s=l?"createQuery"in t&&t.createQuery():"createQuery"in e&&e.createQuery();s.geometry=this.view.extent;return 0!==(l?"queryFeatureCount"in t&&await t.queryFeatureCount(s):"queryFeatureCount"in e&&await e.queryFeatureCount(s))}_getParentLayerOpacity(e){let t=1;const l=e.parent;return l&&"uid"in l&&(t=this._getParentLayerOpacity(l)),e.opacity*t}_isGroupActive(){const e=this.children;return!!e.length&&e.some((e=>e.ready))}_isScaleDrivenSizeVariable(e){if(e&&"size"!==e.type)return!1;const t=e,l=t.minSize,s=t.maxSize;return"object"==typeof l&&l?this._isScaleDrivenSizeVariable(l):"object"==typeof s&&s?this._isScaleDrivenSizeVariable(s):!!t.expression||ie.test(t.valueExpression)}_isLayerScaleDriven(e){if("minScale"in e&&e.minScale>0||"maxScale"in e&&e.maxScale>0)return!0;if("sublayers"in e&&e.sublayers)return e.sublayers.some((e=>this._isLayerScaleDriven(e)));const t=e.parent;if(!1===e.loaded&&t&&ze(t)&&"source"in e&&e.source&&"map-layer"===e.source.type)for(const l of t.sourceJSON.layers)if(l.id===e.source.mapLayerId&&(l.minScale>0||l.maxScale>0))return!0;return!1}async _constructLegendElementsForVoxellayer(){this.legendElements=[],this._handles.remove("voxel-style-watcher");const e=this.layer;this._handles.add(b(e,"style",(()=>this._constructLegendElementsForVoxellayer())),"voxel-style-watcher");const t=u(e.getVariableStyle(null)),l=[];var s;if(t)if(null!=(s=t.uniqueValues)&&s.length){const e=[];t.uniqueValues.forEach((t=>{t.enabled&&e.push({label:t.label||`${t.value}`,value:t.value,symbol:new ee({color:t.color,outline:null})})})),e.length&&l.push({type:"symbol-table",title:t.label,infos:e})}else if(t.transferFunction){const{colorStops:e,stretchRange:s}=t.transferFunction,r=e.toArray().reverse(),n=s.map(((e,t)=>`${0===t?J:Q} ${Y(e)}`)).reverse(),i=r.map((e=>({color:e.color,value:null,label:null})));i[0].label=n[0],i[i.length-1].label=n[1],l.push({type:"color-ramp",title:t.label,infos:i,preview:x(r.map((e=>e.color)))})}const r=e.opacity,n=l.reduce(((e,t)=>e.concat(this._getAllInfos(t))),[]).filter((e=>!(null==e||!e.symbol))).map((e=>this._getSymbolPreview(e,r)));await d(n),this.legendElements=l,this.notifyChange("ready")}_constructLegendElementsForWMTSlayer(){this.legendElements=[],this._handles.remove("wmts-activeLayer-watcher");const e=this.layer.activeLayer;if(this._handles.add(b(this.layer,"activeLayer",(()=>this._constructLegendElementsForWMTSlayer())),"wmts-activeLayer-watcher"),e.styleId&&e.styles){let t=null;e.styles.some((l=>e.styleId===l.id&&(t=l.legendUrl,!0))),t&&(this.legendElements=[{type:"symbol-table",title:e.title,infos:[{src:t,opacity:this.opacity}]}])}this.notifyChange("ready")}async _constructLegendElementsForWMSSublayers(){this.legendElements=[],this._handles.remove("wms-sublayers-watcher");const e=this.layer;let t=null;(e.customParameters||e.customLayerParameters)&&(t={...e.customParameters,...e.customLayerParameters}),this._handles.add(b(this.layer,"sublayers",(()=>this._constructLegendElementsForWMSSublayers())),"wms-sublayers-watcher"),this.legendElements=await this._generateLegendElementsForWMSSublayers(e.sublayers,t),this.notifyChange("ready")}async _generateLegendElementsForWMSSublayers(e,t){const l=[];this._handles.add(e.on("change",(()=>this._constructLegendElementsForWMSSublayers())),"wms-sublayers-watcher");const s=e.toArray();for(const r of s){const e=r.watch(["title","visible","legendEnabled"],(()=>this._constructLegendElementsForWMSSublayers()));if(this._handles.add(e,"wms-sublayers-watcher"),!this.respectLayerVisibility||r.visible&&r.legendEnabled){const e=await this._generateSymbolTableElementForWMSSublayer(r,t);e&&e.infos.length&&l.unshift(e)}}return l}async _generateSymbolTableElementForWMSSublayer(e,t){if(!e.legendUrl&&e.sublayers){const l=(await this._generateLegendElementsForWMSSublayers(e.sublayers,t)).filter((e=>e));return{type:"symbol-table",title:e.title,infos:l}}return this._generateSymbolTableElementForLegendUrl(e,t)}async _generateSymbolTableElementForLegendUrl(e,t){var l;let r=e.legendUrl;if(!r)return;const n={type:"symbol-table",title:e.title||e.name||e.id&&e.id+"",infos:[]};t&&(r=m(r,t));let i=null;const a=null==(l=e.layer)?void 0:l.opacity;try{i=(await s(r,{responseType:"image"})).data,i&&(i.style.opacity=a)}catch{}return n.infos.push({src:r,preview:i,opacity:a}),n}_getLegendLayers(e,t){const l=ke&&ke[e];return l?Promise.resolve(l):this._legendRequest(t).then((t=>{const l=t.layers;return ke[e]=l,l}))}_legendRequest(e){const t=this.layer;let l={f:"json",dynamicLayers:e};if(De(t)){const e=t.exportImageServiceParameters.renderingRule;if(e&&(l.renderingRule=JSON.stringify(e.rasterFunctionDefinition||e.toJSON())),t.bandIds&&(l.bandIds=t.bandIds.join()),t.raster||t.viewId||t.customParameters){const{raster:e,viewId:s,customParameters:r}=t;l={raster:e,viewId:s,...l,...r}}}let r=t.url.replace(/(\/)+$/,"");if("version"in t&&t.version>=10.01){const e=r.indexOf("?");e>-1?r=r.substring(0,e)+"/legend"+r.substring(e):r+="/legend"}else{const e=r.toLowerCase().indexOf("/rest/"),t=r.substring(0,e)+r.substring(e+5,r.length);r=le+"?soapUrl="+encodeURI(t)+"&returnbytes=true"}return s(r,{query:l}).then((e=>e.data))}async _constructLegendElementsForBuildingSceneLayer(){this.legendElements=[],this._handles.remove("sublayers-watcher");const e=this.layer;this._handles.add(b(e,"sublayers",(()=>this._constructLegendElementsForBuildingSceneLayer())),"sublayers-watcher");try{this.legendElements=await this._generateLegendElementsForBuildingSublayers(e.sublayers,this.opacity),this.notifyChange("ready")}catch(t){te.warn("Request to server for legend has failed!",t)}}async _generateLegendElementsForBuildingSublayers(e,t){let l=[];this._handles.add(e.on("change",(()=>this._constructLegendElementsForBuildingSceneLayer())),"sublayers-watcher");const s=e.toArray();for(const r of s){const e=r.watch(["renderer","opacity","title","visible"],(()=>this._constructLegendElementsForBuildingSceneLayer()));if(this._handles.add(e,"sublayers-watcher"),!this.respectLayerVisibility||r.visible){const e=r&&null!=r.opacity?r.opacity:null,s=null!=e?e*t:t;if("building-group"===r.type){const e={type:"symbol-table",title:r.title,infos:[]},t=await this._generateLegendElementsForBuildingSublayers(r.sublayers,s);e.infos.push(...t),l=[e,...l]}else if(r.renderer){l=[...await this._getRendererLegendElements(r.renderer,{title:r.title,opacity:s,sublayer:r}),...l]}}}return l.filter((e=>!!e&&(!("infos"in e)||e.infos.length>0)))}async _constructLegendElementsForSublayers(){this.legendElements=[],this._handles.remove("sublayers-watcher");const e=this.layer;this._handles.add(b(e,"sublayers",(()=>this._constructLegendElementsForSublayers)),"sublayers-watcher");try{this.legendElements=await this._generateLegendElementsForSublayers(e.sublayers,this.opacity),this.notifyChange("ready")}catch(t){te.warn("Request to server for legend has failed!",t)}}async _generateLegendElementsForSublayers(e,t,l){const s=this.layer;let r=[];this._handles.add(e.on("change",(()=>this._constructLegendElementsForSublayers())),"sublayers-watcher");let n=e.toArray();!l&&this.sublayerIds&&this.sublayerIds.length&&(n=this.sublayerIds.map((e=>s.findSublayerById(e))).filter(Boolean));for(const i of n){const e=i.watch("renderer, opacity, title, visible, legendEnabled",(()=>this._constructLegendElementsForSublayers()));if(this._handles.add(e,"sublayers-watcher"),!this.respectLayerVisibility||i.visible&&i.legendEnabled&&this._isSublayerInScale(i)){const e=i&&null!=i.opacity?i.opacity:null,s=null!=e?e*t:t;if(i.renderer&&!i.sublayers&&i.originIdOf("renderer")>v.SERVICE){await i.load();r=[...await this._getRendererLegendElements(i.renderer,{title:i.title,opacity:s,sublayer:i}),...r]}else{const e=await this._generateSymbolTableElementForSublayer(i,s,l);e&&r.unshift(e)}}}return r.filter((e=>!!e&&(!("infos"in e)||e.infos.length>0)))}async _generateSymbolTableElementForSublayer(e,t,l){if(!l){l=new Map;const t=this.layer,s=e.source;let r=null;if(!(!s||"map-layer"===s.type&&s.mapLayerId===e.id&&(!s.gdbVersion||s.gdbVersion===("gdbVersion"in t&&t.gdbVersion)))||e.originIdOf("renderer")>v.SERVICE||e.originIdOf("labelingInfo")>v.SERVICE||e.originIdOf("labelsVisible")>v.SERVICE){const e=new E({layer:this.layer});r=e.hasDynamicLayers?e.dynamicLayers:null,e.destroy()}const n=r||`${t.uid}-default`;(await this._getLegendLayers(n,r)).forEach((e=>l.set(e.layerId,e)))}const s=l.get(e.id);if((!s||null!=s&&s.subLayerIds&&s.defaultVisibility)&&e.sublayers){const s=await this._generateLegendElementsForSublayers(e.sublayers,t,l);return{type:"symbol-table",title:e.title,infos:s}}return this._generateSymbolTableElementForLegendLayer(s,e,t)}_generateSymbolTableElementForLegendLayer(e,t,l){var s;if(!e||!e.legend||this.respectLayerVisibility&&!this._isLegendLayerInScale(e,t))return null;const r=null==t?void 0:t.renderer;let n=(null==t?void 0:t.title)||e.layerName;if(r&&(!t||(null==t?void 0:t.originIdOf("renderer"))>v.SERVICE)){const e=(null==t?void 0:t.title)||this._getRendererTitle(r,t);e&&(n&&"string"!=typeof e&&"title"in e&&(e.title=n),n=e)}const i={type:"symbol-table",title:n,legendType:e.legendType?e.legendType:null,infos:[]},a=t?this._sanitizeLegendForSublayer(e.legend.slice(),t):e.legend;return(null==(s=e.legendGroups)?void 0:s.length)>0?e.legendGroups.forEach((t=>{var s;const r={type:"symbol-table",title:t.heading,legendType:e.legendType?e.legendType:null,infos:this._generateSymbolTableElementInfosForLegendLayer(a.filter((e=>e.groupId===t.id)),e.layerId,l)};(null==(s=r.infos)?void 0:s.length)>0&&i.infos.push(r)})):i.infos=this._generateSymbolTableElementInfosForLegendLayer(a,e.layerId,l),i.infos.length>0?i:null}_generateSymbolTableElementInfosForLegendLayer(e,t,s){return e.map((e=>{let r=e.url;if(e.imageData&&e.imageData.length>0)r=`data:image/png;base64,${e.imageData}`;else{if(0===r.indexOf("http"))return null;r=l(`${this.layer.url}/${t}/images/${r}`)}return{label:e.label,src:r,opacity:null==s?this.opacity:s,width:e.width,height:e.height}})).filter((e=>!!e))}_isSublayerInScale(e){const t=e.minScale||0,l=e.maxScale||0;return!(t>0&&t<this.scale||l>this.scale)}_isLegendLayerInScale(e,t){const l=t||this.layer;let s=null,r=null,n=!0;return!l.minScale&&0!==l.minScale||!l.maxScale&&0!==l.maxScale?(0===e.minScale&&l.tileInfo&&(s=l.tileInfo.lods[0].scale),0===e.maxScale&&l.tileInfo&&(r=l.tileInfo.lods[l.tileInfo.lods.length-1].scale)):(s=Math.min(l.minScale,e.minScale)||l.minScale||e.minScale,r=Math.max(l.maxScale,e.maxScale)),(s>0&&s<this.scale||r>this.scale)&&(n=!1),n}_sanitizeLegendForSublayer(e,t){if("version"in this.layer&&this.layer.version<10.1||0===e.length)return e;const l=t.renderer,s=e.some((e=>e.values));let r=null,n=null;return s&&e.some(((e,t)=>(e.values||(r=t,n=e,n.label||(n.label="others")),null!=n))),l?"unique-value"===l.type?n&&(e.splice(r,1),e.push(n)):"class-breaks"===l.type&&(n&&e.splice(r,1),e.reverse(),n&&e.push(n)):n&&(e.splice(r,1),e.push(n)),e}async _getRendererLegendElements(e,t={}){return Ce(e,this.view)?_e(e)?this._constructPointCloudRendererLegendElements(e,t):Ie(e)?this._constructDotDensityRendererLegendElements(e):this._constructRendererLegendElements(e,t):(te.warn(`Renderer of type '${e.type}' not supported!`),[])}_getPointCloudRendererTitle(e){return e.legendOptions&&e.legendOptions.title||e.field}_constructPointCloudRendererLegendElements(e,t={}){const l=t.title,s=[];let r=null,n=null;if(we(e))r={type:"symbol-table",title:l||this._getPointCloudRendererTitle(e),infos:[]},e.colorClassBreakInfos.forEach((e=>{r.infos.unshift({label:e.label||e.minValue+" - "+e.maxValue,value:[e.minValue,e.maxValue],symbol:this._getAppliedCloneSymbol(ue,e.color)})}));else if(Le(e)){const t=e.stops;let s=null;if(t.length&&(1===t.length&&(s=t[0].color),!s)){const e=t[0].value,l=t[t.length-1].value;if(null!=e&&null!=l){s=P(e+(l-e)/2,t)}}r={type:"symbol-table",title:null,infos:[{label:null,value:null,symbol:this._getAppliedCloneSymbol(ue,s||ue.color)}]};const i=A(e.stops);n={type:"color-ramp",title:l||this._getPointCloudRendererTitle(e),infos:i,preview:x(i.map((e=>e.color)))}}else Ee(e)&&(r={type:"symbol-table",title:l||this._getPointCloudRendererTitle(e),infos:[]},e.colorUniqueValueInfos.forEach((e=>{r.infos.push({label:e.label||e.values.join(", "),value:e.values.join(", "),symbol:this._getAppliedCloneSymbol(ue,e.color)})})));r&&r.infos.length&&s.push(r),n&&n.infos.length&&s.push(n);const i=s.reduce(((e,t)=>e.concat(t.infos)),[]).filter((e=>!!e.symbol)).map((t=>this._getSymbolPreview(t,this.opacity,{symbolConfig:{applyColorModulation:!!e.colorModulation}})));return d(i).then((()=>s))}_getElementInfoForDotDensity(e,t){const{backgroundColor:l,outline:s,dotSize:r}=e,n=this.effectList,i=null==n?void 0:n.effects.map((e=>e.toJSON())),a=L(i),o=r+"-"+t+"-"+l+"-"+(s&&JSON.stringify(s.toJSON()))+"-"+a,u=this._dotDensityUrlCache,c=u.has(o)?u.get(o):j(e,t);u.set(o,c);const d={shape:{type:"image",x:0,y:0,width:c.width,height:c.height,src:c.src},fill:null,stroke:null,offset:[0,0]},y=z([[d]],[c.width,c.height],{effectView:this.effectList});return{opacity:1,src:c.src,preview:y,width:c.width,height:c.height}}_constructDotDensityRendererLegendElements(e){const t=e.calculateDotValue(this.view.scale),l=e.legendOptions&&e.legendOptions.unit,s={type:"symbol-table",title:{value:t&&Math.round(t),unit:l||""},infos:[]};return e.attributes.forEach((t=>{const l=this._getElementInfoForDotDensity(e,t.color);l.label=t.label||t.valueExpressionTitle||t.field,s.infos.push(l)})),Promise.resolve([s])}async _constructRendererLegendElements(e,t={}){const{title:l,sublayer:s}=t,r=s||this.layer;let n=await this._loadRenderer(e);this._hasColorRamp=!1,this._hasOpacityRamp=!1,this._hasSizeRamp=!1,this._scaleDrivenSizeVariable=null;const i=await this._getVisualVariableLegendElements(n,r)||[],a={type:"symbol-table",title:l||this._getRendererTitle(n,r),infos:[]};let o=null,c=!1;const y=new Set;if(de(n)&&!this._hasSizeRamp){const e=await H(n);a.infos.push({label:null,symbol:e})}else if(Ae(n)){let e=l;const t=Ue(n)?"univariate-above-and-below-ramp":"univariate-color-size-ramp",s=i.findIndex((e=>"color-ramp"===e.type)),r=-1!==s?i.splice(s,1)[0]:null,a=i.findIndex((e=>"size-ramp"===e.type)),o=-1!==a?i.splice(a,1)[0]:null,u=[];r&&(e=r.title,u.push(r)),o&&(e=o.title,u.push(o)),u.length>0&&i.push({type:t,title:e,infos:u})}else if(Se(n)){const e=k(n);i.push({type:"heatmap-ramp",title:l,infos:e,preview:x(e.map((e=>e.color)),{effectList:this.effectList})})}else if(be(n)){const e=n&&n.authoringInfo;if(e&&"relationship"===e.type){const{focus:t,numClasses:l,field1:s,field2:o}=e;if(l&&s&&o){const e=[s,o];let u=N(t)||0;for(const t of e){const{field:e,normalizationField:l,label:s}=t,n=s||{field:this._getFieldAlias(e,r),normField:l&&this._getFieldAlias(l,r)},i=Be.clone();i.angle=u,a.infos.push({label:n,symbol:i}),y.add(i),u+=90}const c=q({focus:t,numClasses:l,infos:n.uniqueValueInfos});i.unshift(c)}}else{const e=n.field;n.uniqueValueInfos.forEach((t=>{t.symbol&&a.infos.push({label:t.label||this._getDomainName(e,t.value,r)||t.value,value:t.value,symbol:t.symbol})}))}n.defaultSymbol&&(a.infos.push({label:n.defaultLabel||"others",symbol:n.defaultSymbol}),c=!0)}else if(ge(n)){o=this._isUnclassedRenderer(n);(!o||!this._hasSizeRamp)&&(n.classBreakInfos.forEach((e=>{e.symbol&&a.infos.unshift({label:e.label||(o?null:e.minValue+" - "+e.maxValue),value:[e.minValue,e.maxValue],symbol:e.symbol})})),o&&(a.title=null),this._updateInfosforClassedSizeRenderer(n,a.infos)),n.defaultSymbol&&!o&&(a.infos.push({label:n.defaultLabel||"others",symbol:n.defaultSymbol}),c=!0)}else if(me(n))if(Oe(this.layer)||Me(this.layer)){const e=this._constructTileImageryStretchRendererElements(n);Pe(e)?i.push(e):a.infos=e}else{const e=this.layer;let t,l;n.statistics&&n.statistics.length&&(t=null!=n.statistics[0].min?n.statistics[0].min:n.statistics[0][0],l=null!=n.statistics[0].max?n.statistics[0].max:n.statistics[0][1]);let s=[];const r=u(e.renderingRule?await e.generateRasterInfo(e.renderingRule):e.serviceRasterInfo),o=r.keyProperties.BandProperties,c=oe[e.rasterInfo.pixelType.toLowerCase()];1===r.bandCount||e.bandIds&&1===e.bandIds.length?(t=null!=t?t:r.statistics?r.statistics[e.bandIds[0]].min:c[0],l=null!=l?l:r.statistics?r.statistics[e.bandIds[0]].max:c[1],t||l?i.push(this._getStretchLegendElements(n,{min:t,max:l})):this._getServerSideLegend()):r.bandCount>=3?o&&o.length>=r.bandCount?e.bandIds&&3===e.bandIds.length?(s=e.bandIds.map((e=>o[e].BandName)),a.infos=this._createSymbolTableElementMultiBand(s)):"lerc"===e.format?(s=[0,1,2].map((e=>o[e].BandName)),a.infos=this._createSymbolTableElementMultiBand(s)):this._getServerSideLegend():"lerc"===e.format?(s=["band1","band2","band3"],a.infos=this._createSymbolTableElementMultiBand(s)):this._getServerSideLegend():this._getServerSideLegend()}else if(he(n))n.colormapInfos.forEach((e=>{a.infos.push({label:e.label,value:e.value,symbol:this._getAppliedCloneSymbol(ce,e.color)})}));else if(fe(n)){let e=n.symbol;switch(t.geometryType){case"point":e="pointSymbol"in r&&r.pointSymbol;break;case"polyline":e="lineSymbol"in r&&r.lineSymbol;break;case"polygon":e="polygonSymbol"in r&&r.polygonSymbol}n.symbol&&!this._hasSizeRamp&&a.infos.push({label:n.label,symbol:e})}else if(ye(n)){n.outputUnit&&(this.title="("+n.toJSON().outputUnit+")"),a.title=n.attributeField;const e=n.getClassBreakInfos();null!=e&&e.length?e.forEach((e=>{a.infos.push({label:e.minValue+" - "+e.maxValue,symbol:e.symbol})})):a.infos.push({label:n.attributeField,symbol:n.getDefaultSymbol()})}else pe(n)&&i.push(this._getStretchLegendElements(n,{min:0,max:255}));const h=n.defaultSymbol;!h||c||fe(n)||o&&!this._hasColorRamp&&!this._hasSizeRamp&&!this._hasOpacityRamp||i.push({type:"symbol-table",infos:[{label:n.defaultLabel||"others",symbol:h}]}),a.infos.length&&i.unshift(a);const m=null==t.opacity?this.opacity:t.opacity,p=this._isTallSymbol("visualVariables"in n&&n.visualVariables),f=De(this.layer)||Oe(this.layer),g=i.reduce(((e,t)=>e.concat(this._getAllInfos(t))),[]).filter((e=>!(null==e||!e.symbol))).map((e=>this._getSymbolPreview(e,m,{isDefault:e.symbol===h,applyScaleDrivenSize:!y.has(e.symbol),symbolConfig:{isTall:p,isSquareFill:f},effectList:y.has(e.symbol)?null:this.effectList})));return n=null,await d(g),i}_getServerSideLegend(){setTimeout((()=>this.buildLegendElementsForTools()),0)}_getAllInfos(e){const t=null==e?void 0:e.infos;return t?t.reduce(((e,t)=>e.concat(this._getAllInfos(t))),[]):[e]}_constructTileImageryStretchRendererElements(e){var t,l;const s=this.layer,r=s.rasterInfo,n=r.bandCount||e.statistics.length;let i,a,o=[];const u=r.keyProperties&&r.keyProperties.BandProperties,c=null!=e&&null!=(t=e.statistics)&&t.length?e.statistics:null==r?void 0:r.statistics;if(c)i=void 0!==c[0].min?c[0].min:c[0][0],a=c[0].max||c[0][1];else{const e=oe[s.rasterInfo.pixelType.toLowerCase()];i=e[0],a=e[1]}if(s.hasStandardTime()&&(i=s.getStandardTimeValue(i),a=s.getStandardTimeValue(a)),1===r.bandCount||1===(null==(l=s.bandIds)?void 0:l.length))return this._getStretchLegendElements(e,{min:i,max:a});function d(e){var t;const l=(null!=s&&null!=(t=s.bandIds)&&t.length?s.bandIds:Array.from(Array(Math.min(r.bandCount,3)).keys())).map((t=>e&&e[t]&&e[t].BandName||"band"+(t+1)));return l.length<3?l.push(l[1]):l.length>3&&l.splice(3),l}return o=u&&u.length>=n?d(u):d(),this._createSymbolTableElementMultiBand(o)}_getStretchLegendElements(e,t){const l=e.colorRamp,s=U(l,t);return{type:"stretch-ramp",title:"",infos:s,preview:x(s.map((e=>e.color)))}}async _getSizeLegendElement(e,t,l,s){return{type:"size-ramp",title:this._hasClusterSizeVariable?this._getClusterTitle(t):e,infos:await W(l,t,await X(l),this.scale,this.view.type,s)}}_createSymbolTableElementMultiBand(e){const t=[],l=["red","green","blue"];return e.forEach(((e,s)=>{t.push({label:{colorName:l[s],bandName:e},src:K[s],opacity:1})})),t}_updateInfosforClassedSizeRenderer(e,t){const l=e.authoringInfo&&"class-breaks-size"===e.authoringInfo.type,s=e.classBreakInfos.some((e=>O(e.symbol)));if(l&&s){const l=$,s=G,r=e.classBreakInfos.length,n=(l-s)/(r>1?r-1:r);t.forEach(((e,t)=>{e.size=l-n*t}))}}_isTallSymbol(e){let t=!1,l=!1;if(e)for(let s=0;s<e.length&&(!t||!l);s++){const r=e[s];"size"===r.type&&("height"===r.axis&&(t=!0),"width-and-depth"===r.axis&&(l=!0))}return t&&l}async _getSymbolPreview(e,t,l){let s=null!=l&&l.isDefault||null!=e.size||!this._hasSizeRamp?e.size:h(T.size);if(this._scaleDrivenSizeVariable&&null!=l&&l.applyScaleDrivenSize){const{getSize:t}=await import("../../../renderers/visualVariables/support/visualVariableUtils.js");s=t(this._scaleDrivenSizeVariable,null,{view:this.view.type,scale:this.scale,shape:"simple-marker"===e.symbol.type?e.symbol.style:null})}return D(e.symbol,{size:s,opacity:t,scale:!1,symbolConfig:null==l?void 0:l.symbolConfig,effectView:null==l?void 0:l.effectList}).then((t=>(e.preview=t,e))).catch((()=>(e.preview=null,e)))}async _loadRenderer(e){var t,l;const s=[],r=this.layer;e=e.clone(),this._hasClusterSizeVariable=!1;const n="visualVariables"in e&&(null==(t=e.visualVariables)?void 0:t.some((e=>"size"===e.type&&"outline"!==e.target&&!ie.test(e.valueExpression))));if(e&&"visualVariables"in e&&!n&&"featureReduction"in r&&"cluster"===(null==(l=r.featureReduction)?void 0:l.type)){const t=this.layerView._effectiveRenderer,l=u(M(t,this.view));if(l){const t=r.featureReduction;if("clusterMinSize"in t&&"clusterMaxSize"in t){const{clusterMinSize:e,clusterMaxSize:s}=t;l.legendOptions=new F({showLegend:e!==s})}const s=e.visualVariables||[];e.visualVariables=s.concat([l]),this._hasClusterSizeVariable=!0}}const i=await X(e);if(ge(e)||be(e)){const t=(e.classBreakInfos||e.uniqueValueInfos).map((e=>this._fetchSymbol(e.symbol,i).then((t=>{e.symbol=t})).catch((()=>{e.symbol=null}))));Array.prototype.push.apply(s,t)}return s.push(this._fetchSymbol(e.symbol||e.defaultSymbol,e.defaultSymbol?null:i).then((t=>{this._applySymbolToRenderer(e,t,fe(e))})).catch((()=>{this._applySymbolToRenderer(e,null,fe(e))}))),d(s).then((()=>e))}_applySymbolToRenderer(e,t,l){l?e.symbol=t:e.defaultSymbol=t}_fetchSymbol(e,t){if(!e)return Promise.reject();if("web-style"===e.type){const l=e.portal,s=l&&l.url,r=l&&l.user&&l.user.username,n=e.name+"-"+e.styleName+"-"+e.styleUrl+"-"+s+"-"+r,i=this._webStyleSymbolCache;return i.has(n)||("2d"===this.view.type?i.set(n,e.fetchCIMSymbol()):i.set(n,e.fetchSymbol())),i.get(n).then((e=>this._getAppliedCloneSymbol(e,t))).catch((()=>{throw te.warn("Fetching web-style failed!"),new Error}))}return Promise.resolve(this._getAppliedCloneSymbol(e,t))}_getAppliedCloneSymbol(e,l){if(!e||!l)return e;const s=e.clone(),r=l&&l.toRgba();return s.type.includes("3d")?this._applyColorTo3dSymbol(s,r):"cim"===s.type?V(s,l):s.color&&(s.color=new t(r||s.color)),s}_applyColorTo3dSymbol(e,l){l&&e.symbolLayers.forEach((e=>{e&&(e.material||(e.material={}),e.material.color=new t(l))}))}async _getVisualVariableLegendElements(e,t){if(!("visualVariables"in e)||!e.visualVariables||"vector-field"===e.type)return null;const l=e.visualVariables,s=[],r=[],n=[];for(const c of l)"color"===c.type?s.push(c):"size"===c.type?r.push(c):"opacity"===c.type&&n.push(c);const i=[...s,...r,...n];let a,o;if(0===s.length&&ge(e)&&e.classBreakInfos&&1===e.classBreakInfos.length){const t=e.classBreakInfos[0];a=t&&t.symbol}if(0===s.length&&fe(e)&&(a=e.symbol),a)if(a.type.includes("3d")){const e=a.symbolLayers.getItemAt(0);"water"===e.type?c(e.color)&&(o=e.color):c(e.material)&&c(e.material.color)&&(o=e.material.color)}else a.url||(o=a.color);const u=this.effectList;return(await Promise.all(i.map((async l=>{if(!l.legendOptions||!1!==l.legendOptions.showLegend){const s=de(e)?l.field:this._getRampTitle(l,t);let r=null;const n="getField"in t&&t.getField&&t.getField(l.field),i=n&&I(n);if("color"===l.type){const e=await B(l,null,i);r={type:"color-ramp",title:s,infos:e,preview:x(e.map((e=>e.color)),{effectList:u})},this._hasColorRamp||(this._hasColorRamp=!(null==r.infos||!r.infos.length))}else if("size"===l.type&&"outline"!==l.target)ie.test(l.valueExpression)?this._hasClusterSizeVariable||(this._scaleDrivenSizeVariable=l):(r=await this._getSizeLegendElement(s,l,e,i),this._hasSizeRamp||(this._hasSizeRamp=!(null==r.infos||!r.infos.length)));else if("opacity"===l.type){const e=await B(l,o,i);r={type:"opacity-ramp",title:s,infos:e,preview:x(e.map((e=>e.color)),{effectList:u})},this._hasOpacityRamp||(this._hasOpacityRamp=!(null==r.infos||!r.infos.length))}return r&&r.infos?r:null}})))).filter((e=>!!e))}_getDomainName(e,t,l){if(e&&"function"!=typeof e){const s="getField"in l&&l.getField&&l.getField(e),r=s&&"getFieldDomain"in l&&l.getFieldDomain?l.getFieldDomain(s.name):null;return r&&"coded-value"===r.type?r.getName(t):null}return null}_getClusterTitle(e){const t=this.layer,l=e.field;if("featureReduction"in t&&t.featureReduction&&"cluster"===t.featureReduction.type){const e=t.featureReduction,s="popupTemplate"in e&&e.popupTemplate,r=s&&s.fieldInfos;if(r)for(const t of r)if(t.fieldName===l)return"cluster_count"===l?t.label||{showCount:!0}:t.label}return{showCount:!0}}_getRampTitle(e,t){let l=e.field,s=e.normalizationField,r=!1,n=!1,i=!1,a=null;l="function"==typeof l?null:l,s="function"==typeof s?null:s;const o=e.legendOptions&&e.legendOptions.title;if(null!=o)a=o;else if(e.valueExpressionTitle)a=e.valueExpressionTitle;else{if("renderer"in t&&t.renderer&&"authoringInfo"in t.renderer&&t.renderer.authoringInfo&&t.renderer.authoringInfo.visualVariables){const e=t.renderer.authoringInfo.visualVariables;for(let t=0;t<e.length;t++){const l=e[t];if("color"===l.type){if("ratio"===l.style){r=!0;break}if("percent"===l.style){n=!0;break}if("percent-of-total"===l.style){i=!0;break}}}}a={field:l&&this._getFieldAlias(l,t),normField:s&&this._getFieldAlias(s,t),ratio:r,ratioPercent:n,ratioPercentTotal:i}}return a}_getRendererTitle(e,t){const l=e;if(l.legendOptions&&l.legendOptions.title)return l.legendOptions.title;if(l.valueExpressionTitle)return l.valueExpressionTitle;let s=l.field,r=null,n=null;ge(l)&&(r=l.normalizationField,n="percent-of-total"===l.normalizationType),s="function"==typeof s?null:s,r="function"==typeof r?null:r;let i=null;return(s||r)&&(i={field:s&&this._getFieldAlias(s,t),normField:r&&this._getFieldAlias(r,t),normByPct:n}),i}_getFieldAlias(e,t){const l="popupTemplate"in t&&t.popupTemplate,s=l&&l.fieldInfos;let r=null;s&&s.some((t=>e===t.fieldName&&(r=t,!0)));let n=null;"getField"in t&&t.getField?n=t.getField(e):"fieldsIndex"in t&&t.fieldsIndex&&(n=t.fieldsIndex.get(e));const i=r||n;let a=null;return i&&(a=r&&r.label||n&&n.alias||"name"in i&&i.name||"fieldName"in i&&i.fieldName),a}_isUnclassedRenderer(e){const t=e.visualVariables;let l=!1;return ge(e)&&e.classBreakInfos&&1===e.classBreakInfos.length&&t&&(l=e.field?t.some((t=>!(!t||e.field!==t.field||(e.normalizationField||t.normalizationField)&&e.normalizationField!==t.normalizationField))):!!t.length),l}};e([S()],Ne.prototype,"children",void 0),e([S({readOnly:!0})],Ne.prototype,"effectList",null),e([S()],Ne.prototype,"layerView",void 0),e([S()],Ne.prototype,"layer",void 0),e([S()],Ne.prototype,"legendElements",void 0),e([S({readOnly:!0})],Ne.prototype,"opacity",null),e([S()],Ne.prototype,"parent",void 0),e([S({readOnly:!0,dependsOn:[]})],Ne.prototype,"ready",null),e([S()],Ne.prototype,"hideLayersNotInCurrentView",void 0),e([S()],Ne.prototype,"keepCacheOnDestroy",void 0),e([S()],Ne.prototype,"respectLayerVisibility",void 0),e([S({readOnly:!0})],Ne.prototype,"scale",null),e([S()],Ne.prototype,"sublayerIds",void 0),e([S({readOnly:!0})],Ne.prototype,"isScaleDriven",null),e([S()],Ne.prototype,"title",void 0),e([S({readOnly:!0,dependsOn:["ready"],value:0})],Ne.prototype,"version",null),e([S()],Ne.prototype,"view",void 0),Ne=e([_("esri.widgets.Legend.support.ActiveLayerInfo")],Ne);const qe=Ne;export{qe 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 l from"../../../Color.js";import{createStopLabel as e}from"./utils.js";const o=new l([64,64,64]);function n(l,o){const n=[],r=l.length-1;return 5===l.length?n.push(0,2,4):n.push(0,r),l.map(((l,t)=>n.
|
|
5
|
+
import l from"../../../Color.js";import{createStopLabel as e}from"./utils.js";const o=new l([64,64,64]);function n(l,o){const n=[],r=l.length-1;return 5===l.length?n.push(0,2,4):n.push(0,r),l.map(((l,t)=>n.includes(t)?e(l,t,r,o):null))}async function r(l,e,o){let r=!1,a=[],u=[];if(l.stops){const e=l.stops;a=e.map((l=>l.value)),r=e.some((l=>!!l.label)),r&&(u=e.map((l=>l.label)))}const s=a[0],i=a[a.length-1];if(null==s&&null==i)return null;const c=r?null:n(a,o);return(await Promise.all(a.map((async(o,n)=>({value:o,color:"opacity"===l.type?await t(o,l,e):(await import("../../../renderers/visualVariables/support/visualVariableUtils.js")).getColor(l,o),label:r?u[n]:c[n]}))))).reverse()}async function t(e,n,r=o){const t=new l(r),a=(await import("../../../renderers/visualVariables/support/visualVariableUtils.js")).getOpacity(n,e);return null!=a&&(t.a=a),t}function a(l){let e=!1,o=[],r=[];o=l.map((l=>l.value)),e=l.some((l=>!!l.label)),e&&(r=l.map((l=>l.label)));const t=o[0],a=o[o.length-1];if(null==t&&null==a)return null;const s=e?null:n(o,!1);return o.map(((o,n)=>({value:o,color:u(o,l),label:e?r[n]:s[n]}))).reverse()}function u(e,o){const{startIndex:n,endIndex:r,weight:t}=s(e,o);if(n===r)return o[n].color;const a=l.blendColors(o[n].color,o[r].color,t);return new l(a)}function s(l,e){let o=0,n=e.length-1;return e.some(((e,r)=>l<e.value?(n=r,!0):(o=r,!1))),{startIndex:o,endIndex:n,weight:(l-e[o].value)/(e[n].value-e[o].value)}}function i(e,o){let n=[];if(e&&"multipart"===e.type)e.colorRamps.reverse().forEach((function(r,t){0===t?n.push({value:o.max,color:new l(r.toColor),label:"high"}):n.push({value:null,color:new l(r.toColor),label:""}),t===e.colorRamps.length-1?n.push({value:o.min,color:new l(r.fromColor),label:"low"}):n.push({value:null,color:new l(r.fromColor),label:""})}));else{let r,t;e&&"algorithmic"===e.type?(r=e.fromColor,t=e.toColor):(r=[0,0,0,1],t=[255,255,255,1]),n=[{value:o.max,color:new l(t),label:"high"},{value:o.min,color:new l(r),label:"low"}]}return n}export{u as getColorFromPointCloudStops,r as getRampStops,a as getRampStopsForPointCloud,i as getStrectchRampStops};
|
|
@@ -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{clone as t}from"../../../core/lang.js";import{getStroke as e,getFill as o}from"../../../symbols/support/gfxUtils.js";import{getSymbolLayerFill as r}from"../../../symbols/support/previewSymbol3D.js";const s={HH:315,HL:45,LL:135,LH:225},l={2:[["HL","HH"],["LL","LH"]],3:[["HL","HM","HH"],["ML","MM","MH"],["LL","LM","LH"]],4:[["HL","HM1","HM2","HH"],["M2L","M2M1","M2M2","M2H"],["M1L","M1M1","M1M2","M1H"],["LL","LM1","LM2","LH"]]};function n(t){if(!t)return;const{type:s}=t;if(s.
|
|
5
|
+
import{clone as t}from"../../../core/lang.js";import{getStroke as e,getFill as o}from"../../../symbols/support/gfxUtils.js";import{getSymbolLayerFill as r}from"../../../symbols/support/previewSymbol3D.js";const s={HH:315,HL:45,LL:135,LH:225},l={2:[["HL","HH"],["LL","LH"]],3:[["HL","HM","HH"],["ML","MM","MH"],["LL","LM","LH"]],4:[["HL","HM1","HM2","HH"],["M2L","M2M1","M2M2","M2H"],["M1L","M1M1","M1M2","M1H"],["LL","LM1","LM2","LH"]]};function n(t){if(!t)return;const{type:s}=t;if(s.includes("3d"))return r(t.symbolLayers.getItemAt(0));if("simple-line"===s){const o=e(t);return o&&o.color}if("simple-marker"===t.type&&("x"===t.style||"cross"===t.style)){const o=e(t);return o&&o.color}return o(t)}function H(t,e){const o=e.HH.label,r=e.LL.label,s=e.HL.label,l=e.LH.label;switch(t){case"HH":default:return{top:o,bottom:r,left:s,right:l};case"HL":return{top:s,bottom:l,left:r,right:o};case"LL":return{top:r,bottom:o,left:l,right:s};case"LH":return{top:l,bottom:s,left:o,right:r}}}function L(e,o){const r=[],s=e.length**.5,l=t(e),n=(o||"HH").split(""),H=n[0],L="H"===n[1];for(;l.length;){const t=[];for(;t.length<s;)t.push(l.shift());L&&t.reverse(),r.push(t)}return"L"===H&&r.reverse(),r}function i(t){const{focus:e,infos:o,numClasses:r}=t,s=l[r],L={};o.forEach((t=>{L[t.value]={label:t.label,fill:n(t.symbol)}}));const i=[];for(let l=0;l<r;l++){const t=[];for(let e=0;e<r;e++){const o=L[s[l][e]];t.push(o.fill)}i.push(t)}return{type:"relationship-ramp",numClasses:r,focus:e,colors:i,labels:H(e,L),rotation:u(e)}}function u(t){let e=s[t];return t&&null==e&&(e=s.HH),e||0}export{L as getRelationshipRampColors2D,i as getRelationshipRampElement,u as getRotationAngleForFocus};
|