@arcgis/core 5.0.0-next.17 → 5.0.0-next.19
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/AttributeBinsGraphic.js +1 -1
- package/analysis/ElevationProfile/ElevationProfileLineGround.js +1 -1
- package/analysis/ElevationProfile/ElevationProfileLineInput.js +1 -1
- package/analysis/ElevationProfile/ElevationProfileLineQuery.js +1 -1
- package/analysis/ElevationProfile/ElevationProfileLineScene.js +1 -1
- package/arcade/featureSetUtils.js +1 -1
- package/arcade/featureset/sources/FeatureLayerDynamic.js +1 -1
- package/arcade/featureset/sources/FeatureLayerMemory.js +1 -1
- package/arcade/featureset/sources/FeatureLayerOGC.js +5 -0
- package/arcade/featureset/sources/FeatureLayerRelated.js +1 -1
- package/arcade/featureset/support/FeatureSet.js +1 -1
- package/arcade/featureset/support/shared.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/057d59ee6144e5890780.js +1 -0
- package/assets/esri/core/workers/chunks/{adf7ccf4ef629211c7ee.js → 08aacbfb651cc2e1c054.js} +1 -1
- package/assets/esri/core/workers/chunks/{31b5900119dd7cd9e7d3.js → 0a6ad58ca4ca0cba2fa0.js} +1 -1
- package/assets/esri/core/workers/chunks/0d8d3d0de49064971874.js +1 -0
- package/assets/esri/core/workers/chunks/{b87bc987983b31c13f64.js → 0f1b9d69961dad0b922f.js} +1 -1
- package/assets/esri/core/workers/chunks/110cc01dd6af7ee125d4.js +1 -0
- package/assets/esri/core/workers/chunks/11687718c8635eb7bf37.js +1 -0
- package/assets/esri/core/workers/chunks/{5f6df4a3376b52ead53f.js → 14f994b1dd682bf2d61a.js} +1 -1
- package/assets/esri/core/workers/chunks/3538eb39ebb58acedd67.js +1 -0
- package/assets/esri/core/workers/chunks/{658cd45b5fb304fd840a.js → 3aa77696c5ea54a238da.js} +1 -1
- package/assets/esri/core/workers/chunks/{49571d6875de1f2e7e25.js → 4b9dfdc23ba3d6ebcc1b.js} +2 -2
- package/assets/esri/core/workers/chunks/{02a22dd6d208a925cc5a.js → 52cf643621662712dc85.js} +1 -1
- package/assets/esri/core/workers/chunks/5755b11272b777507612.js +1 -0
- package/assets/esri/core/workers/chunks/{d69265ceabfa92b40bb7.js → 58969dde8c3d0b2a9829.js} +1 -1
- package/assets/esri/core/workers/chunks/6e4829b52ade3e41ccc4.js +1 -0
- package/assets/esri/core/workers/chunks/{4a89e120be142ab58a27.js → 7224b321606116fd691c.js} +1 -1
- package/assets/esri/core/workers/chunks/{888f188541f8bd68e33e.js → 72f1c3d97e7b9546c113.js} +1 -1
- package/assets/esri/core/workers/chunks/{a4518f25b9f8fe704286.js → 76e945da8f30d8641c3d.js} +4 -4
- package/assets/esri/core/workers/chunks/{257f17b3836a623a9dbe.js → 795b09ff7a8f4e91f4dc.js} +1 -1
- package/assets/esri/core/workers/chunks/{3ac7562ea90f91a9f30c.js → 82b2741e75c2e9b88252.js} +1 -1
- package/assets/esri/core/workers/chunks/{5d2e5774768d8f290343.js → b656e8fd374113523404.js} +1 -1
- package/assets/esri/core/workers/chunks/bccb9ac572bc093fb177.js +1 -0
- package/assets/esri/core/workers/chunks/{79dbfa2b9b332ca0002f.js → c52161b94c0fb071747e.js} +1 -1
- package/assets/esri/core/workers/chunks/db76958fd9f54b6bd324.js +1 -0
- package/assets/esri/core/workers/chunks/e61d7762b56e36dc7e8a.js +1 -0
- package/assets/esri/core/workers/chunks/{b30897952494a3e5b9fe.js → e69c2b613bd0210e25ba.js} +1 -1
- package/assets/esri/core/workers/chunks/f43e1e1a1b2eb737e00c.js +1 -0
- package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
- package/chunks/GlowComposition.glsl.js +46 -46
- package/chunks/ImageMaterial.glsl.js +1 -1
- package/chunks/ShadedColorMaterial.glsl.js +10 -10
- package/config.js +1 -1
- package/editing/templateUtils.js +1 -1
- package/interfaces.d.ts +167 -51
- package/intl/locale.js +1 -1
- package/kernel.js +1 -1
- package/layers/BingMapsLayer.js +1 -1
- package/layers/Lyr3DWasmPerSceneView.js +1 -1
- package/layers/PointCloudLayer.js +1 -1
- package/layers/SceneLayer.js +1 -1
- package/layers/VideoLayer.js +1 -1
- package/layers/graphics/sources/OGCFeatureSource.js +1 -1
- package/layers/mixins/SceneService.js +1 -1
- package/layers/ogc/ogcFeatureUtils.js +1 -1
- package/libs/parquet/parquet.js +1 -1
- package/package.json +1 -1
- package/renderers/support/RasterSymbolizer.js +1 -1
- package/rest/support/QueryMixin.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
- package/symbols/cim/cimAnalyzer.js +1 -1
- package/undoredo/support/ServiceVersionInfo.js +1 -1
- package/undoredo/support/Services.js +1 -1
- package/views/2d/LabelManager.js +1 -1
- package/views/2d/engine/webgl/FeatureTile.js +1 -1
- package/views/2d/engine/webgl/OverlayMultipoint.js +1 -1
- package/views/2d/engine/webgl/VideoScreenRenderer.js +1 -1
- package/views/2d/engine/webgl/animations/store/AnimationStore.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/colorize/ColorizeTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityResources.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/drop-shadow/DropShadowTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/opacity/OpacityTechnique.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/processor/textureUtils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/BaseRasterHighlightShader.js +5 -0
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/RasterRangeHighlightShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/RasterXYBandHighlightShader.js +5 -0
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/math.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/stretch.js +1 -1
- package/views/2d/engine/webgl/textureUtils.js +1 -1
- package/views/2d/layers/ImageryTileLayerView2D.js +1 -1
- package/views/2d/layers/features/FeatureContainer.js +1 -1
- package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
- package/views/3d/GroundView3D.js +1 -1
- package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
- package/views/3d/analysis/Slice/RotateManipulator.js +1 -1
- package/views/3d/analysis/images/Factory.js +1 -1
- package/views/3d/environment/ChapmanAtmosphere.js +1 -1
- package/views/3d/environment/EnvironmentManager.js +1 -1
- package/views/3d/environment/SceneViewEnvironment.js +1 -1
- package/views/3d/environment/SunLighting.js +1 -1
- package/views/3d/environment/VirtualLighting.js +1 -1
- package/views/3d/layers/BuildingComponentSublayerView3D.js +1 -1
- package/views/3d/layers/DrapedSubView3D.js +1 -1
- package/views/3d/layers/FlowSubView3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/IntegratedMeshLayerView3D.js +1 -1
- package/views/3d/layers/MediaLayerView3D.js +1 -1
- package/views/3d/layers/PointCloudLayerView3D.js +1 -1
- package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
- package/views/3d/layers/SceneLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
- package/views/3d/layers/graphics/pipeline/rendering/FeaturePipelineRenderManager.js +1 -1
- package/views/3d/layers/graphics/wosrLoader.js +1 -1
- package/views/3d/layers/i3s/I3SMaterialUtil.js +1 -1
- package/views/3d/support/QualityProfile.js +5 -0
- package/views/3d/support/QualitySettings.js +1 -1
- package/views/3d/support/StreamTextureCollection.js +1 -1
- package/views/3d/support/TextureCollection.js +1 -1
- package/views/3d/support/engineContent/marker.js +1 -1
- package/views/3d/support/engineContent/sdfPrimitives.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatOrderTexture.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/terrain/TileCompositor.js +1 -1
- package/views/3d/webgl-engine/Stage.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/core/material/MaterialBase.js +1 -1
- package/views/3d/webgl-engine/core/material/RenderTexture.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/smaa/SMAA.js +1 -1
- package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
- package/views/3d/webgl-engine/lib/AnimationTimeStep.js +1 -1
- package/views/3d/webgl-engine/lib/BasisUtil.js +1 -1
- package/views/3d/webgl-engine/lib/DDSUtil.js +1 -1
- package/views/3d/webgl-engine/lib/GLTextureMaterial.js +1 -1
- package/views/3d/webgl-engine/lib/ManagedTexture.js +5 -0
- package/views/3d/webgl-engine/lib/OrderIndependentTransparency.js +1 -1
- package/views/3d/webgl-engine/lib/RenderFeature.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/TextTextureAtlas.js +1 -1
- package/views/3d/webgl-engine/lib/TextTextureFactory.js +1 -1
- package/views/3d/webgl-engine/lib/TextureRepository.js +1 -1
- package/views/3d/webgl-engine/lib/glUtil3D.js +1 -1
- package/views/3d/webgl-engine/materials/CheckerBoardMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/internal/WaterTextureRepository.js +1 -1
- package/views/3d/webgl-engine/materials/stippleTextureRepository.js +1 -1
- package/views/3d/webgl-engine/parts/RenderView.js +1 -1
- package/views/GroundView.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/support/layerViewUtils.js +1 -1
- package/views/webgl/Texture.js +1 -1
- package/views/webgl/testSVGPremultipliedAlpha.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/VisibleElements.js +1 -1
- package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
- package/widgets/Editor/workflowUtils.js +1 -1
- package/widgets/Editor.js +1 -1
- package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/FeatureFormUtilityNetworkAssociationList.js +1 -1
- package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationSettings.js +1 -1
- package/widgets/FeatureTable/FieldColumn.js +1 -1
- package/widgets/FeatureTable/Grid/Column.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/adapters/sketch/MeasurementAdapter.js +1 -1
- package/widgets/OrientedImageryViewer/adapters/sketch/TriangulatedMeasurementAdapter.js +1 -1
- package/widgets/OrientedImageryViewer/imageMeasurementUtils.js +1 -1
- package/widgets/OrientedImageryViewer/services/ImageMeasurementService.js +1 -1
- package/widgets/OrientedImageryViewer.js +1 -1
- package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
- package/widgets/smartMapping/SizeSlider.js +1 -1
- package/widgets/support/SelectionList/VisibleElements.js +1 -1
- package/widgets/support/SelectionList.js +1 -1
- package/widgets/support/UtilityNetworkAssociations/FeatureUtilityNetworkAssociationsViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/080268f78436a2f0d996.js +0 -1
- package/assets/esri/core/workers/chunks/18474c017ddacd1d3d2c.js +0 -1
- package/assets/esri/core/workers/chunks/27e6a6c5610007ac6a54.js +0 -1
- package/assets/esri/core/workers/chunks/5415fbcc7ed203fc5575.js +0 -1
- package/assets/esri/core/workers/chunks/631fb2e62e48f8be4051.js +0 -1
- package/assets/esri/core/workers/chunks/722da7a39a0ad9300752.js +0 -1
- package/assets/esri/core/workers/chunks/9595aabbaf411eceea1e.js +0 -1
- package/assets/esri/core/workers/chunks/a470f662d73aa8d5d90f.js +0 -1
- package/assets/esri/core/workers/chunks/a57751f3d78524c876cd.js +0 -1
- package/assets/esri/core/workers/chunks/ac366221e8636b60aee5.js +0 -1
- package/assets/esri/core/workers/chunks/dec336700cfb83abbbeb.js +0 -1
- package/views/3d/support/DisplayQualityProfile.js +0 -5
- package/views/3d/webgl-engine/lib/Texture.js +0 -5
- /package/views/3d/webgl-engine/lib/{ITexture.js → IManagedTexture.js} +0 -0
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__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 l,on as n,whenOnce as p,initial as d}from"../../core/reactiveUtils.js";import{property as u}from"../../core/accessorSupport/decorators/property.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as c}from"../../core/accessorSupport/decorators/subclass.js";import h from"../../layers/GraphicsLayer.js";import{getDrawHelpMessage as m}from"../../views/draw/support/helpMessageUtils.js";import w from"../../views/draw/support/HighlightHelper.js";import y from"../../views/interactive/snapping/FeatureSnappingLayerSource.js";import{temporaryHighlightName as g}from"../../views/support/HighlightDefaults.js";import f from"./Edits.js";import v from"./SplitFeatureWorkflowData.js";import _ from"./Workflow.js";import{createWorkflowSteps as F,swapForEditingSession as M,updateGraphicSymbolWhenRequired as S,makeMinimalAttributes as b}from"./workflowUtils.js";import{assertViewNot3D as k,assertSplitWorkflowCapabilities as T}from"./support/errors.js";import{getCompatibleSpitterGeometryType as V,ensureSplittableGeometry as G,makeNewFeatureAttributes as I,splitGeometry as E,canSplitByPoint as j,isSplitterGeometry as H}from"./support/splitFeatureUtils.js";import x from"../FeatureForm/FeatureFormViewModel.js";import C from"../Sketch/SketchViewModel.js";import{getDrawToolGeometryTypeFromCreateTool as L}from"../Sketch/support/sketchUtils.js";var U;const W=Symbol(),P=Symbol();let z=U=class extends _{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 w({view:e,highlightName:g}):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}=this._sketchViewModel,r=L(t);if("mesh"!==r)return m(r,i?.geometry,e)}get layer(){return this.data.editorItem.layer}get parent(){return this.data.parent}get updating(){return this._updatingHandles.updating||this._formViewModel.updating||this._sketchViewModel.updating}get noticeMessage(){return this._lastSplitterGeometryWasInvalid?"invalidSplitterGeometry":void 0}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(k(e.viewModel,"split-feature"),T(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=V(G(s.originalFeature.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.originalFeature.geometry?.type}'.`)}const l=new U({data:new v(s),defaultSplitterGeometryType:a,onCommit:O(e.applyEdits)});return l._set("steps",U._createWorkflowSteps(l,o)),l}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 start(){return await super.start(),this._makeSketchController()}async _createAndInitializeEdits({newPart:e,remainingPart:t}){const{data:i}=this,r=i.originalFeature,a=this._formViewModel,o=r.clone();o.geometry=t;const s=new f({feature:o});i.existingFeatureEdits=s,s.trackChanges(r),await this._setFeatureOnFormViewModel(o,"existing"),s.submittable=a.submittable;const l=r.clone();l.geometry=e,l.attributes=I(r.attributes,i.editorItem.layer);const n=new f({feature:l});return i.newFeatureEdits=n,n.trackChanges(),await this._setFeatureOnFormViewModel(l,"new"),n.submittable=a.submittable,{featureToCreate:l,featureToUpdate:o}}static _createWorkflowSteps(e,i="drawing-splitter-geometry"){const{data:r}=e;return F(["drawing-splitter-geometry","reviewing-features"],i,{"drawing-splitter-geometry":()=>({id:"drawing-splitter-geometry",async setUp(){const i=G(r.originalFeature.geometry),a=V(i,e.defaultSplitterGeometryType),{snappingManager:o}=r;j(i)&&o&&e.addHandles(R(o,e.layer));const s=e._sketchViewModel;e.addHandles([n(()=>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(!H(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)}}}),l(()=>s.activeTool,(t,i)=>{"point"===t&&!e.hasHandles(W)&&o?e.addHandles(D(o,e.layer),W):"point"===i&&e.removeHandles(W)})],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),l=await e._displayFeatureGraphics(s,o);e.addHandles(l,this.id)},async tearDown(){e.removeHandles(this.id)}})})}async _displayFeatureGraphics(e,t){const{data:a,_graphicsLayer:o}=this,n=a.viewModel.view,p=[];if(!e||!t||!n)return i();const d=s(i=>Promise.all([S(e,this._webStyleCache,i),S(t,this._webStyleCache,i)]));return await d("2d"===n.type?n.scale:null),"2d"===n.type&&p.push(l(()=>n.scale,e=>d(e))),o.add(t),p.push(i(()=>o.remove(t))),p.push(await M(o,n,a.originalFeature,e)),r(p)}async _executeSplit(e){const{data:i}=this,{originalFeature: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 E(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 x({formTemplate:e.editorItem.formTemplate,highlightHelper:this._highlightHelper,map:i?.map,spatialReference:i?.spatialReference,timeZone:e.timeZone});this._formViewModel=r,this.addHandles(n(()=>r,"value-change",({feature:r,fieldName:a,value:o})=>{r&&(e.getEditsForFeature(r)?.setAttribute(a,o),S(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 C({layer:e,creationMode:"single",sketchOptions:t.sketchOptions,snappingManager:t.snappingManager,updateOnGraphicClick:!1,defaultUpdateOptions:{multipleSelectionEnabled:!1},view:i})}_makeSketchController(){return{enter:async()=>this.addHandles(N(this)),exit:()=>this.removeHandles(P),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.originalFeature)):r.editType="INSERT",await p(()=>!r.updating)}get test(){}};e([u()],z.prototype,"activeFeature",null),e([u()],z.prototype,"allowSave",null),e([u()],z.prototype,"availableCreateTools",null),e([u()],z.prototype,"defaultSplitterGeometryType",void 0),e([u()],z.prototype,"formViewModel",null),e([u()],z.prototype,"hasInvalidFormTemplate",null),e([u()],z.prototype,"hasPreviousStep",null),e([u()],z.prototype,"helpMessage",null),e([u()],z.prototype,"layer",null),e([u()],z.prototype,"parent",null),e([u()],z.prototype,"type",void 0),e([u()],z.prototype,"updating",null),e([u()],z.prototype,"noticeMessage",null),e([u()],z.prototype,"_activeFeature",void 0),e([u()],z.prototype,"_formViewModel",void 0),e([u()],z.prototype,"_graphicsLayer",void 0),e([u()],z.prototype,"_highlightHelper",void 0),e([u()],z.prototype,"_lastSplitterGeometryWasInvalid",void 0),e([u()],z.prototype,"_sketchViewModel",void 0),z=U=e([c("esri.widgets.Editor.SplitFeatureWorkflow")],z);const A=z;function O(e){return async i=>{const{existingFeatureEdits:r,newFeatureEdits:a}=i,o=r?.feature?.cloneShallow(),s=a?.feature?.cloneShallow(),l=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=b(o,i.editorItem.layer)),await e(l,{addFeatures:[s],updateFeatures:[o]})}}function R(e,t){if(e.options.featureSources.some(e=>e.layer===t))return i();const r=new y({enabled:!1,layer:t});return e.options.featureSources.add(r),i(()=>{e.options.featureSources.remove(r),r.destroy()})}function D(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 l=new Map;for(const i of r.featureSources)l.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 l)e.enabled=t})}function N(e){const t=e.data,{originalFeature:o,viewModel:s}=t,{view:n}=s;if(!n)return i();const p=new w({view:n}),u=l(()=>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 w({view:n,highlightName:g}),h=l(()=>t.temporaryHighlightFeature,(t,i)=>{i&&i!==e.activeFeature&&c.remove(i),t&&c.add(t)}),m=l(()=>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{A as default};
|
|
5
|
+
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}from"../../core/accessorSupport/decorators/property.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as c}from"../../core/accessorSupport/decorators/subclass.js";import h from"../../layers/GraphicsLayer.js";import{isGraphicsLayer as m}from"../../layers/support/layerUtils.js";import{getDrawHelpMessage as y}from"../../views/draw/support/helpMessageUtils.js";import w from"../../views/draw/support/HighlightHelper.js";import g from"../../views/interactive/snapping/FeatureSnappingLayerSource.js";import{temporaryHighlightName as f}from"../../views/support/HighlightDefaults.js";import v from"./Edits.js";import _ from"./SplitFeatureWorkflowData.js";import F from"./Workflow.js";import{createWorkflowSteps as M,updateFeatureWorkflowInternalGraphicsLayerTitle as b,swapForEditingSession as S,updateGraphicSymbolWhenRequired as k,makeMinimalAttributes as G,whenGraphicDisplayed as T,whenEditorLayerView as V}from"./workflowUtils.js";import{assertViewNot3D as I,assertSplitWorkflowCapabilities as j}from"./support/errors.js";import{getCompatibleSpitterGeometryType as E,ensureSplittableGeometry as H,makeNewFeatureAttributes as x,splitGeometry as L,canSplitByPoint as C,isSplitterGeometry as U}from"./support/splitFeatureUtils.js";import W from"../FeatureForm/FeatureFormViewModel.js";import P from"../Sketch/SketchViewModel.js";import{getDrawToolGeometryTypeFromCreateTool as z}from"../Sketch/support/sketchUtils.js";var A;const O=Symbol(),R=Symbol();let D=A=class extends F{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 w({view:e,highlightName:f}):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}=this._sketchViewModel,r=z(t);if("mesh"!==r)return y(r,i?.geometry,e)}get layer(){return this.data.editorItem.layer}get parent(){return this.data.parent}get updating(){return this._updatingHandles.updating||this._formViewModel.updating||this._sketchViewModel.updating}get noticeMessage(){return this._lastSplitterGeometryWasInvalid?"invalidSplitterGeometry":void 0}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"),j(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(H(s.originalFeature.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.originalFeature.geometry?.type}'.`)}const n=new A({data:new _(s),defaultSplitterGeometryType:a,onCommit:Z(e.applyEdits)});return n._set("steps",A._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 start(){return await super.start(),this._makeSketchController()}async _createAndInitializeEdits({newPart:e,remainingPart:t}){const{data:i}=this,r=i.originalFeature,a=this._formViewModel,o=r.clone();o.geometry=t;const s=new v({feature:o});i.existingFeatureEdits=s,s.trackChanges(r),await this._setFeatureOnFormViewModel(o,"existing"),s.submittable=a.submittable;const n=r.clone();n.geometry=e,n.attributes=x(r.attributes,i.editorItem.layer);const l=new v({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 M(["drawing-splitter-geometry","reviewing-features"],i,{"drawing-splitter-geometry":()=>({id:"drawing-splitter-geometry",async setUp(){const i=H(r.originalFeature.geometry),a=E(i,e.defaultSplitterGeometryType),{snappingManager:o}=r;C(i)&&o&&e.addHandles($(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(!U(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(O)&&o?e.addHandles(q(o,e.layer),O):"point"===i&&e.removeHandles(O)})],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([k(e,this._webStyleCache,i),k(t,this._webStyleCache,i)]));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)));const{originalFeature:u}=a,c=u.layer,h=m(c)&&c.title===b&&c.internal?await J({editingGraphicsLayer:o,view:l,originalGraphicsLayer:c,editedGraphic:e}):await S(o,l,u,e);return p.push(h),r(p)}async _executeSplit(e){const{data:i}=this,{originalFeature: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 L(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 W({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),k(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 P({layer:e,creationMode:"single",sketchOptions:t.sketchOptions,snappingManager:t.snappingManager,updateOnGraphicClick:!1,defaultUpdateOptions:{multipleSelectionEnabled:!1},view:i})}_makeSketchController(){return{enter:async()=>this.addHandles(B(this)),exit:()=>this.removeHandles(R),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.originalFeature)):r.editType="INSERT",await p(()=>!r.updating)}get test(){}};e([u()],D.prototype,"activeFeature",null),e([u()],D.prototype,"allowSave",null),e([u()],D.prototype,"availableCreateTools",null),e([u()],D.prototype,"defaultSplitterGeometryType",void 0),e([u()],D.prototype,"formViewModel",null),e([u()],D.prototype,"hasInvalidFormTemplate",null),e([u()],D.prototype,"hasPreviousStep",null),e([u()],D.prototype,"helpMessage",null),e([u()],D.prototype,"layer",null),e([u()],D.prototype,"parent",null),e([u()],D.prototype,"type",void 0),e([u()],D.prototype,"updating",null),e([u()],D.prototype,"noticeMessage",null),e([u()],D.prototype,"_activeFeature",void 0),e([u()],D.prototype,"_formViewModel",void 0),e([u()],D.prototype,"_graphicsLayer",void 0),e([u()],D.prototype,"_highlightHelper",void 0),e([u()],D.prototype,"_lastSplitterGeometryWasInvalid",void 0),e([u()],D.prototype,"_sketchViewModel",void 0),D=A=e([c("esri.widgets.Editor.SplitFeatureWorkflow")],D);const N=D;function Z(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=G(o,i.editorItem.layer)),await e(n,{addFeatures:[s],updateFeatures:[o]})}}function $(e,t){if(e.options.featureSources.some(e=>e.layer===t))return i();const r=new g({enabled:!1,layer:t});return e.options.featureSources.add(r),i(()=>{e.options.featureSources.remove(r),r.destroy()})}function q(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 B(e){const t=e.data,{originalFeature:o,viewModel:s}=t,{view:l}=s;if(!l)return i();const p=new w({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 w({view:l,highlightName:f}),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)])}async function J({editingGraphicsLayer:e,view:t,originalGraphicsLayer:a,editedGraphic:o}){function s(e){a.visible=e}return e.add(o),await T(t,o),s(!1),r([i(async()=>{s(!0);try{if(!t.destroyed){const e=await V(t,a).catch(()=>{});e&&!e.destroyed&&await p(()=>!e.updating)}}finally{e.remove(o)}})])}export{N as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__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 o}from"../../core/reactiveUtils.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import l from"../../layers/GraphicsLayer.js";import{highlightsSupported as h}from"../../views/support/layerViewUtils.js";import d from"./UpdateFeatureWorkflowData.js";import{UpdateRecordWorkflow as n,handleKeys as c}from"./UpdateRecordWorkflow.js";import{getVisualVariableAttributes as p,setUpGeometryUpdate as w,updateGraphicSymbolWhenRequired as u,swapForEditingSession as
|
|
5
|
+
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 o}from"../../core/reactiveUtils.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import l from"../../layers/GraphicsLayer.js";import{highlightsSupported as h}from"../../views/support/layerViewUtils.js";import d from"./UpdateFeatureWorkflowData.js";import{UpdateRecordWorkflow as n,handleKeys as c}from"./UpdateRecordWorkflow.js";import{getVisualVariableAttributes as p,setUpGeometryUpdate as w,updateFeatureWorkflowInternalGraphicsLayerTitle as m,updateGraphicSymbolWhenRequired as u,swapForEditingSession as y,cloneGraphicExceptMesh as f,canCreateInteractiveEditSession as k,isTerminalUpdateEventType as g}from"./workflowUtils.js";import _ from"../Sketch/SketchViewModel.js";var V;const v={...c,highlights:Symbol(),sketchGraphics:Symbol(),sketchViewModel:Symbol(),waitingForTool:Symbol()};let M=V=class extends n{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 viewGraphic(){return this._sketchViewModel?this._sketchGraphicClone:this.data.edits.feature??this.fullFeature}async commit(){this.removeHandles(v.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)}),o(()=>this._formViewModel.feature?.sourceLayer,e=>this._sketchGraphicClone.sourceLayer=e)])}_configureHighlight(){const{edits:e,layerView:t}=this.data;h(t)&&this.addHandles(t.highlight(e.feature),v.highlights)}async _configureSketchViewModel(){const{_sketchLayer:e,_sketchViewModel:t}=this;if(!t||!e)return;const{data:i,_formViewModel:s,_sketchGraphicClone:o}=this,{edits:r,viewModel:a}=i,l=r.feature,{view:h}=a,d=p(l),n=await w({feature:l,featureClone:o,visualVariableAttributes:d,sketchLayer:e,sketchViewModel:t,view:h,onUpdate:({geometry:e,attributes:t},i)=>{if(r.updateAttributes(t),r.updateGeometry(e),s.feature&&(s.feature.geometry=e),null!=d.rotation){const{field:e}=d.rotation;s.setValue(e,t[e])}if(null!=d.size){const{field:e}=d.size;s.setValue(e,t[e])}("undo"===i.type||"redo"===i.type||"update"===i.type&&null!=i.toolEventInfo&&g(i.toolEventInfo.type))&&s.notifyFeatureGeometryChanged()},addUpdatingPromise:e=>{this._updatingHandles.addPromise(e)},addHandle:e=>{this.addHandles(e,v.waitingForTool)},webStyleCache:this._webStyleCache});this.addHandles(n,v.sketchGraphics),t.addHandles(n)}async _initializeSketchViewModel(){const{data:e,_sketchGraphicClone:t}=this,{readOnly:o}=e,r=e.edits.feature,{capabilities:a,layer:h}=e.editorItem,d=e.viewModel.view;if(this.removeHandles([v.highlights,v.sketchGraphics,v.sketchViewModel,v.waitingForTool]),!a.update.geometry||o)return{enter:async()=>{this.hasHandles(v.highlights)||this._configureHighlight()},exit:()=>this.removeHandles([v.highlights])};const n=new l({elevationInfo:h.elevationInfo,internal:!0,listMode:"hide",title:m}),c=new _({allowDeleteKey:!1,layer:n,sketchOptions:e.sketchOptions,snappingManager:e.snappingManager,updateOnGraphicClick:!1,view:d});return this._sketchLayer=n,this._sketchViewModel=c,d?.map.add(n),await(d?.whenLayerView(n)),this.addHandles(i(()=>{d?.destroyed||d?.map.remove(n),n.destroyed||n.destroy(),this._sketchViewModel=s(c)}),v.sketchViewModel),await u(t,this._webStyleCache,"2d"===d?.type?d.scale:null),this.addHandles([await y(n,d,r,t)]),{enter:async()=>{this.hasHandles(v.sketchGraphics)||await this._configureSketchViewModel()},exit:()=>this.removeHandles([v.sketchGraphics]),viewModel:c}}_onFullFeatureLoaded(e){super._onFullFeatureLoaded(e);const t=this._sketchGraphicClone=f(e),{edits:i,layerView:s}=this.data;i.updateGeometry(e.geometry),i.trackChanges(),k(s)&&(this._layerViewEditSession=s.createInteractiveEditSession(t))}static async create(e){const t=new V({data:await d.create(e),onCommit:this._onCommitFactory(e.applyEdits)});return t._set("steps",this._createWorkflowSteps(t)),t}get test(){}};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=V=e([a("esri.widgets.Editor.UpdateFeatureWorkflow")],M);export{M as UpdateFeatureWorkflow,v as handleKeys};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as o}from"tslib";import
|
|
5
|
+
import{__decorate as o}from"tslib";import t from"../../core/Accessor.js";import{property as e}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as l}from"../../core/accessorSupport/decorators/subclass.js";import n from"../support/SnappingControls/VisibleElements.js";let s=class extends t{constructor(o){super(o),this.batchUpdateActions=!0,this.createFeaturesSection=!0,this.directionModePicker=!1,this.editFeaturesSection=!0,this.flow=!0,this.labelsToggle=!0,this.mergeButton=!0,this.selectionToolbar=!0,this.settingsMenu=!0,this.sketch=!0,this.snappingControls=!0,this.snappingControlsElements=new n,this.splitButton=!0,this.tooltipsToggle=!0,this.undoRedoButtons=!0,this.zoomToButton=!0}};o([e({type:Boolean,nonNullable:!0})],s.prototype,"batchUpdateActions",void 0),o([e({type:Boolean,nonNullable:!0})],s.prototype,"createFeaturesSection",void 0),o([e({type:Boolean,nonNullable:!0})],s.prototype,"directionModePicker",void 0),o([e({type:Boolean,nonNullable:!0})],s.prototype,"editFeaturesSection",void 0),o([e({type:Boolean,nonNullable:!0})],s.prototype,"flow",void 0),o([e({type:Boolean,nonNullable:!0})],s.prototype,"labelsToggle",void 0),o([e({type:Boolean,nonNullable:!0})],s.prototype,"mergeButton",void 0),o([e({type:Boolean,nonNullable:!0})],s.prototype,"selectionToolbar",void 0),o([e({type:Boolean,nonNullable:!0})],s.prototype,"settingsMenu",void 0),o([e({type:Boolean,nonNullable:!0})],s.prototype,"sketch",void 0),o([e({type:Boolean,nonNullable:!0})],s.prototype,"snappingControls",void 0),o([e({type:n,nonNullable:!0})],s.prototype,"snappingControlsElements",void 0),o([e({type:Boolean,nonNullable:!0})],s.prototype,"splitButton",void 0),o([e({type:Boolean,nonNullable:!0})],s.prototype,"tooltipsToggle",void 0),o([e({type:Boolean,nonNullable:!0})],s.prototype,"undoRedoButtons",void 0),o([e({type:Boolean,nonNullable:!0})],s.prototype,"zoomToButton",void 0),s=o([l("esri.widgets.Editor.VisibleElements")],s);const p=s;export{p as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{substitute as e}from"../../../intl/substitute.js";import{css as t}from"../css.js";import{isCreateFeaturesWorkflow as o,isSplitFeatureWorkflow as i,isMergeFeaturesWorkflow as n,isUpdateFeaturesWorkflow as s,isBatchAttributeFormViewModel as a,isUpdateFeatureWorkflow as r}from"../workflowUtils.js";import{loadFooterActionsComponents as l,FooterActions as c}from"./FooterActions.js";import u from"./MergeFeaturesList.js";import{loadNoticesComponents as p,Notices as m}from"./Notices.js";import{loadPanelContentComponents as d,PanelContentSection as f,PanelContentSectionGroup as g,PanelContent as w}from"./PanelContent.js";import k from"./PendingFeatureList.js";import{loadCalciteComponents as b}from"../../support/componentsUtils.js";import{Heading as v,incrementHeadingLevel as h}from"../../support/Heading.js";import{tsx as F,tsxFragment as y}from"../../support/widget.js";import{classes as A}from"../../support/widgetUtils.js";const j=()=>Promise.all([b({"action-bar":()=>import("@esri/calcite-components/dist/components/calcite-action-bar"),action:()=>import("@esri/calcite-components/dist/components/calcite-action")}),l(),p(),d()]);function C(e){const{editorViewModel:r,headingLevel:l,messages:p,renderAttachments:d,renderFeatureForm:b,renderBatchAttributeForm:A,renderSketchToolbar:j}=e,{activeFeatureCount:C,activeLeafWorkflow:S,activeWorkflow:T,formViewModel:
|
|
5
|
+
import{substitute as e}from"../../../intl/substitute.js";import{css as t}from"../css.js";import{isCreateFeaturesWorkflow as o,isSplitFeatureWorkflow as i,isMergeFeaturesWorkflow as n,isUpdateFeaturesWorkflow as s,isBatchAttributeFormViewModel as a,isUpdateFeatureWorkflow as r}from"../workflowUtils.js";import{loadFooterActionsComponents as l,FooterActions as c}from"./FooterActions.js";import u from"./MergeFeaturesList.js";import{loadNoticesComponents as p,Notices as m}from"./Notices.js";import{loadPanelContentComponents as d,PanelContentSection as f,PanelContentSectionGroup as g,PanelContent as w}from"./PanelContent.js";import k from"./PendingFeatureList.js";import{loadCalciteComponents as b}from"../../support/componentsUtils.js";import{Heading as v,incrementHeadingLevel as h}from"../../support/Heading.js";import{tsx as F,tsxFragment as y}from"../../support/widget.js";import{classes as A}from"../../support/widgetUtils.js";const j=()=>Promise.all([b({"action-bar":()=>import("@esri/calcite-components/dist/components/calcite-action-bar"),action:()=>import("@esri/calcite-components/dist/components/calcite-action")}),l(),p(),d()]);function C(e){const{editorViewModel:r,headingLevel:l,messages:p,renderAttachments:d,renderFeatureForm:b,renderBatchAttributeForm:A,renderSketchToolbar:j}=e,{activeFeatureCount:C,activeLeafWorkflow:S,activeWorkflow:T,formViewModel:B}=r;if(!S||!T||!B)return null;const V=a(B),z=o(S)&&!S.data.selectedPendingFeature||i(S)&&!S.activeFeature,I=n(S),x=S.shouldShowAttachments&&!V&&!B.activeRelationshipInput&&!B.activeAssociationInput,D=V?B.activeForm.inputs:B.inputs,W=o(S)&&D.every(e=>!e.visible)&&!x,H=null!=r.featureFormViewModel?.activeAssociationInput,P=!z&&!W&&!H,U=s(S)?A:b,E=W?F(f,null,F(k,{headingLevel:l,key:"pending-feature-list",workflow:S})):F(y,null,F(m,{activeFeatureCount:C,messages:p,workflow:T}),I?F(f,{class:t.mergeFeaturesListSection,key:"panel-section-merge"},F(u,{headingLevel:l,key:"merge-features-list",workflow:S})):void 0,F(f,{key:"panel-content-section-main"},F(g,null,z?F(k,{headingLevel:l,key:"pending-feature-list",workflow:S}):U(),x?F("div",{key:"attachments"},F(v,{level:h(l)},p.attachments),d()):null)));return F(y,null,P?M(S,e):void 0,W?j?.():void 0,F(w,{key:"attribute-panel-content"},E),F(c,{buttons:L(e)}))}function M(e,o){const i=[],n="3d"===o.editorViewModel.view?.type,{visibleElements:a}=o;if(a.zoomToButton&&o.editorViewModel.canZoomTo&&i.push(F("calcite-action",{alignment:"center",appearance:"transparent",icon:"zoom-to-object",key:"zoom-to-button",onclick:()=>o.editorViewModel.zoomTo(),scale:"s",text:o.messages.zoomTo,title:o.messages.zoomTo})),a.splitButton&&r(e)&&e.editorItem.supportsSplitFeatureWorkflow&&!n&&o.onSplit){const{onSplit:e,messages:t}=o;i.push(F("calcite-action",{icon:"split-geometry",key:"split-button",onclick:e,scale:"s",text:t.split,title:t.split}))}if(a.mergeButton&&s(e)&&e.supportsMergeFeaturesWorkflow&&!n&&o.onMerge){const{onMerge:e,messages:t}=o;i.push(F("calcite-action",{icon:"merge",key:"merge-button",onclick:e,scale:"s",text:t.mergeFeatures,title:t.mergeFeatures}))}return i.length>0?F("calcite-action-bar",{class:A(t.sketchContainer,t.updateActionBar),"data-testid":"update-feature-panel-action-bar",expandDisabled:!0,layout:"horizontal"},i):void 0}function L({editorViewModel:t,messages:o,messagesCommon:i,onDelete:n,onDeleteAssociation:s,onSave:a}){const{activeFeatureCount:r,activeLeafWorkflow:l,syncing:c}=t;if(!l)return[];const{page:u}=t;if("viewing-associated-features"===u||"viewing-associated-layers"===u)return[{appearance:"outline",onClick:()=>{const{featureFormViewModel:e}=t;null!=e?.associationId&&(e.associationId=null)},disabled:c,label:i.cancel,type:"button"}];const p=[],m=r>1?o.multiFeature:o.singleFeature,d=!l.allowSave||c,f=e(m[l.saveActionLabel],{count:r});p.push({appearance:"solid",onClick:a,disabled:d,label:f,type:"button"});const g={appearance:"outline",disabled:c,kind:"danger",label:e(m.delete,{count:r}),type:"button"};return t.shouldShowDeleteButton&&!t.featureFormHasAssociation&&n&&p.push({...g,onClick:n}),t.featureFormHasAssociation&&!t.shouldShowDeleteButton&&s&&p.push({...g,onClick:s,label:o.deleteAssociationTitle}),t.featureFormHasAssociation&&t.shouldShowDeleteButton&&s&&n&&p.push({...g,primaryLabel:i.delete,primaryText:i.delete,onClick:n,dropdownItems:[{onClick:s,label:o.deleteAssociationTitle}],type:"split-button"}),p}export{C as UpdateFeaturePanelContent,j as loadUpdateFeaturePanelContentComponents};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../Color.js";import t from"../../Graphic.js";import{isSome as r,equals as n,addMany as o}from"../../core/arrayUtils.js";import{createTask as a}from"../../core/asyncUtils.js";import"../../core/has.js";import i from"../../core/Error.js";import{handlesGroup as s,makeHandle as l,abortHandle as c}from"../../core/handleUtils.js";import{clone as u}from"../../core/lang.js";import d from"../../core/Logger.js";import{getOrCreateMapValue as p}from"../../core/MapUtils.js";import{debounce as f,isPromiseLike as y,throwIfAborted as m,whenOrAbort as h}from"../../core/promiseUtils.js";import{watch as g,on as b,whenOnce as w}from"../../core/reactiveUtils.js";import{px2pt as I}from"../../core/screenUtils.js";import{addMany as v}from"../../core/SetUtils.js";import{diff as T}from"../../core/accessorSupport/diffUtils.js";import{isSharedTemplateOrMetadata as S,isSharedGroupTemplate as F,isSharedTemplate as j,isSharedPresetTemplate as k,isStandardFeatureTemplate as A,isSharedFeatureTemplate as L}from"../../editing/templateUtils.js";import{getSharedTemplateProvider as U}from"../../editing/sharedTemplates/SharedTemplateProvider.js";import V from"../../layers/GraphicsLayer.js";import{featureHasFields as M,fixFields as O,getDisplayFieldName as x}from"../../layers/support/fieldUtils.js";import{isSubtypeSublayer as q}from"../../layers/support/layerUtils.js";import{calculateTolerance as z}from"../../renderers/support/clickToleranceUtils.js";import{meterIn as E}from"../../renderers/support/lengthUtils.js";import{isRenderer as P}from"../../renderers/support/typeUtils.js";import{getTransformationType as C}from"../../renderers/visualVariables/support/sizeVariableUtils.js";import{isGraphic as D}from"../../support/guards.js";import R from"../../symbols/SimpleFillSymbol.js";import G from"../../symbols/SimpleLineSymbol.js";import B from"../../symbols/SimpleMarkerSymbol.js";import{to3D as N}from"../../symbols/support/symbolConversion.js";import{getDisplayedSymbol as Z}from"../../symbols/support/symbolUtils.js";import{getServices as Q}from"../../undoredo/support/Services.js";import{GraphicState as W}from"../../views/3d/layers/graphics/GraphicState.js";import{defaultDrawingMode as $}from"../../views/draw/DrawingMode.js";import{createQueryGeometry as J}from"../../views/support/drapedUtils.js";import{filterGraphicHits as H,hitTestSelectSimilarDistance as K}from"../../views/support/hitTestSelectUtils.js";import{dependencySort as X}from"./support/dependencySort.js";import{isDrawGraphicTool as Y}from"../Sketch/support/sketchUtils.js";const _=()=>d.getLogger("esri.widgets.Editor.workflowUtils");function ee(e){return ie(e)||oe(e)}function te(e){return!!e&&"features"in e}function re(e){return null!=e&&"create-features"===e.type}function ne(e){return!!e&&"feature"in e}function oe(e){return null!=e&&"update-features"===e.type}function ae(e){return null!=e&&"update-feature"===e.type}function ie(e){return null!=e&&e.type.includes("update-")&&"fullFeature"in e}function se(e){return null!=e&&"update"===e.type}function le(e){return null!=e&&"merge-features"===e.type}function ce(e){return null!=e&&"split-feature"===e.type}function ue(e){const t=e?.type;return"update-feature"===t||"update-table-record"===t||"update-features"===t||"split-feature"===t}function de(e){return"merge"===e?.type}function pe(e){return"split"===e?.type}function fe(e){return le(e)||ce(e)}function ye(e){return"update-multiple"===e?.type}function me(e){const t=e&&"renderer"in e?e.renderer:null;if(!Te(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"===C(e));return{rotation:1===r.length?r[0]:null,size:1===n.length?n[0]:null}}function he(e){const t=e.sourceLayer;if(!(t&&"renderer"in t&&Te(t.renderer)))return{rotation:null,size:null};const{rotation:r,size:n}=me(t);let o=null,a=null;if(r){const e=t.fields?.filter(e=>e.name===r.field),n=1===e?.length?e[0]:null;o=ge(r,n)}if(n){const e=t.fields?.filter(e=>e.name===n.field),r=1===e?.length?e[0]:null;a=Ie(n,r)}return{rotation:o,size:a}}function ge(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,ve((o.current+360)%360,n)),setInitialValue:e=>{o.initial=e,o.current=0},isUpdatingInteractively:!1,rotationType:e.rotationType??"geographic"}}function be(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 we(e,t,r){if(null==t)return 0;const{symbol:n}=N(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(ut.icon,(await e(o,ut.icon))[0])||ut.icon}case"text":return ut.text;case"line":return ut.line;case"object":{const{computeObjectLayerResourceSize:t}=await import("../../symbols/support/symbolLayerUtils.js");return be(await t(o,e.scale/ut.viewScaleSizeFactor),r)}case"path":case"extrude":return e.scale/ut.viewScaleSizeFactor;default:return 0}}function Ie(e,t){const r=e.axis,n=t?.type??"double",o={initial:0,current:0},a=E[e.valueUnit]??1;let i;return i="area"===e.valueRepresentation?e=>(e*a/2)**2*Math.PI:"radius"===e.valueRepresentation||"distance"===e.valueRepresentation?e=>e*a/2:e=>e*a,{field:e.field,fieldType:n,getDefaultValue:async(e,t)=>ve(i(await we(t,e,r)),n),getValue:(e,t)=>(o.initial||(o.initial=t.pixelSizeAt(t.center)),o.current=o.initial*e,ve(o.current,n)),setInitialValue:e=>{o.initial=e,o.current=0},isUpdatingInteractively:!1,displayUnit:ft(e.valueUnit),axis:e.axis}}function ve(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 Te(e){if(!P(e))return!1;switch(e?.type){case"class-breaks":case"simple":case"unique-value":case"dot-density":case"dictionary":case"pie-chart":return!0;default:return!1}}async function Se(e,t,r){const n=await Z(e,{useSourceLayer:!0,ignoreGraphicSymbol:!0,webStyleCache:t,scale:r});null!=T(e.symbol,n)&&(e.symbol=n)}function Fe(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:$,optionsPerTool:r};if(S(t)){const o=t.defaultTool,a=F(t)?t.definition?.inputGeometryType??e:e;switch(o){case"freehand":case"stream-line":return{tool:"polyline"===a?"freehandPolyline":"freehandPolygon",createOptions:n};case"autocomplete-freehand-polygons":case"stream-polygon":return{tool:"freehandPolygon",createOptions:n};case"autocomplete-polygons":case"difference-polygon":case"create-structures":case"polygon":case"trace":return{tool:"polygon"===a?"polygon":"polyline",createOptions:n};case"circle":return r.get("circle").preserveAspectRatio=!0,{tool:"circle",createOptions:n};case"ellipse":return r.get("circle").preserveAspectRatio=!1,{tool:"circle",createOptions:n};case"create-points-along-line":case"multipoint":return{tool:"multipoint",createOptions:n};case"line":case"radial-line":case"right-angle-line":case"split":case"two-point-line":return{tool:"polyline",createOptions:n};case"rectangle":case"regular-polygon":case"right-angle-polygon":return{tool:"rectangle",createOptions:n};case"elevation-point-from-contour":case"elevation-point-from-dem":case"parcel-seed":case"point":case"point-and-rotation":case"point-at-end-of-line":return{tool:"point",createOptions:n}}}else{const o=t.drawingTool;if("circle"===o||"ellipse"===o)return r.get("circle").preserveAspectRatio="circle"===o,{tool:"circle",createOptions:n};if("rectangle"===o)return{tool:"rectangle",createOptions:n};if("freehand"===o)return{tool:"polygon"===e?"freehandPolygon":"freehandPolyline",createOptions:n}}return{tool:e,createOptions:n}}async function je(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=Ne(a,o.attributeOverrides),{view:c}=e,u="2d"===c?.type;F(a)||k(a)||await Ze(e,s,l,n,u?c.scale:null);const{capabilities:d}=s;t.elevationInfo=s.elevationInfo;const p=Fe(s.geometryType,a);e.defaultCreateOptions={graphicProperties:{attributes:l,sourceLayer:s},mode:p.createOptions.mode,optionsPerTool:p.createOptions.optionsPerTool,preserveAspectRatio:p.createOptions.preserveAspectRatio,hasZ:d.data.supportsZ,defaultZ:(u?d.editing.zDefault:null)??e.defaultCreateOptions.defaultZ},null==o.geometryToPlace?await e.create(p.tool):await e.place(o.geometryToPlace,{graphicProperties:{attributes:l,sourceLayer:s}})}async function ke(e){return s([Ae(e),Le(e)])}function Ae({creationAttributes:e,data:t,sketchViewModel:r,view:n,webStyleCache:o}){const{creationInfo:a}=t,{fullTemplate:i}=t;if(!a||"2d"!==n?.type||F(i)||k(i))return null;const s=f(t=>Ze(r,a.layer,e,o,t));return g(()=>n.scale,e=>s(e))}function Le({data:t,sketchViewModel:r,view:n}){const{templateExecutorInfo:o}=t;if(!o)return null;const a=r.activeComponent;if(!n||!Y(a))return _().error(new i("featureworkflow","Failed to set up template feedback.")),null;const c=new V({effect:"saturate(0.6) opacity(0.8)",listMode:"hide",title:"Shared Template Feedback Graphics"});n.map?.add(c);const{executor:u,serviceLayersById:d}=o,p=n.theme?.accentColor??new e([255,165,0,1]);return s([b(()=>a,["cursor-update","vertex-add"],()=>{c.removeAll();const e=a.graphic?.geometry;if(!e||!Ue(e))return;const t=u(e,"digitizing");if(!y(t))for(const r of t.edits){const e=d.get(r.id);if(e&&r.addFeatures&&0!==r.addFeatures.length)for(const t of e)if(!t.isTable)for(const e of r.addFeatures){const t=Ve(e,p);t&&c.add(t)}}}),l(()=>{n.map.remove(c),c.destroy()})])}function Ue(e){switch(e.type){case"point":case"multipoint":return!0;case"polyline":return e.paths[0].length>1;case"polygon":{const t=e.rings[0];return n(t.at(0),t.at(-1))?t.length>2:t.length>1}default:return!1}}function Ve(e,r){let n=null;switch(e.geometry?.type){case"point":case"multipoint":n=new B({angle:0,color:r,outline:new G({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 R({color:r,outline:new G({cap:"round",color:r,join:"round",miterLimit:1,style:"solid",width:3}),style:"none"});break;case"polyline":n=new G({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}})}async function Me(e,t){const r=await Q(t).load(),n=q(e)?e.parent:e;return r.tablesAndLayersLookup.get(n)}async function Oe(e,t){const r=await Me(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 xe(e){const t=e.objectIdField,r=e.globalIdField??"";return{id:e.layerId,identifierFields:{objectIdField:t,globalIdField:r},addFeatures:[],deleteAttachments:[],addAttachments:[],deleteFeatures:[],updateFeatures:[]}}function qe(e){const{edits:t,serviceInfo:n,view:o,findOriginalFeature:a}=e,i=ze(n.layersAndTables),s=n.layersAndTables.toArray(),{allEditData:l,editDataByLayerIdMap:c,editDataByIdMap:u}=Pe(t,i,a),d=Ce(l,Ee(s,c),c);if(o&&Ge(l,d,o),0===d.length)return t;const p=X(d,{continueOnCircularDependency:!0}).map(e=>u.get(e)).filter(r),f=new Map;for(const r of p)f.set(r.uniqueId,r);const y=[];for(const r of l)f.has(r.uniqueId)||y.push(r);const m=[];let h=null;for(const r of p){const{layer:e}=r;switch(null==h?h=xe(e):h.id!==e.layerId&&(m.push(h),h=xe(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)??xe(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 ze(e){const t=new Map;for(const r of e)t.set(r.layerId,r);return t}function Ee(e,t){const r=new Map;for(const n of e)for(const e of n.relationships??[])if(r.set(De(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(De(n,e),t.keyField);break}}return r}function Pe(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 Ce(e,t,r){const n=[];for(const o of e){const e=o.layer.relationships??[],{uniqueId:a}=o;for(const i of e){const e=i.keyField;if("origin"===i.role){const s=r.get(i.relatedTableId);if(!s||0===s.length)continue;const l=De(o.layer,i),c=t.get(l);if(void 0===c||""===c)continue;switch(o.operationType){case"add":for(const t of s)t!==o&&("add"!==t.operationType&&"modify"!==t.operationType||t.after.attributes[c]===o.after.attributes[e]&&n.push([a,t.uniqueId]));break;case"modify":if(o.before.attributes[e]!==o.after.attributes[e])for(const t of s){const r=t.uniqueId;t!==o&&("delete"===t.operationType?t.before.attributes[c]===o.before.attributes[e]?n.push([r,a]):t.before.attributes[c]===o.after.attributes[e]&&n.push([a,r]):"add"===t.operationType?t.after.attributes[c]===o.after.attributes[e]?n.push([a,r]):t.after.attributes[c]===o.before.attributes[e]&&n.push([r,a]):"modify"===t.operationType&&(t.before.attributes[c]!==t.after.attributes[c]?t.after.attributes[c]===o.after.attributes[e]?n.push([a,r]):n.push([r,a]):n.push([a,r])))}break;case"delete":for(const t of s)t!==o&&("delete"!==t.operationType&&"modify"!==t.operationType||t.before.attributes[c]===o.before.attributes[e]&&n.push([t.uniqueId,a]))}}}}return n}function De(e,t){return`${e.layerId}:${t.id}`}function Re(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 Ge(e,t,r){const n=[];for(const a of e)Re(a.layer,r)&&n.push(a);if(0===n.length)return;let o=[];for(const a of n){const r=a.layer;switch(a.operationType){case"delete":o=[...Be(a.before.attributes[r.fieldsIndex.get("fromglobalid").name],e),...Be(a.before.attributes[r.fieldsIndex.get("toglobalid").name],e)];for(const e of o)t.push([a.uniqueId,e.uniqueId]);break;case"add":o=[...Be(a.after.attributes[r.fieldsIndex.get("fromglobalid").name],e),...Be(a.after.attributes[r.fieldsIndex.get("toglobalid").name],e)];for(const e of o)t.push([e.uniqueId,a.uniqueId])}}}function Be(e,t){const r=[],n=t.filter(({layer:e})=>""!==e.globalIdField&&null!=e.globalIdField);for(const o of n){const t=o.layer.globalIdField;("before"in o&&o.before?.attributes[t]===e||"after"in o&&o.after?.attributes[t]===e)&&r.push(o)}return r}function Ne(e,t={}){return F(e)||k(e)?{}:A(e)?{...e.prototype.attributes,...t}:L(e)?{...e.definition?.defaultValues,...t}:{...t}}async function Ze(e,r,n,o,a){const i=new t({sourceLayer:r,attributes:n}),{rotation:s,size:l}=he(i);let c=await Z(i,{useSourceLayer:!0,webStyleCache:o,scale:a}),u=!1;for(const t of[l,s]){if(null==t)continue;null==n[t.field]&&(n[t.field]=await t.getDefaultValue(c,e.view),u=!0)}switch(u&&(c=await Z(i,{useSourceLayer:!0,webStyleCache:o,scale:a})),c?.type){case"simple-fill":case"polygon-3d":e.polygonSymbol=c;break;case"simple-line":case"line-3d":e.polylineSymbol=c;break;case"simple-marker":case"picture-marker":case"point-3d":case"cim":e.pointSymbol=c;break;case"mesh-3d":e.meshSymbol=c}Qe(e.tooltipOptions,l,s)}function Qe(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 We(e,t){return e.find(e=>e.layer===t)}function $e(e,t){const r=We(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 Je(e,t){return e?.find(e=>e.layer===t)}async function He(e,t,r,n){switch(t.type){case"3d":return Ke(e,t,r,n);case"2d":return Xe(e,t,r,n)}}async function Ke(e,t,r,n){if(0===e.length)return[];const{updatable:a,graphicsByLayer:i}=await r.defer(async()=>{const{results:o}=await h(K(t,r),n),a=new Map,i=e=>{const t=e.layer,r=a.get(t);if(!r){const e=new Array;return a.set(t,e),e}return r};H(o).forEach(({graphic:e})=>i(e).push(e));const s=e.filter(({capabilities:e,layer:t})=>e.update.enabled&&a.has(t));return 0!==s.length&&r.stopPropagation(),{updatable:s,graphicsByLayer:a}});return h(Promise.allSettled(a.map(async({layer:e})=>{const t=i.get(e),r=Ye(e);if(t.every(e=>M(e,r)))return t;const a=[];for(const n of t){a.push(n.getObjectId());const e=Object.keys(n.attributes);o(r,e)}const s=e.createQuery();return s.returnGeometry=!1,s.objectIds=a,s.outFields=O(e.fieldsIndex,r),e.queryFeatures(s,{signal:n}).then(({features:e})=>e)})),n)}async function Xe(e,t,r,n){if(0===e.length)return[];const{mapPoint:o}=r;if(null==o)return[];let a=null;const i=await r.defer(async()=>{const{results:o}=await h(t.hitTest(r),n);if(0===o.length)return[];const i=new Set;a=H(o),a.forEach(({graphic:e})=>e&&i.add(e.layer));const s=e.filter(e=>i.has(e.layer)&&e.supportsUpdateWorkflow);return s.length>0&&r.stopPropagation(),s});return h(Promise.allSettled(i.map(async({layer:e})=>{const i=e.createQuery();i.returnGeometry=!0,i.outFields=Ye(e);const s="renderer"in e?z({renderer:e.renderer,pointerType:r.pointerType}):0;i.geometry=J(o,s,t),i.outSpatialReference=t.spatialReference;const{features:l}=await e.queryFeatures(i,{signal:n});return a?.forEach(({graphic:t})=>{t.layer!==e||l.some(e=>e.getObjectId()===t.getObjectId())||l.push(t)}),l})),n)}function Ye(e){return O(e.fieldsIndex,[e.objectIdField,x({displayField:"displayField"in e?e.displayField:null,fields:e.fields})])}async function _e(e,t,n,o){return et(e.map(e=>e.getObjectId()??e.attributes[t.objectIdField]).filter(r),t,n,o)}async function et(e,t,r,n){const o=t.createQuery();o.objectIds=e,o.outFields=["*"],o.returnM=t.capabilities.data.supportsM,o.returnZ=t.capabilities.data.supportsZ,o.returnGeometry=!0,"scene"===t.type&&null!=t.infoFor3D||(o.outSpatialReference=r);const a=await t.queryFeatures(o,{signal:n});return m(n),a.features}async function tt(e){const{graphic:t,sketchViewModel:r,sourceLayer:n,visualVariables:o}=e;await rt(e);const a={multipleSelectionEnabled:!1};return"point"===n.geometryType&&(a.enableRotation=null!=o.rotation,a.enableScaling=null!=o.size),r.update(t,a)}async function rt(e){const{graphic:t,sketchLayer:r,sketchViewModel:n,sourceLayer:o,visualVariables:a,webStyleCache:i}=e;let s=!1;const{rotation:l,size:c}=a;for(const u of[l,c]){if(null==u)continue;const e=t.getAttribute(u.field);if(null!=e)u.setInitialValue(e);else{const e=await u.getDefaultValue(t.symbol,n.view);u.setInitialValue(e),t.setAttribute(u.field,e),s=!0}}if(s){const e="2d"===n.view?.type?n.view.scale:null;await Se(t,i,e)}Qe(n.tooltipOptions,c,l),r.elevationInfo=o.elevationInfo}function nt(e){return null==e||"rotate-start"!==e.type&&"rotate"!==e.type&&"rotate-stop"!==e.type?null:e}function ot(e){return null==e||"scale-start"!==e.type&&"scale"!==e.type&&"scale-stop"!==e.type?null:e}function at(e,t,r,n){if(null==t.geometry||"point"!==t.geometry?.type)return!1;const o=t.attributes;let a=!1;const i=n.rotation,s=nt(r.toolEventInfo);if(null!=i&&null!=s){const{field:r,getValue:n}=i;if("rotate-stop"===s.type)i.isUpdatingInteractively=!1,i.setInitialValue(t.getAttribute(r));else{i.isUpdatingInteractively=!0;const l=n(s.angle,e);l!==o[r]&&t.setAttribute(r,l),a=!0}}const l=n.size,c=ot(r.toolEventInfo);if(null!=l&&null!=c){const{field:r,getValue:n}=l;if("scale-stop"===c.type)l.isUpdatingInteractively=!1,l.setInitialValue(t.getAttribute(r));else{l.isUpdatingInteractively=!0;const i=n(c.xScale,e);i!==o[r]&&t.setAttribute(r,i),a=!0}}return a}async function it({feature:e,featureClone:t,visualVariableAttributes:r,sketchLayer:n,sketchViewModel:o,view:a,onUpdate:i,webStyleCache:u,addUpdatingPromise:d,addHandle:p}){await Se(t,u,"2d"===a.type?a.scale:null);let y=null;if("2d"===o?.view?.type){const e=f(e=>Se(t,u,e));y=g(()=>o?.view?.scale,t=>e(t))}const m=t.sourceLayer,h=ht(a,m);await tt({graphic:t,sketchLayer:n,sketchViewModel:o,sourceLayer:m,visualVariables:r,webStyleCache:u});let b=null;h.then(e=>b=e).catch(()=>{});const I=r.size,v=r.rotation,T=g(()=>e.attributes,async e=>{let r=!1;for(const n in e){const o=e[n];o!==t.getAttribute(n)&&(t.setAttribute(n,o),null==I||I.isUpdatingInteractively||I.field!==n||I.setInitialValue(o),null==v||v.isUpdatingInteractively||v.field!==n||v.setInitialValue(o),(null==b||b.requiredFields.includes(n))&&(r=!0))}r&&await Se(t,u,"2d"===a.type?a.scale:null)}),S=o.on("update",async e=>{const t=e.graphics[0],s={graphic:t,sketchLayer:n,sketchViewModel:o,sourceLayer:m,visualVariables:r,webStyleCache:u};if("complete"===e.state){if(null===a.activeTool)return tt(s);const e=new AbortController,t=c(e);return p(t),d(w(()=>null===a.activeTool,e.signal).then(async()=>{if(!e.signal.aborted)return e.abort(),tt(s)}))}at(a,t,e,r)&&await Se(t,u,"2d"===a.type?a.scale:null),i(bt(t),e)}),F=o.on(["undo","redo"],e=>{i(bt(e.graphics[0]),e)});return s([F,S,l(()=>o.cancel()),T,y])}async function st(e,t,r,n){e.add(n);const o=r.sourceLayer,i=r.getAttribute(o.objectIdField);let c=null;function u(e){c?.abort(),c=a(async r=>{const n=await ht(t,o);m(r),n.setVisibility?.(i,e)})}return await ct(t,n),u(!1),s([lt(t,n,e=>u(!e)),l(async()=>{u(!0);try{if(!t.destroyed){const e=await ht(t,o).catch(()=>{});e&&!e.destroyed&&await w(()=>!e.updating)}}finally{e.remove(n)}})])}function lt(e,t,r){if("3d"===e.type){const n=new W({graphic:t});return s([e.trackGraphicState(n),g(()=>n.displaying,r)])}return g(()=>t.visible,r)}async function ct(e,t){if("3d"===e.type){const r=new W({graphic:t}),n=e.trackGraphicState(r);await w(()=>r.displaying||r.error),n.remove()}else await w(()=>t.visible)}const ut={icon:I(24),text:I(12),line:I(1),viewScaleSizeFactor:100};function dt(e,t,r){let n=!1;return e.filter(e=>!!n||(n=e===t,n)).map(e=>r[e]())}function pt(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 ft(e){return"unknown"===e?null:e}function yt(e){e.filesEnabled=!0,e.mode="view",e.capabilities={editing:!0,operations:{add:!0,update:!0,delete:!0}}}const mt=e=>e.includes("-stop")||e.includes("vertex-"),ht=(e,t)=>{const r="subtype-sublayer"===t.type?t.parent:t;return e.whenLayerView(r)};function gt(e){return"createInteractiveEditSession"in e}function bt(e){const t=e.geometry;if("mesh"===t?.type){const r=e.cloneShallow();return r.attributes=u(e.attributes),r.geometry=t.cloneShallow(),r.geometry.transform=t.transform?.clone()??null,r}return e.clone()}function wt(e){return e.acquireCursor("progress")}async function It(e,t){const{template:r}=e;if(null==r)return null;if(j(r))return r.load();if(S(r)){const e=(await import("../../editing/sharedTemplates/SharedTemplate.js")).default,n=U(t,{makeSharedTemplateFromJSON:t=>e.fromJSON(t)}),o=await n.getTemplates({templateIds:[r.templateId],featureService:r.featureService});if(0===o.length)throw new i("editor:failed-to-load-template","Unable to load the provided template");return o[0].load()}return r}function vt(e){for(const t of e){const{destinationGraphic:e,destinationField:r,sourceGraphic:n,sourceField:o}=t;e.setAttribute(r,n.getAttribute(o))}}function Tt(e){const t=e.templateExecutorInfo?.completionResults;return t?.length?(t.forEach(e=>vt(e.relationships)),t.flatMap(e=>e.edits)):null}function St(e){const t=se(e)?e.activeWorkflow:e;if(null==t)return[];if(oe(t))return t.data.layers;const r=t.layer;return r?[r]:[]}function Ft({attributes:e},t){const r=new Set;r.add(t.objectIdField),"uniqueIdFields"in t&&t.uniqueIdFields&&t.uniqueIdFields.length>0&&v(r,t.uniqueIdFields);const n={};for(const o of r)null!=e[o]&&(n[o]=e[o]);if("scene"===t.type&&null!=t.infoFor3D){const r=t.associatedLayer?.globalIdField;null!=r&&(e[r]=e[r])}return n}function jt(e){if(!kt(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 kt(e){return 0===e.length||D(e[0])}export{Ge as appendAllUtilityNetworkAssociationRelationships,pt as avoidFeatureTemplateSelectionWithOnlyOneItem,gt as canCreateInteractiveEditSession,bt as cloneGraphicExceptMesh,ze as createLayerIdMap,Ee as createRelationshipKeyMap,Fe as createToolFromGeometryType,dt as createWorkflowSteps,He as fetchCandidates,_e as fetchFullFeatures,et as fetchFullFeaturesByObjectId,Ce as findAllDependencies,Be as findChangesByGlobalId,We as findEditorItemForLayer,$e as findEditorItemForLayerOrThrow,Je as findLayerInfo,De as generateHashForRelationship,Ne as getCreationAttributes,It as getFullTemplateForCreationInfo,St as getLayersFromWorkflow,ge as getRotationVariableAttribute,Tt as getServiceEditsFromWorkflowData,Me as getServiceInfoForLayer,Oe as getServiceLayersById,Ie as getSizeVariableAttribute,he as getVisualVariableAttributes,me as getVisualVariablesForLayer,ee as isAnyUpdateLeafWorkflow,te as isBatchAttributeFormViewModel,re as isCreateFeaturesWorkflow,ne as isFeatureFormViewModel,kt as isGraphicsArray,le as isMergeFeaturesWorkflow,de as isMergeWorkflowOptions,ue as isParentWorkflow,ce as isSplitFeatureWorkflow,pe as isSplitWorkflowOptions,mt as isTerminalUpdateEventType,ae as isUpdateFeatureWorkflow,oe as isUpdateFeaturesWorkflow,ye as isUpdateFeaturesWorkflowOptions,ie as isUpdateRecordWorkflow,se as isUpdateWorkflow,Re as isUtilityNetworkAssociationsTable,Ft as makeMinimalAttributes,qe as orderEditsByRelationshipDependencies,yt as prepareAttachmentsForCreateFeaturesWorkflow,vt as setRelationshipFields,it as setUpGeometryUpdate,ke as setUpSketchCreateWatchers,rt as setVisualVariablesAndElevationInfoForUpdate,wt as showProgressCursor,ut as sizeDefaults,ft as sizeVariableUnitToLengthUnit,je as startCreatingNewFeature,tt as startUpdatingFeatureGeometry,st as swapForEditingSession,jt as toFeatureInfos,Se as updateGraphicSymbolWhenRequired,at as visualVariableInteractiveUpdate,ht as whenEditorLayerView,ct as whenGraphicDisplayed,fe as workflowInfluencesOutcomeOfParent};
|
|
5
|
+
import e from"../../Color.js";import t from"../../Graphic.js";import{isSome as r,equals as n,addMany as o}from"../../core/arrayUtils.js";import{createTask as a}from"../../core/asyncUtils.js";import"../../core/has.js";import i from"../../core/Error.js";import{handlesGroup as s,makeHandle as l,abortHandle as c}from"../../core/handleUtils.js";import{clone as u}from"../../core/lang.js";import d from"../../core/Logger.js";import{getOrCreateMapValue as p}from"../../core/MapUtils.js";import{debounce as f,isPromiseLike as y,throwIfAborted as m,whenOrAbort as h}from"../../core/promiseUtils.js";import{watch as g,on as b,whenOnce as w}from"../../core/reactiveUtils.js";import{px2pt as I}from"../../core/screenUtils.js";import{addMany as v}from"../../core/SetUtils.js";import{diff as T}from"../../core/accessorSupport/diffUtils.js";import{isSharedTemplateOrMetadata as S,isSharedGroupTemplate as F,isSharedTemplate as j,isSharedPresetTemplate as k,isStandardFeatureTemplate as A,isSharedFeatureTemplate as L}from"../../editing/templateUtils.js";import{getSharedTemplateProvider as U}from"../../editing/sharedTemplates/SharedTemplateProvider.js";import V from"../../layers/GraphicsLayer.js";import{featureHasFields as M,fixFields as O,getDisplayFieldName as x}from"../../layers/support/fieldUtils.js";import{isSubtypeSublayer as q}from"../../layers/support/layerUtils.js";import{calculateTolerance as z}from"../../renderers/support/clickToleranceUtils.js";import{meterIn as E}from"../../renderers/support/lengthUtils.js";import{isRenderer as P}from"../../renderers/support/typeUtils.js";import{getTransformationType as C}from"../../renderers/visualVariables/support/sizeVariableUtils.js";import{isGraphic as D}from"../../support/guards.js";import R from"../../symbols/SimpleFillSymbol.js";import G from"../../symbols/SimpleLineSymbol.js";import B from"../../symbols/SimpleMarkerSymbol.js";import{to3D as N}from"../../symbols/support/symbolConversion.js";import{getDisplayedSymbol as Z}from"../../symbols/support/symbolUtils.js";import{getServices as W}from"../../undoredo/support/Services.js";import{GraphicState as Q}from"../../views/3d/layers/graphics/GraphicState.js";import{defaultDrawingMode as $}from"../../views/draw/DrawingMode.js";import{createQueryGeometry as J}from"../../views/support/drapedUtils.js";import{filterGraphicHits as H,hitTestSelectSimilarDistance as K}from"../../views/support/hitTestSelectUtils.js";import{dependencySort as X}from"./support/dependencySort.js";import{isDrawGraphicTool as Y}from"../Sketch/support/sketchUtils.js";const _="updateFeatureWorkflow-internal",ee=()=>d.getLogger("esri.widgets.Editor.workflowUtils");function te(e){return se(e)||ae(e)}function re(e){return!!e&&"features"in e}function ne(e){return null!=e&&"create-features"===e.type}function oe(e){return!!e&&"feature"in e}function ae(e){return null!=e&&"update-features"===e.type}function ie(e){return null!=e&&"update-feature"===e.type}function se(e){return null!=e&&e.type.includes("update-")&&"fullFeature"in e}function le(e){return null!=e&&"update"===e.type}function ce(e){return null!=e&&"merge-features"===e.type}function ue(e){return null!=e&&"split-feature"===e.type}function de(e){const t=e?.type;return"update-feature"===t||"update-table-record"===t||"update-features"===t||"split-feature"===t}function pe(e){return"merge"===e?.type}function fe(e){return"split"===e?.type}function ye(e){return ce(e)||ue(e)}function me(e){return"update-multiple"===e?.type}function he(e){const t=e&&"renderer"in e?e.renderer:null;if(!Se(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"===C(e));return{rotation:1===r.length?r[0]:null,size:1===n.length?n[0]:null}}function ge(e){const t=e.sourceLayer;if(!(t&&"renderer"in t&&Se(t.renderer)))return{rotation:null,size:null};const{rotation:r,size:n}=he(t);let o=null,a=null;if(r){const e=t.fields?.filter(e=>e.name===r.field),n=1===e?.length?e[0]:null;o=be(r,n)}if(n){const e=t.fields?.filter(e=>e.name===n.field),r=1===e?.length?e[0]:null;a=ve(n,r)}return{rotation:o,size:a}}function be(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,Te((o.current+360)%360,n)),setInitialValue:e=>{o.initial=e,o.current=0},isUpdatingInteractively:!1,rotationType:e.rotationType??"geographic"}}function we(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 Ie(e,t,r){if(null==t)return 0;const{symbol:n}=N(t);if(null==n||"web-style"===n.type||"cim"===n.type)return 0;const o=n.symbolLayers.at(0);if(!o)return 0;switch(o.type){case"icon":{const{computeIconLayerResourceSize:e}=await import("../../symbols/support/symbolLayerUtils.js");return Math.min(dt.icon,(await e(o,dt.icon))[0])||dt.icon}case"text":return dt.text;case"line":return dt.line;case"object":{const{computeObjectLayerResourceSize:t}=await import("../../symbols/support/symbolLayerUtils.js");return we(await t(o,e.scale/dt.viewScaleSizeFactor),r)}case"path":case"extrude":return e.scale/dt.viewScaleSizeFactor;default:return 0}}function ve(e,t){const r=e.axis,n=t?.type??"double",o={initial:0,current:0},a=E[e.valueUnit]??1;let i;return i="area"===e.valueRepresentation?e=>(e*a/2)**2*Math.PI:"radius"===e.valueRepresentation||"distance"===e.valueRepresentation?e=>e*a/2:e=>e*a,{field:e.field,fieldType:n,getDefaultValue:async(e,t)=>Te(i(await Ie(t,e,r)),n),getValue:(e,t)=>(o.initial||(o.initial=t.pixelSizeAt(t.center)),o.current=o.initial*e,Te(o.current,n)),setInitialValue:e=>{o.initial=e,o.current=0},isUpdatingInteractively:!1,displayUnit:yt(e.valueUnit),axis:e.axis}}function Te(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 Se(e){if(!P(e))return!1;switch(e?.type){case"class-breaks":case"simple":case"unique-value":case"dot-density":case"dictionary":case"pie-chart":return!0;default:return!1}}async function Fe(e,t,r){const n=await Z(e,{useSourceLayer:!0,ignoreGraphicSymbol:!0,webStyleCache:t,scale:r});null!=T(e.symbol,n)&&(e.symbol=n)}function je(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:$,optionsPerTool:r};if(S(t)){const o=t.defaultTool,a=F(t)?t.definition?.inputGeometryType??e:e;switch(o){case"freehand":case"stream-line":return{tool:"polyline"===a?"freehandPolyline":"freehandPolygon",createOptions:n};case"autocomplete-freehand-polygons":case"stream-polygon":return{tool:"freehandPolygon",createOptions:n};case"autocomplete-polygons":case"difference-polygon":case"create-structures":case"polygon":case"trace":return{tool:"polygon"===a?"polygon":"polyline",createOptions:n};case"circle":return r.get("circle").preserveAspectRatio=!0,{tool:"circle",createOptions:n};case"ellipse":return r.get("circle").preserveAspectRatio=!1,{tool:"circle",createOptions:n};case"create-points-along-line":case"multipoint":return{tool:"multipoint",createOptions:n};case"line":case"radial-line":case"right-angle-line":case"split":case"two-point-line":return{tool:"polyline",createOptions:n};case"rectangle":case"regular-polygon":case"right-angle-polygon":return{tool:"rectangle",createOptions:n};case"elevation-point-from-contour":case"elevation-point-from-dem":case"parcel-seed":case"point":case"point-and-rotation":case"point-at-end-of-line":return{tool:"point",createOptions:n}}}else{const o=t.drawingTool;if("circle"===o||"ellipse"===o)return r.get("circle").preserveAspectRatio="circle"===o,{tool:"circle",createOptions:n};if("rectangle"===o)return{tool:"rectangle",createOptions:n};if("freehand"===o)return{tool:"polygon"===e?"freehandPolygon":"freehandPolyline",createOptions:n}}return{tool:e,createOptions:n}}async function ke(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=Ze(a,o.attributeOverrides),{view:c}=e,u="2d"===c?.type;F(a)||k(a)||await We(e,s,l,n,u?c.scale:null);const{capabilities:d}=s;t.elevationInfo=s.elevationInfo;const p=je(s.geometryType,a);e.defaultCreateOptions={graphicProperties:{attributes:l,sourceLayer:s},mode:p.createOptions.mode,optionsPerTool:p.createOptions.optionsPerTool,preserveAspectRatio:p.createOptions.preserveAspectRatio,hasZ:d.data.supportsZ,defaultZ:(u?d.editing.zDefault:null)??e.defaultCreateOptions.defaultZ},null==o.geometryToPlace?await e.create(p.tool):await e.place(o.geometryToPlace,{graphicProperties:{attributes:l,sourceLayer:s}})}async function Ae(e){return s([Le(e),Ue(e)])}function Le({creationAttributes:e,data:t,sketchViewModel:r,view:n,webStyleCache:o}){const{creationInfo:a}=t,{fullTemplate:i}=t;if(!a||"2d"!==n?.type||F(i)||k(i))return null;const s=f(t=>We(r,a.layer,e,o,t));return g(()=>n.scale,e=>s(e))}function Ue({data:t,sketchViewModel:r,view:n}){const{templateExecutorInfo:o}=t;if(!o)return null;const a=r.activeComponent;if(!n||!Y(a))return ee().error(new i("featureworkflow","Failed to set up template feedback.")),null;const c=new V({effect:"saturate(0.6) opacity(0.8)",listMode:"hide",title:"Shared Template Feedback Graphics"});n.map?.add(c);const{executor:u,serviceLayersById:d}=o,p=n.theme?.accentColor??new e([255,165,0,1]);return s([b(()=>a,["cursor-update","vertex-add"],()=>{c.removeAll();const e=a.graphic?.geometry;if(!e||!Ve(e))return;const t=u(e,"digitizing");if(!y(t))for(const r of t.edits){const e=d.get(r.id);if(e&&r.addFeatures&&0!==r.addFeatures.length)for(const t of e)if(!t.isTable)for(const e of r.addFeatures){const t=Me(e,p);t&&c.add(t)}}}),l(()=>{n.map.remove(c),c.destroy()})])}function Ve(e){switch(e.type){case"point":case"multipoint":return!0;case"polyline":return e.paths[0].length>1;case"polygon":{const t=e.rings[0];return n(t.at(0),t.at(-1))?t.length>2:t.length>1}default:return!1}}function Me(e,r){let n=null;switch(e.geometry?.type){case"point":case"multipoint":n=new B({angle:0,color:r,outline:new G({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 R({color:r,outline:new G({cap:"round",color:r,join:"round",miterLimit:1,style:"solid",width:3}),style:"none"});break;case"polyline":n=new G({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=W(t),n=q(e)?e.parent:e;return r.tablesAndLayersLookup.get(n)}function xe(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 qe(e){const t=e.objectIdField,r=e.globalIdField??"";return{id:e.layerId,identifierFields:{objectIdField:t,globalIdField:r},addFeatures:[],deleteAttachments:[],addAttachments:[],deleteFeatures:[],updateFeatures:[]}}function ze(e){const{edits:t,serviceInfo:n,view:o,findOriginalFeature:a}=e,i=Ee(n.layersAndTables),s=n.layersAndTables.toArray(),{allEditData:l,editDataByLayerIdMap:c,editDataByIdMap:u}=Ce(t,i,a),d=De(l,Pe(s,c),c);if(o&&Be(l,d,o),0===d.length)return t;const p=X(d,{continueOnCircularDependency:!0}).map(e=>u.get(e)).filter(r),f=new Map;for(const r of p)f.set(r.uniqueId,r);const y=[];for(const r of l)f.has(r.uniqueId)||y.push(r);const m=[];let h=null;for(const r of p){const{layer:e}=r;switch(null==h?h=qe(e):h.id!==e.layerId&&(m.push(h),h=qe(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)??qe(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 Ee(e){const t=new Map;for(const r of e)t.set(r.layerId,r);return t}function Pe(e,t){const r=new Map;for(const n of e)for(const e of n.relationships??[])if(r.set(Re(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(Re(n,e),t.keyField);break}}return r}function Ce(e,t,r){const n=new Map,o=[],a=new Map;let s=1;for(const l of e){const e=[],c=t.get(l.id);if(!c)throw new i("featureworkflow",`Failed to prepare applyEdits payload. Layer with id ${l.id} not found.`);for(const t of l.addFeatures??[])e.push({uniqueId:"T"+s++,operationType:"add",layer:c,after:t});for(const t of l.deleteFeatures??[])e.push({uniqueId:"T"+s++,operationType:"delete",before:t,layer:c});for(const t of l.deleteAttachments??[])e.push({uniqueId:"T"+s++,operationType:"deleteAttachment",attachmentId:t,layer:c});for(const t of l.addAttachments??[])e.push({uniqueId:"T"+s++,operationType:"addAttachment",attachment:t,layer:c});for(const t of l.updateFeatures??[])e.push({uniqueId:"T"+s++,operationType:"modify",before:r(t),after:t,layer:c});n.set(c.layerId,e);for(const t of e)o.push(t),a.set(t.uniqueId,t)}return{allEditData:o,editDataByIdMap:a,editDataByLayerIdMap:n}}function De(e,t,r){const n=[];for(const o of e){const e=o.layer.relationships??[],{uniqueId:a}=o;for(const i of e){const e=i.keyField;if("origin"===i.role){const s=r.get(i.relatedTableId);if(!s||0===s.length)continue;const l=Re(o.layer,i),c=t.get(l);if(void 0===c||""===c)continue;switch(o.operationType){case"add":for(const t of s)t!==o&&("add"!==t.operationType&&"modify"!==t.operationType||t.after.attributes[c]===o.after.attributes[e]&&n.push([a,t.uniqueId]));break;case"modify":if(o.before.attributes[e]!==o.after.attributes[e])for(const t of s){const r=t.uniqueId;t!==o&&("delete"===t.operationType?t.before.attributes[c]===o.before.attributes[e]?n.push([r,a]):t.before.attributes[c]===o.after.attributes[e]&&n.push([a,r]):"add"===t.operationType?t.after.attributes[c]===o.after.attributes[e]?n.push([a,r]):t.after.attributes[c]===o.before.attributes[e]&&n.push([r,a]):"modify"===t.operationType&&(t.before.attributes[c]!==t.after.attributes[c]?t.after.attributes[c]===o.after.attributes[e]?n.push([a,r]):n.push([r,a]):n.push([a,r])))}break;case"delete":for(const t of s)t!==o&&("delete"!==t.operationType&&"modify"!==t.operationType||t.before.attributes[c]===o.before.attributes[e]&&n.push([t.uniqueId,a]))}}}}return n}function Re(e,t){return`${e.layerId}:${t.id}`}function Ge(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 Be(e,t,r){const n=[];for(const a of e)Ge(a.layer,r)&&n.push(a);if(0===n.length)return;let o=[];for(const a of n){const r=a.layer;switch(a.operationType){case"delete":o=[...Ne(a.before.attributes[r.fieldsIndex.get("fromglobalid").name],e),...Ne(a.before.attributes[r.fieldsIndex.get("toglobalid").name],e)];for(const e of o)t.push([a.uniqueId,e.uniqueId]);break;case"add":o=[...Ne(a.after.attributes[r.fieldsIndex.get("fromglobalid").name],e),...Ne(a.after.attributes[r.fieldsIndex.get("toglobalid").name],e)];for(const e of o)t.push([e.uniqueId,a.uniqueId])}}}function Ne(e,t){const r=[],n=t.filter(({layer:e})=>""!==e.globalIdField&&null!=e.globalIdField);for(const o of n){const t=o.layer.globalIdField;("before"in o&&o.before?.attributes[t]===e||"after"in o&&o.after?.attributes[t]===e)&&r.push(o)}return r}function Ze(e,t={}){return F(e)||k(e)?{}:A(e)?{...e.prototype.attributes,...t}:L(e)?{...e.definition?.defaultValues,...t}:{...t}}async function We(e,r,n,o,a){const i=new t({sourceLayer:r,attributes:n}),{rotation:s,size:l}=ge(i);let c=await Z(i,{useSourceLayer:!0,webStyleCache:o,scale:a}),u=!1;for(const t of[l,s]){if(null==t)continue;null==n[t.field]&&(n[t.field]=await t.getDefaultValue(c,e.view),u=!0)}switch(u&&(c=await Z(i,{useSourceLayer:!0,webStyleCache:o,scale:a})),c?.type){case"simple-fill":case"polygon-3d":e.polygonSymbol=c;break;case"simple-line":case"line-3d":e.polylineSymbol=c;break;case"simple-marker":case"picture-marker":case"point-3d":case"cim":e.pointSymbol=c;break;case"mesh-3d":e.meshSymbol=c}Qe(e.tooltipOptions,l,s)}function Qe(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 $e(e,t){return e.find(e=>e.layer===t)}function Je(e,t){const r=$e(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 He(e,t){return e?.find(e=>e.layer===t)}async function Ke(e,t,r,n){switch(t.type){case"3d":return Xe(e,t,r,n);case"2d":return Ye(e,t,r,n)}}async function Xe(e,t,r,n){if(0===e.length)return[];const{updatable:a,graphicsByLayer:i}=await r.defer(async()=>{const{results:o}=await h(K(t,r),n),a=new Map,i=e=>{const t=e.layer,r=a.get(t);if(!r){const e=new Array;return a.set(t,e),e}return r};H(o).forEach(({graphic:e})=>i(e).push(e));const s=e.filter(({capabilities:e,layer:t})=>e.update.enabled&&a.has(t));return 0!==s.length&&r.stopPropagation(),{updatable:s,graphicsByLayer:a}});return h(Promise.allSettled(a.map(async({layer:e})=>{const t=i.get(e),r=_e(e);if(t.every(e=>M(e,r)))return t;const a=[];for(const n of t){a.push(n.getObjectId());const e=Object.keys(n.attributes);o(r,e)}const s=e.createQuery();return s.returnGeometry=!1,s.objectIds=a,s.outFields=O(e.fieldsIndex,r),e.queryFeatures(s,{signal:n}).then(({features:e})=>e)})),n)}async function Ye(e,t,r,n){if(0===e.length)return[];const{mapPoint:o}=r;if(null==o)return[];let a=null;const i=await r.defer(async()=>{const{results:o}=await h(t.hitTest(r),n);if(0===o.length)return[];const i=new Set;a=H(o),a.forEach(({graphic:e})=>e&&i.add(e.layer));const s=e.filter(e=>i.has(e.layer)&&e.supportsUpdateWorkflow);return s.length>0&&r.stopPropagation(),s});return h(Promise.allSettled(i.map(async({layer:e})=>{const i=e.createQuery();i.returnGeometry=!0,i.outFields=_e(e);const s="renderer"in e?z({renderer:e.renderer,pointerType:r.pointerType}):0;i.geometry=J(o,s,t),i.outSpatialReference=t.spatialReference;const{features:l}=await e.queryFeatures(i,{signal:n});return a?.forEach(({graphic:t})=>{t.layer!==e||l.some(e=>e.getObjectId()===t.getObjectId())||l.push(t)}),l})),n)}function _e(e){return O(e.fieldsIndex,[e.objectIdField,x({displayField:"displayField"in e?e.displayField:null,fields:e.fields})])}async function et(e,t,n,o){return tt(e.map(e=>e.getObjectId()??e.attributes[t.objectIdField]).filter(r),t,n,o)}async function tt(e,t,r,n){const o=t.createQuery();o.objectIds=e,o.outFields=["*"],o.returnM=t.capabilities.data.supportsM,o.returnZ=t.capabilities.data.supportsZ,o.returnGeometry=!0,"scene"===t.type&&null!=t.infoFor3D||(o.outSpatialReference=r);const a=await t.queryFeatures(o,{signal:n});return m(n),a.features}async function rt(e){const{graphic:t,sketchViewModel:r,sourceLayer:n,visualVariables:o}=e;await nt(e);const a={multipleSelectionEnabled:!1};return"point"===n.geometryType&&(a.enableRotation=null!=o.rotation,a.enableScaling=null!=o.size),r.update(t,a)}async function nt(e){const{graphic:t,sketchLayer:r,sketchViewModel:n,sourceLayer:o,visualVariables:a,webStyleCache:i}=e;let s=!1;const{rotation:l,size:c}=a;for(const u of[l,c]){if(null==u)continue;const e=t.getAttribute(u.field);if(null!=e)u.setInitialValue(e);else{const e=await u.getDefaultValue(t.symbol,n.view);u.setInitialValue(e),t.setAttribute(u.field,e),s=!0}}if(s){const e="2d"===n.view?.type?n.view.scale:null;await Fe(t,i,e)}Qe(n.tooltipOptions,c,l),r.elevationInfo=o.elevationInfo}function ot(e){return null==e||"rotate-start"!==e.type&&"rotate"!==e.type&&"rotate-stop"!==e.type?null:e}function at(e){return null==e||"scale-start"!==e.type&&"scale"!==e.type&&"scale-stop"!==e.type?null:e}function it(e,t,r,n){if(null==t.geometry||"point"!==t.geometry?.type)return!1;const o=t.attributes;let a=!1;const i=n.rotation,s=ot(r.toolEventInfo);if(null!=i&&null!=s){const{field:r,getValue:n}=i;if("rotate-stop"===s.type)i.isUpdatingInteractively=!1,i.setInitialValue(t.getAttribute(r));else{i.isUpdatingInteractively=!0;const l=n(s.angle,e);l!==o[r]&&t.setAttribute(r,l),a=!0}}const l=n.size,c=at(r.toolEventInfo);if(null!=l&&null!=c){const{field:r,getValue:n}=l;if("scale-stop"===c.type)l.isUpdatingInteractively=!1,l.setInitialValue(t.getAttribute(r));else{l.isUpdatingInteractively=!0;const i=n(c.xScale,e);i!==o[r]&&t.setAttribute(r,i),a=!0}}return a}async function st({feature:e,featureClone:t,visualVariableAttributes:r,sketchLayer:n,sketchViewModel:o,view:a,onUpdate:i,webStyleCache:u,addUpdatingPromise:d,addHandle:p}){await Fe(t,u,"2d"===a.type?a.scale:null);let y=null;if("2d"===o?.view?.type){const e=f(e=>Fe(t,u,e));y=g(()=>o?.view?.scale,t=>e(t))}const m=t.sourceLayer,h=gt(a,m);await rt({graphic:t,sketchLayer:n,sketchViewModel:o,sourceLayer:m,visualVariables:r,webStyleCache:u});let b=null;h.then(e=>b=e).catch(()=>{});const I=r.size,v=r.rotation,T=g(()=>e.attributes,async e=>{let r=!1;for(const n in e){const o=e[n];o!==t.getAttribute(n)&&(t.setAttribute(n,o),null==I||I.isUpdatingInteractively||I.field!==n||I.setInitialValue(o),null==v||v.isUpdatingInteractively||v.field!==n||v.setInitialValue(o),(null==b||b.requiredFields.includes(n))&&(r=!0))}r&&await Fe(t,u,"2d"===a.type?a.scale:null)}),S=o.on("update",async e=>{const t=e.graphics[0],s={graphic:t,sketchLayer:n,sketchViewModel:o,sourceLayer:m,visualVariables:r,webStyleCache:u};if("complete"===e.state){if(null===a.activeTool)return rt(s);const e=new AbortController,t=c(e);return p(t),d(w(()=>null===a.activeTool,e.signal).then(async()=>{if(!e.signal.aborted)return e.abort(),rt(s)}))}it(a,t,e,r)&&await Fe(t,u,"2d"===a.type?a.scale:null),i(wt(t),e)}),F=o.on(["undo","redo"],e=>{i(wt(e.graphics[0]),e)});return s([F,S,l(()=>o.cancel()),T,y])}async function lt(e,t,r,n){e.add(n);const o=r.sourceLayer,i=r.getAttribute(o.objectIdField);let c=null;function u(e){c?.abort(),c=a(async r=>{const n=await gt(t,o);m(r),n.setVisibility?.(i,e)})}return await ut(t,n),u(!1),s([ct(t,n,e=>u(!e)),l(async()=>{u(!0);try{if(!t.destroyed){const e=await gt(t,o).catch(()=>{});e&&!e.destroyed&&await w(()=>!e.updating)}}finally{e.remove(n)}})])}function ct(e,t,r){if("3d"===e.type){const n=new Q({graphic:t});return s([e.trackGraphicState(n),g(()=>n.displaying,r)])}return g(()=>t.visible,r)}async function ut(e,t){if("3d"===e.type){const r=new Q({graphic:t}),n=e.trackGraphicState(r);await w(()=>r.displaying||r.error),n.remove()}else await w(()=>t.visible)}const dt={icon:I(24),text:I(12),line:I(1),viewScaleSizeFactor:100};function pt(e,t,r){let n=!1;return e.filter(e=>!!n||(n=e===t,n)).map(e=>r[e]())}function ft(e,t){e.viewModel.syncFeatureTemplates();const r=e.creationInfo;if("awaiting-feature-creation-info"===t[0].id&&r){const n=r.layer,o=e.viewModel.getTemplatesForLayer(n);1===o.length&&"scene"!==n.type&&(r.template=o[0],t.shift())}return t}function yt(e){return"unknown"===e?null:e}function mt(e){e.filesEnabled=!0,e.mode="view",e.capabilities={editing:!0,operations:{add:!0,update:!0,delete:!0}}}const ht=e=>e.includes("-stop")||e.includes("vertex-"),gt=(e,t)=>{const r="subtype-sublayer"===t.type?t.parent:t;return e.whenLayerView(r)};function bt(e){return"createInteractiveEditSession"in e}function wt(e){const t=e.geometry;if("mesh"===t?.type){const r=e.cloneShallow();return r.attributes=u(e.attributes),r.geometry=t.cloneShallow(),r.geometry.transform=t.transform?.clone()??null,r}return e.clone()}function It(e){return e.acquireCursor("progress")}async function vt(e,t){const{template:r}=e;if(null==r)return null;if(j(r))return r.load();if(S(r)){const e=(await import("../../editing/sharedTemplates/SharedTemplate.js")).default,n=U(t,{makeSharedTemplateFromJSON:t=>e.fromJSON(t)}),o=await n.getTemplates({templateIds:[r.templateId],featureService:r.featureService});if(0===o.length)throw new i("editor:failed-to-load-template","Unable to load the provided template");return o[0].load()}return r}function Tt(e){for(const t of e){const{destinationGraphic:e,destinationField:r,sourceGraphic:n,sourceField:o}=t;e.setAttribute(r,n.getAttribute(o))}}function St(e){const t=e.templateExecutorInfo?.completionResults;return t?.length?(t.forEach(e=>Tt(e.relationships)),t.flatMap(e=>e.edits)):null}function Ft(e){const t=le(e)?e.activeWorkflow:e;if(null==t)return[];if(ae(t))return t.data.layers;const r=t.layer;return r?[r]:[]}function jt({attributes:e},t){const r=new Set;r.add(t.objectIdField),"uniqueIdFields"in t&&t.uniqueIdFields&&t.uniqueIdFields.length>0&&v(r,t.uniqueIdFields);const n={};for(const o of r)null!=e[o]&&(n[o]=e[o]);if("scene"===t.type&&null!=t.infoFor3D){const r=t.associatedLayer?.globalIdField;null!=r&&(e[r]=e[r])}return n}function kt(e){if(!At(e))return e;const t=new Map;for(const r of e){const e=r.getObjectId();if(null!=e){const n=r.sourceLayer??r.layer;p(t,n,()=>[]).push(e)}}return Array.from(t.entries()).map(([e,t])=>({layer:e,objectIds:t}))}function At(e){return 0===e.length||D(e[0])}export{Be as appendAllUtilityNetworkAssociationRelationships,ft as avoidFeatureTemplateSelectionWithOnlyOneItem,bt as canCreateInteractiveEditSession,wt as cloneGraphicExceptMesh,Ee as createLayerIdMap,Pe as createRelationshipKeyMap,je as createToolFromGeometryType,pt as createWorkflowSteps,Ke as fetchCandidates,et as fetchFullFeatures,tt as fetchFullFeaturesByObjectId,De as findAllDependencies,Ne as findChangesByGlobalId,$e as findEditorItemForLayer,Je as findEditorItemForLayerOrThrow,He as findLayerInfo,Re as generateHashForRelationship,Ze as getCreationAttributes,vt as getFullTemplateForCreationInfo,Ft as getLayersFromWorkflow,be as getRotationVariableAttribute,St as getServiceEditsFromWorkflowData,Oe as getServiceInfoForLayer,xe as getServiceLayersById,ve as getSizeVariableAttribute,ge as getVisualVariableAttributes,he as getVisualVariablesForLayer,te as isAnyUpdateLeafWorkflow,re as isBatchAttributeFormViewModel,ne as isCreateFeaturesWorkflow,oe as isFeatureFormViewModel,At as isGraphicsArray,ce as isMergeFeaturesWorkflow,pe as isMergeWorkflowOptions,de as isParentWorkflow,ue as isSplitFeatureWorkflow,fe as isSplitWorkflowOptions,ht as isTerminalUpdateEventType,ie as isUpdateFeatureWorkflow,ae as isUpdateFeaturesWorkflow,me as isUpdateFeaturesWorkflowOptions,se as isUpdateRecordWorkflow,le as isUpdateWorkflow,Ge as isUtilityNetworkAssociationsTable,jt as makeMinimalAttributes,ze as orderEditsByRelationshipDependencies,mt as prepareAttachmentsForCreateFeaturesWorkflow,Tt as setRelationshipFields,st as setUpGeometryUpdate,Ae as setUpSketchCreateWatchers,nt as setVisualVariablesAndElevationInfoForUpdate,It as showProgressCursor,dt as sizeDefaults,yt as sizeVariableUnitToLengthUnit,ke as startCreatingNewFeature,rt as startUpdatingFeatureGeometry,lt as swapForEditingSession,kt as toFeatureInfos,_ as updateFeatureWorkflowInternalGraphicsLayerTitle,Fe as updateGraphicSymbolWhenRequired,it as visualVariableInteractiveUpdate,gt as whenEditorLayerView,ut as whenGraphicDisplayed,ye as workflowInfluencesOutcomeOfParent};
|
package/widgets/Editor.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{substitute as t}from"../intl.js";import{deprecatedFunction as i}from"../core/deprecate.js";import s from"../core/Logger.js";import{destroyMaybe as o,abortMaybe as r,mappedFind as a}from"../core/maybe.js";import{createResolver as n}from"../core/promiseUtils.js";import{watch as l,on as c,when as d,initial as h}from"../core/reactiveUtils.js";import{property as m}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as p}from"../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as u}from"../core/support/UpdatingHandles.js";import g from"../views/interactive/sketch/SketchValueOptions.js";import w from"./Attachments.js";import _ from"./BatchAttributeForm.js";import v from"./FeatureForm.js";import f from"./FeatureTemplates.js";import y from"./Spinner.js";import b from"./Widget.js";import{VisibleElements as k}from"./BatchAttributeForm/VisibleElements.js";import{css as F}from"./Editor/css.js";import M from"./Editor/EditorViewModel.js";import{isModelUpload as A}from"./Editor/modelUploadUtils.js";import T from"./Editor/VisibleElements.js";import{isFeatureFormViewModel as S,isUpdateWorkflow as C,isUpdateFeaturesWorkflow as L,isUpdateFeatureWorkflow as E,isBatchAttributeFormViewModel as W}from"./Editor/workflowUtils.js";import{loadCreateFeaturesPanelContentComponents as P,CreateFeaturesPanelContent as I}from"./Editor/components/CreateFeaturesPanelContent.js";import{loadFeatureListComponents as j,FeatureList as U}from"./Editor/components/FeatureList.js";import{loadFooterActionsComponents as V,FooterActions as D}from"./Editor/components/FooterActions.js";import{loadNoticesComponents as x,Notice as B}from"./Editor/components/Notices.js";import{loadPanelContentComponents as O,PanelContent as N,PanelContentSection as H,PanelContentMessage as G}from"./Editor/components/PanelContent.js";import{PanelToolbar as R,loadPanelToolbarComponents as z}from"./Editor/components/PanelToolbar.js";import{loadPromptComponents as q,Prompt as K}from"./Editor/components/Prompt.js";import{loadUpdateFeaturePanelContentComponents as Z,UpdateFeaturePanelContent as $}from"./Editor/components/UpdateFeaturePanelContent.js";import{loadUploadDetailsComponents as J,UploadDetails as Q}from"./Editor/components/UploadDetails.js";import{CreateToolVisibilityMap as X}from"./Sketch/CreateToolVisibilityMap.js";import{SelectionToolVisibilityMap as Y}from"./Sketch/SelectionToolVisibilityMap.js";import{VisibleElements as ee}from"./Sketch/VisibleElements.js";import{loadCalciteComponents as te}from"./support/componentsUtils.js";import{globalCss as ie}from"./support/globalCss.js";import{incrementHeadingLevel as se,Heading as oe}from"./support/Heading.js";import{renderItem as re}from"./support/ItemList.js";import{connectDelayedLoading as ae}from"./support/loaderUtils.js";import ne from"./support/SelectionList.js";import le from"./support/SelectionToolbar.js";import{messageBundle as ce,vmEvent as de,tsx as he}from"./support/widget.js";import me from"./support/SelectionList/VisibleElements.js";import pe from"./support/SelectionToolbar/VisibleElements.js";const ue=Symbol("sketch-setup-handles");let ge=class extends b{constructor(e,i){super(e,i),this._batchAttributeForm=new _({visibleElements:new k({loadingIndicator:!1})}),this._featureForm=new v,this._sketchToolbar=null,this._attachments=new w({visibleElements:{addSubmitButton:!1,cancelAddButton:!1,cancelUpdateButton:!1,deleteButton:!1,errorMessage:!1,progressBar:!1,updateButton:!1}}),this._associationItemList=null,this._associationSettings=null,this._featureTemplates=new f({enableListScroll:!1,renderItemContentEnd:e=>e.supportsUpload?he("calcite-icon",{class:F.templateItemContentEnd,icon:"upload-to",key:"upload-icon"}):null,renderItemLabel:e=>e.label,renderCustomGroupContent:e=>this._renderCustomTemplateGroupContent(e)}),this._filterText="",this._prompt=null,this._spinner=new y,this._loading=!1,this._selectionList=new ne({displayMode:"layer",itemActionConfigs:this._selectionListItemActionConfigs,onListItemSelect:({item:e})=>this._onSelectionListItemSelect(e),visibleElements:new me({header:!1})}),this._selectionToolbar=new le({visibleElements:new pe({chip:!1})}),this._updatingHandles=new u,this.headingLevel=4,this.messages=null,this.messagesCommon=null,this.messagesTemplates=null,this.messagesFeature=null,this.supportingWidgetDefaults=null,this.viewModel=new M,this.visibleElements=new T,this._renderAttachments=()=>this._attachments.render(),this._renderFeatureForm=()=>this._featureForm.render(),this._renderBatchAttributeForm=()=>this._batchAttributeForm.render(),this._renderFeatureTemplates=()=>this._featureTemplates.render(),this._renderSelectionList=()=>this._selectionList.render(),this._renderSelectionToolbar=()=>this._selectionToolbar.render(),this._renderSketch=()=>this._sketchToolbar?he("div",{class:F.sketchContainer,key:"editor-sketch-container"},this._sketchToolbar?.render()):void 0,this._renderSelectIcon=()=>he("calcite-icon",{icon:"cursor",slot:"content-start"}),this.EditorPanel=({heading:e,key:t,selected:i},...s)=>{const{visibleElements:o}=this;return he("calcite-flow-item",{closable:!1,heading:e,headingLevel:this.headingLevel,key:t,loading:this._loading,selected:i,onCalciteFlowItemBack:this._onBack},o.settingsMenu?he(R,{editorViewModel:this.viewModel,messagesCommon:this.messagesCommon,visibleElements:o}):null,...s)},this._showDiscardEditsPrompt=()=>{const{messages:e,activeWorkflow:t}=this,i={title:e.cancelEditTitle,message:e.cancelEditWarningMessage,yesLabel:e.discardEdits,noLabel:e.continueEditing};return"create-features"===t?.type&&A(t.data.creationInfo)?this._showPromptAndWait("success"===t.data.upload?.state?e.modelUploads.cancelPlacementPrompt:e.modelUploads.cancelUploadPrompt):"update"===t?.type&&S(t.formViewModel)&&t.formViewModel.activeAssociation?this._showPromptAndWait({...i,message:e.cancelAssociationEditWarning}):this._showPromptAndWait(i)},this._showGenericCancelPrompt=()=>{const{messages:e,messagesCommon:t}=this;return this._showPromptAndWait({title:e.cancelRequestTitle,message:e.cancelRequestWarningMessage,yesLabel:t.form.yes,noLabel:t.form.no})},this._showPrompt=e=>{this._prompt?.cancel?.(),this._prompt=e},this._clearPrompt=()=>{this._prompt=null},this._onSave=()=>{this.viewModel.saveWorkflow()},this._onMerge=()=>{const{activeWorkflow:e}=this.viewModel;if(C(e)){const t=e.activeWorkflow;L(t)&&e.startMergingFeatures(t.viewGraphics)}},this._onSplit=()=>{const{activeWorkflow:e}=this.viewModel;if(C(e)){const t=e.activeWorkflow;if(E(t)){const i=t.viewGraphic;i&&e.startSplittingFeature(i)}}},this._onDelete=()=>{const e=this.viewModel.activeFeatureCount,i=e>1?this.messages.multiFeature:this.messages.singleFeature;this._showPrompt({title:i.deleteWarningTitle,message:i.deleteWarningMessage,context:"danger",actions:{primary:{label:t(i.delete,{count:e}),action:()=>{this.deleteFeatures(),this._clearPrompt()}},secondary:{label:i.keep,action:this._clearPrompt}}})},this._onDeleteAssociation=()=>{const{messages:e,messagesCommon:t}=this;this._showPrompt({title:e.deleteAssociationTitle,message:e.deleteAssociationMessage,context:"danger",actions:{primary:{label:t.delete,action:()=>{this.deleteAssociationFromWorkflow(),this._clearPrompt()}},secondary:{label:e.keepAssociation,action:this._clearPrompt}}})},this._onToggleUpdateWorkflow=()=>this.viewModel.toggleUpdateWorkflow(),this._onBack=e=>(e?.stopPropagation(),this.viewModel.back()),this._onAttachmentAdd=()=>{const{activeWorkflow:e}=this.viewModel;e&&("create-features"===e.type||"update"===e.type&&"create-features"===e.activeWorkflow?.type?(this._attachments.addFile(),e.back()):this._attachments.addAttachment().then(()=>e.back()))},this._onAttachmentUpdate=()=>{const{activeWorkflow:e}=this.viewModel;e&&("create-features"===e.type?(this._attachments.updateFile(),e.back()):this._attachments.updateAttachment().then(()=>e.back()))},this._onAttachmentDelete=()=>{const{messages:e,messagesCommon:t}=this;this._showPrompt({title:e.deleteAttachmentWarningTitle,message:e.deleteAttachmentWarningMessage,context:"danger",actions:{primary:{label:t.delete,action:this._onAttachmentDeleteConfirm},secondary:{label:e.keepAttachment,action:this._clearPrompt}}})},this._onAttachmentDeleteConfirm=async()=>{const e=this._attachments,{activeWorkflow:t}=this.viewModel;t&&("create-features"===t.type?e.deleteFile():(await e.deleteAttachment(e.viewModel.activeAttachmentInfo),this._clearPrompt()),await t.back(),this._clearPrompt())},this._onAttachmentsError=e=>{this._showPrompt({title:this.messages.errorWarningTitle,message:e.message,context:"warning",actions:{primary:{label:this.messagesCommon.form.ok,action:this._clearPrompt}}})}}initialize(){this._featureForm.showPrompt=this._showPrompt,this._featureForm.clearPrompt=this._clearPrompt,this.addHandles([l(()=>se(this.headingLevel),e=>{this._featureForm.headingLevel=e,this._featureTemplates.headingLevel=e},h),c(()=>this.viewModel.activeWorkflow,"cancel-request",({controller:e})=>{(this.viewModel.hasPendingEdits?this._showDiscardEditsPrompt():this._showGenericCancelPrompt()).then(t=>t?e.allow():e.deny())}),d(()=>this.viewModel.formViewModel,e=>{W(e)?this._batchAttributeForm.viewModel=e:this._featureForm.viewModel=e},h),d(()=>this.viewModel.utilityNetworkAssociationAddAssociationViewModel,e=>{this._associationItemList?this._associationItemList.viewModel=e:this._updatingHandles.addPromise(this._initializeAssociationItemList(e))},h),d(()=>this.viewModel.utilityNetworkAssociationAddAssociationViewModel?.association,()=>{this._setUpAssociationSettings()}),l(()=>[this.viewModel,this.viewModel?.attachmentsViewModel,this.viewModel?.featureTemplatesViewModel,this.viewModel?.spinnerViewModel,this.viewModel?.selectionListViewModel,this.viewModel?.selectionToolbarViewModel],([e,t,i,s,o,r])=>{this._attachments.viewModel=t,this._featureTemplates.viewModel=i,this._spinner.viewModel=s,this._selectionList.viewModel=o,this._selectionToolbar.viewModel=r,e.showDiscardEditsPrompt=this._showDiscardEditsPrompt},h),l(()=>this.view,(e,t)=>{const i=`editor-${this.id}-spinner`;t?.ui.remove(this._spinner,i),e?.ui.add(this._spinner,{key:i,position:"manual"}),this._associationItemList&&(this._associationItemList.view=e)},h),l(()=>[this.supportingWidgetDefaults,this.viewModel.sketchViewModel],([e])=>{e&&(this._featureForm.set(e.featureForm),this._attachments.set(e.attachments),this._featureTemplates.set(e.featureTemplates),this.viewModel.sketchViewModel?.set(e.sketch))},h),d(()=>this._attachments?.error,e=>this._onAttachmentsError(e)),d(()=>this._selectionListItemActionConfigs,()=>{this._selectionList.itemActionConfigs=this._selectionListItemActionConfigs}),d(()=>this.viewModel?.failures,e=>{const{messages:i}=this,[{error:s,retry:o,cancel:r}]=e;this._showPrompt({title:i.errorWarningTitle,message:t(i.errorWarningMessageTemplate,{errorMessage:s.message}),context:"warning",actions:{primary:{label:i.retry,action:()=>{o(),this._clearPrompt()}},secondary:{label:i.ignore,action:()=>{r(),this._clearPrompt()}}}})}),l(()=>this.viewModel?.state,e=>{switch(e){case"awaiting-feature-to-update":case"ready":case"disabled":this._filterText="",this._featureTemplates.filterText=""}}),l(()=>this.viewModel.featureFormDisabled,e=>this._featureForm.disabled=e),l(()=>this.visibleElements.sketch,()=>this._setupSketch(),h),ae({getLoading:()=>{const{viewModel:e}=this;return e.syncing||e.updating||this._attachments.submitting||this._updatingHandles.updating},setEffectiveLoading:e=>{this._loading=e}})])}destroy(){this._associationItemList?.destroy(),this._associationSettings?.destroy(),this._selectionList.destroy(),this._selectionToolbar.destroy(),this._attachments.destroy(),this._batchAttributeForm.destroy(),this._featureForm.destroy(),this._featureTemplates.destroy(),this._spinner.destroy(),this._sketchToolbar=o(this._sketchToolbar),this._sketchImportAbortController=r(this._sketchImportAbortController)}loadDependencies(){return Promise.all([te({flow:()=>import("@esri/calcite-components/dist/components/calcite-flow"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),list:()=>import("@esri/calcite-components/dist/components/calcite-list")}),P(),j(),V(),x(),O(),z(),q(),Z(),J()])}get _hasInvalidBatchSelection(){return this._hasSelectionFromMultipleLayers||this._selectionCountExceedsMaximum||0===this._selectionList.visibleFeatureCount}get _hasSelectionFromMultipleLayers(){return this._selectionList.visibleLayerCount>1}get _deleteButtonCommonInfo(){return{appearance:"outline",kind:"danger"}}get _selectionCountExceedsMaximum(){const e=this._batchAttributeForm.maximumFeatureCount,{activeLayerItem:t,effectiveCount:i,filterText:s,visibleFeatureCount:o}=this._selectionList;return null!=s&&""!==s?o>e:t?t.total>e:i>e}get _selectionListItemActionConfigs(){const{messages:e}=this;return[{label:e?.batchEditing?.editThisFeature,icon:"edit-attributes",type:"feature",callback:({item:e})=>this._onSelectionListMenuItemSelect(e,"update")},{label:e?.batchEditing.editTheseFeatures,icon:"edit-attributes",type:"layer",callback:({item:e})=>this._onSelectionListMenuItemSelect(e,"update")},{label:e?.batchEditing.mergeTheseFeatures,icon:"merge",type:"layer",callback:({item:e})=>this._onSelectionListMenuItemSelect(e,"merge")}]}get _visibleSelectionCount(){const{activeLayerItem:e,effectiveCount:t,filterText:i,visibleFeatureCount:s}=this._selectionList;return null!=i&&""!==i?s:e?e.total:t}get activeWorkflow(){return this.viewModel.activeWorkflow}get effectiveSelectionManager(){return this.viewModel.effectiveSelectionManager}get hideTemplatesForInactiveLayers(){return this.viewModel.hideTemplatesForInactiveLayers}set hideTemplatesForInactiveLayers(e){this.viewModel.hideTemplatesForInactiveLayers=e}get icon(){return"pencil"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get labelOptions(){return this.viewModel.labelOptions}set labelOptions(e){this.viewModel.labelOptions=e}get layerInfos(){return this.viewModel.layerInfos}set layerInfos(e){this.viewModel.layerInfos=e}get snappingOptions(){return this.viewModel.snappingOptions}set snappingOptions(e){this.viewModel.snappingOptions=e}get tooltipOptions(){return this.viewModel.tooltipOptions}set tooltipOptions(e){this.viewModel.tooltipOptions=e}get valueOptions(){return this.viewModel.valueOptions}set valueOptions(e){this.viewModel.valueOptions=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}startCreateFeaturesWorkflowAtFeatureTypeSelection(){return this.viewModel.startCreateFeaturesWorkflowAtFeatureTypeSelection()}startCreateFeaturesWorkflowAtFeatureCreation(e){return this.viewModel.startCreateFeaturesWorkflowAtFeatureCreation(e)}startCreateFeaturesWorkflowAtFeatureEdit(e){return this.viewModel.startCreateFeaturesWorkflowAtFeatureEdit(e)}startMergeFeaturesWorkflow(e,t={}){return this.viewModel.startMergeFeaturesWorkflow(e,t)}startSplitFeatureWorkflow(e,t={}){return this.viewModel.startSplitFeatureWorkflow(e,t)}async startUpdateFeaturesWorkflow(e){return this.viewModel.startUpdateFeaturesWorkflow(e)}startUpdateWorkflowAtFeatureSelection(){return this.viewModel.startUpdateWorkflowAtFeatureSelection()}startUpdateWorkflowAtMultipleFeatureSelection(e){return this.viewModel.startUpdateWorkflowAtMultipleFeatureSelection(e)}startUpdateWorkflowAtFeatureEdit(e){return this.viewModel.startUpdateWorkflowAtFeatureEdit(e)}startUpdateWorkflowWithActiveSelection(){return this.viewModel.startUpdateWorkflowWithActiveSelection()}deleteFeatureFromWorkflow(){return i(s.getLogger(this),"Editor.deleteFeatureFromWorkflow is deprecated. Use Editor.deleteFeatures instead.",{version:"4.33",replacement:"Editor.deleteFeatures",warnOnce:!0}),this.deleteFeatures()}async deleteFeatures(){await this.viewModel.deleteFeatures()}deleteAssociationFromWorkflow(){return this.viewModel.deleteAssociationFromWorkflow()}cancelWorkflow(e){return this.viewModel.cancelWorkflow(e)}render(){const{visibleElements:e,viewModel:t}=this,i=this.classes(F.base,ie.widget,ie.panel);if(!t)return he("div",{class:i,key:"empty"});const{pageStack:s}=t,o=s.length-1,r=s.map((e,t)=>this._renderPage(e,t===o));return he("div",{class:i,key:"base"},e.flow?he("calcite-flow",{inert:!!this._prompt,key:"flow"},r):r,this._prompt?he(K,{...this._prompt,headingLevel:this.headingLevel}):void 0)}_renderPage(e,t){const i={selected:t};switch(e){case"disabled":break;case"ready":return this._renderReady(i);case"viewing-selection-list":return this._renderSelectionListPage(i);case"awaiting-feature-creation-info":return this._renderAwaitingFeatureCreationInfo(i);case"creating-features-upload-details":return this._renderUploadDetails(i);case"creating-features":return this._renderCreatingFeatures(i);case"editing-existing-feature":case"editing-features":case"editing-attributes":case"choosing-key-feature":return this._renderUpdateFeature(i);case"awaiting-update-feature-candidate":return this._renderFeatureList(i);case"adding-attachment":return this._renderAttachmentAdding(i);case"editing-attachment":return this._renderAttachmentEditing(i);case"viewing-associated-layers":case"viewing-associated-features":return this._renderViewAssociatedLayers(i);case"add-association-select-layer":case"add-association-select-feature":return this._renderSelectFeature(i);case"add-association-create-association":return this._renderAddAssociation(i);case"drawing-splitter-geometry":return this._renderDrawingSplitGeometry(i);case"reviewing-features":return this._renderReviewingSplitFeatures(i)}return he("div",{key:"empty-page"})}_renderAwaitingFeatureCreationInfo(e){const{EditorPanel:t,messages:i}=this;return he(t,{heading:i.selectTemplate,key:"templates-panel",...e},he(N,{key:"feature-templates"},he(H,null,this._renderFeatureTemplates())))}_renderUploadDetails(e){const{EditorPanel:t,activeWorkflow:i,messages:s}=this;if("create-features"!==i?.type)return null;const o=i.data.upload;return o?he(t,{heading:s.createFeatures,key:"upload-details-panel",...e},he(Q,{helpMessage:this._helpMessage,messages:s,upload:o})):null}_renderCreatingFeatures(e){const{EditorPanel:t,activeWorkflow:i,messages:s,messagesCommon:o,headingLevel:r,viewModel:a}=this;if(!i)return null;const n="create-features"===i.type&&i.numPendingFeatures>0||"update"===i.type&&"create-features"===i?.activeWorkflow?.type&&i.activeWorkflow?.numPendingFeatures>0;return he(t,{heading:s.createFeatures,key:"create-features-panel",...e},n?he($,{editorViewModel:a,headingLevel:r,messages:s,messagesCommon:o,renderAttachments:this._renderAttachments,renderBatchAttributeForm:this._renderBatchAttributeForm,renderFeatureForm:this._renderFeatureForm,renderSketchToolbar:this._renderSketch,visibleElements:this.visibleElements,onDelete:this._onDelete,onDeleteAssociation:this._onDeleteAssociation,onSave:this._onSave}):he(I,{helpMessage:this._helpMessage,renderSketchToolbar:this._renderSketch}))}_renderUpdateFeature(e){const{EditorPanel:t,messages:i,messagesCommon:s,headingLevel:o,viewModel:r}=this,a=r.activeFeatureCount>1?i.multiFeature.editPanelTitle:i.singleFeature.editPanelTitle;return he(t,{heading:a,key:"update-feature-panel",...e},he($,{editorViewModel:r,headingLevel:o,messages:i,messagesCommon:s,renderAttachments:this._renderAttachments,renderBatchAttributeForm:this._renderBatchAttributeForm,renderFeatureForm:this._renderFeatureForm,visibleElements:this.visibleElements,onDelete:this._onDelete,onDeleteAssociation:this._onDeleteAssociation,onMerge:this._onMerge,onSave:this._onSave,onSplit:this._onSplit}))}_renderDrawingSplitGeometry(e){const{EditorPanel:t}=this;return he(t,{heading:this.messages.splitFeature,key:"draw-split-geometry-panel",...e},he(I,{helpMessage:this._helpMessage,noticeMessage:this._noticeMessage,renderSketchToolbar:this._renderSketch}))}_renderReviewingSplitFeatures(e){const{EditorPanel:t,messages:i,messagesCommon:s,headingLevel:o,viewModel:r}=this;return he(t,{heading:i.splitFeature,key:"review-split-features-panel",...e},he($,{editorViewModel:r,headingLevel:o,messages:i,messagesCommon:s,renderAttachments:this._renderAttachments,renderBatchAttributeForm:this._renderBatchAttributeForm,renderFeatureForm:this._renderFeatureForm,visibleElements:this.visibleElements,onSave:this._onSave}))}_getAssociationTypeTitle(e){const{messages:t}=this;if(!e)return t.singleFeature.editPanelTitle;if(e.title)return e.title;const{messagesFeature:i}=this;switch(e.type){case"attachment":return i.associationsAttachments;case"connectivity":return i.associationsConnectivity;case"structure":return i.associationsStructure;case"content":return i.associationsContents;case"container":return i.associationsContainer}}_getAddAssociationTypeTitle(e){const{messages:t}=this;if(!e)return t.singleFeature.editPanelTitle;const i=t.associations;switch(e.type){case"attachment":return i.addAttachment;case"connectivity":return i.addConnectivity;case"structure":return i.addStructure;case"content":return i.addContent;case"container":return i.addContainer}}async _initializeAssociationItemList(e){const t=(await import("./FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationItemList.js")).default;this._associationItemList=new t({view:this.view,viewModel:e})}async _initializeAssociationSettings(){const e=new(0,(await import("./FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationSettings.js")).default);return this._associationSettings=e,e}_renderViewAssociatedLayers(e){const{EditorPanel:t,messages:i,messagesCommon:s,headingLevel:o,viewModel:r}=this,a=r.featureFormViewModel?.activeAssociationInput?.activeAssociationType,n=this._getAssociationTypeTitle(a);return he(t,{heading:n,key:"viewing-associated-layers-panel",...e},he($,{editorViewModel:r,headingLevel:o,messages:i,messagesCommon:s,renderAttachments:this._renderAttachments,renderBatchAttributeForm:this._renderBatchAttributeForm,renderFeatureForm:this._renderFeatureForm,renderSketchToolbar:this._renderSketch,visibleElements:this.visibleElements,onDelete:this._onDelete,onDeleteAssociation:this._onDeleteAssociation,onSave:this._onSave}))}_renderSelectFeature(e){const{_associationItemList:t,EditorPanel:i,viewModel:s,messagesCommon:o}=this,r=s.utilityNetworkAssociationAddAssociationViewModel,a=this._getAddAssociationTypeTitle(r?.associationType),n="ready"!==r?.state||this.viewModel.featureFormDisabled;return t?he(i,{heading:a,key:"add-association-select-feature",...e},he(N,{key:"select-feature"},he(H,null,t.render())),he(D,{buttons:[t.filterOptionsVisible?{appearance:"solid",label:o.apply,disabled:n,onClick:()=>t.applyFilterOptions(),type:"button"}:void 0,{appearance:"outline",label:o.cancel,disabled:n,onClick:()=>{"update"===s.activeWorkflow?.type&&(r?.reset(),s.activeWorkflow.cancelActiveWorkflow())},type:"button"}]})):he(i,{heading:a,key:"add-association-select-feature",...e})}async _setUpAssociationSettings(){const{viewModel:e}=this,t=this._associationSettings??await this._updatingHandles.addPromise(this._initializeAssociationSettings()),i=e.utilityNetworkAssociationAddAssociationViewModel,s="update"===e.activeWorkflow?.type?e.activeWorkflow:null,o=s?s.activeWorkflow:null,r="add-association"===o?.type?o.sourceFeatureItem:null,a=i?.selectedFeature,n=i?.association,l=i?.utilityNetwork;r&&a&&n&&l&&(t.sourceFeature=r,t.targetFeature=a,t.association=n,t.utilityNetwork=l)}_renderAddAssociation(e){const{_associationSettings:t,EditorPanel:i,viewModel:s,messagesCommon:o}=this;if(!t)return null;const r=s.utilityNetworkAssociationAddAssociationViewModel,a=this._getAddAssociationTypeTitle(r?.associationType),n="ready"!==r?.state;return he(i,{heading:a,key:"add-association",...e},he(N,{key:"add-association-content"},he(H,null,t.render())),he(D,{buttons:[{label:o.add,disabled:n||!r.canAddAssociation,onClick:()=>this._onSave(),type:"button"},{appearance:"outline",label:o.cancel,disabled:n,onClick:()=>{"update"===s.activeWorkflow?.type&&s.activeWorkflow.cancelActiveWorkflow()},type:"button"}]}))}_renderCustomTemplateGroupContent(e){const{messages:t,viewModel:i}=this,s=a(e.group.items,e=>i.itemHasInvalidFormTemplate(e)?t.formFieldCreateError:void 0);return s?he(B,{kind:"warning",message:s}):null}_renderAttachmentAdding(e){const{EditorPanel:t,_attachments:i,messages:s,messagesCommon:o}=this;return he(t,{heading:s.addAttachment,key:"attachment-adding-panel",...e},he(N,{key:"attachments"},this._renderAttachments()),he(D,{buttons:[{label:i.submitting?o.cancel:o.add,disabled:i.submitting||!i.selectedFile,onClick:this._onAttachmentAdd,type:"button"}]}))}_renderSelectionListPage(e){const{_hasSelectionFromMultipleLayers:i,_hasInvalidBatchSelection:s,_selectionCountExceedsMaximum:o,_selectionList:r,_visibleSelectionCount:a,messages:n,EditorPanel:l}=this,{batchUpdateActions:c}=this.visibleElements,{maxVisibleFeatureCountPerLayer:d}=r;return he(l,{heading:n.widgetLabel,key:"selection-list-panel",...e},this.visibleElements.selectionToolbar&&"3d"!==this.view?.type?he("div",{class:F.selectionToolbarContainer},this._renderSelectionToolbar()):void 0,he(N,{key:"selection-list"},he(H,null,this._renderSelectionList())),he(D,{buttons:[c?{label:t(n.batchEditing.editCount,{count:a}),disabled:s,onClick:()=>this.startUpdateWorkflowWithActiveSelection(),type:"button"}:void 0],notice:c&&i?{text:n.batchEditing.selectOneLayer,icon:"information"}:c&&o?{text:t(this.messages.multiFeature.formFailedToLoadTooManyFeatures,{num:d}),icon:"information"}:void 0}))}_renderAttachmentEditing(e){const{EditorPanel:t,_attachments:i,activeWorkflow:s,messages:o,messagesCommon:r}=this;return s?he(t,{heading:o.editAttachment,key:"attachment-editing-panel",...e},he(N,{key:"attachments"},this._renderAttachments()),s.shouldAllowAttachmentEditing?he(D,{buttons:[{label:r.update,disabled:i.submitting||!i.selectedFile,onClick:this._onAttachmentUpdate,type:"button"},{...this._deleteButtonCommonInfo,onClick:this._onAttachmentDelete,disabled:i.submitting,label:r.delete,type:"button"}]}):void 0):null}_renderReady(e){const{EditorPanel:t,messages:i,viewModel:s,visibleElements:o}=this,r=this._helpMessage;return he(t,{heading:i.widgetLabel,key:"landing-panel",...e},he(N,{key:"landing-content"},s.editorItems.length?[o.editFeaturesSection?he(H,{key:"edit-actions"},this._renderUpdateActions()):null,o.createFeaturesSection&&s.canCreateVisible?he(H,{key:"create-actions"},this._renderCreateActions()):null]:he(G,{key:"no-content"},i.noEditableLayers)),r?he("div",{class:F.helpMessage,key:"footer-actions",slot:"footer"},r):void 0)}get _helpMessage(){return this.getHelpMessageString(this.activeWorkflow?.helpMessage)}get _noticeMessage(){return this.getHelpMessageString(this.activeWorkflow?.noticeMessage)}_renderUpdateActions(){const{messages:e,messagesCommon:t,viewModel:i}=this,s={id:"select",label:t.select};return he("div",{class:F.updateActions,key:"update-actions"},he(oe,{level:se(this.headingLevel)},e.editFeatures),this.visibleElements.selectionToolbar&&"3d"!==this.view?.type?he("div",{class:F.selectionToolbarContainer},this._renderSelectionToolbar()):he("calcite-list",{class:F.updateActionsList,label:e.editFeaturesList,selectionAppearance:"border",selectionMode:"single"},re({disabled:!i.canUpdateVisible,grouped:!1,item:s,selectedItem:"awaiting-feature-to-update"===i.activeWorkflow?.stepId?s:void 0,renderIcon:this._renderSelectIcon,onItemSelect:this._onToggleUpdateWorkflow})))}_renderCreateActions(){return he("div",{key:"create-actions"},he(oe,{level:se(this.headingLevel)},this.messages.createFeatures),he("div",{class:F.featureTemplatesContainer,key:"templates"},this._renderFeatureTemplates()))}_renderFeatureList(e){const{EditorPanel:i,viewModel:s}=this,{activeWorkflow:o}=s;if("update"!==o?.type)return null;const r=o.data.candidates,a=t(this.messages.multipleFeaturesTemplate,{total:r.length});return he(i,{heading:a,key:"feature-list",...e},he(U,{editorItems:s.editorItems,editorMessages:this.messages,filterText:this._filterText,id:this.id,messagesTemplates:this.messagesTemplates,workflow:o,onFilterTextChange:e=>this._filterText=e,onSelectFeature:(e,t)=>s.selectFeature(e,t),onZoomTo:e=>s.zoomTo(e)}))}_showPromptAndWait({title:e,message:t,yesLabel:i,noLabel:s}){const o=n(),{view:r}=this,a=r?.focused;return this._showPrompt({title:e,message:t,context:"danger",actions:{primary:{label:i,action:()=>o.resolve(!0)},secondary:{label:s,action:()=>o.resolve(!1)}}}),o.promise.finally(()=>{this._clearPrompt(),a&&r?.focus()})}async _onSelectionListItemSelect(e){await this.viewModel.onSelectionListItemSelect(e)}async _onSelectionListMenuItemSelect(e,t){await this.viewModel.onSelectionListMenuItemSelect(e,t)}async _setupSketch(){if(!!!this.visibleElements.sketch)return this._sketchImportAbortController=r(this._sketchImportAbortController),this._sketchToolbar=o(this._sketchToolbar),void this.removeHandles(ue);if(this._sketchImportAbortController)return;const e=new AbortController;this._sketchImportAbortController=e;const t=await import("./Sketch.js");if(!e.signal.aborted)try{this._sketchToolbar=new t.default({toolbarKind:"docked",contextualToolLocation:"inline-end",scale:"s",visibleElements:new ee({deleteButton:!1,settingsMenu:!1,directionModePicker:!1,selectionCountLabel:!1,duplicateButton:!1,createTools:new X({freehandPolygon:!0,freehandPolyline:!0}),selectionTools:new Y({"lasso-selection":!1,"rectangle-selection":!1})})}),this.addHandles([l(()=>{const e=this.viewModel.activeLeafWorkflow;return e&&"availableCreateTools"in e?e.availableCreateTools:null},e=>{this._sketchToolbar&&(this._sketchToolbar.availableCreateTools=e)},h),l(()=>this.visibleElements.undoRedoButtons,e=>{this._sketchToolbar&&(this._sketchToolbar.visibleElements.undoRedoMenu=e)},h),d(()=>this.viewModel?.sketchViewModel,e=>{this._sketchToolbar&&(this._sketchToolbar.viewModel=e)},h)],ue)}finally{this._sketchImportAbortController=null}}getHelpMessageString(e){const{messages:t,view:i}=this;return e?t["3d"===i?.type?"helpMessages3d":"helpMessages2d"]?.[e]:void 0}get test(){return{sketch:this._sketchToolbar,showPrompt:this._showPromptAndWait.bind(this)}}};e([m()],ge.prototype,"_batchAttributeForm",void 0),e([m()],ge.prototype,"_featureForm",void 0),e([m()],ge.prototype,"_sketchToolbar",void 0),e([m()],ge.prototype,"_attachments",void 0),e([m()],ge.prototype,"_associationItemList",void 0),e([m()],ge.prototype,"_associationSettings",void 0),e([m()],ge.prototype,"_featureTemplates",void 0),e([m()],ge.prototype,"_filterText",void 0),e([m()],ge.prototype,"_hasInvalidBatchSelection",null),e([m()],ge.prototype,"_hasSelectionFromMultipleLayers",null),e([m()],ge.prototype,"_prompt",void 0),e([m()],ge.prototype,"_spinner",void 0),e([m()],ge.prototype,"_deleteButtonCommonInfo",null),e([m()],ge.prototype,"_loading",void 0),e([m()],ge.prototype,"_selectionCountExceedsMaximum",null),e([m()],ge.prototype,"_selectionList",void 0),e([m()],ge.prototype,"_selectionListItemActionConfigs",null),e([m()],ge.prototype,"_selectionToolbar",void 0),e([m()],ge.prototype,"_visibleSelectionCount",null),e([m({readOnly:!0})],ge.prototype,"activeWorkflow",null),e([m()],ge.prototype,"effectiveSelectionManager",null),e([m()],ge.prototype,"headingLevel",void 0),e([m()],ge.prototype,"hideTemplatesForInactiveLayers",null),e([m()],ge.prototype,"icon",null),e([m()],ge.prototype,"label",null),e([m()],ge.prototype,"labelOptions",null),e([m()],ge.prototype,"layerInfos",null),e([m(),ce("esri/widgets/Editor/t9n/Editor")],ge.prototype,"messages",void 0),e([m(),ce("esri/t9n/common")],ge.prototype,"messagesCommon",void 0),e([m(),ce("esri/widgets/FeatureTemplates/t9n/FeatureTemplates")],ge.prototype,"messagesTemplates",void 0),e([m(),ce("esri/widgets/Feature/t9n/Feature")],ge.prototype,"messagesFeature",void 0),e([m()],ge.prototype,"snappingOptions",null),e([m()],ge.prototype,"tooltipOptions",null),e([m()],ge.prototype,"supportingWidgetDefaults",void 0),e([m({type:g,nonNullable:!0})],ge.prototype,"valueOptions",null),e([m()],ge.prototype,"view",null),e([m(),de(["sketch-create","sketch-delete","sketch-update","workflow-cancel","workflow-commit"])],ge.prototype,"viewModel",void 0),e([m({type:T,nonNullable:!0})],ge.prototype,"visibleElements",void 0),e([m()],ge.prototype,"_helpMessage",null),e([m()],ge.prototype,"_noticeMessage",null),ge=e([p("esri.widgets.Editor")],ge);const we=ge;export{we as default};
|
|
5
|
+
import{__decorate as e}from"tslib";import{substitute as t}from"../intl.js";import{deprecatedFunction as i}from"../core/deprecate.js";import s from"../core/Logger.js";import{destroyMaybe as o,abortMaybe as r,mappedFind as a}from"../core/maybe.js";import{createResolver as n}from"../core/promiseUtils.js";import{watch as l,on as c,when as d,initial as h}from"../core/reactiveUtils.js";import{property as m}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as p}from"../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as u}from"../core/support/UpdatingHandles.js";import g from"../views/interactive/sketch/SketchValueOptions.js";import w from"./Attachments.js";import _ from"./BatchAttributeForm.js";import v from"./FeatureForm.js";import f from"./FeatureTemplates.js";import b from"./Spinner.js";import y from"./Widget.js";import{VisibleElements as k}from"./BatchAttributeForm/VisibleElements.js";import{css as F}from"./Editor/css.js";import M from"./Editor/EditorViewModel.js";import{isModelUpload as A}from"./Editor/modelUploadUtils.js";import T from"./Editor/VisibleElements.js";import{isFeatureFormViewModel as S,isUpdateWorkflow as C,isUpdateFeaturesWorkflow as L,isUpdateFeatureWorkflow as E,isBatchAttributeFormViewModel as W,findEditorItemForLayer as P}from"./Editor/workflowUtils.js";import{loadCreateFeaturesPanelContentComponents as I,CreateFeaturesPanelContent as j}from"./Editor/components/CreateFeaturesPanelContent.js";import{loadFeatureListComponents as U,FeatureList as V}from"./Editor/components/FeatureList.js";import{loadFooterActionsComponents as D,FooterActions as x}from"./Editor/components/FooterActions.js";import{loadNoticesComponents as B,Notice as O}from"./Editor/components/Notices.js";import{loadPanelContentComponents as N,PanelContent as H,PanelContentSection as G,PanelContentMessage as R}from"./Editor/components/PanelContent.js";import{PanelToolbar as z,loadPanelToolbarComponents as q}from"./Editor/components/PanelToolbar.js";import{loadPromptComponents as K,Prompt as Z}from"./Editor/components/Prompt.js";import{loadUpdateFeaturePanelContentComponents as $,UpdateFeaturePanelContent as J}from"./Editor/components/UpdateFeaturePanelContent.js";import{loadUploadDetailsComponents as Q,UploadDetails as X}from"./Editor/components/UploadDetails.js";import{CreateToolVisibilityMap as Y}from"./Sketch/CreateToolVisibilityMap.js";import{SelectionToolVisibilityMap as ee}from"./Sketch/SelectionToolVisibilityMap.js";import{VisibleElements as te}from"./Sketch/VisibleElements.js";import{loadCalciteComponents as ie}from"./support/componentsUtils.js";import{globalCss as se}from"./support/globalCss.js";import{incrementHeadingLevel as oe,Heading as re}from"./support/Heading.js";import{renderItem as ae}from"./support/ItemList.js";import{connectDelayedLoading as ne}from"./support/loaderUtils.js";import le from"./support/SelectionList.js";import ce from"./support/SelectionToolbar.js";import{messageBundle as de,vmEvent as he,tsx as me}from"./support/widget.js";import{isLayerItem as pe}from"./support/SelectionList/selectionListUtils.js";import ue from"./support/SelectionList/VisibleElements.js";import ge from"./support/SelectionToolbar/VisibleElements.js";const we=Symbol("sketch-setup-handles");let _e=class extends y{constructor(e,i){super(e,i),this._batchAttributeForm=new _({visibleElements:new k({loadingIndicator:!1})}),this._featureForm=new v,this._sketchToolbar=null,this._attachments=new w({visibleElements:{addSubmitButton:!1,cancelAddButton:!1,cancelUpdateButton:!1,deleteButton:!1,errorMessage:!1,progressBar:!1,updateButton:!1}}),this._associationItemList=null,this._associationSettings=null,this._featureTemplates=new f({enableListScroll:!1,renderItemContentEnd:e=>e.supportsUpload?me("calcite-icon",{class:F.templateItemContentEnd,icon:"upload-to",key:"upload-icon"}):null,renderItemLabel:e=>e.label,renderCustomGroupContent:e=>this._renderCustomTemplateGroupContent(e)}),this._filterText="",this._prompt=null,this._spinner=new b,this._loading=!1,this._selectionList=new le({displayMode:"layer",itemActionConfigs:this._selectionListItemActionConfigs,onListItemSelect:({item:e})=>this._onSelectionListItemSelect(e),visibleElements:new ue({header:!1})}),this._selectionToolbar=new ce({visibleElements:new ge({chip:!1})}),this._updatingHandles=new u,this.headingLevel=4,this.messages=null,this.messagesCommon=null,this.messagesTemplates=null,this.messagesFeature=null,this.supportingWidgetDefaults=null,this.viewModel=new M,this.visibleElements=new T,this._renderAttachments=()=>this._attachments.render(),this._renderFeatureForm=()=>this._featureForm.render(),this._renderBatchAttributeForm=()=>this._batchAttributeForm.render(),this._renderFeatureTemplates=()=>this._featureTemplates.render(),this._renderSelectionList=()=>this._selectionList.render(),this._renderSelectionToolbar=()=>this._selectionToolbar.render(),this._renderSketch=()=>this._sketchToolbar?me("div",{class:F.sketchContainer,key:"editor-sketch-container"},this._sketchToolbar?.render()):void 0,this._renderSelectIcon=()=>me("calcite-icon",{icon:"cursor",slot:"content-start"}),this.EditorPanel=({heading:e,key:t,selected:i},...s)=>{const{visibleElements:o}=this;return me("calcite-flow-item",{closable:!1,heading:e,headingLevel:this.headingLevel,key:t,loading:this._loading,selected:i,onCalciteFlowItemBack:this._onBack},o.settingsMenu?me(z,{editorViewModel:this.viewModel,messagesCommon:this.messagesCommon,visibleElements:o}):null,...s)},this._showDiscardEditsPrompt=()=>{const{messages:e,activeWorkflow:t}=this,i={title:e.cancelEditTitle,message:e.cancelEditWarningMessage,yesLabel:e.discardEdits,noLabel:e.continueEditing};return"create-features"===t?.type&&A(t.data.creationInfo)?this._showPromptAndWait("success"===t.data.upload?.state?e.modelUploads.cancelPlacementPrompt:e.modelUploads.cancelUploadPrompt):"update"===t?.type&&S(t.formViewModel)&&t.formViewModel.activeAssociation?this._showPromptAndWait({...i,message:e.cancelAssociationEditWarning}):this._showPromptAndWait(i)},this._showGenericCancelPrompt=()=>{const{messages:e,messagesCommon:t}=this;return this._showPromptAndWait({title:e.cancelRequestTitle,message:e.cancelRequestWarningMessage,yesLabel:t.form.yes,noLabel:t.form.no})},this._showPrompt=e=>{this._prompt?.cancel?.(),this._prompt=e},this._clearPrompt=()=>{this._prompt=null},this._onSave=()=>{this.viewModel.saveWorkflow()},this._onMerge=()=>{const{activeWorkflow:e}=this.viewModel;if(C(e)){const t=e.activeWorkflow;L(t)&&e.startMergingFeatures(t.viewGraphics)}},this._onSplit=()=>{const{activeWorkflow:e}=this.viewModel;if(C(e)){const t=e.activeWorkflow;if(E(t)){const i=t.viewGraphic;i&&e.startSplittingFeature(i)}}},this._onDelete=()=>{const e=this.viewModel.activeFeatureCount,i=e>1?this.messages.multiFeature:this.messages.singleFeature;this._showPrompt({title:i.deleteWarningTitle,message:i.deleteWarningMessage,context:"danger",actions:{primary:{label:t(i.delete,{count:e}),action:()=>{this.deleteFeatures(),this._clearPrompt()}},secondary:{label:i.keep,action:this._clearPrompt}}})},this._onDeleteAssociation=()=>{const{messages:e,messagesCommon:t}=this;this._showPrompt({title:e.deleteAssociationTitle,message:e.deleteAssociationMessage,context:"danger",actions:{primary:{label:t.delete,action:()=>{this.deleteAssociationFromWorkflow(),this._clearPrompt()}},secondary:{label:e.keepAssociation,action:this._clearPrompt}}})},this._onToggleUpdateWorkflow=()=>this.viewModel.toggleUpdateWorkflow(),this._onBack=e=>(e?.stopPropagation(),this.viewModel.back()),this._onAttachmentAdd=()=>{const{activeWorkflow:e}=this.viewModel;e&&("create-features"===e.type||"update"===e.type&&"create-features"===e.activeWorkflow?.type?(this._attachments.addFile(),e.back()):this._attachments.addAttachment().then(()=>e.back()))},this._onAttachmentUpdate=()=>{const{activeWorkflow:e}=this.viewModel;e&&("create-features"===e.type?(this._attachments.updateFile(),e.back()):this._attachments.updateAttachment().then(()=>e.back()))},this._onAttachmentDelete=()=>{const{messages:e,messagesCommon:t}=this;this._showPrompt({title:e.deleteAttachmentWarningTitle,message:e.deleteAttachmentWarningMessage,context:"danger",actions:{primary:{label:t.delete,action:this._onAttachmentDeleteConfirm},secondary:{label:e.keepAttachment,action:this._clearPrompt}}})},this._onAttachmentDeleteConfirm=async()=>{const e=this._attachments,{activeWorkflow:t}=this.viewModel;t&&("create-features"===t.type?e.deleteFile():(await e.deleteAttachment(e.viewModel.activeAttachmentInfo),this._clearPrompt()),await t.back(),this._clearPrompt())},this._onAttachmentsError=e=>{this._showPrompt({title:this.messages.errorWarningTitle,message:e.message,context:"warning",actions:{primary:{label:this.messagesCommon.form.ok,action:this._clearPrompt}}})}}initialize(){this._featureForm.showPrompt=this._showPrompt,this._featureForm.clearPrompt=this._clearPrompt,this.addHandles([l(()=>oe(this.headingLevel),e=>{this._featureForm.headingLevel=e,this._featureTemplates.headingLevel=e},h),c(()=>this.viewModel.activeWorkflow,"cancel-request",({controller:e})=>{(this.viewModel.hasPendingEdits?this._showDiscardEditsPrompt():this._showGenericCancelPrompt()).then(t=>t?e.allow():e.deny())}),d(()=>this.viewModel.formViewModel,e=>{W(e)?this._batchAttributeForm.viewModel=e:this._featureForm.viewModel=e},h),d(()=>this.viewModel.utilityNetworkAssociationAddAssociationViewModel,e=>{this._associationItemList?this._associationItemList.viewModel=e:this._updatingHandles.addPromise(this._initializeAssociationItemList(e))},h),d(()=>this.viewModel.utilityNetworkAssociationAddAssociationViewModel?.association,()=>{this._setUpAssociationSettings()}),l(()=>[this.viewModel,this.viewModel?.attachmentsViewModel,this.viewModel?.featureTemplatesViewModel,this.viewModel?.spinnerViewModel,this.viewModel?.selectionListViewModel,this.viewModel?.selectionToolbarViewModel],([e,t,i,s,o,r])=>{this._attachments.viewModel=t,this._featureTemplates.viewModel=i,this._spinner.viewModel=s,this._selectionList.viewModel=o,this._selectionToolbar.viewModel=r,e.showDiscardEditsPrompt=this._showDiscardEditsPrompt},h),l(()=>this.view,(e,t)=>{const i=`editor-${this.id}-spinner`;t?.ui.remove(this._spinner,i),e?.ui.add(this._spinner,{key:i,position:"manual"}),this._associationItemList&&(this._associationItemList.view=e)},h),l(()=>[this.supportingWidgetDefaults,this.viewModel.sketchViewModel],([e])=>{e&&(this._featureForm.set(e.featureForm),this._attachments.set(e.attachments),this._featureTemplates.set(e.featureTemplates),this.viewModel.sketchViewModel?.set(e.sketch))},h),d(()=>this._attachments?.error,e=>this._onAttachmentsError(e)),d(()=>this._selectionListItemActionConfigs,()=>{this._selectionList.itemActionConfigs=this._selectionListItemActionConfigs}),d(()=>this.viewModel?.failures,e=>{const{messages:i}=this,[{error:s,retry:o,cancel:r}]=e;this._showPrompt({title:i.errorWarningTitle,message:t(i.errorWarningMessageTemplate,{errorMessage:s.message}),context:"warning",actions:{primary:{label:i.retry,action:()=>{o(),this._clearPrompt()}},secondary:{label:i.ignore,action:()=>{r(),this._clearPrompt()}}}})}),l(()=>this.viewModel?.state,e=>{switch(e){case"awaiting-feature-to-update":case"ready":case"disabled":this._filterText="",this._featureTemplates.filterText=""}}),l(()=>this.viewModel.featureFormDisabled,e=>this._featureForm.disabled=e),l(()=>this.visibleElements.sketch,()=>this._setupSketch(),h),l(()=>this.visibleElements.zoomToButton,e=>this._selectionList.visibleElements.zoomToButton=e,h),ne({getLoading:()=>{const{viewModel:e}=this;return e.syncing||e.updating||this._attachments.submitting||this._updatingHandles.updating},setEffectiveLoading:e=>{this._loading=e}})])}destroy(){this._associationItemList?.destroy(),this._associationSettings?.destroy(),this._selectionList.destroy(),this._selectionToolbar.destroy(),this._attachments.destroy(),this._batchAttributeForm.destroy(),this._featureForm.destroy(),this._featureTemplates.destroy(),this._spinner.destroy(),this._sketchToolbar=o(this._sketchToolbar),this._sketchImportAbortController=r(this._sketchImportAbortController)}loadDependencies(){return Promise.all([ie({flow:()=>import("@esri/calcite-components/dist/components/calcite-flow"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),list:()=>import("@esri/calcite-components/dist/components/calcite-list")}),I(),U(),D(),B(),N(),q(),K(),$(),Q()])}get _hasInvalidBatchSelection(){return this._hasSelectionFromMultipleLayers||this._selectionCountExceedsMaximum||0===this._selectionList.visibleFeatureCount}get _hasSelectionFromMultipleLayers(){return this._selectionList.visibleLayerCount>1}get _deleteButtonCommonInfo(){return{appearance:"outline",kind:"danger"}}get _selectionCountExceedsMaximum(){const e=this._batchAttributeForm.maximumFeatureCount,{activeLayerItem:t,effectiveCount:i,filterText:s,visibleFeatureCount:o}=this._selectionList;return null!=s&&""!==s?o>e:t?t.total>e:i>e}get _selectionListItemActionConfigs(){const{messages:e,visibleElements:t}=this,i=t?.mergeButton??!0;return[{label:e?.batchEditing?.editThisFeature,icon:"edit-attributes",type:"feature",callback:({item:e})=>this._onSelectionListMenuItemSelect(e,"update")},{label:e?.batchEditing.editTheseFeatures,icon:"edit-attributes",type:"layer",callback:({item:e})=>this._onSelectionListMenuItemSelect(e,"update")},{label:e?.batchEditing.mergeTheseFeatures,icon:"merge",type:"layer",hidden:!i||(({item:e})=>{if(!pe(e))return!0;const t=P(this.viewModel.editorItems,e.layer);return!t?.supportsMergeFeaturesWorkflow||e.visibleTotal<2}),callback:({item:e})=>this._onSelectionListMenuItemSelect(e,"merge")}]}get _visibleSelectionCount(){const{activeLayerItem:e,effectiveCount:t,filterText:i,visibleFeatureCount:s}=this._selectionList;return null!=i&&""!==i?s:e?e.total:t}get activeWorkflow(){return this.viewModel.activeWorkflow}get effectiveSelectionManager(){return this.viewModel.effectiveSelectionManager}get hideTemplatesForInactiveLayers(){return this.viewModel.hideTemplatesForInactiveLayers}set hideTemplatesForInactiveLayers(e){this.viewModel.hideTemplatesForInactiveLayers=e}get icon(){return"pencil"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get labelOptions(){return this.viewModel.labelOptions}set labelOptions(e){this.viewModel.labelOptions=e}get layerInfos(){return this.viewModel.layerInfos}set layerInfos(e){this.viewModel.layerInfos=e}get snappingOptions(){return this.viewModel.snappingOptions}set snappingOptions(e){this.viewModel.snappingOptions=e}get tooltipOptions(){return this.viewModel.tooltipOptions}set tooltipOptions(e){this.viewModel.tooltipOptions=e}get valueOptions(){return this.viewModel.valueOptions}set valueOptions(e){this.viewModel.valueOptions=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}startCreateFeaturesWorkflowAtFeatureTypeSelection(){return this.viewModel.startCreateFeaturesWorkflowAtFeatureTypeSelection()}startCreateFeaturesWorkflowAtFeatureCreation(e){return this.viewModel.startCreateFeaturesWorkflowAtFeatureCreation(e)}startCreateFeaturesWorkflowAtFeatureEdit(e){return this.viewModel.startCreateFeaturesWorkflowAtFeatureEdit(e)}startMergeFeaturesWorkflow(e,t={}){return this.viewModel.startMergeFeaturesWorkflow(e,t)}startSplitFeatureWorkflow(e,t={}){return this.viewModel.startSplitFeatureWorkflow(e,t)}async startUpdateFeaturesWorkflow(e){return this.viewModel.startUpdateFeaturesWorkflow(e)}startUpdateWorkflowAtFeatureSelection(){return this.viewModel.startUpdateWorkflowAtFeatureSelection()}startUpdateWorkflowAtMultipleFeatureSelection(e){return this.viewModel.startUpdateWorkflowAtMultipleFeatureSelection(e)}startUpdateWorkflowAtFeatureEdit(e){return this.viewModel.startUpdateWorkflowAtFeatureEdit(e)}startUpdateWorkflowWithActiveSelection(){return this.viewModel.startUpdateWorkflowWithActiveSelection()}deleteFeatureFromWorkflow(){return i(s.getLogger(this),"Editor.deleteFeatureFromWorkflow is deprecated. Use Editor.deleteFeatures instead.",{version:"4.33",replacement:"Editor.deleteFeatures",warnOnce:!0}),this.deleteFeatures()}async deleteFeatures(){await this.viewModel.deleteFeatures()}deleteAssociationFromWorkflow(){return this.viewModel.deleteAssociationFromWorkflow()}cancelWorkflow(e){return this.viewModel.cancelWorkflow(e)}render(){const{visibleElements:e,viewModel:t}=this,i=this.classes(F.base,se.widget,se.panel);if(!t)return me("div",{class:i,key:"empty"});const{pageStack:s}=t,o=s.length-1,r=s.map((e,t)=>this._renderPage(e,t===o));return me("div",{class:i,key:"base"},e.flow?me("calcite-flow",{inert:!!this._prompt,key:"flow"},r):r,this._prompt?me(Z,{...this._prompt,headingLevel:this.headingLevel}):void 0)}_renderPage(e,t){const i={selected:t};switch(e){case"disabled":break;case"ready":return this._renderReady(i);case"viewing-selection-list":return this._renderSelectionListPage(i);case"awaiting-feature-creation-info":return this._renderAwaitingFeatureCreationInfo(i);case"creating-features-upload-details":return this._renderUploadDetails(i);case"creating-features":return this._renderCreatingFeatures(i);case"editing-existing-feature":case"editing-features":case"editing-attributes":case"choosing-key-feature":return this._renderUpdateFeature(i);case"awaiting-update-feature-candidate":return this._renderFeatureList(i);case"adding-attachment":return this._renderAttachmentAdding(i);case"editing-attachment":return this._renderAttachmentEditing(i);case"viewing-associated-layers":case"viewing-associated-features":return this._renderViewAssociatedLayers(i);case"add-association-select-layer":case"add-association-select-feature":return this._renderSelectFeature(i);case"add-association-create-association":return this._renderAddAssociation(i);case"drawing-splitter-geometry":return this._renderDrawingSplitGeometry(i);case"reviewing-features":return this._renderReviewingSplitFeatures(i)}return me("div",{key:"empty-page"})}_renderAwaitingFeatureCreationInfo(e){const{EditorPanel:t,messages:i}=this;return me(t,{heading:i.selectTemplate,key:"templates-panel",...e},me(H,{key:"feature-templates"},me(G,null,this._renderFeatureTemplates())))}_renderUploadDetails(e){const{EditorPanel:t,activeWorkflow:i,messages:s}=this;if("create-features"!==i?.type)return null;const o=i.data.upload;return o?me(t,{heading:s.createFeatures,key:"upload-details-panel",...e},me(X,{helpMessage:this._helpMessage,messages:s,upload:o})):null}_renderCreatingFeatures(e){const{EditorPanel:t,activeWorkflow:i,messages:s,messagesCommon:o,headingLevel:r,viewModel:a}=this;if(!i)return null;const n="create-features"===i.type&&i.numPendingFeatures>0||"update"===i.type&&"create-features"===i?.activeWorkflow?.type&&i.activeWorkflow?.numPendingFeatures>0;return me(t,{heading:s.createFeatures,key:"create-features-panel",...e},n?me(J,{editorViewModel:a,headingLevel:r,messages:s,messagesCommon:o,renderAttachments:this._renderAttachments,renderBatchAttributeForm:this._renderBatchAttributeForm,renderFeatureForm:this._renderFeatureForm,renderSketchToolbar:this._renderSketch,visibleElements:this.visibleElements,onDelete:this._onDelete,onDeleteAssociation:this._onDeleteAssociation,onSave:this._onSave}):me(j,{helpMessage:this._helpMessage,renderSketchToolbar:this._renderSketch}))}_renderUpdateFeature(e){const{EditorPanel:t,messages:i,messagesCommon:s,headingLevel:o,viewModel:r}=this,a=r.activeFeatureCount>1?i.multiFeature.editPanelTitle:i.singleFeature.editPanelTitle;return me(t,{heading:a,key:"update-feature-panel",...e},me(J,{editorViewModel:r,headingLevel:o,messages:i,messagesCommon:s,renderAttachments:this._renderAttachments,renderBatchAttributeForm:this._renderBatchAttributeForm,renderFeatureForm:this._renderFeatureForm,visibleElements:this.visibleElements,onDelete:this._onDelete,onDeleteAssociation:this._onDeleteAssociation,onMerge:this._onMerge,onSave:this._onSave,onSplit:this._onSplit}))}_renderDrawingSplitGeometry(e){const{EditorPanel:t}=this;return me(t,{heading:this.messages.splitFeature,key:"draw-split-geometry-panel",...e},me(j,{helpMessage:this._helpMessage,noticeMessage:this._noticeMessage,renderSketchToolbar:this._renderSketch}))}_renderReviewingSplitFeatures(e){const{EditorPanel:t,messages:i,messagesCommon:s,headingLevel:o,viewModel:r}=this;return me(t,{heading:i.splitFeature,key:"review-split-features-panel",...e},me(J,{editorViewModel:r,headingLevel:o,messages:i,messagesCommon:s,renderAttachments:this._renderAttachments,renderBatchAttributeForm:this._renderBatchAttributeForm,renderFeatureForm:this._renderFeatureForm,visibleElements:this.visibleElements,onSave:this._onSave}))}_getAssociationTypeTitle(e){const{messages:t}=this;if(!e)return t.singleFeature.editPanelTitle;if(e.title)return e.title;const{messagesFeature:i}=this;switch(e.type){case"attachment":return i.associationsAttachments;case"connectivity":return i.associationsConnectivity;case"structure":return i.associationsStructure;case"content":return i.associationsContents;case"container":return i.associationsContainer}}_getAddAssociationTypeTitle(e){const{messages:t}=this;if(!e)return t.singleFeature.editPanelTitle;const i=t.associations;switch(e.type){case"attachment":return i.addAttachment;case"connectivity":return i.addConnectivity;case"structure":return i.addStructure;case"content":return i.addContent;case"container":return i.addContainer}}async _initializeAssociationItemList(e){const t=(await import("./FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationItemList.js")).default;this._associationItemList=new t({view:this.view,viewModel:e})}async _initializeAssociationSettings(){const e=new(0,(await import("./FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationSettings.js")).default);return this._associationSettings=e,e}_renderViewAssociatedLayers(e){const{EditorPanel:t,messages:i,messagesCommon:s,headingLevel:o,viewModel:r}=this,a=r.featureFormViewModel?.activeAssociationInput?.activeAssociationType,n=this._getAssociationTypeTitle(a);return me(t,{heading:n,key:"viewing-associated-layers-panel",...e},me(J,{editorViewModel:r,headingLevel:o,messages:i,messagesCommon:s,renderAttachments:this._renderAttachments,renderBatchAttributeForm:this._renderBatchAttributeForm,renderFeatureForm:this._renderFeatureForm,renderSketchToolbar:this._renderSketch,visibleElements:this.visibleElements,onDelete:this._onDelete,onDeleteAssociation:this._onDeleteAssociation,onSave:this._onSave}))}_renderSelectFeature(e){const{_associationItemList:t,EditorPanel:i,viewModel:s,messagesCommon:o}=this,r=s.utilityNetworkAssociationAddAssociationViewModel,a=this._getAddAssociationTypeTitle(r?.associationType),n="ready"!==r?.state||this.viewModel.featureFormDisabled;return t?me(i,{heading:a,key:"add-association-select-feature",...e},me(H,{key:"select-feature"},me(G,null,t.render())),me(x,{buttons:[t.filterOptionsVisible?{appearance:"solid",label:o.apply,disabled:n,onClick:()=>t.applyFilterOptions(),type:"button"}:void 0,{appearance:"outline",label:o.cancel,disabled:n,onClick:()=>{"update"===s.activeWorkflow?.type&&(r?.reset(),s.activeWorkflow.cancelActiveWorkflow())},type:"button"}]})):me(i,{heading:a,key:"add-association-select-feature",...e})}async _setUpAssociationSettings(){const{viewModel:e}=this,t=this._associationSettings??await this._updatingHandles.addPromise(this._initializeAssociationSettings()),i=e.utilityNetworkAssociationAddAssociationViewModel,s="update"===e.activeWorkflow?.type?e.activeWorkflow:null,o=s?s.activeWorkflow:null,r="add-association"===o?.type?o.sourceFeatureItem:null,a=i?.selectedFeature,n=i?.association,l=i?.utilityNetwork;r&&a&&n&&l&&(t.sourceFeature=r,t.targetFeature=a,t.association=n,t.utilityNetwork=l)}_renderAddAssociation(e){const{_associationSettings:t,EditorPanel:i,viewModel:s,messagesCommon:o}=this;if(!t)return null;const r=s.utilityNetworkAssociationAddAssociationViewModel,a=this._getAddAssociationTypeTitle(r?.associationType),n="ready"!==r?.state;return me(i,{heading:a,key:"add-association",...e},me(H,{key:"add-association-content"},me(G,null,t.render())),me(x,{buttons:[{label:o.add,disabled:n||!r.canAddAssociation,onClick:()=>this._onSave(),type:"button"},{appearance:"outline",label:o.cancel,disabled:n,onClick:()=>{"update"===s.activeWorkflow?.type&&s.activeWorkflow.cancelActiveWorkflow()},type:"button"}]}))}_renderCustomTemplateGroupContent(e){const{messages:t,viewModel:i}=this,s=a(e.group.items,e=>i.itemHasInvalidFormTemplate(e)?t.formFieldCreateError:void 0);return s?me(O,{kind:"warning",message:s}):null}_renderAttachmentAdding(e){const{EditorPanel:t,_attachments:i,messages:s,messagesCommon:o}=this;return me(t,{heading:s.addAttachment,key:"attachment-adding-panel",...e},me(H,{key:"attachments"},this._renderAttachments()),me(x,{buttons:[{label:i.submitting?o.cancel:o.add,disabled:i.submitting||!i.selectedFile,onClick:this._onAttachmentAdd,type:"button"}]}))}_renderSelectionListPage(e){const{_hasSelectionFromMultipleLayers:i,_hasInvalidBatchSelection:s,_selectionCountExceedsMaximum:o,_selectionList:r,_visibleSelectionCount:a,messages:n,EditorPanel:l}=this,{batchUpdateActions:c}=this.visibleElements,{maxVisibleFeatureCountPerLayer:d}=r;return me(l,{heading:n.widgetLabel,key:"selection-list-panel",...e},this.visibleElements.selectionToolbar&&"3d"!==this.view?.type?me("div",{class:F.selectionToolbarContainer},this._renderSelectionToolbar()):void 0,me(H,{key:"selection-list"},me(G,null,this._renderSelectionList())),me(x,{buttons:[c?{label:t(n.batchEditing.editCount,{count:a}),disabled:s,onClick:()=>this.startUpdateWorkflowWithActiveSelection(),type:"button"}:void 0],notice:c&&i?{text:n.batchEditing.selectOneLayer,icon:"information"}:c&&o?{text:t(this.messages.multiFeature.formFailedToLoadTooManyFeatures,{num:d}),icon:"information"}:void 0}))}_renderAttachmentEditing(e){const{EditorPanel:t,_attachments:i,activeWorkflow:s,messages:o,messagesCommon:r}=this;return s?me(t,{heading:o.editAttachment,key:"attachment-editing-panel",...e},me(H,{key:"attachments"},this._renderAttachments()),s.shouldAllowAttachmentEditing?me(x,{buttons:[{label:r.update,disabled:i.submitting||!i.selectedFile,onClick:this._onAttachmentUpdate,type:"button"},{...this._deleteButtonCommonInfo,onClick:this._onAttachmentDelete,disabled:i.submitting,label:r.delete,type:"button"}]}):void 0):null}_renderReady(e){const{EditorPanel:t,messages:i,viewModel:s,visibleElements:o}=this,r=this._helpMessage;return me(t,{heading:i.widgetLabel,key:"landing-panel",...e},me(H,{key:"landing-content"},s.editorItems.length?[o.editFeaturesSection?me(G,{key:"edit-actions"},this._renderUpdateActions()):null,o.createFeaturesSection&&s.canCreateVisible?me(G,{key:"create-actions"},this._renderCreateActions()):null]:me(R,{key:"no-content"},i.noEditableLayers)),r?me("div",{class:F.helpMessage,key:"footer-actions",slot:"footer"},r):void 0)}get _helpMessage(){return this.getHelpMessageString(this.activeWorkflow?.helpMessage)}get _noticeMessage(){return this.getHelpMessageString(this.activeWorkflow?.noticeMessage)}_renderUpdateActions(){const{messages:e,messagesCommon:t,viewModel:i}=this,s={id:"select",label:t.select};return me("div",{class:F.updateActions,key:"update-actions"},me(re,{level:oe(this.headingLevel)},e.editFeatures),this.visibleElements.selectionToolbar&&"3d"!==this.view?.type?me("div",{class:F.selectionToolbarContainer},this._renderSelectionToolbar()):me("calcite-list",{class:F.updateActionsList,label:e.editFeaturesList,selectionAppearance:"border",selectionMode:"single"},ae({disabled:!i.canUpdateVisible,grouped:!1,item:s,selectedItem:"awaiting-feature-to-update"===i.activeWorkflow?.stepId?s:void 0,renderIcon:this._renderSelectIcon,onItemSelect:this._onToggleUpdateWorkflow})))}_renderCreateActions(){return me("div",{key:"create-actions"},me(re,{level:oe(this.headingLevel)},this.messages.createFeatures),me("div",{class:F.featureTemplatesContainer,key:"templates"},this._renderFeatureTemplates()))}_renderFeatureList(e){const{EditorPanel:i,viewModel:s}=this,{activeWorkflow:o}=s;if("update"!==o?.type)return null;const r=o.data.candidates,a=t(this.messages.multipleFeaturesTemplate,{total:r.length});return me(i,{heading:a,key:"feature-list",...e},me(V,{editorItems:s.editorItems,editorMessages:this.messages,filterText:this._filterText,id:this.id,messagesTemplates:this.messagesTemplates,workflow:o,onFilterTextChange:e=>this._filterText=e,onSelectFeature:(e,t)=>s.selectFeature(e,t),onZoomTo:e=>s.zoomTo(e)}))}_showPromptAndWait({title:e,message:t,yesLabel:i,noLabel:s}){const o=n(),{view:r}=this,a=r?.focused;return this._showPrompt({title:e,message:t,context:"danger",actions:{primary:{label:i,action:()=>o.resolve(!0)},secondary:{label:s,action:()=>o.resolve(!1)}}}),o.promise.finally(()=>{this._clearPrompt(),a&&r?.focus()})}async _onSelectionListItemSelect(e){await this.viewModel.onSelectionListItemSelect(e)}async _onSelectionListMenuItemSelect(e,t){await this.viewModel.onSelectionListMenuItemSelect(e,t)}async _setupSketch(){if(!!!this.visibleElements.sketch)return this._sketchImportAbortController=r(this._sketchImportAbortController),this._sketchToolbar=o(this._sketchToolbar),void this.removeHandles(we);if(this._sketchImportAbortController)return;const e=new AbortController;this._sketchImportAbortController=e;const t=await import("./Sketch.js");if(!e.signal.aborted)try{this._sketchToolbar=new t.default({toolbarKind:"docked",contextualToolLocation:"inline-end",scale:"s",visibleElements:new te({deleteButton:!1,settingsMenu:!1,directionModePicker:!1,selectionCountLabel:!1,duplicateButton:!1,createTools:new Y({freehandPolygon:!0,freehandPolyline:!0}),selectionTools:new ee({"lasso-selection":!1,"rectangle-selection":!1})})}),this.addHandles([l(()=>{const e=this.viewModel.activeLeafWorkflow;return e&&"availableCreateTools"in e?e.availableCreateTools:null},e=>{this._sketchToolbar&&(this._sketchToolbar.availableCreateTools=e)},h),l(()=>this.visibleElements.undoRedoButtons,e=>{this._sketchToolbar&&(this._sketchToolbar.visibleElements.undoRedoMenu=e)},h),d(()=>this.viewModel?.sketchViewModel,e=>{this._sketchToolbar&&(this._sketchToolbar.viewModel=e)},h)],we)}finally{this._sketchImportAbortController=null}}getHelpMessageString(e){const{messages:t,view:i}=this;return e?t["3d"===i?.type?"helpMessages3d":"helpMessages2d"]?.[e]:void 0}get test(){return{sketch:this._sketchToolbar,showPrompt:this._showPromptAndWait.bind(this)}}};e([m()],_e.prototype,"_batchAttributeForm",void 0),e([m()],_e.prototype,"_featureForm",void 0),e([m()],_e.prototype,"_sketchToolbar",void 0),e([m()],_e.prototype,"_attachments",void 0),e([m()],_e.prototype,"_associationItemList",void 0),e([m()],_e.prototype,"_associationSettings",void 0),e([m()],_e.prototype,"_featureTemplates",void 0),e([m()],_e.prototype,"_filterText",void 0),e([m()],_e.prototype,"_hasInvalidBatchSelection",null),e([m()],_e.prototype,"_hasSelectionFromMultipleLayers",null),e([m()],_e.prototype,"_prompt",void 0),e([m()],_e.prototype,"_spinner",void 0),e([m()],_e.prototype,"_deleteButtonCommonInfo",null),e([m()],_e.prototype,"_loading",void 0),e([m()],_e.prototype,"_selectionCountExceedsMaximum",null),e([m()],_e.prototype,"_selectionList",void 0),e([m()],_e.prototype,"_selectionListItemActionConfigs",null),e([m()],_e.prototype,"_selectionToolbar",void 0),e([m()],_e.prototype,"_visibleSelectionCount",null),e([m({readOnly:!0})],_e.prototype,"activeWorkflow",null),e([m()],_e.prototype,"effectiveSelectionManager",null),e([m()],_e.prototype,"headingLevel",void 0),e([m()],_e.prototype,"hideTemplatesForInactiveLayers",null),e([m()],_e.prototype,"icon",null),e([m()],_e.prototype,"label",null),e([m()],_e.prototype,"labelOptions",null),e([m()],_e.prototype,"layerInfos",null),e([m(),de("esri/widgets/Editor/t9n/Editor")],_e.prototype,"messages",void 0),e([m(),de("esri/t9n/common")],_e.prototype,"messagesCommon",void 0),e([m(),de("esri/widgets/FeatureTemplates/t9n/FeatureTemplates")],_e.prototype,"messagesTemplates",void 0),e([m(),de("esri/widgets/Feature/t9n/Feature")],_e.prototype,"messagesFeature",void 0),e([m()],_e.prototype,"snappingOptions",null),e([m()],_e.prototype,"tooltipOptions",null),e([m()],_e.prototype,"supportingWidgetDefaults",void 0),e([m({type:g,nonNullable:!0})],_e.prototype,"valueOptions",null),e([m()],_e.prototype,"view",null),e([m(),he(["sketch-create","sketch-delete","sketch-update","workflow-cancel","workflow-commit"])],_e.prototype,"viewModel",void 0),e([m({type:T,nonNullable:!0})],_e.prototype,"visibleElements",void 0),e([m()],_e.prototype,"_helpMessage",null),e([m()],_e.prototype,"_noticeMessage",null),_e=e([p("esri.widgets.Editor")],_e);const ve=_e;export{ve as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import{substitute as e}from"../../../intl.js";import{stripHTML as i}from"../../../core/string.js";import{property as s}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import r from"../UtilityNetworkAssociationInput.js";import{AssociationDetails as a}from"./AssociationDetails.js";import n from"./VisibleElements.js";import{loadCalciteComponents as c}from"../../support/componentsUtils.js";import{globalCss as l}from"../../support/globalCss.js";import{Heading as d}from"../../support/Heading.js";import{tsx as p,tsxFragment as u,messageBundle as m}from"../../support/widget.js";import h from"../../support/UtilityNetworkAssociations/FeatureUtilityNetworkAssociationsViewModel.js";import y from"../../support/UtilityNetworkAssociations/UtilityNetworkAssociationList.js";import{formatPercentAlong as
|
|
5
|
+
import{__decorate as t}from"tslib";import{substitute as e}from"../../../intl.js";import{stripHTML as i}from"../../../core/string.js";import{property as s}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import r from"../UtilityNetworkAssociationInput.js";import{AssociationDetails as a}from"./AssociationDetails.js";import n from"./VisibleElements.js";import{loadCalciteComponents as c}from"../../support/componentsUtils.js";import{globalCss as l}from"../../support/globalCss.js";import{Heading as d}from"../../support/Heading.js";import{tsx as p,tsxFragment as u,messageBundle as m}from"../../support/widget.js";import h from"../../support/UtilityNetworkAssociations/FeatureUtilityNetworkAssociationsViewModel.js";import y from"../../support/UtilityNetworkAssociations/UtilityNetworkAssociationList.js";import{formatPercentAlong as f}from"../../support/UtilityNetworkAssociations/utils/formatPercentAlong.js";import{isConnectivity as g}from"../../support/UtilityNetworkAssociations/utils/isConnectivity.js";import{isConnectivityMidspan as F}from"../../support/UtilityNetworkAssociations/utils/isConnectivityMidspan.js";const _="esri-feature-form-utility-network-association-list",v={base:_,header:`${_}__header`,headingContent:`${_}__heading-content`,listContainer:`${_}__list-container`};let L=class extends y{constructor(t,e){super(t,e),this._isLoadingSelectFeature=!1,this.associationInput=null,this.headingLevel=5,this.messagesFeatureForm=null,this.onSelectLayer=()=>{},this.onSelectFeature=async()=>{},this.onAddAssociation=()=>{},this.viewModel=new h,this.visibleElements=new n}initialize(){this.setUpObserver()}loadDependencies(){return c({chip:()=>import("@esri/calcite-components/dist/components/calcite-chip"),fab:()=>import("@esri/calcite-components/dist/components/calcite-fab"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip")})}get _filteredFeatureInfos(){const{associationInput:t,filterText:e}=this;return t?.associatedLayer?t?.associatedFeatureInfos.get(t.associatedLayer)?.filter(t=>t.title?.toLowerCase().includes(e)??!1).toArray()??[]:[]}get associatedFeatureCount(){const{associationInput:t}=this;if(!t)return 0;const{associatedFeatureInfos:e,associatedLayer:i}=t,s=i?e.get(i):null;return s?s.length:0}render(){const{associationInput:t}=this;if(!t)return p("div",{class:this.classes(v.base,l.widget)});const{associatedLayer:e}=t,{state:i}=this.viewModel;return p("div",{class:this.classes(v.base,l.widget)},"loading"===i||"querying"===i?this.renderLoading():e?this._renderFeatureList(t,e):this._renderLayerList(t))}_renderLayerList(t){const{associatedFeatureInfos:e,editable:i}=t;return p("div",{class:v.listContainer},p("calcite-list",{label:this.messagesFeatureForm?.associations.associatedLayers},Array.from(e.keys(),e=>this._renderLayerItem(t,e))),i?p("calcite-fab",{appearance:"outline-fill",icon:"plus",key:`${t.uid}-add-button`,kind:"neutral",onclick:()=>this.onAddAssociation({feature:t.feature,associationType:t.activeAssociationType,utilityNetwork:t.utilityNetwork}),text:this.messagesCommon.add,textEnabled:!0}):null)}_renderFeatureList(t,e){return p(u,null,this._renderHeader(t,e),p("div",{class:v.listContainer},this.renderFeatureCountWarning(),p("calcite-list",{label:this.messagesFeatureForm?.associations.associatedFeatures},this._renderAssociatedFeatureListPage(),this.renderFeatureObserver())))}_renderLayerTitle(t){return t.title?p(d,{key:"title",level:this.headingLevel},p("div",{class:v.headingContent},p("calcite-icon",{icon:"layer"}),t.title)):null}_renderTotal(t){const i=e(this.messagesFeature?.numberRecords,{number:this._filteredFeatureInfos.length});return p("div",{key:t.id},i)}_renderHeader(t,e){const{messagesFeatureForm:i}=this,{activeAssociationType:s,featureItem:o,feature:r}=t;return p("div",{class:v.header,key:"filter"},this.visibleElements.associationDetails?p(a,{associationType:s?.type,feature:r,heading:o?.label,messages:i.associations}):void 0,this._renderLayerTitle(e),this.renderFilter(),this._renderTotal(e))}_renderAssociatedFeatureListPage(){const t=this._filteredFeatureInfos.slice(0,this.endIndex);return[...this._renderTooltips(t),...this._renderAssociatedFeatureList(t)]}_renderItemTooltip(t){const{tooltipReferenceMap:e}=this,i=t.feature.uid.toString();return g(t.association)?p("calcite-tooltip",{key:`tooltip-${i}`,overlayPositioning:"fixed",referenceElement:e.get(i)},this.getConnectivityTooltip(t.association.associationType)):null}_renderAssociatedFeature(t){const e=this.messagesCommon.untitled,s=t.title||e,o=t.feature.uid.toString();return p("calcite-list-item",{description:i(t.terminalName??""),key:`associated-feature-type-${o}`,label:i(s),onCalciteListItemSelect:()=>this._selectAssociation(t)},g(t.association)?this.renderConnectivityIcon(t.association.associationType,o):null,F(t.association)?p("calcite-chip",{label:f(t.association),scale:"s",slot:"content-end"},f(t.association)):null,p("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"}))}_renderTooltips(t){return t.map(t=>this._renderItemTooltip(t))}_renderAssociatedFeatureList(t){return t.map(t=>this._renderAssociatedFeature(t))}_renderLayerItem(t,e){const{associatedFeatureInfos:i}=t,s=i.get(e)?.length??0;return p("calcite-list-item",{expanded:!0,key:`${e.id}-show-all`,label:e.title??this.messagesCommon.untitled,value:e.id,onCalciteListItemSelect:()=>{this.filterText="",this._showAllAssociations(e)}},p("calcite-chip",{label:s.toString(),scale:"s",slot:"content-end"},s),p("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"}))}async _selectAssociation(t){this._isLoadingSelectFeature||(this._isLoadingSelectFeature=!0,await this.onSelectFeature({feature:t.feature,association:t.association}),this._isLoadingSelectFeature=!1)}_showAllAssociations(t){this.onSelectLayer({layer:t,associationInput:this.associationInput})}};t([s()],L.prototype,"_filteredFeatureInfos",null),t([s()],L.prototype,"associatedFeatureCount",null),t([s({type:r})],L.prototype,"associationInput",void 0),t([s()],L.prototype,"headingLevel",void 0),t([s(),m("esri/widgets/FeatureForm/t9n/FeatureForm")],L.prototype,"messagesFeatureForm",void 0),t([s({constructOnly:!0})],L.prototype,"onSelectLayer",void 0),t([s({constructOnly:!0})],L.prototype,"onSelectFeature",void 0),t([s({constructOnly:!0})],L.prototype,"onAddAssociation",void 0),t([s({type:h})],L.prototype,"viewModel",void 0),t([s({type:n,nonNullable:!0})],L.prototype,"visibleElements",void 0),L=t([o("esri.widgets.FeatureForm.FeatureFormUtilityNetworkAssociations.FeatureFormUtilityNetworkAssociationList")],L);const A=L;export{A as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{property as t}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import i from"../../Widget.js";import{loadCalciteComponents as n}from"../../support/componentsUtils.js";import{globalCss as s}from"../../support/globalCss.js";import{tsx as r,messageBundle as c}from"../../support/widget.js";import{getAssociationTitle as a}from"../../support/UtilityNetworkAssociations/utils/getAssociationTitle.js";import{isFromElement as l}from"../../support/UtilityNetworkAssociations/utils/isFromElement.js";const m="esri-feature-form-utility-network-association-settings",
|
|
5
|
+
import{__decorate as e}from"tslib";import{property as t}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import i from"../../Widget.js";import{loadCalciteComponents as n}from"../../support/componentsUtils.js";import{globalCss as s}from"../../support/globalCss.js";import{tsx as r,messageBundle as c}from"../../support/widget.js";import{getAssociationTitle as a}from"../../support/UtilityNetworkAssociations/utils/getAssociationTitle.js";import{isFromElement as l}from"../../support/UtilityNetworkAssociations/utils/isFromElement.js";const m="esri-feature-form-utility-network-association-settings",u={base:m,infoContainer:`${m}__info-container`};let d=class extends i{constructor(e,t){super(e,t),this.percentAlong=50,this.headingLevel=5,this.messagesFeature=null,this.messagesCommon=null,this.messagesFeatureForm=null,this.readOnly=!1,this.sourceFeature=null,this.targetFeature=null,this.utilityNetwork=null}loadDependencies(){return n({block:()=>import("@esri/calcite-components/dist/components/calcite-block"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item"),"input-number":()=>import("@esri/calcite-components/dist/components/calcite-input-number"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch")})}get association(){return this._get("association")}set association(e){this.percentAlong=e.percentAlong?100*e.percentAlong:50,this._set("association",e)}get associationType(){return this.association.associationType}set associationType(e){this.association.associationType=e,"junction-edge-to-connectivity"!==e&&"junction-edge-from-connectivity"!==e||(this.association.percentAlong=void 0)}render(){return r("div",{class:this.classes(u.base,s.widget)},this._renderFromAssociationEndpoint(),this._renderToAssociationEndpoint(),this._renderAdditionalContent())}_renderFromAssociationEndpoint(){const{associationType:e,association:t,sourceFeature:o,targetFeature:i,messagesFeatureForm:n}=this,s=l(o.feature,t)?o:i,r=s.label,c=a(t,"from",n.associations);switch(e){case"connectivity":case"junction-junction-connectivity":case"junction-edge-midspan-connectivity":case"junction-edge-from-connectivity":case"junction-edge-to-connectivity":return this._renderAssociationEndpoint(r,c,this._renderConnectivityContent(s.feature,t.fromNetworkElement))}return this._renderAssociationEndpoint(r,c)}_renderToAssociationEndpoint(){const{associationType:e,association:t,sourceFeature:o,targetFeature:i,messagesFeatureForm:n}=this,s=l(o.feature,t)?i:o,r=s.label,c=a(t,"to",n.associations);let m;switch(e){case"connectivity":case"junction-junction-connectivity":m=this._renderConnectivityContent(s.feature,t.toNetworkElement);break;case"containment":m=this._isNonspatial(s.feature)?null:this._renderContainmentContent()}return this._renderAssociationEndpoint(r,c,m)}_renderAssociationEndpoint(e,t,o){return r("calcite-block",{description:t,expanded:!0,heading:e},o)}_renderContainmentContent(){const{messagesFeatureForm:e,association:t}=this,o=t.isContentVisible??!1;return r("calcite-label",{layout:"inline"},e.associations.visible,r("calcite-switch",{checked:o,onCalciteSwitchChange:({currentTarget:e})=>{t.isContentVisible=e.checked}}))}_renderConnectivityContent(e,t){const{messagesFeatureForm:o,utilityNetwork:i}=this,n=i.getTerminalConfiguration(e),s=n?.terminals.map(e=>this._renderComboboxListItemNumber(e.id,t.terminalId,e.name))||[];return r("calcite-label",null,o.associations.terminal,r("calcite-combobox",{allowCustomValues:!1,label:o.associations.terminalComboboxLabel,overlayPositioning:"fixed",selectionMode:"single-persist",onCalciteComboboxChange:({currentTarget:e})=>{t.terminalId=parseInt(e.value,10)}},...s))}_renderAdditionalContent(){const{associationType:e}=this;switch(e){case"connectivity":case"junction-junction-connectivity":case"attachment":case"containment":return}const t="junction-edge-midspan-connectivity"===e?e:"junction-edge-from-connectivity",{messagesFeatureForm:o}=this,i=[this._renderComboboxListItemString("junction-edge-midspan-connectivity",t,o.associations.midspanEdge),this._renderComboboxListItemString("junction-edge-from-connectivity",t,o.associations.endpointEdge)];return r("div",{class:u.infoContainer},r("calcite-label",{key:"additional-content"},o.associations.connectTo,r("calcite-combobox",{allowCustomValues:!1,label:o.associations.edgeConnectionComboboxLabel,overlayPositioning:"fixed",selectionMode:"single-persist",onCalciteComboboxChange:({currentTarget:e})=>{this.associationType=e.value}},...i)),"junction-edge-midspan-connectivity"===t?this._renderMidspanEdgeContent():this._renderEndpointEdgeContent())}_renderMidspanEdgeContent(){const{messagesFeatureForm:e,percentAlong:t,association:o}=this;return o.percentAlong=t/100,r("calcite-label",{key:"midspan-edge"},e.associations.midspanLocation,r("calcite-input-number",{max:100,min:0,numberButtonType:"vertical",suffixText:"%",value:`${t}`,onCalciteInputNumberInput:({currentTarget:e})=>{this.percentAlong=parseFloat(e.value)}}))}_renderEndpointEdgeContent(){const{associationType:e,messagesFeatureForm:t}=this,o="junction-edge-to-connectivity"===e;return r("calcite-label",{key:"endpoint-edge"},t.associations.edgeSide,r("calcite-label",{layout:"inline"},t.associations.fromSide,r("calcite-switch",{checked:o,onCalciteSwitchChange:({currentTarget:e})=>{const t=e.checked?"junction-edge-to-connectivity":"junction-edge-from-connectivity";this.associationType=t}}),t.associations.toSide))}_renderComboboxListItemNumber(e,t,o){return r("calcite-combobox-item",{heading:o,key:`#${e}`,selected:t===e,value:`${e}`})}_renderComboboxListItemString(e,t,o){return r("calcite-combobox-item",{heading:o,key:`#${e}`,selected:t===e,value:`${e}`})}_isNonspatial(e){const{sourceLayer:t}=e;return null!=t&&"geometryType"in t&&null==t.geometryType}};e([t()],d.prototype,"association",null),e([t()],d.prototype,"percentAlong",void 0),e([t()],d.prototype,"associationType",null),e([t()],d.prototype,"headingLevel",void 0),e([t(),c("esri/widgets/Feature/t9n/Feature")],d.prototype,"messagesFeature",void 0),e([t(),c("esri/t9n/common")],d.prototype,"messagesCommon",void 0),e([t(),c("esri/widgets/FeatureForm/t9n/FeatureForm")],d.prototype,"messagesFeatureForm",void 0),e([t()],d.prototype,"readOnly",void 0),e([t()],d.prototype,"sourceFeature",void 0),e([t()],d.prototype,"targetFeature",void 0),e([t()],d.prototype,"utilityNetwork",void 0),d=e([o("esri.widgets.FeatureForm.FeatureFormUtilityNetworkAssociations.UtilityNetworkAssociationSettings")],d);const p=d;export{p as default};
|