@arcgis/core 5.0.0-next.67 → 5.0.0-next.68
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/analysis/ElevationProfile/ElevationProfileLineViewOptions.d.ts +9 -6
- package/analysis/ElevationProfile/ElevationProfileLineViewOptions.js +1 -1
- package/arcade/arcadeAsyncRuntime.js +1 -1
- package/arcade/arcadeCompiler.js +1 -1
- package/arcade/arcadeRuntime.js +1 -1
- package/arcade/batchExec.js +1 -1
- package/arcade/compilerUtils.js +1 -1
- package/arcade/featureset/actions/SpatialFilter.js +1 -1
- package/arcade/geometry/unitConversion.js +1 -1
- package/arcade/treeAnalysis.js +1 -1
- package/arcade.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{251eb6e00f99a816d55c.js → 0326314947734b8e640a.js} +1 -1
- package/assets/esri/core/workers/chunks/04176244b0a3539c9681.js +1 -0
- package/assets/esri/core/workers/chunks/{942fad4ec96295672ce8.js → 10e474d664b20adcd917.js} +1 -1
- package/assets/esri/core/workers/chunks/12f9a55253084a910b2e.js +1 -0
- package/assets/esri/core/workers/chunks/{0629087bd5bb8048493e.js → 14dedd80fb797303f91f.js} +1 -1
- package/assets/esri/core/workers/chunks/{81d89107ff82604a3ea0.js → 1b445981fbc8373f4dd8.js} +1 -1
- package/assets/esri/core/workers/chunks/{6ba3c2b9f699d94d62b8.js → 1ec1a1997b5577619040.js} +1 -1
- package/assets/esri/core/workers/chunks/2085084324cd5a81783f.js +1 -0
- package/assets/esri/core/workers/chunks/2c2c0f66cffc521df736.js +1 -0
- package/assets/esri/core/workers/chunks/2dd347aa2a061d536e69.js +1 -0
- package/assets/esri/core/workers/chunks/2dfa7abf2d39fa5a3874.js +1 -0
- package/assets/esri/core/workers/chunks/322085d63719da6e443c.js +1 -0
- package/assets/esri/core/workers/chunks/{76086517591d0eb35156.js → 34a2e0462eb05986cdd1.js} +1 -1
- package/assets/esri/core/workers/chunks/{a6dcd13c792b6538ac50.js → 35593a9790818b689455.js} +1 -1
- package/assets/esri/core/workers/chunks/3a04153ca9d8e4f01185.js +1 -0
- package/assets/esri/core/workers/chunks/{4e9a8fce55cad841c731.js → 3b25f5d9c8f78bb6e011.js} +1 -1
- package/assets/esri/core/workers/chunks/3e7ea06b342e33bc48a5.js +1 -0
- package/assets/esri/core/workers/chunks/3ed317900f0edf635508.js +1 -0
- package/assets/esri/core/workers/chunks/401ce5cb98fa14c1a725.js +1 -0
- package/assets/esri/core/workers/chunks/4319b89cfa02894a8cae.js +1 -0
- package/assets/esri/core/workers/chunks/4a060147d25929680ec8.js +1 -0
- package/assets/esri/core/workers/chunks/{7bed14d9bcd7fc5e2eec.js → 4bcd74951477e8977ba1.js} +1 -1
- package/assets/esri/core/workers/chunks/4d0eaeb4cd6cd55e25fd.js +1 -0
- package/assets/esri/core/workers/chunks/{687d2b761dc5b5cf0c31.js → 4d4d71d24c1a9cb342b8.js} +1 -1
- package/assets/esri/core/workers/chunks/4fa230dc6e5e87b0dec1.js +1 -0
- package/assets/esri/core/workers/chunks/50f03813fba4b752ca9f.js +1 -0
- package/assets/esri/core/workers/chunks/{abc236e99b52be1c83b9.js → 52a14266fe239b95c5ce.js} +1 -1
- package/assets/esri/core/workers/chunks/53b5c77832df7df4d4e3.js +1 -0
- package/assets/esri/core/workers/chunks/{34178ace79e8dea3567d.js → 562cddaf63985e53ee6e.js} +1 -1
- package/assets/esri/core/workers/chunks/{6599cc702a46f81a5634.js → 5dd5be91038df8902dc4.js} +1 -1
- package/assets/esri/core/workers/chunks/{49a1b7f700b8a42de817.js → 60c7f896f2246a8aa6d7.js} +19 -19
- package/assets/esri/core/workers/chunks/60f363ee2add089e8f0b.js +1 -0
- package/assets/esri/core/workers/chunks/61801bb8c7be8fe77086.js +1 -0
- package/assets/esri/core/workers/chunks/68074a484d7f9bc713c0.js +1 -0
- package/assets/esri/core/workers/chunks/6acfa51b81e6f4255118.js +1 -0
- package/assets/esri/core/workers/chunks/{3fe7be535affae31de7e.js → 6b85a8776ec2beff63cb.js} +1 -1
- package/assets/esri/core/workers/chunks/6df484faf54e90a6cc77.js +1 -0
- package/assets/esri/core/workers/chunks/6ea6ad894ac634aa4391.js +1 -0
- package/assets/esri/core/workers/chunks/6f8098f9fe233833245a.js +1 -0
- package/assets/esri/core/workers/chunks/75fd2ef1236a9364ca7f.js +1 -0
- package/assets/esri/core/workers/chunks/7be9bbae23895d1cfa92.js +1 -0
- package/assets/esri/core/workers/chunks/7ea48661f1087d06aa41.js +1 -0
- package/assets/esri/core/workers/chunks/{47e5149765beee46f208.js → 7ee68f67f9cc48a328f0.js} +1 -1
- package/assets/esri/core/workers/chunks/866477acdf03b8a40bc9.js +1 -0
- package/assets/esri/core/workers/chunks/8e83c133b201b9b61e70.js +1 -0
- package/assets/esri/core/workers/chunks/9086a4933d3d3d9ffa72.js +1 -0
- package/assets/esri/core/workers/chunks/94174d40de39dbe7d0bf.js +1 -0
- package/assets/esri/core/workers/chunks/98f4b44eca91c42ca08e.js +1 -0
- package/assets/esri/core/workers/chunks/{dd99b77a7c0a052507bb.js → 9d88b4ba8e511da64583.js} +3 -3
- package/assets/esri/core/workers/chunks/a808be466812db51813d.js +1 -0
- package/assets/esri/core/workers/chunks/{6b4a24248182245167ca.js → a931515a2569713e743b.js} +1 -1
- package/assets/esri/core/workers/chunks/a95e28ade258b144cbb5.js +1 -0
- package/assets/esri/core/workers/chunks/adc68e2c6d2698a52bfe.js +1 -0
- package/assets/esri/core/workers/chunks/b2a1e5e9182b643909eb.js +316 -0
- package/assets/esri/core/workers/chunks/bb4574a87ca21e719f0d.js +1 -0
- package/assets/esri/core/workers/chunks/{07639f406b71bb49ffd6.js → bdbb5b33f0f49661bf6d.js} +1 -1
- package/assets/esri/core/workers/chunks/c042269586921e337be9.js +1 -0
- package/assets/esri/core/workers/chunks/c623918e289a09905cd1.js +1 -0
- package/assets/esri/core/workers/chunks/c7391b0b5a9c916a53f7.js +1 -0
- package/assets/esri/core/workers/chunks/{43d28c6509c21b8917a8.js → ca7523c14d81c470e92e.js} +1 -1
- package/assets/esri/core/workers/chunks/cd2708fb7636b3ace229.js +1 -0
- package/assets/esri/core/workers/chunks/d445e9399fe4ca3d2a50.js +1 -0
- package/assets/esri/core/workers/chunks/d7683a95775c9f401a7e.js +1 -0
- package/assets/esri/core/workers/chunks/{9d6945cda99d14af83ac.js → d7d9656b990ce8be2152.js} +1 -1
- package/assets/esri/core/workers/chunks/df4a0af329ce94a47a7b.js +1 -0
- package/assets/esri/core/workers/chunks/e10d6e511921394474ca.js +1 -0
- package/assets/esri/core/workers/chunks/e4b6aa8f67c2bd285020.js +1 -0
- package/assets/esri/core/workers/chunks/e6ca02f98f855024f74b.js +1 -0
- package/assets/esri/core/workers/chunks/{892157696e8f9e38c472.js → e6e837e43b9348050832.js} +1 -1
- package/assets/esri/core/workers/chunks/{d3325ed8d224e2350db7.js → e8a3ad00936f2ccaf362.js} +1 -1
- package/assets/esri/core/workers/chunks/ef7063ee790d2d64d4b2.js +1 -0
- package/assets/esri/core/workers/chunks/{b65fcfde62d49de1fa54.js → ef977be20a647aeded0a.js} +1 -1
- package/assets/esri/core/workers/chunks/efb631371b6bb3f043bb.js +1 -0
- package/assets/esri/core/workers/chunks/{0f5693541111fcae0c2f.js → f0914715e90e43466f8c.js} +1 -1
- package/assets/esri/core/workers/chunks/f95e488d2b86e320624f.js +1 -0
- package/assets/esri/core/workers/chunks/{bfc063d4431bfa162160.js → fd09f38fb4d99bf34988.js} +1 -1
- package/chunks/boundedPlane.js +1 -1
- package/config.js +1 -1
- package/core/accessorSupport/ensureType.js +1 -1
- package/core/compilerUtils.js +1 -1
- package/core/typedArrayUtil.js +1 -1
- package/core/units.js +1 -1
- package/core/workers/loaderConfig.js +1 -1
- package/editing/sharedTemplates/SharedTemplate.js +1 -1
- package/geometry/support/MeshTexture.js +1 -1
- package/geometry/support/aaBoundingRect.js +1 -1
- package/geometry/support/boundedPlane.js +1 -1
- package/geometry/support/heightModelInfoUtils.js +1 -1
- package/geometry/support/meshUtils/External.js +1 -1
- package/geometry/support/meshUtils/exporters/gltf/imageutils.js +1 -1
- package/geometry/support/meshUtils/loadExternal.js +1 -1
- package/geometry/support/rotate.js +1 -1
- package/interfaces.d.ts +0 -1
- package/kernel.js +1 -1
- package/layers/BuildingSceneLayer.d.ts +1 -1
- package/layers/buildingSublayers/BuildingGroupSublayer.d.ts +1 -1
- package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
- package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
- package/layers/graphics/dehydratedFeatureComparison.js +1 -1
- package/layers/graphics/dehydratedFeatures.js +1 -1
- package/layers/graphics/hydratedFeatures.js +1 -1
- package/layers/orientedImagery/transformations/rectifyMapPoint.js +1 -1
- package/layers/raster/functions/changeDetectionUtils.js +1 -1
- package/layers/raster/functions/customBandIndexUtils.js +1 -1
- package/layers/raster/functions/focalStatUtils.js +1 -1
- package/layers/raster/functions/pixelTransformUtils.js +1 -1
- package/layers/save/featureLayerUtils.js +1 -1
- package/layers/support/ElevationSampler.js +1 -1
- package/layers/support/SubtypeSublayer.js +1 -1
- package/layers/support/domains.js +1 -1
- package/networks/support/TopologyValidationJobInfo.js +1 -1
- package/networks/support/TraceJobInfo.js +1 -1
- package/package.json +2 -2
- package/renderers/support/RasterSymbolizer.js +1 -1
- package/renderers/support/rendererConversion.js +1 -1
- package/renderers/visualVariables/support/visualVariableUtils.js +1 -1
- package/rest/query/operations/pbfDehydratedFeatureSet.js +1 -1
- package/rest/support/JobInfo.js +1 -1
- package/rest/support/ServiceAreaParameters.js +1 -1
- package/smartMapping/heuristics/sizeRange.js +1 -1
- package/smartMapping/renderers/support/utils.js +1 -1
- package/smartMapping/statistics/support/statsWorker.js +1 -1
- package/smartMapping/statistics/support/utils.js +1 -1
- package/smartMapping/support/adapters/FeatureLayerAdapter.js +1 -1
- package/smartMapping/support/adapters/InMemoryLayerAdapter.js +1 -1
- package/smartMapping/support/adapters/support/histogramUtils.js +1 -1
- package/smartMapping/support/utils.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/support/ElevationInfo.d.ts +2 -2
- package/symbols/support/IconSymbol3DLayerResource.d.ts +1 -1
- package/symbols/support/defaults.js +1 -1
- package/symbols/support/defaults3D.js +1 -1
- package/symbols/support/previewSymbol3D.js +1 -1
- package/symbols/support/symbolLayerUtils3D.js +1 -1
- package/symbols/support/symbolUtils.js +1 -1
- package/symbols/support/utils.js +1 -1
- package/views/2d/analysis/ElevationProfile/ElevationProfileLineVisualization2D.js +1 -1
- package/views/2d/analysis/ElevationProfileAnalysisView2D.d.ts +16 -11
- package/views/2d/analysis/ElevationProfileAnalysisView2D.js +1 -1
- package/views/2d/engine/imagery/RasterVFDisplayObject.js +1 -1
- package/views/2d/engine/vectorTiles/VectorTile.js +1 -1
- package/views/2d/engine/vectorTiles/shaders/sources/shaderRepository.js +1 -1
- package/views/2d/engine/webgl/TextureUploadManager.js +1 -1
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/2d/input/handlers/DoubleTapDragZoom.js +1 -1
- package/views/2d/input/handlers/KeyZoom.js +1 -1
- package/views/2d/layers/FeatureLayerView2D.js +1 -1
- package/views/2d/layers/TileLayerView2D.js +1 -1
- package/views/3d/analysis/AreaMeasurement/support/utils.js +1 -1
- package/views/3d/analysis/Dimension/lengthDimensionConstraintUtils.js +1 -1
- package/views/3d/analysis/ElevationProfile/ElevationProfileLineVisualization3D.js +1 -1
- package/views/3d/analysis/ElevationProfileAnalysisView3D.d.ts +16 -11
- package/views/3d/analysis/ElevationProfileAnalysisView3D.js +1 -1
- package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementTool.js +1 -1
- package/views/3d/analysis/VolumeMeasurementAnalysisView3D.js +1 -1
- package/views/3d/camera/constraintUtils/tilt.js +1 -1
- package/views/3d/environment/CloudsParameters.js +1 -1
- package/views/3d/environment/CloudsRenderer.js +1 -1
- package/views/3d/environment/SceneViewEnvironment.js +1 -1
- package/views/3d/glTF/internal/Resource.js +1 -1
- package/views/3d/glTF/internal/fillDefaults.js +1 -1
- package/views/3d/interactive/Manipulator3D.js +1 -1
- package/views/3d/interactive/SnappingVisualizer3D.js +1 -1
- package/views/3d/interactive/editingTools/isSupportedObjectUtils.js +1 -1
- package/views/3d/interactive/editingTools/move/isSupportedObject.js +1 -1
- package/views/3d/interactive/editingTools/transform/isSupportedGraphic.js +1 -1
- package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DFeatureProcessor.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/LabelInfo.js +1 -1
- package/views/3d/layers/graphics/defaultSymbolComplexity.js +1 -1
- package/views/3d/layers/graphics/lineUtils.js +1 -1
- package/views/3d/layers/graphics/pipeline/rendering/FeaturePipelineRenderManager.js +1 -1
- package/views/3d/layers/graphics/pipeline/symbolization/primitiveObjectUtils.js +1 -1
- package/views/3d/layers/graphics/primitiveObjectSymbolUtils.js +1 -1
- package/views/3d/layers/i3s/BuildingFilterUtil.js +1 -1
- package/views/3d/layers/i3s/I3SIntersectionHandler.js +1 -1
- package/views/3d/layers/i3s/I3SNode.js +1 -1
- package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
- package/views/3d/layers/i3s/PointCloudWorkerUtil.js +1 -1
- package/views/3d/layers/i3s/SphereCone.js +5 -0
- package/views/3d/layers/support/FastSymbolUpdates.js +1 -1
- package/views/3d/layers/support/edgeUtils.js +1 -1
- package/views/3d/layers/support/featureReference.js +1 -1
- package/views/3d/layers/support/featureTileQuery3D.js +1 -1
- package/views/3d/layers/support/patternUtils.js +1 -1
- package/views/3d/state/controllers/GamepadKeyboardController.js +1 -1
- package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
- package/views/3d/support/FrustumExtentIntersection.js +1 -1
- package/views/3d/support/buffer/glUtil.js +1 -1
- package/views/3d/support/engineContent/sdfPrimitives.js +1 -1
- package/views/3d/support/viewpointUtils.js +1 -1
- package/views/3d/terrain/isTerrainSurfaceLayer.js +1 -1
- package/views/3d/webgl/RenderNode.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentData.glsl.js +8 -8
- package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBufferFields.glsl.js +3 -3
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/NormalAttribute.glsl.js +4 -4
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexNormal.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ComputeFragmentNormals.glsl.js +6 -6
- package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/Normals.glsl.js +5 -5
- package/views/3d/webgl-engine/core/shaderLibrary/terrain/TileBackground.glsl.js +3 -3
- package/views/3d/webgl-engine/core/shaderLibrary/util/BlendModes.glsl.js +1 -1
- package/views/3d/webgl-engine/lib/ManagedTexture.js +1 -1
- package/views/3d/webgl-engine/materials/lineStippleUtils.js +1 -1
- package/views/3d/webgl-engine/shaders/CompositingTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/sources/edgeRenderer/LineAmplitude.glsl.js +4 -4
- package/views/3d/webgl-engine/shaders/sources/edgeRenderer/LineOffset.glsl.js +8 -8
- package/views/VideoView.js +1 -1
- package/views/analysis/ElevationProfile/ElevationProfileController.js +1 -1
- package/views/analysis/ElevationProfile/ElevationProfileIndicatorPointVisualization.js +5 -0
- package/views/analysis/ElevationProfile/ElevationProfileLineComputation.js +1 -1
- package/views/analysis/ElevationProfile/ElevationProfileResult.js +1 -1
- package/views/analysis/ElevationProfile/ElevationProfileTool.js +1 -1
- package/views/analysis/ElevationProfile/constants.js +1 -1
- package/views/draw/Draw.js +1 -1
- package/views/input/ViewEvents.js +1 -1
- package/views/interactive/editGeometry/EditGeometry.js +1 -1
- package/views/interactive/snapping/featureSources/snappingCandidateElevationAlignment.js +1 -1
- package/views/interactive/snapping/featureSources/snappingCandidateElevationFilter.js +1 -1
- package/views/interactive/snapping/featureSources/symbologySnappingCandidates.js +1 -1
- package/views/support/PromiseQueue.js +1 -1
- package/views/support/screenUtils.js +1 -1
- package/views/support/screenshotUtils.js +1 -1
- package/views/webgl/FramebufferObject.js +1 -1
- package/views/webgl/Uniform.js +1 -1
- package/views/webgl/Util.js +1 -1
- package/webscene/Slide.d.ts +2 -2
- package/webscene/spec-certification/api.js +1 -1
- package/widgets/BatchAttributeForm/batchAttributeFormUtils.js +1 -1
- package/widgets/BatchAttributeForm/templates/support/hashElementTemplate.js +1 -1
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/Editor/workflowUtils.js +1 -1
- package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
- package/widgets/FeatureForm/featureFormUtils.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
- package/widgets/Sketch/support/OperationHandle.js +1 -1
- package/widgets/TimeSlider.js +1 -1
- package/widgets/support/SelectionList/GroupLayerItem.js +1 -1
- package/widgets/support/dateUtils.js +1 -1
- package/assets/esri/core/workers/chunks/055fdc5134d54174444d.js +0 -316
- package/assets/esri/core/workers/chunks/058fb2cd6387acfd458c.js +0 -1
- package/assets/esri/core/workers/chunks/08359ae020238a565955.js +0 -1
- package/assets/esri/core/workers/chunks/0ae018098906d6a88904.js +0 -1
- package/assets/esri/core/workers/chunks/0cd3acfbf9ee991bdab4.js +0 -1
- package/assets/esri/core/workers/chunks/0dc3a04ce717b7ddd957.js +0 -1
- package/assets/esri/core/workers/chunks/0e5cd0cf6ab7cb37d723.js +0 -1
- package/assets/esri/core/workers/chunks/0ee407b8db5c07a00d82.js +0 -1
- package/assets/esri/core/workers/chunks/10373885604655f673df.js +0 -1
- package/assets/esri/core/workers/chunks/119822a646834c1cebc0.js +0 -1
- package/assets/esri/core/workers/chunks/13d61d34e55c80e4ecdf.js +0 -1
- package/assets/esri/core/workers/chunks/17dea03fc4eb414f0022.js +0 -1
- package/assets/esri/core/workers/chunks/1967239713b58dccfd81.js +0 -1
- package/assets/esri/core/workers/chunks/1c350a2c4014146dbcd9.js +0 -1
- package/assets/esri/core/workers/chunks/2266a8f2c2ec37c19bb4.js +0 -1
- package/assets/esri/core/workers/chunks/226acd251ad7d7ee3b57.js +0 -1
- package/assets/esri/core/workers/chunks/22b07c54a5fcc27771b0.js +0 -1
- package/assets/esri/core/workers/chunks/22ca80f491e070b2a5e7.js +0 -1
- package/assets/esri/core/workers/chunks/2402d305a77fef4694a0.js +0 -1
- package/assets/esri/core/workers/chunks/27f096c434f049b8df01.js +0 -1
- package/assets/esri/core/workers/chunks/3371935a4fd6346d3a17.js +0 -1
- package/assets/esri/core/workers/chunks/3c4f8597f602779174f1.js +0 -1
- package/assets/esri/core/workers/chunks/3da53c017f9c5d2d778a.js +0 -1
- package/assets/esri/core/workers/chunks/4773a358832f87963766.js +0 -1
- package/assets/esri/core/workers/chunks/492515860198f38dd698.js +0 -1
- package/assets/esri/core/workers/chunks/4f33a2ecb154a2c2449c.js +0 -1
- package/assets/esri/core/workers/chunks/4f6f181ee83b4d484518.js +0 -1
- package/assets/esri/core/workers/chunks/52726458f590e726d52c.js +0 -1
- package/assets/esri/core/workers/chunks/536c492fdda30f2f1288.js +0 -1
- package/assets/esri/core/workers/chunks/600e2e6b51e2fb9c598c.js +0 -1
- package/assets/esri/core/workers/chunks/63b8cd7d5cafbaeed894.js +0 -1
- package/assets/esri/core/workers/chunks/6cb44cd319cb6c2539c8.js +0 -1
- package/assets/esri/core/workers/chunks/7f4fa2f2e85863d3cfb9.js +0 -1
- package/assets/esri/core/workers/chunks/8f4c480c418eba299c2b.js +0 -1
- package/assets/esri/core/workers/chunks/a3836f6a93924ee4816e.js +0 -1
- package/assets/esri/core/workers/chunks/ab520fd1ae917daf07d8.js +0 -1
- package/assets/esri/core/workers/chunks/acc7ff44bfcb5c195114.js +0 -1
- package/assets/esri/core/workers/chunks/b25a131c04092c3ab75d.js +0 -1
- package/assets/esri/core/workers/chunks/b7960ab9a9da7f88184c.js +0 -1
- package/assets/esri/core/workers/chunks/b9909264cfea68d5f2a1.js +0 -1
- package/assets/esri/core/workers/chunks/bb08359610a41e304b55.js +0 -1
- package/assets/esri/core/workers/chunks/bfbbcaa1fb04f17fc869.js +0 -1
- package/assets/esri/core/workers/chunks/d30cfc5fa302cc08d862.js +0 -1
- package/assets/esri/core/workers/chunks/d75adfd4acb3c92accc9.js +0 -1
- package/assets/esri/core/workers/chunks/da99fd0d3106dd357743.js +0 -1
- package/assets/esri/core/workers/chunks/de71db3b0fb947b13c97.js +0 -1
- package/assets/esri/core/workers/chunks/dfbbead4c24d13682891.js +0 -1
- package/assets/esri/core/workers/chunks/e4ba850e8344ac2c5fc0.js +0 -1
- package/assets/esri/core/workers/chunks/e705d041f6c1632bfbcc.js +0 -1
- package/assets/esri/core/workers/chunks/f9370830051865a3435b.js +0 -1
- package/views/analysis/ElevationProfile/ElevationProfileHoveredPointVisualization.js +0 -5
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import
|
|
5
|
+
import{clamp as t}from"../../core/mathUtils.js";export{createEmptyImageData}from"../../core/imageUtils.js";const h=2048,i=1.5,e=8;function o(h,i){const{format:e,quality:o,rotation:n,disableDecorations:a}=h||{},r=b(h,i.padding),l=p(h,{width:i.width-r.left-r.right,height:i.height-r.top-r.bottom}),{width:g,height:f}=m(h,l),u=j(e),d=R[u];return{format:u,quality:t(null!=o?o:d,0,100),area:l,width:g,height:f,rotation:n,disableDecorations:!!a,ignoreBackground:!!h?.ignoreBackground,ignorePadding:!!h?.ignorePadding}}function n(t,h){const i=o(t,h),e=i.area,n=i.width/e.width,a=b(i,h.padding),r=a.left+a.right,l=a.top+a.bottom,g=h.width-r,f=h.height-l,u=Math.floor(g*n+r),d=Math.floor(f*n+l),c=t?.layers??[],s=i.ignoreBackground,w=i.ignorePadding;return{framebufferWidth:u,framebufferHeight:d,region:{x:Math.floor(e.x*n)+a.left,y:Math.floor(e.y*n)+a.top,width:i.width,height:i.height},format:i.format,quality:i.quality,rotation:i.rotation,pixelRatio:n,layers:c,disableDecorations:i.disableDecorations,ignoreBackground:s,ignorePadding:w,olidColor:!1}}function a(t,h,i){const{ctx:e,canvas:o}=l(t,i),n=e.getImageData(0,0,t.width,t.height),a=d(o,h);return g(o),{dataUrl:a,data:n}}function r(t,h){const{ctx:i,canvas:e}=l(t,h),o=i.getImageData(0,0,t.width,t.height);return g(e),o}function l(t,h){const i=f();h.premultipliedAlpha&&q(t),i.width=t.width,i.height=t.height;const e=i.getContext("2d",{willReadFrequently:!0});return e.putImageData(t,0,0),h.flipY&&D(e),{ctx:e,canvas:i}}function g(t){t.width=0,t.height=0}function f(){return null==u&&(u=document.createElement("canvas")),u}let u=null;function d(t,h){const i=v[h.format],e=h.quality/100;return t.toDataURL(i,e)}function c(h,i){const e=j(h),o=R[e];return{format:e,quality:t(null!=i?i:o,0,100)}}function s(t,h){return h/Math.max(t[0],t[1])}function w(t,h,i,e=0,o=0,n=t.width-e,a=t.height-o,r=!1){const{data:l}=t,{width:g,height:f,data:u}=h,d=n/g,c=a/f,s=Math.ceil(d/2),w=Math.ceil(c/2),M=t.width;for(let m=0;m<f;m++)for(let t=0;t<g;t++){const h=4*(t+(r?f-m-1:m)*g);let n=0,a=0,p=0,x=0,y=0,b=0;const j=(m+.5)*c;for(let r=Math.floor(m*c);r<(m+1)*c;r++){const h=Math.abs(j-(r+.5))/w,g=(t+.5)*d,f=h*h;for(let u=Math.floor(t*d);u<(t+1)*d;u++){const t=Math.abs(g-(u+.5))/s,h=Math.sqrt(f+t*t);if(h>=1)continue;let d=2*h*h*h-3*h*h+1;const c=4*(e+u+(o+r)*M);b+=d*l[c+3],a+=d,!i&&l[c+3]<255&&(d=d*l[c+3]/255),p+=d*l[c],x+=d*l[c+1],y+=d*l[c+2],n+=d}}u[h]=p/n,u[h+1]=x/n,u[h+2]=y/n,u[h+3]=b/a}return h}function M(t,o,n){if(!o)return t;const{framebufferWidth:a,framebufferHeight:r,pixelRatio:l,region:g}=t,f=b(t,n),u=f.left+f.right,d=f.top+f.bottom,c=a-u,s=r-d,w=Math.min(e,Math.min((h-u)/c,(h-d)/s));return w<i?t:{...t,framebufferWidth:Math.round(c*w)+u,framebufferHeight:Math.round(s*w)+d,pixelRatio:l*w,resample:{region:{x:Math.round((g.x-f.left)*w)+f.left,y:Math.round((g.y-f.top)*w)+f.top,width:Math.round(g.width*w),height:Math.round(g.height*w)},width:a,height:r}}}function m(t,h){if(!t)return h;const i=t.width,e=t.height;if(null!=i&&null!=e)return{width:Math.floor(i),height:Math.floor(e)};if(null==i&&null==e)return h;const o=h.width/h.height;return null==e?{width:Math.floor(i),height:Math.floor(i/o)}:{width:Math.floor(e*o),height:Math.floor(e)}}function p(t,h){const i={x:0,y:0,width:h.width,height:h.height};if(t?.area){null!=t.area.x&&(i.x=Math.floor(t.area.x)),null!=t.area.y&&(i.y=Math.floor(t.area.y));const e=null!=t.area.width?Math.floor(t.area.width):null,o=null!=t.area.height?Math.floor(t.area.height):null;if(i.width=h.width-i.x,i.height=h.height-i.y,null!=e&&null!=o)i.width=Math.min(i.width,e),i.height=Math.min(i.height,o);else if(null==e&&null!=o){const t=Math.min(i.width,e);i.height=t/i.width*i.height,i.width=t}else if(null!=e&&null==o){const t=Math.min(i.height,o);i.width=t/i.height*i.width,i.height=t}}return x(y(i,t),h)}function x(t,h){const i=Math.floor(Math.max(t.x,0)),e=Math.floor(Math.max(t.y,0)),o={x:i,y:e,width:Math.floor(Math.min(t.width,h.width-i)),height:Math.floor(Math.min(t.height,h.height-e))},n=o.width/o.height,a=t.width/t.height;if(a===n)return o;if(a>n){const t=Math.floor(o.width/a),h=o.height-t;return{x:o.x,y:Math.floor(o.y+h/2),width:o.width,height:t}}const r=Math.floor(o.height*a),l=o.width-r;return{x:Math.floor(o.x+l/2),y:o.y,width:r,height:o.height}}function y(t,h){if(null==h?.width||null==h.height)return t;const i=h.width/h.height,e=t.width/t.height;if(e===i)return t;if(e<i){const h=Math.floor(t.height*i);return t.x-=(h-t.width)/2,t.width=h,t}const o=Math.floor(t.width/i);return t.y-=(o-t.height)/2,t.height=o,t}function b(t,h){return!h||t?.ignorePadding?k:h}function j(t){switch(t){case"png":case"jpg":case"jpeg":return t;default:return P}}function D(t){t.save(),t.globalCompositeOperation="copy",t.scale(1,-1),t.translate(0,-t.canvas.height),t.drawImage(t.canvas,0,0),t.restore()}function q(t){const h=t.data,i=h.length;for(let e=0;e<i;e+=4){const t=h[e+3];if(255!==t&&t>0){const i=255/t;h[e]=h[e]*i,h[e+1]=h[e+1]*i,h[e+2]=h[e+2]*i}}}const v={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg"},I=98,P="png",R={png:100,jpg:I,jpeg:I},k={top:0,right:0,bottom:0,left:0};export{o as completeUserSettings,a as encode,r as encodeData,c as getFormatAndQuality,s as getMaximumResolutionScale,w as resampleHermite,M as screenshotSuperSampleSettings,d as toDataUrl,n as toRenderSettings};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../core/has.js";import e from"../../core/Logger.js";import{disposeMaybe as t}from"../../core/maybe.js";import{BufferObject as r}from"./BufferObject.js";import{webglDebugEnabled as i}from"./checkWebGLError.js";import{ResourceType as s,ColorAttachment0 as n,PixelType as h,StencilAttachment as o,SizedDepthStencilFormat as c,DepthStencilAttachment as a,SizedDepthFormat as u,DepthAttachment as f}from"./enums.js";import{Renderbuffer as l}from"./Renderbuffer.js";import d from"./Texture.js";const _=()=>e.getLogger("esri.views.webgl.FramebufferObject");class m{constructor(e,t,r){if(this._context=e,this._glName=null,this._colorAttachments=new Map,this._depthStencilBuffer=null,this._depthStencilTexture=null,this._initialized=!1,e.instanceCounter.increment(s.FramebufferObject,this),null!=t){const r=E(e,t);null!=r&&(this._colorAttachments.set(n,r),p(r)?this._validateTextureDescriptor(r.descriptor):this._validateRenderbufferDescriptor(r.descriptor)),this._validateColorAttachmentPoint(n)}if(null!=r)if(x(r))this._depthStencilTexture=p(r)?r:new d(e,r),this._validateTextureDescriptor(this._depthStencilTexture.descriptor);else{const t=T(r)?r:new l(e,r);this._depthStencilBuffer=t,this._validateRenderbufferDescriptor(t.descriptor)}}dispose(){const{_colorAttachments:e,_glName:t}=this;if(0===e.size&&!this._depthStencilBuffer&&!this._depthStencilTexture&&!t)return;const{_context:r}=this,i=r.getBoundFramebufferObject();e.forEach((e,t)=>this.detachColorTexture(t)?.dispose()),this.detachDepthStencilBuffer()?.dispose(),this.detachDepthStencilTexture()?.dispose(),r.gl.deleteFramebuffer(t),this._glName=null,r.bindFramebuffer(i===this?null:i),r.instanceCounter.decrement(s.FramebufferObject,this)}get glName(){return this._glName}get colorTexture(){const e=this._colorAttachments.get(n);return p(e)?e:null}get depthStencil(){return this._depthStencilTexture||this._depthStencilBuffer}get depthStencilTexture(){return this._depthStencilTexture}get width(){const e=this._colorAttachments.get(n)??this._depthStencilTexture??this._depthStencilBuffer;return e?.descriptor?.width??0}get height(){const e=this._colorAttachments.get(n)??this._depthStencilTexture??this._depthStencilBuffer;return e?.descriptor?.height??0}get usedMemory(){return[...this._colorAttachments].reduce((e,[t,r])=>e+r.usedMemory,this.depthStencil?.usedMemory??0)}static{this._MAX_COLOR_ATTACHMENTS=-1}getColorTexture(e){const t=this._colorAttachments.get(e);return t&&p(t)?t:null}get colorAttachments(){return[...this._colorAttachments.keys()]}attachColorTexture(e,t=n){if(!e)return;this._validateColorAttachmentPoint(t);const{descriptor:r}=e;this._validateTextureDescriptor(r),this.detachColorTexture(t)?.dispose(),this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(e.glName,t)),this._colorAttachments.set(t,e)}detachColorTexture(e=n){const t=this._colorAttachments.get(e);if(!t)return;const r=p(t);return this._initialized&&this._context.temporaryBindFramebufferObject(this,()=>{if(r)this._framebufferTexture2D(null,e);else{const t=this._context.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,e,t.RENDERBUFFER,null)}}),this._colorAttachments.delete(e),r?t:void 0}setColorTextureTarget(e,t=n,r=0){const i=this._colorAttachments.get(t);i&&(35866===e?this._framebufferTextureLayer(i.glName,t,36160,0,r):this._framebufferTexture2D(i.glName,t,e,36160,0))}attachDepthStencil(e){if(e)switch(e.type){case 1:return this._attachDepthStencilTexture(e);case 2:return this._attachDepthStencilBuffer(e)}}_attachDepthStencilTexture(e){if(null==e)return;const{descriptor:t}=e,{pixelFormat:r,dataType:i}=t;34041===r||6402===r?34041!==r||i===h.UNSIGNED_INT_24_8?6402!==r||i===h.UNSIGNED_INT||i===h.UNSIGNED_SHORT?(this._validateTextureDescriptor(t),this._disposeDepthStencilAttachments(),this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(e.glName,A(r))),this._depthStencilTexture?.dispose(),this._depthStencilTexture=e):console.error("Depth texture must have data type of UNSIGNED_INT or UNSIGNED_SHORT!"):console.error("Depth/Stencil texture must have data type of UNSIGNED_INT_24_8!"):console.error("Depth/Stencil texture must have a pixel type of DEPTH_STENCIL!")}detachDepthStencilTexture(){const e=this._depthStencilTexture;return e&&this._initialized&&this._context.temporaryBindFramebufferObject(this,()=>{this._framebufferTexture2D(null,A(e.descriptor.pixelFormat))}),this._depthStencilTexture=null,e}_attachDepthStencilBuffer(e){if(null==e)return;const t=e.descriptor;if(this._validateRenderbufferDescriptor(t),this._disposeDepthStencilAttachments(),this._initialized){this._context.bindFramebuffer(this);const{gl:r}=this._context,i=this._getGLAttachmentPoint(t);r.framebufferRenderbuffer(36160,i,r.RENDERBUFFER,e.glName)}this._depthStencilBuffer=e}detachDepthStencilBuffer(){const e=this._depthStencilBuffer;if(e&&this._initialized){const{_context:t}=this,r=t.getBoundFramebufferObject();t.bindFramebuffer(this);const{gl:i}=t,s=this._getGLAttachmentPoint(e.descriptor);i.framebufferRenderbuffer(36160,s,i.RENDERBUFFER,null),t.bindFramebuffer(r)}return this._depthStencilBuffer=null,e}invalidateAttachments(e){const{_context:t}=this;t.temporaryBindFramebufferObject(this,()=>t.gl.invalidateFramebuffer(36160,e),!0)}copyToTexture(e,t,r,i,s,n,h){(e<0||t<0||s<0||n<0)&&console.error("Offsets cannot be negative!"),(r<=0||i<=0)&&console.error("Copy width and height must be greater than zero!");const o=h.descriptor;3553!==h.descriptor.target&&console.error("Texture target must be TEXTURE_2D!"),(null==o?.width||null==o?.height||e+r>this.width||t+i>this.height||s+r>o.width||n+i>o.height)&&console.error("Bad dimensions, the current input values will attempt to read or copy out of bounds!");const c=this._context,a=c.bindTexture(h,d.TEXTURE_UNIT_FOR_UPDATES);c.setActiveTexture(d.TEXTURE_UNIT_FOR_UPDATES),c.bindFramebuffer(this),c.gl.copyTexSubImage2D(3553,0,s,n,e,t,r,i),c.bindTexture(a,d.TEXTURE_UNIT_FOR_UPDATES)}readPixels(e,t,r,i,s,n,h){(r<=0||i<=0)&&console.error("Copy width and height must be greater than zero!"),h||console.error("Target memory is not initialized!"),this._context.bindFramebuffer(this),this._context.gl.readPixels(e,t,r,i,s,n,h)}async readPixelsAsync(e,t,i,s,n,h,o){const{gl:c}=this._context,a=r.createPixelPack(this._context,35041,o.byteLength);this._context.bindBuffer(a);const u=this._context.getBoundFramebufferObject();this._context.bindFramebuffer(this),c.readPixels(e,t,i,s,n,h,0),this._context.unbindBuffer(35051),this._context.bindFramebuffer(u),await a.getSubDataAsync(o),a.dispose()}resize(e,t){if(this.width===e&&this.height===t)return;const r={width:e,height:t};if(F(r,this._context.parameters.maxTextureSize),this._colorAttachments.forEach(e=>e.resize(r.width,r.height)),this._depthStencilTexture?.resize(r.width,r.height),this._initialized&&(F(r,this._context.parameters.maxRenderbufferSize),this._depthStencilBuffer?.resize(r.width,r.height),i())){const{gl:e}=this._context;e.checkFramebufferStatus(36160)!==e.FRAMEBUFFER_COMPLETE&&console.error("Framebuffer is incomplete!")}}initializeAndBind(e=36160){const{gl:t}=this._context;if(this._initialized)return void t.bindFramebuffer(e,this.glName);this._glName&&t.deleteFramebuffer(this._glName);const r=t.createFramebuffer();if(t.bindFramebuffer(e,r),this._colorAttachments.forEach((t,r)=>{if(p(t)){const i=D(t);35866===i?this._framebufferTextureLayer(t.glName,r,e,0,0):this._framebufferTexture2D(t.glName,r,i,e)}else if(T(t)){const i=this._context.gl;i.framebufferRenderbuffer(e,r,i.RENDERBUFFER,t.glName)}}),this._depthStencilBuffer){const r=this._getGLAttachmentPoint(this._depthStencilBuffer.descriptor);t.framebufferRenderbuffer(e,r,t.RENDERBUFFER,this._depthStencilBuffer.glName)}else if(this._depthStencilTexture){const t=A(this._depthStencilTexture.descriptor.pixelFormat);this._framebufferTexture2D(this._depthStencilTexture.glName,t,D(this._depthStencilTexture),e)}if(i()){t.checkFramebufferStatus(e)!==t.FRAMEBUFFER_COMPLETE&&console.error("Framebuffer is incomplete!")}this._glName=r,this._initialized=!0}_framebufferTexture2D(e,t=n,r=3553,i=36160,s=0){this._context.gl.framebufferTexture2D(i,t,r,e,s)}_framebufferTextureLayer(e,t=n,r=36160,i=0,s=0){this._context.gl.framebufferTextureLayer(r,t,e,i,s)}_disposeDepthStencilAttachments(){const e=this._context.gl;if(this._depthStencilBuffer){if(this._initialized){this._context.bindFramebuffer(this);const t=this._getGLAttachmentPoint(this._depthStencilBuffer.descriptor);e.framebufferRenderbuffer(36160,t,e.RENDERBUFFER,null)}this._depthStencilBuffer=t(this._depthStencilBuffer)}this._depthStencilTexture&&(this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(null,A(this._depthStencilTexture.descriptor.pixelFormat))),this._depthStencilTexture=t(this._depthStencilTexture))}_validateTextureDescriptor(e){3553!==e.target&&34067!==e.target&&35866!==e.target&&console.error("Texture type must be TEXTURE_2D, TEXTURE_2D_ARRAY or TEXTURE_CUBE_MAP!"),F(e,this._context.parameters.maxTextureSize),this._validateBufferDimensions(e)}_validateRenderbufferDescriptor(e){F(e,this._context.parameters.maxRenderbufferSize),this._validateBufferDimensions(e)}_validateBufferDimensions(e){e.width<=0&&(e.width=this.width),e.height<=0&&(e.height=this.height),this.width>0&&this.height>0&&(this.width===e.width&&this.height===e.height||console.error("Attachment size must match framebuffer size!"))}_getGLAttachmentPoint(e){switch(e.internalFormat){case u.DEPTH_COMPONENT16:case u.DEPTH_COMPONENT24:case u.DEPTH_COMPONENT32F:return f;case c.DEPTH24_STENCIL8:case c.DEPTH32F_STENCIL8:return a;case 36168:return o;default:return n}}_validateColorAttachmentPoint(t){if(-1===m._MAX_COLOR_ATTACHMENTS){const{gl:e}=this._context;m._MAX_COLOR_ATTACHMENTS=e.getParameter(e.MAX_COLOR_ATTACHMENTS)}const r=t-n;r+1>m._MAX_COLOR_ATTACHMENTS&&e.getLogger("esri.views.webgl.FrameBufferObject").error("esri.FrameBufferObject",`illegal attachment point for color attachment: ${r+1}. Implementation supports up to ${m._MAX_COLOR_ATTACHMENTS} color attachments`)}}function p(e){return 1===S(e)}function T(e){return 2===S(e)}function x(e){return p(e)||b(e)}function b(e){return 0===S(e)}function g(e){return 3===S(e)||null!=e&&"samples"in e}function S(e){return null!=e&&"type"in e?e.type:null}function E(e,t){return p(t)||T(t)?t:b(t)?new d(e,t):g(t)?new l(e,t):null}function F(e,t){const r=Math.max(e.width,e.height);if(r>t){_().warnOnce(`Resizing FBO attachment size ${e.width}x${e.height} to device limit ${t}`);const i=t/r;return e.width=Math.round(e.width*i),e.height=Math.round(e.height*i),!1}return!0}function D(e){return 34067===e.descriptor.target?34069:35866===e.descriptor.target?35866:3553}function A(e){return 6402===e?f:a}export{m as FramebufferObject,F as ensureAttachmentMaxSize};
|
|
5
|
+
import e from"../../core/Logger.js";import{disposeMaybe as t}from"../../core/maybe.js";import{BufferObject as r}from"./BufferObject.js";import{webglDebugEnabled as i}from"./checkWebGLError.js";import{ResourceType as s,ColorAttachment0 as n,PixelType as h,StencilAttachment as o,SizedDepthStencilFormat as c,DepthStencilAttachment as a,SizedDepthFormat as u,DepthAttachment as f}from"./enums.js";import{Renderbuffer as l}from"./Renderbuffer.js";import d from"./Texture.js";const _=()=>e.getLogger("esri.views.webgl.FramebufferObject");class m{constructor(e,t,r){if(this._context=e,this._glName=null,this._colorAttachments=new Map,this._depthStencilBuffer=null,this._depthStencilTexture=null,this._initialized=!1,e.instanceCounter.increment(s.FramebufferObject,this),null!=t){const r=E(e,t);null!=r&&(this._colorAttachments.set(n,r),p(r)?this._validateTextureDescriptor(r.descriptor):this._validateRenderbufferDescriptor(r.descriptor)),this._validateColorAttachmentPoint(n)}if(null!=r)if(x(r))this._depthStencilTexture=p(r)?r:new d(e,r),this._validateTextureDescriptor(this._depthStencilTexture.descriptor);else{const t=T(r)?r:new l(e,r);this._depthStencilBuffer=t,this._validateRenderbufferDescriptor(t.descriptor)}}dispose(){const{_colorAttachments:e,_glName:t}=this;if(0===e.size&&!this._depthStencilBuffer&&!this._depthStencilTexture&&!t)return;const{_context:r}=this,i=r.getBoundFramebufferObject();e.forEach((e,t)=>this.detachColorTexture(t)?.dispose()),this.detachDepthStencilBuffer()?.dispose(),this.detachDepthStencilTexture()?.dispose(),r.gl.deleteFramebuffer(t),this._glName=null,r.bindFramebuffer(i===this?null:i),r.instanceCounter.decrement(s.FramebufferObject,this)}get glName(){return this._glName}get colorTexture(){const e=this._colorAttachments.get(n);return p(e)?e:null}get depthStencil(){return this._depthStencilTexture||this._depthStencilBuffer}get depthStencilTexture(){return this._depthStencilTexture}get width(){const e=this._colorAttachments.get(n)??this._depthStencilTexture??this._depthStencilBuffer;return e?.descriptor?.width??0}get height(){const e=this._colorAttachments.get(n)??this._depthStencilTexture??this._depthStencilBuffer;return e?.descriptor?.height??0}get usedMemory(){return[...this._colorAttachments].reduce((e,[t,r])=>e+r.usedMemory,this.depthStencil?.usedMemory??0)}static{this._MAX_COLOR_ATTACHMENTS=-1}getColorTexture(e){const t=this._colorAttachments.get(e);return t&&p(t)?t:null}get colorAttachments(){return[...this._colorAttachments.keys()]}attachColorTexture(e,t=n){if(!e)return;this._validateColorAttachmentPoint(t);const{descriptor:r}=e;this._validateTextureDescriptor(r),this.detachColorTexture(t)?.dispose(),this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(e.glName,t)),this._colorAttachments.set(t,e)}detachColorTexture(e=n){const t=this._colorAttachments.get(e);if(!t)return;const r=p(t);return this._initialized&&this._context.temporaryBindFramebufferObject(this,()=>{if(r)this._framebufferTexture2D(null,e);else{const t=this._context.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,e,t.RENDERBUFFER,null)}}),this._colorAttachments.delete(e),r?t:void 0}setColorTextureTarget(e,t=n,r=0){const i=this._colorAttachments.get(t);i&&(35866===e?this._framebufferTextureLayer(i.glName,t,36160,0,r):this._framebufferTexture2D(i.glName,t,e,36160,0))}attachDepthStencil(e){if(e)switch(e.type){case 1:return this._attachDepthStencilTexture(e);case 2:return this._attachDepthStencilBuffer(e)}}_attachDepthStencilTexture(e){if(null==e)return;const{descriptor:t}=e,{pixelFormat:r,dataType:i}=t;34041===r||6402===r?34041!==r||i===h.UNSIGNED_INT_24_8?6402!==r||i===h.UNSIGNED_INT||i===h.UNSIGNED_SHORT?(this._validateTextureDescriptor(t),this._disposeDepthStencilAttachments(),this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(e.glName,A(r))),this._depthStencilTexture?.dispose(),this._depthStencilTexture=e):console.error("Depth texture must have data type of UNSIGNED_INT or UNSIGNED_SHORT!"):console.error("Depth/Stencil texture must have data type of UNSIGNED_INT_24_8!"):console.error("Depth/Stencil texture must have a pixel type of DEPTH_STENCIL!")}detachDepthStencilTexture(){const e=this._depthStencilTexture;return e&&this._initialized&&this._context.temporaryBindFramebufferObject(this,()=>{this._framebufferTexture2D(null,A(e.descriptor.pixelFormat))}),this._depthStencilTexture=null,e}_attachDepthStencilBuffer(e){if(null==e)return;const t=e.descriptor;if(this._validateRenderbufferDescriptor(t),this._disposeDepthStencilAttachments(),this._initialized){this._context.bindFramebuffer(this);const{gl:r}=this._context,i=this._getGLAttachmentPoint(t);r.framebufferRenderbuffer(36160,i,r.RENDERBUFFER,e.glName)}this._depthStencilBuffer=e}detachDepthStencilBuffer(){const e=this._depthStencilBuffer;if(e&&this._initialized){const{_context:t}=this,r=t.getBoundFramebufferObject();t.bindFramebuffer(this);const{gl:i}=t,s=this._getGLAttachmentPoint(e.descriptor);i.framebufferRenderbuffer(36160,s,i.RENDERBUFFER,null),t.bindFramebuffer(r)}return this._depthStencilBuffer=null,e}invalidateAttachments(e){const{_context:t}=this;t.temporaryBindFramebufferObject(this,()=>t.gl.invalidateFramebuffer(36160,e),!0)}copyToTexture(e,t,r,i,s,n,h){(e<0||t<0||s<0||n<0)&&console.error("Offsets cannot be negative!"),(r<=0||i<=0)&&console.error("Copy width and height must be greater than zero!");const o=h.descriptor;3553!==h.descriptor.target&&console.error("Texture target must be TEXTURE_2D!"),(null==o?.width||null==o?.height||e+r>this.width||t+i>this.height||s+r>o.width||n+i>o.height)&&console.error("Bad dimensions, the current input values will attempt to read or copy out of bounds!");const c=this._context,a=c.bindTexture(h,d.TEXTURE_UNIT_FOR_UPDATES);c.setActiveTexture(d.TEXTURE_UNIT_FOR_UPDATES),c.bindFramebuffer(this),c.gl.copyTexSubImage2D(3553,0,s,n,e,t,r,i),c.bindTexture(a,d.TEXTURE_UNIT_FOR_UPDATES)}readPixels(e,t,r,i,s,n,h){(r<=0||i<=0)&&console.error("Copy width and height must be greater than zero!"),h||console.error("Target memory is not initialized!"),this._context.bindFramebuffer(this),this._context.gl.readPixels(e,t,r,i,s,n,h)}async readPixelsAsync(e,t,i,s,n,h,o){const{gl:c}=this._context,a=r.createPixelPack(this._context,35041,o.byteLength);this._context.bindBuffer(a);const u=this._context.getBoundFramebufferObject();this._context.bindFramebuffer(this),c.readPixels(e,t,i,s,n,h,0),this._context.unbindBuffer(35051),this._context.bindFramebuffer(u),await a.getSubDataAsync(o),a.dispose()}resize(e,t){if(this.width===e&&this.height===t)return;const r={width:e,height:t};if(F(r,this._context.parameters.maxTextureSize),this._colorAttachments.forEach(e=>e.resize(r.width,r.height)),this._depthStencilTexture?.resize(r.width,r.height),this._initialized&&(F(r,this._context.parameters.maxRenderbufferSize),this._depthStencilBuffer?.resize(r.width,r.height),i())){const{gl:e}=this._context;e.checkFramebufferStatus(36160)!==e.FRAMEBUFFER_COMPLETE&&console.error("Framebuffer is incomplete!")}}initializeAndBind(e=36160){const{gl:t}=this._context;if(this._initialized)return void t.bindFramebuffer(e,this.glName);this._glName&&t.deleteFramebuffer(this._glName);const r=t.createFramebuffer();if(t.bindFramebuffer(e,r),this._colorAttachments.forEach((t,r)=>{if(p(t)){const i=D(t);35866===i?this._framebufferTextureLayer(t.glName,r,e,0,0):this._framebufferTexture2D(t.glName,r,i,e)}else if(T(t)){const i=this._context.gl;i.framebufferRenderbuffer(e,r,i.RENDERBUFFER,t.glName)}}),this._depthStencilBuffer){const r=this._getGLAttachmentPoint(this._depthStencilBuffer.descriptor);t.framebufferRenderbuffer(e,r,t.RENDERBUFFER,this._depthStencilBuffer.glName)}else if(this._depthStencilTexture){const t=A(this._depthStencilTexture.descriptor.pixelFormat);this._framebufferTexture2D(this._depthStencilTexture.glName,t,D(this._depthStencilTexture),e)}if(i()){t.checkFramebufferStatus(e)!==t.FRAMEBUFFER_COMPLETE&&console.error("Framebuffer is incomplete!")}this._glName=r,this._initialized=!0}_framebufferTexture2D(e,t=n,r=3553,i=36160,s=0){this._context.gl.framebufferTexture2D(i,t,r,e,s)}_framebufferTextureLayer(e,t=n,r=36160,i=0,s=0){this._context.gl.framebufferTextureLayer(r,t,e,i,s)}_disposeDepthStencilAttachments(){const e=this._context.gl;if(this._depthStencilBuffer){if(this._initialized){this._context.bindFramebuffer(this);const t=this._getGLAttachmentPoint(this._depthStencilBuffer.descriptor);e.framebufferRenderbuffer(36160,t,e.RENDERBUFFER,null)}this._depthStencilBuffer=t(this._depthStencilBuffer)}this._depthStencilTexture&&(this._initialized&&(this._context.bindFramebuffer(this),this._framebufferTexture2D(null,A(this._depthStencilTexture.descriptor.pixelFormat))),this._depthStencilTexture=t(this._depthStencilTexture))}_validateTextureDescriptor(e){3553!==e.target&&34067!==e.target&&35866!==e.target&&console.error("Texture type must be TEXTURE_2D, TEXTURE_2D_ARRAY or TEXTURE_CUBE_MAP!"),F(e,this._context.parameters.maxTextureSize),this._validateBufferDimensions(e)}_validateRenderbufferDescriptor(e){F(e,this._context.parameters.maxRenderbufferSize),this._validateBufferDimensions(e)}_validateBufferDimensions(e){e.width<=0&&(e.width=this.width),e.height<=0&&(e.height=this.height),this.width>0&&this.height>0&&(this.width===e.width&&this.height===e.height||console.error("Attachment size must match framebuffer size!"))}_getGLAttachmentPoint(e){switch(e.internalFormat){case u.DEPTH_COMPONENT16:case u.DEPTH_COMPONENT24:case u.DEPTH_COMPONENT32F:return f;case c.DEPTH24_STENCIL8:case c.DEPTH32F_STENCIL8:return a;case 36168:return o;default:return n}}_validateColorAttachmentPoint(t){if(-1===m._MAX_COLOR_ATTACHMENTS){const{gl:e}=this._context;m._MAX_COLOR_ATTACHMENTS=e.getParameter(e.MAX_COLOR_ATTACHMENTS)}const r=t-n;r+1>m._MAX_COLOR_ATTACHMENTS&&e.getLogger("esri.views.webgl.FrameBufferObject").error("esri.FrameBufferObject",`illegal attachment point for color attachment: ${r+1}. Implementation supports up to ${m._MAX_COLOR_ATTACHMENTS} color attachments`)}}function p(e){return 1===S(e)}function T(e){return 2===S(e)}function x(e){return p(e)||b(e)}function b(e){return 0===S(e)}function g(e){return 3===S(e)||null!=e&&"samples"in e}function S(e){return null!=e&&"type"in e?e.type:null}function E(e,t){return p(t)||T(t)?t:b(t)?new d(e,t):g(t)?new l(e,t):null}function F(e,t){const r=Math.max(e.width,e.height);if(r>t){_().warnOnce(`Resizing FBO attachment size ${e.width}x${e.height} to device limit ${t}`);const i=t/r;return e.width=Math.round(e.width*i),e.height=Math.round(e.height*i),!1}return!0}function D(e){return 34067===e.descriptor.target?34069:35866===e.descriptor.target?35866:3553}function A(e){return 6402===e?f:a}export{m as FramebufferObject,F as ensureAttachmentMaxSize};
|
package/views/webgl/Uniform.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/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
|
|
5
|
+
class i{constructor(i,e,s,a,t=null){if(this.name=i,this.type=e,this.arraySize=t,this.bind={0:null,1:null,2:null},a)switch(s){case void 0:break;case 0:this.bind[0]=a;break;case 1:this.bind[1]=a;break;case 2:this.bind[2]=a}}equals(i){return this.type===i.type&&this.name===i.name&&this.arraySize===i.arraySize}}export{i as Uniform};
|
package/views/webgl/Util.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/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import
|
|
5
|
+
import{webglDebugEnabled as e,getErrorMessage as s}from"./checkWebGLError.js";import{CompressedTextureFormat as c,SizedPixelFormat as a,SizedDepthStencilFormat as r,SizedDepthFormat as t,DataType as R}from"./enums.js";const n=new Set([R.BYTE,R.SHORT,R.INT,R.UNSIGNED_BYTE,R.UNSIGNED_SHORT,R.UNSIGNED_INT]);function _(c,a,r,t=0){const R=c.gl;c.bindBuffer(r);for(const _ of r.layout){const r=a.get(_.name);if(null==r){console.warn(`There is no location for vertex attribute '${_.name}' defined.`);continue}const i=t*_.stride;if(_.count<=4)_.integer&&n.has(_.type)?R.vertexAttribIPointer(r,_.count,_.type,_.stride,_.offset+i):R.vertexAttribPointer(r,_.count,_.type,_.normalized,_.stride,_.offset+i),R.enableVertexAttribArray(r),_.divisor>0&&R.vertexAttribDivisor(r,_.divisor);else if(9===_.count)for(let e=0;e<3;e++)R.vertexAttribPointer(r+e,3,_.type,_.normalized,_.stride,_.offset+12*e+i),R.enableVertexAttribArray(r+e),_.divisor>0&&R.vertexAttribDivisor(r+e,_.divisor);else if(16===_.count)for(let e=0;e<4;e++)R.vertexAttribPointer(r+e,4,_.type,_.normalized,_.stride,_.offset+16*e+i),R.enableVertexAttribArray(r+e),_.divisor>0&&R.vertexAttribDivisor(r+e,_.divisor);else console.error("Unsupported vertex attribute element count: "+_.count);if(e()){const e=s(c.gl);e&&console.error(`Unable to bind vertex attribute "${_.name}" with baseInstanceOffset ${i}:`,e,_)}}}function i(e){switch(e){case 6406:case 6409:case 6403:case 36244:case 6402:case 34041:return 1;case 6410:case 33319:case 33320:return 2;case 6407:case 36248:return 3;case 6408:case 36249:return 4}return 0}function E(e){switch(e){case 6406:case 6409:case 6403:case 36244:case a.R8:case a.R8I:case a.R8UI:case a.R8_SNORM:case 36168:return 1;case 6410:case 33319:case 33320:case a.RGBA4:case a.R16F:case a.R16I:case a.R16UI:case a.RG8:case a.RG8I:case a.RG8UI:case a.RG8_SNORM:case a.RGB565:case a.RGB5_A1:case t.DEPTH_COMPONENT16:return 2;case 6407:case 36248:case a.RGB8:case a.RGB8I:case a.RGB8UI:case a.RGB8_SNORM:case a.SRGB8:case t.DEPTH_COMPONENT24:return 3;case 6408:case 36249:case a.RGBA8:case a.R32F:case a.R11F_G11F_B10F:case a.RG16F:case a.R32I:case a.R32UI:case a.RG16I:case a.RG16UI:case a.RGBA8I:case a.RGBA8UI:case a.RGBA8_SNORM:case a.SRGB8_ALPHA8:case a.RGB9_E5:case a.RGB10_A2UI:case a.RGB10_A2:case t.DEPTH_COMPONENT32F:case r.DEPTH24_STENCIL8:return 4;case r.DEPTH32F_STENCIL8:return 5;case a.RGB16F:case a.RGB16I:case a.RGB16UI:return 6;case a.RG32F:case a.RG32I:case a.RG32UI:case a.RGBA16F:case a.RGBA16I:case a.RGBA16UI:return 8;case a.RGB32F:case a.RGB32I:case a.RGB32UI:return 12;case a.RGBA32F:case a.RGBA32I:case a.RGBA32UI:return 16;case c.COMPRESSED_RGB_S3TC_DXT1_EXT:case c.COMPRESSED_RGBA_S3TC_DXT1_EXT:return.5;case c.COMPRESSED_RGBA_S3TC_DXT3_EXT:case c.COMPRESSED_RGBA_S3TC_DXT5_EXT:return 1;case c.COMPRESSED_R11_EAC:case c.COMPRESSED_SIGNED_R11_EAC:case c.COMPRESSED_RGB8_ETC2:case c.COMPRESSED_SRGB8_ETC2:case c.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:case c.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:return.5;case c.COMPRESSED_RG11_EAC:case c.COMPRESSED_SIGNED_RG11_EAC:case c.COMPRESSED_RGBA8_ETC2_EAC:case c.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:return 1}return 0}export{_ as bindVertexBufferLayout,E as getFormatBytesPerElement,i as getFormatComponents};
|
package/webscene/Slide.d.ts
CHANGED
|
@@ -106,7 +106,7 @@ export type SlideLayout = "caption" | "cover" | "none";
|
|
|
106
106
|
export interface SlideEvents {
|
|
107
107
|
/**
|
|
108
108
|
* Emitted just after applying the slide was interrupted. In this case the
|
|
109
|
-
*
|
|
109
|
+
* [apply-slide-complete](https://developers.arcgis.com/javascript/latest/api-reference/esri-webscene-Slide.html#event-apply-slide-complete) event is not emitted.
|
|
110
110
|
*
|
|
111
111
|
* @see [applyTo()](https://developers.arcgis.com/javascript/latest/api-reference/esri-webscene-Slide.html#applyTo)
|
|
112
112
|
* @since 5.0
|
|
@@ -114,7 +114,7 @@ export interface SlideEvents {
|
|
|
114
114
|
"apply-slide-cancel": void;
|
|
115
115
|
/**
|
|
116
116
|
* Emitted just after applying the slide has successfully completed. If applying the slide is interrupted then the
|
|
117
|
-
*
|
|
117
|
+
* [apply-slide-cancel](https://developers.arcgis.com/javascript/latest/api-reference/esri-webscene-Slide.html#event-apply-slide-cancel) event is emitted instead.
|
|
118
118
|
*
|
|
119
119
|
* @see [applyTo()](https://developers.arcgis.com/javascript/latest/api-reference/esri-webscene-Slide.html#applyTo)
|
|
120
120
|
* @since 5.0
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__addDisposableResource as e,__disposeResources as t}from"tslib";import r from"../../Basemap.js";import n from"../../Ground.js";import a from"../../WebScene.js";import
|
|
5
|
+
import{__addDisposableResource as e,__disposeResources as t}from"tslib";import r from"../../Basemap.js";import n from"../../Ground.js";import a from"../../WebScene.js";import{isLongFormType as s,Null as l,Integer as y}from"../../core/accessorSupport/ensureType.js";import{isCollection as o}from"../../core/accessorSupport/extensions/serializableProperty/type.js";import i from"../../layers/GroupLayer.js";import p from"../../layers/KMLLayer.js";import{typeModuleMap as u}from"../../layers/mixins/operationalLayerModuleMap.js";import{supportedTypes as c}from"../../layers/mixins/operationalLayers.js";import f from"../../layers/support/Sublayer.js";import{JoinTableDataSourceClass as m,DataLayerSource as d}from"../../layers/support/source/DataLayerSource.js";import b from"../../layers/support/source/MapLayerSource.js";import w from"../InitialViewProperties.js";import{ScanContext as N,sorted as j}from"./utils.js";import{webSceneAnalysisRegistry as g}from"../support/analysisUtils.js";import v from"../support/SlideElements.js";async function T(r){const n={stack:[],error:void 0,hasError:!1};try{const t=e(n,new N,!1);return await P(null,{typeName:"json",type:r},void 0,t)}catch(a){n.error=a,n.hasError=!0}finally{t(n)}}async function q(e,t,r,n){switch(t.typeName){case"array":await R(e,t,r,n);break;case"union":await M(e,t,r,n);break;case"json":await P(e,t,r,n);break;case"native":await k(e,t,r,n);break;case"enum":await h(e,t,r,n)}}async function k(e,t,r,n){const a=r??t;n.addProperty({name:e,type:O(n,t),default:a.default,required:a.isRequired,nullable:a.nullable})}async function h(e,t,r,n){const a=r??t;n.currentClass?.typeValue&&"type"===e?n.addProperty({name:e,type:"string",enum:`"${n.currentClass.typeValue}"`,default:a.default,required:a.isRequired,nullable:a.nullable}):n.addProperty({name:e,type:O(n,t),enum:j(t.values).map(e=>"string"==typeof e?`"${e}"`:`${e}`).join("|"),default:a.default,required:a.isRequired,nullable:a.nullable})}async function R(e,t,r,n){t.elementType.isRequired=t.isRequired,await q(`${e}[]`,t.elementType,r??t.elementType,n)}function S(e,t){if("json"===e.typeName){const t=e.type.__accessorMetadata__,r=t?.type,n=r&&U(r),a=n?.type,s=a||r?.type;if(s&&Array.isArray(s)&&1===s.length&&"string"==typeof s[0])return a?s[0]:D(r,s[0])}return t}async function M(e,t,r,n){const a=[],s=r??t;for(const l of t.types)if("native"!==l.type.typeName&&t.key){const a=`${e}<${S(l.type,l.value)}>`;await q(a,l.type,r??t,n)}else a.push(l.type);if(a.length){const t=j(a.map(e=>O(n,e)));n.addProperty({type:t.join("|"),name:e,default:s.default,required:s.isRequired,nullable:s.nullable})}}async function C(e,t){return e.type===a&&"layers"===t?_("web-scene/operational-layers","operational-layers"):e.type===a&&"tables"===t?_("web-scene/tables","tables"):e.type!==r||"baseLayers"!==t&&"baseMapLayers"!==t?e.type===r&&"groundLayers"===t?_("web-scene/basemap-ground-layers","basemap-ground-layers"):e.type===r&&"elevationLayers"===t||e.type===n&&"layers"===t?_("web-scene/ground","ground"):e.type===i&&"layers"===t?_("web-scene/operational-layers","operational-layers",e=>e!==i):e.type!==v&&e.type!==w||"analyses"!==t?e.type!==m||"leftTableSource"!==t&&"rightTableSource"!==t?null:V({},{key:"type",base:null,typeMap:{"data-layer":d,"map-layer":b}}):{typeName:"array",elementType:{typeName:"union",key:"type",types:await Promise.all(Object.entries(g).map(async([e,t])=>({type:{typeName:"json",type:await t()},value:e})))}}:_("web-scene/basemap-base-layers","basemap-base-layers")}async function L(e,t,r){const n=I(r),a=await C(e,t);return a?(a.isRequired=n.isRequired,a.nullable=n.nullable,a.default=n.default,a):n}async function P(e,t,r,n){const a=t.type.__accessorMetadata__,s=n.getDeclaredClass(t.type);if(!a)return e&&n.addProperty({name:e,type:"unknown"}),null;let l=s,y=null;t.layerContainerType&&(l+=`--${t.layerContainerType}`);const o=e?.match(/<([^>]+)>$/);o&&(l+=`--${o[1]}`,y=o[1]);const i=r??t;t.type===f&&(l+=`--${n.currentClass?.name}`,y=n.currentClass?.name);const p=n.seen.get(l);if(p&&e)return n.addProperty({name:e,type:p,required:i.isRequired,default:i.default,nullable:i.nullable}),p;const u={type:t.type,name:s,id:l,properties:[]};e&&(n.addProperty({name:e,type:u,required:i.isRequired,default:i.default,nullable:i.nullable}),u.typeValue=y),n.push(e,u);for(const c in a){const e=a[c],r=F(e);if(!r?.enabled)continue;if(r.layerContainerTypes&&t.layerContainerType&&!r.layerContainerTypes.includes(t.layerContainerType))continue;if(t.type===f){const e="esri/layers/TileLayer"===n.stack[n.stack.length-2].klass.name;if(e&&f.test.isMapImageLayerOverridePolicy(r.overridePolicy)||!e&&f.test.isTileImageLayerOverridePolicy(r.overridePolicy))continue}const s=r.target;if("string"==typeof s||null==s){const r=await L(t,c,e);if(!r)continue;await q("string"==typeof s?s:c,r,void 0,n)}else await $(t,s,n)}return n.pop()}async function $(e,t,r){for(const n in t){let a=await C(e,n);if(!a){const e=t[n];a=e.types?V({default:e.default,write:e},e.types):J(e.type),a.default=e.default,a.isRequired=e.isRequired,a.nullable=e.allowNull,a=E(a)}await q(n,a,void 0,r)}}async function _(e,t,r){const n={typeName:"union",key:"layerType",types:[]};for(const a in c[e]){if("web-scene/operational-layers"===e&&"ArcGISTiledElevationServiceLayer"===a)continue;const s=await u[a]();s&&(r&&!r(s)||s!==p&&n.types.push({type:{typeName:"json",layerContainerType:t,type:s},value:a}))}if(0===n.types.length)return null;return{typeName:"array",elementType:1===n.types.length?n.types[0].type:n}}function O(e,t){switch(t.typeName){case"array":return`${O(e,t.elementType)}[]`;case"union":return`${j(t.types.map(t=>O(e,t.type))).join(" | ")}`;case"native":switch(t.type){case Number:return"number";case y:return"integer";case String:return"string";case Boolean:return"boolean";case Object:return"object";default:return"unknown"}case"json":return e.getDeclaredClass(t.type);case"enum":return"string"}}function A(e){const t=e.prototype.itemType?.Type;if(!t)return{typeName:"array",elementType:{typeName:"native",type:null}};if("function"==typeof t)return{typeName:"array",elementType:J(t)};if(t.typeMap){const e=[];for(const r in t.typeMap){const n=t.typeMap[r];e.push({type:J(n),value:K(n)?null:r})}return{typeName:"array",elementType:{typeName:"union",key:"string"==typeof t.key?t.key:"type",types:e}}}}function x(e){if("json"!==e.typeName)return null;const t=e.type.__accessorMetadata__,r=t?.type,n=r&&U(r),a=n?.type,s=a||r?.type;return s&&Array.isArray(s)&&"string"==typeof s[0]?a||r.type.map(e=>D(r,e)):null}function E(e){if("array"===e.typeName)return e.elementType=E(e.elementType),e;const t=x(e);return t?{typeName:"union",key:"type",nullable:e.nullable,isRequired:e.isRequired,types:t.map(t=>({value:t,type:e}))}:e}function I(e){const t=U(e);return t?.types?V(t,t.types):!t?.type&&e.types?V(t,e.types):E(G(e))}function V(e,t){if(Array.isArray(t))return{typeName:"array",elementType:V(e,t[0])};const r=[];for(const n in t.typeMap){const e=t.typeMap[n];r.push({type:J(e),value:K(e)?null:n})}return{typeName:"union",key:"string"==typeof t.key?t.key:"type",types:r,nullable:e?.write?.allowNull,isRequired:e?.write?.isRequired,default:e?.default}}function B(e){return null!=e&&e.isJSONMapWriter}function D(e,t){const r=F(e);if(r&&B(r.writer)){const e={value:""};return r.writer?.(t,e,"value"),e.value}return t}function G(e){const t=U(e),r=F(e),n=t?.type,a=J(n||e.type);return void 0!==t?.default&&"function"!=typeof t.default&&(a.default=D(e,t.default)),r?.allowNull&&(a.nullable=!0),r?.isRequired&&(a.isRequired=!0),a}function J(e){if(!e)return{typeName:"native",type:null};if(s(e))return W(e);if(Array.isArray(e)){if("string"==typeof e[0]||"number"==typeof e[0])return{typeName:"enum",values:e};if(e.length>1){const t=[];let r;for(const n of e)n!==l?t.push({type:J(n),value:null}):r=!0;return 1===t.length?{...t[0].type,nullable:r}:{typeName:"union",key:null,types:t,nullable:r}}return{typeName:"array",elementType:J(e[0])}}return o(e)?A(e):K(e)?{typeName:"native",type:e}:z(e)?{typeName:"json",type:e}:{typeName:"native",type:null}}function W(e){switch(e.type){case"native":return{typeName:"native",type:e.value};case"array":return{typeName:"array",elementType:J(e.value)};case"one-of":return{typeName:"union",key:null,types:e.values.map(e=>({type:W(e),value:null}))}}}function z(e){let t=e;for(;t;){if(t.prototype&&("esri.core.JSONSupport"===t.prototype.declaredClass||"esri.core.MultiOriginJSONSupport"===t.prototype.declaredClass))return!0;t=Object.getPrototypeOf(t)}return!1}function K(e){return e===String||e===Boolean||e===Number||e===y||e===Object||e===l}function U(e){if(!e.json)return null;const t=e.json.origins,r=e.json,n=t?.["web-scene"],a=t?.["web-document"];return n||a||r||null}function F(e){if(!e.json)return null;const t=e.json.origins,r=e.json.write,n=t?.["web-scene"]?.write,a=t?.["web-document"]?.write;return n||a||r||null}export{T as scan};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{substitute as e}from"../../intl.js";import{
|
|
5
|
+
import{substitute as e}from"../../intl.js";import{ReactiveGraphic as i}from"./ReactiveGraphic.js";import{getIntlOptionsForField as n}from"../support/dateUtils.js";import{getRangeErrorMessage as t,shouldUseScientificNotation as r,scientificNumberFormatOptions as o,numberFormatOptions as a}from"../support/forms/formUtils.js";const l=(e,i)=>null!=e&&e.input?.type===i;function s(e){return new i({source:e})}function d(i,l,s,d){const{dataType:u,minLength:p}=i,c=s?.validationErrors;if(!c||!l)return null;if("batch-attribute-form-validation::features-have-different-errors"===l)return c.invalidBatchFormType;if("input-validation-error::cannot-be-empty"===l)return c.cannotBeNull;if("domain-validation-error::value-out-of-range"===l||"numeric-range-validation-error::out-of-range"===l){const{field:l,range:s}=i,p={type:"date",intlOptions:{timeZone:"date"===l.type&&d?d:void 0,...n(l)}},f=t(s,c);return e(f,s,{format:{max:"date"===u?p:null!=s.max&&r(s.max)?o:a,min:"date"===u?p:null!=s.min&&r(s.min)?o:a}})}return"domain-validation-error::invalid-coded-value"===l?c.invalidCodedValue:"type-validation-error::invalid-type"===l?c.invalidType:"length-validation-error::too-short"===l?e(c.tooShort,{min:p}):null}function u(e,i,n){const t=n?.validationErrors;if(!t)return null;let r=null;for(const o of e.invalidHiddenInputs)switch(o.effectiveVisibilityCode){case"hidden:visibility-expression:all-features":case"hidden:group-visibility-expression:all-features":case"hidden:field-definition":return"single"===i?t.nonVisibleError_changeValues:t.nonVisibleError_checkIndividualFeatures;case"hidden:no-domain-in-common":case"hidden:visibility-expression:some-features":case"hidden:group-visibility-expression:some-features":case"hidden:not-in-all-layers":r=t.nonVisibleError_checkIndividualFeatures;break;case"visible":continue;default:o.effectiveVisibilityCode}return r}function p(e){return null!=e&&"object"==typeof e&&"type"in e&&("feature"===e.type||"geojson"===e.type||"knowledge-graph-sublayer"===e.type||"oriented-imagery"===e.type||"scene"===e.type||"subtype-sublayer"===e.type)}export{s as createReactiveGraphic,u as getHiddenFieldsValidationErrorMessage,d as getVisibleFieldInputValidationErrorMessage,p as isAttributeFormSupportedLayerUnion,l as isElementTemplateWithInputType};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import
|
|
5
|
+
import{numericHash as t}from"../../../../core/string.js";import{isBarcodeScannerInput as n,isComboBoxInput as e,isRadioButtonsInput as i,isDatePickerInput as r,isDateTimePickerInput as o,isDateTimeOffsetPickerInput as $,isSwitchInput as u,isTextAreaInput as f,isTextBoxInput as s,isTimePickerInput as l}from"../../../../form/elements/inputs/inputUtils.js";import{isFieldElementTemplate as c,isGroupElementTemplate as m,isExcludedFromSharedForm as a}from"./templateUtils.js";const p="",g="num:";function d(n){return c(n)?t(y(n)).toString():m(n)?t(S(n)).toString():t(JSON.stringify(n)).toString()}function y(t){return`${V(t)}.${h(t.field)}.${x(t.domain)}.${t.hint??p}.${b(t.input)}.${t.layerTimeZone??""}`}function S(t){const n=V(t)+`.${t.initialState}`;let e=p;for(const i of t.elements)a(i)||(e+="."+d(i).toString());return`${n}${e}`}function V(t){return`${t.label??p}.${t.description??p}`}function b(t){if(!t)return p;const{type:c}=t;if(n(t))return c??p;if(e(t)||i(t)){const{showNoValueOption:n}=t;return`${c}.${n}.${t.noValueOptionLabel??p}`}if(r(t))return`${c}.${O(t)}`;if(o(t)){const n=t.min?.getTime(),e=t.max?.getTime(),{includeTime:i}=t;return`${c}.${n}.${e}.${i}`}if($(t)){const n=O(t),{includeTimeOffset:e,timeResolution:i}=t;return`${c}.${n}.${e}.${i}`}if(u(t)){const{offValue:n,onValue:e}=t;return`${c}.${j(n)}.${j(e)}`}if(f(t)||s(t)){return`${c}.${t.minLength?.toString()??p}.${t.maxLength?.toString()??p}`}if(l(t)){const n=O(t),{timeResolution:e}=t;return`${c}.${n}.${e}`}return JSON.stringify(t)}function O(t){return`${t.min??p}.${t.max??p}`}function h(t){const n=t.name,e=t.alias??p;return`${n}.${e===n?p:e}.${t.nullable}.${t.type}.${t.length??p}.${t.defaultValue??p}.${t.description??p}.${t.editable}.${t.visible}`}function x(t){return t?"coded-value"===t.type?T(t):"range"===t.type?N(t):JSON.stringify(t):p}function T(t){const{type:n}=t;return`${n}.${t.codedValues.map(({code:t,name:n})=>`${j(t)}.${n}`).sort().join(".")}`}function j(t){return"number"==typeof t?`${g}${t}`:t}function N(t){const{maxValue:n,minValue:e,type:i}=t;return`${i}.${e}.${n}`}export{d as hashElementTemplate};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{substitute as t}from"../intl.js";import"../core/has.js";import{getOrCreateMapValue as i}from"../core/MapUtils.js";import{watch as n,on as o}from"../core/reactiveUtils.js";import{property as a,subclass as s}from"../core/accessorSupport/decorators.js";import{isIntegerField as r}from"../layers/support/fieldUtils.js";import{isString as l}from"../support/guards.js";import d from"./Widget.js";import{getHiddenFieldsValidationErrorMessage as p,getVisibleFieldInputValidationErrorMessage as u,isElementTemplateWithInputType as m}from"./BatchAttributeForm/batchAttributeFormUtils.js";import c from"./BatchAttributeForm/BatchAttributeFormViewModel.js";import{css as h}from"./BatchAttributeForm/css.js";import v from"./BatchAttributeForm/VisibleElements.js";import{isGroupInput as f,isFieldInput as b,isTextElementInput as C,differentValuesString as g}from"./BatchAttributeForm/inputs/support/inputUtils.js";import{loadCalciteComponents as _}from"./support/componentsUtils.js";import{getLabelForDateFieldValue as y,getIntlOptionsForField as F,prepareISOFieldValueForDateComponents as w,prepareUnixFieldValueForDateComponents as I,normalizeTimeOnlyString as x,getISOFieldValueFromDateComponents as M,getUnixFieldValueFromDateComponents as k}from"./support/dateUtils.js";import{globalCss as O}from"./support/globalCss.js";import{messageBundle as T,vmEvent as V,tsx as D}from"./support/widget.js";import{setFocus as U}from"./support/widgetUtils.js";import{isEmptyValue as E}from"./support/forms/formUtils.js";const S="data-element-id";let R=class extends d{constructor(e,t){super(e,t),this.headingLevel=2,this.messagesCommon=null,this.messages=null,this.featureFormMessages=null,this.viewModel=new c,this.visibleElements=new v,this.groupDisplay="all",this._attemptFocusOnNextRender=!1,this._dateComponentMap=new Map,this._touchedInputs=new Set,this._focusedFieldInput=null,this._batchSwitchInputInitialValues=new Map,this._saveInput=this._saveInput.bind(this),this._onFormSubmit=this._onFormSubmit.bind(this),this._onComponentFocus=this._onComponentFocus.bind(this),this._onComponentBlur=this._onComponentBlur.bind(this),this._afterComponentCreateOrUpdate=this._afterComponentCreateOrUpdate.bind(this),this._afterDateComponentCreate=this._afterDateComponentCreate.bind(this),this._afterRadioGroupCreateOrUpdate=this._afterRadioGroupCreateOrUpdate.bind(this)}initialize(){this.addHandles([n(()=>this.features,()=>{this._dateComponentMap.clear()}),n(()=>this.viewModel.activeForm,()=>{this._batchSwitchInputInitialValues.clear()}),o(()=>this.viewModel,"submit",()=>{this.valid||this.goToClosestError()})])}loadDependencies(){return _({input:()=>import("@esri/calcite-components/dist/components/calcite-input"),block:()=>import("@esri/calcite-components/dist/components/calcite-block"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item"),"combobox-item-group":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item-group"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown"),"dropdown-group":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-group"),"dropdown-item":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-item"),"input-date-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-date-picker"),"input-number":()=>import("@esri/calcite-components/dist/components/calcite-input-number"),"input-time-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-time-picker"),"input-time-zone":()=>import("@esri/calcite-components/dist/components/calcite-input-time-zone"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),"input-message":()=>import("@esri/calcite-components/dist/components/calcite-input-message"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch"),"text-area":()=>import("@esri/calcite-components/dist/components/calcite-text-area"),"radio-button":()=>import("@esri/calcite-components/dist/components/calcite-radio-button"),"radio-button-group":()=>import("@esri/calcite-components/dist/components/calcite-radio-button-group")})}get activeFeatureIndex(){return this.viewModel.activeFeatureIndex}set activeFeatureIndex(e){this.viewModel.activeFeatureIndex=e}get disabled(){return this.viewModel.disabled}set disabled(e){this.viewModel.disabled=e}get _effectiveDisabled(){return this.disabled||this.viewModel.updating}get features(){return this.viewModel.features}set features(e){this.viewModel.features=e}get map(){return this.viewModel.map}set map(e){this.viewModel.map=e}get maximumFeatureCount(){return this.viewModel.maximumFeatureCount}set maximumFeatureCount(e){this.viewModel.maximumFeatureCount=e}get maximumFeatureCountWithComplexForms(){return this.viewModel.maximumFeatureCountWithComplexForms}set maximumFeatureCountWithComplexForms(e){this.viewModel.maximumFeatureCountWithComplexForms=e}get spatialReference(){return this.viewModel.spatialReference}set spatialReference(e){this.viewModel.spatialReference=e}get layerInfos(){return this.viewModel.layerInfos}set layerInfos(e){this.viewModel.layerInfos=e}get timeZone(){return this.viewModel.timeZone}set timeZone(e){this.viewModel.timeZone=e}get icon(){return"edit-attributes"}set icon(e){this._overrideIfSome("icon",e)}get readOnly(){return this.viewModel.readOnly}set readOnly(e){this.viewModel.readOnly=e}get valid(){return this.viewModel.valid}goToClosestError(){const e=this.viewModel.getFirstVisibleInvalidFieldInput();if(!e)return;const{groupInput:t}=e;t&&(t.open||(t.open=!0)),this._focusedFieldInput=e.input,this._attemptFocusOnNextRender=!0,this.scheduleRender()}render(){const{status:e}=this.viewModel;return"failed"===e?this.viewModel.hasTooManyComplexFeatures?this._renderErrorNotice(t(this.messages.formFailedToLoadTooManyComplexFeatures,{num:this.viewModel.maximumFeatureCountWithComplexForms})):this.viewModel.hasTooManyFeatures?this._renderErrorNotice(t(this.messages.formFailedToLoadTooManyFeatures,{num:this.viewModel.maximumFeatureCount})):this._renderErrorNotice(this.messages.formFailedToLoad):this.viewModel.expressionEvaluationFailed?this._renderErrorNotice(this.messages.expressionEvaluationFailed):this.viewModel.hasLayersWithContingentValues?this._renderErrorNotice(this.messages.unsupportedContingentValues):D("div",{class:this.classes(h.base,O.widget,O.panel)},"loaded"===e?this._renderForm():"loading"===e&&this.visibleElements.loadingIndicator?D("calcite-loader",{key:"loader",label:this.messagesCommon?.loading}):null)}submit(){this.viewModel.submit()}_setDateTimeTimeZoneMap(e){const{datePart:t,elementId:n}=e.dataset,o=i(this._dateComponentMap,`${n}`,()=>({}));switch(t){case"date":o.date=e;break;case"time":o.time=e;break;case"timeZone":o.timeZone=e}}_renderErrorNotice(e){return D("div",{class:this.classes(h.base,O.widget,O.panel)},D("calcite-notice",{class:h.noticeError,icon:!0,kind:"warning",open:!0},D("div",{slot:"message"},e)))}_renderForm(){return D("form",{onsubmit:this._onFormSubmit},this._renderInvisibleFieldsError(),this._renderContent())}_renderInvisibleFieldsError(){const{viewModel:e}=this,{hasNonActiveInvalidFeatures:t,activeForm:i}=e;let n;if(!e.submitHasBeenAttempted)return null;if(i.invalidHiddenInputs.length>0)if(n=p(i,e.mode,this.messages),"batch"===this.viewModel.mode){const e=i.invalidHiddenInputs.filter(e=>"hidden:group-visibility-expression:all-features"===e.effectiveVisibilityCode||"hidden:visibility-expression:all-features"===e.visibilityCode);e.length>0?n+=` (${e.map(e=>e.label).join(", ")})`:n=null}else n+=` (${i.invalidHiddenInputs.map(e=>e.label).join(", ")})`;else if(t)return null;return n?D("calcite-notice",{class:h.noticeError,icon:!0,kind:"danger",open:!0},D("div",{slot:"message"},n)):null}_renderContent(){if(!this.viewModel.hasVisibleInputs)return[D("calcite-notice",{class:h.noticeError,icon:!0,kind:"warning",open:!0},D("div",{slot:"message"},this.messages.noVisibleFields[this.viewModel.noVisibleElementsReason]))];const{inputs:e}=this.viewModel.activeForm;return e.filter(e=>e.visible).map(e=>this._renderInput(e))}_renderInput(e){return f(e)?this._renderGroupInput(e):b(e)?this._renderLabeledField(e):C(e)?this._renderTextComponent(e):void 0}_renderGroupInput(e){const{inputs:t,template:i,open:n}=e,o=t.filter(e=>e.visible),a=i.label??"";return D("calcite-block",{class:this.classes(h.group,"sequential"===this.groupDisplay?h.groupSequential:null,this.disabled?h.inputDisabled:null),collapsible:!0,description:i.description??void 0,disabled:this._effectiveDisabled,expanded:n,heading:a,headingLevel:this.headingLevel,key:`{${i.elementId}-key}`,label:a,onCalciteBlockClose:()=>{e.open=!1},onCalciteBlockOpen:()=>{e.open=!0}},o.map(e=>this._renderInput(e)))}_renderLabeledField(e){const{elementId:i}=e.template,{label:n,required:o,dataType:a}=e,s=o?t(this.messages.requiredFieldLabel,{name:n}):n;return D("calcite-label",{"aria-label":s,class:h.label,key:`field--${i}`},D("div",{class:h.labelTextContent,key:"labelTextContainer"},n,o?D("span",{"aria-hidden":"true",title:this.messagesCommon.required},"*"):void 0),"unsupported"!==a?this._renderFieldInput(e):this._renderReadOnlyComponent(e),this._renderAuxiliaryText(e))}_renderFieldInput(e){const t=this.getCommonInputProps(e),{dataType:i}=e;return"date"===i?this._renderDateComponents(e,t):"coded-value"===e.domain?.type?this._renderCodedInputs({input:e,props:t}):"number"===i?this._renderNumberComponent(e,t):this._renderStringComponent(e,t)}_renderAuxiliaryText(e){const{compositeError:t,description:i,submittable:n}=e,o=!n&&t&&(this.viewModel.submitHasBeenAttempted||this._touchedInputs.has(e.template.elementId))?u(e,t,this.messages):null;return o?D("calcite-input-message",{icon:!0,status:"invalid"},o):i?D("calcite-input-message",{class:h.description,icon:!1,status:"idle"},i):null}_renderCodedInputs({input:e,props:t}){const i=e.template.input?.type??null,n=e.codedValueOptions;switch(i){case"switch":return this._renderSwitchField({input:e,props:t});case"radio-buttons":return this._renderRadioButtonGroupComponent({input:e,options:n.flat(),props:t});default:return this._renderComboBoxComponent({options:n,props:t,input:e})}}_renderSwitchField({input:e,props:t}){if((this._batchSwitchInputInitialValues.get(e)===g||e.value===g)&&"batch"===this.viewModel.mode){const i={dropdown:{afterCreate:this._afterComponentCreateOrUpdate,afterUpdate:this._afterComponentCreateOrUpdate,disabled:t.readOnly,open:!1,[S]:t[S]},trigger:{appearance:"transparent",iconEnd:"chevron-down",kind:"neutral",slot:"trigger",label:t.label},group:{mode:"single"}};return this._renderDropdownComponent({buttonValue:e.value,dropdownProps:i,options:[{name:this.messages.differentValuesPlaceholder,value:g,disabled:!0},...e.codedValueDomainOptions]})}return this._renderSwitchComponent({input:e,props:t})}_renderSwitchComponent({input:e,props:t}){return D("calcite-switch",{...t,checked:!!m(e.template,"switch")&&e.value===e.template.input.onValue,class:h.inputSwitch,disabled:t.readOnly,onblur:()=>{this._focusedFieldInput=null},onCalciteSwitchChange:({currentTarget:e})=>this._saveInput(e)})}_renderDropdownComponent({buttonValue:e,options:t,dropdownProps:i}){const{trigger:n,dropdown:o,group:a}=i;return D("calcite-dropdown",{...o,onblur:()=>{this._focusedFieldInput=null},onfocus:this._onComponentFocus,onCalciteDropdownSelect:({currentTarget:e})=>this._saveInput(e)},D("calcite-button",{...n},e===g?this.messages.differentValuesPlaceholder:e),D("calcite-dropdown-group",{selectionMode:a.mode},t.map(t=>D("calcite-dropdown-item",{disabled:t.disabled,label:String(t.name),selected:e===t.value},t.name))))}_renderComboBoxComponent({input:e,options:t,props:i}){const n="INSERT"===this.viewModel.editType,o=this._touchedInputs.has(e?.template?.elementId),a=n&&e.showNoValueOptionEnabled&&!o?()=>{}:i.onblur,s={...i,onblur:a};return D("calcite-combobox",{...s,selectionMode:"single",value:i.placeholder===this.messages.differentValuesPlaceholder?g:String(i.value),onCalciteComboboxChange:({currentTarget:e})=>{e.value!==g&&this._saveInput(e)}},this.renderComboboxOptionsList({input:e,options:t,props:i}))}renderComboboxOptionsList({input:e,options:t,props:i}){const[n,o]=t.map(e=>e.map(({name:e,value:t})=>D("calcite-combobox-item",{heading:e,key:`#${t}`,selected:i.value===t,value:`${t}`}))),a=[...n];o.length>0&&a.push(D("calcite-combobox-item-group",{key:"unsupported",label:this.featureFormMessages.subtypes.unsupportedDomainGroupTitle},o));const s=i.placeholder===this.messages.differentValuesPlaceholder,r=!s&&E(i.value);return e.showNoValueOptionEnabled&&a.unshift(D("calcite-combobox-item",{heading:e.showNoValueLabel||this.messages.empty,key:"empty-option",selected:r,value:""})),s&&a.unshift(D("calcite-combobox-item",{heading:this.messages.differentValuesPlaceholder,key:g,selected:!0,value:g})),a}_renderRadioButtonGroupComponent({input:e,options:t,props:i}){const n=t.map(({name:t,value:n})=>this._renderRadioButtons({label:t,value:n,selected:n===e.value,props:i}));if(e.showNoValueOptionEnabled){const t="",o=e.showNoValueLabel||this.messages.empty,a=E(e.value);n.unshift(this._renderRadioButtons({label:o,value:t,selected:a,props:i}))}return D("calcite-radio-button-group",{afterCreate:this._afterRadioGroupCreateOrUpdate,afterUpdate:this._afterRadioGroupCreateOrUpdate,class:h.inputRadioGroup,disabled:i.readOnly,key:`${i.key}-radio-group`,layout:"vertical",name:i.name,required:i.required},n,i.placeholder===this.messages.differentValuesPlaceholder?D("calcite-label",{class:h.placeholderRadio,key:i.label,layout:"inline"},D("calcite-radio-button",{checked:!0,class:h.inputRadio,disabled:!0,name:i.placeholder,value:i.placeholder}),i.placeholder):null)}_renderRadioButtons({value:e,selected:t,label:i,props:n}){return D("calcite-label",{class:h.inputRadioLabel,key:n.label,layout:"inline"},D("calcite-radio-button",{...n,afterCreate:void 0,afterUpdate:void 0,checked:t,class:h.inputRadio,disabled:n.readOnly,name:n.label,onblur:()=>{this._focusedFieldInput=null},value:e,onCalciteRadioButtonChange:({currentTarget:e})=>{e.checked&&this._saveInput(e)}}),i)}_renderStringComponent(e,t){const{template:i}=e;return!i.field.editable||this.readOnly?this._renderReadOnlyComponent(e):"text-area"===i.input?.type?D("calcite-text-area",{...t,class:this.classes(h.individualElement),resize:"vertical",value:t.value?String(t.value):"",onCalciteTextAreaInput:({currentTarget:e})=>this._saveInput(e)}):D("calcite-input",{...t,class:this.classes(h.individualElement),type:"text",value:t.value?String(t.value):"",onCalciteInputInput:({currentTarget:e})=>this._saveInput(e)})}_renderNumberComponent(e,t){const i=r(e.field);return D("calcite-input-number",{...t,integer:i,type:"number",value:i&&""!==t.value?Math.round(parseFloat(String(t.value))).toString():String(t.value),onCalciteInputNumberInput:({currentTarget:e})=>this._saveInput(e)})}_renderReadOnlyComponent(e,t){const i=this.getCommonInputProps(e);return D("calcite-input",{...i,class:this.classes(h.fieldInput,h.inputDisabled,h.individualElement),readOnly:!0,type:"text",value:String(t??i.value??"")})}_renderDateComponents(e,t){const{field:i}=e;let n;switch(i.type){case"date":n=this._renderDateFieldComponents(e,t);break;case"date-only":n=this._renderDateOnlyFieldComponent(e,t);break;case"time-only":n=this._renderTimeOnlyFieldComponent(e,t);break;case"timestamp-offset":n=this._renderTimestampOffsetFieldComponents(e,t);break;default:n=this._renderReadOnlyComponent(e,y(i,t.value,{timeZone:e.effectiveTimeZone,...F(e.template.field)}))}return e.value===g?[n,D("calcite-input-message",{icon:"information",key:"diff-values-message",status:"idle"},this.messages.differentValues)]:n}_renderDateOnlyFieldComponent(e,t){const{class:i,key:n,readOnly:o}=t,{rawMax:a,rawMin:s}=e.range;return D("calcite-input-date-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,class:i,"data-date-part":"date","data-element-id":t[S],key:`${n}-date-input`,max:l(a)?a:void 0,min:l(s)?s:void 0,onblur:()=>{this._focusedFieldInput=null},onfocus:this._onComponentFocus,overlayPositioning:"fixed",readOnly:o,value:e.value===g?"":e.value?String(e.value):"",onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.currentTarget)})}_renderTimeOnlyFieldComponent(e,t){const{class:i,key:n,readOnly:o}=t;return D("calcite-input-time-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,class:i,"data-date-part":"time","data-element-id":t[S],key:`${n}-time-input`,onblur:()=>{this._focusedFieldInput=null},onfocus:this._onComponentFocus,overlayPositioning:"fixed",readOnly:o,value:e.value===g?"":e.value?String(e.value):"",onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.currentTarget)})}_renderTimestampOffsetFieldComponents(e,t){const{class:i,key:n,readOnly:o}=t,{rawMax:a,rawMin:s}=e.range,r=w(a),l=w(s),d=w(e.value===g?"":e.value),p=e.includeTimeOffset,u={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,overlayPositioning:"fixed",readOnly:o,[S]:t[S],onfocus:this._onComponentFocus};return D("div",{class:h.dateInputContainer,key:`${n}-date-time-container`},D("calcite-input-date-picker",{...u,class:i,"data-date-part":"date",key:`${n}-date-input`,max:r?.date??void 0,min:l?.date??void 0,onblur:()=>{this._focusedFieldInput=null},value:d.date??"",onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),D("calcite-input-time-picker",{...u,class:i,"data-date-part":"time",key:`${n}-time-input`,onblur:()=>{this._focusedFieldInput=null},value:d.time??"",onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),p?D("calcite-input-time-zone",{...u,class:i,clearable:e.value===g||null==e.value,"data-date-part":"timeZone",key:`${n}-timezone-input`,onblur:()=>{this._focusedFieldInput=null},value:d.timeZoneOffset||"",onCalciteInputTimeZoneChange:t=>this._saveValueFromDateComponent(e,t.target)}):null)}_renderDateFieldComponents(e,t){const{class:i,key:n,readOnly:o,min:a,max:s}=t,r=e.effectiveTimeZone,l=I(e.value===g?"":e.value,r),d=I(s,r),p=I(a,r),u=e.includeTime,m={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,overlayPositioning:"fixed",readOnly:o,[S]:t[S],onfocus:this._onComponentFocus};return D("div",{class:h.dateInputContainer,key:`${n}-date-time-container`},D("calcite-input-date-picker",{...m,class:i,"data-date-part":"date",key:`${n}-date-input`,max:d?.date??void 0,min:p?.date??void 0,onblur:()=>{this._focusedFieldInput=null},value:l.date??"",onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),u?D("calcite-input-time-picker",{...m,"data-date-part":"time",key:`${n}-time-input`,onblur:()=>{this._focusedFieldInput=null},step:1,value:l.time??"",onCalciteInputTimePickerChange:t=>{this._saveValueFromDateComponent(e,t.target)}}):null)}_renderTextComponent(e){return D("div",{class:h.textElementInput,innerHTML:e.text,key:`text-element-${e.template.elementId}`})}getCommonInputProps(e){const{template:t,valid:i,value:n,minLength:o,maxLength:a,required:s,fieldName:r,editable:l,userHasChangedValue:d,range:{max:p,min:u}}=e,m=!l||this.readOnly,c=!m&&this._effectiveDisabled;let v=t.hint??void 0,f=!1;return n===g&&(v=this.messages.differentValuesPlaceholder,f=!0),{afterCreate:this._afterComponentCreateOrUpdate,afterUpdate:this._afterComponentCreateOrUpdate,"aria-invalid":i?"false":"true",class:this.classes(h.fieldInput,m?h.inputDisabled:null),status:!d&&!this.viewModel.submitHasBeenAttempted||i?"idle":"invalid",maxLength:a&&a>-1?a:void 0,minLength:o&&o>-1?o:void 0,key:t.elementId,label:r,name:r,max:null!=p?p:void 0,min:null!=u?u:void 0,disabled:c,readOnly:m,onblur:this._onComponentBlur,required:s,placeholder:v,value:f?"":n??"",[S]:t.elementId,onfocus:this._onComponentFocus}}_onFormSubmit(e){e.preventDefault()}_getFieldInputFromHTMLElement(e){return this.viewModel.findFieldInput(e.getAttribute(S))}_afterRadioGroupCreateOrUpdate(e){const t=e.selectedItem,i=e.querySelector("calcite-radio-button"),n=t||i;n&&this._afterComponentCreateOrUpdate(n)}_onComponentFocus(e){const t=e.target,i=this._getFieldInputFromHTMLElement(t);this._touchedInputs.add(i.template.elementId),this._focusedFieldInput=i}_afterComponentCreateOrUpdate(e){const t=this._getFieldInputFromHTMLElement(e),i=this._focusedFieldInput;this._attemptFocusOnNextRender&&i===t&&(this._attemptFocusOnNextRender=!1,U(e))}_onComponentBlur(){this._focusedFieldInput=null}_parseValue(e,t){if(m(t.template,"switch")){if("calcite-dropdown"===e.localName&&t.domain)for(const i of t.domain.codedValues)if(i.name===e.selectedItems[0].textContent)return i.code;return e.checked?t.template.input.onValue:t.template.input.offValue}const i=e.value;return null==i||""===i?null:"number"===t.dataType?"-0"===i||"-0."===i||"-0,"===i?i:parseFloat(i):"date"===t.field.type?parseFloat(i):i}_saveInput(e){const t=this._getFieldInputFromHTMLElement(e),{elementId:n}=t.template;if(!t)return;const o=t?.value;if(m(t.template,"switch")&&"single"!==this.viewModel.mode){const e=i(this._batchSwitchInputInitialValues,t,()=>t.value);this._batchSwitchInputInitialValues.set(t,null===e?o:e)}const a=this._parseValue(e,t);a!==o&&this.viewModel.setValue(n,a)}_afterDateComponentCreate(e){this._setDateTimeTimeZoneMap(e),this._afterComponentCreateOrUpdate(e)}_saveValueFromDateComponent(e,t){const{elementId:i}=e.template,n=e.field.type,o=this._dateComponentMap.get(`${i}`);if(!o)return;const a=e.effectiveTimeZone;let s=e.value===g?void 0:e.value,r=null;"date-only"===n?r=Array.isArray(t.value)?t.value[0]:t.value:"time-only"===n?(s=x(s),r=x(t.value)):r="timestamp-offset"===n?null!=t.value?M({dateComponent:o.date,timeComponent:o.time,oldValue:s,timeZoneComponent:o.timeZone,defaultTimeZone:a}):null:null!=t.value?k({oldValue:s,dateComponent:o.date,timeZone:a,timeComponent:o.time?.value===g?void 0:o.time}):null,s!==r&&(null!==r&&t.value?this.viewModel.setValue(`${i}`,r):this.viewModel.setValue(`${i}`,null))}};e([a()],R.prototype,"activeFeatureIndex",null),e([a()],R.prototype,"disabled",null),e([a()],R.prototype,"_effectiveDisabled",null),e([a()],R.prototype,"features",null),e([a()],R.prototype,"map",null),e([a()],R.prototype,"maximumFeatureCount",null),e([a()],R.prototype,"maximumFeatureCountWithComplexForms",null),e([a()],R.prototype,"spatialReference",null),e([a()],R.prototype,"layerInfos",null),e([a()],R.prototype,"timeZone",null),e([a()],R.prototype,"headingLevel",void 0),e([a()],R.prototype,"icon",null),e([a(),T("esri/t9n/common")],R.prototype,"messagesCommon",void 0),e([a(),T("esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm")],R.prototype,"messages",void 0),e([a(),T("esri/widgets/FeatureForm/t9n/FeatureForm")],R.prototype,"featureFormMessages",void 0),e([a()],R.prototype,"readOnly",null),e([a()],R.prototype,"valid",null),e([a({type:c}),V(["value-change","submit"])],R.prototype,"viewModel",void 0),e([a({type:v,nonNullable:!0})],R.prototype,"visibleElements",void 0),e([a()],R.prototype,"groupDisplay",void 0),R=e([s("esri.widgets.BatchAttributeForm")],R);const B=R;export{B as default};
|
|
5
|
+
import{__decorate as e}from"tslib";import{substitute as t}from"../intl.js";import{getOrCreateMapValue as i}from"../core/MapUtils.js";import{watch as n,on as o}from"../core/reactiveUtils.js";import{property as a,subclass as s}from"../core/accessorSupport/decorators.js";import{isIntegerField as r}from"../layers/support/fieldUtils.js";import{isString as l}from"../support/guards.js";import d from"./Widget.js";import{getHiddenFieldsValidationErrorMessage as p,getVisibleFieldInputValidationErrorMessage as u,isElementTemplateWithInputType as m}from"./BatchAttributeForm/batchAttributeFormUtils.js";import c from"./BatchAttributeForm/BatchAttributeFormViewModel.js";import{css as h}from"./BatchAttributeForm/css.js";import v from"./BatchAttributeForm/VisibleElements.js";import{isGroupInput as f,isFieldInput as b,isTextElementInput as C,differentValuesString as g}from"./BatchAttributeForm/inputs/support/inputUtils.js";import{loadCalciteComponents as _}from"./support/componentsUtils.js";import{getLabelForDateFieldValue as y,getIntlOptionsForField as F,prepareISOFieldValueForDateComponents as w,prepareUnixFieldValueForDateComponents as I,normalizeTimeOnlyString as x,getISOFieldValueFromDateComponents as M,getUnixFieldValueFromDateComponents as k}from"./support/dateUtils.js";import{globalCss as O}from"./support/globalCss.js";import{messageBundle as T,vmEvent as V,tsx as D}from"./support/widget.js";import{setFocus as U}from"./support/widgetUtils.js";import{isEmptyValue as E}from"./support/forms/formUtils.js";const S="data-element-id";let R=class extends d{constructor(e,t){super(e,t),this.headingLevel=2,this.messagesCommon=null,this.messages=null,this.featureFormMessages=null,this.viewModel=new c,this.visibleElements=new v,this.groupDisplay="all",this._attemptFocusOnNextRender=!1,this._dateComponentMap=new Map,this._touchedInputs=new Set,this._focusedFieldInput=null,this._batchSwitchInputInitialValues=new Map,this._saveInput=this._saveInput.bind(this),this._onFormSubmit=this._onFormSubmit.bind(this),this._onComponentFocus=this._onComponentFocus.bind(this),this._onComponentBlur=this._onComponentBlur.bind(this),this._afterComponentCreateOrUpdate=this._afterComponentCreateOrUpdate.bind(this),this._afterDateComponentCreate=this._afterDateComponentCreate.bind(this),this._afterRadioGroupCreateOrUpdate=this._afterRadioGroupCreateOrUpdate.bind(this)}initialize(){this.addHandles([n(()=>this.features,()=>{this._dateComponentMap.clear()}),n(()=>this.viewModel.activeForm,()=>{this._batchSwitchInputInitialValues.clear()}),o(()=>this.viewModel,"submit",()=>{this.valid||this.goToClosestError()})])}loadDependencies(){return _({input:()=>import("@esri/calcite-components/dist/components/calcite-input"),block:()=>import("@esri/calcite-components/dist/components/calcite-block"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item"),"combobox-item-group":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item-group"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown"),"dropdown-group":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-group"),"dropdown-item":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-item"),"input-date-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-date-picker"),"input-number":()=>import("@esri/calcite-components/dist/components/calcite-input-number"),"input-time-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-time-picker"),"input-time-zone":()=>import("@esri/calcite-components/dist/components/calcite-input-time-zone"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),"input-message":()=>import("@esri/calcite-components/dist/components/calcite-input-message"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch"),"text-area":()=>import("@esri/calcite-components/dist/components/calcite-text-area"),"radio-button":()=>import("@esri/calcite-components/dist/components/calcite-radio-button"),"radio-button-group":()=>import("@esri/calcite-components/dist/components/calcite-radio-button-group")})}get activeFeatureIndex(){return this.viewModel.activeFeatureIndex}set activeFeatureIndex(e){this.viewModel.activeFeatureIndex=e}get disabled(){return this.viewModel.disabled}set disabled(e){this.viewModel.disabled=e}get _effectiveDisabled(){return this.disabled||this.viewModel.updating}get features(){return this.viewModel.features}set features(e){this.viewModel.features=e}get map(){return this.viewModel.map}set map(e){this.viewModel.map=e}get maximumFeatureCount(){return this.viewModel.maximumFeatureCount}set maximumFeatureCount(e){this.viewModel.maximumFeatureCount=e}get maximumFeatureCountWithComplexForms(){return this.viewModel.maximumFeatureCountWithComplexForms}set maximumFeatureCountWithComplexForms(e){this.viewModel.maximumFeatureCountWithComplexForms=e}get spatialReference(){return this.viewModel.spatialReference}set spatialReference(e){this.viewModel.spatialReference=e}get layerInfos(){return this.viewModel.layerInfos}set layerInfos(e){this.viewModel.layerInfos=e}get timeZone(){return this.viewModel.timeZone}set timeZone(e){this.viewModel.timeZone=e}get icon(){return"edit-attributes"}set icon(e){this._overrideIfSome("icon",e)}get readOnly(){return this.viewModel.readOnly}set readOnly(e){this.viewModel.readOnly=e}get valid(){return this.viewModel.valid}goToClosestError(){const e=this.viewModel.getFirstVisibleInvalidFieldInput();if(!e)return;const{groupInput:t}=e;t&&(t.open||(t.open=!0)),this._focusedFieldInput=e.input,this._attemptFocusOnNextRender=!0,this.scheduleRender()}render(){const{status:e}=this.viewModel;return"failed"===e?this.viewModel.hasTooManyComplexFeatures?this._renderErrorNotice(t(this.messages.formFailedToLoadTooManyComplexFeatures,{num:this.viewModel.maximumFeatureCountWithComplexForms})):this.viewModel.hasTooManyFeatures?this._renderErrorNotice(t(this.messages.formFailedToLoadTooManyFeatures,{num:this.viewModel.maximumFeatureCount})):this._renderErrorNotice(this.messages.formFailedToLoad):this.viewModel.expressionEvaluationFailed?this._renderErrorNotice(this.messages.expressionEvaluationFailed):this.viewModel.hasLayersWithContingentValues?this._renderErrorNotice(this.messages.unsupportedContingentValues):D("div",{class:this.classes(h.base,O.widget,O.panel)},"loaded"===e?this._renderForm():"loading"===e&&this.visibleElements.loadingIndicator?D("calcite-loader",{key:"loader",label:this.messagesCommon?.loading}):null)}submit(){this.viewModel.submit()}_setDateTimeTimeZoneMap(e){const{datePart:t,elementId:n}=e.dataset,o=i(this._dateComponentMap,`${n}`,()=>({}));switch(t){case"date":o.date=e;break;case"time":o.time=e;break;case"timeZone":o.timeZone=e}}_renderErrorNotice(e){return D("div",{class:this.classes(h.base,O.widget,O.panel)},D("calcite-notice",{class:h.noticeError,icon:!0,kind:"warning",open:!0},D("div",{slot:"message"},e)))}_renderForm(){return D("form",{onsubmit:this._onFormSubmit},this._renderInvisibleFieldsError(),this._renderContent())}_renderInvisibleFieldsError(){const{viewModel:e}=this,{hasNonActiveInvalidFeatures:t,activeForm:i}=e;let n;if(!e.submitHasBeenAttempted)return null;if(i.invalidHiddenInputs.length>0)if(n=p(i,e.mode,this.messages),"batch"===this.viewModel.mode){const e=i.invalidHiddenInputs.filter(e=>"hidden:group-visibility-expression:all-features"===e.effectiveVisibilityCode||"hidden:visibility-expression:all-features"===e.visibilityCode);e.length>0?n+=` (${e.map(e=>e.label).join(", ")})`:n=null}else n+=` (${i.invalidHiddenInputs.map(e=>e.label).join(", ")})`;else if(t)return null;return n?D("calcite-notice",{class:h.noticeError,icon:!0,kind:"danger",open:!0},D("div",{slot:"message"},n)):null}_renderContent(){if(!this.viewModel.hasVisibleInputs)return[D("calcite-notice",{class:h.noticeError,icon:!0,kind:"warning",open:!0},D("div",{slot:"message"},this.messages.noVisibleFields[this.viewModel.noVisibleElementsReason]))];const{inputs:e}=this.viewModel.activeForm;return e.filter(e=>e.visible).map(e=>this._renderInput(e))}_renderInput(e){return f(e)?this._renderGroupInput(e):b(e)?this._renderLabeledField(e):C(e)?this._renderTextComponent(e):void 0}_renderGroupInput(e){const{inputs:t,template:i,open:n}=e,o=t.filter(e=>e.visible),a=i.label??"";return D("calcite-block",{class:this.classes(h.group,"sequential"===this.groupDisplay?h.groupSequential:null,this.disabled?h.inputDisabled:null),collapsible:!0,description:i.description??void 0,disabled:this._effectiveDisabled,expanded:n,heading:a,headingLevel:this.headingLevel,key:`{${i.elementId}-key}`,label:a,onCalciteBlockClose:()=>{e.open=!1},onCalciteBlockOpen:()=>{e.open=!0}},o.map(e=>this._renderInput(e)))}_renderLabeledField(e){const{elementId:i}=e.template,{label:n,required:o,dataType:a}=e,s=o?t(this.messages.requiredFieldLabel,{name:n}):n;return D("calcite-label",{"aria-label":s,class:h.label,key:`field--${i}`},D("div",{class:h.labelTextContent,key:"labelTextContainer"},n,o?D("span",{"aria-hidden":"true",title:this.messagesCommon.required},"*"):void 0),"unsupported"!==a?this._renderFieldInput(e):this._renderReadOnlyComponent(e),this._renderAuxiliaryText(e))}_renderFieldInput(e){const t=this.getCommonInputProps(e),{dataType:i}=e;return"date"===i?this._renderDateComponents(e,t):"coded-value"===e.domain?.type?this._renderCodedInputs({input:e,props:t}):"number"===i?this._renderNumberComponent(e,t):this._renderStringComponent(e,t)}_renderAuxiliaryText(e){const{compositeError:t,description:i,submittable:n}=e,o=!n&&t&&(this.viewModel.submitHasBeenAttempted||this._touchedInputs.has(e.template.elementId))?u(e,t,this.messages):null;return o?D("calcite-input-message",{icon:!0,status:"invalid"},o):i?D("calcite-input-message",{class:h.description,icon:!1,status:"idle"},i):null}_renderCodedInputs({input:e,props:t}){const i=e.template.input?.type??null,n=e.codedValueOptions;switch(i){case"switch":return this._renderSwitchField({input:e,props:t});case"radio-buttons":return this._renderRadioButtonGroupComponent({input:e,options:n.flat(),props:t});default:return this._renderComboBoxComponent({options:n,props:t,input:e})}}_renderSwitchField({input:e,props:t}){if((this._batchSwitchInputInitialValues.get(e)===g||e.value===g)&&"batch"===this.viewModel.mode){const i={dropdown:{afterCreate:this._afterComponentCreateOrUpdate,afterUpdate:this._afterComponentCreateOrUpdate,disabled:t.readOnly,open:!1,[S]:t[S]},trigger:{appearance:"transparent",iconEnd:"chevron-down",kind:"neutral",slot:"trigger",label:t.label},group:{mode:"single"}};return this._renderDropdownComponent({buttonValue:e.value,dropdownProps:i,options:[{name:this.messages.differentValuesPlaceholder,value:g,disabled:!0},...e.codedValueDomainOptions]})}return this._renderSwitchComponent({input:e,props:t})}_renderSwitchComponent({input:e,props:t}){return D("calcite-switch",{...t,checked:!!m(e.template,"switch")&&e.value===e.template.input.onValue,class:h.inputSwitch,disabled:t.readOnly,onblur:()=>{this._focusedFieldInput=null},onCalciteSwitchChange:({currentTarget:e})=>this._saveInput(e)})}_renderDropdownComponent({buttonValue:e,options:t,dropdownProps:i}){const{trigger:n,dropdown:o,group:a}=i;return D("calcite-dropdown",{...o,onblur:()=>{this._focusedFieldInput=null},onfocus:this._onComponentFocus,onCalciteDropdownSelect:({currentTarget:e})=>this._saveInput(e)},D("calcite-button",{...n},e===g?this.messages.differentValuesPlaceholder:e),D("calcite-dropdown-group",{selectionMode:a.mode},t.map(t=>D("calcite-dropdown-item",{disabled:t.disabled,label:String(t.name),selected:e===t.value},t.name))))}_renderComboBoxComponent({input:e,options:t,props:i}){const n="INSERT"===this.viewModel.editType,o=this._touchedInputs.has(e?.template?.elementId),a=n&&e.showNoValueOptionEnabled&&!o?()=>{}:i.onblur,s={...i,onblur:a};return D("calcite-combobox",{...s,selectionMode:"single",value:i.placeholder===this.messages.differentValuesPlaceholder?g:String(i.value),onCalciteComboboxChange:({currentTarget:e})=>{e.value!==g&&this._saveInput(e)}},this.renderComboboxOptionsList({input:e,options:t,props:i}))}renderComboboxOptionsList({input:e,options:t,props:i}){const[n,o]=t.map(e=>e.map(({name:e,value:t})=>D("calcite-combobox-item",{heading:e,key:`#${t}`,selected:i.value===t,value:`${t}`}))),a=[...n];o.length>0&&a.push(D("calcite-combobox-item-group",{key:"unsupported",label:this.featureFormMessages.subtypes.unsupportedDomainGroupTitle},o));const s=i.placeholder===this.messages.differentValuesPlaceholder,r=!s&&E(i.value);return e.showNoValueOptionEnabled&&a.unshift(D("calcite-combobox-item",{heading:e.showNoValueLabel||this.messages.empty,key:"empty-option",selected:r,value:""})),s&&a.unshift(D("calcite-combobox-item",{heading:this.messages.differentValuesPlaceholder,key:g,selected:!0,value:g})),a}_renderRadioButtonGroupComponent({input:e,options:t,props:i}){const n=t.map(({name:t,value:n})=>this._renderRadioButtons({label:t,value:n,selected:n===e.value,props:i}));if(e.showNoValueOptionEnabled){const t="",o=e.showNoValueLabel||this.messages.empty,a=E(e.value);n.unshift(this._renderRadioButtons({label:o,value:t,selected:a,props:i}))}return D("calcite-radio-button-group",{afterCreate:this._afterRadioGroupCreateOrUpdate,afterUpdate:this._afterRadioGroupCreateOrUpdate,class:h.inputRadioGroup,disabled:i.readOnly,key:`${i.key}-radio-group`,layout:"vertical",name:i.name,required:i.required},n,i.placeholder===this.messages.differentValuesPlaceholder?D("calcite-label",{class:h.placeholderRadio,key:i.label,layout:"inline"},D("calcite-radio-button",{checked:!0,class:h.inputRadio,disabled:!0,name:i.placeholder,value:i.placeholder}),i.placeholder):null)}_renderRadioButtons({value:e,selected:t,label:i,props:n}){return D("calcite-label",{class:h.inputRadioLabel,key:n.label,layout:"inline"},D("calcite-radio-button",{...n,afterCreate:void 0,afterUpdate:void 0,checked:t,class:h.inputRadio,disabled:n.readOnly,name:n.label,onblur:()=>{this._focusedFieldInput=null},value:e,onCalciteRadioButtonChange:({currentTarget:e})=>{e.checked&&this._saveInput(e)}}),i)}_renderStringComponent(e,t){const{template:i}=e;return!i.field.editable||this.readOnly?this._renderReadOnlyComponent(e):"text-area"===i.input?.type?D("calcite-text-area",{...t,class:this.classes(h.individualElement),resize:"vertical",value:t.value?String(t.value):"",onCalciteTextAreaInput:({currentTarget:e})=>this._saveInput(e)}):D("calcite-input",{...t,class:this.classes(h.individualElement),type:"text",value:t.value?String(t.value):"",onCalciteInputInput:({currentTarget:e})=>this._saveInput(e)})}_renderNumberComponent(e,t){const i=r(e.field);return D("calcite-input-number",{...t,integer:i,type:"number",value:i&&""!==t.value?Math.round(parseFloat(String(t.value))).toString():String(t.value),onCalciteInputNumberInput:({currentTarget:e})=>this._saveInput(e)})}_renderReadOnlyComponent(e,t){const i=this.getCommonInputProps(e);return D("calcite-input",{...i,class:this.classes(h.fieldInput,h.inputDisabled,h.individualElement),readOnly:!0,type:"text",value:String(t??i.value??"")})}_renderDateComponents(e,t){const{field:i}=e;let n;switch(i.type){case"date":n=this._renderDateFieldComponents(e,t);break;case"date-only":n=this._renderDateOnlyFieldComponent(e,t);break;case"time-only":n=this._renderTimeOnlyFieldComponent(e,t);break;case"timestamp-offset":n=this._renderTimestampOffsetFieldComponents(e,t);break;default:n=this._renderReadOnlyComponent(e,y(i,t.value,{timeZone:e.effectiveTimeZone,...F(e.template.field)}))}return e.value===g?[n,D("calcite-input-message",{icon:"information",key:"diff-values-message",status:"idle"},this.messages.differentValues)]:n}_renderDateOnlyFieldComponent(e,t){const{class:i,key:n,readOnly:o}=t,{rawMax:a,rawMin:s}=e.range;return D("calcite-input-date-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,class:i,"data-date-part":"date","data-element-id":t[S],key:`${n}-date-input`,max:l(a)?a:void 0,min:l(s)?s:void 0,onblur:()=>{this._focusedFieldInput=null},onfocus:this._onComponentFocus,overlayPositioning:"fixed",readOnly:o,value:e.value===g?"":e.value?String(e.value):"",onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.currentTarget)})}_renderTimeOnlyFieldComponent(e,t){const{class:i,key:n,readOnly:o}=t;return D("calcite-input-time-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,class:i,"data-date-part":"time","data-element-id":t[S],key:`${n}-time-input`,onblur:()=>{this._focusedFieldInput=null},onfocus:this._onComponentFocus,overlayPositioning:"fixed",readOnly:o,value:e.value===g?"":e.value?String(e.value):"",onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.currentTarget)})}_renderTimestampOffsetFieldComponents(e,t){const{class:i,key:n,readOnly:o}=t,{rawMax:a,rawMin:s}=e.range,r=w(a),l=w(s),d=w(e.value===g?"":e.value),p=e.includeTimeOffset,u={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,overlayPositioning:"fixed",readOnly:o,[S]:t[S],onfocus:this._onComponentFocus};return D("div",{class:h.dateInputContainer,key:`${n}-date-time-container`},D("calcite-input-date-picker",{...u,class:i,"data-date-part":"date",key:`${n}-date-input`,max:r?.date??void 0,min:l?.date??void 0,onblur:()=>{this._focusedFieldInput=null},value:d.date??"",onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),D("calcite-input-time-picker",{...u,class:i,"data-date-part":"time",key:`${n}-time-input`,onblur:()=>{this._focusedFieldInput=null},value:d.time??"",onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),p?D("calcite-input-time-zone",{...u,class:i,clearable:e.value===g||null==e.value,"data-date-part":"timeZone",key:`${n}-timezone-input`,onblur:()=>{this._focusedFieldInput=null},value:d.timeZoneOffset||"",onCalciteInputTimeZoneChange:t=>this._saveValueFromDateComponent(e,t.target)}):null)}_renderDateFieldComponents(e,t){const{class:i,key:n,readOnly:o,min:a,max:s}=t,r=e.effectiveTimeZone,l=I(e.value===g?"":e.value,r),d=I(s,r),p=I(a,r),u=e.includeTime,m={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,overlayPositioning:"fixed",readOnly:o,[S]:t[S],onfocus:this._onComponentFocus};return D("div",{class:h.dateInputContainer,key:`${n}-date-time-container`},D("calcite-input-date-picker",{...m,class:i,"data-date-part":"date",key:`${n}-date-input`,max:d?.date??void 0,min:p?.date??void 0,onblur:()=>{this._focusedFieldInput=null},value:l.date??"",onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),u?D("calcite-input-time-picker",{...m,"data-date-part":"time",key:`${n}-time-input`,onblur:()=>{this._focusedFieldInput=null},step:1,value:l.time??"",onCalciteInputTimePickerChange:t=>{this._saveValueFromDateComponent(e,t.target)}}):null)}_renderTextComponent(e){return D("div",{class:h.textElementInput,innerHTML:e.text,key:`text-element-${e.template.elementId}`})}getCommonInputProps(e){const{template:t,valid:i,value:n,minLength:o,maxLength:a,required:s,fieldName:r,editable:l,userHasChangedValue:d,range:{max:p,min:u}}=e,m=!l||this.readOnly,c=!m&&this._effectiveDisabled;let v=t.hint??void 0,f=!1;return n===g&&(v=this.messages.differentValuesPlaceholder,f=!0),{afterCreate:this._afterComponentCreateOrUpdate,afterUpdate:this._afterComponentCreateOrUpdate,"aria-invalid":i?"false":"true",class:this.classes(h.fieldInput,m?h.inputDisabled:null),status:!d&&!this.viewModel.submitHasBeenAttempted||i?"idle":"invalid",maxLength:a&&a>-1?a:void 0,minLength:o&&o>-1?o:void 0,key:t.elementId,label:r,name:r,max:null!=p?p:void 0,min:null!=u?u:void 0,disabled:c,readOnly:m,onblur:this._onComponentBlur,required:s,placeholder:v,value:f?"":n??"",[S]:t.elementId,onfocus:this._onComponentFocus}}_onFormSubmit(e){e.preventDefault()}_getFieldInputFromHTMLElement(e){return this.viewModel.findFieldInput(e.getAttribute(S))}_afterRadioGroupCreateOrUpdate(e){const t=e.selectedItem,i=e.querySelector("calcite-radio-button"),n=t||i;n&&this._afterComponentCreateOrUpdate(n)}_onComponentFocus(e){const t=e.target,i=this._getFieldInputFromHTMLElement(t);this._touchedInputs.add(i.template.elementId),this._focusedFieldInput=i}_afterComponentCreateOrUpdate(e){const t=this._getFieldInputFromHTMLElement(e),i=this._focusedFieldInput;this._attemptFocusOnNextRender&&i===t&&(this._attemptFocusOnNextRender=!1,U(e))}_onComponentBlur(){this._focusedFieldInput=null}_parseValue(e,t){if(m(t.template,"switch")){if("calcite-dropdown"===e.localName&&t.domain)for(const i of t.domain.codedValues)if(i.name===e.selectedItems[0].textContent)return i.code;return e.checked?t.template.input.onValue:t.template.input.offValue}const i=e.value;return null==i||""===i?null:"number"===t.dataType?"-0"===i||"-0."===i||"-0,"===i?i:parseFloat(i):"date"===t.field.type?parseFloat(i):i}_saveInput(e){const t=this._getFieldInputFromHTMLElement(e),{elementId:n}=t.template;if(!t)return;const o=t?.value;if(m(t.template,"switch")&&"single"!==this.viewModel.mode){const e=i(this._batchSwitchInputInitialValues,t,()=>t.value);this._batchSwitchInputInitialValues.set(t,null===e?o:e)}const a=this._parseValue(e,t);a!==o&&this.viewModel.setValue(n,a)}_afterDateComponentCreate(e){this._setDateTimeTimeZoneMap(e),this._afterComponentCreateOrUpdate(e)}_saveValueFromDateComponent(e,t){const{elementId:i}=e.template,n=e.field.type,o=this._dateComponentMap.get(`${i}`);if(!o)return;const a=e.effectiveTimeZone;let s=e.value===g?void 0:e.value,r=null;"date-only"===n?r=Array.isArray(t.value)?t.value[0]:t.value:"time-only"===n?(s=x(s),r=x(t.value)):r="timestamp-offset"===n?null!=t.value?M({dateComponent:o.date,timeComponent:o.time,oldValue:s,timeZoneComponent:o.timeZone,defaultTimeZone:a}):null:null!=t.value?k({oldValue:s,dateComponent:o.date,timeZone:a,timeComponent:o.time?.value===g?void 0:o.time}):null,s!==r&&(null!==r&&t.value?this.viewModel.setValue(`${i}`,r):this.viewModel.setValue(`${i}`,null))}};e([a()],R.prototype,"activeFeatureIndex",null),e([a()],R.prototype,"disabled",null),e([a()],R.prototype,"_effectiveDisabled",null),e([a()],R.prototype,"features",null),e([a()],R.prototype,"map",null),e([a()],R.prototype,"maximumFeatureCount",null),e([a()],R.prototype,"maximumFeatureCountWithComplexForms",null),e([a()],R.prototype,"spatialReference",null),e([a()],R.prototype,"layerInfos",null),e([a()],R.prototype,"timeZone",null),e([a()],R.prototype,"headingLevel",void 0),e([a()],R.prototype,"icon",null),e([a(),T("esri/t9n/common")],R.prototype,"messagesCommon",void 0),e([a(),T("esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm")],R.prototype,"messages",void 0),e([a(),T("esri/widgets/FeatureForm/t9n/FeatureForm")],R.prototype,"featureFormMessages",void 0),e([a()],R.prototype,"readOnly",null),e([a()],R.prototype,"valid",null),e([a({type:c}),V(["value-change","submit"])],R.prototype,"viewModel",void 0),e([a({type:v,nonNullable:!0})],R.prototype,"visibleElements",void 0),e([a()],R.prototype,"groupDisplay",void 0),R=e([s("esri.widgets.BatchAttributeForm")],R);const B=R;export{B as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../Color.js";import t from"../../Graphic.js";import{isSome as r,equals as n,addMany as o}from"../../core/arrayUtils.js";import{createTask as a}from"../../core/asyncUtils.js";import"../../core/has.js";import i from"../../core/Error.js";import{handlesGroup as s,makeHandle as l,abortHandle as c}from"../../core/handleUtils.js";import{clone as u}from"../../core/lang.js";import d from"../../core/Logger.js";import{getOrCreateMapValue as p}from"../../core/MapUtils.js";import{debounce as f,isPromiseLike as y,throwIfAborted as m,whenOrAbort as h}from"../../core/promiseUtils.js";import{watch as b,on as g,whenOnce as w}from"../../core/reactiveUtils.js";import{px2pt as I}from"../../core/screenUtils.js";import{addMany as v}from"../../core/SetUtils.js";import{diff as T}from"../../core/accessorSupport/diffUtils.js";import{isSharedTemplateOrMetadata as S,isSharedGroupTemplate as F,isSharedTemplate as j,isSharedPresetTemplate as k,isStandardFeatureTemplate as A,isSharedFeatureTemplate as L}from"../../editing/templateUtils.js";import{getSharedTemplateProvider as U}from"../../editing/sharedTemplates/SharedTemplateProvider.js";import V from"../../layers/GraphicsLayer.js";import{featureHasFields as M,fixFields as O,getDisplayFieldName as x}from"../../layers/support/fieldUtils.js";import{isSubtypeSublayer as q,isGraphicsLayer as z,isSceneLayer as E}from"../../layers/support/layerUtils.js";import{calculateTolerance as P}from"../../renderers/support/clickToleranceUtils.js";import{meterIn as C}from"../../renderers/support/lengthUtils.js";import{isRenderer as R}from"../../renderers/support/typeUtils.js";import{getTransformationType as D}from"../../renderers/visualVariables/support/sizeVariableUtils.js";import{isGraphic as G}from"../../support/guards.js";import B from"../../symbols/SimpleFillSymbol.js";import N from"../../symbols/SimpleLineSymbol.js";import Z from"../../symbols/SimpleMarkerSymbol.js";import{to3D as Q}from"../../symbols/support/symbolConversion.js";import{getDisplayedSymbol as W}from"../../symbols/support/symbolUtils.js";import{getServices as $}from"../../undoredo/support/Services.js";import{GraphicState as J}from"../../views/3d/layers/graphics/GraphicState.js";import{defaultDrawingMode as H}from"../../views/draw/drawingModes.js";import{createQueryGeometry as K}from"../../views/support/drapedUtils.js";import{filterGraphicHits as X,hitTestSelectSimilarDistance as Y}from"../../views/support/hitTestSelectUtils.js";import{dependencySort as _}from"./support/dependencySort.js";import{isDrawGraphicTool as ee}from"../Sketch/support/sketchUtils.js";const te=()=>d.getLogger("esri.widgets.Editor.workflowUtils");function re(e){return le(e)||ie(e)}function ne(e){return!!e&&"features"in e}function oe(e){return null!=e&&"create-features"===e.type}function ae(e){return!!e&&"feature"in e}function ie(e){return null!=e&&"update-features"===e.type}function se(e){return null!=e&&"update-feature"===e.type}function le(e){return null!=e&&e.type.includes("update-")&&"fullFeature"in e}function ce(e){return null!=e&&"update"===e.type}function ue(e){return null!=e&&"merge-features"===e.type}function de(e){return null!=e&&"split-feature"===e.type}function pe(e){const t=e?.type;return"update-feature"===t||"update-table-record"===t||"update-features"===t||"split-feature"===t}function fe(e){return"merge"===e?.type}function ye(e){return"split"===e?.type}function me(e){return ue(e)||de(e)}function he(e){return"update-multiple"===e?.type}function be(e){const t=e&&"renderer"in e?e.renderer:null;if(!Fe(t))return{rotation:null,size:null};const r=t.getVisualVariablesForType("rotation").filter(e=>(!e.axis||"heading"===e.axis)&&e.field&&!e.valueExpression),n=t.getVisualVariablesForType("size").filter(e=>e.field&&!e.useSymbolValue&&!e.valueExpression&&"real-world-size"===D(e));return{rotation:1===r.length?r[0]:null,size:1===n.length?n[0]:null}}function ge(e){const t=e.sourceLayer;if(!(t&&"renderer"in t&&Fe(t.renderer)))return{rotation:null,size:null};const{rotation:r,size:n}=be(t);let o=null,a=null;if(r){const e=t.fields?.filter(e=>e.name===r.field),n=1===e?.length?e[0]:null;o=we(r,n)}if(n){const e=t.fields?.filter(e=>e.name===n.field),r=1===e?.length?e[0]:null;a=Te(n,r)}return{rotation:o,size:a}}function we(e,t){const r="heading"===(e.axis||"heading")&&"arithmetic"===e.rotationType?-1:1,n=t?.type??"double",o={initial:0,current:0};return{field:e.field,fieldType:n,getDefaultValue:()=>Promise.resolve(0),getValue:e=>(o.current=o.initial-r*e,Se((o.current+360)%360,n)),setInitialValue:e=>{o.initial=e,o.current=0},isUpdatingInteractively:!1,rotationType:e.rotationType??"geographic"}}function Ie(e,t){switch(t){case"width":return e[0];case"depth":return e[1];case"height":return e[2];default:return e[2]||e[1]||e[0]}}async function ve(e,t,r){if(null==t)return 0;const{symbol:n}=Q(t);if(null==n||"web-style"===n.type||"cim"===n.type)return 0;const o=n.symbolLayers.at(0);if(!o)return 0;switch(o.type){case"icon":{const{computeIconLayerResourceSize:e}=await import("../../symbols/support/symbolLayerUtils.js");return Math.min(dt.icon,(await e(o,dt.icon))[0])||dt.icon}case"text":return dt.text;case"line":return dt.line;case"object":{const{computeObjectLayerResourceSize:t}=await import("../../symbols/support/symbolLayerUtils.js");return Ie(await t(o,e.scale/dt.viewScaleSizeFactor),r)}case"path":case"extrude":return e.scale/dt.viewScaleSizeFactor;default:return 0}}function Te(e,t){const r=e.axis,n=t?.type??"double",o={initial:0,current:0},a=C[e.valueUnit]??1;let i;return i="area"===e.valueRepresentation?e=>(e*a/2)**2*Math.PI:"radius"===e.valueRepresentation||"distance"===e.valueRepresentation?e=>e*a/2:e=>e*a,{field:e.field,fieldType:n,getDefaultValue:async(e,t)=>Se(i(await ve(t,e,r)),n),getValue:(e,t)=>(o.initial||(o.initial=t.pixelSizeAt(t.center)),o.current=o.initial*e,Se(o.current,n)),setInitialValue:e=>{o.initial=e,o.current=0},isUpdatingInteractively:!1,displayUnit:yt(e.valueUnit),axis:e.axis}}function Se(e,t){switch(t){case"small-integer":case"integer":case"long":return Math.round(e);case"double":case"single":return e;default:return 0}}function Fe(e){if(!R(e))return!1;switch(e?.type){case"class-breaks":case"simple":case"unique-value":case"dot-density":case"dictionary":case"pie-chart":return!0;default:return!1}}async function je(e,t,r){const n=await W(e,{useSourceLayer:!0,ignoreGraphicSymbol:!0,webStyleCache:t,scale:r});null!=T(e.symbol,n)&&(e.symbol=n)}function ke(e,t){if(!e||!t)throw new Error("no geometry type");if("multipatch"===e)return{tool:"mesh",createOptions:{mode:"hybrid"}};const r=new Map;r.set("circle",{mode:"freehand"}),r.set("rectangle",{mode:"freehand"});const n={mode:H,optionsPerTool:r};if(S(t)){const o=t.defaultTool,a=F(t)?t.definition?.inputGeometryType??e:e;switch(o){case"freehand":case"stream-line":return{tool:"polyline"===a?"freehandPolyline":"freehandPolygon",createOptions:n};case"autocomplete-freehand-polygons":case"stream-polygon":return{tool:"freehandPolygon",createOptions:n};case"autocomplete-polygons":case"difference-polygon":case"create-structures":case"polygon":case"trace":return{tool:"polygon"===a?"polygon":"polyline",createOptions:n};case"circle":return r.get("circle").preserveAspectRatio=!0,{tool:"circle",createOptions:n};case"ellipse":return r.get("circle").preserveAspectRatio=!1,{tool:"circle",createOptions:n};case"create-points-along-line":case"multipoint":return{tool:"multipoint",createOptions:n};case"line":case"radial-line":case"right-angle-line":case"split":case"two-point-line":return{tool:"polyline",createOptions:n};case"rectangle":case"regular-polygon":case"right-angle-polygon":return{tool:"rectangle",createOptions:n};case"elevation-point-from-contour":case"elevation-point-from-dem":case"parcel-seed":case"point":case"point-and-rotation":case"point-at-end-of-line":return{tool:"point",createOptions:n}}}else{const o=t.drawingTool;if("circle"===o||"ellipse"===o)return r.get("circle").preserveAspectRatio="circle"===o,{tool:"circle",createOptions:n};if("rectangle"===o)return{tool:"rectangle",createOptions:n};if("freehand"===o)return{tool:"polygon"===e?"freehandPolygon":"freehandPolyline",createOptions:n}}return{tool:e,createOptions:n}}async function Ae(e,t,r,n){const{creationInfo:o,fullTemplate:a}=r;if(!o)throw new i("featureworkflow","No creation info provided.");const s=o.layer,l=Qe(a,o.attributeOverrides),{view:c}=e,u="2d"===c?.type;F(a)||k(a)||await We(e,s,l,n,u?c.scale:null);const{capabilities:d}=s;t.elevationInfo=s.elevationInfo;const p=ke(s.geometryType,a);e.defaultCreateOptions={graphicProperties:{attributes:l,sourceLayer:s},mode:p.createOptions.mode,optionsPerTool:p.createOptions.optionsPerTool,preserveAspectRatio:p.createOptions.preserveAspectRatio,hasZ:d.data.supportsZ,defaultZ:(u?d.editing.zDefault:null)??e.defaultCreateOptions.defaultZ},null==o.geometryToPlace?await e.create(p.tool):await e.place(o.geometryToPlace,{graphicProperties:{attributes:l,sourceLayer:s}})}async function Le(e){return s([Ue(e),Ve(e)])}function Ue({creationAttributes:e,data:t,sketchViewModel:r,view:n,webStyleCache:o}){const{creationInfo:a}=t,{fullTemplate:i}=t;if(!a||"2d"!==n?.type||F(i)||k(i))return null;const s=f(t=>We(r,a.layer,e,o,t));return b(()=>n.scale,e=>s(e))}function Ve({data:t,sketchViewModel:r,view:n}){const{templateExecutorInfo:o}=t;if(!o)return null;const a=r.activeComponent;if(!n||!ee(a))return te().error(new i("featureworkflow","Failed to set up template feedback.")),null;const c=new V({effect:"saturate(0.6) opacity(0.8)",listMode:"hide",title:"Shared Template Feedback Graphics"});n.map?.add(c);const{executor:u,serviceLayersById:d}=o,p=n.theme?.accentColor??new e([255,165,0,1]);return s([g(()=>a,["cursor-update","vertex-add"],()=>{c.removeAll();const e=a.graphic?.geometry;if(!e||!Me(e))return;const t=u(e,"digitizing");if(!y(t))for(const r of t.edits){const e=d.get(r.id);if(e&&r.addFeatures&&0!==r.addFeatures.length)for(const t of e)if(!t.isTable)for(const e of r.addFeatures){const t=Oe(e,p);t&&c.add(t)}}}),l(()=>{n.map.remove(c),c.destroy()})])}function Me(e){switch(e.type){case"point":case"multipoint":return!0;case"polyline":return e.paths[0].length>1;case"polygon":{const t=e.rings[0];return n(t.at(0),t.at(-1))?t.length>2:t.length>1}default:return!1}}function Oe(e,r){let n=null;switch(e.geometry?.type){case"point":case"multipoint":n=new Z({angle:0,color:r,outline:new N({cap:"round",color:r,join:"round",miterLimit:1,style:"solid",width:1}),path:"undefined",size:8,style:"circle",xoffset:0,yoffset:0});break;case"polygon":n=new B({color:r,outline:new N({cap:"round",color:r,join:"round",miterLimit:1,style:"solid",width:3}),style:"none"});break;case"polyline":n=new N({cap:"round",color:r,join:"round",miterLimit:1,style:"solid",width:2});break;default:return null}return new t({geometry:e.geometry,symbol:n,attributes:{...e.attributes}})}function xe(e,t){const r=$(t),n=q(e)?e.parent:e;return r.tablesAndLayersLookup.get(n)}function qe(e,t){const r=xe(e,t);if(!r)return new Map;const n=new Map;for(const o of r.layersAndTables)p(n,o.layerId,()=>[]).push(o);return n}function ze(e){const t=e.objectIdField,r=e.globalIdField??"";return{id:e.layerId,identifierFields:{objectIdField:t,globalIdField:r},addFeatures:[],deleteAttachments:[],addAttachments:[],deleteFeatures:[],updateFeatures:[]}}function Ee(e){const{edits:t,serviceInfo:n,view:o,findOriginalFeature:a}=e,i=Pe(n.layersAndTables),s=n.layersAndTables.toArray(),{allEditData:l,editDataByLayerIdMap:c,editDataByIdMap:u}=Re(t,i,a),d=De(l,Ce(s,c),c);if(o&&Ne(l,d,o),0===d.length)return t;const p=_(d,{continueOnCircularDependency:!0}).map(e=>u.get(e)).filter(r),f=new Map;for(const r of p)f.set(r.uniqueId,r);const y=[];for(const r of l)f.has(r.uniqueId)||y.push(r);const m=[];let h=null;for(const r of p){const{layer:e}=r;switch(null==h?h=ze(e):h.id!==e.layerId&&(m.push(h),h=ze(e)),r.operationType){case"add":case"modify":h.addFeatures.push(r.after);break;case"delete":h.deleteFeatures.push(r.before)}}null!==h&&m.push(h);for(const r of y){const e=r.layer.layerId,t=m.find(t=>t.id===e)??ze(r.layer);switch(m.includes(t)||m.push(t),r.operationType){case"add":t.addFeatures.push(r.after);break;case"modify":t.updateFeatures.push(r.after);break;case"delete":t.deleteFeatures.push(r.before);break;case"deleteAttachment":t.deleteAttachments.push(r.attachmentId);break;case"addAttachment":t.addAttachments.push(r.attachment)}}for(const r of m)void 0!==r.deleteAttachments&&0===r.deleteAttachments.length&&delete r.deleteAttachments,void 0!==r.addAttachments&&0===r.addAttachments.length&&delete r.addAttachments;return m}function Pe(e){const t=new Map;for(const r of e)t.set(r.layerId,r);return t}function Ce(e,t){const r=new Map;for(const n of e)for(const e of n.relationships??[])if(r.set(Ge(n,e),""),t.has(e.relatedTableId)){const o=t.get(e.relatedTableId);if(o.length>0)for(const t of o[0].layer.relationships??[])if(t.id===e.id){r.set(Ge(n,e),t.keyField);break}}return r}function Re(e,t,r){const n=new Map,o=[],a=new Map;let s=1;for(const l of e){const e=[],c=t.get(l.id);if(!c)throw new i("featureworkflow",`Failed to prepare applyEdits payload. Layer with id ${l.id} not found.`);for(const t of l.addFeatures??[])e.push({uniqueId:"T"+s++,operationType:"add",layer:c,after:t});for(const t of l.deleteFeatures??[])e.push({uniqueId:"T"+s++,operationType:"delete",before:t,layer:c});for(const t of l.deleteAttachments??[])e.push({uniqueId:"T"+s++,operationType:"deleteAttachment",attachmentId:t,layer:c});for(const t of l.addAttachments??[])e.push({uniqueId:"T"+s++,operationType:"addAttachment",attachment:t,layer:c});for(const t of l.updateFeatures??[])e.push({uniqueId:"T"+s++,operationType:"modify",before:r(t),after:t,layer:c});n.set(c.layerId,e);for(const t of e)o.push(t),a.set(t.uniqueId,t)}return{allEditData:o,editDataByIdMap:a,editDataByLayerIdMap:n}}function De(e,t,r){const n=[];for(const o of e){const e=o.layer.relationships??[],{uniqueId:a}=o;for(const i of e){const e=i.keyField;if("origin"===i.role){const s=r.get(i.relatedTableId);if(!s||0===s.length)continue;const l=Ge(o.layer,i),c=t.get(l);if(void 0===c||""===c)continue;switch(o.operationType){case"add":for(const t of s)t!==o&&("add"!==t.operationType&&"modify"!==t.operationType||t.after.attributes[c]===o.after.attributes[e]&&n.push([a,t.uniqueId]));break;case"modify":if(o.before.attributes[e]!==o.after.attributes[e])for(const t of s){const r=t.uniqueId;t!==o&&("delete"===t.operationType?t.before.attributes[c]===o.before.attributes[e]?n.push([r,a]):t.before.attributes[c]===o.after.attributes[e]&&n.push([a,r]):"add"===t.operationType?t.after.attributes[c]===o.after.attributes[e]?n.push([a,r]):t.after.attributes[c]===o.before.attributes[e]&&n.push([r,a]):"modify"===t.operationType&&(t.before.attributes[c]!==t.after.attributes[c]?t.after.attributes[c]===o.after.attributes[e]?n.push([a,r]):n.push([r,a]):n.push([a,r])))}break;case"delete":for(const t of s)t!==o&&("delete"!==t.operationType&&"modify"!==t.operationType||t.before.attributes[c]===o.before.attributes[e]&&n.push([t.uniqueId,a]))}}}}return n}function Ge(e,t){return`${e.layerId}:${t.id}`}function Be(e,t){return!!(t?.map&&"utilityNetworks"in t.map&&t.map.utilityNetworks?.length&&t.map.utilityNetworks.some(t=>!(!t.loaded||!e.url?.startsWith(t.featureServiceUrl)||e.layerId!==t.networkSystemLayers.associationsTableId)))}function Ne(e,t,r){const n=[];for(const a of e)Be(a.layer,r)&&n.push(a);if(0===n.length)return;let o=[];for(const a of n){const r=a.layer;switch(a.operationType){case"delete":o=[...Ze(a.before.attributes[r.fieldsIndex.get("fromglobalid").name],e),...Ze(a.before.attributes[r.fieldsIndex.get("toglobalid").name],e)];for(const e of o)t.push([a.uniqueId,e.uniqueId]);break;case"add":o=[...Ze(a.after.attributes[r.fieldsIndex.get("fromglobalid").name],e),...Ze(a.after.attributes[r.fieldsIndex.get("toglobalid").name],e)];for(const e of o)t.push([e.uniqueId,a.uniqueId])}}}function Ze(e,t){const r=[],n=t.filter(({layer:e})=>""!==e.globalIdField&&null!=e.globalIdField);for(const o of n){const t=o.layer.globalIdField;("before"in o&&o.before?.attributes[t]===e||"after"in o&&o.after?.attributes[t]===e)&&r.push(o)}return r}function Qe(e,t={}){return F(e)||k(e)?{}:A(e)?{...e.prototype.attributes,...t}:L(e)?{...e.definition?.defaultValues,...t}:{...t}}async function We(e,r,n,o,a){const i=new t({sourceLayer:r,attributes:n}),{rotation:s,size:l}=ge(i);let c=await W(i,{useSourceLayer:!0,webStyleCache:o,scale:a}),u=!1;for(const t of[l,s]){if(null==t)continue;null==n[t.field]&&(n[t.field]=await t.getDefaultValue(c,e.view),u=!0)}switch(u&&(c=await W(i,{useSourceLayer:!0,webStyleCache:o,scale:a})),c?.type){case"simple-fill":case"polygon-3d":e.polygonSymbol=c;break;case"simple-line":case"line-3d":e.polylineSymbol=c;break;case"simple-marker":case"picture-marker":case"point-3d":case"cim":e.pointSymbol=c;break;case"mesh-3d":e.meshSymbol=c}$e(e.tooltipOptions,l,s)}function $e(e,t,r){e.visualVariables=null!=t||null!=r?{size:null!=t?{unit:t.displayUnit,axis:t.axis,valueType:t.fieldType}:null,rotation:null!=r?{valueType:r.fieldType,rotationType:r.rotationType??"geographic"}:null}:null}function Je(e,t){return e.find(e=>e.layer===t)}function He(e,t){const r=Je(e,t);if(null==r)throw new i("no-editorItem-found","The EditorViewModel provided did not have an EditorItem associated with the specified layer");return r}function Ke(e,t){return e?.find(e=>e.layer===t)}async function Xe(e,t,r,n){switch(t.type){case"3d":return Ye(e,t,r,n);case"2d":return _e(e,t,r,n)}}async function Ye(e,t,r,n){if(0===e.length)return[];const{updatable:a,graphicsByLayer:i}=await r.defer(async()=>{const{results:o}=await h(Y(t,r),n),a=new Map,i=e=>{const t=e.layer,r=a.get(t);if(!r){const e=new Array;return a.set(t,e),e}return r};X(o).forEach(({graphic:e})=>i(e).push(e));const s=e.filter(({capabilities:e,layer:t})=>e.update.enabled&&a.has(t));return 0!==s.length&&r.stopPropagation(),{updatable:s,graphicsByLayer:a}});return h(Promise.allSettled(a.map(async({layer:e})=>{const t=i.get(e),r=et(e);if(t.every(e=>M(e,r)))return t;const a=[];for(const n of t){a.push(n.getObjectId());const e=Object.keys(n.attributes);o(r,e)}const s=e.createQuery();return s.returnGeometry=!1,s.objectIds=a,s.outFields=O(e.fieldsIndex,r),e.queryFeatures(s,{signal:n}).then(({features:e})=>e)})),n)}async function _e(e,t,r,n){if(0===e.length)return[];const{mapPoint:o}=r;if(null==o)return[];let a=null;const i=await r.defer(async()=>{const{results:o}=await h(t.hitTest(r),n);if(0===o.length)return[];const i=new Set;a=X(o),a.forEach(({graphic:e})=>e&&i.add(e.layer));const s=e.filter(e=>i.has(e.layer)&&e.supportsUpdateWorkflow);return s.length>0&&r.stopPropagation(),s});return h(Promise.allSettled(i.map(async({layer:e})=>{const i=e.createQuery();i.returnGeometry=!0,i.outFields=et(e);const s="renderer"in e?P({renderer:e.renderer,pointerType:r.pointerType}):0;i.geometry=K(o,s,t),i.outSpatialReference=t.spatialReference;const{features:l}=await e.queryFeatures(i,{signal:n});return a?.forEach(({graphic:t})=>{t.layer!==e||l.some(e=>e.getObjectId()===t.getObjectId())||l.push(t)}),l})),n)}function et(e){return O(e.fieldsIndex,[e.objectIdField,x({displayField:"displayField"in e?e.displayField:null,fields:e.fields})])}async function tt(e,t,n,o){return rt(e.map(e=>e.getObjectId()??e.attributes[t.objectIdField]).filter(r),t,n,o)}async function rt(e,t,r,n){const o=t.createQuery();o.objectIds=e,o.outFields=["*"],o.returnM=t.capabilities.data.supportsM,o.returnZ=t.capabilities.data.supportsZ,o.returnGeometry=!0,E(t)&&null!=t.infoFor3D||(o.outSpatialReference=r),!E(t)&&t.capabilities?.data.supportsTrueCurve&&(o.returnTrueCurves=!0);const a=await t.queryFeatures(o,{signal:n});return m(n),a.features}async function nt(e){const{graphic:t,sketchViewModel:r,sourceLayer:n,visualVariables:o}=e;await ot(e);const a={multipleSelectionEnabled:!1};return"point"===n.geometryType&&(a.enableRotation=null!=o.rotation,a.enableScaling=null!=o.size),r.update(t,a)}async function ot(e){const{graphic:t,sketchLayer:r,sketchViewModel:n,sourceLayer:o,visualVariables:a,webStyleCache:i}=e;let s=!1;const{rotation:l,size:c}=a;for(const u of[l,c]){if(null==u)continue;const e=t.getAttribute(u.field);if(null!=e)u.setInitialValue(e);else{const e=await u.getDefaultValue(t.symbol,n.view);u.setInitialValue(e),t.setAttribute(u.field,e),s=!0}}if(s){const e="2d"===n.view?.type?n.view.scale:null;await je(t,i,e)}$e(n.tooltipOptions,c,l),r.elevationInfo=o.elevationInfo}function at(e){return null==e||"rotate-start"!==e.type&&"rotate"!==e.type&&"rotate-stop"!==e.type?null:e}function it(e){return null==e||"scale-start"!==e.type&&"scale"!==e.type&&"scale-stop"!==e.type?null:e}function st(e,t,r,n){if(null==t.geometry||"point"!==t.geometry?.type)return!1;const o=t.attributes;let a=!1;const i=n.rotation,s=at(r.toolEventInfo);if(null!=i&&null!=s){const{field:r,getValue:n}=i;if("rotate-stop"===s.type)i.isUpdatingInteractively=!1,i.setInitialValue(t.getAttribute(r));else{i.isUpdatingInteractively=!0;const l=n(s.angle,e);l!==o[r]&&t.setAttribute(r,l),a=!0}}const l=n.size,c=it(r.toolEventInfo);if(null!=l&&null!=c){const{field:r,getValue:n}=l;if("scale-stop"===c.type)l.isUpdatingInteractively=!1,l.setInitialValue(t.getAttribute(r));else{l.isUpdatingInteractively=!0;const i=n(c.xScale,e);i!==o[r]&&t.setAttribute(r,i),a=!0}}return a}async function lt({feature:e,featureClone:t,visualVariableAttributes:r,sketchLayer:n,sketchViewModel:o,view:a,onUpdate:i,webStyleCache:u,addUpdatingPromise:d,addHandle:p}){await je(t,u,"2d"===a.type?a.scale:null);let y=null;if("2d"===o?.view?.type){const e=f(e=>je(t,u,e));y=b(()=>o?.view?.scale,t=>e(t))}const m=t.sourceLayer,h=bt(a,m);await nt({graphic:t,sketchLayer:n,sketchViewModel:o,sourceLayer:m,visualVariables:r,webStyleCache:u});let g=null;h.then(e=>g=e).catch(()=>{});const I=r.size,v=r.rotation,T=b(()=>e.attributes,async e=>{let r=!1;for(const n in e){const o=e[n];o!==t.getAttribute(n)&&(t.setAttribute(n,o),null==I||I.isUpdatingInteractively||I.field!==n||I.setInitialValue(o),null==v||v.isUpdatingInteractively||v.field!==n||v.setInitialValue(o),(null==g||g.requiredFields.includes(n))&&(r=!0))}r&&await je(t,u,"2d"===a.type?a.scale:null)}),S=o.on("update",async e=>{const t=e.graphics[0],s={graphic:t,sketchLayer:n,sketchViewModel:o,sourceLayer:m,visualVariables:r,webStyleCache:u};if("complete"===e.state){if(null===a.activeTool)return nt(s);const e=new AbortController,t=c(e);return p(t),d(w(()=>null===a.activeTool,e.signal).then(async()=>{if(!e.signal.aborted)return e.abort(),nt(s)}))}st(a,t,e,r)&&await je(t,u,"2d"===a.type?a.scale:null),i(wt(t),e)}),F=o.on(["undo","redo"],e=>{i(wt(e.graphics[0]),e)});return s([F,S,l(()=>o.cancel()),T,y])}async function ct(e,t,r,n){e.add(n);const o=r.sourceLayer,i=r.layer??o,c=r.getAttribute(o.objectIdField);let u=null;function d(e){u?.abort(),z(i)?r.visible=e:u=a(async r=>{const n=await bt(t,i);m(r),n.setVisibility?.(c,e)})}return await ut(t,n),d(!1),s([l(async()=>{d(!0);try{if(!t.destroyed){const e=await bt(t,i).catch(()=>{});e&&!e.destroyed&&await w(()=>!e.updating)}}finally{e.remove(n)}})])}async function ut(e,t){if("3d"===e.type){const r=new J({graphic:t}),n=e.trackGraphicState(r);await w(()=>r.displaying||r.error),n.remove()}else await w(()=>t.visible)}const dt={icon:I(24),text:I(12),line:I(1),viewScaleSizeFactor:100};function pt(e,t,r){let n=!1;return e.filter(e=>!!n||(n=e===t,n)).map(e=>r[e]())}function ft(e,t){e.viewModel.syncFeatureTemplates();const r=e.creationInfo;if("awaiting-feature-creation-info"===t[0].id&&r){const n=r.layer,o=e.viewModel.getTemplatesForLayer(n);1===o.length&&"scene"!==n.type&&(r.template=o[0],t.shift())}return t}function yt(e){return"unknown"===e?null:e}function mt(e){e.filesEnabled=!0,e.mode="view",e.capabilities={editing:!0,operations:{add:!0,update:!0,delete:!0}}}const ht=e=>e.includes("-stop")||e.includes("vertex-"),bt=(e,t)=>{const r="subtype-sublayer"===t.type?t.parent:t;return e.whenLayerView(r)};function gt(e){return"createInteractiveEditSession"in e}function wt(e){const t=e.geometry;if("mesh"===t?.type){const r=e.cloneShallow();return r.attributes=u(e.attributes),r.geometry=t.cloneShallow(),r.geometry.transform=t.transform?.clone()??null,r}return e.clone()}function It(e){return e.acquireCursor("progress")}async function vt(e,t){const{template:r}=e;if(null==r)return null;if(j(r))return r.load();if(S(r)){const e=(await import("../../editing/sharedTemplates/SharedTemplate.js")).default,n=U(t,{makeSharedTemplateFromJSON:t=>e.fromJSON(t)}),o=await n.getTemplates({templateIds:[r.templateId],featureService:r.featureService});if(0===o.length)throw new i("editor:failed-to-load-template","Unable to load the provided template");return o[0].load()}return r}function Tt(e){for(const t of e){const{destinationGraphic:e,destinationField:r,sourceGraphic:n,sourceField:o}=t;e.setAttribute(r,n.getAttribute(o))}}function St(e){const t=e.templateExecutorInfo?.completionResults;return t?.length?(t.forEach(e=>Tt(e.relationships)),t.flatMap(e=>e.edits)):null}function Ft(e){const t=ce(e)?e.activeWorkflow:e;if(null==t)return[];if(ie(t))return t.data.layers;const r=t.layer;return r?[r]:[]}function jt({attributes:e},t){const r=new Set;r.add(t.objectIdField),"uniqueIdFields"in t&&t.uniqueIdFields&&t.uniqueIdFields.length>0&&v(r,t.uniqueIdFields);const n={};for(const o of r)null!=e[o]&&(n[o]=e[o]);if("scene"===t.type&&null!=t.infoFor3D){const r=t.associatedLayer?.globalIdField;null!=r&&(e[r]=e[r])}return n}function kt(e){if(!At(e))return e;const t=new Map;for(const r of e){const e=r.getObjectId();if(null!=e){const n=r.sourceLayer??r.layer;p(t,n,()=>[]).push(e)}}return Array.from(t.entries()).map(([e,t])=>({layer:e,objectIds:t}))}function At(e){return 0===e.length||G(e[0])}export{Ne as appendAllUtilityNetworkAssociationRelationships,ft as avoidFeatureTemplateSelectionWithOnlyOneItem,gt as canCreateInteractiveEditSession,wt as cloneGraphicExceptMesh,Pe as createLayerIdMap,Ce as createRelationshipKeyMap,ke as createToolFromGeometryType,pt as createWorkflowSteps,Xe as fetchCandidates,tt as fetchFullFeatures,rt as fetchFullFeaturesByObjectId,De as findAllDependencies,Ze as findChangesByGlobalId,Je as findEditorItemForLayer,He as findEditorItemForLayerOrThrow,Ke as findLayerInfo,Ge as generateHashForRelationship,Qe as getCreationAttributes,vt as getFullTemplateForCreationInfo,Ft as getLayersFromWorkflow,we as getRotationVariableAttribute,St as getServiceEditsFromWorkflowData,xe as getServiceInfoForLayer,qe as getServiceLayersById,Te as getSizeVariableAttribute,ge as getVisualVariableAttributes,be as getVisualVariablesForLayer,re as isAnyUpdateLeafWorkflow,ne as isBatchAttributeFormViewModel,oe as isCreateFeaturesWorkflow,ae as isFeatureFormViewModel,At as isGraphicsArray,ue as isMergeFeaturesWorkflow,fe as isMergeWorkflowOptions,pe as isParentWorkflow,de as isSplitFeatureWorkflow,ye as isSplitWorkflowOptions,ht as isTerminalUpdateEventType,se as isUpdateFeatureWorkflow,ie as isUpdateFeaturesWorkflow,he as isUpdateFeaturesWorkflowOptions,le as isUpdateRecordWorkflow,ce as isUpdateWorkflow,Be as isUtilityNetworkAssociationsTable,jt as makeMinimalAttributes,Ee as orderEditsByRelationshipDependencies,mt as prepareAttachmentsForCreateFeaturesWorkflow,Tt as setRelationshipFields,lt as setUpGeometryUpdate,Le as setUpSketchCreateWatchers,ot as setVisualVariablesAndElevationInfoForUpdate,It as showProgressCursor,dt as sizeDefaults,yt as sizeVariableUnitToLengthUnit,Ae as startCreatingNewFeature,nt as startUpdatingFeatureGeometry,ct as swapForEditingSession,kt as toFeatureInfos,je as updateGraphicSymbolWhenRequired,st as visualVariableInteractiveUpdate,bt as whenEditorLayerView,ut as whenGraphicDisplayed,me as workflowInfluencesOutcomeOfParent};
|
|
5
|
+
import e from"../../Color.js";import t from"../../Graphic.js";import{isSome as r,equals as n,addMany as o}from"../../core/arrayUtils.js";import{createTask as a}from"../../core/asyncUtils.js";import i from"../../core/Error.js";import{handlesGroup as s,makeHandle as l,abortHandle as c}from"../../core/handleUtils.js";import{clone as u}from"../../core/lang.js";import d from"../../core/Logger.js";import{getOrCreateMapValue as p}from"../../core/MapUtils.js";import{debounce as f,isPromiseLike as y,throwIfAborted as m,whenOrAbort as h}from"../../core/promiseUtils.js";import{watch as b,on as g,whenOnce as w}from"../../core/reactiveUtils.js";import{px2pt as I}from"../../core/screenUtils.js";import{addMany as v}from"../../core/SetUtils.js";import{diff as T}from"../../core/accessorSupport/diffUtils.js";import{isSharedTemplateOrMetadata as S,isSharedGroupTemplate as F,isSharedTemplate as j,isSharedPresetTemplate as k,isStandardFeatureTemplate as A,isSharedFeatureTemplate as L}from"../../editing/templateUtils.js";import{getSharedTemplateProvider as U}from"../../editing/sharedTemplates/SharedTemplateProvider.js";import V from"../../layers/GraphicsLayer.js";import{featureHasFields as M,fixFields as O,getDisplayFieldName as x}from"../../layers/support/fieldUtils.js";import{isSubtypeSublayer as q,isGraphicsLayer as z,isSceneLayer as E}from"../../layers/support/layerUtils.js";import{calculateTolerance as P}from"../../renderers/support/clickToleranceUtils.js";import{meterIn as C}from"../../renderers/support/lengthUtils.js";import{isRenderer as R}from"../../renderers/support/typeUtils.js";import{getTransformationType as D}from"../../renderers/visualVariables/support/sizeVariableUtils.js";import{isGraphic as G}from"../../support/guards.js";import B from"../../symbols/SimpleFillSymbol.js";import N from"../../symbols/SimpleLineSymbol.js";import Z from"../../symbols/SimpleMarkerSymbol.js";import{to3D as Q}from"../../symbols/support/symbolConversion.js";import{getDisplayedSymbol as W}from"../../symbols/support/symbolUtils.js";import{getServices as $}from"../../undoredo/support/Services.js";import{GraphicState as J}from"../../views/3d/layers/graphics/GraphicState.js";import{defaultDrawingMode as H}from"../../views/draw/drawingModes.js";import{createQueryGeometry as K}from"../../views/support/drapedUtils.js";import{filterGraphicHits as X,hitTestSelectSimilarDistance as Y}from"../../views/support/hitTestSelectUtils.js";import{dependencySort as _}from"./support/dependencySort.js";import{isDrawGraphicTool as ee}from"../Sketch/support/sketchUtils.js";const te=()=>d.getLogger("esri.widgets.Editor.workflowUtils");function re(e){return le(e)||ie(e)}function ne(e){return!!e&&"features"in e}function oe(e){return null!=e&&"create-features"===e.type}function ae(e){return!!e&&"feature"in e}function ie(e){return null!=e&&"update-features"===e.type}function se(e){return null!=e&&"update-feature"===e.type}function le(e){return null!=e&&e.type.includes("update-")&&"fullFeature"in e}function ce(e){return null!=e&&"update"===e.type}function ue(e){return null!=e&&"merge-features"===e.type}function de(e){return null!=e&&"split-feature"===e.type}function pe(e){const t=e?.type;return"update-feature"===t||"update-table-record"===t||"update-features"===t||"split-feature"===t}function fe(e){return"merge"===e?.type}function ye(e){return"split"===e?.type}function me(e){return ue(e)||de(e)}function he(e){return"update-multiple"===e?.type}function be(e){const t=e&&"renderer"in e?e.renderer:null;if(!Fe(t))return{rotation:null,size:null};const r=t.getVisualVariablesForType("rotation").filter(e=>(!e.axis||"heading"===e.axis)&&e.field&&!e.valueExpression),n=t.getVisualVariablesForType("size").filter(e=>e.field&&!e.useSymbolValue&&!e.valueExpression&&"real-world-size"===D(e));return{rotation:1===r.length?r[0]:null,size:1===n.length?n[0]:null}}function ge(e){const t=e.sourceLayer;if(!(t&&"renderer"in t&&Fe(t.renderer)))return{rotation:null,size:null};const{rotation:r,size:n}=be(t);let o=null,a=null;if(r){const e=t.fields?.filter(e=>e.name===r.field),n=1===e?.length?e[0]:null;o=we(r,n)}if(n){const e=t.fields?.filter(e=>e.name===n.field),r=1===e?.length?e[0]:null;a=Te(n,r)}return{rotation:o,size:a}}function we(e,t){const r="heading"===(e.axis||"heading")&&"arithmetic"===e.rotationType?-1:1,n=t?.type??"double",o={initial:0,current:0};return{field:e.field,fieldType:n,getDefaultValue:()=>Promise.resolve(0),getValue:e=>(o.current=o.initial-r*e,Se((o.current+360)%360,n)),setInitialValue:e=>{o.initial=e,o.current=0},isUpdatingInteractively:!1,rotationType:e.rotationType??"geographic"}}function Ie(e,t){switch(t){case"width":return e[0];case"depth":return e[1];case"height":return e[2];default:return e[2]||e[1]||e[0]}}async function ve(e,t,r){if(null==t)return 0;const{symbol:n}=Q(t);if(null==n||"web-style"===n.type||"cim"===n.type)return 0;const o=n.symbolLayers.at(0);if(!o)return 0;switch(o.type){case"icon":{const{computeIconLayerResourceSize:e}=await import("../../symbols/support/symbolLayerUtils.js");return Math.min(dt.icon,(await e(o,dt.icon))[0])||dt.icon}case"text":return dt.text;case"line":return dt.line;case"object":{const{computeObjectLayerResourceSize:t}=await import("../../symbols/support/symbolLayerUtils.js");return Ie(await t(o,e.scale/dt.viewScaleSizeFactor),r)}case"path":case"extrude":return e.scale/dt.viewScaleSizeFactor;default:return 0}}function Te(e,t){const r=e.axis,n=t?.type??"double",o={initial:0,current:0},a=C[e.valueUnit]??1;let i;return i="area"===e.valueRepresentation?e=>(e*a/2)**2*Math.PI:"radius"===e.valueRepresentation||"distance"===e.valueRepresentation?e=>e*a/2:e=>e*a,{field:e.field,fieldType:n,getDefaultValue:async(e,t)=>Se(i(await ve(t,e,r)),n),getValue:(e,t)=>(o.initial||(o.initial=t.pixelSizeAt(t.center)),o.current=o.initial*e,Se(o.current,n)),setInitialValue:e=>{o.initial=e,o.current=0},isUpdatingInteractively:!1,displayUnit:yt(e.valueUnit),axis:e.axis}}function Se(e,t){switch(t){case"small-integer":case"integer":case"long":return Math.round(e);case"double":case"single":return e;default:return 0}}function Fe(e){if(!R(e))return!1;switch(e?.type){case"class-breaks":case"simple":case"unique-value":case"dot-density":case"dictionary":case"pie-chart":return!0;default:return!1}}async function je(e,t,r){const n=await W(e,{useSourceLayer:!0,ignoreGraphicSymbol:!0,webStyleCache:t,scale:r});null!=T(e.symbol,n)&&(e.symbol=n)}function ke(e,t){if(!e||!t)throw new Error("no geometry type");if("multipatch"===e)return{tool:"mesh",createOptions:{mode:"hybrid"}};const r=new Map;r.set("circle",{mode:"freehand"}),r.set("rectangle",{mode:"freehand"});const n={mode:H,optionsPerTool:r};if(S(t)){const o=t.defaultTool,a=F(t)?t.definition?.inputGeometryType??e:e;switch(o){case"freehand":case"stream-line":return{tool:"polyline"===a?"freehandPolyline":"freehandPolygon",createOptions:n};case"autocomplete-freehand-polygons":case"stream-polygon":return{tool:"freehandPolygon",createOptions:n};case"autocomplete-polygons":case"difference-polygon":case"create-structures":case"polygon":case"trace":return{tool:"polygon"===a?"polygon":"polyline",createOptions:n};case"circle":return r.get("circle").preserveAspectRatio=!0,{tool:"circle",createOptions:n};case"ellipse":return r.get("circle").preserveAspectRatio=!1,{tool:"circle",createOptions:n};case"create-points-along-line":case"multipoint":return{tool:"multipoint",createOptions:n};case"line":case"radial-line":case"right-angle-line":case"split":case"two-point-line":return{tool:"polyline",createOptions:n};case"rectangle":case"regular-polygon":case"right-angle-polygon":return{tool:"rectangle",createOptions:n};case"elevation-point-from-contour":case"elevation-point-from-dem":case"parcel-seed":case"point":case"point-and-rotation":case"point-at-end-of-line":return{tool:"point",createOptions:n}}}else{const o=t.drawingTool;if("circle"===o||"ellipse"===o)return r.get("circle").preserveAspectRatio="circle"===o,{tool:"circle",createOptions:n};if("rectangle"===o)return{tool:"rectangle",createOptions:n};if("freehand"===o)return{tool:"polygon"===e?"freehandPolygon":"freehandPolyline",createOptions:n}}return{tool:e,createOptions:n}}async function Ae(e,t,r,n){const{creationInfo:o,fullTemplate:a}=r;if(!o)throw new i("featureworkflow","No creation info provided.");const s=o.layer,l=Qe(a,o.attributeOverrides),{view:c}=e,u="2d"===c?.type;F(a)||k(a)||await We(e,s,l,n,u?c.scale:null);const{capabilities:d}=s;t.elevationInfo=s.elevationInfo;const p=ke(s.geometryType,a);e.defaultCreateOptions={graphicProperties:{attributes:l,sourceLayer:s},mode:p.createOptions.mode,optionsPerTool:p.createOptions.optionsPerTool,preserveAspectRatio:p.createOptions.preserveAspectRatio,hasZ:d.data.supportsZ,defaultZ:(u?d.editing.zDefault:null)??e.defaultCreateOptions.defaultZ},null==o.geometryToPlace?await e.create(p.tool):await e.place(o.geometryToPlace,{graphicProperties:{attributes:l,sourceLayer:s}})}async function Le(e){return s([Ue(e),Ve(e)])}function Ue({creationAttributes:e,data:t,sketchViewModel:r,view:n,webStyleCache:o}){const{creationInfo:a}=t,{fullTemplate:i}=t;if(!a||"2d"!==n?.type||F(i)||k(i))return null;const s=f(t=>We(r,a.layer,e,o,t));return b(()=>n.scale,e=>s(e))}function Ve({data:t,sketchViewModel:r,view:n}){const{templateExecutorInfo:o}=t;if(!o)return null;const a=r.activeComponent;if(!n||!ee(a))return te().error(new i("featureworkflow","Failed to set up template feedback.")),null;const c=new V({effect:"saturate(0.6) opacity(0.8)",listMode:"hide",title:"Shared Template Feedback Graphics"});n.map?.add(c);const{executor:u,serviceLayersById:d}=o,p=n.theme?.accentColor??new e([255,165,0,1]);return s([g(()=>a,["cursor-update","vertex-add"],()=>{c.removeAll();const e=a.graphic?.geometry;if(!e||!Me(e))return;const t=u(e,"digitizing");if(!y(t))for(const r of t.edits){const e=d.get(r.id);if(e&&r.addFeatures&&0!==r.addFeatures.length)for(const t of e)if(!t.isTable)for(const e of r.addFeatures){const t=Oe(e,p);t&&c.add(t)}}}),l(()=>{n.map.remove(c),c.destroy()})])}function Me(e){switch(e.type){case"point":case"multipoint":return!0;case"polyline":return e.paths[0].length>1;case"polygon":{const t=e.rings[0];return n(t.at(0),t.at(-1))?t.length>2:t.length>1}default:return!1}}function Oe(e,r){let n=null;switch(e.geometry?.type){case"point":case"multipoint":n=new Z({angle:0,color:r,outline:new N({cap:"round",color:r,join:"round",miterLimit:1,style:"solid",width:1}),path:"undefined",size:8,style:"circle",xoffset:0,yoffset:0});break;case"polygon":n=new B({color:r,outline:new N({cap:"round",color:r,join:"round",miterLimit:1,style:"solid",width:3}),style:"none"});break;case"polyline":n=new N({cap:"round",color:r,join:"round",miterLimit:1,style:"solid",width:2});break;default:return null}return new t({geometry:e.geometry,symbol:n,attributes:{...e.attributes}})}function xe(e,t){const r=$(t),n=q(e)?e.parent:e;return r.tablesAndLayersLookup.get(n)}function qe(e,t){const r=xe(e,t);if(!r)return new Map;const n=new Map;for(const o of r.layersAndTables)p(n,o.layerId,()=>[]).push(o);return n}function ze(e){const t=e.objectIdField,r=e.globalIdField??"";return{id:e.layerId,identifierFields:{objectIdField:t,globalIdField:r},addFeatures:[],deleteAttachments:[],addAttachments:[],deleteFeatures:[],updateFeatures:[]}}function Ee(e){const{edits:t,serviceInfo:n,view:o,findOriginalFeature:a}=e,i=Pe(n.layersAndTables),s=n.layersAndTables.toArray(),{allEditData:l,editDataByLayerIdMap:c,editDataByIdMap:u}=Re(t,i,a),d=De(l,Ce(s,c),c);if(o&&Ne(l,d,o),0===d.length)return t;const p=_(d,{continueOnCircularDependency:!0}).map(e=>u.get(e)).filter(r),f=new Map;for(const r of p)f.set(r.uniqueId,r);const y=[];for(const r of l)f.has(r.uniqueId)||y.push(r);const m=[];let h=null;for(const r of p){const{layer:e}=r;switch(null==h?h=ze(e):h.id!==e.layerId&&(m.push(h),h=ze(e)),r.operationType){case"add":case"modify":h.addFeatures.push(r.after);break;case"delete":h.deleteFeatures.push(r.before)}}null!==h&&m.push(h);for(const r of y){const e=r.layer.layerId,t=m.find(t=>t.id===e)??ze(r.layer);switch(m.includes(t)||m.push(t),r.operationType){case"add":t.addFeatures.push(r.after);break;case"modify":t.updateFeatures.push(r.after);break;case"delete":t.deleteFeatures.push(r.before);break;case"deleteAttachment":t.deleteAttachments.push(r.attachmentId);break;case"addAttachment":t.addAttachments.push(r.attachment)}}for(const r of m)void 0!==r.deleteAttachments&&0===r.deleteAttachments.length&&delete r.deleteAttachments,void 0!==r.addAttachments&&0===r.addAttachments.length&&delete r.addAttachments;return m}function Pe(e){const t=new Map;for(const r of e)t.set(r.layerId,r);return t}function Ce(e,t){const r=new Map;for(const n of e)for(const e of n.relationships??[])if(r.set(Ge(n,e),""),t.has(e.relatedTableId)){const o=t.get(e.relatedTableId);if(o.length>0)for(const t of o[0].layer.relationships??[])if(t.id===e.id){r.set(Ge(n,e),t.keyField);break}}return r}function Re(e,t,r){const n=new Map,o=[],a=new Map;let s=1;for(const l of e){const e=[],c=t.get(l.id);if(!c)throw new i("featureworkflow",`Failed to prepare applyEdits payload. Layer with id ${l.id} not found.`);for(const t of l.addFeatures??[])e.push({uniqueId:"T"+s++,operationType:"add",layer:c,after:t});for(const t of l.deleteFeatures??[])e.push({uniqueId:"T"+s++,operationType:"delete",before:t,layer:c});for(const t of l.deleteAttachments??[])e.push({uniqueId:"T"+s++,operationType:"deleteAttachment",attachmentId:t,layer:c});for(const t of l.addAttachments??[])e.push({uniqueId:"T"+s++,operationType:"addAttachment",attachment:t,layer:c});for(const t of l.updateFeatures??[])e.push({uniqueId:"T"+s++,operationType:"modify",before:r(t),after:t,layer:c});n.set(c.layerId,e);for(const t of e)o.push(t),a.set(t.uniqueId,t)}return{allEditData:o,editDataByIdMap:a,editDataByLayerIdMap:n}}function De(e,t,r){const n=[];for(const o of e){const e=o.layer.relationships??[],{uniqueId:a}=o;for(const i of e){const e=i.keyField;if("origin"===i.role){const s=r.get(i.relatedTableId);if(!s||0===s.length)continue;const l=Ge(o.layer,i),c=t.get(l);if(void 0===c||""===c)continue;switch(o.operationType){case"add":for(const t of s)t!==o&&("add"!==t.operationType&&"modify"!==t.operationType||t.after.attributes[c]===o.after.attributes[e]&&n.push([a,t.uniqueId]));break;case"modify":if(o.before.attributes[e]!==o.after.attributes[e])for(const t of s){const r=t.uniqueId;t!==o&&("delete"===t.operationType?t.before.attributes[c]===o.before.attributes[e]?n.push([r,a]):t.before.attributes[c]===o.after.attributes[e]&&n.push([a,r]):"add"===t.operationType?t.after.attributes[c]===o.after.attributes[e]?n.push([a,r]):t.after.attributes[c]===o.before.attributes[e]&&n.push([r,a]):"modify"===t.operationType&&(t.before.attributes[c]!==t.after.attributes[c]?t.after.attributes[c]===o.after.attributes[e]?n.push([a,r]):n.push([r,a]):n.push([a,r])))}break;case"delete":for(const t of s)t!==o&&("delete"!==t.operationType&&"modify"!==t.operationType||t.before.attributes[c]===o.before.attributes[e]&&n.push([t.uniqueId,a]))}}}}return n}function Ge(e,t){return`${e.layerId}:${t.id}`}function Be(e,t){return!!(t?.map&&"utilityNetworks"in t.map&&t.map.utilityNetworks?.length&&t.map.utilityNetworks.some(t=>!(!t.loaded||!e.url?.startsWith(t.featureServiceUrl)||e.layerId!==t.networkSystemLayers.associationsTableId)))}function Ne(e,t,r){const n=[];for(const a of e)Be(a.layer,r)&&n.push(a);if(0===n.length)return;let o=[];for(const a of n){const r=a.layer;switch(a.operationType){case"delete":o=[...Ze(a.before.attributes[r.fieldsIndex.get("fromglobalid").name],e),...Ze(a.before.attributes[r.fieldsIndex.get("toglobalid").name],e)];for(const e of o)t.push([a.uniqueId,e.uniqueId]);break;case"add":o=[...Ze(a.after.attributes[r.fieldsIndex.get("fromglobalid").name],e),...Ze(a.after.attributes[r.fieldsIndex.get("toglobalid").name],e)];for(const e of o)t.push([e.uniqueId,a.uniqueId])}}}function Ze(e,t){const r=[],n=t.filter(({layer:e})=>""!==e.globalIdField&&null!=e.globalIdField);for(const o of n){const t=o.layer.globalIdField;("before"in o&&o.before?.attributes[t]===e||"after"in o&&o.after?.attributes[t]===e)&&r.push(o)}return r}function Qe(e,t={}){return F(e)||k(e)?{}:A(e)?{...e.prototype.attributes,...t}:L(e)?{...e.definition?.defaultValues,...t}:{...t}}async function We(e,r,n,o,a){const i=new t({sourceLayer:r,attributes:n}),{rotation:s,size:l}=ge(i);let c=await W(i,{useSourceLayer:!0,webStyleCache:o,scale:a}),u=!1;for(const t of[l,s]){if(null==t)continue;null==n[t.field]&&(n[t.field]=await t.getDefaultValue(c,e.view),u=!0)}switch(u&&(c=await W(i,{useSourceLayer:!0,webStyleCache:o,scale:a})),c?.type){case"simple-fill":case"polygon-3d":e.polygonSymbol=c;break;case"simple-line":case"line-3d":e.polylineSymbol=c;break;case"simple-marker":case"picture-marker":case"point-3d":case"cim":e.pointSymbol=c;break;case"mesh-3d":e.meshSymbol=c}$e(e.tooltipOptions,l,s)}function $e(e,t,r){e.visualVariables=null!=t||null!=r?{size:null!=t?{unit:t.displayUnit,axis:t.axis,valueType:t.fieldType}:null,rotation:null!=r?{valueType:r.fieldType,rotationType:r.rotationType??"geographic"}:null}:null}function Je(e,t){return e.find(e=>e.layer===t)}function He(e,t){const r=Je(e,t);if(null==r)throw new i("no-editorItem-found","The EditorViewModel provided did not have an EditorItem associated with the specified layer");return r}function Ke(e,t){return e?.find(e=>e.layer===t)}async function Xe(e,t,r,n){switch(t.type){case"3d":return Ye(e,t,r,n);case"2d":return _e(e,t,r,n)}}async function Ye(e,t,r,n){if(0===e.length)return[];const{updatable:a,graphicsByLayer:i}=await r.defer(async()=>{const{results:o}=await h(Y(t,r),n),a=new Map,i=e=>{const t=e.layer,r=a.get(t);if(!r){const e=new Array;return a.set(t,e),e}return r};X(o).forEach(({graphic:e})=>i(e).push(e));const s=e.filter(({capabilities:e,layer:t})=>e.update.enabled&&a.has(t));return 0!==s.length&&r.stopPropagation(),{updatable:s,graphicsByLayer:a}});return h(Promise.allSettled(a.map(async({layer:e})=>{const t=i.get(e),r=et(e);if(t.every(e=>M(e,r)))return t;const a=[];for(const n of t){a.push(n.getObjectId());const e=Object.keys(n.attributes);o(r,e)}const s=e.createQuery();return s.returnGeometry=!1,s.objectIds=a,s.outFields=O(e.fieldsIndex,r),e.queryFeatures(s,{signal:n}).then(({features:e})=>e)})),n)}async function _e(e,t,r,n){if(0===e.length)return[];const{mapPoint:o}=r;if(null==o)return[];let a=null;const i=await r.defer(async()=>{const{results:o}=await h(t.hitTest(r),n);if(0===o.length)return[];const i=new Set;a=X(o),a.forEach(({graphic:e})=>e&&i.add(e.layer));const s=e.filter(e=>i.has(e.layer)&&e.supportsUpdateWorkflow);return s.length>0&&r.stopPropagation(),s});return h(Promise.allSettled(i.map(async({layer:e})=>{const i=e.createQuery();i.returnGeometry=!0,i.outFields=et(e);const s="renderer"in e?P({renderer:e.renderer,pointerType:r.pointerType}):0;i.geometry=K(o,s,t),i.outSpatialReference=t.spatialReference;const{features:l}=await e.queryFeatures(i,{signal:n});return a?.forEach(({graphic:t})=>{t.layer!==e||l.some(e=>e.getObjectId()===t.getObjectId())||l.push(t)}),l})),n)}function et(e){return O(e.fieldsIndex,[e.objectIdField,x({displayField:"displayField"in e?e.displayField:null,fields:e.fields})])}async function tt(e,t,n,o){return rt(e.map(e=>e.getObjectId()??e.attributes[t.objectIdField]).filter(r),t,n,o)}async function rt(e,t,r,n){const o=t.createQuery();o.objectIds=e,o.outFields=["*"],o.returnM=t.capabilities.data.supportsM,o.returnZ=t.capabilities.data.supportsZ,o.returnGeometry=!0,E(t)&&null!=t.infoFor3D||(o.outSpatialReference=r),!E(t)&&t.capabilities?.data.supportsTrueCurve&&(o.returnTrueCurves=!0);const a=await t.queryFeatures(o,{signal:n});return m(n),a.features}async function nt(e){const{graphic:t,sketchViewModel:r,sourceLayer:n,visualVariables:o}=e;await ot(e);const a={multipleSelectionEnabled:!1};return"point"===n.geometryType&&(a.enableRotation=null!=o.rotation,a.enableScaling=null!=o.size),r.update(t,a)}async function ot(e){const{graphic:t,sketchLayer:r,sketchViewModel:n,sourceLayer:o,visualVariables:a,webStyleCache:i}=e;let s=!1;const{rotation:l,size:c}=a;for(const u of[l,c]){if(null==u)continue;const e=t.getAttribute(u.field);if(null!=e)u.setInitialValue(e);else{const e=await u.getDefaultValue(t.symbol,n.view);u.setInitialValue(e),t.setAttribute(u.field,e),s=!0}}if(s){const e="2d"===n.view?.type?n.view.scale:null;await je(t,i,e)}$e(n.tooltipOptions,c,l),r.elevationInfo=o.elevationInfo}function at(e){return null==e||"rotate-start"!==e.type&&"rotate"!==e.type&&"rotate-stop"!==e.type?null:e}function it(e){return null==e||"scale-start"!==e.type&&"scale"!==e.type&&"scale-stop"!==e.type?null:e}function st(e,t,r,n){if(null==t.geometry||"point"!==t.geometry?.type)return!1;const o=t.attributes;let a=!1;const i=n.rotation,s=at(r.toolEventInfo);if(null!=i&&null!=s){const{field:r,getValue:n}=i;if("rotate-stop"===s.type)i.isUpdatingInteractively=!1,i.setInitialValue(t.getAttribute(r));else{i.isUpdatingInteractively=!0;const l=n(s.angle,e);l!==o[r]&&t.setAttribute(r,l),a=!0}}const l=n.size,c=it(r.toolEventInfo);if(null!=l&&null!=c){const{field:r,getValue:n}=l;if("scale-stop"===c.type)l.isUpdatingInteractively=!1,l.setInitialValue(t.getAttribute(r));else{l.isUpdatingInteractively=!0;const i=n(c.xScale,e);i!==o[r]&&t.setAttribute(r,i),a=!0}}return a}async function lt({feature:e,featureClone:t,visualVariableAttributes:r,sketchLayer:n,sketchViewModel:o,view:a,onUpdate:i,webStyleCache:u,addUpdatingPromise:d,addHandle:p}){await je(t,u,"2d"===a.type?a.scale:null);let y=null;if("2d"===o?.view?.type){const e=f(e=>je(t,u,e));y=b(()=>o?.view?.scale,t=>e(t))}const m=t.sourceLayer,h=bt(a,m);await nt({graphic:t,sketchLayer:n,sketchViewModel:o,sourceLayer:m,visualVariables:r,webStyleCache:u});let g=null;h.then(e=>g=e).catch(()=>{});const I=r.size,v=r.rotation,T=b(()=>e.attributes,async e=>{let r=!1;for(const n in e){const o=e[n];o!==t.getAttribute(n)&&(t.setAttribute(n,o),null==I||I.isUpdatingInteractively||I.field!==n||I.setInitialValue(o),null==v||v.isUpdatingInteractively||v.field!==n||v.setInitialValue(o),(null==g||g.requiredFields.includes(n))&&(r=!0))}r&&await je(t,u,"2d"===a.type?a.scale:null)}),S=o.on("update",async e=>{const t=e.graphics[0],s={graphic:t,sketchLayer:n,sketchViewModel:o,sourceLayer:m,visualVariables:r,webStyleCache:u};if("complete"===e.state){if(null===a.activeTool)return nt(s);const e=new AbortController,t=c(e);return p(t),d(w(()=>null===a.activeTool,e.signal).then(async()=>{if(!e.signal.aborted)return e.abort(),nt(s)}))}st(a,t,e,r)&&await je(t,u,"2d"===a.type?a.scale:null),i(wt(t),e)}),F=o.on(["undo","redo"],e=>{i(wt(e.graphics[0]),e)});return s([F,S,l(()=>o.cancel()),T,y])}async function ct(e,t,r,n){e.add(n);const o=r.sourceLayer,i=r.layer??o,c=r.getAttribute(o.objectIdField);let u=null;function d(e){u?.abort(),z(i)?r.visible=e:u=a(async r=>{const n=await bt(t,i);m(r),n.setVisibility?.(c,e)})}return await ut(t,n),d(!1),s([l(async()=>{d(!0);try{if(!t.destroyed){const e=await bt(t,i).catch(()=>{});e&&!e.destroyed&&await w(()=>!e.updating)}}finally{e.remove(n)}})])}async function ut(e,t){if("3d"===e.type){const r=new J({graphic:t}),n=e.trackGraphicState(r);await w(()=>r.displaying||r.error),n.remove()}else await w(()=>t.visible)}const dt={icon:I(24),text:I(12),line:I(1),viewScaleSizeFactor:100};function pt(e,t,r){let n=!1;return e.filter(e=>!!n||(n=e===t,n)).map(e=>r[e]())}function ft(e,t){e.viewModel.syncFeatureTemplates();const r=e.creationInfo;if("awaiting-feature-creation-info"===t[0].id&&r){const n=r.layer,o=e.viewModel.getTemplatesForLayer(n);1===o.length&&"scene"!==n.type&&(r.template=o[0],t.shift())}return t}function yt(e){return"unknown"===e?null:e}function mt(e){e.filesEnabled=!0,e.mode="view",e.capabilities={editing:!0,operations:{add:!0,update:!0,delete:!0}}}const ht=e=>e.includes("-stop")||e.includes("vertex-"),bt=(e,t)=>{const r="subtype-sublayer"===t.type?t.parent:t;return e.whenLayerView(r)};function gt(e){return"createInteractiveEditSession"in e}function wt(e){const t=e.geometry;if("mesh"===t?.type){const r=e.cloneShallow();return r.attributes=u(e.attributes),r.geometry=t.cloneShallow(),r.geometry.transform=t.transform?.clone()??null,r}return e.clone()}function It(e){return e.acquireCursor("progress")}async function vt(e,t){const{template:r}=e;if(null==r)return null;if(j(r))return r.load();if(S(r)){const e=(await import("../../editing/sharedTemplates/SharedTemplate.js")).default,n=U(t,{makeSharedTemplateFromJSON:t=>e.fromJSON(t)}),o=await n.getTemplates({templateIds:[r.templateId],featureService:r.featureService});if(0===o.length)throw new i("editor:failed-to-load-template","Unable to load the provided template");return o[0].load()}return r}function Tt(e){for(const t of e){const{destinationGraphic:e,destinationField:r,sourceGraphic:n,sourceField:o}=t;e.setAttribute(r,n.getAttribute(o))}}function St(e){const t=e.templateExecutorInfo?.completionResults;return t?.length?(t.forEach(e=>Tt(e.relationships)),t.flatMap(e=>e.edits)):null}function Ft(e){const t=ce(e)?e.activeWorkflow:e;if(null==t)return[];if(ie(t))return t.data.layers;const r=t.layer;return r?[r]:[]}function jt({attributes:e},t){const r=new Set;r.add(t.objectIdField),"uniqueIdFields"in t&&t.uniqueIdFields&&t.uniqueIdFields.length>0&&v(r,t.uniqueIdFields);const n={};for(const o of r)null!=e[o]&&(n[o]=e[o]);if("scene"===t.type&&null!=t.infoFor3D){const r=t.associatedLayer?.globalIdField;null!=r&&(e[r]=e[r])}return n}function kt(e){if(!At(e))return e;const t=new Map;for(const r of e){const e=r.getObjectId();if(null!=e){const n=r.sourceLayer??r.layer;p(t,n,()=>[]).push(e)}}return Array.from(t.entries()).map(([e,t])=>({layer:e,objectIds:t}))}function At(e){return 0===e.length||G(e[0])}export{Ne as appendAllUtilityNetworkAssociationRelationships,ft as avoidFeatureTemplateSelectionWithOnlyOneItem,gt as canCreateInteractiveEditSession,wt as cloneGraphicExceptMesh,Pe as createLayerIdMap,Ce as createRelationshipKeyMap,ke as createToolFromGeometryType,pt as createWorkflowSteps,Xe as fetchCandidates,tt as fetchFullFeatures,rt as fetchFullFeaturesByObjectId,De as findAllDependencies,Ze as findChangesByGlobalId,Je as findEditorItemForLayer,He as findEditorItemForLayerOrThrow,Ke as findLayerInfo,Ge as generateHashForRelationship,Qe as getCreationAttributes,vt as getFullTemplateForCreationInfo,Ft as getLayersFromWorkflow,we as getRotationVariableAttribute,St as getServiceEditsFromWorkflowData,xe as getServiceInfoForLayer,qe as getServiceLayersById,Te as getSizeVariableAttribute,ge as getVisualVariableAttributes,be as getVisualVariablesForLayer,re as isAnyUpdateLeafWorkflow,ne as isBatchAttributeFormViewModel,oe as isCreateFeaturesWorkflow,ae as isFeatureFormViewModel,At as isGraphicsArray,ue as isMergeFeaturesWorkflow,fe as isMergeWorkflowOptions,pe as isParentWorkflow,de as isSplitFeatureWorkflow,ye as isSplitWorkflowOptions,ht as isTerminalUpdateEventType,se as isUpdateFeatureWorkflow,ie as isUpdateFeaturesWorkflow,he as isUpdateFeaturesWorkflowOptions,le as isUpdateRecordWorkflow,ce as isUpdateWorkflow,Be as isUtilityNetworkAssociationsTable,jt as makeMinimalAttributes,Ee as orderEditsByRelationshipDependencies,mt as prepareAttachmentsForCreateFeaturesWorkflow,Tt as setRelationshipFields,lt as setUpGeometryUpdate,Le as setUpSketchCreateWatchers,ot as setVisualVariablesAndElevationInfoForUpdate,It as showProgressCursor,dt as sizeDefaults,yt as sizeVariableUnitToLengthUnit,Ae as startCreatingNewFeature,nt as startUpdatingFeatureGeometry,ct as swapForEditingSession,kt as toFeatureInfos,je as updateGraphicSymbolWhenRequired,st as visualVariableInteractiveUpdate,bt as whenEditorLayerView,ut as whenGraphicDisplayed,me as workflowInfluencesOutcomeOfParent};
|