@arcgis/core 5.1.0-next.78 → 5.1.0-next.79
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/ShadowCast/DiscreteOptions.d.ts +33 -6
- package/analysis/ShadowCast/DiscreteOptions.js +1 -1
- package/analysis/ShadowCast/MinDurationOptions.d.ts +6 -4
- package/analysis/ShadowCast/TotalDurationOptions.d.ts +33 -6
- package/analysis/ShadowCast/TotalDurationOptions.js +1 -1
- package/analysis/ShadowCast/colorStopsUtils.js +2 -0
- package/analysis/ShadowCastAnalysis.d.ts +24 -1
- package/analysis/ShadowCastAnalysis.js +1 -1
- package/analysis/Viewshed.d.ts +27 -0
- package/analysis/Viewshed.js +1 -1
- package/analysis/ViewshedAnalysis.js +1 -1
- package/arcade/FunctionWrapper.js +1 -1
- package/arcade/arcadeAsyncRuntime.js +1 -1
- package/arcade/arcadeCompiler.js +1 -1
- package/arcade/arcadeRuntime.js +1 -1
- package/arcade/compilerUtils.js +1 -1
- package/arcade/debug.d.ts +139 -0
- package/arcade/debug.js +2 -0
- package/arcade/featureSetCollection.js +1 -1
- package/arcade/featureSetUtils.js +1 -1
- package/arcade/featureset/actions/GroupBy.js +1 -1
- package/arcade/featureset/actions/OrderBy.js +1 -1
- package/arcade/functions/featuresetstring.js +1 -1
- package/arcade/languageUtils.js +1 -1
- package/arcade.d.ts +46 -2
- package/arcade.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{1c7183551f5269bdcf13.js → 01bd1b86ba899c6aa4c0.js} +1 -1
- package/assets/esri/core/workers/chunks/{1f8ccf96069ac3a40c3d.js → 01ee18782a50279f907e.js} +1 -1
- package/assets/esri/core/workers/chunks/{f81c6f6ccc201f584970.js → 022067e807905cabeaa1.js} +1 -1
- package/assets/esri/core/workers/chunks/{11ea4be441a26134ce1f.js → 052cdc7aaa803b5873f0.js} +1 -1
- package/assets/esri/core/workers/chunks/{b7bb7072dbee978f3ca3.js → 056fd7847caaff2c9514.js} +1 -1
- package/assets/esri/core/workers/chunks/{8acee3fba488f202f82f.js → 05c3146d87d917606193.js} +1 -1
- package/assets/esri/core/workers/chunks/{a8ca5d8740cc7e39197b.js → 0aebcbf41cb193e76809.js} +5 -5
- package/assets/esri/core/workers/chunks/{54023458195549f66215.js → 0b77c124b743067e4155.js} +1 -1
- package/assets/esri/core/workers/chunks/10408183681fd6c7b4ed.js +2 -0
- package/assets/esri/core/workers/chunks/{7595ceba529ed01c7590.js → 2c87c3112a43db8624f6.js} +1 -1
- package/assets/esri/core/workers/chunks/{13e60f19f436b8d683ae.js → 3c9482764c9e4f8bcbb0.js} +1 -1
- package/assets/esri/core/workers/chunks/{322c54081b25f1c53661.js → 3e37019eee1c49d2bf64.js} +1 -1
- package/assets/esri/core/workers/chunks/45c83eb7c2a06166e3b0.js +1 -0
- package/assets/esri/core/workers/chunks/48acd146bf0241d87647.js +1 -0
- package/assets/esri/core/workers/chunks/5818f1f526577068d6ca.js +2 -0
- package/assets/esri/core/workers/chunks/{34fe97bcacc0dfc5bce6.js → 5ccc325d83cec4f5ccdb.js} +1 -1
- package/assets/esri/core/workers/chunks/{30e710ec4d22c43d4e7e.js → 5cffc7b49966201eccdb.js} +1 -1
- package/assets/esri/core/workers/chunks/{1a87e9bbd85ba29b1514.js → 5da2051f548c2942e01a.js} +1 -1
- package/assets/esri/core/workers/chunks/5ec66e39e53c11e75179.js +2 -0
- package/assets/esri/core/workers/chunks/{0b1454a77a6a682541dc.js.LICENSE.txt → 5ec66e39e53c11e75179.js.LICENSE.txt} +9 -1
- package/assets/esri/core/workers/chunks/5f6fd20a7f4e80eafa25.js +1 -0
- package/assets/esri/core/workers/chunks/{abc06d10c7ac8ba5b0e4.js → 67ec1694d6e18b7c234c.js} +1 -1
- package/assets/esri/core/workers/chunks/{32e22d6eee9fed1f70b0.js → 6d696beddcc5fbed5875.js} +1 -1
- package/assets/esri/core/workers/chunks/{f590b60fca607d66001a.js → 716a4d7e8b908b81870b.js} +1 -1
- package/assets/esri/core/workers/chunks/71fe127734f33d020a44.js +1 -0
- package/assets/esri/core/workers/chunks/7cdd0492b2191df95102.js +2 -0
- package/assets/esri/core/workers/chunks/7cea68257d24ffd205bb.js +1 -0
- package/assets/esri/core/workers/chunks/7e530e635325dba07864.js +1 -0
- package/assets/esri/core/workers/chunks/8f6f5dad52747d252aac.js +596 -0
- package/assets/esri/core/workers/chunks/{d950d5c2844206502ff0.js → 992cd87ba0ab6346f692.js} +1 -1
- package/assets/esri/core/workers/chunks/{73c87eb9bd8f0f848481.js → 9c11e1fe785e1385fdb1.js} +1 -1
- package/assets/esri/core/workers/chunks/{5ed8d8b5336c81fbcda3.js → 9d216e30d04ea21fc8a2.js} +1 -1
- package/assets/esri/core/workers/chunks/a54aa93b6012a2597f82.js +1 -0
- package/assets/esri/core/workers/chunks/{cf14b3a44705dacefac4.js → a9b5ce00323cd5574bf7.js} +1 -1
- package/assets/esri/core/workers/chunks/ae6b3dfe5f757df539d6.js +1 -0
- package/assets/esri/core/workers/chunks/b14c4c3f295970f731ab.js +1 -0
- package/assets/esri/core/workers/chunks/{c70df6ed190f9ebcf6aa.js → bf2c202dec5ab7bc770b.js} +1 -1
- package/assets/esri/core/workers/chunks/c1d4110aa494a1dba3c4.js +1 -0
- package/assets/esri/core/workers/chunks/{85d8c7cc7f8decbe975d.js → c442916805975744dd92.js} +1 -1
- package/assets/esri/core/workers/chunks/dacc2e5fa462495ed1cc.js +2 -0
- package/assets/esri/core/workers/chunks/f227b34cce6843df0fb6.js +1 -0
- package/assets/esri/core/workers/chunks/{dda2cb5c073d1e65f14f.js → f43d628d47eec7d530c7.js} +1 -1
- package/assets/esri/core/workers/chunks/f7531aa69a87814c60d1.js +1 -0
- package/assets/esri/core/workers/chunks/{4ccb56333de0247dcb6f.js → fb100935fd8948d779f5.js} +1 -1
- package/assets/esri/core/workers/chunks/{5ee4b630ad39c21d11db.js → fb9e3e7cd532ac4353f1.js} +12 -12
- package/assets/esri/core/workers/chunks/fc6ca7ffb9f1b875059c.js +1 -0
- package/assets/esri/core/workers/chunks/{3d9fcbe95dd22dbe730e.js → ffc4f3406ce383b9bd88.js} +1 -1
- package/assets/esri/themes/base/widgets/_BatchAttributeForm.scss +6 -0
- 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/assets/esri/widgets/Sketch/t9n/Sketch_ar.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_bg.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_bs.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_ca.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_cs.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_da.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_de.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_el.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_es.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_et.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_fi.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_fr.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_he.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_hr.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_hu.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_id.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_it.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_ja.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_ko.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_lt.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_lv.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_nl.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_no.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_pl.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_pt-BR.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_pt-PT.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_ro.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_ru.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_sk.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_sl.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_sr.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_sv.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_th.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_tr.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_uk.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_vi.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_zh-CN.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_zh-HK.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_zh-TW.json +1 -1
- package/chunks/ImageMaterial.glsl.js +7 -5
- package/chunks/SlicePlaneMaterial.glsl.js +21 -13
- package/chunks/arcade.js +1 -1
- package/chunks/languageUtils.js +1 -1
- package/config.js +1 -1
- package/core/MapUtils.js +1 -1
- package/core/arrayUtils.js +1 -1
- package/kernel.js +1 -1
- package/layers/IntegratedMeshLayer.d.ts +18 -14
- package/layers/SceneLayer.d.ts +35 -1
- package/layers/SceneLayer.js +1 -1
- package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
- package/layers/scene/ModelFileInfo.d.ts +29 -0
- package/layers/scene/ModelFileInfo.js +2 -0
- package/layers/scene/ModelInfo.d.ts +38 -0
- package/layers/scene/ModelInfo.js +2 -0
- package/layers/scene/modelQuerySupport.js +2 -0
- package/layers/scene/types.d.ts +14 -0
- package/layers/support/infoFor3D.js +1 -1
- package/layers/support/serviceCapabilitiesUtils.js +1 -1
- package/layers/types.d.ts +13 -1
- package/package.json +3 -3
- package/popup/Features.d.ts +1 -6
- package/popup/Features.js +1 -1
- package/popup/actions.js +1 -1
- package/renderers/visualVariables/support/ColorStop.js +1 -1
- package/support/arcadeUtils.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/engine/flow/styles/Imagery.js +1 -1
- package/views/2d/engine/flow/styles/Particles.js +1 -1
- package/views/2d/engine/flow/styles/Streamlines.js +1 -1
- package/views/2d/engine/vectorTiles/Placement.js +1 -1
- package/views/2d/engine/vectorTiles/TextShaping.js +1 -1
- package/views/2d/engine/webgl/AttributeStoreView.js +1 -1
- package/views/2d/engine/webgl/GlyphMosaic.js +1 -1
- package/views/2d/engine/webgl/GlyphSource.js +1 -1
- package/views/2d/engine/webgl/Overlay.js +1 -1
- package/views/2d/engine/webgl/OverlayMultipoint.js +1 -1
- package/views/2d/engine/webgl/RenderingDevice.js +1 -1
- package/views/2d/engine/webgl/TextureManager.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/GLSLShaderModule.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/GraphShaderModule.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/graph/ShaderGraphContext.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/TechniqueProgramCache.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/TestTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/TextureStatisticsTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AAnimatedShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimationUniformInfo.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/bitmap/BitmapTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/blend/BlendTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/bloom/BloomTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/blur/BlurTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/clip/ClipTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/colorize/ColorizeTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityPointShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityPolygonShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/drop-shadow/DropShadowTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/featureTechniqueUtils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/ComplexFillTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/ComplexOutlineFillTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/FillTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/GradientFillTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/OutlineFillTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/PatternFillTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/PatternOutlineFillTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/flow/FlowTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/grid/GridTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/heatmap/HeatmapTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/line/GradientStrokeTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/line/LineTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/line/TexturedLineTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/magnifier/MagnifierTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/opacity/OpacityTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/overlay/OverlayTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/pieChart/PieChartShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/pieChart/PieChartTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/RasterColorizerTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/RasterHighlightTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/VectorFieldTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/AspectTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/BandArithmeticTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/BaseRasterProcessorTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/ColormapToRGBTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/CompositeBandTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/ComputeChangeTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/ContrastBrightnessTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/ConvolutionTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/CurvatureTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/ExtractBandTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/FocalStatisticsTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/GrayscaleTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/HillshadeTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/LocalTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/MaskTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/NDVITechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/RemapTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/ReprojectTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/ShadedReliefTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/SlopeTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/SpectralConversionTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/StretchTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/AFeatureShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/BitmapShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/BlendShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/BlitShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/BloomShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/BlurShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/ColorizeShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/ComplexFillShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/ComplexOutlineFillShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/DropShadowShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/EntityStorage.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/GradientFillShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/GradientStrokeShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/HeatmapAccumulateShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/HeatmapResolveShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/MagnifierShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/MosaicInfo.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/OpacityShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/OverlayShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/PatternFillShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/PatternOutlineFillShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TextureStatisticsDiffShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TextureStatisticsMinMaxSumShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TextureStatisticsStdDevShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TextureStatisticsSumOfSquaredDiffShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TexturedLineShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TileDebugInfoShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/VideoScreenShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/flow/FlowImageryShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/flow/FlowUtils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/BaseRasterColorizerShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/BaseRasterHighlightShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/RasterColorizerLUTShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/RasterColorizerShadedReliefShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/RasterColorizerStretchShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/RasterXYBandHighlightShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/lut.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/AspectShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/BaseRasterProcessorShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/ColormapToRGBShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/ConvolutionShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/CurvatureShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/FocalStatisticsShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/HillshadeShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/MultiRasterMixin.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/ShadedReliefShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/SlopeShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/projection.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/stretch.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderBackground.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderFill.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderIcon.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderLine.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderText.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vvUtils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/text/TextTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/tile/TileDebugInfoTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/tile/TileStencilTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueBackground.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueCircle.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueFill.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueLine.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueSymbol.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/videoScreenRenderer/VideoScreenTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/typed/TypedShaderProgram.js +1 -1
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/3d/FocusAreasView.js +1 -1
- package/views/3d/StencilGeometry.js +2 -0
- package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedComputedData.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedConfiguration.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedFieldOfViewManipulation.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedScaleOrientManipulation.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedShapeVisualElement.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedSubVisualization.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
- package/views/3d/analysis/Viewshed/viewshedToolUtils.js +1 -1
- package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
- package/views/3d/focusAreaUtils.js +2 -0
- package/views/3d/layers/BuildingComponentSublayerView3D.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/IntegratedMeshLayerView3D.js +1 -1
- package/views/3d/layers/IntegratedMeshNormals.js +1 -1
- package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
- package/views/3d/layers/SceneLayerView3D.js +1 -1
- package/views/3d/layers/SceneLayerWorker.js +1 -1
- package/views/3d/layers/i3s/I3SQueryEngine.js +1 -1
- package/views/3d/layers/i3s/I3SUtil.js +1 -1
- package/views/3d/layers/support/DefinitionExpressionSceneLayerView.js +1 -1
- package/views/3d/layers/support/TemporalSceneLayerView.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/core/shaderTechnique/ShaderTechniqueRepository.js +1 -1
- package/views/3d/webgl-engine/effects/atmosphere/ChapmanAtmosphere.js +1 -1
- package/views/3d/webgl-engine/effects/atmosphere/LocalAtmosphere.js +1 -1
- package/views/3d/webgl-engine/effects/atmosphere/MarsAtmosphere.js +1 -1
- package/views/3d/webgl-engine/effects/blit/Blit.js +1 -1
- package/views/3d/webgl-engine/effects/clouds/CloudsComposition.js +1 -1
- package/views/3d/webgl-engine/effects/clouds/CloudsRenderer.js +1 -1
- package/views/3d/webgl-engine/effects/clouds/CloudsTechnique.js +1 -1
- package/views/3d/webgl-engine/effects/clouds/NoiseTextureAtlas.js +1 -1
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaColorNode.js +1 -1
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
- package/views/3d/webgl-engine/effects/focusArea/focusAreaMaskUtils.js +2 -0
- package/views/3d/webgl-engine/effects/fog/Fog.js +1 -1
- package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +1 -1
- package/views/3d/webgl-engine/effects/glow/GlowRenderNode.js +1 -1
- package/views/3d/webgl-engine/effects/haze/Haze.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/ShadowHighlightBuffer.js +1 -1
- package/views/3d/webgl-engine/effects/laserlines/LaserLineRenderer.js +1 -1
- package/views/3d/webgl-engine/effects/laserlines/LaserlinePathTechnique.js +1 -1
- package/views/3d/webgl-engine/effects/magnifier/Magnifier.js +1 -1
- package/views/3d/webgl-engine/effects/precipitation/Precipitation.js +1 -1
- package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
- package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
- package/views/3d/webgl-engine/effects/stars/Stars.js +1 -1
- package/views/3d/webgl-engine/effects/stars/StarsTechnique.js +1 -1
- package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
- package/views/3d/webgl-engine/lib/Compositor.js +1 -1
- package/views/3d/webgl-engine/lib/CutFillComputationRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/CutFillVisualizationRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/Material.js +1 -1
- package/views/3d/webgl-engine/lib/Normals.js +1 -1
- package/views/3d/webgl-engine/lib/OrderIndependentTransparency.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
- package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
- package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/CheckerBoardTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/ColorMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/CompositingTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/ImageMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/LineMarkerTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/MeasurementArrowTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/OutputColorHighlightOLID.glsl.js +10 -10
- package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/ShadedColorMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/SlicePlaneMaterialTechnique.js +1 -1
- package/views/View2D.js +1 -1
- package/views/draw/support/GraphicMover.js +1 -1
- package/views/draw/support/Reshape.js +1 -1
- package/views/draw/support/editingSessionUtils.js +1 -1
- package/views/webgl/FramebufferObject.js +1 -1
- package/widgets/BatchAttributeForm/css.js +1 -1
- package/widgets/BatchAttributeForm/inputs/GroupInput.d.ts +2 -1
- package/widgets/BatchAttributeForm/inputs/RelationshipElementInput.d.ts +54 -0
- package/widgets/BatchAttributeForm/inputs/RelationshipElementInput.js +2 -0
- package/widgets/BatchAttributeForm/inputs/support/createBatchFormInputs.js +1 -1
- package/widgets/BatchAttributeForm/inputs/support/inputUtils.js +1 -1
- package/widgets/BatchAttributeForm/inputs/types.d.ts +4 -3
- package/widgets/BatchAttributeForm/templates/AttachmentElementTemplate.js +1 -1
- package/widgets/BatchAttributeForm/templates/RelationshipElementTemplate.js +2 -0
- package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
- package/widgets/BatchAttributeForm/templates/support/hashElementTemplate.js +1 -1
- package/widgets/BatchAttributeForm/templates/support/templateUtils.js +1 -1
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/CoordinateConversion/CoordinateConversionViewModel.d.ts +21 -1
- package/widgets/CoordinateConversion/CoordinateConversionViewModel.js +1 -1
- package/widgets/CoordinateConversion/support/Format.js +1 -1
- package/widgets/CoordinateConversion/support/coordinateConversionUtils.js +1 -1
- package/widgets/CoordinateConversion.d.ts +21 -1
- package/widgets/CoordinateConversion.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/SplitFeatureWorkflow.js +1 -1
- package/widgets/Editor/UpdateFeatureWorkflow.js +1 -1
- package/widgets/Editor/support/SketchController.js +1 -1
- package/widgets/Editor/workflowUtils.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/support/ContingentValuesManager.js +1 -1
- package/widgets/types.d.ts +1 -1
- package/assets/esri/core/workers/chunks/07eff82916681fcff069.js +0 -1
- package/assets/esri/core/workers/chunks/0b1454a77a6a682541dc.js +0 -2
- package/assets/esri/core/workers/chunks/1c7fd0a229a8112b0539.js +0 -596
- package/assets/esri/core/workers/chunks/3697e51e1e4cf442f39a.js +0 -1
- package/assets/esri/core/workers/chunks/3cce9dad8ee0e4971d50.js +0 -1
- package/assets/esri/core/workers/chunks/3df8493b91aa3bce824d.js +0 -1
- package/assets/esri/core/workers/chunks/68a313155ddc29bd024d.js +0 -1
- package/assets/esri/core/workers/chunks/751609831b283903ba48.js +0 -1
- package/assets/esri/core/workers/chunks/7bacdd65a6cc4d284e0a.js +0 -2
- package/assets/esri/core/workers/chunks/7e97684e851274efd11f.js +0 -1
- package/assets/esri/core/workers/chunks/85aac8539996372f1ee8.js +0 -1
- package/assets/esri/core/workers/chunks/99d298d0039c536fcf3e.js +0 -1
- package/assets/esri/core/workers/chunks/9aaf78b831f8739bc127.js +0 -1
- package/assets/esri/core/workers/chunks/9b9916864b6575c42c8a.js +0 -1
- package/assets/esri/core/workers/chunks/bf7e019437a3b6036300.js +0 -2
- package/assets/esri/core/workers/chunks/d304343a781acfa3ff96.js +0 -1
- package/assets/esri/core/workers/chunks/dbb9bb28696ff9536678.js +0 -2
- package/assets/esri/core/workers/chunks/f09a41ad239d467d9438.js +0 -2
- package/assets/esri/core/workers/chunks/f6912532aae1638cbe8f.js +0 -1
- /package/assets/esri/core/workers/chunks/{7bacdd65a6cc4d284e0a.js.LICENSE.txt → 10408183681fd6c7b4ed.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{f09a41ad239d467d9438.js.LICENSE.txt → 5818f1f526577068d6ca.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{dbb9bb28696ff9536678.js.LICENSE.txt → 7cdd0492b2191df95102.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{bf7e019437a3b6036300.js.LICENSE.txt → dacc2e5fa462495ed1cc.js.LICENSE.txt} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";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 p,initial as h,sync as m,whenOnce as f,syncAndInitial as g}from"../../core/reactiveUtils.js";import{generateBracedUUID as w}from"../../core/uuid.js";import{property as y,subclass as v}from"../../core/accessorSupport/decorators.js";import{isSharedTemplateOrMetadata as _,isSharedTemplate as F,getCreationAttributes as b,isStandardFeatureTemplate as M}from"../../editing/templateUtils.js";import{getFullTemplate as I}from"../../editing/sharedTemplates/templateLoader.js";import V from"../../layers/GraphicsLayer.js";import{isSceneLayer as k,isTable as S}from"../../layers/support/layerUtils.js";import{isNumber as C}from"../../support/guards.js";import{getDisplayedSymbol as T}from"../../symbols/support/symbolUtils.js";import{updateGraphicSymbolWhenRequired as A}from"../../views/draw/support/editingSessionUtils.js";import{getDrawHelpMessage as P}from"../../views/draw/support/helpMessageUtils.js";import E from"../../views/draw/support/HighlightHelper.js";import U from"../../views/interactive/sketch/SketchOptions.js";import H from"../../views/interactive/snapping/FeatureSnappingLayerSource.js";import{temporaryHighlightName as L}from"../../views/support/HighlightDefaults.js";import O from"./CreateFeaturesWorkflowData.js";import{isModelUpload as j,handleModelUpload as x}from"./modelUploadUtils.js";import D from"./Workflow.js";import{activeSketchToolDrawsUnsupportedCurve as z,createToolFromGeometryType as R,containsUnsupportedCurve as W,findEditorItemForLayer as G,getServiceEditsFromWorkflowData as N,getServiceInfoForLayer as K,orderEditsByRelationshipDependencies as Z,getServiceLayersById as q,startCreatingNewFeature as B,syncUpdateOptions as J,findLayerInfo as Q,isTerminalUpdateEventType as X,getVisualVariableAttributes as Y,startUpdatingFeatureGeometry as $,createWorkflowSteps as ee,avoidFeatureTemplateSelectionWithOnlyOneItem as te,setUpSketchCreateWatchers as ae,setRelationshipFields as ie,prepareAttachmentsForCreateFeaturesWorkflow as re,showProgressCursor as se,setVisualVariablesAndElevationInfoForUpdate as oe,visualVariableInteractiveUpdate as ne}from"./workflowUtils.js";import le from"../FeatureForm/FeatureFormViewModel.js";import de from"../Sketch/SketchViewModel.js";var ce;const ue=Symbol(),pe=Symbol(),he=Symbol(),me=Symbol(),fe={point:["point"],multipoint:["multipoint"],polygon:["polygon","freehandPolygon","rectangle","circle"],polyline:["polyline","freehandPolyline"],mesh:[],multipatch:[]};let ge=ce=class extends D{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._formViewModel=new le,this._sketchLayer=null,this._sketchViewModel=null,this._attachmentFileInfos=new Map,this._isActive=!0}initialize(){this.isNested&&(this._isActive=!1),this._initializeSketchViewModel()}destroy(){this._sketchViewModel.destroy()}get allowSave(){return!this.updating}get curveResizeDisabled(){return this.data.curveResizeDisabled}get curveUpdatesDisabled(){return this.data.curveUpdatesDisabled}get formViewModel(){return this._formViewModel}get hasInvalidFormTemplate(){return!!this.data.editorItem?.hasInvalidFormTemplate}get hasPendingEdits(){if(this.pendingFeatures.some(e=>!!this.data.getEditsForPendingFeature(e)?.modified))return!0;const{creationInfo:e,upload:t}=this.data,{activeComponent:a,createGraphic:i}=this._sketchViewModel,r=i?.geometry?.type;return!("polyline"!==r&&"polygon"!==r&&"multipoint"!==r||"draw-2d"!==a?.type&&"draw-3d"!==a?.type)&&a.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&&!j(this.data.creationInfo)}get helpMessage(){const{creationInfo:e,viewModel:t}=this.data;if("creating-features"!==this.stepId||!e)return;const{_sketchViewModel:a}=this,{drawTool:i,isUsingLegacyCreateTools:r}=a;if(!r)return i?.helpMessageKey??"noTool";const s=e.layer.geometryType,o=a.createGraphic;if("mesh"===s){this._getDrawMeshHelpMessage||import("../../views/draw/support/helpMessageUtils3d.js").then(e=>{this._getDrawMeshHelpMessage=e.getDrawMeshHelpMessage});const{view:e}=t;return"3d"===e?.type?this._getDrawMeshHelpMessage?.(o,e):void 0}const{activeCreateToolDrawMode:n,activeTool:l}=a;return P("rectangle"===l||"circle"===l?l:s,o?.geometry,n)}get noticeMessage(){if(z(this._sketchViewModel,this.data.editorItem))return"curveToolDensifyWarning"}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 pendingFeatures(){return this.data.pendingFeatures}get keyboardCancellationEnabled(){return 0===this.numPendingFeatures}get reliesOnOwnerAdminPrivileges(){return this.data.editorItem?.capabilities.create.reliesOnOwnerAdminPrivileges??!1}get saveActionLabel(){return"create"}get shouldShowAttachments(){return(this.data.selectedPendingFeature&&this.data.editorItem?.capabilities.create.attachments.enabled)??!1}get shouldAllowAttachmentEditing(){return this.shouldShowAttachments}get sketchUpdateOptions(){const{editorItem:e}=this.data;return{enableScaling:!this.curveResizeDisabled,multipleSelectionEnabled:!1,reshapeOptions:{enableCreateCurveFromStraightEdge:!k(e?.layer)&&!!e?.capabilities.supportsTrueCurve}}}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(_(this.data.fullTemplate)){const{tool:t}=R(e,this.data.fullTemplate);return[t]}return"2d"!==t?.type&&"multipoint"===e?[]:[...fe[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)}getUpdating(){return!!this._sketchViewModel?.updating}async enter(){this._isActive=!0,"awaiting-feature-creation-info"!==this.stepId&&await this._updatingHandles.addPromise(this._setUpCreatingFeaturesStep())}exit(){this._isActive=!1,this.removeHandles([he])}async updatePendingFeature(e){if(e!==this.data.selectedPendingFeature)return this._sketchViewModel.cancel(),this._startUpdating({feature:e})}async start(){return await super.start(),S(this.data.creationInfo?.layer)?null:{enter:async()=>{},exit:async()=>{},viewModel:this._sketchViewModel}}async save(e){const{formViewModel:t}=this;if(t.pendingSubtypeChoice)return;t.submit(),this._stashValidationState();const a=this.data.selectedPendingFeature,i=this._hasValidationErrors(a)?a:this.data.pendingFeatures.find(e=>this._hasValidationErrors(e));if(i)return await this._startUpdating({feature:i}),void t?.submit();const{pendingFeatures:r,editorItem:s}=this.data;if(s&&e&&W(r.toArray(),s)){if(!await e("curveEditingDensifyPrompt"))return this.reset()}return super.save()}back(e){return"update-pending"!==this.createFeatureState||!this.data.selectedPendingFeature||j(this.data.creationInfo)||this._attachmentsActive||this.parent?super.back(e):this._clearSelectedFeature()}previous(e){return"update-pending"!==this.createFeatureState||!this.data.selectedPendingFeature||j(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.removeGraphic(e))}static create(e){const{addAttachmentsCallback:t,applyEdits:a,applyEditsFeatureService:i,isNested:r,creationInfo:s,parent:o,snappingManager:n,startAt:l,viewModel:d}=e,c=e.sketchOptions??new U,u=s?.layer,p=u?G(d.editorItems,u):void 0,h=new ce({data:new O({creationInfo:s,editorItem:p,parent:o,sketchOptions:c,snappingManager:n,viewModel:d}),isNested:r,onCommit:async e=>{const{creationInfo:r}=e;if(!r)return;h._sketchViewModel.cancel();const s=e.pendingFeatures.toArray(),{layer:o}=r,n=o.capabilities?.editing.supportsGlobalId&&"globalIdField"in o,l=h._attachmentFileInfos,{fullTemplate:c}=e,u=N(h.data),p=F(c)&&u;if(n){if(_e(s),p){let t=be(u,l);const a=await(K(o,d.view)?.load());a&&(t=Z({edits:t,serviceInfo:a,view:d.view,findOriginalFeature:t=>e.getEditsForPendingFeature(t)?.initialFeature??t})),await i(c.featureService,t,{globalIdUsed:!0,honorSequenceOfEdits:!0,gdbVersion:c.layer.gdbVersion??void 0})}else{const e=Fe(s,l);await a(o,e,{globalIdUsed:!0})}return}const m=p?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,ve(s,e.addFeatureResults,o,l))}))}});return h._set("steps",this._createWorkflowSteps(h,l)),h}_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 I(a,t.template);if(e.fullTemplate=i,i&&F(i)){const{createTemplateExecutor:r}=await import("../../editing/sharedTemplates/executor/createTemplateExecutor.js"),s={completionResults:[],executor:await r(i),serviceLayersById:q(t.layer,a)};e.templateExecutorInfo=s}return i}async _startCreating(){this.removeHandles(pe);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 B(this._sketchViewModel,this._sketchLayer,e,this._webStyleCache)}async _clearSelectedFeature(){const e=this._formViewModel.pendingSubtypeChoice;e&&(e.resolve("undo"),await e.promise),this._stashValidationState(),this.sketchViewModel.cancel(),this.data.selectedPendingFeature=null,this._featureFormHandle=n(this._featureFormHandle),this._formViewModel.feature=null;const t=this.data.viewModel.attachmentsViewModel;"add"!==t.mode&&"edit"!==t.mode||await(this.data.viewModel.activeWorkflow?.previous())}_stashValidationState(){const e=this._formViewModel.feature,t=e&&this.data.getEditsForPendingFeature(e);t&&(t.submittable=this._formViewModel.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{_formViewModel:o,_sketchViewModel:l,sketchUpdateOptions:d}=this,{creationInfo:c,viewModel:p}=a,{attachmentsViewModel:h,layerInfos:m,view:f}=p;if(!f||!c)return;J(l,d),n(this._featureFormHandle);const g=e.sourceLayer,w=Q(m,g),y=w?.formTemplate,v=f.spatialReference;o.set({editType:"INSERT",feature:e,formTemplate:y,spatialReference:v,map:f.map}),"add"!==h.mode&&"edit"!==h.mode||await(p.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 A(e,s,"2d"===f.type?f.scale:null);const _=a.getEditsForPendingFeature(e);this._featureFormHandle=r([o.on("value-change",async({fieldName:t,value:a})=>{if(_?.updateAttributes(o.getValues()),C(a)){const e=this._visualVariableAttributes;e.size&&!e.size.isUpdatingInteractively&&t===e.size.field&&e.size.setInitialValue(a),e.rotation&&!e.rotation.isUpdatingInteractively&&t===e.rotation.field&&e.rotation.setInitialValue(a)}await A(e,s,"2d"===f.type?f.scale:null)}),l.on(["update","undo","redo"],e=>{("undo"===e.type||"redo"===e.type||"update"===e.type&&null!=e.toolEventInfo&&X(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{_sketchLayer:a,_sketchViewModel:i,data:r}=this,{creationInfo:s,viewModel:o}=r,{view:n}=o;if(!n||!s)return;const l=e.sourceLayer??s.layer;return S(l)?void 0:(this._visualVariableAttributes=Y(e),$({graphic:e,sketchLayer:a,sketchViewModel:i,sourceLayer:l,updateOptions:this.sketchUpdateOptions,visualVariables:this._visualVariableAttributes,webStyleCache:this._webStyleCache}))}static _createWorkflowSteps(e,t="awaiting-feature-creation-info"){const{data:a}=e,i=ee(["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&&(j(t)?e.addHandles(await x({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([he,ue,pe,me]),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 te(a,i)}static _configureSketchViewModel(e){const{data:t,_sketchLayer:a,_sketchViewModel:s,_webStyleCache:o}=e,{creationInfo:n,viewModel:l}=t,{view:d}=l,h=[];if(!d)return i();if("2d"===d.type){n&&h.push(e._fadeExistingFeatures(n.layer));const t=c((e,t)=>Promise.all(e.map(e=>A(e,o,t))));h.push(u(()=>d.scale,e=>t(a.graphics,e)))}const m=b(t.fullTemplate,n?.attributeOverrides,n?.layer),f=u(()=>s.createGraphic&&s.activeComponent,()=>{s.createGraphic&&s.activeComponent&&!e.hasHandles(pe)&&e._updatingHandles.consumePromise(ae({creationAttributes:m,data:t,sketchViewModel:s,view:d,webStyleCache:o}).then(t=>e.addHandles(t,pe)))}),g=async t=>{if("cancel"!==t.state&&"complete"!==t.state||e.removeHandles(pe),"cancel"===t.state&&null!==d.activeTool&&d.activeTool!==e.sketchViewModel.activeComponent&&(await e._waitForActiveToolCleared(),await e._startCreating()),"complete"===t.state&&t.graphic){const a=await e._processEdits(t.graphic,{scale:"2d"===d.type?d.scale:null,useSourceLayer:!0,webStyleCache:e._webStyleCache});a&&(await e._waitForActiveToolCleared(),await e._startUpdating({feature:a}))}},w=async i=>{const{attachmentsViewModel:r}=l,{_formViewModel:o}=e;if(i.graphics.length>1)return void await e._clearSelectedFeature();const c=i.graphics[0];if("complete"===i.state){const{submittable:t}=o;if(e.numPendingFeatures!==n?.maxFeatures&&t||o.submit(),await e._clearSelectedFeature(),"add"!==r.mode&&"edit"!==r.mode||await(l.activeWorkflow?.previous()),!i.aborted&&d.activeTool===e.sketchViewModel.activeComponent&&(await e.sketchViewModel.wait(),"ready"===e.sketchViewModel.state&&"mesh"!==e.data.creationInfo?.layer.geometryType))return e._startCreating()}else{if("start"===i.state)return c.sourceLayer??=t.creationInfo?.layer,await oe({graphic:c,sketchLayer:a,sketchViewModel:s,visualVariables:e._visualVariableAttributes,webStyleCache:e._webStyleCache,sourceLayer:c.sourceLayer}),e._selectFeatureForUpdate({feature:c});if("active"===i.state){await e.updatePendingFeature(c);const t=e._visualVariableAttributes;ne(d,c,i,t)&&await A(c,e._webStyleCache,"2d"===d.type?d.scale:null);const a=c.attributes,{rotation:r,size:s}=t;if(null!=r){const{field:e}=r;o.setValue(e,a[e])}if(null!=s){const{field:e}=s;o.setValue(e,a[e])}}}},y=async a=>{if(a.graphics.forEach(e=>{t.removePendingFeature(e)}),!j(t.creationInfo))return e._startCreating()},v=async()=>{if(j(t.creationInfo))try{await e.data.viewModel.back()}catch{}return e._startCreating()};h.push(f,s.on("create",t=>e._updatingHandles.addPromise(g(t))),s.on("update",t=>e._updatingHandles.addPromise(w(t))),s.on("delete",t=>e._updatingHandles.addPromise(y(t))),p(()=>!e.numPendingFeatures,()=>e._updatingHandles.addPromise(v())),i(()=>{s.cancel()}),we(s,a,t),...ye(t));const _=r(h);return s.addHandles(_),_}_initializeSketchViewModel(){const{data:e}=this,{view:t}=e.viewModel,a=new V({elevationInfo:e.creationInfo?.layer.elevationInfo,internal:!0,listMode:"hide",title:"createFeaturesWorkflow-internal"}),r=new de({layer:a,creationMode:"single",sketchOptions:e.sketchOptions,snappingManager:e.snappingManager,useLegacyCreateTools:e.viewModel.useLegacyCreateTools,updateOnGraphicClick:!1,defaultUpdateOptions:this.sketchUpdateOptions,view:t});this._sketchLayer=a,this._sketchViewModel=r,t?.map.add(a),this.addHandles([i(()=>{t?.destroyed||t?.map.remove(a),l(a)}),u(()=>this.numPendingFeatures>0,e=>this._sketchViewModel.updateOnGraphicClick=e,h),u(()=>this.sketchUpdateOptions,e=>{r.defaultUpdateOptions=e,J(r,e)},m)])}_hasValidationErrors(e){return!!e&&(!this.data.isSubmittable(e)||!!this._formViewModel.validateContingencyConstraints(e.attributes,{includeIncompleteViolations:!0})?.length)}async _processEdits(e,t){const{data:a,_formViewModel:i,_sketchLayer:r}=this,{layerInfos:s,view:o}=a.viewModel;i.editType="INSERT",i.map=o?.map,i.spatialReference=o?.spatialReference;const{templateExecutorInfo:n}=a;if(!n){const t=e.clone();return t.geometry=null,await this._addAndInitializeEdits(e,t),e}r.remove(e);const{executor:l}=n,c=l(e.geometry,"completion"),u=d(c)?await c:c;n.completionResults.push(u),ie(u.relationships),i.editType="INSERT",i.map=o?.map,i.spatialReference=o?.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 T(a,t),r.add(a)),a.sourceLayer!==e?.layer&&(e=Q(s,a.sourceLayer));const o=!!u.associationGraphics?.has(a);await this._addAndInitializeEdits(a,i,e,o)}}i.feature=null,await f(()=>!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,_formViewModel:s}=this,{layerInfos:o}=r.viewModel,n=r.addPendingFeature(e,t,{isAssociation:i});a??=Q(o,e.sourceLayer),s.feature=e,s.formTemplate=a?.formTemplate,await f(()=>!s.updating),n.updateAttributes(s.getValues()),n.submittable=s.submittable}async _setUpCreatingFeaturesStep(){if(this.hasHandles(he))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:p,layer:m}=o,f=[],g=[];this._featureFormHandle=n(this._featureFormHandle),this._visualVariableAttributes={rotation:null,size:null},e.editorItem=G(l.editorItems,o.layer),o.template&&(null==e.fullTemplate&&await this._initializeFullTemplateAndExecutorInfo(e),g.push(i(()=>{e.templateExecutorInfo&&(e.templateExecutorInfo.completionResults=[])}))),s.allowDeleteKey=!e.isSharedTemplateWorkflow,re(d),f.push(u(()=>d.mode,e=>{switch(e){case"add":this.go("adding-attachment");break;case"edit":this.go("editing-attachment")}}));const w=se(c);f.push(w);const y=S(o.layer),{template:v}=o,F=!v||M(v)||_(v)&&"feature"===v.type,I=y&&F;try{if(I){const a=p??new t({attributes:b(e.fullTemplate,o.attributeOverrides,m),sourceLayer:m}),i=await this._processEdits(a);i&&await this._startUpdating({feature:i})}else f.push(ce._configureSketchViewModel(this)),p?(j(o)&&o.geometryToPlace&&(p.attributes=b(e.fullTemplate,o.attributeOverrides,m)),s.addGraphic(p),await this._startUpdating({feature:p})):await this._startCreating()}finally{w.remove()}const V=i(()=>{for(const t of e.pendingFeatures)s.removeGraphic(t),e.removePendingFeature(t)}),k=u(()=>c?.timeZone,e=>{this._formViewModel.timeZone=e,this.data.timeZone=e},h),C=i(()=>{j(o)&&l.cancelWorkflow({warnIfNoWorkflow:!1})});this._featureFormHandle&&f.push(this._featureFormHandle),this.addHandles(f,this._handleKeys.beforeCommit),this.addHandles(g,this._handleKeys.afterCommit),this.addHandles([i(()=>d.fileInfos.removeAll()),r(f),r(g),C,V,k],he)}async _waitForActiveToolCleared(){const e=this.data.viewModel.view;if(null==e?.activeTool)return;const t=new AbortController;this.addHandles(s(t),me),await f(()=>null==e?.activeTool,t.signal),t.abort()}};function we(e,t,a){let s=null;const o=()=>e.snappingOptions.featureSources,n=()=>(s=new H({layer:t}),o().add(s),s),d=()=>{null!=s&&(o().remove(s),s=l(s))};return r([u(()=>{const e=a.creationInfo?.layer,t=o().find(t=>t.layer===e);return{hasFeatureLayerSource:!!t,enabled:t?.enabled??!1}},({hasFeatureLayerSource:e,enabled:t})=>{if(!e)return d();s??=n(),s.enabled=t},g),i(d)])}function ye(e){const t=e.viewModel.view;if(!t)return[];const a=[];if("3d"===t.type){const r=new E({view:t});a.push(u(()=>e.selectedPendingFeature,(e,t)=>{r.remove(e),r.add(t)}),i(()=>r.destroy()))}const r=new E({view:t,highlightName:L});return a.push(u(()=>e.temporaryHighlightFeature,e=>{r.removeAll(),r.add(e)}),i(()=>r.destroy())),a}function ve(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 _e(e){for(const t of e){const{sourceLayer:e}=t;e&&"globalIdField"in e&&null!=e.globalIdField&&(t.attributes[e.globalIdField]??=w())}}function Fe(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 be(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([y()],ge.prototype,"allowSave",null),e([y()],ge.prototype,"createFeatureState",void 0),e([y()],ge.prototype,"curveResizeDisabled",null),e([y()],ge.prototype,"curveUpdatesDisabled",null),e([y()],ge.prototype,"data",void 0),e([y({constructOnly:!0})],ge.prototype,"isNested",void 0),e([y()],ge.prototype,"formViewModel",null),e([y()],ge.prototype,"hasInvalidFormTemplate",null),e([y()],ge.prototype,"hasPendingEdits",null),e([y()],ge.prototype,"hasPreviousStep",null),e([y()],ge.prototype,"_getDrawMeshHelpMessage",void 0),e([y()],ge.prototype,"helpMessage",null),e([y()],ge.prototype,"noticeMessage",null),e([y()],ge.prototype,"layer",null),e([y()],ge.prototype,"parent",null),e([y()],ge.prototype,"keyboardCancellationEnabled",null),e([y()],ge.prototype,"reliesOnOwnerAdminPrivileges",null),e([y()],ge.prototype,"saveActionLabel",null),e([y()],ge.prototype,"shouldShowAttachments",null),e([y()],ge.prototype,"shouldAllowAttachmentEditing",null),e([y()],ge.prototype,"sketchUpdateOptions",null),e([y()],ge.prototype,"sketchViewModel",null),e([y()],ge.prototype,"availableCreateTools",null),e([y()],ge.prototype,"_attachmentsActive",null),ge=ce=e([v("esri.widgets.Editor.CreateFeaturesWorkflow")],ge);const Me=ge;export{Me as default};
|
|
2
|
+
import{__decorate as e}from"tslib";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 n from"../../core/Logger.js";import{removeMaybe as o,destroyMaybe as l}from"../../core/maybe.js";import{isPromiseLike as d,debounce as c}from"../../core/promiseUtils.js";import{watch as u,initial as p,sync as h,whenOnce as m,syncAndInitial as f}from"../../core/reactiveUtils.js";import{generateBracedUUID as g}from"../../core/uuid.js";import{property as w,subclass as y}from"../../core/accessorSupport/decorators.js";import{isSharedTemplateOrMetadata as v,isSharedTemplate as _,getCreationAttributes as F,isStandardFeatureTemplate as b}from"../../editing/templateUtils.js";import{getFullTemplate as M}from"../../editing/sharedTemplates/templateLoader.js";import I from"../../layers/GraphicsLayer.js";import{isSceneLayer as V,isTable as k}from"../../layers/support/layerUtils.js";import{isNumber as S}from"../../support/guards.js";import{getDisplayedSymbol as T}from"../../symbols/support/symbolUtils.js";import{updateGraphicSymbolWhenRequired as C}from"../../views/draw/support/editingSessionUtils.js";import{getDrawHelpMessage as A}from"../../views/draw/support/helpMessageUtils.js";import P from"../../views/draw/support/HighlightHelper.js";import E from"../../views/interactive/sketch/SketchOptions.js";import U from"../../views/interactive/snapping/FeatureSnappingLayerSource.js";import{temporaryHighlightName as H}from"../../views/support/HighlightDefaults.js";import L from"./CreateFeaturesWorkflowData.js";import{isModelUpload as O,handleModelUpload as j}from"./modelUploadUtils.js";import x from"./Workflow.js";import{activeSketchToolDrawsUnsupportedCurve as D,createToolFromGeometryType as z,containsUnsupportedCurve as R,findEditorItemForLayer as W,getServiceEditsFromWorkflowData as G,getServiceInfoForLayer as N,orderEditsByRelationshipDependencies as K,getServiceLayersById as Z,startCreatingNewFeature as q,syncUpdateOptions as B,findLayerInfo as J,isTerminalUpdateEventType as Q,getVisualVariableAttributes as X,startUpdatingFeatureGeometry as Y,createWorkflowSteps as $,avoidFeatureTemplateSelectionWithOnlyOneItem as ee,setUpSketchCreateWatchers as te,setRelationshipFields as ae,prepareAttachmentsForCreateFeaturesWorkflow as ie,showProgressCursor as re,setVisualVariablesAndElevationInfoForUpdate as se,visualVariableInteractiveUpdate as ne}from"./workflowUtils.js";import oe from"../FeatureForm/FeatureFormViewModel.js";import le from"../Sketch/SketchViewModel.js";var de;const ce=Symbol(),ue=Symbol(),pe=Symbol(),he=Symbol(),me={point:["point"],multipoint:["multipoint"],polygon:["polygon","freehandPolygon","rectangle","circle"],polyline:["polyline","freehandPolyline"],mesh:[],multipatch:[]};let fe=de=class extends x{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._formViewModel=new oe,this._sketchLayer=null,this._sketchViewModel=null,this._attachmentFileInfos=new Map,this._isActive=!0}initialize(){this.isNested&&(this._isActive=!1),this._initializeSketchViewModel()}destroy(){this._sketchViewModel.destroy()}get allowSave(){return!this.updating}get curveResizeDisabled(){return this.data.curveResizeDisabled}get curveUpdatesDisabled(){return this.data.curveUpdatesDisabled}get formViewModel(){return this._formViewModel}get hasInvalidFormTemplate(){return!!this.data.editorItem?.hasInvalidFormTemplate}get hasPendingEdits(){if(this.pendingFeatures.some(e=>!!this.data.getEditsForPendingFeature(e)?.modified))return!0;const{creationInfo:e,upload:t}=this.data,{activeComponent:a,createGraphic:i}=this._sketchViewModel,r=i?.geometry?.type;return!("polyline"!==r&&"polygon"!==r&&"multipoint"!==r||"draw-2d"!==a?.type&&"draw-3d"!==a?.type)&&a.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&&!O(this.data.creationInfo)}get helpMessage(){const{creationInfo:e,viewModel:t}=this.data;if("creating-features"!==this.stepId||!e)return;const{_sketchViewModel:a}=this,{drawTool:i,isUsingLegacyCreateTools:r}=a;if(!r)return i?.helpMessageKey??"noTool";const s=e.layer.geometryType,n=a.createGraphic;if("mesh"===s){this._getDrawMeshHelpMessage||import("../../views/draw/support/helpMessageUtils3d.js").then(e=>{this._getDrawMeshHelpMessage=e.getDrawMeshHelpMessage});const{view:e}=t;return"3d"===e?.type?this._getDrawMeshHelpMessage?.(n,e):void 0}const{activeCreateToolDrawMode:o,activeTool:l}=a;return A("rectangle"===l||"circle"===l?l:s,n?.geometry,o)}get noticeMessage(){if(D(this._sketchViewModel,this.data.editorItem))return"curveToolDensifyWarning"}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 pendingFeatures(){return this.data.pendingFeatures}get keyboardCancellationEnabled(){return 0===this.numPendingFeatures}get reliesOnOwnerAdminPrivileges(){return this.data.editorItem?.capabilities.create.reliesOnOwnerAdminPrivileges??!1}get saveActionLabel(){return"create"}get shouldShowAttachments(){return(this.data.selectedPendingFeature&&this.data.editorItem?.capabilities.create.attachments.enabled)??!1}get shouldAllowAttachmentEditing(){return this.shouldShowAttachments}get sketchUpdateOptions(){const{editorItem:e}=this.data;return{enableScaling:!this.curveResizeDisabled,multipleSelectionEnabled:!1,reshapeOptions:{enableCreateCurveFromStraightEdge:!V(e?.layer)&&!!e?.capabilities.supportsTrueCurve}}}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}=z(e,this.data.fullTemplate);return[t]}return"2d"!==t?.type&&"multipoint"===e?[]:[...me[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)}getUpdating(){return!!this._sketchViewModel?.updating}async enter(){this._isActive=!0,"awaiting-feature-creation-info"!==this.stepId&&await this._updatingHandles.addPromise(this._setUpCreatingFeaturesStep())}exit(){this._isActive=!1,this.removeHandles([pe])}async updatePendingFeature(e){if(e!==this.data.selectedPendingFeature)return this._sketchViewModel.cancel(),this._startUpdating({feature:e})}async start(){return await super.start(),k(this.data.creationInfo?.layer)?null:{enter:async()=>{},exit:async()=>{},viewModel:this._sketchViewModel}}async save(e){const{formViewModel:t}=this;if(t.pendingSubtypeChoice)return;t.submit(),this._stashValidationState();const a=this.data.selectedPendingFeature,i=this._hasValidationErrors(a)?a:this.data.pendingFeatures.find(e=>this._hasValidationErrors(e));if(i)return await this._startUpdating({feature:i}),void t?.submit();const{pendingFeatures:r,editorItem:s}=this.data;if(s&&e&&R(r.toArray(),s)){if(!await e("curveEditingDensifyPrompt"))return this.reset()}return super.save()}back(e){return"update-pending"!==this.createFeatureState||!this.data.selectedPendingFeature||O(this.data.creationInfo)||this._attachmentsActive||this.parent?super.back(e):this._clearSelectedFeature()}previous(e){return"update-pending"!==this.createFeatureState||!this.data.selectedPendingFeature||O(this.data.creationInfo)||this._attachmentsActive?super.previous(e):this._clearSelectedFeature()}cancelFeature(e){this.data.isSharedTemplateWorkflow?n.getLogger(this).warn("Cannot cancel individual features created by shared templates."):(this.data.removePendingFeature(e),this.sketchViewModel.removeGraphic(e))}static create(e){const{addAttachmentsCallback:t,applyEdits:a,applyEditsFeatureService:i,isNested:r,creationInfo:s,parent:n,snappingManager:o,startAt:l,viewModel:d}=e,c=e.sketchOptions??new E,u=s?.layer,p=u?W(d.editorItems,u):void 0,h=new de({data:new L({creationInfo:s,editorItem:p,parent:n,sketchOptions:c,snappingManager:o,viewModel:d}),isNested:r,onCommit:async e=>{const{creationInfo:r}=e;if(!r)return;h._sketchViewModel.cancel();const s=e.pendingFeatures.toArray(),{layer:n}=r,o=n.capabilities?.editing.supportsGlobalId&&"globalIdField"in n,l=h._attachmentFileInfos,{fullTemplate:c}=e,u=G(h.data),p=_(c)&&u;if(o){if(ve(s),p){let t=Fe(u,l);const a=await(N(n,d.view)?.load());a&&(t=K({edits:t,serviceInfo:a,view:d.view,findOriginalFeature:t=>e.getEditsForPendingFeature(t)?.initialFeature??t})),await i(c.featureService,t,{globalIdUsed:!0,honorSequenceOfEdits:!0,gdbVersion:c.layer.gdbVersion??void 0})}else{const e=_e(s,l);await a(n,e,{globalIdUsed:!0})}return}const m=p?await i(c.featureService,u,{gdbVersion:c.layer.gdbVersion??void 0}):[await a(n,{addFeatures:s})];m&&l.size>0&&await Promise.all(m.map(e=>{if(e?.addFeatureResults)return t(n,ye(s,e.addFeatureResults,n,l))}))}});return h._set("steps",this._createWorkflowSteps(h,l)),h}_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 M(a,t.template);if(e.fullTemplate=i,i&&_(i)){const{createTemplateExecutor:r}=await import("../../editing/sharedTemplates/executor/createTemplateExecutor.js"),s={completionResults:[],executor:await r(i),serviceLayersById:Z(t.layer,a)};e.templateExecutorInfo=s}return i}async _startCreating(){this.removeHandles(ue);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 q(this._sketchViewModel,this._sketchLayer,e,this._webStyleCache)}async _clearSelectedFeature(){const e=this._formViewModel.pendingSubtypeChoice;e&&(e.resolve("undo"),await e.promise),this._stashValidationState(),this.sketchViewModel.cancel(),this.data.selectedPendingFeature=null,this._featureFormHandle=o(this._featureFormHandle),this._formViewModel.feature=null;const t=this.data.viewModel.attachmentsViewModel;"add"!==t.mode&&"edit"!==t.mode||await(this.data.viewModel.activeWorkflow?.previous())}_stashValidationState(){const e=this._formViewModel.feature,t=e&&this.data.getEditsForPendingFeature(e);t&&(t.submittable=this._formViewModel.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{_formViewModel:n,_sketchViewModel:l,sketchUpdateOptions:d}=this,{creationInfo:c,viewModel:p}=a,{attachmentsViewModel:h,layerInfos:m,view:f}=p;if(!f||!c)return;B(l,d),o(this._featureFormHandle);const g=e.sourceLayer,w=J(m,g),y=w?.formTemplate,v=f.spatialReference;n.set({editType:"INSERT",feature:e,formTemplate:y,spatialReference:v,map:f.map}),"add"!==h.mode&&"edit"!==h.mode||await(p.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 C(e,s,"2d"===f.type?f.scale:null);const _=a.getEditsForPendingFeature(e);this._featureFormHandle=r([n.on("value-change",async({fieldName:t,value:a})=>{if(_?.updateAttributes(n.getValues()),S(a)){const e=this._visualVariableAttributes;e.size&&!e.size.isUpdatingInteractively&&t===e.size.field&&e.size.setInitialValue(a),e.rotation&&!e.rotation.isUpdatingInteractively&&t===e.rotation.field&&e.rotation.setInitialValue(a)}await C(e,s,"2d"===f.type?f.scale:null)}),l.on(["update","undo","redo"],e=>{("undo"===e.type||"redo"===e.type||"update"===e.type&&null!=e.toolEventInfo&&Q(e.toolEventInfo.type))&&n.notifyFeatureGeometryChanged()}),u(()=>n.feature?.sourceLayer,t=>e.sourceLayer=t),u(()=>[n.feature,n.submittable],()=>this._stashValidationState())]),this.createFeatureState="update-pending"}async _startUpdating({feature:e,initialFeature:t=e}){await this._selectFeatureForUpdate({feature:e,initialFeature:t});const{_sketchLayer:a,_sketchViewModel:i,data:r}=this,{creationInfo:s,viewModel:n}=r,{view:o}=n;if(!o||!s)return;const l=e.sourceLayer??s.layer;return k(l)?void 0:(this._visualVariableAttributes=X(e),Y({graphic:e,sketchLayer:a,sketchViewModel:i,sourceLayer:l,updateOptions:this.sketchUpdateOptions,visualVariables:this._visualVariableAttributes,webStyleCache:this._webStyleCache}))}static _createWorkflowSteps(e,t="awaiting-feature-creation-info"){const{data:a}=e,i=$(["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&&(O(t)?e.addHandles(await j({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([pe,ce,ue,he]),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 ee(a,i)}static _configureSketchViewModel(e){const{data:t,_sketchLayer:a,_sketchViewModel:s,_webStyleCache:n}=e,{creationInfo:o,viewModel:l}=t,{view:d}=l,p=[];if(!d)return i();if("2d"===d.type){o&&p.push(e._fadeExistingFeatures(o.layer));const t=c((e,t)=>Promise.all(e.map(e=>C(e,n,t))));p.push(u(()=>d.scale,e=>t(a.graphics,e)))}const h=F(t.fullTemplate,o?.attributeOverrides,o?.layer),m=u(()=>s.createGraphic&&s.activeComponent,()=>{s.createGraphic&&s.activeComponent&&!e.hasHandles(ue)&&e._updatingHandles.consumePromise(te({creationAttributes:h,data:t,sketchViewModel:s,view:d,webStyleCache:n}).then(t=>e.addHandles(t,ue)))}),f=async t=>{if("cancel"!==t.state&&"complete"!==t.state||e.removeHandles(ue),"cancel"===t.state&&null!==d.activeTool&&d.activeTool!==e.sketchViewModel.activeComponent&&(await e._waitForActiveToolCleared(),await e._startCreating()),"complete"===t.state&&t.graphic){const a=await e._processEdits(t.graphic,{scale:"2d"===d.type?d.scale:null,useSourceLayer:!0,webStyleCache:e._webStyleCache});a&&(await e._waitForActiveToolCleared(),await e._startUpdating({feature:a}))}},g=async i=>{const{attachmentsViewModel:r}=l,{_formViewModel:n}=e;if(i.graphics.length>1)return void await e._clearSelectedFeature();const c=i.graphics[0];if("complete"===i.state){const{submittable:t}=n;if(e.numPendingFeatures!==o?.maxFeatures&&t||n.submit(),await e._clearSelectedFeature(),"add"!==r.mode&&"edit"!==r.mode||await(l.activeWorkflow?.previous()),null==e.data.selectedPendingFeature&&(null==d.activeTool||d.activeTool===e.sketchViewModel.activeComponent)&&(await e.sketchViewModel.wait(),"ready"===e.sketchViewModel.state&&"mesh"!==e.data.creationInfo?.layer.geometryType))return e._startCreating()}else{if("start"===i.state)return c.sourceLayer??=t.creationInfo?.layer,await se({graphic:c,sketchLayer:a,sketchViewModel:s,visualVariables:e._visualVariableAttributes,webStyleCache:e._webStyleCache,sourceLayer:c.sourceLayer}),e._selectFeatureForUpdate({feature:c});if("active"===i.state){await e.updatePendingFeature(c);const t=e._visualVariableAttributes;ne(d,c,i,t)&&await C(c,e._webStyleCache,"2d"===d.type?d.scale:null);const a=c.attributes,{rotation:r,size:s}=t;if(null!=r){const{field:e}=r;n.setValue(e,a[e])}if(null!=s){const{field:e}=s;n.setValue(e,a[e])}}}},w=async a=>{if(a.graphics.forEach(e=>{t.removePendingFeature(e)}),!O(t.creationInfo))return e._startCreating()},y=async()=>{if(O(t.creationInfo))try{await e.data.viewModel.back()}catch{}return e._startCreating()};p.push(m,s.on("create",t=>e._updatingHandles.addPromise(f(t))),s.on("update",t=>e._updatingHandles.addPromise(g(t))),s.on("delete",t=>e._updatingHandles.addPromise(w(t))),e._updatingHandles.addWhen(()=>!e.numPendingFeatures,()=>e._updatingHandles.addPromise(y())),i(()=>{s.cancel()}),ge(s,a,t),...we(t));const v=r(p);return s.addHandles(v),v}_initializeSketchViewModel(){const{data:e}=this,{view:t}=e.viewModel,a=new I({elevationInfo:e.creationInfo?.layer.elevationInfo,internal:!0,listMode:"hide",title:"createFeaturesWorkflow-internal"}),r=new le({layer:a,creationMode:"single",sketchOptions:e.sketchOptions,snappingManager:e.snappingManager,useLegacyCreateTools:e.viewModel.useLegacyCreateTools,updateOnGraphicClick:!1,defaultUpdateOptions:this.sketchUpdateOptions,view:t});this._sketchLayer=a,this._sketchViewModel=r,t?.map.add(a),this.addHandles([i(()=>{t?.destroyed||t?.map.remove(a),l(a)}),u(()=>this.numPendingFeatures>0,e=>this._sketchViewModel.updateOnGraphicClick=e,p),u(()=>this.sketchUpdateOptions,e=>{r.defaultUpdateOptions=e,B(r,e)},h)])}_hasValidationErrors(e){return!!e&&(!this.data.isSubmittable(e)||!!this._formViewModel.validateContingencyConstraints(e.attributes,{includeIncompleteViolations:!0})?.length)}async _processEdits(e,t){const{data:a,_formViewModel:i,_sketchLayer:r}=this,{layerInfos:s,view:n}=a.viewModel;i.editType="INSERT",i.map=n?.map,i.spatialReference=n?.spatialReference;const{templateExecutorInfo:o}=a;if(!o){const t=e.clone();return t.geometry=null,await this._addAndInitializeEdits(e,t),e}r.remove(e);const{executor:l}=o,c=l(e.geometry,"completion"),u=d(c)?await c:c;o.completionResults.push(u),ae(u.relationships),i.editType="INSERT",i.map=n?.map,i.spatialReference=n?.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 T(a,t),r.add(a)),a.sourceLayer!==e?.layer&&(e=J(s,a.sourceLayer));const n=!!u.associationGraphics?.has(a);await this._addAndInitializeEdits(a,i,e,n)}}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,_formViewModel:s}=this,{layerInfos:n}=r.viewModel,o=r.addPendingFeature(e,t,{isAssociation:i});a??=J(n,e.sourceLayer),s.feature=e,s.formTemplate=a?.formTemplate,await m(()=>!s.updating),o.updateAttributes(s.getValues()),o.submittable=s.submittable}async _setUpCreatingFeaturesStep(){if(this.hasHandles(pe))return;const{data:e,sketchViewModel:s}=this,{creationInfo:n,viewModel:l}=e,{attachmentsViewModel:d,view:c}=l;if(!c||!n?.layer)throw new a("missing-parameters","CreateFeaturesWorkflow requires a view and creationInfo.");const{initialFeature:h,layer:m}=n,f=[],g=[];this._featureFormHandle=o(this._featureFormHandle),this._visualVariableAttributes={rotation:null,size:null},e.editorItem=W(l.editorItems,n.layer),n.template&&(null==e.fullTemplate&&await this._initializeFullTemplateAndExecutorInfo(e),g.push(i(()=>{e.templateExecutorInfo&&(e.templateExecutorInfo.completionResults=[])}))),s.allowDeleteKey=!e.isSharedTemplateWorkflow,ie(d),f.push(u(()=>d.mode,e=>{switch(e){case"add":this.go("adding-attachment");break;case"edit":this.go("editing-attachment")}}));const w=re(c);f.push(w);const y=k(n.layer),{template:_}=n,M=!_||b(_)||v(_)&&"feature"===_.type,I=y&&M;try{if(I){const a=h??new t({attributes:F(e.fullTemplate,n.attributeOverrides,m),sourceLayer:m}),i=await this._processEdits(a);i&&await this._startUpdating({feature:i})}else f.push(de._configureSketchViewModel(this)),h?(O(n)&&n.geometryToPlace&&(h.attributes=F(e.fullTemplate,n.attributeOverrides,m)),s.addGraphic(h),await this._startUpdating({feature:h})):await this._startCreating()}finally{w.remove()}const V=i(()=>{for(const t of e.pendingFeatures)s.removeGraphic(t),e.removePendingFeature(t)}),S=u(()=>c?.timeZone,e=>{this._formViewModel.timeZone=e,this.data.timeZone=e},p),T=i(()=>{O(n)&&l.cancelWorkflow({warnIfNoWorkflow:!1})});this._featureFormHandle&&f.push(this._featureFormHandle),this.addHandles(f,this._handleKeys.beforeCommit),this.addHandles(g,this._handleKeys.afterCommit),this.addHandles([i(()=>d.fileInfos.removeAll()),r(f),r(g),T,V,S],pe)}async _waitForActiveToolCleared(){const e=this.data.viewModel.view;if(null==e?.activeTool)return;const t=new AbortController;this.addHandles(s(t),he),await m(()=>null==e?.activeTool,t.signal),t.abort()}};function ge(e,t,a){let s=null;const n=()=>e.snappingOptions.featureSources,o=()=>(s=new U({layer:t}),n().add(s),s),d=()=>{null!=s&&(n().remove(s),s=l(s))};return r([u(()=>{const e=a.creationInfo?.layer,t=n().find(t=>t.layer===e);return{hasFeatureLayerSource:!!t,enabled:t?.enabled??!1}},({hasFeatureLayerSource:e,enabled:t})=>{if(!e)return d();s??=o(),s.enabled=t},f),i(d)])}function we(e){const t=e.viewModel.view;if(!t)return[];const a=[];if("3d"===t.type){const r=new P({view:t});a.push(u(()=>e.selectedPendingFeature,(e,t)=>{r.remove(e),r.add(t)}),i(()=>r.destroy()))}const r=new P({view:t,highlightName:H});return a.push(u(()=>e.temporaryHighlightFeature,e=>{r.removeAll(),r.add(e)}),i(()=>r.destroy())),a}function ye(e,t,a,i){const r=[];return t.forEach((t,s)=>{if(!t.error){const n=e[s],o=i.get(n)||[];n.attributes[a.objectIdField]=t.objectId,o.forEach(({form:e})=>r.push({feature:n,attachment:e}))}}),r}function ve(e){for(const t of e){const{sourceLayer:e}=t;e&&"globalIdField"in e&&null!=e.globalIdField&&(t.attributes[e.globalIdField]??=g())}}function _e(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:g(),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:g(),data:t}})}return i.length?{...e,addAttachments:i}:e})}e([w()],fe.prototype,"allowSave",null),e([w()],fe.prototype,"createFeatureState",void 0),e([w()],fe.prototype,"curveResizeDisabled",null),e([w()],fe.prototype,"curveUpdatesDisabled",null),e([w()],fe.prototype,"data",void 0),e([w({constructOnly:!0})],fe.prototype,"isNested",void 0),e([w()],fe.prototype,"formViewModel",null),e([w()],fe.prototype,"hasInvalidFormTemplate",null),e([w()],fe.prototype,"hasPendingEdits",null),e([w()],fe.prototype,"hasPreviousStep",null),e([w()],fe.prototype,"_getDrawMeshHelpMessage",void 0),e([w()],fe.prototype,"helpMessage",null),e([w()],fe.prototype,"noticeMessage",null),e([w()],fe.prototype,"layer",null),e([w()],fe.prototype,"parent",null),e([w()],fe.prototype,"keyboardCancellationEnabled",null),e([w()],fe.prototype,"reliesOnOwnerAdminPrivileges",null),e([w()],fe.prototype,"saveActionLabel",null),e([w()],fe.prototype,"shouldShowAttachments",null),e([w()],fe.prototype,"shouldAllowAttachmentEditing",null),e([w()],fe.prototype,"sketchUpdateOptions",null),e([w()],fe.prototype,"sketchViewModel",null),e([w()],fe.prototype,"availableCreateTools",null),e([w()],fe.prototype,"_attachmentsActive",null),fe=de=e([y("esri.widgets.Editor.CreateFeaturesWorkflow")],fe);const be=fe;export{be as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../core/Error.js";import{makeHandle as i,handlesGroup as r,destroyHandle as a}from"../../core/handleUtils.js";import"../../core/has.js";import{destroyMaybe as o}from"../../core/maybe.js";import{debounce as s}from"../../core/promiseUtils.js";import{watch as n,on as l,whenOnce as p,initial as d}from"../../core/reactiveUtils.js";import{property as u,subclass as c}from"../../core/accessorSupport/decorators.js";import h from"../../layers/GraphicsLayer.js";import{swapForEditingSession as m,updateGraphicSymbolWhenRequired as y}from"../../views/draw/support/editingSessionUtils.js";import{getDrawHelpMessage as w}from"../../views/draw/support/helpMessageUtils.js";import g from"../../views/draw/support/HighlightHelper.js";import f from"../../views/interactive/snapping/FeatureSnappingLayerSource.js";import{temporaryHighlightName as v}from"../../views/support/HighlightDefaults.js";import _ from"./Edits.js";import F from"./SplitFeatureWorkflowData.js";import M from"./Workflow.js";import{activeSketchToolDrawsUnsupportedCurve as S,containsUnsupportedCurve as b,createWorkflowSteps as k,makeMinimalAttributes as T}from"./workflowUtils.js";import{assertViewNot3D as I,assertSplitWorkflowCapabilities as V}from"./support/errors.js";import{getCompatibleSpitterGeometryType as E,ensureSplittableGeometry as G,makeNewFeatureAttributes as H,splitGeometry as j,canSplitByPoint as C,isSplitterGeometry as x}from"./support/splitFeatureUtils.js";import U from"../FeatureForm/FeatureFormViewModel.js";import L from"../Sketch/SketchViewModel.js";import{getDrawToolGeometryTypeFromCreateTool as W}from"../Sketch/support/sketchUtils.js";var O;const P=Symbol(),z=Symbol();let A=O=class extends M{constructor(e){super(e),this.defaultSplitterGeometryType=null,this.type="split-feature",this._activeFeature=null,this._formViewModel=null,this._graphicsLayer=null,this._highlightHelper=null,this._lastSplitterGeometryWasInvalid=!1,this._sketchViewModel=null,this._webStyleCache=new Map}initialize(){const e=this.data.viewModel.view;this._highlightHelper=e?new g({view:e,highlightName:v}):null,this._initializeFormViewModel();const t=this._initializeGraphicsLayer();this._initializeSketchViewModel(t)}destroy(){const e=this._graphicsLayer,{view:t}=this.data.viewModel;t?.destroyed||t?.map.remove(e),this._graphicsLayer=o(this._graphicsLayer),this._formViewModel.destroy(),this._sketchViewModel.destroy(),this._highlightHelper?.destroy()}get activeFeature(){return this._activeFeature}get allowSave(){const{data:e}=this;return null!=e.existingFeatureEdits&&null!=e.newFeatureEdits&&!this.updating}get availableCreateTools(){const e=["polyline","polygon","rectangle","circle","freehandPolyline","freehandPolygon"];switch(this.data.editorItem.layer.geometryType){case"polygon":case"multipoint":return e;case"polyline":return["point",...e];default:return[]}}get formViewModel(){return this._formViewModel}get hasInvalidFormTemplate(){return!!this.data.editorItem?.hasInvalidFormTemplate}get hasPreviousStep(){return null!==this._activeFeature||this._stepIndex>0}get helpMessage(){const{activeCreateToolDrawMode:e,activeTool:t,createGraphic:i,drawTool:r,isUsingLegacyCreateTools:a}=this._sketchViewModel;if(!a)return r?.helpMessageKey??"noTool";const o=W(t);return"mesh"!==o?w(o,i?.geometry,e):void 0}get layer(){return this.data.editorItem.layer}get parent(){return this.data.parent}get sketchUpdateOptions(){return{enableScaling:!this.curveResizeDisabled,multipleSelectionEnabled:!1}}get updating(){return this._updatingHandles.updating||this._formViewModel.updating||this._sketchViewModel.updating}get noticeMessage(){return this._splittingMayIntroduceCurves&&S(this._sketchViewModel,this.data.editorItem)?"curveToolDensifyWarning":this._lastSplitterGeometryWasInvalid?"invalidSplitterGeometry":void 0}get _splittingMayIntroduceCurves(){return"polygon"===this.data.editorItem.layer.geometryType}async back(e){return this.activeFeature?await this.setActiveFeature(null):await super.back(e)}static create(e){const{applyEdits:i,applyEditsFeatureService:r,defaultSplitterGeometryType:a,startAt:o,...s}=e;if(I(e.viewModel,"split-feature"),V(s.editorItem),"reviewing-features"===o){if(!s.splitterGeometry)throw new t("editing:split-geometry-required","Must provide the split geometry to start at the 'reviewing-features' step.");const e=E(G(s.feature.geometry),s.splitterGeometry.type);if(s.splitterGeometry.type!==e)throw new t("editing:incompatible-split-geometries",`Geometry of type '${s.splitterGeometry.type}' cannot be used to split geometry of type '${s.feature.geometry?.type}'.`)}const n=new O({data:new F(s),defaultSplitterGeometryType:a,onCommit:R(e.applyEdits)});return n._set("steps",O._createWorkflowSteps(n,o)),n}async enter(){}exit(){if("reviewing-features"!==this.stepId)throw new t("editing:invalid-exit-state","The SplitFeatureWorkflow can only be exited when in the 'reviewing-features' step.")}async setActiveFeature(e){const i=this._activeFeature;if(e===i)return;const r=this.data,a=i?r.getEditsForFeature(i):null;if(a&&(a.submittable=this._formViewModel.submittable),this._activeFeature=e,null==e)return;const o=this.data.getRoleForFeature(e);if(!o)throw new t("editing:unknown-feature","The provided feature is not part of this workflow.");await this._setFeatureOnFormViewModel(e,o)}async commit(e){const{newFeatureEdits:t,existingFeatureEdits:i,editorItem:r}=this.data,a=[i?.feature,t?.feature].filter(e=>!!e);if(e&&b(a,r)){if(!await e("curveEditingDensifyPrompt"))return this.reset()}return super.commit()}async start(){return await super.start(),this._makeSketchController()}async _createAndInitializeEdits({newPart:e,remainingPart:t}){const{data:i}=this,r=i.feature,a=this._formViewModel,o=r.clone();o.geometry=t;const s=new _({feature:o});i.existingFeatureEdits=s,s.trackChanges(i.initialFeature),await this._setFeatureOnFormViewModel(o,"existing"),s.submittable=a.submittable;const n=r.clone();n.geometry=e,n.attributes=H(r.attributes,i.editorItem.layer);const l=new _({feature:n});return i.newFeatureEdits=l,l.trackChanges(),await this._setFeatureOnFormViewModel(n,"new"),l.submittable=a.submittable,{featureToCreate:n,featureToUpdate:o}}static _createWorkflowSteps(e,i="drawing-splitter-geometry"){const{data:r}=e;return k(["drawing-splitter-geometry","reviewing-features"],i,{"drawing-splitter-geometry":()=>({id:"drawing-splitter-geometry",async setUp(){const i=G(r.feature.geometry),a=E(i,e.defaultSplitterGeometryType),{snappingManager:o}=r;C(i)&&o&&e.addHandles(N(o,e.layer));const s=e._sketchViewModel;e.addHandles([l(()=>s,"create",async i=>{if("start"===i.state&&e._lastSplitterGeometryWasInvalid&&(e._lastSplitterGeometryWasInvalid=!1),"complete"===i.state){e._graphicsLayer.removeAll();const o=i.graphic?.geometry;try{if(!x(o))throw new t("editing:invalid-split-geometry","The geometry produced by the Sketch operation cannot be used for splitting.");r.splitterGeometry=o,r.splitResult=await e._updatingHandles.addPromise(e._executeSplit(o)),await e.next()}catch(a){e._lastSplitterGeometryWasInvalid=!0,await s.create(i.tool)}}}),n(()=>s.activeTool,(t,i)=>{"point"===t&&!e.hasHandles(P)&&o?e.addHandles(Z(o,e.layer),P):"point"===i&&e.removeHandles(P)})],this.id),await s.create(a)},async tearDown(){e.removeHandles(this.id)}}),"reviewing-features":()=>({id:"reviewing-features",async setUp(){const i=r.splitterGeometry;if(!i)throw new t("editing:missing-splitter-geometry","The `splitterGeometry` property of the workflow's data must be set in order to start the 'reviewing-features' step.");const a=r.splitResult??await e._executeSplit(i),{featureToCreate:o,featureToUpdate:s}=await e._createAndInitializeEdits(a),n=await e._displayFeatureGraphics(s,o);e.addHandles(n,this.id)},async tearDown(){e.removeHandles(this.id)}})})}async _displayFeatureGraphics(e,t){const{data:a,_graphicsLayer:o}=this,l=a.viewModel.view,p=[];if(!e||!t||!l)return i();const d=s(i=>Promise.all([y(e,this._webStyleCache,i),y(t,this._webStyleCache,i)]));return await d("2d"===l.type?l.scale:null),"2d"===l.type&&p.push(n(()=>l.scale,e=>d(e))),o.add(t),p.push(i(()=>o.remove(t))),p.push(await m(o,l,a.feature,e)),r(p)}async _executeSplit(e){const{data:i}=this,{feature:r}=i,a=r.geometry;if(!a)throw new t("editing:feature-has-no-geometry","Cannot split the provided feature as it has no geometry.");const o=await j(a,e);if(!o||!o.newPart)throw new t("editing:split-failed","The split operation did not produce a valid result.");return o}_initializeFormViewModel(){const{data:e,_webStyleCache:t}=this,i=e.viewModel.view,r=new U({formTemplate:e.editorItem.formTemplate,highlightHelper:this._highlightHelper,map:i?.map,spatialReference:i?.spatialReference,timeZone:e.timeZone});this._formViewModel=r,this.addHandles(l(()=>r,"value-change",({feature:r,fieldName:a,value:o})=>{r&&(e.getEditsForFeature(r)?.setAttribute(a,o),y(r,t,i?.scale))}))}_initializeGraphicsLayer(){const{data:e}=this,{view:t}=e.viewModel,i=new h({elevationInfo:e.editorItem.layer.elevationInfo,internal:!0,listMode:"hide",title:"splitFeatureWorkflow-internal"});return this._graphicsLayer=i,t?.map.add(i),i}_initializeSketchViewModel(e){const{data:t}=this,{view:i}=t.viewModel;this._sketchViewModel=new L({layer:e,creationMode:"single",sketchOptions:t.sketchOptions,snappingManager:t.snappingManager,useLegacyCreateTools:t.viewModel.useLegacyCreateTools,updateOnGraphicClick:!1,defaultUpdateOptions:this.sketchUpdateOptions,view:i})}_makeSketchController(){return{enter:async()=>this.addHandles($(this)),exit:()=>this.removeHandles(z),viewModel:this._sketchViewModel}}async _setFeatureOnFormViewModel(e,t){const{data:i}=this,r=this._formViewModel;r.feature=e,"existing"===t?(r.editType="UPDATE",r.overrideInitialFeature(i.initialFeature)):r.editType="INSERT",await p(()=>!r.updating)}get test(){}};e([u()],A.prototype,"activeFeature",null),e([u()],A.prototype,"allowSave",null),e([u()],A.prototype,"availableCreateTools",null),e([u()],A.prototype,"defaultSplitterGeometryType",void 0),e([u()],A.prototype,"formViewModel",null),e([u()],A.prototype,"hasInvalidFormTemplate",null),e([u()],A.prototype,"hasPreviousStep",null),e([u()],A.prototype,"helpMessage",null),e([u()],A.prototype,"layer",null),e([u()],A.prototype,"parent",null),e([u()],A.prototype,"sketchUpdateOptions",null),e([u()],A.prototype,"type",void 0),e([u()],A.prototype,"updating",null),e([u()],A.prototype,"noticeMessage",null),e([u()],A.prototype,"_activeFeature",void 0),e([u()],A.prototype,"_formViewModel",void 0),e([u()],A.prototype,"_graphicsLayer",void 0),e([u()],A.prototype,"_highlightHelper",void 0),e([u()],A.prototype,"_lastSplitterGeometryWasInvalid",void 0),e([u()],A.prototype,"_sketchViewModel",void 0),e([u()],A.prototype,"_splittingMayIntroduceCurves",null),A=O=e([c("esri.widgets.Editor.SplitFeatureWorkflow")],A);const D=A;function R(e){return async i=>{const{existingFeatureEdits:r,newFeatureEdits:a}=i,o=r?.feature?.cloneShallow(),s=a?.feature?.cloneShallow(),n=i.editorItem.layer;if(null==o||null==s)throw new t("editing:missing-features","Expected both a feature to update and a feature to add for the split operation.");r?.attributesModified||(o.attributes=T(o,i.editorItem.layer)),await e(n,{addFeatures:[s],updateFeatures:[o]})}}function N(e,t){if(e.options.featureSources.some(e=>e.layer===t))return i();const r=new f({enabled:!1,layer:t});return e.options.featureSources.add(r),i(()=>{e.options.featureSources.remove(r),r.destroy()})}function Z(e,t){const{options:r}=e,a=r.enabled;r.enabled=!0;const o=r.featureEnabled;r.featureEnabled=!0;const s=r.distance;r.distance=15;const n=new Map;for(const i of r.featureSources)n.set(i,i.enabled),i.layer===t?i.enabled=!0:i.enabled=!1;return i(()=>{r.enabled=a,r.featureEnabled=o,r.distance=s;for(const[e,t]of n)e.enabled=t})}function $(e){const t=e.data,{feature:o,viewModel:s}=t,{view:l}=s;if(!l)return i();const p=new g({view:l}),u=n(()=>e.stepId,e=>{switch(p.removeAll(),e){case"drawing-splitter-geometry":p.add(o);break;case"reviewing-features":p.add(t.existingFeatureEdits?.feature),p.add(t.newFeatureEdits?.feature)}},d),c=new g({view:l,highlightName:v}),h=n(()=>t.temporaryHighlightFeature,(t,i)=>{i&&i!==e.activeFeature&&c.remove(i),t&&c.add(t)}),m=n(()=>e.activeFeature,(e,i)=>{i&&i!==t.temporaryHighlightFeature&&c.remove(i),e&&c.add(e)});return r([u,h,m,a(p),a(c)])}export{D as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../core/Error.js";import{makeHandle as i,handlesGroup as r,destroyHandle as a}from"../../core/handleUtils.js";import"../../core/has.js";import{destroyMaybe as o}from"../../core/maybe.js";import{debounce as s}from"../../core/promiseUtils.js";import{watch as n,on as l,whenOnce as p,initial as d}from"../../core/reactiveUtils.js";import{property as u,subclass as c}from"../../core/accessorSupport/decorators.js";import h from"../../layers/GraphicsLayer.js";import{swapForEditingSession as m,updateGraphicSymbolWhenRequired as y}from"../../views/draw/support/editingSessionUtils.js";import{getDrawHelpMessage as w}from"../../views/draw/support/helpMessageUtils.js";import g from"../../views/draw/support/HighlightHelper.js";import f from"../../views/interactive/snapping/FeatureSnappingLayerSource.js";import{temporaryHighlightName as v}from"../../views/support/HighlightDefaults.js";import _ from"./Edits.js";import F from"./SplitFeatureWorkflowData.js";import M from"./Workflow.js";import{activeSketchToolDrawsUnsupportedCurve as S,containsUnsupportedCurve as b,createWorkflowSteps as k,makeMinimalAttributes as T}from"./workflowUtils.js";import{assertViewNot3D as I,assertSplitWorkflowCapabilities as V}from"./support/errors.js";import{getCompatibleSpitterGeometryType as E,ensureSplittableGeometry as G,makeNewFeatureAttributes as H,splitGeometry as j,canSplitByPoint as C,isSplitterGeometry as x}from"./support/splitFeatureUtils.js";import U from"../FeatureForm/FeatureFormViewModel.js";import L from"../Sketch/SketchViewModel.js";import{getDrawToolGeometryTypeFromCreateTool as W}from"../Sketch/support/sketchUtils.js";var O;const P=Symbol(),z=Symbol();let A=O=class extends M{constructor(e){super(e),this.defaultSplitterGeometryType=null,this.type="split-feature",this._activeFeature=null,this._formViewModel=null,this._graphicsLayer=null,this._highlightHelper=null,this._lastSplitterGeometryWasInvalid=!1,this._sketchViewModel=null,this._webStyleCache=new Map}initialize(){const e=this.data.viewModel.view;this._highlightHelper=e?new g({view:e,highlightName:v}):null,this._initializeFormViewModel();const t=this._initializeGraphicsLayer();this._initializeSketchViewModel(t)}destroy(){const e=this._graphicsLayer,{view:t}=this.data.viewModel;t?.destroyed||t?.map.remove(e),this._graphicsLayer=o(this._graphicsLayer),this._formViewModel.destroy(),this._sketchViewModel.destroy(),this._highlightHelper?.destroy()}get activeFeature(){return this._activeFeature}get allowSave(){const{data:e}=this;return null!=e.existingFeatureEdits&&null!=e.newFeatureEdits&&!this.updating}get availableCreateTools(){const e=["polyline","polygon","rectangle","circle","freehandPolyline","freehandPolygon"];switch(this.data.editorItem.layer.geometryType){case"polygon":case"multipoint":return e;case"polyline":return["point",...e];default:return[]}}get formViewModel(){return this._formViewModel}get hasInvalidFormTemplate(){return!!this.data.editorItem?.hasInvalidFormTemplate}get hasPreviousStep(){return null!==this._activeFeature||this._stepIndex>0}get helpMessage(){const{activeCreateToolDrawMode:e,activeTool:t,createGraphic:i,drawTool:r,isUsingLegacyCreateTools:a}=this._sketchViewModel;if(!a)return r?.helpMessageKey??"noTool";const o=W(t);return"mesh"!==o?w(o,i?.geometry,e):void 0}get layer(){return this.data.editorItem.layer}get parent(){return this.data.parent}get sketchUpdateOptions(){return{enableScaling:!this.curveResizeDisabled,multipleSelectionEnabled:!1}}get updating(){return this._updatingHandles.updating||this._formViewModel.updating||this._sketchViewModel.updating}get noticeMessage(){return this._splittingMayIntroduceCurves&&S(this._sketchViewModel,this.data.editorItem)?"curveToolDensifyWarning":this._lastSplitterGeometryWasInvalid?"invalidSplitterGeometry":void 0}get _splittingMayIntroduceCurves(){return"polygon"===this.data.editorItem.layer.geometryType}async back(e){if(this.activeFeature)return await this.setActiveFeature(null);await super.back(e)}static create(e){const{applyEdits:i,applyEditsFeatureService:r,defaultSplitterGeometryType:a,startAt:o,...s}=e;if(I(e.viewModel,"split-feature"),V(s.editorItem),"reviewing-features"===o){if(!s.splitterGeometry)throw new t("editing:split-geometry-required","Must provide the split geometry to start at the 'reviewing-features' step.");const e=E(G(s.feature.geometry),s.splitterGeometry.type);if(s.splitterGeometry.type!==e)throw new t("editing:incompatible-split-geometries",`Geometry of type '${s.splitterGeometry.type}' cannot be used to split geometry of type '${s.feature.geometry?.type}'.`)}const n=new O({data:new F(s),defaultSplitterGeometryType:a,onCommit:R(e.applyEdits)});return n._set("steps",O._createWorkflowSteps(n,o)),n}async enter(){}exit(){if("reviewing-features"!==this.stepId)throw new t("editing:invalid-exit-state","The SplitFeatureWorkflow can only be exited when in the 'reviewing-features' step.")}async setActiveFeature(e){const i=this._activeFeature;if(e===i)return;const r=this.data,a=i?r.getEditsForFeature(i):null;if(a&&(a.submittable=this._formViewModel.submittable),this._activeFeature=e,null==e)return;const o=this.data.getRoleForFeature(e);if(!o)throw new t("editing:unknown-feature","The provided feature is not part of this workflow.");await this._setFeatureOnFormViewModel(e,o)}async commit(e){const{newFeatureEdits:t,existingFeatureEdits:i,editorItem:r}=this.data,a=[i?.feature,t?.feature].filter(e=>!!e);if(e&&b(a,r)){if(!await e("curveEditingDensifyPrompt"))return this.reset()}return super.commit()}async start(){return await super.start(),this._makeSketchController()}async _createAndInitializeEdits({newPart:e,remainingPart:t}){const{data:i}=this,r=i.feature,a=this._formViewModel,o=r.clone();o.geometry=t;const s=new _({feature:o});i.existingFeatureEdits=s,s.trackChanges(i.initialFeature),await this._setFeatureOnFormViewModel(o,"existing"),s.submittable=a.submittable;const n=r.clone();n.geometry=e,n.attributes=H(r.attributes,i.editorItem.layer);const l=new _({feature:n});return i.newFeatureEdits=l,l.trackChanges(),await this._setFeatureOnFormViewModel(n,"new"),l.submittable=a.submittable,{featureToCreate:n,featureToUpdate:o}}static _createWorkflowSteps(e,i="drawing-splitter-geometry"){const{data:r}=e;return k(["drawing-splitter-geometry","reviewing-features"],i,{"drawing-splitter-geometry":()=>({id:"drawing-splitter-geometry",async setUp(){const i=G(r.feature.geometry),a=E(i,e.defaultSplitterGeometryType),{snappingManager:o}=r;C(i)&&o&&e.addHandles(N(o,e.layer));const s=e._sketchViewModel;e.addHandles([l(()=>s,"create",async i=>{if("start"===i.state&&e._lastSplitterGeometryWasInvalid&&(e._lastSplitterGeometryWasInvalid=!1),"complete"===i.state){e._graphicsLayer.removeAll();const o=i.graphic?.geometry;try{if(!x(o))throw new t("editing:invalid-split-geometry","The geometry produced by the Sketch operation cannot be used for splitting.");r.splitterGeometry=o,r.splitResult=await e._updatingHandles.addPromise(e._executeSplit(o)),await e.next()}catch(a){e._lastSplitterGeometryWasInvalid=!0,await s.create(i.tool)}}}),n(()=>s.activeTool,(t,i)=>{"point"===t&&!e.hasHandles(P)&&o?e.addHandles(Z(o,e.layer),P):"point"===i&&e.removeHandles(P)})],this.id),await s.create(a)},async tearDown(){e.removeHandles(this.id)}}),"reviewing-features":()=>({id:"reviewing-features",async setUp(){const i=r.splitterGeometry;if(!i)throw new t("editing:missing-splitter-geometry","The `splitterGeometry` property of the workflow's data must be set in order to start the 'reviewing-features' step.");const a=r.splitResult??await e._executeSplit(i),{featureToCreate:o,featureToUpdate:s}=await e._createAndInitializeEdits(a),n=await e._displayFeatureGraphics(s,o);e.addHandles(n,this.id)},async tearDown(){e.removeHandles(this.id)}})})}async _displayFeatureGraphics(e,t){const{data:a,_graphicsLayer:o}=this,l=a.viewModel.view,p=[];if(!e||!t||!l)return i();const d=s(i=>Promise.all([y(e,this._webStyleCache,i),y(t,this._webStyleCache,i)]));return await d("2d"===l.type?l.scale:null),"2d"===l.type&&p.push(n(()=>l.scale,e=>d(e))),o.add(t),p.push(i(()=>o.remove(t))),p.push(await m(o,l,a.feature,e)),r(p)}async _executeSplit(e){const{data:i}=this,{feature:r}=i,a=r.geometry;if(!a)throw new t("editing:feature-has-no-geometry","Cannot split the provided feature as it has no geometry.");const o=await j(a,e);if(!o||!o.newPart)throw new t("editing:split-failed","The split operation did not produce a valid result.");return o}_initializeFormViewModel(){const{data:e,_webStyleCache:t}=this,i=e.viewModel.view,r=new U({formTemplate:e.editorItem.formTemplate,highlightHelper:this._highlightHelper,map:i?.map,spatialReference:i?.spatialReference,timeZone:e.timeZone});this._formViewModel=r,this.addHandles(l(()=>r,"value-change",({feature:r,fieldName:a,value:o})=>{r&&(e.getEditsForFeature(r)?.setAttribute(a,o),y(r,t,i?.scale))}))}_initializeGraphicsLayer(){const{data:e}=this,{view:t}=e.viewModel,i=new h({elevationInfo:e.editorItem.layer.elevationInfo,internal:!0,listMode:"hide",title:"splitFeatureWorkflow-internal"});return this._graphicsLayer=i,t?.map.add(i),i}_initializeSketchViewModel(e){const{data:t}=this,{view:i}=t.viewModel;this._sketchViewModel=new L({layer:e,creationMode:"single",sketchOptions:t.sketchOptions,snappingManager:t.snappingManager,useLegacyCreateTools:t.viewModel.useLegacyCreateTools,updateOnGraphicClick:!1,defaultUpdateOptions:this.sketchUpdateOptions,view:i})}_makeSketchController(){return{enter:async()=>this.addHandles($(this)),exit:()=>this.removeHandles(z),viewModel:this._sketchViewModel}}async _setFeatureOnFormViewModel(e,t){const{data:i}=this,r=this._formViewModel;r.feature=e,"existing"===t?(r.editType="UPDATE",r.overrideInitialFeature(i.initialFeature)):r.editType="INSERT",await p(()=>!r.updating)}get test(){}};e([u()],A.prototype,"activeFeature",null),e([u()],A.prototype,"allowSave",null),e([u()],A.prototype,"availableCreateTools",null),e([u()],A.prototype,"defaultSplitterGeometryType",void 0),e([u()],A.prototype,"formViewModel",null),e([u()],A.prototype,"hasInvalidFormTemplate",null),e([u()],A.prototype,"hasPreviousStep",null),e([u()],A.prototype,"helpMessage",null),e([u()],A.prototype,"layer",null),e([u()],A.prototype,"parent",null),e([u()],A.prototype,"sketchUpdateOptions",null),e([u()],A.prototype,"type",void 0),e([u()],A.prototype,"updating",null),e([u()],A.prototype,"noticeMessage",null),e([u()],A.prototype,"_activeFeature",void 0),e([u()],A.prototype,"_formViewModel",void 0),e([u()],A.prototype,"_graphicsLayer",void 0),e([u()],A.prototype,"_highlightHelper",void 0),e([u()],A.prototype,"_lastSplitterGeometryWasInvalid",void 0),e([u()],A.prototype,"_sketchViewModel",void 0),e([u()],A.prototype,"_splittingMayIntroduceCurves",null),A=O=e([c("esri.widgets.Editor.SplitFeatureWorkflow")],A);const D=A;function R(e){return async i=>{const{existingFeatureEdits:r,newFeatureEdits:a}=i,o=r?.feature?.cloneShallow(),s=a?.feature?.cloneShallow(),n=i.editorItem.layer;if(null==o||null==s)throw new t("editing:missing-features","Expected both a feature to update and a feature to add for the split operation.");r?.attributesModified||(o.attributes=T(o,i.editorItem.layer)),await e(n,{addFeatures:[s],updateFeatures:[o]})}}function N(e,t){if(e.options.featureSources.some(e=>e.layer===t))return i();const r=new f({enabled:!1,layer:t});return e.options.featureSources.add(r),i(()=>{e.options.featureSources.remove(r),r.destroy()})}function Z(e,t){const{options:r}=e,a=r.enabled;r.enabled=!0;const o=r.featureEnabled;r.featureEnabled=!0;const s=r.distance;r.distance=15;const n=new Map;for(const i of r.featureSources)n.set(i,i.enabled),i.layer===t?i.enabled=!0:i.enabled=!1;return i(()=>{r.enabled=a,r.featureEnabled=o,r.distance=s;for(const[e,t]of n)e.enabled=t})}function $(e){const t=e.data,{feature:o,viewModel:s}=t,{view:l}=s;if(!l)return i();const p=new g({view:l}),u=n(()=>e.stepId,e=>{switch(p.removeAll(),e){case"drawing-splitter-geometry":p.add(o);break;case"reviewing-features":p.add(t.existingFeatureEdits?.feature),p.add(t.newFeatureEdits?.feature)}},d),c=new g({view:l,highlightName:v}),h=n(()=>t.temporaryHighlightFeature,(t,i)=>{i&&i!==e.activeFeature&&c.remove(i),t&&c.add(t)}),m=n(()=>e.activeFeature,(e,i)=>{i&&i!==t.temporaryHighlightFeature&&c.remove(i),e&&c.add(e)});return r([u,h,m,a(p),a(c)])}export{D as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../core/Error.js";import{makeHandle as i}from"../../core/handleUtils.js";import"../../core/has.js";import{destroyMaybe as s}from"../../core/maybe.js";import{watch as a,sync as o}from"../../core/reactiveUtils.js";import{property as r,subclass as l}from"../../core/accessorSupport/decorators.js";import d from"../../layers/GraphicsLayer.js";import{isSceneLayer as h}from"../../layers/support/layerUtils.js";import{updateGraphicSymbolWhenRequired as n,swapForEditingSession as c}from"../../views/draw/support/editingSessionUtils.js";import{highlightsSupported as p}from"../../views/support/layerViewUtils.js";import u from"./UpdateFeatureWorkflowData.js";import{UpdateRecordWorkflow as w,handleKeys as
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../core/Error.js";import{makeHandle as i}from"../../core/handleUtils.js";import"../../core/has.js";import{destroyMaybe as s}from"../../core/maybe.js";import{watch as a,sync as o}from"../../core/reactiveUtils.js";import{property as r,subclass as l}from"../../core/accessorSupport/decorators.js";import d from"../../layers/GraphicsLayer.js";import{isSceneLayer as h}from"../../layers/support/layerUtils.js";import{updateGraphicSymbolWhenRequired as n,swapForEditingSession as c}from"../../views/draw/support/editingSessionUtils.js";import{highlightsSupported as p}from"../../views/support/layerViewUtils.js";import u from"./UpdateFeatureWorkflowData.js";import{UpdateRecordWorkflow as w,handleKeys as m}from"./UpdateRecordWorkflow.js";import{getVisualVariableAttributes as y,setUpGeometryUpdate as f,syncUpdateOptions as g,cloneGraphicExceptMesh as k,canCreateInteractiveEditSession as _,isTerminalUpdateEventType as v}from"./workflowUtils.js";import V from"../Sketch/SketchViewModel.js";var S;const b={...m,highlights:Symbol(),sketchGraphics:Symbol(),sketchViewModel:Symbol(),waitingForTool:Symbol()};let M=S=class extends w{constructor(e){super(e),this.type="update-feature",this._layerViewEditSession=null,this._sketchGraphicClone=null,this._sketchLayer=null,this._sketchViewModel=null,this._webStyleCache=new Map}destroy(){this._layerViewEditSession?.rollback()}get curveResizeDisabled(){return this.data.curveResizeDisabled}get curveUpdatesDisabled(){return this.data.curveUpdatesDisabled}get sketchUpdateOptions(){const{capabilities:e,layer:t}=this.data.editorItem;return{enableScaling:!this.curveResizeDisabled,multipleSelectionEnabled:!1,reshapeOptions:{enableCreateCurveFromStraightEdge:!h(t)&&e.supportsTrueCurve}}}get supportsSplitFeatureWorkflow(){return this.data.supportsSplitFeatureWorkflow}get viewGraphic(){return this._sketchViewModel?this._sketchGraphicClone:this.data.edits.feature??this.fullFeature}getUpdating(){return!!this._sketchViewModel?.updating}async commit(){this.removeHandles(b.sketchGraphics);try{const e=this.data.edits.stagedForDelete;await super.commit();const t=this._layerViewEditSession;e?t?.rollback():t?.commit()}catch(e){throw await this._configureSketchViewModel(),new t("editor-workflow:failed-to-commit","An error occurred when sending the updates to the service",{error:e})}}async start(){return await super.start(),await this._initializeSketchViewModel()}_initializeFormViewModel(){super._initializeFormViewModel(),this.addHandles([this._formViewModel.on("value-change",e=>{this._layerViewEditSession?.setAttribute(e.fieldName,e.value)}),a(()=>this._formViewModel.feature?.sourceLayer,e=>this._sketchGraphicClone.sourceLayer=e)])}_configureHighlight(){const{edits:e,layerView:t}=this.data;p(t)&&this.addHandles(t.highlight(e.feature),b.highlights)}async _configureSketchViewModel(){const{_sketchLayer:e,_sketchViewModel:t}=this;if(!t||!e)return;const{data:i,_formViewModel:s,_sketchGraphicClone:a}=this,{edits:o,viewModel:r}=i,l=o.feature,{view:d}=r,h=y(l),n=await f({feature:l,featureClone:a,visualVariableAttributes:h,sketchLayer:e,sketchViewModel:t,getUpdateOptions:()=>this.sketchUpdateOptions,view:d,webStyleCache:this._webStyleCache,onUpdate:({geometry:e,attributes:t},i)=>{if(o.updateAttributes(t),o.updateGeometry(e),s.feature&&(s.feature.geometry=e),null!=h.rotation){const{field:e}=h.rotation;s.setValue(e,t[e])}if(null!=h.size){const{field:e}=h.size;s.setValue(e,t[e])}("undo"===i.type||"redo"===i.type||"update"===i.type&&null!=i.toolEventInfo&&v(i.toolEventInfo.type))&&s.notifyFeatureGeometryChanged()},addUpdatingPromise:e=>{this._updatingHandles.consumePromise(e)},addHandle:e=>{this.addHandles(e,b.waitingForTool)}});this.addHandles(n,b.sketchGraphics),t.addHandles(n)}async _initializeSketchViewModel(){const{data:e,_sketchGraphicClone:t}=this,{readOnly:r}=e,l=e.edits.feature,{capabilities:h,layer:p}=e.editorItem,u=e.viewModel.view;if(this.removeHandles([b.highlights,b.sketchGraphics,b.sketchViewModel,b.waitingForTool]),!h.update.geometry||r||this.curveUpdatesDisabled)return{enter:async()=>{this.hasHandles(b.highlights)||this._configureHighlight()},exit:()=>this.removeHandles([b.highlights])};const w=new d({elevationInfo:p.elevationInfo,internal:!0,listMode:"hide",title:"updateFeaturesWorkflow-internal"}),m=new V({allowDeleteKey:!1,layer:w,sketchOptions:e.sketchOptions,snappingManager:e.snappingManager,useLegacyCreateTools:e.viewModel.useLegacyCreateTools,updateOnGraphicClick:!1,defaultUpdateOptions:this.sketchUpdateOptions,view:u});return this._sketchLayer=w,this._sketchViewModel=m,u?.map.add(w),await(u?.whenLayerView(w)),this.addHandles([i(()=>{u?.destroyed||u?.map.remove(w),w.destroyed||w.destroy(),this._sketchViewModel=s(m)}),a(()=>this.sketchUpdateOptions,e=>{m.defaultUpdateOptions=e,g(m,e)},o)],b.sketchViewModel),await n(t,this._webStyleCache,"2d"===u?.type?u.scale:null),this.addHandles([await c(w,u,l,t)]),{enter:async()=>{this.hasHandles(b.sketchGraphics)||await this._updatingHandles.addPromise(this._configureSketchViewModel())},exit:()=>this.removeHandles([b.sketchGraphics]),viewModel:m}}_onFullFeatureLoaded(e){super._onFullFeatureLoaded(e);const t=this._sketchGraphicClone=k(e),{edits:i,layerView:s}=this.data;i.updateGeometry(e.geometry),i.trackChanges(),_(s)&&(this._layerViewEditSession=s.createInteractiveEditSession(t))}static async create(e){const t=new S({data:await u.create(e),onCommit:this._onCommitFactory(e.applyEdits)});return t._set("steps",this._createWorkflowSteps(t)),t}get test(){}};e([r()],M.prototype,"curveResizeDisabled",null),e([r()],M.prototype,"curveUpdatesDisabled",null),e([r()],M.prototype,"sketchUpdateOptions",null),e([r()],M.prototype,"supportsSplitFeatureWorkflow",null),e([r()],M.prototype,"_layerViewEditSession",void 0),e([r()],M.prototype,"_sketchGraphicClone",void 0),e([r()],M.prototype,"_sketchLayer",void 0),e([r()],M.prototype,"_sketchViewModel",void 0),M=S=e([l("esri.widgets.Editor.UpdateFeatureWorkflow")],M);export{M as UpdateFeatureWorkflow,b as handleKeys};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{isSome as i}from"../../../core/arrayUtils.js";import{abortHandle as s}from"../../../core/handleUtils.js";import{debounce as a}from"../../../core/promiseUtils.js";import o from"../../../core/ReactiveMap.js";import{whenOnce as r,watch as
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{isSome as i}from"../../../core/arrayUtils.js";import{abortHandle as s}from"../../../core/handleUtils.js";import{debounce as a}from"../../../core/promiseUtils.js";import o from"../../../core/ReactiveMap.js";import{whenOnce as r,when as n,watch as l}from"../../../core/reactiveUtils.js";import{property as p,subclass as c}from"../../../core/accessorSupport/decorators.js";import{UpdatingHandles as d}from"../../../core/support/UpdatingHandles.js";import u from"../../../layers/GraphicsLayer.js";import{isSceneLayer as h}from"../../../layers/support/layerUtils.js";import{updateGraphicSymbolWhenRequired as y,swapForEditingSession as m}from"../../../views/draw/support/editingSessionUtils.js";import v from"../../../views/interactive/sketch/SketchOptions.js";import{getVisualVariablesForLayer as g,setVisualVariablesAndElevationInfoForUpdate as f,visualVariableInteractiveUpdate as w,getSizeVariableAttribute as _,getRotationVariableAttribute as b}from"../workflowUtils.js";import k from"../../Sketch/SketchViewModel.js";const U=Symbol();let L=class extends t{constructor(e){super(e),this.features=[],this.onGeometriesUpdated=()=>{},this.onVisualVariableAttributesUpdated=()=>{},this.sketchOptions=new v,this.snappingManager=null,this.sourceLayer=null,this.view=null,this.viewModel=null,this.useLegacyCreateTools=!1,this._nextUpdateSubset=[],this._sketchGraphicsMap=new o,this._sketchLayer=null,this._updatingHandles=new d,this._visualVariableAttributes=new Map,this._visualVariablesForLayer=null,this._webStyleCache=new Map}async initialize(){this._visualVariablesForLayer=g(this.sourceLayer),this._nextUpdateSubset=this.features,this._initializeSketchGraphics(),this._initializeSketchLayer(),await this._updatingHandles.addPromise(this._initializeSketchViewModel())}destroy(){const{_sketchLayer:e,view:t}=this;t?.destroyed||t?.map.remove(e),this._updatingHandles.destroy(),e.destroy(),this.viewModel.destroy()}get defaultUpdateOptions(){const e=this.sourceLayer;return{multipleSelectionEnabled:!1,reshapeOptions:{enableCreateCurveFromStraightEdge:!h(e)&&e.capabilities?.data.supportsTrueCurve}}}set defaultUpdateOptions(e){this._set("defaultUpdateOptions",e)}get sketchGraphics(){return Array.from(this._sketchGraphicsMap.values())}get updating(){return this._updatingHandles.updating||!0===this.viewModel?.updating}async enter(){await this.startUpdatingFeatures(this._nextUpdateSubset)}async exit(){this._completeCurrentOperation()}notifyAttributesChanged({features:e,fieldName:t}){const i=this._webStyleCache,s=this.view.scale,a=this._updatingHandles;for(const o of e){const e=this._sketchGraphicsMap.get(o),r=o.getAttribute(t);if(!e||e.getAttribute(t)===r)continue;e.setAttribute(t,r);const n=this._visualVariableAttributes.get(o);null==n?.size||n.size.isUpdatingInteractively||n.size.field!==t||n.size.setInitialValue(r),null==n?.rotation||n.rotation.isUpdatingInteractively||n.rotation.field!==t||n.rotation.setInitialValue(r),a.consumePromise(y(e,i,s))}}async startUpdatingFeatures(e){const{onGeometriesUpdated:t,onVisualVariableAttributesUpdated:a,_sketchGraphicsMap:o,_sketchLayer:l,sourceLayer:p,view:c,viewModel:d,_webStyleCache:u}=this,h=e.map(e=>o.get(e)).filter(i),m={...this.defaultUpdateOptions};this._completeCurrentOperation();let v=null;if(1===e.length){const t=e[0],i=this._visualVariableAttributes.get(t);!(!i?.rotation&&!i?.size)&&(await f({graphic:h[0],sketchLayer:l,sketchViewModel:d,sourceLayer:p,visualVariables:i,webStyleCache:u}),"point"===p.geometryType&&(m.enableRotation=null!=i.rotation,m.enableScaling=null!=i.size,v=async e=>{const s=e.graphics[0];w(c,s,e,i)&&(a?.([{feature:t,attributes:s.attributes}],e),this._updatingHandles.consumePromise(y(s,u,"2d"===c.type?c.scale:null)))}))}else m.tool="move";const g=()=>d.update(h,m),_=d.on("update",a=>{if("complete"===a.state){if(null===c.activeTool)return void g();const e=new AbortController,t=s(e);return this.addHandles(t,U),void this._updatingHandles.consumePromise(r(()=>null===c.activeTool,e.signal).then(async()=>{e.signal.aborted||(e.abort(),await g())}))}const n=e.map(e=>{const t=o.get(e);return t?{feature:e,geometry:t.geometry}:null}).filter(i);t(n,a),v?.(a)});await g();const b=n(()=>null!=c.activeTool&&c.activeTool!==d.activeComponent,()=>d.cancel());this._nextUpdateSubset=this.features,this.addHandles([_,b],U),d.addHandles(b),d.addHandles(_)}_completeCurrentOperation(){this.removeHandles(U),this.viewModel.complete()}_initializeSketchGraphics(){const{features:e,_sketchGraphicsMap:t,sourceLayer:i,_visualVariableAttributes:s}=this,a=this._visualVariablesForLayer,o=a.rotation?.field,r=a.size?.field,n={rotation:o?i.getField(o):null,size:r?i.getField(r):null},l=!(!n.rotation&&!n.size);for(const p of e)t.set(p,p.clone()),l&&s.set(p,S(a,n))}_initializeSketchLayer(){const{view:e}=this,t=new u({elevationInfo:this.sourceLayer.elevationInfo,internal:!0,listMode:"hide",title:"SketchController layer"});this._sketchLayer=t,e.map.add(t),this._updatingHandles.consumePromise(e.whenLayerView(t))}async _initializeSketchViewModel(){const{defaultUpdateOptions:e,sketchOptions:t,snappingManager:i,useLegacyCreateTools:s,view:o,_sketchGraphicsMap:r,_sketchLayer:n,_webStyleCache:p}=this,c=Array.from(r.entries()),d=new k({allowDeleteKey:!1,defaultUpdateOptions:e,layer:n,sketchOptions:t,snappingManager:i,useLegacyCreateTools:s,updateOnGraphicClick:!1,view:o});this.viewModel=d;const u=a(e=>Promise.all(c.map(([,t])=>y(t,p,e))));await u("2d"===o.type?o.scale:null),"2d"===o.type&&this.addHandles(l(()=>o.scale,e=>u(e))),this.addHandles(await Promise.all(c.map(([e,t])=>m(n,o,e,t))))}};function S({rotation:e,size:t},i){return{rotation:e?b(e,i.rotation):null,size:t?_(t,i.size):null}}e([p()],L.prototype,"defaultUpdateOptions",null),e([p()],L.prototype,"features",void 0),e([p()],L.prototype,"onGeometriesUpdated",void 0),e([p()],L.prototype,"onVisualVariableAttributesUpdated",void 0),e([p()],L.prototype,"sketchGraphics",null),e([p()],L.prototype,"sketchOptions",void 0),e([p()],L.prototype,"snappingManager",void 0),e([p()],L.prototype,"sourceLayer",void 0),e([p()],L.prototype,"updating",null),e([p()],L.prototype,"view",void 0),e([p()],L.prototype,"viewModel",void 0),e([p()],L.prototype,"useLegacyCreateTools",void 0),e([p()],L.prototype,"_nextUpdateSubset",void 0),e([p()],L.prototype,"_sketchGraphicsMap",void 0),e([p()],L.prototype,"_sketchLayer",void 0),e([p()],L.prototype,"_visualVariablesForLayer",void 0),L=e([c("esri.widgets.Editor.support.SketchController")],L);export{L as SketchController};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import e from"../../Color.js";import t from"../../Graphic.js";import{isSome as r,equals as n,addMany as o}from"../../core/arrayUtils.js";import i from"../../core/Error.js";import{handlesGroup as a,makeHandle as s,abortHandle as l}from"../../core/handleUtils.js";import{clone as c}from"../../core/lang.js";import u from"../../core/Logger.js";import{getOrCreateMapValue as p}from"../../core/MapUtils.js";import{debounce as d,isPromiseLike as f,whenOrAbort as y}from"../../core/promiseUtils.js";import{watch as m,on as h,whenOnce as g}from"../../core/reactiveUtils.js";import{px2pt as b}from"../../core/screenUtils.js";import{addMany as w}from"../../core/SetUtils.js";import{isSharedTemplateOrMetadata as I,isSharedGroupTemplate as v,getCreationAttributes as T,isSharedPresetTemplate as F}from"../../editing/templateUtils.js";import{isCurvedGeometry as j,hasUnsupportedCurve as S}from"../../geometry/support/curves/curveUtils.js";import k from"../../layers/GraphicsLayer.js";import{featureHasFields as A,fixFields as O,getDisplayFieldName as U}from"../../layers/support/fieldUtils.js";import{isSubtypeSublayer as L}from"../../layers/support/layerUtils.js";import{calculateTolerance as V}from"../../renderers/support/clickToleranceUtils.js";import{meterIn as M}from"../../renderers/support/lengthUtils.js";import{isRenderer as x}from"../../renderers/support/typeUtils.js";import{getTransformationType as q}from"../../renderers/visualVariables/support/sizeVariableUtils.js";import{isGraphic as z}from"../../support/graphicInstanceUtils.js";import P from"../../symbols/SimpleFillSymbol.js";import E from"../../symbols/SimpleLineSymbol.js";import C from"../../symbols/SimpleMarkerSymbol.js";import{to3D as R}from"../../symbols/support/symbolConversion.js";import{getDisplayedSymbol as D}from"../../symbols/support/symbolUtils.js";import{getServices as G}from"../../undoredo/support/Services.js";import{defaultDrawingMode as B}from"../../views/draw/drawingModes.js";import{updateGraphicSymbolWhenRequired as N,fetchFullFeaturesByObjectId as Z}from"../../views/draw/support/editingSessionUtils.js";import{createQueryGeometry as W}from"../../views/support/drapedUtils.js";import{filterGraphicHits as $,hitTestSelectSimilarDistance as Q}from"../../views/support/hitTestSelectUtils.js";import{dependencySort as H}from"./support/dependencySort.js";import{isDrawGraphicTool as J,isDrawTool as K}from"../Sketch/support/sketchUtils.js";const X=()=>u.getLogger("esri.widgets.Editor.workflowUtils");function Y(e){return oe(e)||re(e)}function _(e){return!!e&&"features"in e}function ee(e){return null!=e&&"create-features"===e.type}function te(e){return!!e&&"feature"in e}function re(e){return null!=e&&"update-features"===e.type}function ne(e){return null!=e&&"update-feature"===e.type}function oe(e){return null!=e&&e.type.includes("update-")&&"fullFeature"in e}function ie(e){return null!=e&&"update"===e.type}function ae(e){return null!=e&&"merge-features"===e.type}function se(e){return null!=e&&"split-feature"===e.type}function le(e){const t=e?.type;return"update-feature"===t||"update-table-record"===t||"update-features"===t||"split-feature"===t}function ce(e){return"merge"===e?.type}function ue(e){return"split"===e?.type}function pe(e){return ae(e)||se(e)}function de(e){return"update-multiple"===e?.type}function fe(e){const t=e&&"renderer"in e?e.renderer:null;if(!Ie(t))return{rotation:null,size:null};const r=t.getVisualVariablesForType("rotation").filter(e=>(!e.axis||"heading"===e.axis)&&e.field&&!e.valueExpression),n=t.getVisualVariablesForType("size").filter(e=>e.field&&!e.useSymbolValue&&!e.valueExpression&&"real-world-size"===q(e));return{rotation:1===r.length?r[0]:null,size:1===n.length?n[0]:null}}function ye(e){const t=e.sourceLayer;if(!(t&&"renderer"in t&&Ie(t.renderer)))return{rotation:null,size:null};const{rotation:r,size:n}=fe(t);let o=null,i=null;if(r){const e=t.fields?.filter(e=>e.name===r.field),n=1===e?.length?e[0]:null;o=me(r,n)}if(n){const e=t.fields?.filter(e=>e.name===n.field),r=1===e?.length?e[0]:null;i=be(n,r)}return{rotation:o,size:i}}function me(e,t){const r="heading"===(e.axis||"heading")&&"arithmetic"===e.rotationType?-1:1,n=t?.type??"double",o={initial:0,current:0};return{field:e.field,fieldType:n,getDefaultValue:()=>Promise.resolve(0),getValue:e=>(o.current=o.initial-r*e,we((o.current+360)%360,n)),setInitialValue:e=>{o.initial=e,o.current=0},isUpdatingInteractively:!1,rotationType:e.rotationType??"geographic"}}function he(e,t){switch(t){case"width":return e[0];case"depth":return e[1];case"height":return e[2];default:return e[2]||e[1]||e[0]}}async function ge(e,t,r){if(null==t)return 0;const{symbol:n}=R(t);if(null==n||"web-style"===n.type||"cim"===n.type)return 0;const o=n.symbolLayers.at(0);if(!o)return 0;switch(o.type){case"icon":{const{computeIconLayerResourceSize:e}=await import("../../symbols/support/symbolLayerUtils.js");return Math.min(nt.icon,(await e(o,nt.icon))[0])||nt.icon}case"text":return nt.text;case"line":return nt.line;case"object":{const{computeObjectLayerResourceSize:t}=await import("../../symbols/support/symbolLayerUtils.js");return he(await t(o,e.scale/nt.viewScaleSizeFactor),r)}case"path":case"extrude":return e.scale/nt.viewScaleSizeFactor;default:return 0}}function be(e,t){const r=e.axis,n=t?.type??"double",o={initial:0,current:0},i=M[e.valueUnit]??1;let a;return a="area"===e.valueRepresentation?e=>(e*i/2)**2*Math.PI:"radius"===e.valueRepresentation||"distance"===e.valueRepresentation?e=>e*i/2:e=>e*i,{field:e.field,fieldType:n,getDefaultValue:async(e,t)=>we(a(await ge(t,e,r)),n),getValue:(e,t)=>(o.initial||(o.initial=t.pixelSizeAt(t.center)),o.current=o.initial*e,we(o.current,n)),setInitialValue:e=>{o.initial=e,o.current=0},isUpdatingInteractively:!1,displayUnit:at(e.valueUnit),axis:e.axis}}function we(e,t){switch(t){case"small-integer":case"integer":case"long":return Math.round(e);case"double":case"single":return e;default:return 0}}function Ie(e){if(!x(e))return!1;switch(e?.type){case"class-breaks":case"simple":case"unique-value":case"dot-density":case"dictionary":case"pie-chart":return!0;default:return!1}}function ve(e,t){if(!e||!t)throw new Error("no geometry type");if("multipatch"===e)return{tool:"mesh",createOptions:{mode:"hybrid"}};const r=new Map;r.set("circle",{mode:"freehand"}),r.set("rectangle",{mode:"freehand"});const n={mode:B,optionsPerTool:r};if(I(t)){const o=t.defaultTool,i=v(t)?t.definition?.inputGeometryType??e:e;switch(o){case"freehand":case"stream-line":return{tool:"polyline"===i?"freehandPolyline":"freehandPolygon",createOptions:n};case"autocomplete-freehand-polygons":case"stream-polygon":return{tool:"freehandPolygon",createOptions:n};case"autocomplete-polygons":case"difference-polygon":case"create-structures":case"polygon":case"trace":return{tool:"polygon"===i?"polygon":"polyline",createOptions:n};case"circle":return r.get("circle").preserveAspectRatio=!0,{tool:"circle",createOptions:n};case"ellipse":return r.get("circle").preserveAspectRatio=!1,{tool:"circle",createOptions:n};case"create-points-along-line":case"multipoint":return{tool:"multipoint",createOptions:n};case"line":case"radial-line":case"right-angle-line":case"split":case"two-point-line":return{tool:"polyline",createOptions:n};case"rectangle":case"regular-polygon":case"right-angle-polygon":return{tool:"rectangle",createOptions:n};case"elevation-point-from-contour":case"elevation-point-from-dem":case"parcel-seed":case"point":case"point-and-rotation":case"point-at-end-of-line":return{tool:"point",createOptions:n}}}else{const o=t.drawingTool;if("circle"===o||"ellipse"===o)return r.get("circle").preserveAspectRatio="circle"===o,{tool:"circle",createOptions:n};if("rectangle"===o)return{tool:"rectangle",createOptions:n};if("freehand"===o)return{tool:"polygon"===e?"freehandPolygon":"freehandPolyline",createOptions:n}}return{tool:e,createOptions:n}}async function Te(e,t,r,n){const{creationInfo:o,fullTemplate:a}=r;if(!o)throw new i("featureworkflow","No creation info provided.");const s=o.layer,l=T(a,o.attributeOverrides,o.layer),{view:c}=e,u="2d"===c?.type;v(a)||F(a)||await De(e,s,l,n,u?c.scale:null);const{capabilities:p}=s;t.elevationInfo=s.elevationInfo;const d=ve(s.geometryType,a);e.defaultCreateOptions={graphicProperties:{attributes:l,sourceLayer:s},mode:d.createOptions.mode,optionsPerTool:d.createOptions.optionsPerTool,preserveAspectRatio:d.createOptions.preserveAspectRatio,hasZ:p.data.supportsZ,defaultZ:(u?p.editing.zDefault:null)??e.defaultCreateOptions.defaultZ},null==o.geometryToPlace?await e.create(d.tool):await e.place(o.geometryToPlace,{graphicProperties:{attributes:l,sourceLayer:s}})}async function Fe(e){return a([je(e),Se(e)])}function je({creationAttributes:e,data:t,sketchViewModel:r,view:n,webStyleCache:o}){const{creationInfo:i}=t,{fullTemplate:a}=t;if(!i||"2d"!==n?.type||v(a)||F(a))return null;const s=d(t=>De(r,i.layer,e,o,t));return m(()=>n.scale,e=>s(e))}function Se({data:t,sketchViewModel:r,view:n}){const{templateExecutorInfo:o}=t;if(!o)return null;const l=r.activeComponent;if(!n||!J(l)&&!K(l))return X().error(new i("featureworkflow","Failed to set up template feedback.")),null;const c=new k({effect:"saturate(0.6) opacity(0.8)",listMode:"hide",title:"Shared Template Feedback Graphics"});n.map?.add(c);const{executor:u,serviceLayersById:p}=o,d=n.theme?.accentColor??new e([255,165,0,1]);return a([h(()=>l,["cursor-update","vertex-add"],()=>{c.removeAll();const e=J(l)?l.graphic?.geometry:l.unprocessedGeometry;if(!e||!ke(e))return;const t=u(e,"digitizing");if(!f(t))for(const r of t.edits){const e=p.get(r.id);if(e&&r.addFeatures&&0!==r.addFeatures.length)for(const t of e)if(!t.isTable)for(const e of r.addFeatures){const t=Ae(e,d);t&&c.add(t)}}}),s(()=>{n.map.remove(c),c.destroy()})])}function ke(e){switch(e.type){case"point":case"multipoint":return!0;case"polyline":{if(j(e))return e.curvePaths[0].length>1;const t=e.paths[0];return!!t&&t.length>1}case"polygon":{if(j(e))return e.curveRings[0].length>2;const t=e.rings[0];return!!t&&(n(t.at(0),t.at(-1))?t.length>2:t.length>1)}default:return!1}}function Ae(e,r){let n=null;switch(e.geometry?.type){case"point":case"multipoint":n=new C({angle:0,color:r,outline:new E({cap:"round",color:r,join:"round",miterLimit:1,style:"solid",width:1}),path:"undefined",size:8,style:"circle",xoffset:0,yoffset:0});break;case"polygon":n=new P({color:r,outline:new E({cap:"round",color:r,join:"round",miterLimit:1,style:"solid",width:3}),style:"none"});break;case"polyline":n=new E({cap:"round",color:r,join:"round",miterLimit:1,style:"solid",width:2});break;default:return null}return new t({geometry:e.geometry,symbol:n,attributes:{...e.attributes}})}function Oe(e,t){const r=G(t),n=L(e)?e.parent:e;return r.tablesAndLayersLookup.get(n)}function Ue(e,t){const r=Oe(e,t);if(!r)return new Map;const n=new Map;for(const o of r.layersAndTables)p(n,o.layerId,()=>[]).push(o);return n}function Le(e){const t=e.objectIdField,r=e.globalIdField??"";return{id:e.layerId,identifierFields:{objectIdField:t,globalIdField:r},addFeatures:[],deleteAttachments:[],addAttachments:[],deleteFeatures:[],updateFeatures:[]}}function Ve(e){const{edits:t,serviceInfo:n,view:o,findOriginalFeature:i}=e,a=Me(n.layersAndTables),s=n.layersAndTables.toArray(),{allEditData:l,editDataByLayerIdMap:c,editDataByIdMap:u}=qe(t,a,i),p=ze(l,xe(s,c),c);if(o&&Ce(l,p,o),0===p.length)return t;const d=H(p,{continueOnCircularDependency:!0}).map(e=>u.get(e)).filter(r),f=new Map;for(const r of d)f.set(r.uniqueId,r);const y=[];for(const r of l)f.has(r.uniqueId)||y.push(r);const m=[];let h=null;for(const r of d){const{layer:e}=r;switch(null==h?h=Le(e):h.id!==e.layerId&&(m.push(h),h=Le(e)),r.operationType){case"add":case"modify":h.addFeatures.push(r.after);break;case"delete":h.deleteFeatures.push(r.before)}}null!==h&&m.push(h);for(const r of y){const e=r.layer.layerId,t=m.find(t=>t.id===e)??Le(r.layer);switch(m.includes(t)||m.push(t),r.operationType){case"add":t.addFeatures.push(r.after);break;case"modify":t.updateFeatures.push(r.after);break;case"delete":t.deleteFeatures.push(r.before);break;case"deleteAttachment":t.deleteAttachments.push(r.attachmentId);break;case"addAttachment":t.addAttachments.push(r.attachment)}}for(const r of m)void 0!==r.deleteAttachments&&0===r.deleteAttachments.length&&delete r.deleteAttachments,void 0!==r.addAttachments&&0===r.addAttachments.length&&delete r.addAttachments;return m}function Me(e){const t=new Map;for(const r of e)t.set(r.layerId,r);return t}function xe(e,t){const r=new Map;for(const n of e)for(const e of n.relationships??[])if(r.set(Pe(n,e),""),t.has(e.relatedTableId)){const o=t.get(e.relatedTableId);if(o.length>0)for(const t of o[0].layer.relationships??[])if(t.id===e.id){r.set(Pe(n,e),t.keyField);break}}return r}function qe(e,t,r){const n=new Map,o=[],a=new Map;let s=1;for(const l of e){const e=[],c=t.get(l.id);if(!c)throw new i("featureworkflow",`Failed to prepare applyEdits payload. Layer with id ${l.id} not found.`);for(const t of l.addFeatures??[])e.push({uniqueId:"T"+s++,operationType:"add",layer:c,after:t});for(const t of l.deleteFeatures??[])e.push({uniqueId:"T"+s++,operationType:"delete",before:t,layer:c});for(const t of l.deleteAttachments??[])e.push({uniqueId:"T"+s++,operationType:"deleteAttachment",attachmentId:t,layer:c});for(const t of l.addAttachments??[])e.push({uniqueId:"T"+s++,operationType:"addAttachment",attachment:t,layer:c});for(const t of l.updateFeatures??[])e.push({uniqueId:"T"+s++,operationType:"modify",before:r(t),after:t,layer:c});n.set(c.layerId,e);for(const t of e)o.push(t),a.set(t.uniqueId,t)}return{allEditData:o,editDataByIdMap:a,editDataByLayerIdMap:n}}function ze(e,t,r){const n=[];for(const o of e){const e=o.layer.relationships??[],{uniqueId:i}=o;for(const a of e){const e=a.keyField;if("origin"===a.role){const s=r.get(a.relatedTableId);if(!s||0===s.length)continue;const l=Pe(o.layer,a),c=t.get(l);if(void 0===c||""===c)continue;switch(o.operationType){case"add":for(const t of s)t!==o&&("add"!==t.operationType&&"modify"!==t.operationType||t.after.attributes[c]===o.after.attributes[e]&&n.push([i,t.uniqueId]));break;case"modify":if(o.before.attributes[e]!==o.after.attributes[e])for(const t of s){const r=t.uniqueId;t!==o&&("delete"===t.operationType?t.before.attributes[c]===o.before.attributes[e]?n.push([r,i]):t.before.attributes[c]===o.after.attributes[e]&&n.push([i,r]):"add"===t.operationType?t.after.attributes[c]===o.after.attributes[e]?n.push([i,r]):t.after.attributes[c]===o.before.attributes[e]&&n.push([r,i]):"modify"===t.operationType&&(t.before.attributes[c]!==t.after.attributes[c]?t.after.attributes[c]===o.after.attributes[e]?n.push([i,r]):n.push([r,i]):n.push([i,r])))}break;case"delete":for(const t of s)t!==o&&("delete"!==t.operationType&&"modify"!==t.operationType||t.before.attributes[c]===o.before.attributes[e]&&n.push([t.uniqueId,i]))}}}}return n}function Pe(e,t){return`${e.layerId}:${t.id}`}function Ee(e,t){return!!(t?.map&&"utilityNetworks"in t.map&&t.map.utilityNetworks?.length&&t.map.utilityNetworks.some(t=>!(!t.loaded||!e.url?.startsWith(t.featureServiceUrl)||e.layerId!==t.networkSystemLayers.associationsTableId)))}function Ce(e,t,r){const n=[];for(const i of e)Ee(i.layer,r)&&n.push(i);if(0===n.length)return;let o=[];for(const i of n){const r=i.layer;switch(i.operationType){case"delete":o=[...Re(i.before.attributes[r.fieldsIndex.get("fromglobalid").name],e),...Re(i.before.attributes[r.fieldsIndex.get("toglobalid").name],e)];for(const e of o)t.push([i.uniqueId,e.uniqueId]);break;case"add":o=[...Re(i.after.attributes[r.fieldsIndex.get("fromglobalid").name],e),...Re(i.after.attributes[r.fieldsIndex.get("toglobalid").name],e)];for(const e of o)t.push([e.uniqueId,i.uniqueId])}}}function Re(e,t){const r=[],n=t.filter(({layer:e})=>""!==e.globalIdField&&null!=e.globalIdField);for(const o of n){const t=o.layer.globalIdField;("before"in o&&o.before?.attributes[t]===e||"after"in o&&o.after?.attributes[t]===e)&&r.push(o)}return r}async function De(e,r,n,o,i){const a=new t({sourceLayer:r,attributes:n}),{rotation:s,size:l}=ye(a);let c=await D(a,{useSourceLayer:!0,webStyleCache:o,scale:i}),u=!1;for(const t of[l,s]){if(null==t)continue;null==n[t.field]&&(n[t.field]=await t.getDefaultValue(c,e.view),u=!0)}switch(u&&(c=await D(a,{useSourceLayer:!0,webStyleCache:o,scale:i})),c?.type){case"simple-fill":case"polygon-3d":e.polygonSymbol=c;break;case"simple-line":case"line-3d":e.polylineSymbol=c;break;case"simple-marker":case"picture-marker":case"point-3d":case"cim":e.pointSymbol=c;break;case"mesh-3d":e.meshSymbol=c}Ge(e.tooltipOptions,l,s)}function Ge(e,t,r){e.visualVariables=null!=t||null!=r?{size:null!=t?{unit:t.displayUnit,axis:t.axis,valueType:t.fieldType}:null,rotation:null!=r?{valueType:r.fieldType,rotationType:r.rotationType??"geographic"}:null}:null}function Be(e,t){return e.find(e=>e.layer===t)}function Ne(e,t){const r=Be(e,t);if(null==r)throw new i("no-editorItem-found","The EditorViewModel provided did not have an EditorItem associated with the specified layer");return r}function Ze(e,t){return e?.find(e=>e.layer===t)}async function We(e,t,r,n){switch(t.type){case"3d":return $e(e,t,r,n);case"2d":return Qe(e,t,r,n)}}async function $e(e,t,r,n){if(0===e.length)return[];const{updatable:i,graphicsByLayer:a}=await r.defer(async()=>{const{results:o}=await y(Q(t,r),n),i=new Map,a=e=>{const t=e.layer,r=i.get(t);if(!r){const e=new Array;return i.set(t,e),e}return r};$(o).forEach(({graphic:e})=>a(e).push(e));const s=e.filter(({capabilities:e,layer:t})=>e.update.enabled&&i.has(t));return 0!==s.length&&r.stopPropagation(),{updatable:s,graphicsByLayer:i}});return y(Promise.allSettled(i.map(async({layer:e})=>{const t=a.get(e),r=He(e);if(t.every(e=>A(e,r)))return t;const i=[];for(const n of t){i.push(n.getObjectId());const e=Object.keys(n.attributes);o(r,e)}const s=e.createQuery();return s.returnGeometry=!1,s.objectIds=i,s.outFields=O(e.fieldsIndex,r),e.queryFeatures(s,{signal:n}).then(({features:e})=>e)})),n)}async function Qe(e,t,r,n){if(0===e.length)return[];const{mapPoint:o}=r;if(null==o)return[];let i=null;const a=await r.defer(async()=>{const{results:o}=await y(t.hitTest(r),n);if(0===o.length)return[];const a=new Set;i=$(o),i.forEach(({graphic:e})=>e&&a.add(e.layer));const s=e.filter(e=>a.has(e.layer)&&e.supportsUpdateWorkflow);return s.length>0&&r.stopPropagation(),s});return y(Promise.allSettled(a.map(async({layer:e})=>{const a=e.createQuery();a.returnGeometry=!0,a.outFields=He(e);const s="renderer"in e?V({renderer:e.renderer,pointerType:r.pointerType}):0;a.geometry=W(o,s,t),a.outSpatialReference=t.spatialReference;const{features:l}=await e.queryFeatures(a,{signal:n});return i?.forEach(({graphic:t})=>{t.layer!==e||l.some(e=>e.getObjectId()===t.getObjectId())||l.push(t)}),l})),n)}function He(e){return O(e.fieldsIndex,[e.objectIdField,U({displayField:"displayField"in e?e.displayField:null,fields:e.fields})])}async function Je(e,t,n,o){const i=e.map(e=>e.getObjectId()??e.attributes[t.objectIdField]).filter(r);return await Z(i,t,n,o)}async function Ke(e){const{graphic:t,sketchViewModel:r,sourceLayer:n,updateOptions:o,visualVariables:i}=e;await Ye(e);const a={multipleSelectionEnabled:!1,...o};return"point"===n.geometryType&&(a.enableRotation=null!=i.rotation,a.enableScaling=null!=i.size),r.update(t,a)}function Xe(e,t){const{activeUpdateOptions:r}=e;r&&(e.activeUpdateOptions={...r,...t,reshapeOptions:{...r.reshapeOptions,...t.reshapeOptions},highlightOptions:{...r.highlightOptions,...t.highlightOptions}})}async function Ye(e){const{graphic:t,sketchLayer:r,sketchViewModel:n,sourceLayer:o,visualVariables:i,webStyleCache:a}=e;let s=!1;const{rotation:l,size:c}=i;for(const u of[l,c]){if(null==u)continue;const e=t.getAttribute(u.field);if(null!=e)u.setInitialValue(e);else{const e=await u.getDefaultValue(t.symbol,n.view);u.setInitialValue(e),t.setAttribute(u.field,e),s=!0}}if(s){const e="2d"===n.view?.type?n.view.scale:null;await N(t,a,e)}Ge(n.tooltipOptions,c,l),r.elevationInfo=o.elevationInfo}function _e(e){return null==e||"rotate-start"!==e.type&&"rotate"!==e.type&&"rotate-stop"!==e.type?null:e}function et(e){return null==e||"scale-start"!==e.type&&"scale"!==e.type&&"scale-stop"!==e.type?null:e}function tt(e,t,r,n){if(null==t.geometry||"point"!==t.geometry?.type)return!1;const o=t.attributes;let i=!1;const a=n.rotation,s=_e(r.toolEventInfo);if(null!=a&&null!=s){const{field:r,getValue:n}=a;if("rotate-stop"===s.type)a.isUpdatingInteractively=!1,a.setInitialValue(t.getAttribute(r));else{a.isUpdatingInteractively=!0;const l=n(s.angle,e);l!==o[r]&&t.setAttribute(r,l),i=!0}}const l=n.size,c=et(r.toolEventInfo);if(null!=l&&null!=c){const{field:r,getValue:n}=l;if("scale-stop"===c.type)l.isUpdatingInteractively=!1,l.setInitialValue(t.getAttribute(r));else{l.isUpdatingInteractively=!0;const a=n(c.xScale,e);a!==o[r]&&t.setAttribute(r,a),i=!0}}return i}async function rt({feature:e,featureClone:t,sketchLayer:r,sketchViewModel:n,getUpdateOptions:o,view:i,visualVariableAttributes:c,webStyleCache:u,addHandle:p,addUpdatingPromise:f,onUpdate:y}){await N(t,u,"2d"===i.type?i.scale:null);let h=null;if("2d"===n?.view?.type){const e=d(e=>N(t,u,e));h=m(()=>n?.view?.scale,t=>e(t))}const b=t.sourceLayer,w=ct(i,b);await Ke({graphic:t,sketchLayer:r,sketchViewModel:n,sourceLayer:b,updateOptions:o(),visualVariables:c,webStyleCache:u});let I=null;w.then(e=>I=e).catch(()=>{});const v=c.size,T=c.rotation,F=m(()=>e.attributes,async e=>{let r=!1;for(const n in e){const o=e[n];o!==t.getAttribute(n)&&(t.setAttribute(n,o),null==v||v.isUpdatingInteractively||v.field!==n||v.setInitialValue(o),null==T||T.isUpdatingInteractively||T.field!==n||T.setInitialValue(o),(null==I||I.requiredFields.includes(n))&&(r=!0))}r&&await N(t,u,"2d"===i.type?i.scale:null)}),j=n.on("update",async e=>{const t=e.graphics[0],a={graphic:t,sketchLayer:r,sketchViewModel:n,sourceLayer:b,updateOptions:o(),visualVariables:c,webStyleCache:u};if("complete"===e.state){if(null===i.activeTool)return Ke(a);const e=new AbortController,t=l(e);return p(t),f(g(()=>null===i.activeTool,e.signal).then(async()=>{if(!e.signal.aborted)return e.abort(),Ke(a)}))}tt(i,t,e,c)&&await N(t,u,"2d"===i.type?i.scale:null),y(pt(t),e)}),S=n.on(["undo","redo"],e=>{y(pt(e.graphics[0]),e)});return a([S,j,s(()=>n.cancel()),F,h])}const nt={icon:b(24),text:b(12),line:b(1),viewScaleSizeFactor:100};function ot(e,t,r){let n=!1;return e.filter(e=>!!n||(n=e===t,n)).map(e=>r[e]())}function it(e,t){e.viewModel.syncFeatureTemplates();const r=e.creationInfo;if("awaiting-feature-creation-info"===t[0].id&&r){const n=r.layer,o=e.viewModel.getTemplatesForLayer(n);1===o.length&&"scene"!==n.type&&(r.template=o[0],t.shift())}return t}function at(e){return"unknown"===e?null:e}function st(e){e.filesEnabled=!0,e.mode="view",e.capabilities={editing:!0,operations:{add:!0,update:!0,delete:!0}}}const lt=e=>e.includes("-stop")||e.includes("vertex-"),ct=(e,t)=>{const r="subtype-sublayer"===t.type?t.parent:t;return e.whenLayerView(r)};function ut(e){return"createInteractiveEditSession"in e}function pt(e){const t=e.geometry;if("mesh"===t?.type){const r=e.cloneShallow();return r.attributes=c(e.attributes),r.geometry=t.cloneShallow(),r.geometry.transform=t.transform?.clone()??null,r}return e.clone()}function dt(e){return e.acquireCursor("progress")}function ft(e){for(const t of e){const{destinationGraphic:e,destinationField:r,sourceGraphic:n,sourceField:o}=t;e.setAttribute(r,n.getAttribute(o))}}function yt(e){const t=e.templateExecutorInfo?.completionResults;return t?.length?(t.forEach(e=>ft(e.relationships)),t.flatMap(e=>e.edits)):null}function mt(e){const t=ie(e)?e.activeWorkflow:e;if(null==t)return[];if(re(t))return t.data.layers;const r=t.layer;return r?[r]:[]}function ht({attributes:e},t){const r=new Set;r.add(t.objectIdField),"uniqueIdFields"in t&&t.uniqueIdFields&&t.uniqueIdFields.length>0&&w(r,t.uniqueIdFields);const n={};for(const o of r)null!=e[o]&&(n[o]=e[o]);if("scene"===t.type&&null!=t.infoFor3D){const r=t.associatedLayer?.globalIdField;null!=r&&(e[r]=e[r])}return n}function gt(e){if(!bt(e))return e;const t=new Map;for(const r of e){const e=r.getObjectId();if(null!=e){const n=r.sourceLayer??r.layer;p(t,n,()=>[]).push(e)}}return Array.from(t.entries()).map(([e,t])=>({layer:e,objectIds:t}))}function bt(e){return 0===e.length||z(e[0])}function wt({drawTool:e},t){const r=e?.mostDownstreamPlugin?.configuration?.curveTypes;if(!t||!r||0===r.length)return!1;const n=new Set(t.capabilities.supportedCurveTypes);return r.some(e=>!n.has(e))}function It(e,t){const r=new Set(t.capabilities.supportedCurveTypes);return e.some(({geometry:e})=>e&&j(e)&&S(e,r))}export{wt as activeSketchToolDrawsUnsupportedCurve,Ce as appendAllUtilityNetworkAssociationRelationships,it as avoidFeatureTemplateSelectionWithOnlyOneItem,ut as canCreateInteractiveEditSession,pt as cloneGraphicExceptMesh,It as containsUnsupportedCurve,Me as createLayerIdMap,xe as createRelationshipKeyMap,ve as createToolFromGeometryType,ot as createWorkflowSteps,We as fetchCandidates,Je as fetchFullFeatures,ze as findAllDependencies,Re as findChangesByGlobalId,Be as findEditorItemForLayer,Ne as findEditorItemForLayerOrThrow,Ze as findLayerInfo,Pe as generateHashForRelationship,mt as getLayersFromWorkflow,me as getRotationVariableAttribute,yt as getServiceEditsFromWorkflowData,Oe as getServiceInfoForLayer,Ue as getServiceLayersById,be as getSizeVariableAttribute,ye as getVisualVariableAttributes,fe as getVisualVariablesForLayer,Y as isAnyUpdateLeafWorkflow,_ as isBatchAttributeFormViewModel,ee as isCreateFeaturesWorkflow,te as isFeatureFormViewModel,bt as isGraphicsArray,ae as isMergeFeaturesWorkflow,ce as isMergeWorkflowOptions,le as isParentWorkflow,se as isSplitFeatureWorkflow,ue as isSplitWorkflowOptions,lt as isTerminalUpdateEventType,ne as isUpdateFeatureWorkflow,re as isUpdateFeaturesWorkflow,de as isUpdateFeaturesWorkflowOptions,oe as isUpdateRecordWorkflow,ie as isUpdateWorkflow,Ee as isUtilityNetworkAssociationsTable,ht as makeMinimalAttributes,Ve as orderEditsByRelationshipDependencies,st as prepareAttachmentsForCreateFeaturesWorkflow,ft as setRelationshipFields,rt as setUpGeometryUpdate,Fe as setUpSketchCreateWatchers,Ye as setVisualVariablesAndElevationInfoForUpdate,dt as showProgressCursor,nt as sizeDefaults,at as sizeVariableUnitToLengthUnit,Te as startCreatingNewFeature,Ke as startUpdatingFeatureGeometry,Xe as syncUpdateOptions,gt as toFeatureInfos,tt as visualVariableInteractiveUpdate,ct as whenEditorLayerView,pe as workflowInfluencesOutcomeOfParent};
|
|
2
|
+
import e from"../../Color.js";import t from"../../Graphic.js";import{isSome as r,equals as n,addMany as o}from"../../core/arrayUtils.js";import i from"../../core/Error.js";import{handlesGroup as a,makeHandle as s,abortHandle as l}from"../../core/handleUtils.js";import{clone as c}from"../../core/lang.js";import u from"../../core/Logger.js";import{getOrCreateMapValue as p}from"../../core/MapUtils.js";import{debounce as d,isPromiseLike as f,whenOrAbort as y}from"../../core/promiseUtils.js";import{watch as m,on as h,whenOnce as g,when as b}from"../../core/reactiveUtils.js";import{px2pt as w}from"../../core/screenUtils.js";import{addMany as I}from"../../core/SetUtils.js";import{isSharedTemplateOrMetadata as v,isSharedGroupTemplate as T,getCreationAttributes as F,isSharedPresetTemplate as j}from"../../editing/templateUtils.js";import{isCurvedGeometry as S,hasUnsupportedCurve as k}from"../../geometry/support/curves/curveUtils.js";import A from"../../layers/GraphicsLayer.js";import{featureHasFields as O,fixFields as U,getDisplayFieldName as L}from"../../layers/support/fieldUtils.js";import{isSubtypeSublayer as V}from"../../layers/support/layerUtils.js";import{calculateTolerance as M}from"../../renderers/support/clickToleranceUtils.js";import{meterIn as x}from"../../renderers/support/lengthUtils.js";import{isRenderer as q}from"../../renderers/support/typeUtils.js";import{getTransformationType as z}from"../../renderers/visualVariables/support/sizeVariableUtils.js";import{isGraphic as P}from"../../support/graphicInstanceUtils.js";import E from"../../symbols/SimpleFillSymbol.js";import C from"../../symbols/SimpleLineSymbol.js";import R from"../../symbols/SimpleMarkerSymbol.js";import{to3D as D}from"../../symbols/support/symbolConversion.js";import{getDisplayedSymbol as G}from"../../symbols/support/symbolUtils.js";import{getServices as B}from"../../undoredo/support/Services.js";import{defaultDrawingMode as N}from"../../views/draw/drawingModes.js";import{updateGraphicSymbolWhenRequired as Z,fetchFullFeaturesByObjectId as W}from"../../views/draw/support/editingSessionUtils.js";import{createQueryGeometry as $}from"../../views/support/drapedUtils.js";import{filterGraphicHits as Q,hitTestSelectSimilarDistance as H}from"../../views/support/hitTestSelectUtils.js";import{dependencySort as J}from"./support/dependencySort.js";import{isDrawGraphicTool as K,isDrawTool as X}from"../Sketch/support/sketchUtils.js";const Y=()=>u.getLogger("esri.widgets.Editor.workflowUtils");function _(e){return ie(e)||ne(e)}function ee(e){return!!e&&"features"in e}function te(e){return null!=e&&"create-features"===e.type}function re(e){return!!e&&"feature"in e}function ne(e){return null!=e&&"update-features"===e.type}function oe(e){return null!=e&&"update-feature"===e.type}function ie(e){return null!=e&&e.type.includes("update-")&&"fullFeature"in e}function ae(e){return null!=e&&"update"===e.type}function se(e){return null!=e&&"merge-features"===e.type}function le(e){return null!=e&&"split-feature"===e.type}function ce(e){const t=e?.type;return"update-feature"===t||"update-table-record"===t||"update-features"===t||"split-feature"===t}function ue(e){return"merge"===e?.type}function pe(e){return"split"===e?.type}function de(e){return se(e)||le(e)}function fe(e){return"update-multiple"===e?.type}function ye(e){const t=e&&"renderer"in e?e.renderer:null;if(!ve(t))return{rotation:null,size:null};const r=t.getVisualVariablesForType("rotation").filter(e=>(!e.axis||"heading"===e.axis)&&e.field&&!e.valueExpression),n=t.getVisualVariablesForType("size").filter(e=>e.field&&!e.useSymbolValue&&!e.valueExpression&&"real-world-size"===z(e));return{rotation:1===r.length?r[0]:null,size:1===n.length?n[0]:null}}function me(e){const t=e.sourceLayer;if(!(t&&"renderer"in t&&ve(t.renderer)))return{rotation:null,size:null};const{rotation:r,size:n}=ye(t);let o=null,i=null;if(r){const e=t.fields?.filter(e=>e.name===r.field),n=1===e?.length?e[0]:null;o=he(r,n)}if(n){const e=t.fields?.filter(e=>e.name===n.field),r=1===e?.length?e[0]:null;i=we(n,r)}return{rotation:o,size:i}}function he(e,t){const r="heading"===(e.axis||"heading")&&"arithmetic"===e.rotationType?-1:1,n=t?.type??"double",o={initial:0,current:0};return{field:e.field,fieldType:n,getDefaultValue:()=>Promise.resolve(0),getValue:e=>(o.current=o.initial-r*e,Ie((o.current+360)%360,n)),setInitialValue:e=>{o.initial=e,o.current=0},isUpdatingInteractively:!1,rotationType:e.rotationType??"geographic"}}function ge(e,t){switch(t){case"width":return e[0];case"depth":return e[1];case"height":return e[2];default:return e[2]||e[1]||e[0]}}async function be(e,t,r){if(null==t)return 0;const{symbol:n}=D(t);if(null==n||"web-style"===n.type||"cim"===n.type)return 0;const o=n.symbolLayers.at(0);if(!o)return 0;switch(o.type){case"icon":{const{computeIconLayerResourceSize:e}=await import("../../symbols/support/symbolLayerUtils.js");return Math.min(ot.icon,(await e(o,ot.icon))[0])||ot.icon}case"text":return ot.text;case"line":return ot.line;case"object":{const{computeObjectLayerResourceSize:t}=await import("../../symbols/support/symbolLayerUtils.js");return ge(await t(o,e.scale/ot.viewScaleSizeFactor),r)}case"path":case"extrude":return e.scale/ot.viewScaleSizeFactor;default:return 0}}function we(e,t){const r=e.axis,n=t?.type??"double",o={initial:0,current:0},i=x[e.valueUnit]??1;let a;return a="area"===e.valueRepresentation?e=>(e*i/2)**2*Math.PI:"radius"===e.valueRepresentation||"distance"===e.valueRepresentation?e=>e*i/2:e=>e*i,{field:e.field,fieldType:n,getDefaultValue:async(e,t)=>Ie(a(await be(t,e,r)),n),getValue:(e,t)=>(o.initial||(o.initial=t.pixelSizeAt(t.center)),o.current=o.initial*e,Ie(o.current,n)),setInitialValue:e=>{o.initial=e,o.current=0},isUpdatingInteractively:!1,displayUnit:st(e.valueUnit),axis:e.axis}}function Ie(e,t){switch(t){case"small-integer":case"integer":case"long":return Math.round(e);case"double":case"single":return e;default:return 0}}function ve(e){if(!q(e))return!1;switch(e?.type){case"class-breaks":case"simple":case"unique-value":case"dot-density":case"dictionary":case"pie-chart":return!0;default:return!1}}function Te(e,t){if(!e||!t)throw new Error("no geometry type");if("multipatch"===e)return{tool:"mesh",createOptions:{mode:"hybrid"}};const r=new Map;r.set("circle",{mode:"freehand"}),r.set("rectangle",{mode:"freehand"});const n={mode:N,optionsPerTool:r};if(v(t)){const o=t.defaultTool,i=T(t)?t.definition?.inputGeometryType??e:e;switch(o){case"freehand":case"stream-line":return{tool:"polyline"===i?"freehandPolyline":"freehandPolygon",createOptions:n};case"autocomplete-freehand-polygons":case"stream-polygon":return{tool:"freehandPolygon",createOptions:n};case"autocomplete-polygons":case"difference-polygon":case"create-structures":case"polygon":case"trace":return{tool:"polygon"===i?"polygon":"polyline",createOptions:n};case"circle":return r.get("circle").preserveAspectRatio=!0,{tool:"circle",createOptions:n};case"ellipse":return r.get("circle").preserveAspectRatio=!1,{tool:"circle",createOptions:n};case"create-points-along-line":case"multipoint":return{tool:"multipoint",createOptions:n};case"line":case"radial-line":case"right-angle-line":case"split":case"two-point-line":return{tool:"polyline",createOptions:n};case"rectangle":case"regular-polygon":case"right-angle-polygon":return{tool:"rectangle",createOptions:n};case"elevation-point-from-contour":case"elevation-point-from-dem":case"parcel-seed":case"point":case"point-and-rotation":case"point-at-end-of-line":return{tool:"point",createOptions:n}}}else{const o=t.drawingTool;if("circle"===o||"ellipse"===o)return r.get("circle").preserveAspectRatio="circle"===o,{tool:"circle",createOptions:n};if("rectangle"===o)return{tool:"rectangle",createOptions:n};if("freehand"===o)return{tool:"polygon"===e?"freehandPolygon":"freehandPolyline",createOptions:n}}return{tool:e,createOptions:n}}async function Fe(e,t,r,n){const{creationInfo:o,fullTemplate:a}=r;if(!o)throw new i("featureworkflow","No creation info provided.");const s=o.layer,l=F(a,o.attributeOverrides,o.layer),{view:c}=e,u="2d"===c?.type;T(a)||j(a)||await Ge(e,s,l,n,u?c.scale:null);const{capabilities:p}=s;t.elevationInfo=s.elevationInfo;const d=Te(s.geometryType,a);e.defaultCreateOptions={graphicProperties:{attributes:l,sourceLayer:s},mode:d.createOptions.mode,optionsPerTool:d.createOptions.optionsPerTool,preserveAspectRatio:d.createOptions.preserveAspectRatio,hasZ:p.data.supportsZ,defaultZ:(u?p.editing.zDefault:null)??e.defaultCreateOptions.defaultZ},null==o.geometryToPlace?await e.create(d.tool):await e.place(o.geometryToPlace,{graphicProperties:{attributes:l,sourceLayer:s}})}async function je(e){return a([Se(e),ke(e)])}function Se({creationAttributes:e,data:t,sketchViewModel:r,view:n,webStyleCache:o}){const{creationInfo:i}=t,{fullTemplate:a}=t;if(!i||"2d"!==n?.type||T(a)||j(a))return null;const s=d(t=>Ge(r,i.layer,e,o,t));return m(()=>n.scale,e=>s(e))}function ke({data:t,sketchViewModel:r,view:n}){const{templateExecutorInfo:o}=t;if(!o)return null;const l=r.activeComponent;if(!n||!K(l)&&!X(l))return Y().error(new i("featureworkflow","Failed to set up template feedback.")),null;const c=new A({effect:"saturate(0.6) opacity(0.8)",listMode:"hide",title:"Shared Template Feedback Graphics"});n.map?.add(c);const{executor:u,serviceLayersById:p}=o,d=n.theme?.accentColor??new e([255,165,0,1]);return a([h(()=>l,["cursor-update","vertex-add"],()=>{c.removeAll();const e=K(l)?l.graphic?.geometry:l.unprocessedGeometry;if(!e||!Ae(e))return;const t=u(e,"digitizing");if(!f(t))for(const r of t.edits){const e=p.get(r.id);if(e&&r.addFeatures&&0!==r.addFeatures.length)for(const t of e)if(!t.isTable)for(const e of r.addFeatures){const t=Oe(e,d);t&&c.add(t)}}}),s(()=>{n.map.remove(c),c.destroy()})])}function Ae(e){switch(e.type){case"point":case"multipoint":return!0;case"polyline":{if(S(e))return e.curvePaths[0].length>1;const t=e.paths[0];return!!t&&t.length>1}case"polygon":{if(S(e))return e.curveRings[0].length>2;const t=e.rings[0];return!!t&&(n(t.at(0),t.at(-1))?t.length>2:t.length>1)}default:return!1}}function Oe(e,r){let n=null;switch(e.geometry?.type){case"point":case"multipoint":n=new R({angle:0,color:r,outline:new C({cap:"round",color:r,join:"round",miterLimit:1,style:"solid",width:1}),path:"undefined",size:8,style:"circle",xoffset:0,yoffset:0});break;case"polygon":n=new E({color:r,outline:new C({cap:"round",color:r,join:"round",miterLimit:1,style:"solid",width:3}),style:"none"});break;case"polyline":n=new C({cap:"round",color:r,join:"round",miterLimit:1,style:"solid",width:2});break;default:return null}return new t({geometry:e.geometry,symbol:n,attributes:{...e.attributes}})}function Ue(e,t){const r=B(t),n=V(e)?e.parent:e;return r.tablesAndLayersLookup.get(n)}function Le(e,t){const r=Ue(e,t);if(!r)return new Map;const n=new Map;for(const o of r.layersAndTables)p(n,o.layerId,()=>[]).push(o);return n}function Ve(e){const t=e.objectIdField,r=e.globalIdField??"";return{id:e.layerId,identifierFields:{objectIdField:t,globalIdField:r},addFeatures:[],deleteAttachments:[],addAttachments:[],deleteFeatures:[],updateFeatures:[]}}function Me(e){const{edits:t,serviceInfo:n,view:o,findOriginalFeature:i}=e,a=xe(n.layersAndTables),s=n.layersAndTables.toArray(),{allEditData:l,editDataByLayerIdMap:c,editDataByIdMap:u}=ze(t,a,i),p=Pe(l,qe(s,c),c);if(o&&Re(l,p,o),0===p.length)return t;const d=J(p,{continueOnCircularDependency:!0}).map(e=>u.get(e)).filter(r),f=new Map;for(const r of d)f.set(r.uniqueId,r);const y=[];for(const r of l)f.has(r.uniqueId)||y.push(r);const m=[];let h=null;for(const r of d){const{layer:e}=r;switch(null==h?h=Ve(e):h.id!==e.layerId&&(m.push(h),h=Ve(e)),r.operationType){case"add":case"modify":h.addFeatures.push(r.after);break;case"delete":h.deleteFeatures.push(r.before)}}null!==h&&m.push(h);for(const r of y){const e=r.layer.layerId,t=m.find(t=>t.id===e)??Ve(r.layer);switch(m.includes(t)||m.push(t),r.operationType){case"add":t.addFeatures.push(r.after);break;case"modify":t.updateFeatures.push(r.after);break;case"delete":t.deleteFeatures.push(r.before);break;case"deleteAttachment":t.deleteAttachments.push(r.attachmentId);break;case"addAttachment":t.addAttachments.push(r.attachment)}}for(const r of m)void 0!==r.deleteAttachments&&0===r.deleteAttachments.length&&delete r.deleteAttachments,void 0!==r.addAttachments&&0===r.addAttachments.length&&delete r.addAttachments;return m}function xe(e){const t=new Map;for(const r of e)t.set(r.layerId,r);return t}function qe(e,t){const r=new Map;for(const n of e)for(const e of n.relationships??[])if(r.set(Ee(n,e),""),t.has(e.relatedTableId)){const o=t.get(e.relatedTableId);if(o.length>0)for(const t of o[0].layer.relationships??[])if(t.id===e.id){r.set(Ee(n,e),t.keyField);break}}return r}function ze(e,t,r){const n=new Map,o=[],a=new Map;let s=1;for(const l of e){const e=[],c=t.get(l.id);if(!c)throw new i("featureworkflow",`Failed to prepare applyEdits payload. Layer with id ${l.id} not found.`);for(const t of l.addFeatures??[])e.push({uniqueId:"T"+s++,operationType:"add",layer:c,after:t});for(const t of l.deleteFeatures??[])e.push({uniqueId:"T"+s++,operationType:"delete",before:t,layer:c});for(const t of l.deleteAttachments??[])e.push({uniqueId:"T"+s++,operationType:"deleteAttachment",attachmentId:t,layer:c});for(const t of l.addAttachments??[])e.push({uniqueId:"T"+s++,operationType:"addAttachment",attachment:t,layer:c});for(const t of l.updateFeatures??[])e.push({uniqueId:"T"+s++,operationType:"modify",before:r(t),after:t,layer:c});n.set(c.layerId,e);for(const t of e)o.push(t),a.set(t.uniqueId,t)}return{allEditData:o,editDataByIdMap:a,editDataByLayerIdMap:n}}function Pe(e,t,r){const n=[];for(const o of e){const e=o.layer.relationships??[],{uniqueId:i}=o;for(const a of e){const e=a.keyField;if("origin"===a.role){const s=r.get(a.relatedTableId);if(!s||0===s.length)continue;const l=Ee(o.layer,a),c=t.get(l);if(void 0===c||""===c)continue;switch(o.operationType){case"add":for(const t of s)t!==o&&("add"!==t.operationType&&"modify"!==t.operationType||t.after.attributes[c]===o.after.attributes[e]&&n.push([i,t.uniqueId]));break;case"modify":if(o.before.attributes[e]!==o.after.attributes[e])for(const t of s){const r=t.uniqueId;t!==o&&("delete"===t.operationType?t.before.attributes[c]===o.before.attributes[e]?n.push([r,i]):t.before.attributes[c]===o.after.attributes[e]&&n.push([i,r]):"add"===t.operationType?t.after.attributes[c]===o.after.attributes[e]?n.push([i,r]):t.after.attributes[c]===o.before.attributes[e]&&n.push([r,i]):"modify"===t.operationType&&(t.before.attributes[c]!==t.after.attributes[c]?t.after.attributes[c]===o.after.attributes[e]?n.push([i,r]):n.push([r,i]):n.push([i,r])))}break;case"delete":for(const t of s)t!==o&&("delete"!==t.operationType&&"modify"!==t.operationType||t.before.attributes[c]===o.before.attributes[e]&&n.push([t.uniqueId,i]))}}}}return n}function Ee(e,t){return`${e.layerId}:${t.id}`}function Ce(e,t){return!!(t?.map&&"utilityNetworks"in t.map&&t.map.utilityNetworks?.length&&t.map.utilityNetworks.some(t=>!(!t.loaded||!e.url?.startsWith(t.featureServiceUrl)||e.layerId!==t.networkSystemLayers.associationsTableId)))}function Re(e,t,r){const n=[];for(const i of e)Ce(i.layer,r)&&n.push(i);if(0===n.length)return;let o=[];for(const i of n){const r=i.layer;switch(i.operationType){case"delete":o=[...De(i.before.attributes[r.fieldsIndex.get("fromglobalid").name],e),...De(i.before.attributes[r.fieldsIndex.get("toglobalid").name],e)];for(const e of o)t.push([i.uniqueId,e.uniqueId]);break;case"add":o=[...De(i.after.attributes[r.fieldsIndex.get("fromglobalid").name],e),...De(i.after.attributes[r.fieldsIndex.get("toglobalid").name],e)];for(const e of o)t.push([e.uniqueId,i.uniqueId])}}}function De(e,t){const r=[],n=t.filter(({layer:e})=>""!==e.globalIdField&&null!=e.globalIdField);for(const o of n){const t=o.layer.globalIdField;("before"in o&&o.before?.attributes[t]===e||"after"in o&&o.after?.attributes[t]===e)&&r.push(o)}return r}async function Ge(e,r,n,o,i){const a=new t({sourceLayer:r,attributes:n}),{rotation:s,size:l}=me(a);let c=await G(a,{useSourceLayer:!0,webStyleCache:o,scale:i}),u=!1;for(const t of[l,s]){if(null==t)continue;null==n[t.field]&&(n[t.field]=await t.getDefaultValue(c,e.view),u=!0)}switch(u&&(c=await G(a,{useSourceLayer:!0,webStyleCache:o,scale:i})),c?.type){case"simple-fill":case"polygon-3d":e.polygonSymbol=c;break;case"simple-line":case"line-3d":e.polylineSymbol=c;break;case"simple-marker":case"picture-marker":case"point-3d":case"cim":e.pointSymbol=c;break;case"mesh-3d":e.meshSymbol=c}Be(e.tooltipOptions,l,s)}function Be(e,t,r){e.visualVariables=null!=t||null!=r?{size:null!=t?{unit:t.displayUnit,axis:t.axis,valueType:t.fieldType}:null,rotation:null!=r?{valueType:r.fieldType,rotationType:r.rotationType??"geographic"}:null}:null}function Ne(e,t){return e.find(e=>e.layer===t)}function Ze(e,t){const r=Ne(e,t);if(null==r)throw new i("no-editorItem-found","The EditorViewModel provided did not have an EditorItem associated with the specified layer");return r}function We(e,t){return e?.find(e=>e.layer===t)}async function $e(e,t,r,n){switch(t.type){case"3d":return Qe(e,t,r,n);case"2d":return He(e,t,r,n)}}async function Qe(e,t,r,n){if(0===e.length)return[];const{updatable:i,graphicsByLayer:a}=await r.defer(async()=>{const{results:o}=await y(H(t,r),n),i=new Map,a=e=>{const t=e.layer,r=i.get(t);if(!r){const e=new Array;return i.set(t,e),e}return r};Q(o).forEach(({graphic:e})=>a(e).push(e));const s=e.filter(({capabilities:e,layer:t})=>e.update.enabled&&i.has(t));return 0!==s.length&&r.stopPropagation(),{updatable:s,graphicsByLayer:i}});return y(Promise.allSettled(i.map(async({layer:e})=>{const t=a.get(e),r=Je(e);if(t.every(e=>O(e,r)))return t;const i=[];for(const n of t){i.push(n.getObjectId());const e=Object.keys(n.attributes);o(r,e)}const s=e.createQuery();return s.returnGeometry=!1,s.objectIds=i,s.outFields=U(e.fieldsIndex,r),e.queryFeatures(s,{signal:n}).then(({features:e})=>e)})),n)}async function He(e,t,r,n){if(0===e.length)return[];const{mapPoint:o}=r;if(null==o)return[];let i=null;const a=await r.defer(async()=>{const{results:o}=await y(t.hitTest(r),n);if(0===o.length)return[];const a=new Set;i=Q(o),i.forEach(({graphic:e})=>e&&a.add(e.layer));const s=e.filter(e=>a.has(e.layer)&&e.supportsUpdateWorkflow);return s.length>0&&r.stopPropagation(),s});return y(Promise.allSettled(a.map(async({layer:e})=>{const a=e.createQuery();a.returnGeometry=!0,a.outFields=Je(e);const s="renderer"in e?M({renderer:e.renderer,pointerType:r.pointerType}):0;a.geometry=$(o,s,t),a.outSpatialReference=t.spatialReference;const{features:l}=await e.queryFeatures(a,{signal:n});return i?.forEach(({graphic:t})=>{t.layer!==e||l.some(e=>e.getObjectId()===t.getObjectId())||l.push(t)}),l})),n)}function Je(e){return U(e.fieldsIndex,[e.objectIdField,L({displayField:"displayField"in e?e.displayField:null,fields:e.fields})])}async function Ke(e,t,n,o){const i=e.map(e=>e.getObjectId()??e.attributes[t.objectIdField]).filter(r);return await W(i,t,n,o)}async function Xe(e){const{graphic:t,sketchViewModel:r,sourceLayer:n,updateOptions:o,visualVariables:i}=e;await _e(e);const a={multipleSelectionEnabled:!1,...o};return"point"===n.geometryType&&(a.enableRotation=null!=i.rotation,a.enableScaling=null!=i.size),r.update(t,a)}function Ye(e,t){const{activeUpdateOptions:r}=e;r&&(e.activeUpdateOptions={...r,...t,reshapeOptions:{...r.reshapeOptions,...t.reshapeOptions},highlightOptions:{...r.highlightOptions,...t.highlightOptions}})}async function _e(e){const{graphic:t,sketchLayer:r,sketchViewModel:n,sourceLayer:o,visualVariables:i,webStyleCache:a}=e;let s=!1;const{rotation:l,size:c}=i;for(const u of[l,c]){if(null==u)continue;const e=t.getAttribute(u.field);if(null!=e)u.setInitialValue(e);else{const e=await u.getDefaultValue(t.symbol,n.view);u.setInitialValue(e),t.setAttribute(u.field,e),s=!0}}if(s){const e="2d"===n.view?.type?n.view.scale:null;await Z(t,a,e)}Be(n.tooltipOptions,c,l),r.elevationInfo=o.elevationInfo}function et(e){return null==e||"rotate-start"!==e.type&&"rotate"!==e.type&&"rotate-stop"!==e.type?null:e}function tt(e){return null==e||"scale-start"!==e.type&&"scale"!==e.type&&"scale-stop"!==e.type?null:e}function rt(e,t,r,n){if(null==t.geometry||"point"!==t.geometry?.type)return!1;const o=t.attributes;let i=!1;const a=n.rotation,s=et(r.toolEventInfo);if(null!=a&&null!=s){const{field:r,getValue:n}=a;if("rotate-stop"===s.type)a.isUpdatingInteractively=!1,a.setInitialValue(t.getAttribute(r));else{a.isUpdatingInteractively=!0;const l=n(s.angle,e);l!==o[r]&&t.setAttribute(r,l),i=!0}}const l=n.size,c=tt(r.toolEventInfo);if(null!=l&&null!=c){const{field:r,getValue:n}=l;if("scale-stop"===c.type)l.isUpdatingInteractively=!1,l.setInitialValue(t.getAttribute(r));else{l.isUpdatingInteractively=!0;const a=n(c.xScale,e);a!==o[r]&&t.setAttribute(r,a),i=!0}}return i}async function nt({feature:e,featureClone:t,sketchLayer:r,sketchViewModel:n,getUpdateOptions:o,view:i,visualVariableAttributes:c,webStyleCache:u,addHandle:p,addUpdatingPromise:f,onUpdate:y}){await Z(t,u,"2d"===i.type?i.scale:null);let h=null;if("2d"===n?.view?.type){const e=d(e=>Z(t,u,e));h=m(()=>n?.view?.scale,t=>e(t))}const w=t.sourceLayer,I=ut(i,w);await Xe({graphic:t,sketchLayer:r,sketchViewModel:n,sourceLayer:w,updateOptions:o(),visualVariables:c,webStyleCache:u});let v=null;I.then(e=>v=e).catch(()=>{});const T=c.size,F=c.rotation,j=m(()=>e.attributes,async e=>{let r=!1;for(const n in e){const o=e[n];o!==t.getAttribute(n)&&(t.setAttribute(n,o),null==T||T.isUpdatingInteractively||T.field!==n||T.setInitialValue(o),null==F||F.isUpdatingInteractively||F.field!==n||F.setInitialValue(o),(null==v||v.requiredFields.includes(n))&&(r=!0))}r&&await Z(t,u,"2d"===i.type?i.scale:null)}),S=n.on("update",async e=>{const t=e.graphics[0],a={graphic:t,sketchLayer:r,sketchViewModel:n,sourceLayer:w,updateOptions:o(),visualVariables:c,webStyleCache:u};if("complete"===e.state){if(null===i.activeTool)return Xe(a);const e=new AbortController,t=l(e);return p(t),f(g(()=>null===i.activeTool,e.signal).then(async()=>{if(!e.signal.aborted)return e.abort(),Xe(a)}))}rt(i,t,e,c)&&await Z(t,u,"2d"===i.type?i.scale:null),y(dt(t),e)}),k=b(()=>null!=i.activeTool&&i.activeTool!==n.activeComponent,()=>n.cancel()),A=n.on(["undo","redo"],e=>{y(dt(e.graphics[0]),e)});return a([A,S,k,s(()=>n.cancel()),j,h])}const ot={icon:w(24),text:w(12),line:w(1),viewScaleSizeFactor:100};function it(e,t,r){let n=!1;return e.filter(e=>!!n||(n=e===t,n)).map(e=>r[e]())}function at(e,t){e.viewModel.syncFeatureTemplates();const r=e.creationInfo;if("awaiting-feature-creation-info"===t[0].id&&r){const n=r.layer,o=e.viewModel.getTemplatesForLayer(n);1===o.length&&"scene"!==n.type&&(r.template=o[0],t.shift())}return t}function st(e){return"unknown"===e?null:e}function lt(e){e.filesEnabled=!0,e.mode="view",e.capabilities={editing:!0,operations:{add:!0,update:!0,delete:!0}}}const ct=e=>e.includes("-stop")||e.includes("vertex-"),ut=(e,t)=>{const r="subtype-sublayer"===t.type?t.parent:t;return e.whenLayerView(r)};function pt(e){return"createInteractiveEditSession"in e}function dt(e){const t=e.geometry;if("mesh"===t?.type){const r=e.cloneShallow();return r.attributes=c(e.attributes),r.geometry=t.cloneShallow(),r.geometry.transform=t.transform?.clone()??null,r}return e.clone()}function ft(e){return e.acquireCursor("progress")}function yt(e){for(const t of e){const{destinationGraphic:e,destinationField:r,sourceGraphic:n,sourceField:o}=t;e.setAttribute(r,n.getAttribute(o))}}function mt(e){const t=e.templateExecutorInfo?.completionResults;return t?.length?(t.forEach(e=>yt(e.relationships)),t.flatMap(e=>e.edits)):null}function ht(e){const t=ae(e)?e.activeWorkflow:e;if(null==t)return[];if(ne(t))return t.data.layers;const r=t.layer;return r?[r]:[]}function gt({attributes:e},t){const r=new Set;r.add(t.objectIdField),"uniqueIdFields"in t&&t.uniqueIdFields&&t.uniqueIdFields.length>0&&I(r,t.uniqueIdFields);const n={};for(const o of r)null!=e[o]&&(n[o]=e[o]);if("scene"===t.type&&null!=t.infoFor3D){const r=t.associatedLayer?.globalIdField;null!=r&&(e[r]=e[r])}return n}function bt(e){if(!wt(e))return e;const t=new Map;for(const r of e){const e=r.getObjectId();if(null!=e){const n=r.sourceLayer??r.layer;p(t,n,()=>[]).push(e)}}return Array.from(t.entries()).map(([e,t])=>({layer:e,objectIds:t}))}function wt(e){return 0===e.length||P(e[0])}function It({drawTool:e},t){const r=e?.mostDownstreamPlugin?.configuration?.curveTypes;if(!t||!r||0===r.length)return!1;const n=new Set(t.capabilities.supportedCurveTypes);return r.some(e=>!n.has(e))}function vt(e,t){const r=new Set(t.capabilities.supportedCurveTypes);return e.some(({geometry:e})=>e&&S(e)&&k(e,r))}export{It as activeSketchToolDrawsUnsupportedCurve,Re as appendAllUtilityNetworkAssociationRelationships,at as avoidFeatureTemplateSelectionWithOnlyOneItem,pt as canCreateInteractiveEditSession,dt as cloneGraphicExceptMesh,vt as containsUnsupportedCurve,xe as createLayerIdMap,qe as createRelationshipKeyMap,Te as createToolFromGeometryType,it as createWorkflowSteps,$e as fetchCandidates,Ke as fetchFullFeatures,Pe as findAllDependencies,De as findChangesByGlobalId,Ne as findEditorItemForLayer,Ze as findEditorItemForLayerOrThrow,We as findLayerInfo,Ee as generateHashForRelationship,ht as getLayersFromWorkflow,he as getRotationVariableAttribute,mt as getServiceEditsFromWorkflowData,Ue as getServiceInfoForLayer,Le as getServiceLayersById,we as getSizeVariableAttribute,me as getVisualVariableAttributes,ye as getVisualVariablesForLayer,_ as isAnyUpdateLeafWorkflow,ee as isBatchAttributeFormViewModel,te as isCreateFeaturesWorkflow,re as isFeatureFormViewModel,wt as isGraphicsArray,se as isMergeFeaturesWorkflow,ue as isMergeWorkflowOptions,ce as isParentWorkflow,le as isSplitFeatureWorkflow,pe as isSplitWorkflowOptions,ct as isTerminalUpdateEventType,oe as isUpdateFeatureWorkflow,ne as isUpdateFeaturesWorkflow,fe as isUpdateFeaturesWorkflowOptions,ie as isUpdateRecordWorkflow,ae as isUpdateWorkflow,Ce as isUtilityNetworkAssociationsTable,gt as makeMinimalAttributes,Me as orderEditsByRelationshipDependencies,lt as prepareAttachmentsForCreateFeaturesWorkflow,yt as setRelationshipFields,nt as setUpGeometryUpdate,je as setUpSketchCreateWatchers,_e as setVisualVariablesAndElevationInfoForUpdate,ft as showProgressCursor,ot as sizeDefaults,st as sizeVariableUnitToLengthUnit,Fe as startCreatingNewFeature,Xe as startUpdatingFeatureGeometry,Ye as syncUpdateOptions,bt as toFeatureInfos,rt as visualVariableInteractiveUpdate,ut as whenEditorLayerView,de as workflowInfluencesOutcomeOfParent};
|