@arcgis/core 4.33.0-next.20250428 → 4.33.0-next.20250430
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/AreaMeasurementAnalysis.js +1 -1
- package/applications/Components/baUtils.js +5 -0
- package/assets/components/assets/icon/mosaicMethodBlend16.json +1 -1
- package/assets/components/assets/icon/mosaicMethodBlend24.json +1 -1
- package/assets/components/assets/icon/mosaicMethodBlend32.json +1 -1
- package/assets/components/assets/icon/mosaicMethodNorthWest32.json +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{9a1c058d3ecd1db0e996.js → 0c338364cb55afdbd580.js} +1 -1
- package/assets/esri/core/workers/chunks/{4351b3e54b309935faed.js → 173737c60fa54f7d82bb.js} +1 -1
- package/assets/esri/core/workers/chunks/{90dc783a617ff053e862.js → 181ad3cee0b30a72e7c7.js} +1 -1
- package/assets/esri/core/workers/chunks/{6d230c55cde66ee905b3.js → 1a0d4b7de2f98ff9cc01.js} +1 -1
- package/assets/esri/core/workers/chunks/210e057fe5e66abea984.js +1 -0
- package/assets/esri/core/workers/chunks/{9850ff14bd9c7da81c65.js → 23c76963481e38f39653.js} +1 -1
- package/assets/esri/core/workers/chunks/2433b22749a088735262.js +1 -0
- package/assets/esri/core/workers/chunks/278280121528fa1059de.js +1 -0
- package/assets/esri/core/workers/chunks/2ad47c0ba1680f7d5e03.js +1 -0
- package/assets/esri/core/workers/chunks/2c3920ad82b9d86c3f05.js +1 -0
- package/assets/esri/core/workers/chunks/{4da99f058cca83937e9b.js → 2c92f6f268aa2de5432c.js} +1 -1
- package/assets/esri/core/workers/chunks/37619d28b0441199c320.js +1 -0
- package/assets/esri/core/workers/chunks/{92836e3a2c5226296fec.js → 3a205f87f100832ef9f5.js} +1 -1
- package/assets/esri/core/workers/chunks/543eb46b55cacd6e1dbc.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/{2fd5b48976cefe7cc0ab.js → 581180668e0229dcdc14.js} +1 -1
- package/assets/esri/core/workers/chunks/{c054198c6438cb57f188.js → 5c2299f22a69e58cc4dd.js} +1 -1
- package/assets/esri/core/workers/chunks/60eb6dd09080da5653a1.js +1 -0
- package/assets/esri/core/workers/chunks/6210346dc9d064ac90af.js +1 -0
- package/assets/esri/core/workers/chunks/{3cf001abca8ad933bccf.js → 670a66617249f2d15a62.js} +2 -2
- package/assets/esri/core/workers/chunks/{3cf001abca8ad933bccf.js.LICENSE.txt → 670a66617249f2d15a62.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/6b9110ec7da0fef1be31.js +1 -0
- package/assets/esri/core/workers/chunks/710e03feaa25e357f17a.js +1 -0
- package/assets/esri/core/workers/chunks/{a6de903f22f76d875005.js → 7496c4c33c2d8f60a434.js} +1 -1
- package/assets/esri/core/workers/chunks/7b4523ab392966624d97.js +2 -0
- package/assets/esri/core/workers/chunks/{30551c1d3e4fa7be86c1.js.LICENSE.txt → 7b4523ab392966624d97.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/{50ffb2620cdbcfd75723.js → 81b3351ea9627bb631d4.js} +1 -1
- package/assets/esri/core/workers/chunks/84d7ed2cf5fe23a0888f.js +1 -0
- package/assets/esri/core/workers/chunks/84f972d7851d982701a0.js +319 -0
- package/assets/esri/core/workers/chunks/{f52e597dca4b32a81881.js → 867c6c5b2ee1db977c99.js} +1 -1
- package/assets/esri/core/workers/chunks/{c5d786166a5609b85276.js → 8a87c181b85d0b86b9bb.js} +2 -2
- package/assets/esri/core/workers/chunks/{c5d786166a5609b85276.js.LICENSE.txt → 8a87c181b85d0b86b9bb.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/{a0c51c4c30a5f749dfc6.js → 8bf2e2fe5e3e8b4a1fa0.js} +1 -1
- package/assets/esri/core/workers/chunks/8c8d812a7f2d29c29676.js +1 -0
- package/assets/esri/core/workers/chunks/{213adc87c843d627c5d6.js → 8f2e0277c66247bd40b4.js} +1 -1
- package/assets/esri/core/workers/chunks/8fc5b1c17e841362dd15.js +1 -0
- package/assets/esri/core/workers/chunks/9cac00d4bfac14aaae12.js +1 -0
- package/assets/esri/core/workers/chunks/{a600194cfe26aedc21dd.js → 9d32f41f8f69b8a507c3.js} +1 -1
- package/assets/esri/core/workers/chunks/ac9c6779771ec855da79.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/{899f197556b6ced6eddf.js → ad9b4e0164706c53b872.js} +2 -2
- package/assets/esri/core/workers/chunks/{9661ee8569ee208e6237.js → ada9694498549f56dff1.js} +1 -1
- package/assets/esri/core/workers/chunks/{1a6d2d090b643a87408a.js → b780c7062b1b18a5ae19.js} +1 -1
- package/assets/esri/core/workers/chunks/{72097a8247101018dcdf.js → ba4aafa8dfa76006c3e7.js} +1 -1
- package/assets/esri/core/workers/chunks/c2594024d72133d3ed7b.js +2 -0
- package/assets/esri/core/workers/chunks/{e524462c63834fae7e01.js.LICENSE.txt → c2594024d72133d3ed7b.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/{360c8cff7c3b25d2b2d2.js → c607d618b64d3accecc4.js} +1 -1
- package/assets/esri/core/workers/chunks/{b8b8425e8b1246cdc86d.js → c6b0dda0540c9db12d0e.js} +1 -1
- package/assets/esri/core/workers/chunks/c819535525e9a27bae1f.js +39 -0
- package/assets/esri/core/workers/chunks/{87dcfbbcf290e0fa5c0f.js → cb25b45a6b385e60c68d.js} +315 -378
- package/assets/esri/core/workers/chunks/{577f24923fa4d08360e4.js → ce9de24cb96b56d20562.js} +2 -2
- package/assets/esri/core/workers/chunks/{577f24923fa4d08360e4.js.LICENSE.txt → ce9de24cb96b56d20562.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/d30fae6233d3426615ed.js +1 -0
- package/assets/esri/core/workers/chunks/d8dc922f7466300b668f.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/d92ea6b0674f34206ab6.js +1 -0
- package/assets/esri/core/workers/chunks/{345993291540433d3d92.js → e93222c65bd28203ddf7.js} +1 -1
- package/assets/esri/core/workers/chunks/f1222bf7232c4a168312.js +1 -0
- package/assets/esri/themes/base/widgets/_Legend.scss +2 -1
- package/assets/esri/themes/base/widgets/_SelectionList.scss +5 -17
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ar.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_bg.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_bs.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ca.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_cs.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_da.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_de.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_el.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_es.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_et.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_fi.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_fr.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_he.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_hr.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_hu.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_id.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_it.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ja.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ko.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_lt.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_lv.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_nl.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_no.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pl.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pt-BR.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pt-PT.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ro.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ru.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sk.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sl.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sr.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sv.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_th.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_tr.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_uk.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_vi.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-CN.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-HK.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-TW.json +1 -1
- package/chunks/BloomBlur.glsl.js +1 -1
- package/chunks/BloomComposition.glsl.js +2 -2
- package/chunks/ChapmanAtmosphere.glsl.js +1 -1
- package/chunks/CloudsComposition.glsl.js +1 -1
- package/chunks/ComponentShader.glsl.js +43 -39
- package/chunks/DefaultMaterial.glsl.js +22 -22
- package/chunks/Fog.glsl.js +3 -3
- package/chunks/Haze.glsl.js +1 -1
- package/chunks/Path.glsl.js +22 -18
- package/chunks/RealisticTree.glsl.js +9 -9
- package/chunks/RibbonLine.glsl.js +1 -1
- package/chunks/ShadowCastAccumulate.glsl.js +5 -5
- package/chunks/ShadowHighlight.glsl.js +4 -4
- package/chunks/Terrain.glsl.js +1 -1
- package/chunks/Viewshed.glsl.js +1 -1
- package/core/Collection.js +1 -1
- package/core/CollectionFlattener.js +1 -1
- package/core/MemCache.js +1 -1
- package/geometry/support/PolylineBuilder.js +1 -1
- package/geometry/support/curves/bezierCurveUtils.js +5 -0
- package/geometry/support/curves/circleUtils.js +5 -0
- package/geometry/support/curves/circularArcUtils.js +5 -0
- package/geometry/support/curves/closestPointOnCurve.js +5 -0
- package/geometry/support/curves/curveUtils.js +5 -0
- package/geometry/support/curves/densifyCurvedGeometry.js +5 -0
- package/geometry/support/curves/ellipticArc4Utils.js +5 -0
- package/geometry/support/curves/ellipticArc7Utils.js +5 -0
- package/geometry/support/curves/mathUtils.js +5 -0
- package/geometry/support/curves/splitCurveAtPoint.js +5 -0
- package/identity/IdentityManagerBase.js +1 -1
- package/interfaces.d.ts +485 -20
- package/layers/LinkChartLayer.js +1 -1
- package/layers/VideoLayer.js +1 -1
- package/package.json +3 -3
- package/portal/schemas/definitions.js +1 -1
- package/request.js +1 -1
- package/rest/knowledgeGraph/GraphAddNamedTypesResult.js +5 -0
- package/rest/knowledgeGraph/GraphDeleteNamedTypeResult.js +5 -0
- package/rest/knowledgeGraph/wasmInterface/WasmDataModelWrapperInterfaces.js +1 -1
- package/rest/knowledgeGraph/wasmInterface/updateToWasmEncodedFactories.js +1 -1
- package/rest/knowledgeGraph/wasmInterface/wasmToDataModelChangeResponseFactories.js +5 -0
- package/rest/knowledgeGraph/wasmInterface/wasmUtils.js +1 -1
- package/rest/knowledgeGraphService.js +1 -1
- package/rest/networks/circuits/alterCircuit.js +5 -0
- package/rest/networks/circuits/createCircuit.js +5 -0
- package/rest/networks/circuits/deleteCircuits.js +5 -0
- package/rest/networks/circuits/queryCircuits.js +5 -0
- package/rest/networks/circuits/support/CircuitVerifyResult.js +5 -0
- package/rest/networks/circuits/support/CreateAlterCircuitParameters.js +5 -0
- package/rest/networks/circuits/support/DeleteCircuitsParameters.js +5 -0
- package/rest/networks/circuits/support/QueryCircuitsParameters.js +5 -0
- package/rest/networks/circuits/support/QueryCircuitsResult.js +5 -0
- package/rest/networks/circuits/support/VerifyCircuitsParameters.js +5 -0
- package/rest/networks/circuits/support/VerifyCircuitsResult.js +5 -0
- package/rest/networks/circuits/verifyCircuits.js +5 -0
- package/smartMapping/renderers/support/spikeUtils.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/CIMOperators.js +1 -1
- package/symbols/cim/effects/EffectSuppress.js +5 -0
- package/symbols/cim/effects/EffectTaperedPolygon.js +1 -1
- package/views/2d/layers/MediaLayerView2D.js +1 -1
- package/views/2d/layers/TileLayerView2D.js +1 -1
- package/views/2d/layers/VideoLayerView2D.js +1 -1
- package/views/2d/layers/graphics/GraphicStoreItem.js +1 -1
- package/views/3d/analysis/AreaMeasurementAnalysisView3D.js +1 -1
- package/views/3d/analysis/DirectLineMeasurementAnalysisView3D.js +1 -1
- package/views/3d/environment/ChapmanAtmosphereTechniqueConfiguration.js +1 -1
- package/views/3d/environment/EnvironmentManager.js +1 -1
- package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DTool.js +1 -1
- package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.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/Graphics3DLineCalloutSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/pipeline/Feature3DPipeline.js +1 -1
- package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorker.js +1 -1
- package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorkerHandle.js +1 -1
- package/views/3d/layers/graphics/pipeline/FeatureProcessingContext.js +1 -1
- package/views/3d/layers/graphics/pipeline/symbolization/IconSymbolLayerRenderer.js +5 -0
- package/views/3d/layers/graphics/pipeline/symbolization/ObjectSymbolLayerRenderer.js +5 -0
- package/views/3d/layers/graphics/pipeline/symbolization/Point3DSymbolRenderer.js +5 -0
- package/views/3d/layers/graphics/pipeline/symbolization/SimpleFeatureRenderer.js +1 -1
- package/views/3d/layers/graphics/pipeline/symbolization/UniqueValueFeatureRenderer.js +1 -1
- package/views/3d/layers/graphics/pipeline/symbolization/factoryUtils.js +5 -0
- package/views/3d/layers/graphics/pipeline/symbolization/primitiveObjectUtils.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentShader.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/AnalyticalSkyModel.glsl.js +3 -3
- package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateAmbientOcclusion.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js +20 -19
- package/views/3d/webgl-engine/core/shaderLibrary/shading/FoamRendering.glsl.js +3 -3
- package/views/3d/webgl-engine/core/shaderLibrary/shading/Gamma.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/MainLighting.glsl.js +3 -3
- package/views/3d/webgl-engine/core/shaderLibrary/shading/PhysicallyBasedRendering.glsl.js +10 -11
- package/views/3d/webgl-engine/core/shaderLibrary/shading/PiUtils.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadShadowMap.glsl.js +30 -125
- package/views/3d/webgl-engine/core/shaderLibrary/shading/Water.glsl.js +8 -8
- package/views/3d/webgl-engine/core/shaderLibrary/shading/WaterDistortion.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/calculateUVZShadow.glsl.js +27 -0
- package/views/3d/webgl-engine/core/shaderLibrary/shading/calculateUVZShadowFromDepth.glsl.js +28 -0
- package/views/3d/webgl-engine/effects/RenderNodes.js +1 -1
- package/views/3d/webgl-engine/effects/bloom/BloomRenderNode.js +1 -1
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
- package/views/3d/webgl-engine/effects/haze/HazeTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
- package/views/3d/webgl-engine/effects/weather/SnowCover.glsl.js +12 -0
- package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
- package/views/3d/webgl-engine/materials/PathTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/materials/WaterTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/CheckerBoardTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/ColorMaterialTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterial.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/HUDMaterialTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/ImageMaterialTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/LineMarkerTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/OutputColorHighlightOID.glsl.js +9 -9
- package/views/3d/webgl-engine/shaders/Path.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/PatternTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/ReadShadowMapConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLineTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/ShadedColorMaterialTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/ShadowCastAccumulate.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/ShadowHighlight.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/ToneMapping.glsl.js +2 -20
- package/views/VideoView.js +1 -1
- package/views/support/LayerViewManager.js +1 -1
- package/webscene/support/FeatureReference.d.ts +4 -0
- package/webscene/support/FeatureReference.js +5 -0
- package/webscene/support/FeatureReferenceGlobalId.d.ts +4 -0
- package/webscene/support/FeatureReferenceGlobalId.js +5 -0
- package/webscene/support/FeatureReferenceId.d.ts +4 -0
- package/webscene/support/FeatureReferenceId.js +5 -0
- package/webscene/support/FeatureReferenceObjectId.d.ts +4 -0
- package/webscene/support/FeatureReferenceObjectId.js +5 -0
- package/webscene/support/LayerReference.d.ts +4 -0
- package/webscene/support/LayerReference.js +5 -0
- package/webscene/support/SlideElements.js +1 -1
- package/webscene/support/SlidePopupInfo.d.ts +4 -0
- package/webscene/support/SlidePopupInfo.js +5 -0
- package/webscene/support/featureReferenceUtils.js +5 -0
- package/widgets/AreaMeasurement3D/AreaMeasurement3DViewModel.js +1 -1
- package/widgets/DirectLineMeasurement3D/DirectLineMeasurement3DViewModel.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/UpdateRecordWorkflow.js +1 -1
- package/widgets/FeatureForm/EditableInput.js +1 -1
- package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/FeatureTable.js +1 -1
- package/widgets/Legend/support/sizeRampUtils.js +1 -1
- package/widgets/VideoPlayer.js +1 -1
- package/widgets/support/SelectionList/FeatureItem.js +1 -1
- package/widgets/support/SelectionList/SelectionListViewModel.js +1 -1
- package/widgets/support/SelectionList.js +1 -1
- package/assets/esri/core/workers/chunks/27482132abb939a1cdb7.js +0 -1
- package/assets/esri/core/workers/chunks/2e3019ce49e972a815ca.js +0 -1
- package/assets/esri/core/workers/chunks/30551c1d3e4fa7be86c1.js +0 -2
- package/assets/esri/core/workers/chunks/3293b4041c222299428f.js +0 -1
- package/assets/esri/core/workers/chunks/335b539893569e3d7b82.js +0 -1
- package/assets/esri/core/workers/chunks/53eaad20c4f55dae21e0.js +0 -1
- package/assets/esri/core/workers/chunks/5ac3096139e3eafd0e1d.js +0 -1
- package/assets/esri/core/workers/chunks/626ba3a7dee952308566.js +0 -1
- package/assets/esri/core/workers/chunks/76575d2c1c56e37c1315.js +0 -319
- package/assets/esri/core/workers/chunks/7c4746f60332620f75c5.js +0 -1
- package/assets/esri/core/workers/chunks/8221f2e540abe1e0f048.js +0 -1
- package/assets/esri/core/workers/chunks/ae156b99e60a2bf940e4.js +0 -1
- package/assets/esri/core/workers/chunks/bf4947fe446dcb477031.js +0 -1
- package/assets/esri/core/workers/chunks/c6b08fdc0421258efcf5.js +0 -1
- package/assets/esri/core/workers/chunks/cd2927b922444880566d.js +0 -1
- package/assets/esri/core/workers/chunks/d3a74087e076a3ae76ca.js +0 -1
- package/assets/esri/core/workers/chunks/d44e99b4bb1cec6a922b.js +0 -1
- package/assets/esri/core/workers/chunks/e524462c63834fae7e01.js +0 -2
- package/assets/esri/core/workers/chunks/e64bc4533405af8554ae.js +0 -1
- package/assets/esri/core/workers/chunks/e64e0c3240f8e577a61c.js +0 -39
- package/assets/esri/core/workers/chunks/fd36b7aaf0d8e0c84471.js +0 -1
- package/geometry/support/curveUtils.js +0 -5
- package/geometry/support/densifyUtils.js +0 -5
- package/views/3d/layers/graphics/pipeline/symbolization/Factory.js +0 -5
- package/views/3d/layers/graphics/pipeline/symbolization/TestObjectSymbol.js +0 -5
- package/views/3d/layers/graphics/pipeline/symbolization/TestSymbol.js +0 -5
- package/views/3d/webgl-engine/effects/bloom/BloomCompositionTechniqueConfiguration.js +0 -5
- package/widgets/support/InteractiveAnalysisViewModel.js +0 -5
package/views/VideoView.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import t from"../Color.js";import i from"../Viewpoint.js";import s from"../core/Accessor.js";import r from"../core/Evented.js";import{destroyMaybe as o}from"../core/maybe.js";import n from"../core/Promise.js";import{watch as a,whenOnce as m,initial as p,syncAndInitial as l}from"../core/reactiveUtils.js";import{property as c}from"../core/accessorSupport/decorators/property.js";import{cast as d}from"../core/accessorSupport/decorators/cast.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as h}from"../core/accessorSupport/decorators/subclass.js";import{ensureClass as g}from"../core/accessorSupport/ensureType.js";import f from"../geometry/Extent.js";import j from"../geometry/Point.js";import y from"../geometry/SpatialReference.js";import u from"../layers/support/ExtentAndRotationGeoreference.js";import{MediaElementView as w}from"../layers/support/MediaElementView.js";import b from"../layers/support/TileInfo.js";import v from"../layers/support/VideoElement.js";import{DOMContainer as M}from"./DOMContainer.js";import{Viewport2DMixin as _}from"./Viewport2DMixin.js";import x from"./2d/AnimationManager.js";import C from"./2d/MapViewConstraints.js";import"../core/Error.js";import"../core/scheduling.js";import"../core/Logger.js";import"../core/accessorSupport/tracking/Flags.js";import"../core/colorUtils.js";import"../config.js";import"../symbols/cim/defaultCIMValues.js";import"../symbols/cim/enums.js";import"../core/floatRGBA.js";import"../geometry/Geometry.js";import"../geometry/Multipoint.js";import"../geometry/Polygon.js";import"../geometry/Polyline.js";import"./2d/engine/webgl/definitions.js";import"./2d/engine/webgl/animations/instructions.js";import"../core/mathUtils.js";import"../symbols/Font.js";import"../core/ObjectPool.js";import"../geometry/support/Axis.js";import"../geometry/support/spatialReferenceUtils.js";import"../geometry/support/TileClipper.js";import"../symbols/cim/effects/EffectAddControlPoints.js";import"../symbols/cim/effects/EffectArrow.js";import"../symbols/cim/effects/EffectBuffer.js";import"../symbols/cim/effects/EffectControlMeasureLine.js";import"../symbols/cim/effects/EffectCut.js";import"../symbols/cim/effects/EffectDashes.js";import"../symbols/cim/effects/EffectDonut.js";import"../symbols/cim/effects/EffectEnclosingPolygon.js";import"../symbols/cim/effects/EffectJog.js";import"../symbols/cim/effects/EffectMove.js";import"../symbols/cim/effects/EffectOffset.js";import"../symbols/cim/effects/EffectRadial.js";import"../symbols/cim/effects/EffectReverse.js";import"../symbols/cim/effects/EffectRotate.js";import"../symbols/cim/effects/EffectScale.js";import"../symbols/cim/effects/EffectTaperedPolygon.js";import"../symbols/cim/effects/EffectWave.js";import"../symbols/cim/placements/PlacementAlongLineSameSize.js";import"../symbols/cim/placements/PlacementAtExtremities.js";import"../symbols/cim/placements/PlacementAtRatioPositions.js";import"../symbols/cim/placements/PlacementInsidePolygon.js";import"../symbols/cim/placements/PlacementOnLine.js";import"../symbols/cim/placements/PlacementOnVertices.js";import"../symbols/cim/placements/PlacementPolygonCenter.js";import"../core/libs/gl-matrix-2/factories/vec2f32.js";import"./2d/engine/webgl/alignmentUtils.js";import"../symbols/support/defaults.js";import"../symbols/cim/OverrideHelper.js";import"../layers/effects/EffectView.js";import"./2d/engine/transitions/FadeTransition.js";import"./2d/engine/webgl/enums.js";import"../core/libs/gl-matrix-2/factories/vec4f32.js";import"./webgl/enums.js";import"./2d/engine/webgl/shaders/BackgroundPrograms.js";import"./webgl/checkWebGLError.js";import"./2d/engine/webgl/DefaultVertexAttributeLayouts.js";import"./2d/engine/webgl/AFeatureTile.js";import"./2d/engine/webgl/DisplayEntity.js";import"./2d/engine/webgl/shaderGraph/techniques/featureTechniqueUtils.js";import"./2d/engine/webgl/cpuMapped/MappedMesh.js";import"./2d/engine/webgl/number.js";import"./2d/engine/webgl/shaders/TileInfoPrograms.js";import"./webgl/Texture.js";import"./webgl/FBOAttachmentType.js";import"./2d/engine/vectorTiles/style/StyleDefinition.js";import"./2d/engine/vectorTiles/enums.js";import"./2d/engine/webgl/shaders/BitBlitPrograms.js";import"../request.js";import"../core/urlUtils.js";import"../core/pbf.js";import"./2d/engine/webgl/shaders/StencilPrograms.js";import"./2d/engine/webgl/shaderGraph/techniques/TechniqueType.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/BlendShader.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/OpacityShader.js";import"./2d/engine/webgl/shaders/HighlightPrograms.js";import"./webgl/FramebufferObject.js";import"./2d/engine/webgl/meshing/SimpleMesh.js";import"./2d/engine/webgl/PooledUint32Array.js";import"./2d/engine/webgl/Profiler.js";import"./2d/engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/constants.js";import"./2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/ComplexFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/ComplexOutlineFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/FillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/GradientFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/OutlineFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/PatternFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/PatternOutlineFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/heatmap/HeatmapMeshWriter.js";import"../geometry/support/aaBoundingBox.js";import"./2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/line/GradientStrokeMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/line/LineMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/line/TexturedLineMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/markers/MarkerMeshWriter.js";import"../arcade/ArcadeDate.js";import"../intl/locale.js";import"luxon";import"../core/sql/UnknownTimeZone.js";import"../layers/support/fieldUtils.js";import"../time/constants.js";import"./2d/engine/webgl/shaderGraph/techniques/pieChart/PieChartMeshWriter.js";import"./webgl/renderState.js";import"./3d/webgl-engine/core/shaderModules/glsl.js";import"./webgl/testSVGPremultipliedAlpha.js";import"./2d/LabelManager.js";import"./2d/layers/graphics/GraphicsView2D.js";import"../chunks/earcut.js";import"../core/libs/gl-matrix-2/factories/vec3f32.js";import"../geometry/support/normalizeUtilsCommon.js";import"../geometry/support/Ellipsoid.js";import"../kernel.js";import"./2d/layers/support/util.js";import G from"./2d/navigation/MapViewNavigation.js";import"../core/asyncUtils.js";import"../core/support/UpdatingHandles.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/MagnifierShader.js";import"../core/unitUtils.js";import"../geometry/ellipsoidUtils.js";import"../chunks/pe.js";import"../geometry/projection/projectors.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/GridShader.js";import"../geometry/support/geodesicConstants.js";import{ViewStateManager as S}from"./2d/ViewStateManager.js";import P from"./2d/engine/webgl/Overlay.js";import E from"./2d/engine/webgl/OverlayContainer.js";import q from"./navigation/Navigation.js";import V from"./ui/DefaultUI.js";import R from"./ui/2d/DefaultUI2D.js";const T=new t("#000");let O;async function W(){const[,{Stage:e}]=await Promise.all([import("./2d/webglDeps.js"),import("./2d/mapViewDeps.js")]);O=e}const k=.01;let z=class extends s{};z=e([h("esri.views.VideoView.Base")],z);let A=class extends(_(M(r.EventedMixin(n.EsriPromiseMixin(z))))){constructor(e){super(e),this._isValid=!1,this.stage=null,this.layer=null,this.navigation=new q,this.ready=!1,this.spatialReference=new y({wkid:0}),this.stateManager=new S({constraints:new C({view:this,minScale:1,maxScale:k})}),this.type="2d",this.ui=new R,this.view2dType="video",this.addHandles([a((()=>this.preconditionsReady),(e=>e?this._startup():this._teardown())),a((()=>this.layer),(()=>this.addResolvingPromise(m((()=>this.ready)))),p),a((()=>[this.layer?.effect,this._overlayContainer,this.effect]),(()=>{this._overlayContainer&&(this._overlayContainer.effect=this.effect??this.layer?.effect??null)}),l),a((()=>this.videoSize),(([e,t])=>{this._extent&&e&&t&&(this._extent.xmax=e,this._extent.ymax=t)}))])}initialize(){this.addResolvingPromise(W().then((()=>(this._isValid=!0,m((()=>this.ready))))))}destroy(){this._teardown(),this.removeAllHandles(),this._set("preconditionsReady",!1),this.frameTask=o(this.frameTask),this.goToManager.destroy(),this.inputManager.destroy(),this._set("inputManager",null)}get constraintsInfo(){return{lods:null,spatialReference:this.spatialReference}}get effect(){return this.layer?.effect}set effect(e){this._override("effect",e)}get preconditionsReady(){return!(!this._isValid||0===this.width||0===this.height||0===this.videoSize[0]||0===this.videoSize[1])}get rendering(){return this.stage?.renderRequested??!1}get scale(){return this.stateManager?.scale??0}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get videoSize(){if(!this.layer?.videoWidth||!this.layer?.videoHeight)return[0,0];const[e,t]=this.size,i=(this.layer?.videoWidth||0)/(this.layer?.videoHeight||0),s=t*i,r=e/i;return e/t>=1?i>=1?s<=e?[s,t]:[e,r]:r<=t?[e,r]:[s,t]:i>=1?r<=t?[e,r]:[s,t]:s<=e?[s,t]:[e,r]}_startup(){if(!this.layer)return;const e=this._getViewpoint();this.stateManager.startup(e,this.size,e.targetGeometry.spatialReference),this.stage=new O(this.surface,{renderingOptions:this.renderingOptions,backgroundColor:T}),this._prepareStage(this.stage);const t=new x({view:this});this._set("animationManager",t);const i=new G({view:this,animationManager:t});this._set("mapViewNavigation",i),this._updateConstraints(),this.frameTask.start(),this._set("ready",!0)}_teardown(){this.stage.destroy(),this.stage=null,this._videoElementView=null,this._overlayContainer.removeAllChildren(),this._overlayContainer=null,this.removeHandles("video-view"),this._set("ready",!1),this.stateManager.teardown(),this.frameTask.stop(),this.stationaryManager.clear()}_getViewpoint(){return new i({targetGeometry:new j({x:this.videoSize[0]/2,y:this.videoSize[1]/2,spatialReference:this.spatialReference}),scale:1})}_prepareStage(e){this.addHandles([a((()=>this.stationary),(t=>e.stationary=t),l),a((()=>this.state.id),(()=>e.state=this.state),l),a((()=>this.renderingOptions),(t=>e.renderingOptions=t),l)],"video-view"),this._extent=new f({xmin:0,ymin:0,xmax:this.videoSize[0],ymax:this.videoSize[1],spatialReference:{wkid:0}}),this._videoElementView=new w({element:new v({video:this.layer?.videoElement,georeference:new u({extent:this._extent}),autoplay:!1}),spatialReference:this.spatialReference});const t=new P(this._videoElementView);this._overlayContainer=new E,this._overlayContainer.addChild(t),this.stage.addChild(this._overlayContainer)}_updateConstraints(){this._updateZoomConstraints(),this._updatePanConstraints()}_updateZoomConstraints(){const e=this.videoSize,t=Math.max(e[0]/this.size[0],e[1]/this.size[1]),i=[];for(let r=t;r>k;r/=2)i.push(r);i.push(k);const{lods:s}=b.create({scales:i});this.constraints.set({lods:s,minScale:t})}_updatePanConstraints(){const e=e=>{if(!e.targetGeometry)return e;const[t,i]=this.videoSize,s=t*e.scale/2,r=i*e.scale/2,o=e.targetGeometry.clone();return o.x=Math.max(s,Math.min(t-s,o.x)),o.y=Math.max(r,Math.min(i-r,o.y)),e.targetGeometry=o,e};this.constraints.customConstraints.add({constrain:e,applyPanConstraint:e})}};e([c()],A.prototype,"_overlayContainer",void 0),e([c()],A.prototype,"_isValid",void 0),e([c()],A.prototype,"constraintsInfo",null),e([c()],A.prototype,"effect",null),e([c()],A.prototype,"layer",void 0),e([c({type:q,nonNullable:!0})],A.prototype,"navigation",void 0),e([c({readOnly:!0})],A.prototype,"preconditionsReady",null),e([c({readOnly:!0})],A.prototype,"ready",void 0),e([c({readOnly:!0})],A.prototype,"rendering",null),e([c()],A.prototype,"scale",null),e([c()],A.prototype,"spatialReference",void 0),e([c()],A.prototype,"stateManager",void 0),e([c()],A.prototype,"type",void 0),e([c(),d((e=>e instanceof V?e:g(R,e)))],A.prototype,"ui",void 0),e([c({readOnly:!0})],A.prototype,"videoSize",null),e([c({readOnly:!0})],A.prototype,"view2dType",void 0),A=e([h("esri.views.VideoView")],A);const D=A;export{D as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../Color.js";import i from"../Viewpoint.js";import s from"../core/Accessor.js";import r from"../core/Evented.js";import{destroyMaybe as o}from"../core/maybe.js";import n from"../core/Promise.js";import{watch as a,whenOnce as m,initial as p,syncAndInitial as l}from"../core/reactiveUtils.js";import{property as c}from"../core/accessorSupport/decorators/property.js";import{cast as d}from"../core/accessorSupport/decorators/cast.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as h}from"../core/accessorSupport/decorators/subclass.js";import{ensureClass as g}from"../core/accessorSupport/ensureType.js";import f from"../geometry/Extent.js";import j from"../geometry/Point.js";import y from"../geometry/SpatialReference.js";import u from"../layers/support/ExtentAndRotationGeoreference.js";import{MediaElementView as w}from"../layers/support/MediaElementView.js";import b from"../layers/support/TileInfo.js";import v from"../layers/support/VideoElement.js";import{DOMContainer as M}from"./DOMContainer.js";import{Viewport2DMixin as _}from"./Viewport2DMixin.js";import x from"./2d/AnimationManager.js";import C from"./2d/MapViewConstraints.js";import"../core/Error.js";import"../core/scheduling.js";import"../core/Logger.js";import"../core/accessorSupport/tracking/Flags.js";import"../core/colorUtils.js";import"../config.js";import"../symbols/cim/defaultCIMValues.js";import"../symbols/cim/enums.js";import"../core/floatRGBA.js";import"../geometry/Geometry.js";import"../geometry/Multipoint.js";import"../geometry/Polygon.js";import"../geometry/Polyline.js";import"./2d/engine/webgl/definitions.js";import"./2d/engine/webgl/animations/instructions.js";import"../core/mathUtils.js";import"../symbols/Font.js";import"../core/ObjectPool.js";import"../geometry/support/Axis.js";import"../geometry/support/spatialReferenceUtils.js";import"../geometry/support/TileClipper.js";import"../symbols/cim/effects/EffectAddControlPoints.js";import"../symbols/cim/effects/EffectArrow.js";import"../symbols/cim/effects/EffectBuffer.js";import"../symbols/cim/effects/EffectControlMeasureLine.js";import"../symbols/cim/effects/EffectCut.js";import"../symbols/cim/effects/EffectDashes.js";import"../symbols/cim/effects/EffectDonut.js";import"../symbols/cim/effects/EffectEnclosingPolygon.js";import"../symbols/cim/effects/EffectJog.js";import"../symbols/cim/effects/EffectMove.js";import"../symbols/cim/effects/EffectOffset.js";import"../symbols/cim/effects/EffectRadial.js";import"../symbols/cim/effects/EffectReverse.js";import"../symbols/cim/effects/EffectRotate.js";import"../symbols/cim/effects/EffectScale.js";import"../symbols/cim/effects/EffectSuppress.js";import"../symbols/cim/effects/EffectTaperedPolygon.js";import"../symbols/cim/effects/EffectWave.js";import"../symbols/cim/placements/PlacementAlongLineSameSize.js";import"../symbols/cim/placements/PlacementAtExtremities.js";import"../symbols/cim/placements/PlacementAtRatioPositions.js";import"../symbols/cim/placements/PlacementInsidePolygon.js";import"../symbols/cim/placements/PlacementOnLine.js";import"../symbols/cim/placements/PlacementOnVertices.js";import"../symbols/cim/placements/PlacementPolygonCenter.js";import"../core/libs/gl-matrix-2/factories/vec2f32.js";import"./2d/engine/webgl/alignmentUtils.js";import"../symbols/support/defaults.js";import"../symbols/cim/OverrideHelper.js";import"../layers/effects/EffectView.js";import"./2d/engine/transitions/FadeTransition.js";import"./2d/engine/webgl/enums.js";import"../core/libs/gl-matrix-2/factories/vec4f32.js";import"./webgl/enums.js";import"./2d/engine/webgl/shaders/BackgroundPrograms.js";import"./webgl/checkWebGLError.js";import"./2d/engine/webgl/DefaultVertexAttributeLayouts.js";import"./2d/engine/webgl/AFeatureTile.js";import"./2d/engine/webgl/DisplayEntity.js";import"./2d/engine/webgl/shaderGraph/techniques/featureTechniqueUtils.js";import"./2d/engine/webgl/cpuMapped/MappedMesh.js";import"./2d/engine/webgl/number.js";import"./2d/engine/webgl/shaders/TileInfoPrograms.js";import"./webgl/Texture.js";import"./webgl/FBOAttachmentType.js";import"./2d/engine/vectorTiles/style/StyleDefinition.js";import"./2d/engine/vectorTiles/enums.js";import"./2d/engine/webgl/shaders/BitBlitPrograms.js";import"../request.js";import"../core/urlUtils.js";import"../core/pbf.js";import"./2d/engine/webgl/shaders/StencilPrograms.js";import"./2d/engine/webgl/shaderGraph/techniques/TechniqueType.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/BlendShader.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/OpacityShader.js";import"./2d/engine/webgl/shaders/HighlightPrograms.js";import"./webgl/FramebufferObject.js";import"./2d/engine/webgl/meshing/SimpleMesh.js";import"./2d/engine/webgl/PooledUint32Array.js";import"./2d/engine/webgl/Profiler.js";import"./2d/engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/constants.js";import"./2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/ComplexFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/ComplexOutlineFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/FillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/GradientFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/OutlineFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/PatternFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/fill/PatternOutlineFillMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/heatmap/HeatmapMeshWriter.js";import"../geometry/support/aaBoundingBox.js";import"./2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/line/GradientStrokeMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/line/LineMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/line/TexturedLineMeshWriter.js";import"./2d/engine/webgl/shaderGraph/techniques/markers/MarkerMeshWriter.js";import"../arcade/ArcadeDate.js";import"../intl/locale.js";import"luxon";import"../core/sql/UnknownTimeZone.js";import"../layers/support/fieldUtils.js";import"../time/constants.js";import"./2d/engine/webgl/shaderGraph/techniques/pieChart/PieChartMeshWriter.js";import"./webgl/renderState.js";import"./3d/webgl-engine/core/shaderModules/glsl.js";import"./webgl/testSVGPremultipliedAlpha.js";import"./2d/LabelManager.js";import"./2d/layers/graphics/GraphicsView2D.js";import"../chunks/earcut.js";import"../core/libs/gl-matrix-2/factories/vec3f32.js";import"../geometry/support/normalizeUtilsCommon.js";import"../geometry/support/Ellipsoid.js";import"../kernel.js";import"./2d/layers/support/util.js";import G from"./2d/navigation/MapViewNavigation.js";import"../core/asyncUtils.js";import"../core/support/UpdatingHandles.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/MagnifierShader.js";import"../core/unitUtils.js";import"../geometry/ellipsoidUtils.js";import"../chunks/pe.js";import"../geometry/projection/projectors.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/GridShader.js";import"../geometry/support/geodesicConstants.js";import{ViewStateManager as S}from"./2d/ViewStateManager.js";import E from"./2d/engine/webgl/Overlay.js";import P from"./2d/engine/webgl/OverlayContainer.js";import q from"./navigation/Navigation.js";import V from"./ui/DefaultUI.js";import R from"./ui/2d/DefaultUI2D.js";const T=new t("#000");let O;async function W(){const[,{Stage:e}]=await Promise.all([import("./2d/webglDeps.js"),import("./2d/mapViewDeps.js")]);O=e}const k=.01;let z=class extends s{};z=e([h("esri.views.VideoView.Base")],z);let A=class extends(_(M(r.EventedMixin(n.EsriPromiseMixin(z))))){constructor(e){super(e),this._isValid=!1,this.stage=null,this.layer=null,this.navigation=new q,this.ready=!1,this.spatialReference=new y({wkid:0}),this.stateManager=new S({constraints:new C({view:this,minScale:1,maxScale:k})}),this.type="2d",this.ui=new R,this.view2dType="video",this.addHandles([a((()=>this.preconditionsReady),(e=>e?this._startup():this._teardown())),a((()=>this.layer),(()=>this.addResolvingPromise(m((()=>this.ready)))),p),a((()=>[this.layer?.effect,this._overlayContainer,this.effect]),(()=>{this._overlayContainer&&(this._overlayContainer.effect=this.effect??this.layer?.effect??null)}),l),a((()=>this.videoSize),(([e,t])=>{this._extent&&e&&t&&(this._extent.xmax=e,this._extent.ymax=t)}))])}initialize(){this.addResolvingPromise(W().then((()=>(this._isValid=!0,m((()=>this.ready))))))}destroy(){this._teardown(),this.removeAllHandles(),this._set("preconditionsReady",!1),this.frameTask=o(this.frameTask),this.goToManager.destroy(),this.inputManager.destroy(),this._set("inputManager",null)}get constraintsInfo(){return{lods:null,spatialReference:this.spatialReference}}get effect(){return this.layer?.effect}set effect(e){this._override("effect",e)}get preconditionsReady(){return!(!this._isValid||0===this.width||0===this.height||0===this.videoSize[0]||0===this.videoSize[1])}get rendering(){return this.stage?.renderRequested??!1}get scale(){return this.stateManager?.scale??0}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get videoSize(){if(!this.layer?.videoWidth||!this.layer?.videoHeight)return[0,0];const[e,t]=this.size,i=(this.layer?.videoWidth||0)/(this.layer?.videoHeight||0),s=t*i,r=e/i;return e/t>=1?i>=1?s<=e?[s,t]:[e,r]:r<=t?[e,r]:[s,t]:i>=1?r<=t?[e,r]:[s,t]:s<=e?[s,t]:[e,r]}_startup(){if(!this.layer)return;const e=this._getViewpoint();this.stateManager.startup(e,this.size,e.targetGeometry.spatialReference),this.stage=new O(this.surface,{renderingOptions:this.renderingOptions,backgroundColor:T}),this._prepareStage(this.stage);const t=new x({view:this});this._set("animationManager",t);const i=new G({view:this,animationManager:t});this._set("mapViewNavigation",i),this._updateConstraints(),this.frameTask.start(),this._set("ready",!0)}_teardown(){this.stage.destroy(),this.stage=null,this._videoElementView=null,this._overlayContainer.removeAllChildren(),this._overlayContainer=null,this.removeHandles("video-view"),this._set("ready",!1),this.stateManager.teardown(),this.frameTask.stop(),this.stationaryManager.clear()}_getViewpoint(){return new i({targetGeometry:new j({x:this.videoSize[0]/2,y:this.videoSize[1]/2,spatialReference:this.spatialReference}),scale:1})}_prepareStage(e){this.addHandles([a((()=>this.stationary),(t=>e.stationary=t),l),a((()=>this.state.id),(()=>e.state=this.state),l),a((()=>this.renderingOptions),(t=>e.renderingOptions=t),l)],"video-view"),this._extent=new f({xmin:0,ymin:0,xmax:this.videoSize[0],ymax:this.videoSize[1],spatialReference:{wkid:0}}),this._videoElementView=new w({element:new v({video:this.layer?.videoElement,georeference:new u({extent:this._extent}),autoplay:!1}),spatialReference:this.spatialReference});const t=new E(this._videoElementView);this._overlayContainer=new P,this._overlayContainer.addChild(t),this.stage.addChild(this._overlayContainer)}_updateConstraints(){this._updateZoomConstraints(),this._updatePanConstraints()}_updateZoomConstraints(){const e=this.videoSize,t=Math.max(e[0]/this.size[0],e[1]/this.size[1]),i=[];for(let r=t;r>k;r/=2)i.push(r);i.push(k);const{lods:s}=b.create({scales:i});this.constraints.set({lods:s,minScale:t})}_updatePanConstraints(){const e=e=>{if(!e.targetGeometry)return e;const[t,i]=this.videoSize,s=t*e.scale/2,r=i*e.scale/2,o=e.targetGeometry.clone();return o.x=Math.max(s,Math.min(t-s,o.x)),o.y=Math.max(r,Math.min(i-r,o.y)),e.targetGeometry=o,e};this.constraints.customConstraints.add({constrain:e,applyPanConstraint:e})}};e([c()],A.prototype,"_overlayContainer",void 0),e([c()],A.prototype,"_isValid",void 0),e([c()],A.prototype,"constraintsInfo",null),e([c()],A.prototype,"effect",null),e([c()],A.prototype,"layer",void 0),e([c({type:q,nonNullable:!0})],A.prototype,"navigation",void 0),e([c({readOnly:!0})],A.prototype,"preconditionsReady",null),e([c({readOnly:!0})],A.prototype,"ready",void 0),e([c({readOnly:!0})],A.prototype,"rendering",null),e([c()],A.prototype,"scale",null),e([c()],A.prototype,"spatialReference",void 0),e([c()],A.prototype,"stateManager",void 0),e([c()],A.prototype,"type",void 0),e([c(),d((e=>e instanceof V?e:g(R,e)))],A.prototype,"ui",void 0),e([c({readOnly:!0})],A.prototype,"videoSize",null),e([c({readOnly:!0})],A.prototype,"view2dType",void 0),A=e([h("esri.views.VideoView")],A);const D=A;export{D as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import r from"../../core/Accessor.js";import i from"../../core/Error.js";import t from"../../core/Logger.js";import{someMap as s}from"../../core/MapUtils.js";import{createResolver as o,createAbortError as a,isAbortError as n}from"../../core/promiseUtils.js";import{on as l,watch as h,syncAndInitial as y}from"../../core/reactiveUtils.js";import{schedule as p}from"../../core/scheduling.js";import{property as c}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as d}from"../../core/accessorSupport/decorators/subclass.js";import{get as w}from"../../core/accessorSupport/get.js";import{UpdatingHandles as f}from"../../core/support/UpdatingHandles.js";import{destroyMap as m}from"../../support/collectionUtils.js";import{LayerLayerViewInfo as u}from"./LayerLayerViewInfo.js";function g(e){return null!=e&&"object"==typeof e&&"layerViews"in e}let _=class extends r{constructor(e){super(e),this._layerLayerViewInfoMap=new Map,this._recyclingInfoMap=new Map,this._watchUpdatingTracking=new f,this.supportsGround=!0,this._preloadLayerViewModules=()=>{const e=this.view.map?.allLayers;if(e)for(const r of e)this.layerViewImporter.hasLayerViewModule(r)&&this.layerViewImporter.importLayerView(r)},this._reschedule=()=>this.destroyed?Promise.reject():(null==this._workPromise&&(this._workPromise=o(),this._workPromise.promise.catch((()=>{}))),this.removeHandles("reschedule"),this.addHandles(p(this._doWork),"reschedule"),this._workPromise.promise),this._doWork=()=>{if(this.destroyed)return;const e=this.view.map;if(this._map!==e&&(this.clear(),this._map=e),null==this._workPromise)return void this.notifyChange("updating");this.removeHandles("reschedule"),this.removeHandles("collection-change");const r=new Set,i=[],t=this.view.ready,s=e=>{if(null!=e)for(const o of e)if(o){r.add(o);const e=this._layerLayerViewInfoMap.get(o);e&&t?e.start():e||this._recyclingInfoMap.has(o)||i.push(o),"layers"in o&&o.layers&&s(o.layers)}};for(const a of this._rootCollectionNames)s(w(this,a));for(const[a,n]of this._layerLayerViewInfoMap)if(!r.has(a)){this._layerLayerViewInfoMap.delete(n.layer);const e=n.tryRecycle(i);e?(this.notifyChange("updating"),this._recyclingInfoMap.set(n.layer,n),e.then((()=>{this.notifyChange("updating"),this._recyclingInfoMap.delete(n.layer),this._layerLayerViewInfoMap.set(n.layer,n),this._reschedule()})).catch((()=>{this.notifyChange("updating"),this._recyclingInfoMap.delete(n.layer),n.destroy(),this._reschedule()}))):n.destroy()}for(const[a,n]of this._recyclingInfoMap)r.has(a)||(this.notifyChange("updating"),this._recyclingInfoMap.delete(n.layer),n.destroy());for(const a of i)this._createLayerView(a);this._refreshCollections();const o=[e?.ground?.layers,e?.basemap?.baseLayers,e?.basemap?.referenceLayers,e?.layers].filter((e=>!!e));r.forEach((e=>"layers"in e&&o.push(e.layers))),this.addHandles(o.map((e=>this._watchUpdatingTracking.addOnCollectionChange((()=>e),this._reschedule))),"collection-change"),this._workPromise.resolve(),this._workPromise=null}}initialize(){this.addHandles([l((()=>this.view?.map?.allLayers),"change",this._preloadLayerViewModules,{onListenerAdd:this._preloadLayerViewModules}),h((()=>{const e=this.view,r=e?.map;return[r?.basemap,r?.ground,r?.layers,e?.ready]}),(()=>this._reschedule()),y)]),this._preloadLayerViewModules(),this._reschedule()}destroy(){this.clear(),m(this._recyclingInfoMap),m(this._layerLayerViewInfoMap),this._watchUpdatingTracking.destroy(),this._map=null,null!=this._workPromise&&(this._workPromise.reject(a()),this._workPromise=null)}get _layersToLayerViews(){const e=[["view.map.basemap.baseLayers","view.basemapView.baseLayerViews"],["view.map.layers","view.layerViews"],["view.map.basemap.referenceLayers","view.basemapView.referenceLayerViews"]];return this.supportsGround&&e.push(["view.map.ground.layers","view.groundView.layerViews"]),new Map(e)}get _rootCollectionNames(){return Array.from(this._layersToLayerViews.keys())}get updating(){return null!=this._workPromise||this._watchUpdatingTracking.updating||s(this._layerLayerViewInfoMap,(e=>!e.done))||this._recyclingInfoMap.size>0}get updatingRemaining(){let e=0;for(const r of this._layerLayerViewInfoMap.values())r.done||++e;return e}clear(){this.destroyed||(m(this._layerLayerViewInfoMap),this._refreshCollections())}async whenLayerView(e){if(await this._reschedule(),!this._layerLayerViewInfoMap.has(e)){if(this._recyclingInfoMap.has(e))return this._recyclingInfoMap.get(e).promise;throw new i("view:no-layerview-for-layer","No layerview has been found for the layer",{layer:e})}return this._layerLayerViewInfoMap.get(e).promise}isCreatingLayerViewsForLayer(e,r){this.commitProperty("updatingRemaining");const i=this._layerLayerViewInfoMap.get(e);if(!i?.done)return!0;const t=i.layerView;return!(!t||!r||t.parent===r)||!!(i.done&&t&&"layers"in e&&e.layers?.length)&&e.layers.some((e=>this.isCreatingLayerViewsForLayer(e,t)))}_refreshCollections(){for(const[e,r]of this._layersToLayerViews)this._populateLayerViewsOwners(w(this,e),w(this,r),this.view);this.notifyChange("updating"),this.notifyChange("updatingRemaining")}_populateLayerViewsOwners(e,r,i){if(!e||!r)return void(r&&r.removeAll());let t=0;for(const s of e){const e=this._layerLayerViewInfoMap.get(s);if(!e?.layerView)continue;const o=e.layerView;o.layer=s,o.parent=i,r.at(t)!==o&&r.splice(t,0,o),"layers"in s&&g(o)&&this._populateLayerViewsOwners(s.layers,o.layerViews,o),t+=1}t<r.length&&r.splice(t
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import r from"../../core/Accessor.js";import i from"../../core/Error.js";import t from"../../core/Logger.js";import{someMap as s}from"../../core/MapUtils.js";import{createResolver as o,createAbortError as a,isAbortError as n}from"../../core/promiseUtils.js";import{on as l,watch as h,syncAndInitial as y}from"../../core/reactiveUtils.js";import{schedule as p}from"../../core/scheduling.js";import{property as c}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as d}from"../../core/accessorSupport/decorators/subclass.js";import{get as w}from"../../core/accessorSupport/get.js";import{UpdatingHandles as f}from"../../core/support/UpdatingHandles.js";import{destroyMap as m}from"../../support/collectionUtils.js";import{LayerLayerViewInfo as u}from"./LayerLayerViewInfo.js";function g(e){return null!=e&&"object"==typeof e&&"layerViews"in e}let _=class extends r{constructor(e){super(e),this._layerLayerViewInfoMap=new Map,this._recyclingInfoMap=new Map,this._watchUpdatingTracking=new f,this.supportsGround=!0,this._preloadLayerViewModules=()=>{const e=this.view.map?.allLayers;if(e)for(const r of e)this.layerViewImporter.hasLayerViewModule(r)&&this.layerViewImporter.importLayerView(r)},this._reschedule=()=>this.destroyed?Promise.reject():(null==this._workPromise&&(this._workPromise=o(),this._workPromise.promise.catch((()=>{}))),this.removeHandles("reschedule"),this.addHandles(p(this._doWork),"reschedule"),this._workPromise.promise),this._doWork=()=>{if(this.destroyed)return;const e=this.view.map;if(this._map!==e&&(this.clear(),this._map=e),null==this._workPromise)return void this.notifyChange("updating");this.removeHandles("reschedule"),this.removeHandles("collection-change");const r=new Set,i=[],t=this.view.ready,s=e=>{if(null!=e)for(const o of e)if(o){r.add(o);const e=this._layerLayerViewInfoMap.get(o);e&&t?e.start():e||this._recyclingInfoMap.has(o)||i.push(o),"layers"in o&&o.layers&&s(o.layers)}};for(const a of this._rootCollectionNames)s(w(this,a));for(const[a,n]of this._layerLayerViewInfoMap)if(!r.has(a)){this._layerLayerViewInfoMap.delete(n.layer);const e=n.tryRecycle(i);e?(this.notifyChange("updating"),this._recyclingInfoMap.set(n.layer,n),e.then((()=>{this.notifyChange("updating"),this._recyclingInfoMap.delete(n.layer),this._layerLayerViewInfoMap.set(n.layer,n),this._reschedule()})).catch((()=>{this.notifyChange("updating"),this._recyclingInfoMap.delete(n.layer),n.destroy(),this._reschedule()}))):n.destroy()}for(const[a,n]of this._recyclingInfoMap)r.has(a)||(this.notifyChange("updating"),this._recyclingInfoMap.delete(n.layer),n.destroy());for(const a of i)this._createLayerView(a);this._refreshCollections();const o=[e?.ground?.layers,e?.basemap?.baseLayers,e?.basemap?.referenceLayers,e?.layers].filter((e=>!!e));r.forEach((e=>"layers"in e&&o.push(e.layers))),this.addHandles(o.map((e=>this._watchUpdatingTracking.addOnCollectionChange((()=>e),this._reschedule))),"collection-change"),this._workPromise.resolve(),this._workPromise=null}}initialize(){this.addHandles([l((()=>this.view?.map?.allLayers),"change",this._preloadLayerViewModules,{onListenerAdd:this._preloadLayerViewModules}),h((()=>{const e=this.view,r=e?.map;return[r?.basemap,r?.ground,r?.layers,e?.ready]}),(()=>this._reschedule()),y)]),this._preloadLayerViewModules(),this._reschedule()}destroy(){this.clear(),m(this._recyclingInfoMap),m(this._layerLayerViewInfoMap),this._watchUpdatingTracking.destroy(),this._map=null,null!=this._workPromise&&(this._workPromise.reject(a()),this._workPromise=null)}get _layersToLayerViews(){const e=[["view.map.basemap.baseLayers","view.basemapView.baseLayerViews"],["view.map.layers","view.layerViews"],["view.map.basemap.referenceLayers","view.basemapView.referenceLayerViews"]];return this.supportsGround&&e.push(["view.map.ground.layers","view.groundView.layerViews"]),new Map(e)}get _rootCollectionNames(){return Array.from(this._layersToLayerViews.keys())}get updating(){return null!=this._workPromise||this._watchUpdatingTracking.updating||s(this._layerLayerViewInfoMap,(e=>!e.done))||this._recyclingInfoMap.size>0}get updatingRemaining(){let e=0;for(const r of this._layerLayerViewInfoMap.values())r.done||++e;return e}clear(){this.destroyed||(m(this._layerLayerViewInfoMap),this._refreshCollections())}async whenLayerView(e){if(await this._reschedule(),!this._layerLayerViewInfoMap.has(e)){if(this._recyclingInfoMap.has(e))return this._recyclingInfoMap.get(e).promise;throw new i("view:no-layerview-for-layer","No layerview has been found for the layer",{layer:e})}return this._layerLayerViewInfoMap.get(e).promise}isCreatingLayerViewsForLayer(e,r){this.commitProperty("updatingRemaining");const i=this._layerLayerViewInfoMap.get(e);if(!i?.done)return!0;const t=i.layerView;return!(!t||!r||t.parent===r)||!!(i.done&&t&&"layers"in e&&e.layers?.length)&&e.layers.some((e=>this.isCreatingLayerViewsForLayer(e,t)))}_refreshCollections(){for(const[e,r]of this._layersToLayerViews)this._populateLayerViewsOwners(w(this,e),w(this,r),this.view);this.notifyChange("updating"),this.notifyChange("updatingRemaining")}_populateLayerViewsOwners(e,r,i){if(!e||!r)return void(r&&r.removeAll());let t=0;for(const s of e){const e=this._layerLayerViewInfoMap.get(s);if(!e?.layerView)continue;const o=e.layerView;o.layer=s,o.parent=i,r.at(t)!==o&&r.splice(t,0,o),"layers"in s&&g(o)&&this._populateLayerViewsOwners(s.layers,o.layerViews,o),t+=1}t<r.length&&r.splice(t)}_createLayerView(e){e.load().catch((()=>{})),this.layerViewImporter.hasLayerViewModule(e)&&this.layerViewImporter.importLayerView(e);const r=new u(e,this.view,this.layerViewImporter);r.promise.then((()=>this._refreshCollections()),(r=>{r&&(n(r)||"cancelled:layerview-create"===r.name)||t.getLogger(this).error(`Failed to create layerview for layer title:'${e.title??"no title"}', id:'${e.id??"no id"}' of type '${e.type}'.`,{layer:e,error:r}),this._refreshCollections()})),this._layerLayerViewInfoMap.set(e,r),this.view.ready&&r.start(),this.notifyChange("updating"),this.notifyChange("updatingRemaining")}};e([c()],_.prototype,"_workPromise",void 0),e([c({readOnly:!0})],_.prototype,"_watchUpdatingTracking",void 0),e([c({readOnly:!0})],_.prototype,"_layersToLayerViews",null),e([c({readOnly:!0})],_.prototype,"_rootCollectionNames",null),e([c()],_.prototype,"layerViewImporter",void 0),e([c()],_.prototype,"supportsGround",void 0),e([c({readOnly:!0})],_.prototype,"updating",null),e([c({readOnly:!0})],_.prototype,"updatingRemaining",null),e([c({constructOnly:!0})],_.prototype,"view",void 0),_=e([d("esri.views.support.LayerViewManager")],_);const V=_;export{V as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import r from"../../core/Clonable.js";import o from"../../core/JSONSupport.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as t}from"../../core/accessorSupport/decorators/subclass.js";import p from"./FeatureReferenceObjectId.js";import{featureReferenceIdType as i}from"./featureReferenceUtils.js";import c from"./LayerReference.js";let a=class extends(r.ClonableMixin(o)){constructor(e){super(e),this.layer=new c,this.id=new p}};e([s({nonNullable:!0,json:{write:{isRequired:!0}},type:c})],a.prototype,"layer",void 0),e([s({json:{read:!0,write:{isRequired:!0}},nonNullable:!0,types:i})],a.prototype,"id",void 0),a=e([t("esri.webscene.support.FeatureReference")],a);const n=a;export{n as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import{enumeration as r}from"../../core/accessorSupport/decorators/enumeration.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import t from"./FeatureReferenceId.js";let p=class extends t{constructor(e){super(e),this.type="global-id",this.value=null}};e([r({globalId:"global-id"}),o({type:["global-id"],json:{read:!1,write:{isRequired:!0}},nonNullable:!0})],p.prototype,"type",void 0),e([o({type:String,json:{read:!0,write:{isRequired:!0}}})],p.prototype,"value",void 0),p=e([s("esri.webscene.support.FeatureReferenceGlobalId")],p);const a=p;export{a as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{_ as o}from"../../chunks/tslib.es6.js";import e from"../../core/Clonable.js";import{JSONMap as r}from"../../core/jsonMap.js";import s from"../../core/JSONSupport.js";import{property as t}from"../../core/accessorSupport/decorators/property.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";const c=new r({globalId:"global-id",objectId:"object-id"},{ignoreUnknown:!0});let a=class extends(e.ClonableMixin(s)){constructor(o){super(o),this.type=null}};o([t({type:c.apiValues,readOnly:!0,json:{type:c.jsonValues,read:!1,write:!0}})],a.prototype,"type",void 0),a=o([p("esri.webscene.support.FeatureReferenceId")],a);const n=a;export{n as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import{enumeration as r}from"../../core/accessorSupport/decorators/enumeration.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import{subclass as t}from"../../core/accessorSupport/decorators/subclass.js";import s from"./FeatureReferenceId.js";let c=class extends s{constructor(e){super(e),this.type="object-id",this.value=null}};e([r({objectId:"object-id"}),o({type:["object-id"],json:{read:!1,write:{isRequired:!0}},nonNullable:!0})],c.prototype,"type",void 0),e([o({type:[Number,String],json:{read:!0,write:{isRequired:!0}}})],c.prototype,"value",void 0),c=e([t("esri.webscene.support.FeatureReferenceObjectId")],c);const p=c;export{p as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{_ as r}from"../../chunks/tslib.es6.js";import e from"../../core/Clonable.js";import o from"../../core/JSONSupport.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import{subclass as t}from"../../core/accessorSupport/decorators/subclass.js";let p=class extends(e.ClonableMixin(o)){constructor(r){super(r),this.layerId=null,this.sublayerId=null}};r([s({type:String,json:{write:{isRequired:!0}},nonNullable:!0})],p.prototype,"layerId",void 0),r([s({type:Number,json:{write:!0}})],p.prototype,"sublayerId",void 0),p=r([t("esri.webscene.support.LayerReference")],p);const l=p;export{l as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as o}from"../../chunks/tslib.es6.js";import s from"../../core/Clonable.js";import r from"../../core/JSONSupport.js";import{property as e}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as t}from"../../core/accessorSupport/decorators/subclass.js";import p from"../SlideLegendInfo.js";import{WebSceneAnalysesCollection as i,webSceneAnalysisCollectionProperty as n}from"./analysisUtils.js";let a=class extends(s.ClonableMixin(r)){constructor(o){super(o),this.analyses=new i,this.legendInfo=null}};o([e(n("analyses"))],a.prototype,"analyses",void 0),o([e({type:p,json:{write:!0}})],a.prototype,"legendInfo",void 0),a=o([t("esri.webscene.support.SlideElements")],a);const
|
|
5
|
+
import{_ as o}from"../../chunks/tslib.es6.js";import s from"../../core/Clonable.js";import r from"../../core/JSONSupport.js";import{property as e}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as t}from"../../core/accessorSupport/decorators/subclass.js";import p from"../SlideLegendInfo.js";import{WebSceneAnalysesCollection as i,webSceneAnalysisCollectionProperty as n}from"./analysisUtils.js";import l from"./SlidePopupInfo.js";let a=class extends(s.ClonableMixin(r)){constructor(o){super(o),this.analyses=new i,this.legendInfo=null,this.popupInfo=null}};o([e(n("analyses"))],a.prototype,"analyses",void 0),o([e({type:p,json:{write:!0}})],a.prototype,"legendInfo",void 0),o([e({type:l,json:{write:!0}})],a.prototype,"popupInfo",void 0),a=o([t("esri.webscene.support.SlideElements")],a);const m=a;export{m as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import o from"../../core/Clonable.js";import r from"../../core/Collection.js";import t from"../../core/JSONSupport.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";import i from"../../geometry/Point.js";import n from"./FeatureReference.js";const c=r.ofType(n);let l=class extends(o.ClonableMixin(t)){constructor(e){super(e),this.features=new c,this.selectedFeatureIndex=0,this.location=null}};e([s({type:c,nonNullable:!0,json:{read:!0,write:{isRequired:!0}}})],l.prototype,"features",void 0),e([s({type:Number,nonNullable:!0,json:{write:!0}})],l.prototype,"selectedFeatureIndex",void 0),e([s({type:i,json:{write:{isRequired:!0}}})],l.prototype,"location",void 0),l=e([p("esri.webscene.support.SlidePopupInfo")],l);const a=l;export{a as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import e from"./FeatureReferenceGlobalId.js";import r from"./FeatureReferenceId.js";import t from"./FeatureReferenceObjectId.js";const o={key:"type",base:r,typeMap:{"object-id":t,"global-id":e}};export{o as featureReferenceIdType};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../analysis/AreaMeasurementAnalysis.js";import{watch as
|
|
5
|
+
import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../analysis/AreaMeasurementAnalysis.js";import{watch as s,syncAndInitial as i}from"../../core/reactiveUtils.js";import{measurementAreaUnits as r}from"../../core/unitUtils.js";import{property as n}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";import{defaultUnitPropertyMetadata as l}from"../../properties/defaultUnit.js";import{AnalysisViewModel as a}from"../support/AnalysisViewModel.js";let u=class extends a{constructor(t){super(t),this.analysis=null,this._userUnitOptions=null,this._userUnit=null,this.supportedViewType="3d",this.unsupportedErrorMessage="AreaMeasurement3DViewModel is only supported in 3D views."}initialize(){this.addHandles(s((()=>({analysis:this.analysis,unit:this.unit})),(({analysis:t,unit:e})=>{null!=t&&(t.unit=e)}),i))}get state(){return this.disabled||!this.ready?"disabled":null==this.tool?"ready":this.tool.state}get measurement(){if(null==this.tool||this.disabled||this.tool.destroyed)return null;const{analysisView:t}=this;if(null==t)return null;const{viewData:e,areaLabel:s,perimeterLengthLabel:i}=t,r=e.validMeasurement,n="euclidean"===e.mode,o=0===e.intersectingSegments.size,l=o?r?"available":"unavailable":"invalid";return{mode:n?"euclidean":"geodesic",area:{text:o&&r?s:null,state:l},perimeterLength:{text:o&&r?i:null,state:l}}}get unitOptions(){const t=this._userUnitOptions?.filter((t=>r.includes(t)));return t&&t.length>0?t:r.slice()}set unitOptions(t){this._userUnitOptions=t}get unit(){const t=this._userUnit,e=this.unitOptions;if(t&&e.includes(t))return t;const s=this.defaultUnit;return s&&e.includes(s)?s:e[0]}set unit(t){this._userUnit=t}constructAnalysis(){return new e}};t([n({type:e})],u.prototype,"analysis",void 0),t([n({readOnly:!0})],u.prototype,"state",null),t([n({readOnly:!0})],u.prototype,"measurement",null),t([n()],u.prototype,"unitOptions",null),t([n()],u.prototype,"_userUnitOptions",void 0),t([n()],u.prototype,"unit",null),t([n()],u.prototype,"_userUnit",void 0),t([n(l)],u.prototype,"defaultUnit",void 0),u=t([o("esri.widgets.AreaMeasurement3D.AreaMeasurement3DViewModel")],u);const p=u;export{p as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../analysis/DirectLineMeasurementAnalysis.js";import{watch as s,syncAndInitial as i}from"../../core/reactiveUtils.js";import{measurementLengthUnits as r}from"../../core/unitUtils.js";import{property as n}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";import{defaultUnitPropertyMetadata as l}from"../../properties/defaultUnit.js";import{AnalysisViewModel as a}from"../support/AnalysisViewModel.js";let u=class extends a{constructor(t){super(t),this.analysis=null,this.supportedViewType="3d",this.unsupportedErrorMessage="DirectLineMeasurement3DViewModel is only supported in 3D views."
|
|
5
|
+
import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../analysis/DirectLineMeasurementAnalysis.js";import{watch as s,syncAndInitial as i}from"../../core/reactiveUtils.js";import{measurementLengthUnits as r}from"../../core/unitUtils.js";import{property as n}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";import{defaultUnitPropertyMetadata as l}from"../../properties/defaultUnit.js";import{AnalysisViewModel as a}from"../support/AnalysisViewModel.js";let u=class extends a{constructor(t){super(t),this.analysis=null,this._userUnitOptions=null,this._userUnit=null,this.supportedViewType="3d",this.unsupportedErrorMessage="DirectLineMeasurement3DViewModel is only supported in 3D views."}initialize(){this.addHandles(s((()=>({analysis:this.analysis,unit:this.unit})),(({analysis:t,unit:e})=>{null!=t&&(t.unit=e)}),i))}get state(){return this.disabled||!this.ready?"disabled":null==this.tool?"ready":this.tool.state}get measurement(){const{tool:t}=this;if(null==t)return null;const e=()=>({text:null,state:"unavailable"}),s=t=>({text:t,state:"available"}),{analysisViewData:i}=t,r=null!=i.result;return{mode:i.result?.mode??"euclidean",directDistance:r&&"euclidean"===i.actualVisualizedMeasurement?s(i.directLabelText):e(),horizontalDistance:r?s(i.horizontalLabelText):e(),verticalDistance:r?s(i.verticalLabelText):e()}}get unitOptions(){const t=this._userUnitOptions?.filter((t=>r.includes(t)));return t&&t.length>0?t:r.slice()}set unitOptions(t){this._userUnitOptions=t}get unit(){const t=this._userUnit,e=this.unitOptions;if(t&&e.includes(t))return t;const s=this.defaultUnit;return s&&e.includes(s)?s:e[0]}set unit(t){this._userUnit=t}constructAnalysis(){return new e}};t([n({type:e})],u.prototype,"analysis",void 0),t([n({readOnly:!0})],u.prototype,"state",null),t([n({readOnly:!0})],u.prototype,"measurement",null),t([n()],u.prototype,"unitOptions",null),t([n()],u.prototype,"_userUnitOptions",void 0),t([n()],u.prototype,"unit",null),t([n()],u.prototype,"_userUnit",void 0),t([n(l)],u.prototype,"defaultUnit",void 0),u=t([o("esri.widgets.DirectLineMeasurement3D.DirectLineMeasurement3DViewModel")],u);const p=u;export{p as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import a from"../../core/Error.js";import{makeHandle as i,handlesGroup as r,abortHandle as s}from"../../core/handleUtils.js";import"../../core/has.js";import o from"../../core/Logger.js";import{removeMaybe as n,destroyMaybe as l}from"../../core/maybe.js";import{isPromiseLike as d,debounce as c}from"../../core/promiseUtils.js";import{watch as u,when as h,initial as p,whenOnce as m,syncAndInitial as f}from"../../core/reactiveUtils.js";import{generateBracedUUID as w}from"../../core/uuid.js";import{property as g}from"../../core/accessorSupport/decorators/property.js";import"../../core/RandomLCG.js";import{subclass as y}from"../../core/accessorSupport/decorators/subclass.js";import{isSharedTemplateOrMetadata as v,isSharedTemplate as F,isStandardFeatureTemplate as _}from"../../editing/templateUtils.js";import b from"../../layers/GraphicsLayer.js";import{isTable as M}from"../../layers/support/layerUtils.js";import{getDisplayedSymbol as I}from"../../symbols/support/symbolUtils.js";import{getDrawHelpMessage as V}from"../../views/draw/support/helpMessageUtils.js";import k from"../../views/draw/support/HighlightHelper.js";import S from"../../views/interactive/sketch/SketchOptions.js";import C from"../../views/interactive/snapping/FeatureSnappingLayerSource.js";import{temporaryHighlightName as A}from"../../views/support/HighlightDefaults.js";import E from"./CreateFeaturesWorkflowData.js";import{isModelUpload as P,handleModelUpload as T}from"./modelUploadUtils.js";import H from"./Workflow.js";import{createToolFromGeometryType as j,getServiceEditsFromWorkflowData as U,getServiceInfoForLayer as L,orderEditsByRelationshipDependencies as x,getFullTemplateForCreationInfo as O,getServiceLayersById as W,startCreatingNewFeature as D,findLayerInfo as R,updateGraphicSymbolWhenRequired as z,isTerminalUpdateEventType as G,getVisualVariableAttributes as N,startUpdatingFeatureGeometry as K,createWorkflowSteps as Z,avoidFeatureTemplateSelectionWithOnlyOneItem as q,getCreationAttributes as B,setRelationshipFields as J,prepareAttachmentsForCreateFeaturesWorkflow as Q,showProgressCursor as X,setUpSketchCreateWatchers as Y,setVisualVariablesAndElevationInfoForUpdate as $,visualVariableInteractiveUpdate as ee}from"./workflowUtils.js";import te from"../FeatureForm/FeatureFormViewModel.js";import ae from"../Sketch/SketchViewModel.js";var ie;const re=Symbol(),se=Symbol(),oe=Symbol(),ne=Symbol(),le={point:["point"],multipoint:["multipoint"],polygon:["polygon","freehandPolygon","rectangle","circle"],polyline:["polyline","freehandPolyline"],mesh:[],multipatch:[]};let de=ie=class extends H{constructor(e){super(e),this.type="create-features",this.createFeatureState="create-new",this.data=void 0,this.isNested=!1,this._getDrawMeshHelpMessage=void 0,this._webStyleCache=new Map,this._featureFormHandle=null,this._visualVariableAttributes={rotation:null,size:null},this._featureFormViewModel=new te,this._sketchViewModel=null,this._attachmentFileInfos=new Map,this._isActive=!0}initialize(){this.isNested&&(this._isActive=!1),this._initializeSketchViewModel()}destroy(){this._sketchViewModel.destroy()}get featureFormViewModel(){return this._featureFormViewModel}get hasPendingEdits(){if(this.pendingFeatures.some((e=>!!this.data.getEditsForPendingFeature(e)?.modified)))return!0;const{creationInfo:e,upload:t}=this.data,a=this._sketchViewModel,{activeComponent:i}=a,r=a.createGraphic?.geometry?.type;return!("polyline"!==r&&"polygon"!==r&&"multipoint"!==r||"draw-2d"!==i?.type&&"draw-3d"!==i?.type)&&i.drawOperation.committedVertices.length>0||(!(!t||"pending"!==t.state&&"success"!==t.state)||!!e?.geometryToPlace)}get hasPreviousStep(){return this._stepIndex>0||"update-pending"===this.createFeatureState&&!!this.data.selectedPendingFeature&&!this.parent&&!P(this.data.creationInfo)}get helpMessage(){const{creationInfo:e,viewModel:t}=this.data;if("creating-features"!==this.stepId||!e)return;const a=e.layer.geometryType,i=this._sketchViewModel.createGraphic;if("mesh"===a){this._getDrawMeshHelpMessage||import("../../views/draw/support/helpMessageUtils3d.js").then((e=>{this._getDrawMeshHelpMessage=e.getDrawMeshHelpMessage}));const{view:e}=t;return"3d"===e?.type?this._getDrawMeshHelpMessage?.(i,e):void 0}const r=this._sketchViewModel.activeCreateToolDrawMode,s=this._sketchViewModel.activeTool;return V("rectangle"===s?"rectangle":"circle"===s?"circle":a,i?.geometry,r)}get layer(){return this.data.creationInfo?.layer}get numPendingFeatures(){return this.pendingFeatures.length}get numPendingFeaturesExcludingHidden(){return this.pendingFeatures.filter((e=>this.data.isDisplayable(e))).length}get parent(){return this.data.parent}get parentLayer(){return this.parent?.data.editorItem.layer}get pendingFeatures(){return this.data.pendingFeatures}get keyboardCancellationEnabled(){return 0===this.numPendingFeatures}get reliesOnOwnerAdminPrivileges(){return this.data.editorItem?.capabilities.create.reliesOnOwnerAdminPrivileges??!1}get shouldShowAttachments(){return(this.data.selectedPendingFeature&&this.data.editorItem?.capabilities.create.attachments.enabled)??!1}get shouldAllowAttachmentEditing(){return this.shouldShowAttachments}get sketchViewModel(){return this._sketchViewModel}get test(){}get availableCreateTools(){const e=this.data.creationInfo?.layer.geometryType,t=this.data.viewModel.view;if(!e)return[];if(this.data.creationInfo?.maxFeatures&&this.data.creationInfo.maxFeatures<=this.numPendingFeatures)return[];if(v(this.data.fullTemplate)){const{tool:t}=j(e,this.data.fullTemplate);return[t]}return"2d"!==t?.type&&"multipoint"===e?[]:[...le[e]]}get _attachmentsActive(){const e=this.data.viewModel.attachmentsViewModel.mode,t=this.stepId;return this.shouldShowAttachments&&("add"===e||"edit"===e||"adding-attachment"===t||"editing-attachment"===t)}async enter(){this._isActive=!0,"awaiting-feature-creation-info"!==this.stepId&&await this._updatingHandles.addPromise(this._setUpCreatingFeaturesStep())}exit(){this._isActive=!1,this.removeHandles([oe])}async updatePendingFeature(e){if(e!==this.data.selectedPendingFeature)return this._sketchViewModel.cancel(),this._startUpdating({feature:e})}async start(){return await super.start(),M(this.data.creationInfo?.layer)?null:{enter:async()=>{},exit:async()=>{},viewModel:this._sketchViewModel}}async save(){const{featureFormViewModel:e}=this;if(e.pendingSubtypeChoice)return;e.submit(),this._stashValidationState();const t=this.data.selectedPendingFeature,a=this._hasValidationErrors(t)?t:this.data.pendingFeatures.find((e=>this._hasValidationErrors(e)));return a?(await this._startUpdating({feature:a}),void e?.submit()):super.save()}back(e){return"update-pending"!==this.createFeatureState||!this.data.selectedPendingFeature||P(this.data.creationInfo)||this._attachmentsActive||this.parent?super.back(e):this._clearSelectedFeature()}previous(e){return"update-pending"!==this.createFeatureState||!this.data.selectedPendingFeature||P(this.data.creationInfo)||this._attachmentsActive?super.previous(e):this._clearSelectedFeature()}cancelFeature(e){this.data.isSharedTemplateWorkflow?o.getLogger(this).warn("Cannot cancel individual features created by shared templates."):(this.data.removePendingFeature(e),this.sketchViewModel.layer.graphics.remove(e))}static create(e){const{addAttachmentsCallback:t,applyEditsCallback:a,applyEditsFeatureServiceCallback:i,isNested:r,creationInfo:s,parent:o,snappingManager:n,startAt:l,viewModel:d}=e,c=e.sketchOptions??new S,u=s?.layer,h=u?d.findEditorItemForLayer(u):void 0,p=new ie({data:new E({creationInfo:s,editorItem:h,parent:o,sketchOptions:c,snappingManager:n,viewModel:d}),isNested:r,onCommit:async e=>{const{creationInfo:r}=e;if(!r)return;p._sketchViewModel.cancel();const s=e.pendingFeatures.toArray(),{layer:o}=r,n=o.capabilities?.editing.supportsGlobalId&&"globalIdField"in o,l=p._attachmentFileInfos,{fullTemplate:c}=e,u=U(p.data),h=F(c)&&u;if(n){if(pe(s),h){let t=fe(u,l);const a=await L(o,d.view);a&&(t=x({edits:t,serviceInfo:a,view:d.view,findOriginalFeature:t=>e.getEditsForPendingFeature(t)?.initialFeature??t})),await i(c.featureService,t,{globalIdUsed:!0,gdbVersion:c.layer.gdbVersion??void 0})}else{const e=me(s,l);await a(o,e,{globalIdUsed:!0})}return}const m=h?await i(c.featureService,u,{gdbVersion:c.layer.gdbVersion??void 0}):[await a(o,{addFeatures:s})];m&&l.size>0&&await Promise.all(m.map((e=>{if(e?.addFeatureResults)return t(o,he(s,e.addFeatureResults,o,l))})))}});return p._set("steps",this._createWorkflowSteps(p,l)),p}_fadeExistingFeatures(e){if("effect"in e){const t=e.effect;return e.effect="saturate(0.6) opacity(0.8)",i((()=>e.effect=t))}const t=e.opacity;return e.opacity=.7,i((()=>e.opacity=t))}async _initializeFullTemplateAndExecutorInfo(e){const{creationInfo:t}=e,{view:a}=e.viewModel;if(!t||!a)return null;const i=await O(t,a);if(e.fullTemplate=i,i&&F(i)){const{createTemplateExecutor:r}=await import("../../editing/sharedTemplates/executor/createTemplateExecutor.js"),s={completionResults:[],executor:await r(i),serviceLayersById:await W(t.layer,a)};e.templateExecutorInfo=s}return i}async _startCreating(){this.removeHandles(se);const{data:e}=this;if(!e.creationInfo)return;const t=this.data.creationInfo?.maxFeatures;if(t&&this.numPendingFeatures>=t)return this.sketchViewModel.cancel(),void(this.numPendingFeatures&&await this._startUpdating({feature:this.pendingFeatures.at(-1)}));this.createFeatureState="create-new",await D(this._sketchViewModel,e,this._webStyleCache)}async _clearSelectedFeature(){const e=this._featureFormViewModel.pendingSubtypeChoice;e&&(e.resolve("undo"),await e.promise),this._stashValidationState(),this.sketchViewModel.cancel(),this.data.selectedPendingFeature=null,this._featureFormHandle=n(this._featureFormHandle),this._featureFormViewModel.feature=null;const t=this.data.viewModel.attachmentsViewModel;"add"!==t.mode&&"edit"!==t.mode||this.data.viewModel.activeWorkflow?.previous()}_stashValidationState(){const e=this._featureFormViewModel.feature,t=e&&this.data.getEditsForPendingFeature(e);t&&(t.submittable=this._featureFormViewModel.submittable)}async _selectFeatureForUpdate({feature:e,initialFeature:t=e}){this._stashValidationState();const{data:a,pendingFeatures:i,_webStyleCache:s}=this;i.includes(e)||a.addPendingFeature(e,t),a.selectedPendingFeature=e;const{_featureFormViewModel:o,_sketchViewModel:l}=this,{creationInfo:d,viewModel:c}=a,{attachmentsViewModel:h,layerInfos:p,view:m}=c;if(!m||!d)return;n(this._featureFormHandle);const f=e.sourceLayer,w=R(p,f),g=w?.formTemplate,y=m.spatialReference;o.set({arcadeEditType:"INSERT",feature:e,formTemplate:g,spatialReference:y,map:m.map}),"add"!==h.mode&&"edit"!==h.mode||c.activeWorkflow?.previous(),h.graphic=e,h.fileInfos.removeAll(),h.mode="view";(this._attachmentFileInfos.get(e)||[]).forEach((({file:e,form:t})=>h.addFile(e,t))),await z(e,s,"2d"===m.type?m.scale:null);const v=a.getEditsForPendingFeature(e);this._featureFormHandle=r([o.on("value-change",(async()=>{v?.updateAttributes(o.getValues()),await z(e,s,"2d"===m.type?m.scale:null)})),l.on(["update","undo","redo"],(e=>{("undo"===e.type||"redo"===e.type||"update"===e.type&&null!=e.toolEventInfo&&G(e.toolEventInfo.type))&&o.notifyFeatureGeometryChanged()})),u((()=>o.feature?.sourceLayer),(t=>e.sourceLayer=t)),u((()=>[o.feature,o.submittable]),(()=>this._stashValidationState()))]),this.createFeatureState="update-pending"}async _startUpdating({feature:e,initialFeature:t=e}){await this._selectFeatureForUpdate({feature:e,initialFeature:t});const{_sketchViewModel:a,data:i}=this,{creationInfo:r,viewModel:s}=i,{view:o}=s;if(!o||!r)return;const n=e.sourceLayer??r.layer;return M(n)?void 0:(this._visualVariableAttributes=N(e),K({graphic:e,sketchViewModel:a,sourceLayer:n,visualVariables:this._visualVariableAttributes,webStyleCache:this._webStyleCache}))}static _createWorkflowSteps(e,t="awaiting-feature-creation-info"){const{data:a}=e,i=Z(["awaiting-feature-creation-info","creating-features","adding-attachment","editing-attachment"],t,{"awaiting-feature-creation-info":()=>({id:"awaiting-feature-creation-info",async setUp(){const{creationInfo:t,viewModel:i}=a,{view:r}=i;r&&(P(t)?e.addHandles(await T({view:r,data:a,next:()=>e.next(),cancel:()=>i.cancelWorkflow({warnIfNoWorkflow:!1})}),this.id):(a.parent&&t&&e.addHandles(i.restrictFeatureTemplatesViewModelToLayer(t.layer),this.id),e.addHandles(i.featureTemplatesViewModel.on("select",(({item:t})=>{t&&(a.creationInfo={...a.creationInfo,layer:t.layer,template:t.template},e.next())})),this.id)))},async tearDown(){e.removeHandles(this.id)}}),"creating-features":()=>({id:"creating-features",async setUp(){e._isActive&&await e._setUpCreatingFeaturesStep()},async tearDown(t){const{viewModel:i}=a;t.canceled&&(e.removeHandles([oe,re,se,ne]),i.attachmentsViewModel.fileInfos.removeAll(),e._attachmentFileInfos.clear())}}),"adding-attachment":()=>({id:"adding-attachment",parent:"creating-features",async setUp(){},async tearDown(){const{attachmentsViewModel:t}=a.viewModel,{graphic:i,fileInfos:r}=t;e._attachmentFileInfos.set(i,r.toArray()),t.mode="view"}}),"editing-attachment":()=>({id:"editing-attachment",parent:"creating-features",async setUp(){},async tearDown(){const{attachmentsViewModel:t}=a.viewModel,{graphic:i,fileInfos:r}=t;e._attachmentFileInfos.set(i,r.toArray()),t.mode="view"}})});return q(a,i)}static _configureSketchViewModel(e){const{data:t}=e,a=e._webStyleCache,{creationInfo:s,viewModel:o}=t,{view:n}=o,l=e._sketchViewModel,d=[];if(!n)return i();if("2d"===n.type){s&&d.push(e._fadeExistingFeatures(s.layer));const t=c(((e,t)=>Promise.all(e.map((e=>z(e,a,t))))));d.push(u((()=>n.scale),(e=>t(l.layer.graphics,e))))}const p=B(t.fullTemplate,s?.attributeOverrides),m=u((()=>l.createGraphic),(i=>{i&&!e.hasHandles(se)&&e._updatingHandles.addPromise(Y({creationAttributes:p,data:t,sketchViewModel:l,view:n,webStyleCache:a}).then((t=>e.addHandles(t,se))))})),f=async t=>{if("cancel"!==t.state&&"complete"!==t.state||e.removeHandles(se),"cancel"===t.state&&null!==n.activeTool&&n.activeTool!==e.sketchViewModel.activeComponent&&(await e._waitForActiveToolCleared(),await e._startCreating()),"complete"===t.state&&t.graphic){const a=await e._processEdits(t.graphic,{scale:"2d"===n.type?n.scale:null,useSourceLayer:!0,webStyleCache:e._webStyleCache});a&&(await e._waitForActiveToolCleared(),await e._startUpdating({feature:a}))}},w=async a=>{const{attachmentsViewModel:i}=o,{_featureFormViewModel:r}=e;if(a.graphics.length>1)return void await e._clearSelectedFeature();const d=a.graphics[0];if("complete"===a.state){const{submittable:t}=r;if(e.numPendingFeatures!==s?.maxFeatures&&t||r.submit(),await e._clearSelectedFeature(),"add"!==i.mode&&"edit"!==i.mode||o.activeWorkflow?.previous(),!a.aborted&&n.activeTool===e.sketchViewModel.activeComponent&&(await e.sketchViewModel.wait(),"ready"===e.sketchViewModel.state&&"mesh"!==e.data.creationInfo?.layer.geometryType))return e._startCreating()}else{if("start"===a.state)return d.sourceLayer??=t.creationInfo?.layer,await $({sketchViewModel:l,graphic:d,visualVariables:e._visualVariableAttributes,webStyleCache:e._webStyleCache,sourceLayer:d.sourceLayer}),e._selectFeatureForUpdate({feature:d});if("active"===a.state){await e.updatePendingFeature(d);const t=e._visualVariableAttributes;ee(n,d,a,t)&&await z(d,e._webStyleCache,"2d"===n.type?n.scale:null);const i=d.attributes,{rotation:s,size:o}=t;if(null!=s){const{field:e}=s;r.setValue(e,i[e])}if(null!=o){const{field:e}=o;r.setValue(e,i[e])}}}},g=async a=>{if(a.graphics.forEach((e=>{t.removePendingFeature(e)})),!P(t.creationInfo))return e._startCreating()},y=async()=>{if(P(t.creationInfo))try{await e.data.viewModel.back()}catch{}return e._startCreating()};d.push(m,l.on("create",(t=>e._updatingHandles.addPromise(f(t)))),l.on("update",(t=>e._updatingHandles.addPromise(w(t)))),l.on("delete",(t=>e._updatingHandles.addPromise(g(t)))),h((()=>!e.numPendingFeatures),(()=>e._updatingHandles.addPromise(y()))),i((()=>{l.cancel()})),ce(l,t),...ue(t));const v=r(d);return l.addHandles(v),v}_initializeSketchViewModel(){const{data:e}=this,{view:t}=e.viewModel,a=new b({elevationInfo:e.creationInfo?.layer.elevationInfo,internal:!0,listMode:"hide",title:"createFeaturesWorkflow-internal"}),r=new ae({layer:a,creationMode:"single",sketchOptions:e.sketchOptions,snappingManager:e.snappingManager,updateOnGraphicClick:!1,defaultUpdateOptions:{multipleSelectionEnabled:!1},view:t});this._sketchViewModel=r,t?.map.add(a),this.addHandles([i((()=>{t?.destroyed||t?.map.remove(a),a.destroy()})),u((()=>this.numPendingFeatures>0),(e=>this._sketchViewModel.updateOnGraphicClick=e),p)])}_hasValidationErrors(e){return!!e&&(!this.data.isSubmittable(e)||!!this._featureFormViewModel.validateContingencyConstraints(e.attributes,{includeIncompleteViolations:!0})?.length)}async _processEdits(e,t){const{data:a,_featureFormViewModel:i}=this,{layerInfos:r,view:s}=a.viewModel;i.arcadeEditType="INSERT",i.map=s?.map,i.spatialReference=s?.spatialReference;const{templateExecutorInfo:o}=a;if(!o){const t=e.clone();return t.geometry=null,await this._addAndInitializeEdits(e,t),e}const n=this.sketchViewModel.layer;n.remove(e);const{executor:l}=o,c=l(e.geometry,"completion"),u=d(c)?await c:c;o.completionResults.push(u),J(u.relationships),i.arcadeEditType="INSERT",i.map=s?.map,i.spatialReference=s?.spatialReference,u.primary&&a.creationInfo?.attributeOverrides&&(u.primary.graphic.attributes={...u.primary.graphic.attributes,...a.creationInfo.attributeOverrides});for(const d of u.edits){let e=null;if(d.addFeatures)for(const a of d.addFeatures){const i=a.clone();i.geometry=null,null!=a.geometry&&(a.symbol=await I(a,t),n.add(a)),a.sourceLayer!==e?.layer&&(e=R(r,a.sourceLayer));const s=!!u.associationGraphics?.has(a);await this._addAndInitializeEdits(a,i,e,s)}}i.feature=null,await m((()=>!i.updating));return u.edits.reduce(((e,t)=>e+(t.addFeatures?.length??0)),0)>1?null:u.primary?.graphic}async _addAndInitializeEdits(e,t,a,i=!1){const{data:r,_featureFormViewModel:s}=this,{layerInfos:o}=r.viewModel,n=r.addPendingFeature(e,t,{isAssociation:i});a??=R(o,e.sourceLayer),s.feature=e,s.formTemplate=a?.formTemplate,await m((()=>!s.updating)),n.submittable=s.submittable}async _setUpCreatingFeaturesStep(){if(this.hasHandles(oe))return;const{data:e,sketchViewModel:s}=this,{creationInfo:o,viewModel:l}=e,{attachmentsViewModel:d,view:c}=l;if(!c||!o?.layer)throw new a("missing-parameters","CreateFeaturesWorkflow requires a view and creationInfo.");const{initialFeature:h,layer:m}=o,f=[],w=[];this._featureFormHandle=n(this._featureFormHandle),this._visualVariableAttributes={rotation:null,size:null},e.editorItem=l.findEditorItemForLayer(o.layer),o.template&&(null==e.fullTemplate&&await this._initializeFullTemplateAndExecutorInfo(e),w.push(i((()=>{e.templateExecutorInfo&&(e.templateExecutorInfo.completionResults=[])})))),s.allowDeleteKey=!e.isSharedTemplateWorkflow,Q(d),f.push(u((()=>d.mode),(e=>{switch(e){case"add":this.go("adding-attachment");break;case"edit":this.go("editing-attachment")}})));const g=X(c);f.push(g);const y=M(o.layer),{template:F}=o,b=!F||_(F)||v(F)&&"feature"===F.type,I=y&&b;try{if(I){const a=h??new t({attributes:B(e.fullTemplate,o.attributeOverrides),sourceLayer:m}),i=await this._processEdits(a);i&&await this._startUpdating({feature:i})}else f.push(ie._configureSketchViewModel(this)),h?(P(o)&&o.geometryToPlace&&(h.attributes=B(e.fullTemplate,o.attributeOverrides)),s.layer.add(h),await this._startUpdating({feature:h})):await this._startCreating()}finally{g.remove()}const V=i((()=>{for(const t of e.pendingFeatures)s.layer.remove(t),e.removePendingFeature(t)})),k=u((()=>c?.timeZone),(e=>{this._featureFormViewModel.timeZone=e,this.data.timeZone=e}),p),S=i((()=>{P(o)&&l.cancelWorkflow({warnIfNoWorkflow:!1})}));this._featureFormHandle&&f.push(this._featureFormHandle),this.addHandles(f,this._handleKeys.beforeCommit),this.addHandles(w,this._handleKeys.afterCommit),this.addHandles([i((()=>d.fileInfos.removeAll())),r(f),r(w),S,V,k],oe)}async _waitForActiveToolCleared(){const e=this.data.viewModel.view;if(null==e?.activeTool)return;const t=new AbortController;this.addHandles(s(t),ne),await m((()=>null==e?.activeTool),t.signal),t.abort()}};function ce(e,t){let a=null;const s=()=>e.snappingOptions.featureSources,o=()=>(a=new C({layer:e.layer}),s().add(a),a),n=()=>{null!=a&&(s().remove(a),a=l(a))};return r([u((()=>{const e=t.creationInfo?.layer,a=s().find((t=>t.layer===e));return{hasFeatureLayerSource:!!a,enabled:a?.enabled??!1}}),(({hasFeatureLayerSource:e,enabled:t})=>{if(!e)return n();a??=o(),a.enabled=t}),f),i(n)])}function ue(e){const t=e.viewModel.view;if(!t)return[];const a=[];if("3d"===t.type){const r=new k({view:t});a.push(u((()=>e.selectedPendingFeature),((e,t)=>{r.remove(e),r.add(t)})),i((()=>r.destroy())))}const r=new k({view:t,highlightName:A});return a.push(u((()=>e.temporaryHighlightFeature),(e=>{r.removeAll(),r.add(e)})),i((()=>r.destroy()))),a}function he(e,t,a,i){const r=[];return t.forEach(((t,s)=>{if(!t.error){const o=e[s],n=i.get(o)||[];o.attributes[a.objectIdField]=t.objectId,n.forEach((({form:e})=>r.push({feature:o,attachment:e})))}})),r}function pe(e){for(const t of e){const{sourceLayer:e}=t;e&&"globalIdField"in e&&null!=e.globalIdField&&(t.attributes[e.globalIdField]??=w())}}function me(e,t){const a=[];if(!t||0===t.size)return{addFeatures:e};for(const[i,r]of t)for(const{file:e}of r)a.push({feature:i,attachment:{globalId:w(),data:e}});return a.length?{addFeatures:e,addAttachments:a}:{addFeatures:e}}function fe(e,t){return e.map((e=>{const{addFeatures:a}=e;if(!a||0===a.length)return e;const i=[];for(const r of a){const e=t.get(r);if(e)for(const{file:t}of e)i.push({feature:r,attachment:{globalId:w(),data:t}})}return i.length?{...e,addAttachments:i}:e}))}e([g()],de.prototype,"createFeatureState",void 0),e([g()],de.prototype,"data",void 0),e([g({constructOnly:!0})],de.prototype,"isNested",void 0),e([g()],de.prototype,"featureFormViewModel",null),e([g()],de.prototype,"hasPendingEdits",null),e([g()],de.prototype,"hasPreviousStep",null),e([g()],de.prototype,"_getDrawMeshHelpMessage",void 0),e([g()],de.prototype,"helpMessage",null),e([g()],de.prototype,"layer",null),e([g()],de.prototype,"parent",null),e([g()],de.prototype,"parentLayer",null),e([g()],de.prototype,"keyboardCancellationEnabled",null),e([g()],de.prototype,"reliesOnOwnerAdminPrivileges",null),e([g()],de.prototype,"shouldShowAttachments",null),e([g()],de.prototype,"shouldAllowAttachmentEditing",null),e([g()],de.prototype,"sketchViewModel",null),e([g()],de.prototype,"availableCreateTools",null),e([g()],de.prototype,"_attachmentsActive",null),de=ie=e([y("esri.widgets.Editor.CreateFeaturesWorkflow")],de);const we=de;export{we as default};
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import a from"../../core/Error.js";import{makeHandle as i,handlesGroup as r,abortHandle as s}from"../../core/handleUtils.js";import"../../core/has.js";import o from"../../core/Logger.js";import{removeMaybe as n,destroyMaybe as l}from"../../core/maybe.js";import{isPromiseLike as d,debounce as c}from"../../core/promiseUtils.js";import{watch as u,when as h,initial as p,whenOnce as m,syncAndInitial as f}from"../../core/reactiveUtils.js";import{generateBracedUUID as w}from"../../core/uuid.js";import{property as g}from"../../core/accessorSupport/decorators/property.js";import"../../core/RandomLCG.js";import{subclass as y}from"../../core/accessorSupport/decorators/subclass.js";import{isSharedTemplateOrMetadata as v,isSharedTemplate as F,isStandardFeatureTemplate as _}from"../../editing/templateUtils.js";import b from"../../layers/GraphicsLayer.js";import{isTable as M}from"../../layers/support/layerUtils.js";import{getDisplayedSymbol as I}from"../../symbols/support/symbolUtils.js";import{getDrawHelpMessage as V}from"../../views/draw/support/helpMessageUtils.js";import k from"../../views/draw/support/HighlightHelper.js";import S from"../../views/interactive/sketch/SketchOptions.js";import C from"../../views/interactive/snapping/FeatureSnappingLayerSource.js";import{temporaryHighlightName as A}from"../../views/support/HighlightDefaults.js";import P from"./CreateFeaturesWorkflowData.js";import{isModelUpload as E,handleModelUpload as T}from"./modelUploadUtils.js";import H from"./Workflow.js";import{createToolFromGeometryType as j,getServiceEditsFromWorkflowData as U,getServiceInfoForLayer as L,orderEditsByRelationshipDependencies as x,getFullTemplateForCreationInfo as O,getServiceLayersById as W,startCreatingNewFeature as D,findLayerInfo as R,updateGraphicSymbolWhenRequired as z,isTerminalUpdateEventType as G,getVisualVariableAttributes as N,startUpdatingFeatureGeometry as K,createWorkflowSteps as Z,avoidFeatureTemplateSelectionWithOnlyOneItem as q,getCreationAttributes as B,setRelationshipFields as J,prepareAttachmentsForCreateFeaturesWorkflow as Q,showProgressCursor as X,setUpSketchCreateWatchers as Y,setVisualVariablesAndElevationInfoForUpdate as $,visualVariableInteractiveUpdate as ee}from"./workflowUtils.js";import te from"../FeatureForm/FeatureFormViewModel.js";import ae from"../Sketch/SketchViewModel.js";var ie;const re=Symbol(),se=Symbol(),oe=Symbol(),ne=Symbol(),le={point:["point"],multipoint:["multipoint"],polygon:["polygon","freehandPolygon","rectangle","circle"],polyline:["polyline","freehandPolyline"],mesh:[],multipatch:[]};let de=ie=class extends H{constructor(e){super(e),this.type="create-features",this.createFeatureState="create-new",this.data=void 0,this.isNested=!1,this._getDrawMeshHelpMessage=void 0,this._webStyleCache=new Map,this._featureFormHandle=null,this._visualVariableAttributes={rotation:null,size:null},this._featureFormViewModel=new te,this._sketchViewModel=null,this._attachmentFileInfos=new Map,this._isActive=!0}initialize(){this.isNested&&(this._isActive=!1),this._initializeSketchViewModel()}destroy(){this._sketchViewModel.destroy()}get featureFormViewModel(){return this._featureFormViewModel}get hasPendingEdits(){if(this.pendingFeatures.some((e=>!!this.data.getEditsForPendingFeature(e)?.modified)))return!0;const{creationInfo:e,upload:t}=this.data,a=this._sketchViewModel,{activeComponent:i}=a,r=a.createGraphic?.geometry?.type;return!("polyline"!==r&&"polygon"!==r&&"multipoint"!==r||"draw-2d"!==i?.type&&"draw-3d"!==i?.type)&&i.drawOperation.committedVertices.length>0||(!(!t||"pending"!==t.state&&"success"!==t.state)||!!e?.geometryToPlace)}get hasPreviousStep(){return this._stepIndex>0||"update-pending"===this.createFeatureState&&!!this.data.selectedPendingFeature&&!this.parent&&!E(this.data.creationInfo)}get helpMessage(){const{creationInfo:e,viewModel:t}=this.data;if("creating-features"!==this.stepId||!e)return;const a=e.layer.geometryType,i=this._sketchViewModel.createGraphic;if("mesh"===a){this._getDrawMeshHelpMessage||import("../../views/draw/support/helpMessageUtils3d.js").then((e=>{this._getDrawMeshHelpMessage=e.getDrawMeshHelpMessage}));const{view:e}=t;return"3d"===e?.type?this._getDrawMeshHelpMessage?.(i,e):void 0}const r=this._sketchViewModel.activeCreateToolDrawMode,s=this._sketchViewModel.activeTool;return V("rectangle"===s?"rectangle":"circle"===s?"circle":a,i?.geometry,r)}get layer(){return this.data.creationInfo?.layer}get numPendingFeatures(){return this.pendingFeatures.length}get numPendingFeaturesExcludingHidden(){return this.pendingFeatures.filter((e=>this.data.isDisplayable(e))).length}get parent(){return this.data.parent}get parentLayer(){return this.parent?.data.editorItem.layer}get pendingFeatures(){return this.data.pendingFeatures}get keyboardCancellationEnabled(){return 0===this.numPendingFeatures}get reliesOnOwnerAdminPrivileges(){return this.data.editorItem?.capabilities.create.reliesOnOwnerAdminPrivileges??!1}get shouldShowAttachments(){return(this.data.selectedPendingFeature&&this.data.editorItem?.capabilities.create.attachments.enabled)??!1}get shouldAllowAttachmentEditing(){return this.shouldShowAttachments}get sketchViewModel(){return this._sketchViewModel}get test(){}get availableCreateTools(){const e=this.data.creationInfo?.layer.geometryType,t=this.data.viewModel.view;if(!e)return[];if(this.data.creationInfo?.maxFeatures&&this.data.creationInfo.maxFeatures<=this.numPendingFeatures)return[];if(v(this.data.fullTemplate)){const{tool:t}=j(e,this.data.fullTemplate);return[t]}return"2d"!==t?.type&&"multipoint"===e?[]:[...le[e]]}get _attachmentsActive(){const e=this.data.viewModel.attachmentsViewModel.mode,t=this.stepId;return this.shouldShowAttachments&&("add"===e||"edit"===e||"adding-attachment"===t||"editing-attachment"===t)}async enter(){this._isActive=!0,"awaiting-feature-creation-info"!==this.stepId&&await this._updatingHandles.addPromise(this._setUpCreatingFeaturesStep())}exit(){this._isActive=!1,this.removeHandles([oe])}async updatePendingFeature(e){if(e!==this.data.selectedPendingFeature)return this._sketchViewModel.cancel(),this._startUpdating({feature:e})}async start(){return await super.start(),M(this.data.creationInfo?.layer)?null:{enter:async()=>{},exit:async()=>{},viewModel:this._sketchViewModel}}async save(){const{featureFormViewModel:e}=this;if(e.pendingSubtypeChoice)return;e.submit(),this._stashValidationState();const t=this.data.selectedPendingFeature,a=this._hasValidationErrors(t)?t:this.data.pendingFeatures.find((e=>this._hasValidationErrors(e)));return a?(await this._startUpdating({feature:a}),void e?.submit()):super.save()}back(e){return"update-pending"!==this.createFeatureState||!this.data.selectedPendingFeature||E(this.data.creationInfo)||this._attachmentsActive||this.parent?super.back(e):this._clearSelectedFeature()}previous(e){return"update-pending"!==this.createFeatureState||!this.data.selectedPendingFeature||E(this.data.creationInfo)||this._attachmentsActive?super.previous(e):this._clearSelectedFeature()}cancelFeature(e){this.data.isSharedTemplateWorkflow?o.getLogger(this).warn("Cannot cancel individual features created by shared templates."):(this.data.removePendingFeature(e),this.sketchViewModel.layer.graphics.remove(e))}static create(e){const{addAttachmentsCallback:t,applyEditsCallback:a,applyEditsFeatureServiceCallback:i,isNested:r,creationInfo:s,parent:o,snappingManager:n,startAt:l,viewModel:d}=e,c=e.sketchOptions??new S,u=s?.layer,h=u?d.findEditorItemForLayer(u):void 0,p=new ie({data:new P({creationInfo:s,editorItem:h,parent:o,sketchOptions:c,snappingManager:n,viewModel:d}),isNested:r,onCommit:async e=>{const{creationInfo:r}=e;if(!r)return;p._sketchViewModel.cancel();const s=e.pendingFeatures.toArray(),{layer:o}=r,n=o.capabilities?.editing.supportsGlobalId&&"globalIdField"in o,l=p._attachmentFileInfos,{fullTemplate:c}=e,u=U(p.data),h=F(c)&&u;if(n){if(pe(s),h){let t=fe(u,l);const a=await L(o,d.view);a&&(t=x({edits:t,serviceInfo:a,view:d.view,findOriginalFeature:t=>e.getEditsForPendingFeature(t)?.initialFeature??t})),await i(c.featureService,t,{globalIdUsed:!0,gdbVersion:c.layer.gdbVersion??void 0})}else{const e=me(s,l);await a(o,e,{globalIdUsed:!0})}return}const m=h?await i(c.featureService,u,{gdbVersion:c.layer.gdbVersion??void 0}):[await a(o,{addFeatures:s})];m&&l.size>0&&await Promise.all(m.map((e=>{if(e?.addFeatureResults)return t(o,he(s,e.addFeatureResults,o,l))})))}});return p._set("steps",this._createWorkflowSteps(p,l)),p}_fadeExistingFeatures(e){if("effect"in e){const t=e.effect;return e.effect="saturate(0.6) opacity(0.8)",i((()=>e.effect=t))}const t=e.opacity;return e.opacity=.7,i((()=>e.opacity=t))}async _initializeFullTemplateAndExecutorInfo(e){const{creationInfo:t}=e,{view:a}=e.viewModel;if(!t||!a)return null;const i=await O(t,a);if(e.fullTemplate=i,i&&F(i)){const{createTemplateExecutor:r}=await import("../../editing/sharedTemplates/executor/createTemplateExecutor.js"),s={completionResults:[],executor:await r(i),serviceLayersById:await W(t.layer,a)};e.templateExecutorInfo=s}return i}async _startCreating(){this.removeHandles(se);const{data:e}=this;if(!e.creationInfo)return;const t=this.data.creationInfo?.maxFeatures;if(t&&this.numPendingFeatures>=t)return this.sketchViewModel.cancel(),void(this.numPendingFeatures&&await this._startUpdating({feature:this.pendingFeatures.at(-1)}));this.createFeatureState="create-new",await D(this._sketchViewModel,e,this._webStyleCache)}async _clearSelectedFeature(){const e=this._featureFormViewModel.pendingSubtypeChoice;e&&(e.resolve("undo"),await e.promise),this._stashValidationState(),this.sketchViewModel.cancel(),this.data.selectedPendingFeature=null,this._featureFormHandle=n(this._featureFormHandle),this._featureFormViewModel.feature=null;const t=this.data.viewModel.attachmentsViewModel;"add"!==t.mode&&"edit"!==t.mode||this.data.viewModel.activeWorkflow?.previous()}_stashValidationState(){const e=this._featureFormViewModel.feature,t=e&&this.data.getEditsForPendingFeature(e);t&&(t.submittable=this._featureFormViewModel.submittable)}async _selectFeatureForUpdate({feature:e,initialFeature:t=e}){this._stashValidationState();const{data:a,pendingFeatures:i,_webStyleCache:s}=this;i.includes(e)||a.addPendingFeature(e,t),a.selectedPendingFeature=e;const{_featureFormViewModel:o,_sketchViewModel:l}=this,{creationInfo:d,viewModel:c}=a,{attachmentsViewModel:h,layerInfos:p,view:m}=c;if(!m||!d)return;n(this._featureFormHandle);const f=e.sourceLayer,w=R(p,f),g=w?.formTemplate,y=m.spatialReference;o.set({editType:"INSERT",feature:e,formTemplate:g,spatialReference:y,map:m.map}),"add"!==h.mode&&"edit"!==h.mode||c.activeWorkflow?.previous(),h.graphic=e,h.fileInfos.removeAll(),h.mode="view";(this._attachmentFileInfos.get(e)||[]).forEach((({file:e,form:t})=>h.addFile(e,t))),await z(e,s,"2d"===m.type?m.scale:null);const v=a.getEditsForPendingFeature(e);this._featureFormHandle=r([o.on("value-change",(async()=>{v?.updateAttributes(o.getValues()),await z(e,s,"2d"===m.type?m.scale:null)})),l.on(["update","undo","redo"],(e=>{("undo"===e.type||"redo"===e.type||"update"===e.type&&null!=e.toolEventInfo&&G(e.toolEventInfo.type))&&o.notifyFeatureGeometryChanged()})),u((()=>o.feature?.sourceLayer),(t=>e.sourceLayer=t)),u((()=>[o.feature,o.submittable]),(()=>this._stashValidationState()))]),this.createFeatureState="update-pending"}async _startUpdating({feature:e,initialFeature:t=e}){await this._selectFeatureForUpdate({feature:e,initialFeature:t});const{_sketchViewModel:a,data:i}=this,{creationInfo:r,viewModel:s}=i,{view:o}=s;if(!o||!r)return;const n=e.sourceLayer??r.layer;return M(n)?void 0:(this._visualVariableAttributes=N(e),K({graphic:e,sketchViewModel:a,sourceLayer:n,visualVariables:this._visualVariableAttributes,webStyleCache:this._webStyleCache}))}static _createWorkflowSteps(e,t="awaiting-feature-creation-info"){const{data:a}=e,i=Z(["awaiting-feature-creation-info","creating-features","adding-attachment","editing-attachment"],t,{"awaiting-feature-creation-info":()=>({id:"awaiting-feature-creation-info",async setUp(){const{creationInfo:t,viewModel:i}=a,{view:r}=i;r&&(E(t)?e.addHandles(await T({view:r,data:a,next:()=>e.next(),cancel:()=>i.cancelWorkflow({warnIfNoWorkflow:!1})}),this.id):(a.parent&&t&&e.addHandles(i.restrictFeatureTemplatesViewModelToLayer(t.layer),this.id),e.addHandles(i.featureTemplatesViewModel.on("select",(({item:t})=>{t&&(a.creationInfo={...a.creationInfo,layer:t.layer,template:t.template},e.next())})),this.id)))},async tearDown(){e.removeHandles(this.id)}}),"creating-features":()=>({id:"creating-features",async setUp(){e._isActive&&await e._setUpCreatingFeaturesStep()},async tearDown(t){const{viewModel:i}=a;t.canceled&&(e.removeHandles([oe,re,se,ne]),i.attachmentsViewModel.fileInfos.removeAll(),e._attachmentFileInfos.clear())}}),"adding-attachment":()=>({id:"adding-attachment",parent:"creating-features",async setUp(){},async tearDown(){const{attachmentsViewModel:t}=a.viewModel,{graphic:i,fileInfos:r}=t;e._attachmentFileInfos.set(i,r.toArray()),t.mode="view"}}),"editing-attachment":()=>({id:"editing-attachment",parent:"creating-features",async setUp(){},async tearDown(){const{attachmentsViewModel:t}=a.viewModel,{graphic:i,fileInfos:r}=t;e._attachmentFileInfos.set(i,r.toArray()),t.mode="view"}})});return q(a,i)}static _configureSketchViewModel(e){const{data:t}=e,a=e._webStyleCache,{creationInfo:s,viewModel:o}=t,{view:n}=o,l=e._sketchViewModel,d=[];if(!n)return i();if("2d"===n.type){s&&d.push(e._fadeExistingFeatures(s.layer));const t=c(((e,t)=>Promise.all(e.map((e=>z(e,a,t))))));d.push(u((()=>n.scale),(e=>t(l.layer.graphics,e))))}const p=B(t.fullTemplate,s?.attributeOverrides),m=u((()=>l.createGraphic),(i=>{i&&!e.hasHandles(se)&&e._updatingHandles.addPromise(Y({creationAttributes:p,data:t,sketchViewModel:l,view:n,webStyleCache:a}).then((t=>e.addHandles(t,se))))})),f=async t=>{if("cancel"!==t.state&&"complete"!==t.state||e.removeHandles(se),"cancel"===t.state&&null!==n.activeTool&&n.activeTool!==e.sketchViewModel.activeComponent&&(await e._waitForActiveToolCleared(),await e._startCreating()),"complete"===t.state&&t.graphic){const a=await e._processEdits(t.graphic,{scale:"2d"===n.type?n.scale:null,useSourceLayer:!0,webStyleCache:e._webStyleCache});a&&(await e._waitForActiveToolCleared(),await e._startUpdating({feature:a}))}},w=async a=>{const{attachmentsViewModel:i}=o,{_featureFormViewModel:r}=e;if(a.graphics.length>1)return void await e._clearSelectedFeature();const d=a.graphics[0];if("complete"===a.state){const{submittable:t}=r;if(e.numPendingFeatures!==s?.maxFeatures&&t||r.submit(),await e._clearSelectedFeature(),"add"!==i.mode&&"edit"!==i.mode||o.activeWorkflow?.previous(),!a.aborted&&n.activeTool===e.sketchViewModel.activeComponent&&(await e.sketchViewModel.wait(),"ready"===e.sketchViewModel.state&&"mesh"!==e.data.creationInfo?.layer.geometryType))return e._startCreating()}else{if("start"===a.state)return d.sourceLayer??=t.creationInfo?.layer,await $({sketchViewModel:l,graphic:d,visualVariables:e._visualVariableAttributes,webStyleCache:e._webStyleCache,sourceLayer:d.sourceLayer}),e._selectFeatureForUpdate({feature:d});if("active"===a.state){await e.updatePendingFeature(d);const t=e._visualVariableAttributes;ee(n,d,a,t)&&await z(d,e._webStyleCache,"2d"===n.type?n.scale:null);const i=d.attributes,{rotation:s,size:o}=t;if(null!=s){const{field:e}=s;r.setValue(e,i[e])}if(null!=o){const{field:e}=o;r.setValue(e,i[e])}}}},g=async a=>{if(a.graphics.forEach((e=>{t.removePendingFeature(e)})),!E(t.creationInfo))return e._startCreating()},y=async()=>{if(E(t.creationInfo))try{await e.data.viewModel.back()}catch{}return e._startCreating()};d.push(m,l.on("create",(t=>e._updatingHandles.addPromise(f(t)))),l.on("update",(t=>e._updatingHandles.addPromise(w(t)))),l.on("delete",(t=>e._updatingHandles.addPromise(g(t)))),h((()=>!e.numPendingFeatures),(()=>e._updatingHandles.addPromise(y()))),i((()=>{l.cancel()})),ce(l,t),...ue(t));const v=r(d);return l.addHandles(v),v}_initializeSketchViewModel(){const{data:e}=this,{view:t}=e.viewModel,a=new b({elevationInfo:e.creationInfo?.layer.elevationInfo,internal:!0,listMode:"hide",title:"createFeaturesWorkflow-internal"}),r=new ae({layer:a,creationMode:"single",sketchOptions:e.sketchOptions,snappingManager:e.snappingManager,updateOnGraphicClick:!1,defaultUpdateOptions:{multipleSelectionEnabled:!1},view:t});this._sketchViewModel=r,t?.map.add(a),this.addHandles([i((()=>{t?.destroyed||t?.map.remove(a),a.destroy()})),u((()=>this.numPendingFeatures>0),(e=>this._sketchViewModel.updateOnGraphicClick=e),p)])}_hasValidationErrors(e){return!!e&&(!this.data.isSubmittable(e)||!!this._featureFormViewModel.validateContingencyConstraints(e.attributes,{includeIncompleteViolations:!0})?.length)}async _processEdits(e,t){const{data:a,_featureFormViewModel:i}=this,{layerInfos:r,view:s}=a.viewModel;i.editType="INSERT",i.map=s?.map,i.spatialReference=s?.spatialReference;const{templateExecutorInfo:o}=a;if(!o){const t=e.clone();return t.geometry=null,await this._addAndInitializeEdits(e,t),e}const n=this.sketchViewModel.layer;n.remove(e);const{executor:l}=o,c=l(e.geometry,"completion"),u=d(c)?await c:c;o.completionResults.push(u),J(u.relationships),i.editType="INSERT",i.map=s?.map,i.spatialReference=s?.spatialReference,u.primary&&a.creationInfo?.attributeOverrides&&(u.primary.graphic.attributes={...u.primary.graphic.attributes,...a.creationInfo.attributeOverrides});for(const d of u.edits){let e=null;if(d.addFeatures)for(const a of d.addFeatures){const i=a.clone();i.geometry=null,null!=a.geometry&&(a.symbol=await I(a,t),n.add(a)),a.sourceLayer!==e?.layer&&(e=R(r,a.sourceLayer));const s=!!u.associationGraphics?.has(a);await this._addAndInitializeEdits(a,i,e,s)}}i.feature=null,await m((()=>!i.updating));return u.edits.reduce(((e,t)=>e+(t.addFeatures?.length??0)),0)>1?null:u.primary?.graphic}async _addAndInitializeEdits(e,t,a,i=!1){const{data:r,_featureFormViewModel:s}=this,{layerInfos:o}=r.viewModel,n=r.addPendingFeature(e,t,{isAssociation:i});a??=R(o,e.sourceLayer),s.feature=e,s.formTemplate=a?.formTemplate,await m((()=>!s.updating)),n.submittable=s.submittable}async _setUpCreatingFeaturesStep(){if(this.hasHandles(oe))return;const{data:e,sketchViewModel:s}=this,{creationInfo:o,viewModel:l}=e,{attachmentsViewModel:d,view:c}=l;if(!c||!o?.layer)throw new a("missing-parameters","CreateFeaturesWorkflow requires a view and creationInfo.");const{initialFeature:h,layer:m}=o,f=[],w=[];this._featureFormHandle=n(this._featureFormHandle),this._visualVariableAttributes={rotation:null,size:null},e.editorItem=l.findEditorItemForLayer(o.layer),o.template&&(null==e.fullTemplate&&await this._initializeFullTemplateAndExecutorInfo(e),w.push(i((()=>{e.templateExecutorInfo&&(e.templateExecutorInfo.completionResults=[])})))),s.allowDeleteKey=!e.isSharedTemplateWorkflow,Q(d),f.push(u((()=>d.mode),(e=>{switch(e){case"add":this.go("adding-attachment");break;case"edit":this.go("editing-attachment")}})));const g=X(c);f.push(g);const y=M(o.layer),{template:F}=o,b=!F||_(F)||v(F)&&"feature"===F.type,I=y&&b;try{if(I){const a=h??new t({attributes:B(e.fullTemplate,o.attributeOverrides),sourceLayer:m}),i=await this._processEdits(a);i&&await this._startUpdating({feature:i})}else f.push(ie._configureSketchViewModel(this)),h?(E(o)&&o.geometryToPlace&&(h.attributes=B(e.fullTemplate,o.attributeOverrides)),s.layer.add(h),await this._startUpdating({feature:h})):await this._startCreating()}finally{g.remove()}const V=i((()=>{for(const t of e.pendingFeatures)s.layer.remove(t),e.removePendingFeature(t)})),k=u((()=>c?.timeZone),(e=>{this._featureFormViewModel.timeZone=e,this.data.timeZone=e}),p),S=i((()=>{E(o)&&l.cancelWorkflow({warnIfNoWorkflow:!1})}));this._featureFormHandle&&f.push(this._featureFormHandle),this.addHandles(f,this._handleKeys.beforeCommit),this.addHandles(w,this._handleKeys.afterCommit),this.addHandles([i((()=>d.fileInfos.removeAll())),r(f),r(w),S,V,k],oe)}async _waitForActiveToolCleared(){const e=this.data.viewModel.view;if(null==e?.activeTool)return;const t=new AbortController;this.addHandles(s(t),ne),await m((()=>null==e?.activeTool),t.signal),t.abort()}};function ce(e,t){let a=null;const s=()=>e.snappingOptions.featureSources,o=()=>(a=new C({layer:e.layer}),s().add(a),a),n=()=>{null!=a&&(s().remove(a),a=l(a))};return r([u((()=>{const e=t.creationInfo?.layer,a=s().find((t=>t.layer===e));return{hasFeatureLayerSource:!!a,enabled:a?.enabled??!1}}),(({hasFeatureLayerSource:e,enabled:t})=>{if(!e)return n();a??=o(),a.enabled=t}),f),i(n)])}function ue(e){const t=e.viewModel.view;if(!t)return[];const a=[];if("3d"===t.type){const r=new k({view:t});a.push(u((()=>e.selectedPendingFeature),((e,t)=>{r.remove(e),r.add(t)})),i((()=>r.destroy())))}const r=new k({view:t,highlightName:A});return a.push(u((()=>e.temporaryHighlightFeature),(e=>{r.removeAll(),r.add(e)})),i((()=>r.destroy()))),a}function he(e,t,a,i){const r=[];return t.forEach(((t,s)=>{if(!t.error){const o=e[s],n=i.get(o)||[];o.attributes[a.objectIdField]=t.objectId,n.forEach((({form:e})=>r.push({feature:o,attachment:e})))}})),r}function pe(e){for(const t of e){const{sourceLayer:e}=t;e&&"globalIdField"in e&&null!=e.globalIdField&&(t.attributes[e.globalIdField]??=w())}}function me(e,t){const a=[];if(!t||0===t.size)return{addFeatures:e};for(const[i,r]of t)for(const{file:e}of r)a.push({feature:i,attachment:{globalId:w(),data:e}});return a.length?{addFeatures:e,addAttachments:a}:{addFeatures:e}}function fe(e,t){return e.map((e=>{const{addFeatures:a}=e;if(!a||0===a.length)return e;const i=[];for(const r of a){const e=t.get(r);if(e)for(const{file:t}of e)i.push({feature:r,attachment:{globalId:w(),data:t}})}return i.length?{...e,addAttachments:i}:e}))}e([g()],de.prototype,"createFeatureState",void 0),e([g()],de.prototype,"data",void 0),e([g({constructOnly:!0})],de.prototype,"isNested",void 0),e([g()],de.prototype,"featureFormViewModel",null),e([g()],de.prototype,"hasPendingEdits",null),e([g()],de.prototype,"hasPreviousStep",null),e([g()],de.prototype,"_getDrawMeshHelpMessage",void 0),e([g()],de.prototype,"helpMessage",null),e([g()],de.prototype,"layer",null),e([g()],de.prototype,"parent",null),e([g()],de.prototype,"parentLayer",null),e([g()],de.prototype,"keyboardCancellationEnabled",null),e([g()],de.prototype,"reliesOnOwnerAdminPrivileges",null),e([g()],de.prototype,"shouldShowAttachments",null),e([g()],de.prototype,"shouldAllowAttachmentEditing",null),e([g()],de.prototype,"sketchViewModel",null),e([g()],de.prototype,"availableCreateTools",null),e([g()],de.prototype,"_attachmentsActive",null),de=ie=e([y("esri.widgets.Editor.CreateFeaturesWorkflow")],de);const we=de;export{we as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Error.js";import{makeHandle as i,abortHandle as r}from"../../core/handleUtils.js";import{isAborted as a}from"../../core/promiseUtils.js";import{watch as o}from"../../core/reactiveUtils.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as l}from"../../core/accessorSupport/decorators/subclass.js";import n from"../../views/draw/support/HighlightHelper.js";import{temporaryHighlightName as d}from"../../views/support/HighlightDefaults.js";import c from"./UpdateRecordWorkflowData.js";import u from"./Workflow.js";import{fetchFullFeatures as m}from"./workflowUtils.js";import h from"../FeatureForm/FeatureFormViewModel.js";var p;const f={exit:Symbol()};let g=class extends u{static{p=this}constructor(e){super(e),this._highlightHelper=null,this.fullFeature=null,this.type="update-table-record"}initialize(){const{data:e}=this,{edits:o}=e,{view:s}=e.viewModel,l=o.feature;s&&(this._highlightHelper=new n({view:s,highlightName:d}),this.addHandles(i((()=>this._highlightHelper?.removeAll()))));const c=new AbortController;this.addHandles(r(c)),this._updatingHandles.addPromise(m([l],l.sourceLayer,e.viewModel.view.spatialReference,c.signal).then((([e])=>{a(c)||(this._onFullFeatureLoaded(e),this._initializeFeatureFormViewModel())}),(e=>this.cancel({force:!0,error:new t("editor:failed-to-fetch-full-feature","Failed to retrieve all information for this feature. The update cannot proceed.",{detail:{error:e}})}))))}get editorItem(){return this.data.editorItem}get featureFormViewModel(){return this._featureFormViewModel}get hasPendingEdits(){return this.data.edits.modified}get layer(){return this.data.editorItem.layer}get parent(){return this.data.parent}get parentLayer(){return this.parent?.data.editorItem.layer}get shouldShowAttachments(){return this.editorItem.capabilities.attachments.enabled}get shouldAllowAttachmentEditing(){return this.editorItem.capabilities.update.attachments.enabled}get reliesOnOwnerAdminPrivileges(){const e=this.editorItem.capabilities;return e.update.reliesOnOwnerAdminPrivileges||e.delete.reliesOnOwnerAdminPrivileges}async deleteAndCommit(){return this.data.edits.stageDelete(),this.commit()}async enter(){this._configureAttachmentsViewModel()}exit(e){this.removeHandles(f.exit)}async start(){return await super.start(),null}_configureAttachmentsViewModel(){const{data:e,fullFeature:t}=this,{attachmentsCapabilities:r,viewModel:a}=e,{attachmentsViewModel:s}=a;s.set({capabilities:r,graphic:t,filesEnabled:!1,mode:"view"}),this.addHandles([i((()=>s.fileInfos.removeAll())),o((()=>s.mode),(e=>{switch(e){case"add":this.go("adding-attachment");break;case"edit":this.go("editing-attachment")}}))],f.exit)}_initializeFeatureFormViewModel(){const{association:e,edits:t,formTemplate:i,viewModel:{view:r}}=this.data,a=this._featureFormViewModel=new h({activeAssociation:e,
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Error.js";import{makeHandle as i,abortHandle as r}from"../../core/handleUtils.js";import{isAborted as a}from"../../core/promiseUtils.js";import{watch as o}from"../../core/reactiveUtils.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as l}from"../../core/accessorSupport/decorators/subclass.js";import n from"../../views/draw/support/HighlightHelper.js";import{temporaryHighlightName as d}from"../../views/support/HighlightDefaults.js";import c from"./UpdateRecordWorkflowData.js";import u from"./Workflow.js";import{fetchFullFeatures as m}from"./workflowUtils.js";import h from"../FeatureForm/FeatureFormViewModel.js";var p;const f={exit:Symbol()};let g=class extends u{static{p=this}constructor(e){super(e),this._highlightHelper=null,this.fullFeature=null,this.type="update-table-record"}initialize(){const{data:e}=this,{edits:o}=e,{view:s}=e.viewModel,l=o.feature;s&&(this._highlightHelper=new n({view:s,highlightName:d}),this.addHandles(i((()=>this._highlightHelper?.removeAll()))));const c=new AbortController;this.addHandles(r(c)),this._updatingHandles.addPromise(m([l],l.sourceLayer,e.viewModel.view.spatialReference,c.signal).then((([e])=>{a(c)||(this._onFullFeatureLoaded(e),this._initializeFeatureFormViewModel())}),(e=>this.cancel({force:!0,error:new t("editor:failed-to-fetch-full-feature","Failed to retrieve all information for this feature. The update cannot proceed.",{detail:{error:e}})}))))}get editorItem(){return this.data.editorItem}get featureFormViewModel(){return this._featureFormViewModel}get hasPendingEdits(){return this.data.edits.modified}get layer(){return this.data.editorItem.layer}get parent(){return this.data.parent}get parentLayer(){return this.parent?.data.editorItem.layer}get shouldShowAttachments(){return this.editorItem.capabilities.attachments.enabled}get shouldAllowAttachmentEditing(){return this.editorItem.capabilities.update.attachments.enabled}get reliesOnOwnerAdminPrivileges(){const e=this.editorItem.capabilities;return e.update.reliesOnOwnerAdminPrivileges||e.delete.reliesOnOwnerAdminPrivileges}async deleteAndCommit(){return this.data.edits.stageDelete(),this.commit()}async enter(){this._configureAttachmentsViewModel()}exit(e){this.removeHandles(f.exit)}async start(){return await super.start(),null}_configureAttachmentsViewModel(){const{data:e,fullFeature:t}=this,{attachmentsCapabilities:r,viewModel:a}=e,{attachmentsViewModel:s}=a;s.set({capabilities:r,graphic:t,filesEnabled:!1,mode:"view"}),this.addHandles([i((()=>s.fileInfos.removeAll())),o((()=>s.mode),(e=>{switch(e){case"add":this.go("adding-attachment");break;case"edit":this.go("editing-attachment")}}))],f.exit)}_initializeFeatureFormViewModel(){const{association:e,edits:t,formTemplate:i,viewModel:{view:r}}=this.data,a=this._featureFormViewModel=new h({activeAssociation:e,editType:"UPDATE",feature:this.fullFeature,formTemplate:i,highlightHelper:this._highlightHelper,map:r?.map,spatialReference:r.spatialReference,timeZone:r?.timeZone});a.callbacks={...this.data.featureFormCallbacks,showAllRelatedRecords:e=>a.relationshipId=e.relationshipId,viewAssociatedLayers:e=>a.associationId=e.associationId,viewAssociatedFeatures:e=>a.associatedLayer=e.associatedLayer};const{initialFeature:s}=t;s&&a.overrideInitialFeature(s),this.addHandles([a.on("value-change",(()=>{t.updateAttributes(a.getValues()),this.fullFeature.attributes=t.feature.attributes})),o((()=>r?.timeZone),(e=>a.timeZone=e))])}_onFullFeatureLoaded(e){this.fullFeature=e;const{edits:t}=this.data;t.updateAttributes(e.attributes),t.trackChanges()}static async create(e){const t=new p({data:await c.create(e),onCommit:this._onCommitFactory(e.applyEdits)});return t._set("steps",this._createWorkflowSteps(t)),t}static _createWorkflowSteps(e){const{attachmentsViewModel:t}=e.data.viewModel;return[{id:"editing-attributes",async setUp(){},async tearDown(){}},{id:"adding-attachment",async setUp(){},async tearDown(){t.mode="view"}},{id:"editing-attachment",async setUp(){},async tearDown(){t.mode="view"}}]}static{this._onCommitFactory=e=>async t=>{const{edits:i}=t,{feature:r}=i;if(!r)return;const a=r.sourceLayer,o=r.clone();if(!i.attributesModified||i.stagedForDelete){const e=a.objectIdField;if(o.attributes={[e]:r.getAttribute(e)},"scene"===a.type&&null!=a.infoFor3D){const e=a.associatedLayer?.globalIdField;null!=e&&o.setAttribute(e,r.getAttribute(e))}}i.geometryModified&&!i.stagedForDelete||(o.geometry=null);const s=i.stagedForDelete?"deleteFeatures":"updateFeatures";await e(a,{[s]:[o]})}}};e([s()],g.prototype,"_featureFormViewModel",void 0),e([s()],g.prototype,"editorItem",null),e([s()],g.prototype,"featureFormViewModel",null),e([s()],g.prototype,"fullFeature",void 0),e([s()],g.prototype,"hasPendingEdits",null),e([s()],g.prototype,"layer",null),e([s()],g.prototype,"parent",null),e([s()],g.prototype,"parentLayer",null),e([s()],g.prototype,"shouldShowAttachments",null),e([s()],g.prototype,"shouldAllowAttachmentEditing",null),e([s()],g.prototype,"reliesOnOwnerAdminPrivileges",null),g=p=e([l("esri.widgets.Editor.UpdateRecordWorkflow")],g);export{g as UpdateRecordWorkflow,f as handleKeys};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../chunks/tslib.es6.js";import{property as e}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";import{getEffectiveLayerCapabilities as s}from"../../layers/support/layerUtils.js";import o from"./InputBase.js";import{capabilitiesAllowEditType as i}from"../support/forms/formUtils.js";let l=class extends o{constructor(t){super(t),this.
|
|
5
|
+
import{_ as t}from"../../chunks/tslib.es6.js";import{property as e}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";import{getEffectiveLayerCapabilities as s}from"../../layers/support/layerUtils.js";import o from"./InputBase.js";import{capabilitiesAllowEditType as i}from"../support/forms/formUtils.js";let l=class extends o{constructor(t){super(t),this.editType="NA",this.editableExpressionExecutor=null}get editable(){return!!this.layerAllowsEdits&&(this.evaluatedEditableExpression??!0)}get evaluatedEditableExpression(){const{editableExpressionExecutor:t}=this;return null!=t?!!t.lastEvaluatedValue:null}get layerAllowsEdits(){const{layer:t}=this;if(!t)return!1;const e=s(t),r=e?.operations.supportsEditing,o=i(e,this.editType);return!(!r||!o)}};t([e()],l.prototype,"editType",void 0),t([e()],l.prototype,"editable",null),t([e()],l.prototype,"editableExpressionExecutor",void 0),t([e()],l.prototype,"evaluatedEditableExpression",null),t([e()],l.prototype,"layerAllowsEdits",null),l=t([r("esri.widgets.FeatureForm.EditableInput")],l);const p=l;export{p as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import{neverReached as n}from"../../core/compilerUtils.js";import s from"../../core/Evented.js";import i from"../../core/Logger.js";import{destroyMaybe as o}from"../../core/maybe.js";import r from"../../core/Promise.js";import{debounce as a}from"../../core/promiseUtils.js";import{watch as l,whenOnce as u,on as p,syncAndInitial as c}from"../../core/reactiveUtils.js";import{templateHasKey as h}from"../../core/string.js";import{property as d}from"../../core/accessorSupport/decorators/property.js";import"../../core/RandomLCG.js";import{subclass as f}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as m}from"../../core/support/UpdatingHandles.js";import y from"../../form/FormTemplate.js";import{isUtilityNetworkAssociationsElement as g,isGroupElement as _,isFieldElement as v,isRelationshipElement as I,isTextElement as E}from"../../form/support/formUtils.js";import x from"../../layers/support/ContingentValue.js";import{isEditableLayer as C}from"../../layers/support/editableLayers.js";import F from"../../layers/support/LayerContingentValuesCache.js";import{utc as b,unknown as V,system as w}from"../../time/constants.js";import{flattenAssociationInputs as A,flattenFieldInputs as j,isGroupInput as T,flattenRelationshipInputs as M,parseFormTemplateString as k,isRelationshipInput as N,isFieldInput as S,isTextElementInput as L,getNormalizedFeatureTypeInfo as R,valueIsValidContingentValue as U}from"./featureFormUtils.js";import Z from"./FieldInput.js";import{FormExpressionsManager as H}from"./FormExpressionsManager.js";import P from"./GroupInput.js";import O from"./RelationshipInput.js";import W from"./TextElementInput.js";import{createFormExpressionArcadeExecutor as G}from"../support/forms/expressions/FormExpressionArcadeExecutor.js";const $=new t({attributes:{}}),D={field:["editableExpression","requiredExpression","valueExpression","visibilityExpression"],group:["visibilityExpression"],relationship:["editableExpression","visibilityExpression"],text:["visibilityExpression"],utilityNetworkAssociations:["editableExpression","visibilityExpression"]},z="#JSAPI_CONTINGENT_VALUE_EMPTY_HASH",J="#JSAPI_CONTINGENT_VALUE_ANY_HASH",B="#JSAPI_CONTINGENT_VALUE_NULL_HASH";let K=class extends(r.EsriPromiseMixin(s.EventedAccessor)){constructor(e){super(e),this._expressionExecutorsInUse=new Set,this._expressionExecutorLookup=new Map,this._expressionsManager=null,this._contingentValuesCache=null,this._featureClone=$.clone(),this._initialFeature=$.clone(),this._timeZone=null,this._updatingHandles=new m,this.activeAssociation=null,this.arcadeEditType="NA",this.contingencyConstraintViolations=new Map,this.disabled=!1,this.highlightHelper=null,this.inputs=[],this.map=null,this.callbacks=null,this.strict=!1,this.pendingSubtypeChoice=null,this._updateInputs=a((async()=>{this._stopExpressions();const{_featureClone:e,_initialFeature:t,arcadeEditType:n,formTemplate:s,inputs:i,layer:o,timeZone:r}=this;if(!o)return;const a={arcadeEditType:n,feature:e,initialFeature:t,layer:o,timeZone:r},l=i.slice(),u=s?.elements&&s.elements.length>0?await this._updateInputsUsingFormElements(l,s.elements,a):this._updateInputsUsingLayerFields(l,o?.fields,a);this.inputs=u,await this._startExpressions()}))}initialize(){const e=l((()=>[this.layer,!!this.layer?.loaded,this.formTemplate,this.feature,this.timeZone,this.arcadeEditType]),(([e,t])=>{null!=e&&(t?this._updatingHandles.addPromise(this._updateInputs()):e.load().catch((()=>{})))}),c),t=l((()=>this._arcadeContextInfo),(e=>{null!=this._expressionsManager&&(this._expressionsManager.arcadeContextInfo=e,this._evaluateExpressions((e=>e.evaluateAll())))})),n=l((()=>this.layer),(e=>{const t="subtype-sublayer"===e?.type?e.parent:"feature"===e?.type?e:null;t&&this.addResolvingPromise(F.createLoadedLayerContingentValuesCache(t).then((e=>{this._contingentValuesCache=e,this.notifyChange("fieldsWithContingentValues")})))}),{initial:!0});this.addHandles([e,t,n])}destroy(){this.feature=null,this.layer=null,this._contingentValuesCache=o(this._contingentValuesCache),this.highlightHelper?.removeAll(),this._updatingHandles.destroy()}get _expressionInfosLookup(){return new Map(this.formTemplate?.expressionInfos?.map((e=>[e.name,e])))}get activeAssociationInput(){return this.allAssociationInputs.find((e=>e.uid===this.associationId))}get activeRelationshipInput(){return this.allRelationshipInputs.find((e=>e.relationshipId===this.relationshipId||e.activeCategory||e.showAllEnabled))}get _arcadeContextInfo(){const{_initialFeature:e,arcadeEditType:t,layer:n,map:s,spatialReference:i,timeZone:o}=this;return{layer:C(n)?n:null,originalFeature:e,editType:t,map:s,spatialReference:i,timeZone:o}}get associationId(){return this._get("associationId")}set associationId(e){null==e&&this.activeAssociationInput?.viewModel&&(this.activeAssociationInput.associatedLayer=null,this.activeAssociationInput.viewModel.activeAssociationType=null),this._set("associationId",e)}get associatedLayer(){return this.activeAssociationInput?.associatedLayer}set associatedLayer(e){this.activeAssociationInput&&(this.activeAssociationInput.associatedLayer=e)}get allAssociationInputs(){return A(this.inputs)}get allFieldInputs(){return j(this.inputs)}get allGroupInputs(){return this.inputs.filter(T)}get allRelationshipInputs(){return M(this.inputs)}get _layerFieldsByName(){return new Map(this.layer?.fields.map((e=>[e.name,e])))}get feature(){return this._get("feature")}set feature(e){const t=this._get("feature");this._featureClone=e?e.clone():$.clone(),this._initialFeature=this._featureClone.clone(),this._expressionsManager&&(this._expressionsManager.feature=this._featureClone),e?(this._resetFieldInputValues(this._featureClone),this.allRelationshipInputs.forEach((t=>t.feature=e))):(this.inputs.forEach((e=>e.destroy())),this.inputs.length=0),t!==e&&(this.pendingSubtypeChoice=null),this.contingencyConstraintViolations.clear(),this._set("feature",e)}get fieldsWithContingentValues(){if(null==this._contingentValuesCache)return new Set;const e=this._contingentValuesCache.fieldGroups.flatMap((e=>e.fields));return new Set(e)}get formTemplate(){return this.layer&&"formTemplate"in this.layer?this.layer.formTemplate:null}set formTemplate(e){void 0===e?this._clearOverride("formTemplate"):this._override("formTemplate",e)}get formDescription(){const{formTemplate:e,layer:t}=this;return e?.description&&t?k({label:e.description,attributes:this.getValues(),fieldsIndex:t.fieldsIndex,timeZone:this.timeZone}):null}get formTitle(){const{formTemplate:e,layer:t}=this;return e?.title&&t?k({label:e.title,attributes:this.getValues(),fieldsIndex:t.fieldsIndex,timeZone:this.timeZone}):null}get formHeaderVisible(){const{activeRelationshipInput:e,activeAssociationInput:t,formDescription:n,formTitle:s}=this;return!(e||t||!n&&!s)}get joinedContingentValues(){return this._joinContingentValues()}get layer(){return this.feature?.sourceLayer&&"applyEdits"in this.feature.sourceLayer?this.feature.sourceLayer:null}set layer(e){this._override("layer",e)}get relationshipId(){return this._get("relationshipId")}set relationshipId(e){const t=this.allRelationshipInputs;if(null!=e&&e===this.relationshipId||t.forEach((e=>{e.showAllEnabled=!1,e.activeCategory=null})),null!=e){const n=t.find((t=>t.relationshipId===e));n&&(n.showAllEnabled=!0)}this._set("relationshipId",e)}get spatialReference(){return this.layer?.spatialReference??null}set spatialReference(e){this._override("spatialReference",e)}get state(){return this.layer?.loaded?"ready":"disabled"}get submittable(){return!!this.valid||this.allFieldInputs.filter((e=>!e.valid)).every((({submittable:e})=>e))}get timeZone(){const{layer:e}=this;if(e&&"datesInUnknownTimezone"in e&&e.datesInUnknownTimezone)return b;const t=e&&"preferredTimeZone"in e&&e.preferredTimeZone;return this._timeZone===V?t||b:this._timeZone||w}set timeZone(e){this._timeZone=e}get updating(){return this._updatingHandles.updating}get valid(){const e=this.allFieldInputs;return e.length>0&&e.every((({valid:e})=>e))}findField(e){return this.allFieldInputs.find((t=>t.name===e))}getFieldValueOptionsForField(e,t){const n=this.findField(e);if(!n)return[[],[],[]];const s="coded-value"===n.domain?.type?n.domain.codedValues.map((({name:e,code:t})=>({name:e,value:t}))):[],i=null==n.value||s.some((e=>e.value===n.value))?[]:[{name:`${n.value}`,value:n.value}],o=this.fieldsWithContingentValues.has(e)?this._getContingentValueOptionsForField(e,t):[];if(o.length>0){const e=new Set(o.map((e=>e.value)));return[o,s.filter((t=>!e.has(t.value))),i]}return[s,[],i]}getValue(e){const t=this.layer?.getField(e);if(null!=t)return this._featureClone.getAttribute(t.name)??null}setValue(e,t){const{_featureClone:n,strict:s}=this,i=this.findField(e);t=""===t?null:t,i&&n.getAttribute(e)!==t&&(i.value=t,s&&!i.valid||(this._afterValueChange(i),this._evaluateExpressions((t=>t.evaluateInvalidated([e])))))}getValues(){return{...this._featureClone.attributes}}overrideInitialFeature(e){this._initialFeature=e}submit(){const e=this.allFieldInputs,t=new Set(e.filter((e=>e.valid)).map((({name:e})=>e))),n=e.filter((e=>!e.valid)).map((({name:e})=>e)),s=this.getValues();if(this.validateContingencyConstraints(s,{includeIncompleteViolations:!0}).length>0)for(const[i,o]of this.contingencyConstraintViolations.entries())"error"===o.type&&(t.delete(i),n.push(i));this.notifyChange("submittable"),this.notifyChange("valid"),this.emit("submit",{valid:[...t],invalid:n,values:s})}validateContingencyConstraints(e,t){const{_contingentValuesCache:n}=this,s=new Map;if(this.contingencyConstraintViolations=s,null==n)return[];const{invalid:i,incomplete:o}=n.validateContingencyConstraints(e),r=[...i,...t?.includeIncompleteViolations?o:[]];for(const a of r)for(const e of a.fieldGroup.fields)s.set(e,a);return r}notifyFeatureGeometryChanged(){const{feature:e,_featureClone:t}=this;e&&(t.geometry=e.geometry,this._evaluateExpressions((e=>e.evaluateInvalidatedByGeometry())))}applySubtypeDefaults(e){const{defaultValues:t}=e,{allFieldInputs:n}=this;for(const{name:s}of n){const e=t[s];null!=e&&this.setValue(s,e)}}_emitChangeEvent({name:e,valid:t,value:n}){this.emit("value-change",{layer:this.layer,feature:this.feature,fieldName:e,value:n,valid:t})}async _evaluateExpressions(e){const t=this._expressionsManager;null!=t&&await this._updatingHandles.addPromise(e(t).finally((()=>this._afterExpressionsEvaluated())))}async _updateInputsUsingFormElements(e,t,n){const s=new Map;for(const r of e)if(T(r)){s.set(r.element,r);for(const e of r.inputs)e.element&&s.set(e.element,e)}else r.element&&s.set(r.element,r);const i=new Map,o=await this._updateInputsUsingFormElementsRecursive({existingInputsByElement:s,updatedElements:t.filter((e=>this._isSupportedElement(e))),sharedInitializationProperties:n,group:null,newExpressionExecutorPromises:i});for(const[r,a]of s.entries())s.delete(r),a.destroy();return await Promise.all(Array.from(i.values())),o}async _updateInputsUsingFormElementsRecursive(e){const{existingInputsByElement:t,updatedElements:n,sharedInitializationProperties:s,group:i,newExpressionExecutorPromises:o}=e,r=[];for(const a of n){const e=t.has(a),n=e?t.get(a):g(a)?await this._makeUtilityNetworkAssociationInputFromElement(a,s,i):this._makeInputFromElement(a,s,i);if(n){if(r.push(n),await u((()=>!n.updating)),this._assignExpressionExecutors(n,a,o),e)if(t.delete(a),T(n)){const{feature:e,timeZone:t}=s;n.set({feature:e,timeZone:t})}else if(N(n)){const e=this.relationshipId===a.relationshipId;n.set(s),n.set({map:this.map,showAllEnabled:e})}else g(n)?(n.set(s),n.set({map:this.map})):n.set(s);if(_(a)){const e=a.elements.filter((e=>this._isSupportedElement(e)));n.inputs=await this._updateInputsUsingFormElementsRecursive({existingInputsByElement:t,updatedElements:e,sharedInitializationProperties:s,group:n,newExpressionExecutorPromises:o})}}}return r}_updateInputsUsingLayerFields(e,t,n){if(!Array.isArray(t))return i.getLogger(this).warn(this.declaredClass,"No attribute fields found."),[];const s=new Map;for(const i of e)if(T(i)){for(const e of i.inputs)e.destroy();i.inputs.length=0,i.destroy()}else N(i)?i.destroy():S(i)&&(null!==i.element?i.destroy():s.set(i.field,i));const o=[];for(const i of t){const e=n.feature?.getAttribute(i.name)??null,t=s.get(i)??new Z({field:i,preservesValueWhenHidden:this.formTemplate?.preserveFieldValuesWhenHidden});o.push(t.set({...n,value:e})),s.delete(i)}for(const[i,r]of s.entries())s.delete(i),r.destroy();return o}_resetFieldInputValues(e){for(const t of this.allFieldInputs)t.value=e.getAttribute(t.name)}_makeInputFromElement(e,t,s){return _(e)?Y(e,t):v(e)?this._makeFieldInputFromElement(e,t,s):I(e)?this._makeRelationshipInputFromElement(e,t,s):g(e)?this._makeUtilityNetworkAssociationInputFromElement(e,t,s):E(e)?q(e,t):g(e)?this._makeUtilityNetworkAssociationInputFromElement(e,t,s):n()}_makeFieldInputFromElement(e,t,n){const{arcadeEditType:s,feature:i,initialFeature:o,layer:r,timeZone:a}=t,{fieldName:l}=e,u=l&&this._layerFieldsByName.get(l);return u?new Z({arcadeEditType:s,element:e,field:u,value:i?.getAttribute(e.fieldName)??null,feature:i,initialFeature:o,layer:r,group:n,preservesValueWhenHidden:this.formTemplate?.preserveFieldValuesWhenHidden,timeZone:a}):null}_makeRelationshipInputFromElement(e,t,n=null){const{map:s}=this,{feature:i,layer:o,timeZone:r}=t,a=new O({element:e,feature:i,group:n,layer:o,map:s,timeZone:r});return a.addHandles(p((()=>a.relatedLayer),"edits",(()=>this._evaluateExpressions((e=>e.evaluateAsyncExpressions()))))),a}async _makeUtilityNetworkAssociationInputFromElement(e,t,n=null){const{map:s}=this,{feature:i,layer:o,timeZone:r}=t;return new(0,(await import("./UtilityNetworkAssociationInput.js")).default)({element:e,feature:i,group:n,layer:o,map:s,timeZone:r})}_assignExpressionExecutors(e,t,n){const s=D[t.type],i=[];for(const o of s){const s=`${o}Executor`;if(e[s]){this._useExecutor(e[s]);continue}const r=t[o];if(null!=r&&""!==r){const t=this._expressionInfosLookup.get(r)?.expression??r;i.push(this._getOrCreateExecutorForExpression(t,n).then((t=>{e[s]=this._useExecutor(t)})))}}return L(e)&&i.push(...this._assignTextElementExpressionExecutors(e,n)),i}_assignTextElementExpressionExecutors(e,t){const{_expressionInfosLookup:n}=this,s=[];for(const o of e.expressionsUsed){const r=n.get(o);null!=r?s.push(this._getOrCreateExecutorForExpression(r.expression,t).then((t=>e.setExpressionExecutor(o,this._useExecutor(t))))):i.getLogger(this).error("feature-form:expression-not-found",`Could not find expressionInfo object with name '${o}'`)}for(const i of e.fieldsUsed){const n=`return $feature['${i}'];`;s.push(this._getOrCreateExecutorForExpression(n,t).then((t=>e.setFieldExecutor(i,this._useExecutor(t)))))}return s}async _getOrCreateExecutorForExpression(e,t){const{_expressionExecutorLookup:n}=this;if(n.has(e))return n.get(e);if(t.has(e))return t.get(e);const s=G(e,this.layer);t.set(e,s);const i=await s;return n.set(e,i),i}_createExpressionsManager(e){const{_arcadeContextInfo:t,_featureClone:n,allFieldInputs:s,formTemplate:i}=this;this._expressionsManager=new H({executors:e,feature:n,arcadeContextInfo:t,fieldInputs:s,preserveFieldValuesWhenHidden:!0===i?.preserveFieldValuesWhenHidden})}async _startExpressions(){if(0===this._expressionExecutorsInUse.size)return;const e=Array.from(this._expressionExecutorsInUse);this._createExpressionsManager(e),this._evaluateExpressions((e=>e.evaluateAll()))}_stopExpressions(){this._expressionsManager=o(this._expressionsManager),this._expressionExecutorsInUse.clear()}_useExecutor(e){return this._expressionExecutorsInUse.add(e),e}_afterValueChange(e){const{name:t,value:n}=e,{_featureClone:s,formTemplate:i,layer:o}=this;if(!o)return;const r=s.getAttribute(t);s.setAttribute(t,n);const{typeFieldName:a,types:l}=R(o);if((e.isSubtypeField||t===a)&&n!==r){if("subtype-sublayer"===o.type){const e=o.parent?.findSublayerForFeature(s);e&&(this.feature&&(this.feature.sourceLayer=e),s.sourceLayer=e)}const e=new Set;for(const t of l)if(t.domains&&"object"==typeof t.domains)for(const n of Object.keys(t.domains))e.add(n);for(const t of e){const e=this.findField(t);e&&e.notifyChange("domain")}this.notifyChange("joinedContingentValues")}if(null!=i){const{description:e,title:n}=i;n&&h(n,t)&&this.notifyChange("formTitle"),e&&h(e,t)&&this.notifyChange("formDescription")}this._emitChangeEvent(e)}_afterExpressionsEvaluated(){const{_featureClone:e}=this;for(const t of this.allFieldInputs)t.value!==e.getAttribute(t.name)&&this._afterValueChange(t)}_joinContingentValues(){const e=this._contingentValuesCache;if(null==e)return[];const{typeFieldName:t}=R(this.layer),n=t?this.getValue(t):null,s=[];for(const r of e.fieldGroups){const{contingencies:e,fields:t,name:i}=r,o=[];for(const s of e)s.isRetired||null!=s.subtype&&s.subtype.code!==n||o.push({values:s.values});o.length>0&&s.push({name:i,fields:t,contingencies:o})}const[i,o]=this._generateJoinPlan(s);return[...i.flatMap((e=>this._joinFieldGroupContingencies(e))),...o.flatMap((e=>e.contingencies))]}_generateJoinPlan(e){const t=new Map,n=[],s=new Set;for(const l of e)for(const e of l.fields)if(t.has(e)){const i=t.get(e),o=l,r=[i.name,o.name].sort().join("|");if(s.has(r))continue;n.push([i,o]),s.add(r),t.set(e,o)}else t.set(e,l);const i=new Set(n.flat()),o=new Set(e);for(const l of i)o.delete(l);const r=new Map,a=new Map;for(const l of new Set(n.flat())){const e=Symbol(l.name);r.set(e,new Set([l])),a.set(l,e)}for(const[l,u]of n){const e=a.get(l),t=a.get(u);if(e===t)continue;const n=r.get(e),s=r.get(t);for(const i of s)n.add(i),a.set(i,e);r.delete(t)}return[[...r.values()].map((e=>[...e])),[...o]]}_joinFieldGroupContingencies(e){const t=e.slice(),n=t.shift();let s=t.shift(),i=this._generateJoinKey(n.fields,s.fields),o=new Set([...n.fields,...s.fields]),r=new Map;for(const l of n.contingencies){const[e]=this._hashContingency(l,i.codedValueFields,!0);r.has(e)?r.get(e)?.push(l):r.set(e,[l])}for(;t.length>0;){const e=new Map,n=t.shift(),a=this._generateJoinKey(o,n.fields);for(const t of s.contingencies){const[n,s]=this._hashContingency(t,i.codedValueFields),o=s?this._findMatchingContingenciesWithAnyHashMask(r,n):r.get(n);if(r.has(J)&&o?.push(...this._findMatchingContingenciesContainingAny(t,r.get(J),i.codedValueFields)),null!=o)for(const r of o){const n=i.rangeFields.length>0?this._joinContingenciesWithRangeDomains(r,t,i.rangeFields):this._joinContingencies(r,t);if(null==n)break;const[s]=this._hashContingency(n,a.codedValueFields,!0);e.has(s)?e.get(s)?.push(n):e.set(s,[n])}}r=e,s=n,i=a,o=new Set([...o,...s.fields])}const a=[];for(const l of s.contingencies){const[e,t]=this._hashContingency(l,i.codedValueFields),n=t?this._findMatchingContingenciesWithAnyHashMask(r,e):r.get(e);if(r.has(J)&&n.push(...this._findMatchingContingenciesContainingAny(l,r.get(J),i.codedValueFields)),null!=n)for(const s of n){const e=i.rangeFields.length>0?this._joinContingenciesWithRangeDomains(s,l,i.rangeFields):this._joinContingencies(s,l);null!=e&&a.push(e)}}return a}_joinContingencies(e,t){const n={values:{...e.values,...t.values}};for(const[s,i]of Object.entries(n.values))"any"===i.objectType&&null!=e.values[s]&&(n.values[s]=e.values[s]);return n}_joinContingenciesWithRangeDomains(e,t,n){const s=this._joinContingencies(e,t);for(const i of n){const n=e.values[i],o=t.values[i],{leftIsNull:r,rightIsNull:a,bothAreNull:l,leftIsAny:u,rightIsAny:p,bothAreAny:c,leftIsRange:h,rightIsRange:d}=this._compareObjectTypes(n.objectType,o.objectType);if(l||c)continue;if(r&&p||a&&u){s.values[i]=new x({objectType:"null"});continue}if(r&&d||a&&h)return null;u?(n.minValue=-1/0,n.maxValue=1/0):p&&(o.minValue=-1/0,o.maxValue=1/0);const f=Math.max(n.minValue,o.minValue),m=Math.min(n.maxValue,o.maxValue);if(f>m)return null;s.values[i]=new x({objectType:"range",minValue:f,maxValue:m})}return s}_findMatchingContingenciesContainingAny(e,t,n){return t.filter((t=>n.every((n=>{const s=t.values[n],i=e.values[n];return"any"===s.objectType||"any"===i.objectType||s.codedValue?.code===i.codedValue?.code}))))}_findMatchingContingenciesWithAnyHashMask(e,t){const n=RegExp(`${t}$`),s=[];for(const[i,o]of e){if(i===J)break;n.test(i)&&s.push(...o)}return s}_generateJoinKey(e,t){const n=Array.isArray(e)?new Set(e):e,s=Array.isArray(t)?new Set(t):t,i=n.size<s.size?n:s,o=i===n?s:n,{feature:r}=this,a=new Set,l=new Set;for(const u of i)if(o.has(u)){const e=this.layer?.getFieldDomain(u,{feature:r??void 0,excludeImpliedDomains:!0});if(null==e)continue;switch(e.type){case"coded-value":a.add(u);break;case"range":l.add(u)}}return{codedValueFields:[...a],rangeFields:[...l]}}_contingencyIsValid(e,t){const n={};for(const{name:s,value:i}of this.allFieldInputs)this.fieldsWithContingentValues.has(s)&&null!=i&&s!==e&&(n[s]=i);return Object.entries(n).every((([e,n])=>!t.values.hasOwnProperty(e)||U(n,t.values[e])))}_getContingentValueOptionsForField(e,t){const n=this.joinedContingentValues.slice(),s=new Map,i={code:"",name:t??"No value"};for(const o of n){const t=o.values[e];if("code"===t?.objectType||"null"===t?.objectType){const{code:n,name:r}=t.codedValue&&"null"!==t.objectType?t.codedValue:i;!s.has(n)&&this._contingencyIsValid(e,o)&&s.set(n,{name:r,value:n})}}return[...s.values()]}_hashContingency(e,t,n=!1){if(t.length<1)return[z,!1];const s=[];let i=!1;for(const o of t){const t=e.values[o];if("any"===t.objectType){if(n)return[J,!0];i=!0,s.push(`${o}:.*`)}else"null"===t.objectType?s.push(`${o}:${B}`):s.push(`${o}:${t.codedValue?.code}`)}return[s.sort().join("&"),i]}_compareObjectTypes(e,t){return{leftIsNull:"null"===e,rightIsNull:"null"===t,bothAreNull:"null"===e&&"null"===t,leftIsAny:"any"===e,rightIsAny:"any"===t,bothAreAny:"any"===e&&"any"===t,leftIsRange:"range"===e,rightIsRange:"range"===t}}_isSupportedElement(e){return"field"===e.type||"group"===e.type||"relationship"===e.type||"text"===e.type||"utilityNetworkAssociations"===e.type||(i.getLogger(this).warn("form-info::unsupported-element-type","Only element types 'field', 'group' and 'relationship' are supported",`Element ${e.label} has unsupported type '${e.type}'`),!1)}get test(){return{featureClone:this._featureClone}}};function Y(e,t){const{feature:n,layer:s}=t;return new P({element:e,inputs:[],feature:n,layer:s})}function q(e,t,n=null){const{feature:s,layer:i,timeZone:o}=t;return new W({element:e,feature:s,group:n,layer:i,timeZone:o})}e([d()],K.prototype,"_expressionInfosLookup",null),e([d()],K.prototype,"_featureClone",void 0),e([d()],K.prototype,"_timeZone",void 0),e([d()],K.prototype,"activeAssociation",void 0),e([d()],K.prototype,"activeAssociationInput",null),e([d()],K.prototype,"activeRelationshipInput",null),e([d()],K.prototype,"_arcadeContextInfo",null),e([d()],K.prototype,"associationId",null),e([d()],K.prototype,"associatedLayer",null),e([d()],K.prototype,"allAssociationInputs",null),e([d()],K.prototype,"allFieldInputs",null),e([d()],K.prototype,"allGroupInputs",null),e([d()],K.prototype,"allRelationshipInputs",null),e([d()],K.prototype,"_layerFieldsByName",null),e([d()],K.prototype,"arcadeEditType",void 0),e([d()],K.prototype,"contingencyConstraintViolations",void 0),e([d()],K.prototype,"disabled",void 0),e([d()],K.prototype,"feature",null),e([d()],K.prototype,"fieldsWithContingentValues",null),e([d({type:y})],K.prototype,"formTemplate",null),e([d()],K.prototype,"formDescription",null),e([d()],K.prototype,"formTitle",null),e([d()],K.prototype,"formHeaderVisible",null),e([d()],K.prototype,"highlightHelper",void 0),e([d()],K.prototype,"inputs",void 0),e([d()],K.prototype,"joinedContingentValues",null),e([d()],K.prototype,"layer",null),e([d()],K.prototype,"map",void 0),e([d()],K.prototype,"callbacks",void 0),e([d()],K.prototype,"relationshipId",null),e([d()],K.prototype,"spatialReference",null),e([d()],K.prototype,"state",null),e([d()],K.prototype,"strict",void 0),e([d()],K.prototype,"submittable",null),e([d()],K.prototype,"timeZone",null),e([d()],K.prototype,"updating",null),e([d()],K.prototype,"valid",null),e([d()],K.prototype,"pendingSubtypeChoice",void 0),e([d()],K.prototype,"getValues",null),e([d()],K.prototype,"submit",null),e([d()],K.prototype,"test",null),K=e([f("esri.widgets.FeatureForm.FeatureFormViewModel")],K);const Q=K;export{Q as default};
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import{neverReached as n}from"../../core/compilerUtils.js";import s from"../../core/Evented.js";import i from"../../core/Logger.js";import{destroyMaybe as o}from"../../core/maybe.js";import r from"../../core/Promise.js";import{debounce as a}from"../../core/promiseUtils.js";import{watch as l,whenOnce as u,on as p,syncAndInitial as c}from"../../core/reactiveUtils.js";import{templateHasKey as h}from"../../core/string.js";import{property as d}from"../../core/accessorSupport/decorators/property.js";import"../../core/RandomLCG.js";import{subclass as f}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as m}from"../../core/support/UpdatingHandles.js";import y from"../../form/FormTemplate.js";import{isUtilityNetworkAssociationsElement as g,isGroupElement as _,isFieldElement as v,isRelationshipElement as I,isTextElement as x}from"../../form/support/formUtils.js";import E from"../../layers/support/ContingentValue.js";import{isEditableLayer as C}from"../../layers/support/editableLayers.js";import F from"../../layers/support/LayerContingentValuesCache.js";import{utc as b,unknown as V,system as w}from"../../time/constants.js";import{flattenAssociationInputs as A,flattenFieldInputs as j,isGroupInput as T,flattenRelationshipInputs as M,parseFormTemplateString as k,isRelationshipInput as N,isFieldInput as S,isTextElementInput as L,getNormalizedFeatureTypeInfo as R,valueIsValidContingentValue as U}from"./featureFormUtils.js";import Z from"./FieldInput.js";import{FormExpressionsManager as H}from"./FormExpressionsManager.js";import P from"./GroupInput.js";import O from"./RelationshipInput.js";import W from"./TextElementInput.js";import{createFormExpressionArcadeExecutor as G}from"../support/forms/expressions/FormExpressionArcadeExecutor.js";const $=new t({attributes:{}}),D={field:["editableExpression","requiredExpression","valueExpression","visibilityExpression"],group:["visibilityExpression"],relationship:["editableExpression","visibilityExpression"],text:["visibilityExpression"],utilityNetworkAssociations:["editableExpression","visibilityExpression"]},z="#JSAPI_CONTINGENT_VALUE_EMPTY_HASH",J="#JSAPI_CONTINGENT_VALUE_ANY_HASH",B="#JSAPI_CONTINGENT_VALUE_NULL_HASH";let K=class extends(r.EsriPromiseMixin(s.EventedAccessor)){constructor(e){super(e),this._expressionExecutorsInUse=new Set,this._expressionExecutorLookup=new Map,this._expressionsManager=null,this._contingentValuesCache=null,this._featureClone=$.clone(),this._initialFeature=$.clone(),this._timeZone=null,this._updatingHandles=new m,this.activeAssociation=null,this.editType="NA",this.contingencyConstraintViolations=new Map,this.disabled=!1,this.highlightHelper=null,this.inputs=[],this.map=null,this.callbacks=null,this.strict=!1,this.pendingSubtypeChoice=null,this._updateInputs=a((async()=>{this._stopExpressions();const{_featureClone:e,_initialFeature:t,editType:n,formTemplate:s,inputs:i,layer:o,timeZone:r}=this;if(!o)return;const a={editType:n,feature:e,initialFeature:t,layer:o,timeZone:r},l=i.slice(),u=s?.elements&&s.elements.length>0?await this._updateInputsUsingFormElements(l,s.elements,a):this._updateInputsUsingLayerFields(l,o?.fields,a);this.inputs=u,await this._startExpressions()}))}initialize(){const e=l((()=>[this.layer,!!this.layer?.loaded,this.formTemplate,this.feature,this.timeZone,this.editType]),(([e,t])=>{null!=e&&(t?this._updatingHandles.addPromise(this._updateInputs()):e.load().catch((()=>{})))}),c),t=l((()=>this._arcadeContextInfo),(e=>{null!=this._expressionsManager&&(this._expressionsManager.arcadeContextInfo=e,this._evaluateExpressions((e=>e.evaluateAll())))})),n=l((()=>this.layer),(e=>{const t="subtype-sublayer"===e?.type?e.parent:"feature"===e?.type?e:null;t&&this.addResolvingPromise(F.createLoadedLayerContingentValuesCache(t).then((e=>{this._contingentValuesCache=e,this.notifyChange("fieldsWithContingentValues")})))}),{initial:!0});this.addHandles([e,t,n])}destroy(){this.feature=null,this.layer=null,this._contingentValuesCache=o(this._contingentValuesCache),this.highlightHelper?.removeAll(),this._updatingHandles.destroy()}get _expressionInfosLookup(){return new Map(this.formTemplate?.expressionInfos?.map((e=>[e.name,e])))}get activeAssociationInput(){return this.allAssociationInputs.find((e=>e.uid===this.associationId))}get activeRelationshipInput(){return this.allRelationshipInputs.find((e=>e.relationshipId===this.relationshipId||e.activeCategory||e.showAllEnabled))}get _arcadeContextInfo(){const{_initialFeature:e,editType:t,layer:n,map:s,spatialReference:i,timeZone:o}=this;return{layer:C(n)?n:null,originalFeature:e,editType:t,map:s,spatialReference:i,timeZone:o}}get associationId(){return this._get("associationId")}set associationId(e){null==e&&this.activeAssociationInput?.viewModel&&(this.activeAssociationInput.associatedLayer=null,this.activeAssociationInput.viewModel.activeAssociationType=null),this._set("associationId",e)}get associatedLayer(){return this.activeAssociationInput?.associatedLayer}set associatedLayer(e){this.activeAssociationInput&&(this.activeAssociationInput.associatedLayer=e)}get allAssociationInputs(){return A(this.inputs)}get allFieldInputs(){return j(this.inputs)}get allGroupInputs(){return this.inputs.filter(T)}get allRelationshipInputs(){return M(this.inputs)}get _layerFieldsByName(){return new Map(this.layer?.fields.map((e=>[e.name,e])))}get feature(){return this._get("feature")}set feature(e){const t=this._get("feature");this._featureClone=e?e.clone():$.clone(),this._initialFeature=this._featureClone.clone(),this._expressionsManager&&(this._expressionsManager.feature=this._featureClone),e?(this._resetFieldInputValues(this._featureClone),this.allRelationshipInputs.forEach((t=>t.feature=e))):(this.inputs.forEach((e=>e.destroy())),this.inputs.length=0),t!==e&&(this.pendingSubtypeChoice=null),this.contingencyConstraintViolations.clear(),this._set("feature",e)}get fieldsWithContingentValues(){if(null==this._contingentValuesCache)return new Set;const e=this._contingentValuesCache.fieldGroups.flatMap((e=>e.fields));return new Set(e)}get formTemplate(){return this.layer&&"formTemplate"in this.layer?this.layer.formTemplate:null}set formTemplate(e){void 0===e?this._clearOverride("formTemplate"):this._override("formTemplate",e)}get formDescription(){const{formTemplate:e,layer:t}=this;return e?.description&&t?k({label:e.description,attributes:this.getValues(),fieldsIndex:t.fieldsIndex,timeZone:this.timeZone}):null}get formTitle(){const{formTemplate:e,layer:t}=this;return e?.title&&t?k({label:e.title,attributes:this.getValues(),fieldsIndex:t.fieldsIndex,timeZone:this.timeZone}):null}get formHeaderVisible(){const{activeRelationshipInput:e,activeAssociationInput:t,formDescription:n,formTitle:s}=this;return!(e||t||!n&&!s)}get joinedContingentValues(){return this._joinContingentValues()}get layer(){return this.feature?.sourceLayer&&"applyEdits"in this.feature.sourceLayer?this.feature.sourceLayer:null}set layer(e){this._override("layer",e)}get relationshipId(){return this._get("relationshipId")}set relationshipId(e){const t=this.allRelationshipInputs;if(null!=e&&e===this.relationshipId||t.forEach((e=>{e.showAllEnabled=!1,e.activeCategory=null})),null!=e){const n=t.find((t=>t.relationshipId===e));n&&(n.showAllEnabled=!0)}this._set("relationshipId",e)}get spatialReference(){return this.layer?.spatialReference??null}set spatialReference(e){this._override("spatialReference",e)}get state(){return this.layer?.loaded?"ready":"disabled"}get submittable(){return!!this.valid||this.allFieldInputs.filter((e=>!e.valid)).every((({submittable:e})=>e))}get timeZone(){const{layer:e}=this;if(e&&"datesInUnknownTimezone"in e&&e.datesInUnknownTimezone)return b;const t=e&&"preferredTimeZone"in e&&e.preferredTimeZone;return this._timeZone===V?t||b:this._timeZone||w}set timeZone(e){this._timeZone=e}get updating(){return this._updatingHandles.updating}get valid(){const e=this.allFieldInputs;return e.length>0&&e.every((({valid:e})=>e))}findField(e){return this.allFieldInputs.find((t=>t.name===e))}getFieldValueOptionsForField(e,t){const n=this.findField(e);if(!n)return[[],[],[]];const s="coded-value"===n.domain?.type?n.domain.codedValues.map((({name:e,code:t})=>({name:e,value:t}))):[],i=null==n.value||s.some((e=>e.value===n.value))?[]:[{name:`${n.value}`,value:n.value}],o=this.fieldsWithContingentValues.has(e)?this._getContingentValueOptionsForField(e,t):[];if(o.length>0){const e=new Set(o.map((e=>e.value)));return[o,s.filter((t=>!e.has(t.value))),i]}return[s,[],i]}getValue(e){const t=this.layer?.getField(e);if(null!=t)return this._featureClone.getAttribute(t.name)??null}setValue(e,t){const{_featureClone:n,strict:s}=this,i=this.findField(e);t=""===t?null:t,i&&n.getAttribute(e)!==t&&(i.value=t,s&&!i.valid||(this._afterValueChange(i),this._evaluateExpressions((t=>t.evaluateInvalidated([e])))))}getValues(){return{...this._featureClone.attributes}}overrideInitialFeature(e){this._initialFeature=e}submit(){const e=this.allFieldInputs,t=new Set(e.filter((e=>e.valid)).map((({name:e})=>e))),n=e.filter((e=>!e.valid)).map((({name:e})=>e)),s=this.getValues();if(this.validateContingencyConstraints(s,{includeIncompleteViolations:!0}).length>0)for(const[i,o]of this.contingencyConstraintViolations.entries())"error"===o.type&&(t.delete(i),n.push(i));this.notifyChange("submittable"),this.notifyChange("valid"),this.emit("submit",{valid:[...t],invalid:n,values:s})}validateContingencyConstraints(e,t){const{_contingentValuesCache:n}=this,s=new Map;if(this.contingencyConstraintViolations=s,null==n)return[];const{invalid:i,incomplete:o}=n.validateContingencyConstraints(e),r=[...i,...t?.includeIncompleteViolations?o:[]];for(const a of r)for(const e of a.fieldGroup.fields)s.set(e,a);return r}notifyFeatureGeometryChanged(){const{feature:e,_featureClone:t}=this;e&&(t.geometry=e.geometry,this._evaluateExpressions((e=>e.evaluateInvalidatedByGeometry())))}applySubtypeDefaults(e){const{defaultValues:t}=e,{allFieldInputs:n}=this;for(const{name:s}of n){const e=t[s];null!=e&&this.setValue(s,e)}}_emitChangeEvent({name:e,valid:t,value:n}){this.emit("value-change",{layer:this.layer,feature:this.feature,fieldName:e,value:n,valid:t})}async _evaluateExpressions(e){const t=this._expressionsManager;null!=t&&await this._updatingHandles.addPromise(e(t).finally((()=>this._afterExpressionsEvaluated())))}async _updateInputsUsingFormElements(e,t,n){const s=new Map;for(const r of e)if(T(r)){s.set(r.element,r);for(const e of r.inputs)e.element&&s.set(e.element,e)}else r.element&&s.set(r.element,r);const i=new Map,o=await this._updateInputsUsingFormElementsRecursive({existingInputsByElement:s,updatedElements:t.filter((e=>this._isSupportedElement(e))),sharedInitializationProperties:n,group:null,newExpressionExecutorPromises:i});for(const[r,a]of s.entries())s.delete(r),a.destroy();return await Promise.all(Array.from(i.values())),o}async _updateInputsUsingFormElementsRecursive(e){const{existingInputsByElement:t,updatedElements:n,sharedInitializationProperties:s,group:i,newExpressionExecutorPromises:o}=e,r=[];for(const a of n){const e=t.has(a),n=e?t.get(a):g(a)?await this._makeUtilityNetworkAssociationInputFromElement(a,s,i):this._makeInputFromElement(a,s,i);if(n){if(r.push(n),await u((()=>!n.updating)),this._assignExpressionExecutors(n,a,o),e)if(t.delete(a),T(n)){const{feature:e,timeZone:t}=s;n.set({feature:e,timeZone:t})}else if(N(n)){const e=this.relationshipId===a.relationshipId;n.set(s),n.set({map:this.map,showAllEnabled:e})}else g(n)?(n.set(s),n.set({map:this.map})):n.set(s);if(_(a)){const e=a.elements.filter((e=>this._isSupportedElement(e)));n.inputs=await this._updateInputsUsingFormElementsRecursive({existingInputsByElement:t,updatedElements:e,sharedInitializationProperties:s,group:n,newExpressionExecutorPromises:o})}}}return r}_updateInputsUsingLayerFields(e,t,n){if(!Array.isArray(t))return i.getLogger(this).warn(this.declaredClass,"No attribute fields found."),[];const s=new Map;for(const i of e)if(T(i)){for(const e of i.inputs)e.destroy();i.inputs.length=0,i.destroy()}else N(i)?i.destroy():S(i)&&(null!==i.element?i.destroy():s.set(i.field,i));const o=[];for(const i of t){const e=n.feature?.getAttribute(i.name)??null,t=s.get(i)??new Z({field:i,preservesValueWhenHidden:this.formTemplate?.preserveFieldValuesWhenHidden});o.push(t.set({...n,value:e})),s.delete(i)}for(const[i,r]of s.entries())s.delete(i),r.destroy();return o}_resetFieldInputValues(e){for(const t of this.allFieldInputs)t.value=e.getAttribute(t.name)}_makeInputFromElement(e,t,s){return _(e)?Y(e,t):v(e)?this._makeFieldInputFromElement(e,t,s):I(e)?this._makeRelationshipInputFromElement(e,t,s):g(e)?this._makeUtilityNetworkAssociationInputFromElement(e,t,s):x(e)?q(e,t):g(e)?this._makeUtilityNetworkAssociationInputFromElement(e,t,s):n()}_makeFieldInputFromElement(e,t,n){const{editType:s,feature:i,initialFeature:o,layer:r,timeZone:a}=t,{fieldName:l}=e,u=l&&this._layerFieldsByName.get(l);return u?new Z({editType:s,element:e,field:u,value:i?.getAttribute(e.fieldName)??null,feature:i,initialFeature:o,layer:r,group:n,preservesValueWhenHidden:this.formTemplate?.preserveFieldValuesWhenHidden,timeZone:a}):null}_makeRelationshipInputFromElement(e,t,n=null){const{map:s}=this,{feature:i,layer:o,timeZone:r}=t,a=new O({element:e,feature:i,group:n,layer:o,map:s,timeZone:r});return a.addHandles(p((()=>a.relatedLayer),"edits",(()=>this._evaluateExpressions((e=>e.evaluateAsyncExpressions()))))),a}async _makeUtilityNetworkAssociationInputFromElement(e,t,n=null){const{map:s}=this,{feature:i,layer:o,timeZone:r}=t;return new(0,(await import("./UtilityNetworkAssociationInput.js")).default)({element:e,feature:i,group:n,layer:o,map:s,timeZone:r})}_assignExpressionExecutors(e,t,n){const s=D[t.type],i=[];for(const o of s){const s=`${o}Executor`;if(e[s]){this._useExecutor(e[s]);continue}const r=t[o];if(null!=r&&""!==r){const t=this._expressionInfosLookup.get(r)?.expression??r;i.push(this._getOrCreateExecutorForExpression(t,n).then((t=>{e[s]=this._useExecutor(t)})))}}return L(e)&&i.push(...this._assignTextElementExpressionExecutors(e,n)),i}_assignTextElementExpressionExecutors(e,t){const{_expressionInfosLookup:n}=this,s=[];for(const o of e.expressionsUsed){const r=n.get(o);null!=r?s.push(this._getOrCreateExecutorForExpression(r.expression,t).then((t=>e.setExpressionExecutor(o,this._useExecutor(t))))):i.getLogger(this).error("feature-form:expression-not-found",`Could not find expressionInfo object with name '${o}'`)}for(const i of e.fieldsUsed){const n=`return $feature['${i}'];`;s.push(this._getOrCreateExecutorForExpression(n,t).then((t=>e.setFieldExecutor(i,this._useExecutor(t)))))}return s}async _getOrCreateExecutorForExpression(e,t){const{_expressionExecutorLookup:n}=this;if(n.has(e))return n.get(e);if(t.has(e))return t.get(e);const s=G(e,this.layer);t.set(e,s);const i=await s;return n.set(e,i),i}_createExpressionsManager(e){const{_arcadeContextInfo:t,_featureClone:n,allFieldInputs:s,formTemplate:i}=this;this._expressionsManager=new H({executors:e,feature:n,arcadeContextInfo:t,fieldInputs:s,preserveFieldValuesWhenHidden:!0===i?.preserveFieldValuesWhenHidden})}async _startExpressions(){if(0===this._expressionExecutorsInUse.size)return;const e=Array.from(this._expressionExecutorsInUse);this._createExpressionsManager(e),this._evaluateExpressions((e=>e.evaluateAll()))}_stopExpressions(){this._expressionsManager=o(this._expressionsManager),this._expressionExecutorsInUse.clear()}_useExecutor(e){return this._expressionExecutorsInUse.add(e),e}_afterValueChange(e){const{name:t,value:n}=e,{_featureClone:s,formTemplate:i,layer:o}=this;if(!o)return;const r=s.getAttribute(t);s.setAttribute(t,n);const{typeFieldName:a,types:l}=R(o);if((e.isSubtypeField||t===a)&&n!==r){if("subtype-sublayer"===o.type){const e=o.parent?.findSublayerForFeature(s);e&&(this.feature&&(this.feature.sourceLayer=e),s.sourceLayer=e)}const e=new Set;for(const t of l)if(t.domains&&"object"==typeof t.domains)for(const n of Object.keys(t.domains))e.add(n);for(const t of e){const e=this.findField(t);e&&e.notifyChange("domain")}this.notifyChange("joinedContingentValues")}if(null!=i){const{description:e,title:n}=i;n&&h(n,t)&&this.notifyChange("formTitle"),e&&h(e,t)&&this.notifyChange("formDescription")}this._emitChangeEvent(e)}_afterExpressionsEvaluated(){const{_featureClone:e}=this;for(const t of this.allFieldInputs)t.value!==e.getAttribute(t.name)&&this._afterValueChange(t)}_joinContingentValues(){const e=this._contingentValuesCache;if(null==e)return[];const{typeFieldName:t}=R(this.layer),n=t?this.getValue(t):null,s=[];for(const r of e.fieldGroups){const{contingencies:e,fields:t,name:i}=r,o=[];for(const s of e)s.isRetired||null!=s.subtype&&s.subtype.code!==n||o.push({values:s.values});o.length>0&&s.push({name:i,fields:t,contingencies:o})}const[i,o]=this._generateJoinPlan(s);return[...i.flatMap((e=>this._joinFieldGroupContingencies(e))),...o.flatMap((e=>e.contingencies))]}_generateJoinPlan(e){const t=new Map,n=[],s=new Set;for(const l of e)for(const e of l.fields)if(t.has(e)){const i=t.get(e),o=l,r=[i.name,o.name].sort().join("|");if(s.has(r))continue;n.push([i,o]),s.add(r),t.set(e,o)}else t.set(e,l);const i=new Set(n.flat()),o=new Set(e);for(const l of i)o.delete(l);const r=new Map,a=new Map;for(const l of new Set(n.flat())){const e=Symbol(l.name);r.set(e,new Set([l])),a.set(l,e)}for(const[l,u]of n){const e=a.get(l),t=a.get(u);if(e===t)continue;const n=r.get(e),s=r.get(t);for(const i of s)n.add(i),a.set(i,e);r.delete(t)}return[[...r.values()].map((e=>[...e])),[...o]]}_joinFieldGroupContingencies(e){const t=e.slice(),n=t.shift();let s=t.shift(),i=this._generateJoinKey(n.fields,s.fields),o=new Set([...n.fields,...s.fields]),r=new Map;for(const l of n.contingencies){const[e]=this._hashContingency(l,i.codedValueFields,!0);r.has(e)?r.get(e)?.push(l):r.set(e,[l])}for(;t.length>0;){const e=new Map,n=t.shift(),a=this._generateJoinKey(o,n.fields);for(const t of s.contingencies){const[n,s]=this._hashContingency(t,i.codedValueFields),o=s?this._findMatchingContingenciesWithAnyHashMask(r,n):r.get(n);if(r.has(J)&&o?.push(...this._findMatchingContingenciesContainingAny(t,r.get(J),i.codedValueFields)),null!=o)for(const r of o){const n=i.rangeFields.length>0?this._joinContingenciesWithRangeDomains(r,t,i.rangeFields):this._joinContingencies(r,t);if(null==n)break;const[s]=this._hashContingency(n,a.codedValueFields,!0);e.has(s)?e.get(s)?.push(n):e.set(s,[n])}}r=e,s=n,i=a,o=new Set([...o,...s.fields])}const a=[];for(const l of s.contingencies){const[e,t]=this._hashContingency(l,i.codedValueFields),n=t?this._findMatchingContingenciesWithAnyHashMask(r,e):r.get(e);if(r.has(J)&&n.push(...this._findMatchingContingenciesContainingAny(l,r.get(J),i.codedValueFields)),null!=n)for(const s of n){const e=i.rangeFields.length>0?this._joinContingenciesWithRangeDomains(s,l,i.rangeFields):this._joinContingencies(s,l);null!=e&&a.push(e)}}return a}_joinContingencies(e,t){const n={values:{...e.values,...t.values}};for(const[s,i]of Object.entries(n.values))"any"===i.objectType&&null!=e.values[s]&&(n.values[s]=e.values[s]);return n}_joinContingenciesWithRangeDomains(e,t,n){const s=this._joinContingencies(e,t);for(const i of n){const n=e.values[i],o=t.values[i],{leftIsNull:r,rightIsNull:a,bothAreNull:l,leftIsAny:u,rightIsAny:p,bothAreAny:c,leftIsRange:h,rightIsRange:d}=this._compareObjectTypes(n.objectType,o.objectType);if(l||c)continue;if(r&&p||a&&u){s.values[i]=new E({objectType:"null"});continue}if(r&&d||a&&h)return null;u?(n.minValue=-1/0,n.maxValue=1/0):p&&(o.minValue=-1/0,o.maxValue=1/0);const f=Math.max(n.minValue,o.minValue),m=Math.min(n.maxValue,o.maxValue);if(f>m)return null;s.values[i]=new E({objectType:"range",minValue:f,maxValue:m})}return s}_findMatchingContingenciesContainingAny(e,t,n){return t.filter((t=>n.every((n=>{const s=t.values[n],i=e.values[n];return"any"===s.objectType||"any"===i.objectType||s.codedValue?.code===i.codedValue?.code}))))}_findMatchingContingenciesWithAnyHashMask(e,t){const n=RegExp(`${t}$`),s=[];for(const[i,o]of e){if(i===J)break;n.test(i)&&s.push(...o)}return s}_generateJoinKey(e,t){const n=Array.isArray(e)?new Set(e):e,s=Array.isArray(t)?new Set(t):t,i=n.size<s.size?n:s,o=i===n?s:n,{feature:r}=this,a=new Set,l=new Set;for(const u of i)if(o.has(u)){const e=this.layer?.getFieldDomain(u,{feature:r??void 0,excludeImpliedDomains:!0});if(null==e)continue;switch(e.type){case"coded-value":a.add(u);break;case"range":l.add(u)}}return{codedValueFields:[...a],rangeFields:[...l]}}_contingencyIsValid(e,t){const n={};for(const{name:s,value:i}of this.allFieldInputs)this.fieldsWithContingentValues.has(s)&&null!=i&&s!==e&&(n[s]=i);return Object.entries(n).every((([e,n])=>!t.values.hasOwnProperty(e)||U(n,t.values[e])))}_getContingentValueOptionsForField(e,t){const n=this.joinedContingentValues.slice(),s=new Map,i={code:"",name:t??"No value"};for(const o of n){const t=o.values[e];if("code"===t?.objectType||"null"===t?.objectType){const{code:n,name:r}=t.codedValue&&"null"!==t.objectType?t.codedValue:i;!s.has(n)&&this._contingencyIsValid(e,o)&&s.set(n,{name:r,value:n})}}return[...s.values()]}_hashContingency(e,t,n=!1){if(t.length<1)return[z,!1];const s=[];let i=!1;for(const o of t){const t=e.values[o];if("any"===t.objectType){if(n)return[J,!0];i=!0,s.push(`${o}:.*`)}else"null"===t.objectType?s.push(`${o}:${B}`):s.push(`${o}:${t.codedValue?.code}`)}return[s.sort().join("&"),i]}_compareObjectTypes(e,t){return{leftIsNull:"null"===e,rightIsNull:"null"===t,bothAreNull:"null"===e&&"null"===t,leftIsAny:"any"===e,rightIsAny:"any"===t,bothAreAny:"any"===e&&"any"===t,leftIsRange:"range"===e,rightIsRange:"range"===t}}_isSupportedElement(e){return"field"===e.type||"group"===e.type||"relationship"===e.type||"text"===e.type||"utilityNetworkAssociations"===e.type||(i.getLogger(this).warn("form-info::unsupported-element-type","Only element types 'field', 'group' and 'relationship' are supported",`Element ${e.label} has unsupported type '${e.type}'`),!1)}get test(){return{featureClone:this._featureClone}}};function Y(e,t){const{feature:n,layer:s}=t;return new P({element:e,inputs:[],feature:n,layer:s})}function q(e,t,n=null){const{feature:s,layer:i,timeZone:o}=t;return new W({element:e,feature:s,group:n,layer:i,timeZone:o})}e([d()],K.prototype,"_expressionInfosLookup",null),e([d()],K.prototype,"_featureClone",void 0),e([d()],K.prototype,"_timeZone",void 0),e([d()],K.prototype,"activeAssociation",void 0),e([d()],K.prototype,"activeAssociationInput",null),e([d()],K.prototype,"activeRelationshipInput",null),e([d()],K.prototype,"_arcadeContextInfo",null),e([d()],K.prototype,"associationId",null),e([d()],K.prototype,"associatedLayer",null),e([d()],K.prototype,"allAssociationInputs",null),e([d()],K.prototype,"allFieldInputs",null),e([d()],K.prototype,"allGroupInputs",null),e([d()],K.prototype,"allRelationshipInputs",null),e([d()],K.prototype,"_layerFieldsByName",null),e([d()],K.prototype,"editType",void 0),e([d()],K.prototype,"contingencyConstraintViolations",void 0),e([d()],K.prototype,"disabled",void 0),e([d()],K.prototype,"feature",null),e([d()],K.prototype,"fieldsWithContingentValues",null),e([d({type:y})],K.prototype,"formTemplate",null),e([d()],K.prototype,"formDescription",null),e([d()],K.prototype,"formTitle",null),e([d()],K.prototype,"formHeaderVisible",null),e([d()],K.prototype,"highlightHelper",void 0),e([d()],K.prototype,"inputs",void 0),e([d()],K.prototype,"joinedContingentValues",null),e([d()],K.prototype,"layer",null),e([d()],K.prototype,"map",void 0),e([d()],K.prototype,"callbacks",void 0),e([d()],K.prototype,"relationshipId",null),e([d()],K.prototype,"spatialReference",null),e([d()],K.prototype,"state",null),e([d()],K.prototype,"strict",void 0),e([d()],K.prototype,"submittable",null),e([d()],K.prototype,"timeZone",null),e([d()],K.prototype,"updating",null),e([d()],K.prototype,"valid",null),e([d()],K.prototype,"pendingSubtypeChoice",void 0),e([d()],K.prototype,"getValues",null),e([d()],K.prototype,"submit",null),e([d()],K.prototype,"test",null),K=e([f("esri.widgets.FeatureForm.FeatureFormViewModel")],K);const Q=K;export{Q as default};
|