@arcgis/core 6.0.0-next.49 → 6.0.0-next.50
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/applications/WebEditor/sketchUtils.js +1 -1
- package/arcade/treeAnalysis.js +1 -1
- package/arcgisGlobal.d.ts +0 -6
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/08dd03bc068862160cb2.js +1 -0
- package/assets/esri/core/workers/chunks/38a5be53c3a11adc82e2.js +1 -0
- package/assets/esri/core/workers/chunks/5f12213ccda1f222f244.js +1 -0
- package/assets/esri/core/workers/chunks/aa6f8ee1e1734488ff10.js +1 -0
- package/assets/esri/core/workers/chunks/d781b7e6f9f9f399cf03.js +1 -0
- package/assets/esri/core/workers/chunks/fb4fe32b0b53d8e57f92.js +1 -0
- package/chunks/Pattern.glsl.js +31 -42
- package/config.js +1 -1
- package/interfaces.d.ts +0 -36
- package/kernel.js +1 -1
- package/layers/geospatialPDF/GeospatialPDFLayerWorker.js +8 -8
- package/layers/geospatialPDF/GeospatialPDFWorkerClient.js +1 -1
- package/layers/geospatialPDF/LGIDictMapFrame.js +1 -1
- package/layers/geospatialPDF/ViewportMeasureFrame.js +1 -1
- package/layers/geospatialPDF/geospatialPDFParserUtils.js +1 -1
- package/layers/geospatialPDF/parseAttachmentUtils.js +2 -0
- package/layers/geospatialPDF/sharedUtils.js +1 -1
- package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
- package/layers/raster/datasets/TIFFRaster.js +1 -1
- package/layers/raster/formats/TiffDecoder.js +1 -1
- package/layers/raster/formats/tiffParser.js +1 -1
- package/package.json +3 -3
- package/views/2d/analysis/AreaMeasurementAnalysisView2D.d.ts +2 -2
- package/views/2d/analysis/AreaMeasurementAnalysisView2D.js +1 -1
- package/views/2d/analysis/DistanceMeasurementAnalysisView2D.d.ts +2 -2
- package/views/2d/analysis/DistanceMeasurementAnalysisView2D.js +1 -1
- package/views/3d/analysis/Dimension/LengthDimensionLineRenderObject.js +2 -0
- package/views/3d/analysis/Dimension/lengthDimensionManipulatorUtils.js +1 -1
- package/views/3d/interactive/BufferManipulator3D.js +2 -0
- package/views/3d/interactive/BufferRenderObject.js +2 -0
- package/views/3d/interactive/Manipulator3D.js +1 -1
- package/views/3d/interactive/Manipulator3DBase.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineCalloutSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbolCreationContext.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/LinkChartView.js +1 -1
- package/views/analysis/ElevationProfile/ElevationProfileTool.js +1 -1
- package/views/draw/DrawOperation.js +1 -1
- package/views/interactive/Tooltip.js +1 -1
- package/views/interactive/options/InteractiveToolOptions.js +1 -1
- package/views/interactive/options/ViewOptions.d.ts +5 -1
- package/views/interactive/options/bindViewToolOptions.js +1 -1
- package/views/interactive/sketch/SketchOptions.d.ts +1 -26
- package/views/interactive/sketch/SketchOptions.js +1 -1
- package/views/interactive/snapping/FeatureSnappingLayerSource.d.ts +4 -4
- package/views/interactive/snapping/SnappingManager.js +1 -1
- package/views/interactive/tooltip/components/TooltipEditableField.js +1 -1
- package/views/interactive/tooltip/content/TooltipContent.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentDrawCircle.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentDrawMesh.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentDrawPoint.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentDrawPolygon.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentDrawPolyline.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentDrawRectangle.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentElevation.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentExtentRotate.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentExtentScale.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentMovePoint.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentReshapeEdgeOffset.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentSelectedVertex.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTransformMesh.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTransformPoint.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTranslate.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTranslateVertex.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTranslateXY.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTranslateZ.js +1 -1
- package/views/interactive/tooltip/fields/TooltipField.js +1 -1
- package/views/interactive/tooltip/infos/DynamicTooltipInfo.js +1 -1
- package/views/interactive/tooltip/infos/SketchTooltipInfo.js +1 -1
- package/views/interactive/tooltip/tooltipCommonUtils.js +1 -1
- package/widgets/AreaMeasurement2D/AreaMeasurement2DViewModel.d.ts +8 -8
- package/widgets/AreaMeasurement2D/AreaMeasurement2DViewModel.js +1 -1
- package/widgets/AreaMeasurement2D.d.ts +8 -8
- package/widgets/AreaMeasurement2D.js +1 -1
- package/widgets/BatchAttributeForm/attachmentUtils.d.ts +7 -0
- package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.d.ts +18 -0
- package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.js +1 -1
- package/widgets/DistanceMeasurement2D/DistanceMeasurement2DViewModel.d.ts +8 -8
- package/widgets/DistanceMeasurement2D/DistanceMeasurement2DViewModel.js +1 -1
- package/widgets/DistanceMeasurement2D.d.ts +8 -8
- package/widgets/DistanceMeasurement2D.js +1 -1
- package/widgets/Editor/EditorViewModel.d.ts +23 -23
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Editor.d.ts +24 -24
- package/widgets/Editor.js +1 -1
- package/widgets/Sketch/SketchViewModel.d.ts +25 -25
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/Sketch.d.ts +24 -24
- package/widgets/Sketch.js +1 -1
- package/widgets/UtilityNetworkTrace/support/GraphicHandler.js +1 -1
- package/widgets/support/GridControls/GridControlsViewModel.d.ts +3 -3
- package/widgets/support/GridControls/GridControlsViewModel.js +1 -1
- package/widgets/support/GridControls.d.ts +4 -4
- package/widgets/support/GridControls.js +1 -1
- package/widgets/support/SnappingControls/SnappingControlsViewModel.d.ts +5 -5
- package/widgets/support/SnappingControls/SnappingControlsViewModel.js +1 -1
- package/widgets/support/SnappingControls/VisibleElements.d.ts +3 -3
- package/widgets/support/SnappingControls.d.ts +7 -7
- package/widgets/support/SnappingControls.js +1 -1
- package/assets/esri/core/workers/chunks/0fd5ff5b6037c89257ec.js +0 -1
- package/assets/esri/core/workers/chunks/27a91b52d1bee92b6f20.js +0 -1
- package/assets/esri/core/workers/chunks/3ce7120056040af3bab1.js +0 -1
- package/assets/esri/core/workers/chunks/630a36c4817f33f4cad2.js +0 -1
- package/assets/esri/core/workers/chunks/a0e2a1c6f37454547193.js +0 -1
- package/assets/esri/core/workers/chunks/c4974a4dc081e23899ba.js +0 -1
- package/views/interactive/sketch/SketchLabelOptions.d.ts +0 -72
- package/views/interactive/sketch/SketchLabelOptions.js +0 -2
- package/views/interactive/sketch/SketchTooltipElevationOptions.js +0 -2
- package/views/interactive/sketch/SketchTooltipOptions.d.ts +0 -87
- package/views/interactive/sketch/SketchTooltipOptions.js +0 -2
- package/views/interactive/sketch/SketchTooltipVisibleElements.d.ts +0 -19
- package/views/interactive/sketch/SketchTooltipVisibleElements.js +0 -2
- package/views/interactive/sketch/SketchValueOptions.d.ts +0 -27
- package/views/interactive/sketch/SketchValueOptions.js +0 -2
- package/views/interactive/sketch/Units.d.ts +0 -20
- package/views/interactive/sketch/Units.js +0 -2
- package/views/interactive/snapping/SnappingOptions.d.ts +0 -75
- package/views/interactive/snapping/SnappingOptions.js +0 -2
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type MapView from "../views/MapView.js";
|
|
2
|
-
import type SnappingOptions from "../views/interactive/
|
|
2
|
+
import type SnappingOptions from "../views/interactive/options/SnappingOptions.js";
|
|
3
3
|
import type Widget from "./Widget.js";
|
|
4
4
|
import type DistanceMeasurement2DViewModel from "./DistanceMeasurement2D/DistanceMeasurement2DViewModel.js";
|
|
5
5
|
import type { Icon } from "@esri/calcite-components/components/calcite-icon";
|
|
6
6
|
import type { SystemOrLengthUnit } from "../core/units.js";
|
|
7
7
|
import type { WidgetProperties } from "./Widget.js";
|
|
8
|
-
import type { SnappingOptionsProperties } from "../views/interactive/
|
|
8
|
+
import type { SnappingOptionsProperties } from "../views/interactive/options/SnappingOptions.js";
|
|
9
9
|
import type { DistanceMeasurement2DViewModelProperties } from "./DistanceMeasurement2D/DistanceMeasurement2DViewModel.js";
|
|
10
10
|
|
|
11
11
|
export interface DistanceMeasurement2DProperties extends WidgetProperties, Partial<Pick<DistanceMeasurement2D, "view">> {
|
|
@@ -26,9 +26,9 @@ export interface DistanceMeasurement2DProperties extends WidgetProperties, Parti
|
|
|
26
26
|
*/
|
|
27
27
|
label?: string | null;
|
|
28
28
|
/**
|
|
29
|
-
* The [SnappingOptions](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/
|
|
30
|
-
* It supports [self](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/
|
|
31
|
-
* [feature](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/
|
|
29
|
+
* The [SnappingOptions](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/SnappingOptions/) for sketching.
|
|
30
|
+
* It supports [self](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/SnappingOptions/#selfEnabled) and
|
|
31
|
+
* [feature](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/SnappingOptions/#featureEnabled) snapping.
|
|
32
32
|
*
|
|
33
33
|
* @since 4.32
|
|
34
34
|
*/
|
|
@@ -147,9 +147,9 @@ export default class DistanceMeasurement2D extends Widget<DistanceMeasurement2DP
|
|
|
147
147
|
get label(): string;
|
|
148
148
|
set label(value: string | null | undefined);
|
|
149
149
|
/**
|
|
150
|
-
* The [SnappingOptions](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/
|
|
151
|
-
* It supports [self](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/
|
|
152
|
-
* [feature](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/
|
|
150
|
+
* The [SnappingOptions](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/SnappingOptions/) for sketching.
|
|
151
|
+
* It supports [self](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/SnappingOptions/#selfEnabled) and
|
|
152
|
+
* [feature](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/SnappingOptions/#featureEnabled) snapping.
|
|
153
153
|
*
|
|
154
154
|
* @since 4.32
|
|
155
155
|
*/
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{deprecateWidget as t}from"../core/deprecate.js";import n from"../core/Logger.js";import{ignoreAbortErrors as r}from"../core/promiseUtils.js";import{property as i,subclass as a}from"../core/accessorSupport/decorators.js";import o from"../views/interactive/
|
|
2
|
+
import{__decorate as e}from"tslib";import{deprecateWidget as t}from"../core/deprecate.js";import n from"../core/Logger.js";import{ignoreAbortErrors as r}from"../core/promiseUtils.js";import{property as i,subclass as a}from"../core/accessorSupport/decorators.js";import o from"../views/interactive/options/SnappingOptions.js";import s from"./Widget.js";import c from"./DistanceMeasurement2D/DistanceMeasurement2DViewModel.js";import{globalCss as l}from"./support/globalCss.js";import{MeasurementWidgetContent as u}from"./support/MeasurementWidgetContent.js";import{messageBundle as d,tsx as f}from"./support/widget.js";const p=`esri-distance-measurement-2d`,m={base:p,newMeasurementButton:`${p}__clear-button`};let h=class extends s{constructor(e){super(e),this.messages=null,this.messagesCommon=null,this.viewModel=new c({suppressDeprecationWarning:!0}),t(n.getLogger(this),`Distance Measurement 2D`,`arcgis-distance-measurement-2d`,{version:`5.0`})}get active(){return this.viewModel.active}get icon(){return`measure-line`}set icon(e){this._overrideIfSome(`icon`,e)}get label(){return this.messages?.widgetLabel??``}set label(e){this._overrideIfSome(`label`,e)}get snappingOptions(){return this.viewModel.snappingOptions}set snappingOptions(e){this.viewModel.snappingOptions=e}get unit(){return this.viewModel.unit}set unit(e){this.viewModel.unit=e}get unitOptions(){return this.viewModel.unitOptions}set unitOptions(e){this.viewModel.unitOptions=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}get visible(){return this.viewModel.visible}set visible(e){this.viewModel.visible=e}render(){let{messages:e,messagesCommon:t,unit:n,unitOptions:i,viewModel:a}=this,{active:o,measurementLabel:s,state:c,supported:d}=a;return f(`div`,{"aria-label":this.messages.widgetLabel,class:this.classes(m.base,l.widget,l.panel),key:this,role:`presentation`},this.visible?f(u,{active:o,measurementItems:[{key:`distance`,title:e.distance,value:s}],messages:{...e,notApplicable:t.notApplicable},newMeasurementButtonClass:m.newMeasurementButton,state:c,supported:d,unit:n,unitOptions:i,onNewMeasurementClick:()=>{r(this.viewModel.start())},onUnitChange:e=>{this.unit=e}}):null)}};e([i({readOnly:!0})],h.prototype,`active`,null),e([i()],h.prototype,`icon`,null),e([i()],h.prototype,`label`,null),e([i(),d(`esri/widgets/DistanceMeasurement2D/t9n/DistanceMeasurement2D`)],h.prototype,`messages`,void 0),e([i(),d(`esri/t9n/common`)],h.prototype,`messagesCommon`,void 0),e([i({type:o})],h.prototype,`snappingOptions`,null),e([i()],h.prototype,`uiStrings`,void 0),e([i()],h.prototype,`unit`,null),e([i()],h.prototype,`unitOptions`,null),e([i()],h.prototype,`view`,null),e([i({type:c})],h.prototype,`viewModel`,void 0),e([i({type:Boolean})],h.prototype,`visible`,null),h=e([a(`esri.widgets.DistanceMeasurement2D`)],h);const g=h;export{g as default};
|
|
@@ -3,10 +3,10 @@ import type Collection from "../../core/Collection.js";
|
|
|
3
3
|
import type SharedTemplateMetadata from "../../editing/sharedTemplates/SharedTemplateMetadata.js";
|
|
4
4
|
import type FeatureTemplate from "../../layers/support/FeatureTemplate.js";
|
|
5
5
|
import type SelectionManager from "../../views/SelectionManager.js";
|
|
6
|
-
import type
|
|
7
|
-
import type
|
|
8
|
-
import type
|
|
9
|
-
import type
|
|
6
|
+
import type LabelOptions from "../../views/interactive/options/LabelOptions.js";
|
|
7
|
+
import type SnappingOptions from "../../views/interactive/options/SnappingOptions.js";
|
|
8
|
+
import type TooltipOptions from "../../views/interactive/options/TooltipOptions.js";
|
|
9
|
+
import type ValueOptions from "../../views/interactive/options/ValueOptions.js";
|
|
10
10
|
import type AttachmentsViewModel from "../Attachments/AttachmentsViewModel.js";
|
|
11
11
|
import type BatchAttributeFormViewModel from "../BatchAttributeForm/BatchAttributeFormViewModel.js";
|
|
12
12
|
import type CreateFeaturesWorkflow from "./CreateFeaturesWorkflow.js";
|
|
@@ -20,10 +20,10 @@ import type { MapViewOrSceneView } from "../../views/MapViewOrSceneView.js";
|
|
|
20
20
|
import type { CancelWorkflowOptions, CreationInfo, EditorLayerUnion, EditorSketchCreateEvent, EditorSketchUpdateEvent, EditorStartCreateFeaturesWorkflowAtFeatureEditParameters, EditorStartCreateFeaturesWorkflowAtFeatureTypeSelectionParameters, EditorStartMergeFeaturesWorkflowOptions, EditorStartSplitFeatureWorkflowOptions, FailedOperation, FeatureInfo, LayerInfo, State } from "./types.js";
|
|
21
21
|
import type { AttachmentsViewModelProperties } from "../Attachments/AttachmentsViewModel.js";
|
|
22
22
|
import type { FeatureTemplatesViewModelProperties } from "../FeatureTemplates/FeatureTemplatesViewModel.js";
|
|
23
|
-
import type {
|
|
24
|
-
import type { SnappingOptionsProperties } from "../../views/interactive/
|
|
25
|
-
import type {
|
|
26
|
-
import type {
|
|
23
|
+
import type { LabelOptionsProperties } from "../../views/interactive/options/LabelOptions.js";
|
|
24
|
+
import type { SnappingOptionsProperties } from "../../views/interactive/options/SnappingOptions.js";
|
|
25
|
+
import type { TooltipOptionsProperties } from "../../views/interactive/options/TooltipOptions.js";
|
|
26
|
+
import type { ValueOptionsProperties } from "../../views/interactive/options/ValueOptions.js";
|
|
27
27
|
|
|
28
28
|
export interface EditorViewModelProperties extends Partial<Pick<EditorViewModel, "formSystem" | "layerInfos" | "selectionManager" | "syncViewSelection" | "useLegacyCreateTools" | "useViewOptions" | "view">> {
|
|
29
29
|
/** The [AttachmentsViewModel](https://developers.arcgis.com/javascript/latest/references/core/widgets/Attachments/AttachmentsViewModel/) for supporting the editor widget. Attachment editing is enabled by default if the layer has support for it. */
|
|
@@ -38,9 +38,9 @@ export interface EditorViewModelProperties extends Partial<Pick<EditorViewModel,
|
|
|
38
38
|
*
|
|
39
39
|
* @since 4.24
|
|
40
40
|
*/
|
|
41
|
-
labelOptions?:
|
|
41
|
+
labelOptions?: LabelOptionsProperties;
|
|
42
42
|
/**
|
|
43
|
-
* The [SnappingOptions](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/
|
|
43
|
+
* The [SnappingOptions](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/SnappingOptions/) for sketching. It supports [self](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/SnappingOptions/#selfEnabled) and [feature](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/SnappingOptions/#featureEnabled) snapping.
|
|
44
44
|
*
|
|
45
45
|
* @since 4.19
|
|
46
46
|
*/
|
|
@@ -51,14 +51,14 @@ export interface EditorViewModelProperties extends Partial<Pick<EditorViewModel,
|
|
|
51
51
|
*
|
|
52
52
|
* @since 4.24
|
|
53
53
|
*/
|
|
54
|
-
tooltipOptions?:
|
|
54
|
+
tooltipOptions?: TooltipOptionsProperties;
|
|
55
55
|
/**
|
|
56
56
|
* Options to configure how values are displayed and input when creating or updating graphics.
|
|
57
57
|
* See [useViewOptions](https://developers.arcgis.com/javascript/latest/references/core/widgets/Editor/EditorViewModel/#useViewOptions) for unit inheritance and override behavior.
|
|
58
58
|
*
|
|
59
59
|
* @since 4.29
|
|
60
60
|
*/
|
|
61
|
-
valueOptions?:
|
|
61
|
+
valueOptions?: ValueOptionsProperties;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
export interface EditorViewModelEvents {
|
|
@@ -111,10 +111,10 @@ export interface EditorViewModelEvents {
|
|
|
111
111
|
* @see [CreateFeaturesWorkflowData](https://developers.arcgis.com/javascript/latest/references/core/widgets/Editor/CreateFeaturesWorkflowData/)
|
|
112
112
|
* @see [UpdateWorkflowData](https://developers.arcgis.com/javascript/latest/references/core/widgets/Editor/UpdateWorkflowData/)
|
|
113
113
|
* @see [SnappingControls](https://developers.arcgis.com/javascript/latest/references/core/widgets/support/SnappingControls/)
|
|
114
|
-
* @see [
|
|
115
|
-
* @see [
|
|
116
|
-
* @see [
|
|
117
|
-
* @see [SnappingOptions](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/
|
|
114
|
+
* @see [LabelOptions](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/LabelOptions/)
|
|
115
|
+
* @see [TooltipOptions](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/TooltipOptions/)
|
|
116
|
+
* @see [ValueOptions](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/ValueOptions/)
|
|
117
|
+
* @see [SnappingOptions](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/SnappingOptions/)
|
|
118
118
|
* @see [Programming patterns: Widget viewModel pattern](https://developers.arcgis.com/javascript/latest/programming-patterns/#widget-viewmodel-pattern)
|
|
119
119
|
* @see [Sample - Edit features with the Editor widget](https://developers.arcgis.com/javascript/latest/sample-code/widgets-editor-basic/)
|
|
120
120
|
* @see [Sample - Edit features in 3D with the Editor widget](https://developers.arcgis.com/javascript/latest/sample-code/editor-3d/)
|
|
@@ -211,8 +211,8 @@ export default class EditorViewModel extends EventedAccessor {
|
|
|
211
211
|
*
|
|
212
212
|
* @since 4.24
|
|
213
213
|
*/
|
|
214
|
-
get labelOptions():
|
|
215
|
-
set labelOptions(value:
|
|
214
|
+
get labelOptions(): LabelOptions;
|
|
215
|
+
set labelOptions(value: LabelOptionsProperties);
|
|
216
216
|
/**
|
|
217
217
|
* An array of editing configurations for individual layers.
|
|
218
218
|
*
|
|
@@ -251,7 +251,7 @@ export default class EditorViewModel extends EventedAccessor {
|
|
|
251
251
|
/** The [SketchViewModel](https://developers.arcgis.com/javascript/latest/references/core/widgets/Sketch/SketchViewModel/) for supporting the editor widget. */
|
|
252
252
|
get sketchViewModel(): SketchViewModel | null | undefined;
|
|
253
253
|
/**
|
|
254
|
-
* The [SnappingOptions](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/
|
|
254
|
+
* The [SnappingOptions](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/SnappingOptions/) for sketching. It supports [self](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/SnappingOptions/#selfEnabled) and [feature](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/SnappingOptions/#featureEnabled) snapping.
|
|
255
255
|
*
|
|
256
256
|
* @since 4.19
|
|
257
257
|
*/
|
|
@@ -293,8 +293,8 @@ export default class EditorViewModel extends EventedAccessor {
|
|
|
293
293
|
*
|
|
294
294
|
* @since 4.24
|
|
295
295
|
*/
|
|
296
|
-
get tooltipOptions():
|
|
297
|
-
set tooltipOptions(value:
|
|
296
|
+
get tooltipOptions(): TooltipOptions;
|
|
297
|
+
set tooltipOptions(value: TooltipOptionsProperties);
|
|
298
298
|
/**
|
|
299
299
|
* Starting at version 5.0, Editor is transitioning to a next generation geometry
|
|
300
300
|
* creation experience. This new experience provides advanced curve creation tools
|
|
@@ -343,8 +343,8 @@ export default class EditorViewModel extends EventedAccessor {
|
|
|
343
343
|
*
|
|
344
344
|
* @since 4.29
|
|
345
345
|
*/
|
|
346
|
-
get valueOptions():
|
|
347
|
-
set valueOptions(value:
|
|
346
|
+
get valueOptions(): ValueOptions;
|
|
347
|
+
set valueOptions(value: ValueOptionsProperties);
|
|
348
348
|
/**
|
|
349
349
|
* A reference to the [MapView](https://developers.arcgis.com/javascript/latest/references/core/views/MapView/) or [SceneView](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/).
|
|
350
350
|
* This view provides the editable layers for the Editor widget and is required when instantiating the widget.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{isSome as t}from"../../core/arrayUtils.js";import{createTask as n}from"../../core/asyncUtils.js";import r from"../../core/Collection.js";import{deprecatedFunction as i}from"../../core/deprecate.js";import a from"../../core/Error.js";import{EventedAccessor as o}from"../../core/Evented.js";import{abortHandle as s,makeHandle as c}from"../../core/handleUtils.js";import"../../core/has.js";import l from"../../core/Logger.js";import{destroyMaybe as u,abortMaybe as d,removeMaybe as f}from"../../core/maybe.js";import{throwIfAborted as p}from"../../core/promiseUtils.js";import m from"../../core/ReactiveMap.js";import{watch as h,syncAndInitial as g,initial as _,on as v,when as y,sync as b,whenOnce as x}from"../../core/reactiveUtils.js";import{property as S,subclass as ee}from"../../core/accessorSupport/decorators.js";import{UpdatingHandles as te}from"../../core/support/UpdatingHandles.js";import{getTemplatesForLayers as ne}from"../../editing/templateUtils.js";import{getGraphicLayer as C}from"../../graphic/graphicOriginUtils.js";import w from"../../layers/GraphicsLayer.js";import{isEditableLayer as re}from"../../layers/support/editableLayers.js";import{isFeatureLayer as ie,isSubtypeGroupLayer as T,getOwningPortalUrl as E}from"../../layers/support/layerUtils.js";import{parseKnownArcGISOnlineDomain as D}from"../../portal/support/urlUtils.js";import ae from"../../views/SelectionManager.js";import{fetchFullFeaturesByObjectId as oe}from"../../views/draw/support/editingSessionUtils.js";import se from"../../views/interactive/sketch/SketchLabelOptions.js";import ce from"../../views/interactive/sketch/SketchOptions.js";import le from"../../views/interactive/sketch/SketchTooltipOptions.js";import ue from"../../views/interactive/sketch/SketchValueOptions.js";import{SnappingManager as de}from"../../views/interactive/snapping/SnappingManager.js";import O from"../../views/interactive/snapping/SnappingOptions.js";import{isSelectableLayer as k}from"../../views/support/selectionUtils.js";import A from"../Attachments/AttachmentsViewModel.js";import{isNextOrLegacyCreateFeaturesWorkflow as j,isNextOrLegacyUpdateRecordWorkflow as M,isNextOrLegacyUpdateFeaturesWorkflow as N,isNextOrLegacyMergeFeaturesWorkflow as P,isNextOrLegacySplitFeatureWorkflow as F,isNextOrLegacyUpdateWorkflow as I,isLegacyFeatureFormViewModel as L}from"./compatibilityAdapters.js";import R from"./CreateFeaturesWorkflow.js";import z from"./UpdateWorkflow.js";import{getLayersFromWorkflow as B,isBatchAttributeFormViewModel as V,findEditorItemForLayerOrThrow as H,toFeatureInfos as U,fetchFullFeatures as fe,findEditorItemForLayer as pe,whenEditorLayerView as W}from"./workflowUtils.js";import me from"./legacy/CreateFeaturesWorkflow.js";import he from"./legacy/UpdateWorkflow.js";import ge from"./support/EditorItem.js";import{assertViewNot3D as G,MultipleSourceLayersError as K,InsufficientFeatureCountError as q,MissingOriginLayerError as J,assertMergeWorkflowCapabilities as _e,FetchFullFeatureError as Y,assertSplitWorkflowCapabilities as ve}from"./support/errors.js";import{makeTemplateGroupInfoForLayer as ye}from"../FeatureTemplates/featureTemplatesUtils.js";import X from"../FeatureTemplates/FeatureTemplatesViewModel.js";import be from"../Sketch/SketchViewModel.js";import xe from"../Spinner/SpinnerViewModel.js";import{goTo as Z}from"../support/goToUtils.js";import{isFeatureItem as Q,isLayerItem as Se}from"../support/SelectionList/selectionListUtils.js";import Ce from"../support/SelectionList/SelectionListViewModel.js";import we from"../support/SelectionToolbar/SelectionToolbarViewModel.js";function Te(e,t){return e?.find(e=>e.layer===t)}let $=class extends o{constructor(e){super(e),this._defaultSelectionManager=new ae,this._queuedSelectionTool=null,this._sketchEventListenerHandle=null,this._sketchGraphicsLayer=new w({listMode:`hide`,internal:!0,title:`Editor sketch layer`}),this._snappingManager=null,this._templatesByLayer=new Map,this._updateItemsTask=null,this._updateTemplatesTask=null,this._updatingHandles=new te,this._featureTemplatesViewModelIsRestricted=!1,this.activeWorkflow=null,this._activityQueue=new r,this.editorItems=new r,this.editorItemsLayerMap=new m,this.failures=[],this.hideTemplatesForInactiveLayers=!1,this.attachmentsViewModel=new A({capabilities:{editing:!0}}),this.featureTemplatesViewModel=new X({disabledItemFunction:({layer:e})=>this._itemIsSuspended(e)}),this.layerInfos=null,this.ownSketchViewModel=new be({layer:this._sketchGraphicsLayer,useLegacyCreateTools:this._get(`useLegacyCreateTools`)??!0}),this.selectionListViewModel=new Ce,this.selectionManager=null,this.selectionToolbarViewModel=new we({continuousSelectionEnabled:!0,defaultOperationType:`replace`,persistSelection:!1,returnGeometry:!1}),this.sketchOptions=new ce,this.snappingOptions=new O({attributeRulesEnabled:!0}),this.spinnerViewModel=new xe,this.syncViewSelection=!1,this.useViewOptions=!1,this.pageStack=[],this.showDiscardEditsPrompt=()=>Promise.resolve(!0),this.showConfirmationPrompt=()=>Promise.resolve(!0),this._candidateCommitted=!1,this.formSystem=`legacy`,this.back=async()=>{this.state===`viewing-selection-list`?(this.selectionListViewModel.filterText=void 0,this.effectiveSelectionManager.clear()):this.canGoBack&&(this.activeWorkflow?.hasPreviousStep?await this.activeWorkflow.back(this.showDiscardEditsPrompt):await this._cancelWorkflow({force:!this.hasPendingEdits}))},this.saveWorkflow=async()=>await this.activeWorkflow?.save(this.showConfirmationPrompt),this.selectFeature=(e,t=!1)=>{let n=this.activeWorkflow;if(this._candidateCommitted||n?.type!==`update`)return;let{rootFeatures:r}=n.data;r.removeAll(),e&&r.add(e),t&&(n.next(),this._candidateCommitted=!0)}}initialize(){this.addHandles([h(()=>{let e=this.view,t=e?.map?.editableLayers.toArray();return[t,(e?.allLayerViews)?.filter(e=>!!t?.includes(e.layer)),this.layerInfos]},()=>this._updateEditorItems(),g),h(()=>this.hideTemplatesForInactiveLayers,()=>this.syncFeatureTemplates()),h(()=>this._selectionSources,()=>this._syncSelectionSources(),_),v(()=>this.activeWorkflow,`cancel`,()=>this.emit(`workflow-cancel`)),v(()=>this.activeWorkflow,`commit`,()=>this.emit(`workflow-commit`)),v(()=>this.activeWorkflow,`complete`,()=>{this.emit(`workflow-commit`),this._set(`activeWorkflow`,null)}),y(()=>!this.activeWorkflow&&this._queuedSelectionTool,()=>this._queuedSelectionTool&&this.selectionToolbarViewModel.activateTool(this._queuedSelectionTool)),h(()=>this.activeWorkflow,e=>this._defaultSelectionManager.highlightEnabled=!e),y(()=>this.view?.map,e=>e.add(this._sketchGraphicsLayer),_),v(()=>this.editorItems,`change`,()=>this._afterEditorItemsChange()),h(()=>[this.canCreate,this.canUpdateVisible],()=>this._afterEditorItemsChange()),h(()=>this.page,(e,t)=>{let n=[...this.pageStack];if(n.indexOf(e)===-1)n.push(e);else for(;n.length&&n.at(-1)!==e;)n.pop();this.pageStack=n},g),y(()=>this.state===`awaiting-update-feature-candidate`,()=>this._candidateCommitted=!1),v(()=>this.featureTemplatesViewModel,`select`,async({item:e,oldItem:t})=>{let{activeWorkflow:n}=this;if(n){let e=n.type===`update`&&n.activeWorkflow?.stepId===`awaiting-feature-creation-info`,r=n.type===`create-features`&&n.stepId===`awaiting-feature-creation-info`&&n.data.creationInfo?.layer&&!n.data.creationInfo?.template;if(e||r)return;try{await this.cancelWorkflow({force:!this.hasPendingEdits})}catch{this.featureTemplatesViewModel.select(t,{emit:!1});return}}if(!e)return;let r={layer:e.layer,template:e.template};if(e.supportsUpload)return this.featureTemplatesViewModel.select(t,{emit:!1}),this.startCreateFeaturesWorkflow(r);await this.startCreateFeaturesWorkflowAtFeatureCreation(r)}),h(()=>[this.view,this.featureTemplatesViewModel],([e,t])=>{t.view=e},g),v(()=>this.view,`key-down`,e=>{e.key===`Escape`&&this.activeWorkflow?.keyboardCancellationEnabled&&(e.stopPropagation(),this.back())}),v(()=>this.sketchViewModel,[`create`,`delete`,`update`],e=>{let{activeWorkflow:t}=this,n=B(t),r=`sketch-${e.type}`;this.emit(r,{type:r,detail:e,layer:n[0],layers:n})},b),h(()=>[this.sketchViewModel,this.useViewOptions],([e,t])=>{e&&(e.useViewOptions=t)},g),h(()=>this.view,e=>{if(this._snappingManager=u(this._snappingManager),!e)return;let t=this.snappingOptions;this._snappingManager=new de({view:e,options:t}),this.ownSketchViewModel.snappingManager=this._snappingManager},g),h(()=>this.snappingOptions,e=>{this._snappingManager&&(this._snappingManager.options=e)},g),v(()=>this.selectionToolbarViewModel,`complete`,e=>this._onSelectionComplete(e)),h(()=>({view:this.view,selectionManager:this.effectiveSelectionManager,selectionListViewModel:this.selectionListViewModel,selectionToolbarViewModel:this.selectionToolbarViewModel}),({view:e,selectionManager:t,selectionListViewModel:n,selectionToolbarViewModel:r})=>{t.view=e,n.view=e,r.view=e},g),h(()=>this.effectiveSelectionManager,e=>{this.selectionListViewModel.selectionManager=e,this.selectionToolbarViewModel.selectionManager=e},g)])}destroy(){this._cancelWorkflow({warnIfNoWorkflow:!1}).then(()=>{this.view?.map?.remove(this._sketchGraphicsLayer),this.view=null}),this._updateItemsTask=d(this._updateItemsTask),this._updatingHandles.destroy(),this._sketchEventListenerHandle=f(this._sketchEventListenerHandle),this.selectionListViewModel?.destroy(),this.selectionToolbarViewModel?.destroy(),this._defaultSelectionManager.destroy()}get _featureTemplatesLayersAndTables(){let e=new r;for(let t of this.editorItems){let n=this.hideTemplatesForInactiveLayers&&!t.visible;t.supportsCreateFeaturesWorkflow&&!n&&e.push(t.layer)}return e}get _selectionSources(){let e=new r;if(this.syncViewSelection||this.selectionManager)return e;for(let t of this.editorItems)k(t.layer)&&t.supportsUpdateWorkflow&&e.push(t.layer);return e}get activeFeatureCount(){let e=this.activeLeafWorkflow;return j(e)?e.pendingFeatures.length:M(e)&&e.data.edits.feature?1:N(e)?e.data.fullFeatures.length:P(e)?e.data.features.length:F(e)?2:0}get activeLeafWorkflow(){let e=this.activeWorkflow;return e&&I(e)?e.activeWorkflow??e:e}get canCreate(){return this.editorItems.some(e=>e.supportsCreateFeaturesWorkflow)}get canCreateVisible(){return!!this.featureTemplatesLayers.length}get canUpdate(){return this.editorItems.some(e=>e.supportsUpdateWorkflow)}get canUpdateVisible(){return this.editorItems.some(e=>e.supportsUpdateWorkflow&&e.visible)}get featureTemplatesLayers(){return this._featureTemplatesLayersAndTables.filter(e=>e.type===`scene`||!e.isTable)}get effectiveSelectionManager(){let e=this.view;return e&&this.syncViewSelection?e.selectionManager:this.selectionManager??this._defaultSelectionManager}get featureFormViewModel(){let e=this.activeWorkflow?.formViewModel;return L(e)?e:null}get formViewModel(){return this.activeWorkflow?.formViewModel}get utilityNetworkAssociationAddAssociationViewModel(){let{activeWorkflow:e}=this;return e?.type===`update`?e.activeUtilityNetworkAssociationAddAssociationViewModel:null}get labelOptions(){return this.sketchOptions.labels}set labelOptions(e){this.sketchOptions.labels=e}get useLegacyCreateTools(){return this.ownSketchViewModel.useLegacyCreateTools}set useLegacyCreateTools(e){this.ownSketchViewModel.useLegacyCreateTools=e}get isUsingLegacyCreateTools(){return this.useLegacyCreateTools||this.view?.type!==`2d`}get sketchViewModel(){let{activeWorkflow:e}=this;return e?.type===`update`?e.activeSketchViewModel:e?.type===`create-features`?e.sketchViewModel:this.ownSketchViewModel}get state(){if(!this.view?.ready)return`disabled`;let e=this.attachmentsViewModel.mode;if(e===`add`)return`adding-attachment`;if(e===`edit`)return`editing-attachment`;let{activeWorkflow:t}=this,n=!t?.stepId;return this.effectiveSelectionManager.count&&n?`viewing-selection-list`:n?`ready`:t.type===`update`&&t.activeWorkflow?.stepId?t.activeWorkflow.stepId:t.stepId}get syncing(){return this._activityQueue.length>0}get updating(){return this._updatingHandles.updating||this.activeWorkflow?.updating===!0}get tooltipOptions(){return this.sketchOptions.tooltips}set tooltipOptions(e){this.sketchOptions.tooltips=e}get valueOptions(){return this.sketchOptions.values}set valueOptions(e){this.sketchOptions.values=e}set view(e){this.ownSketchViewModel.view=e,this.spinnerViewModel.view=e,this._set(`view`,e)}get canZoomTo(){return this._getWorkingFeatures().some(e=>e.geometry)}get page(){let{activeWorkflow:e,state:t}=this;if(V(e?.formViewModel)){if(e?.type===`update`&&e.formViewModel?.activeAssociationsInput)return e.formViewModel.activeAssociationsInput.associatedLayer?`viewing-associated-features`:`viewing-associated-layers`}else if(e?.type===`update`&&e.formViewModel){let{associatedLayer:t,associationId:n}=e.formViewModel;if(t||n!=null)return`viewing-associated-features`}if(e?.type===`update`&&e.stepId===`awaiting-feature-to-update`)return`ready`;if(e?.type===`create-features`&&e.numPendingFeatures===0){let t=e.data.upload;if(t)return t.state==="default"?`ready`:`creating-features-upload-details`}return t??`disabled`}get formDisabled(){let{activeLeafWorkflow:e}=this;if(M(e)){let t=e.formViewModel,n=!L(t)&&t.readOnly;return e.data.editorItem?.capabilities.update.attributes===!1||t.disabled===!0||n}if(N(e)){let{formViewModel:t}=e;return t.disabled||t.readOnly}return!1}get featureFormDisabled(){let{activeLeafWorkflow:e}=this;if(M(e))return e.data.editorItem?.capabilities.update.attributes===!1||e.formViewModel.disabled===!0;if(N(e)){let{formViewModel:t}=e;return t.disabled||t.readOnly}return!1}get featureFormHasAssociation(){return!!this.featureFormViewModel?.activeAssociation}get formHasAssociation(){return!!this.formViewModel?.activeAssociation}get canGoBack(){return this.activeWorkflow!=null&&!this.syncing}get shouldShowDeleteButton(){let{activeLeafWorkflow:e}=this;if(M(e)){let{data:t}=e;return t.editorItem?.capabilities.delete.enabled&&!t.readOnly}return N(e)?e.data.editorItems.every(e=>e.capabilities.delete.enabled):!1}get hasPendingEdits(){return this.activeWorkflow?.hasPendingEdits??!1}get snappingManager(){return this._snappingManager}activateSelectionTool(e){return this.selectionToolbarViewModel.activateTool(e)}cancelSelectionTool(){this.selectionToolbarViewModel.cancel()}getTemplatesForLayer(e){return this._templatesByLayer.get(e)??[]}async startCreateFeaturesWorkflowAtFeatureTypeSelection(e){return this.startCreateFeaturesWorkflow(e)}async startCreateFeaturesWorkflowAtFeatureCreation(e){return this.startCreateFeaturesWorkflow(e,`creating-features`)}async startCreateFeaturesWorkflow(e,t=`awaiting-feature-creation-info`){if(await x(()=>!this.updating),!this.canCreate)throw new a(`editing:unsupported-workflow`,`Creating features is unsupported or disabled.`);let n=this._createUpdatingResolver();try{await this._cancelWorkflow();let n=this._createCreateFeaturesWorkflow(e,t);this._set(`activeWorkflow`,n),await n.start()}catch(e){this._logErrorAndCancelWorkflow(e)}finally{n.resolve()}}async startCreateFeaturesWorkflowAtFeatureEdit(e){await x(()=>!this.updating);let t=this._createUpdatingResolver();try{let{initialFeature:t}=e,n=t.sourceLayer=t.layer,r=n?H(this.editorItems,n):void 0;if(!r?.supportsCreateFeaturesWorkflow)throw new a(`editing:unsupported-workflow`,`Creating features is unsupported or disabled for this layer.`);await this._cancelWorkflow();let i=this._createCreateFeaturesWorkflow({initialFeature:t,layer:r.layer,maxFeatures:1},`creating-features`);this._set(`activeWorkflow`,i),await i.start()}catch(e){this._logErrorAndCancelWorkflow(e)}finally{t.resolve()}}async startMergeFeaturesWorkflow(e,t={}){await x(()=>!this.updating),G(this,`merge-features`);let n=Array.isArray(e)?U(e):[e];if(n.length>1)throw new K;if(n.length===0||n[0].objectIds.length<2)throw new q(2);let i=n[0],a=i.layer;if(!a)throw new J;let o=H(this.editorItems,a);_e(o);let c=this._createUpdatingResolver(),l=new AbortController;this.addHandles(s(l));try{await this._cancelWorkflow(),this.cancelSelectionTool();let e=await oe(i.objectIds,a,this.view?.spatialReference,l.signal);if(e.length!==i.objectIds.length)throw new Y;let n;if(t.keyFeature){let r=t.keyFeature.getObjectId();n=e.find(e=>e.getObjectId()===r)??t.keyFeature}let o=this._createUpdateWorkflow(`editing-existing-feature`,{rootFeatures:new r(e),rootWorkflowOptions:{type:`merge`,props:{...t,keyFeature:n}}});this._set(`activeWorkflow`,o),this.addHandles(this._destroyWorkflowOnCommit(o)),await o.start()}catch(e){this._logErrorAndCancelWorkflow(e)}finally{c.resolve()}}async startSplitFeatureWorkflow(e,t={}){await x(()=>!this.updating),G(this,`split-feature`);let n=C(e);if(!n)throw new J;let i=H(this.editorItems,n);ve(i);let a=this._createUpdatingResolver(),o=new AbortController;this.addHandles(s(o));try{await this._cancelWorkflow(),this.cancelSelectionTool();let i=await fe([e],n,this.view?.spatialReference,o.signal);if(i.length!==1)throw new Y;let a=this._createUpdateWorkflow(`editing-existing-feature`,{rootFeatures:new r(i),rootWorkflowOptions:{type:`split`,props:t}});this._set(`activeWorkflow`,a),this.addHandles(this._destroyWorkflowOnCommit(a)),await a.start()}catch(e){this._logErrorAndCancelWorkflow(e)}finally{a.resolve()}}async startUpdateFeaturesWorkflow(e){if(await x(()=>!this.updating),!this.canUpdate){this._logError(`editing:unsupported-workflow`,`Update features workflow is unsupported or disabled.`);return}let t=Array.isArray(e)?U(e):[e];if(t.length>1)throw new K;let n=this._createUpdatingResolver();try{await this._cancelWorkflow(),this.cancelSelectionTool();let e=this._createUpdateWorkflow(`editing-existing-feature`,{rootFeatureInfos:t,rootWorkflowOptions:{type:`update-multiple`}});e.addHandles(this._destroyWorkflowOnCommit(e)),this._set(`activeWorkflow`,e),await e.start()}catch(e){this._logErrorAndCancelWorkflow(e)}finally{n.resolve()}}async startUpdateWorkflowAtFeatureSelection(){if(await x(()=>!this.updating),!this.canUpdate){this._logError(`editing:unsupported-workflow`,`Update workflow is unsupported or disabled.`);return}let e=this._createUpdatingResolver();try{await this._cancelWorkflow();let e=this._createUpdateWorkflow();this._set(`activeWorkflow`,e),await e.start()}catch(e){this._logErrorAndCancelWorkflow(e)}finally{e.resolve()}}async startUpdateWorkflowAtMultipleFeatureSelection(e){if(await x(()=>!this.updating),!this.canUpdate){this._logError(`editing:unsupported-workflow`,`Update workflow is unsupported or disabled.`);return}let t=this._createUpdatingResolver();try{await this._cancelWorkflow();let t=this._createUpdateWorkflow(`awaiting-update-feature-candidate`);t.data.candidates=e,this._set(`activeWorkflow`,t),await t.start()}catch(e){this._logErrorAndCancelWorkflow(e)}finally{t.resolve()}}async startUpdateWorkflowAtFeatureEdit(e){if(await x(()=>!this.updating),!this.canUpdate){this._logError(`editing:unsupported-workflow`,`Update workflow is unsupported or disabled.`);return}let t=this._createUpdatingResolver();try{await this._cancelWorkflow(),this.cancelSelectionTool();let t=this._createUpdateWorkflow(`editing-existing-feature`,{rootFeatures:new r([e])});t.addHandles(this._destroyWorkflowOnCommit(t)),this._set(`activeWorkflow`,t),await t.start()}catch(e){this._logErrorAndCancelWorkflow(e)}finally{t.resolve()}}async startUpdateWorkflowWithActiveSelection(){let{selectionListViewModel:e}=this;if(!e.visibleFeatureCount||!e.visibleLayerCount)throw new a(`editing:missing-selection`,`Unable to determine visible selection.`);if(e.visibleLayerCount>1)throw new a(`editing:features-different-layers`,`Cannot start workflow with features from different layers.`);let t=e.layerItems.find(e=>e.visible);t&&await this._startUpdateWorkflowWithLayerItem(t,`update`)}async deleteFeatureFromWorkflow(){i(l.getLogger(this),`EditorViewModel.deleteFeatureFromWorkflow is deprecated. Use EditorViewModel.deleteFeatures instead.`,{version:`4.33`,replacement:`EditorViewModel.deleteFeatures`,warnOnce:!0}),await this.deleteFeatures()}async deleteFeatures(){let e=this.activeWorkflow;if(I(e))return e.deleteActiveFeatures();this._logError(`editing:unsupported-workflow`,`Deleting features requires an active update workflow.`)}async deleteAssociationFromWorkflow(){let{activeWorkflow:e}=this;!e||e.type!==`update`?this._logError(`editing:unsupported-workflow`,`Deleting an association requires an active update workflow.`):await e.deleteActiveAssociation()}async cancelWorkflow(e){return this._cancelWorkflow({warnIfNoWorkflow:!0,...e})}itemHasInvalidFormTemplate(e){return e!=null&&pe(this.editorItems,e.layer)?.hasInvalidFormTemplate===!0}syncFeatureTemplates(){this._featureTemplatesViewModelIsRestricted||this._updateTemplates()}zoomTo(e){let{view:n,sketchViewModel:r}=this;if(!n)return;let i=e??r?.createGraphic;if(i)i.geometry?.type===`mesh`?Z(n,i.geometry,void 0):Z(n,i,void 0);else{let e=this._getWorkingFeatures();n.type===`3d`&&e?.some(e=>e.geometry?.type===`mesh`)?Z(n,e.map(e=>e.geometry).filter(t),void 0):e&&Z(n,e,void 0)}}async toggleUpdateWorkflow(){this.canUpdate&&(!this.hasPendingEdits||await this.showDiscardEditsPrompt())&&(this.activeWorkflow&&this.state===`awaiting-feature-to-update`?await this.cancelWorkflow({force:!0}):await this.startUpdateWorkflowAtFeatureSelection())}async onSelectionListItemSelect(e){Q(e)&&await this.startUpdateWorkflowAtFeatureEdit(e.graphic)}async onSelectionListMenuItemSelect(e,t){Q(e)?await this.startUpdateWorkflowAtFeatureEdit(e.graphic):Se(e)&&await this._startUpdateWorkflowWithLayerItem(e,t)}restrictFeatureTemplatesViewModelToLayer(e){return this._featureTemplatesViewModelIsRestricted=!0,this._setFeatureTemplatesViewModelLayers([e]),c(()=>{this._featureTemplatesViewModelIsRestricted=!1,this._setFeatureTemplatesViewModelLayers(this.featureTemplatesLayers)})}async _getEditorItemCandidates(e){let{view:t}=this;if(!t?.map)return[];let{map:n}=t,r=n.editableLayers.toArray(),i=n.allTables.toArray().filter(e=>ie(e)||T(e));return await Promise.allSettled([...r.flatMap(e=>this._getLayerLoadPromise(e)),...i.flatMap(e=>this._getLayerLoadPromise(e))]),p(e),[...r.reverse(),...i.reverse()].filter(e=>re(e)&&(e.geometryType!==`mesh`||t.type===`3d`)).flatMap(e=>e.type===`subtype-group`?e.sublayers.toArray():e)}_getLayerLoadPromise(e){return T(e)?e.loadAll():e.load()}_drainEditorItems(){this.editorItems.drain(e=>e.destroy())}_updateEditorItems(){d(this._updateItemsTask);let{view:e}=this,t=n(async t=>{if(!e?.map||!e?.allLayerViews)return;let n=await this._getEditorItemCandidates(t);if(!n.length){this._drainEditorItems(),this.editorItemsLayerMap.clear();return}let r=[],i=[],a=[],{editorItemsLayerMap:o,layerInfos:s}=this;for(let t of n){let n=Te(s,t),c=await W(e,t).catch(()=>null),l=n?r:c?i:a,u=new ge({layer:t,layerInfo:n,layerView:c});l.push(u),o.set(t,u)}s?.length&&r.sort((e,t)=>s.findIndex(({layer:t})=>t===e.layer)-s.findIndex(({layer:e})=>e===t.layer));let c=[...r,...i,...a];t.aborted||(this._drainEditorItems(),this.editorItems.addMany(c))});this._updatingHandles.consumePromise(t.promise),this._updateItemsTask=t}_updateTemplates(){d(this._updateTemplatesTask);let e=n(async e=>{let t=this._templatesByLayer,n=this._featureTemplatesLayersAndTables.filter(e=>!t.has(e));if(n.length>0){let r=await ne({layers:n.toArray(),view:this.view,signal:e,queryOptions:{returnVisibleTemplatesOnly:!0}});for(let{layer:e,templates:n}of r)t.set(e,n)}this._setFeatureTemplatesViewModelLayers(this.featureTemplatesLayers)});this._updatingHandles.consumePromise(e.promise),this._updateTemplatesTask=e}_setFeatureTemplatesViewModelLayers(e){let t=this._templatesByLayer,n=[];for(let r of e){let e=t.get(r);e&&e.length>0&&n.push(ye(r,e))}this.featureTemplatesViewModel.templateInfos=n}_afterEditorItemsChange(){let{activeWorkflow:e}=this;if(this.syncFeatureTemplates(),!e)return;let{stepId:t}=e;e.type===`create-features`?t===`awaiting-feature-creation-info`&&!this.canCreate&&this._cancelWorkflow():e.type===`update`&&(t===`awaiting-feature-to-update`&&!this.canUpdateVisible||t===`awaiting-update-feature-candidate`&&!e.hasUpdatableCandidates)&&this._cancelWorkflow()}async _cancelWorkflow(e){let t=this.activeWorkflow;if(!t)e?.warnIfNoWorkflow&&this._logError(`editing:no-active-workflow`,`There is no active workflow to cancel.`);else if(!e||e.force!==!1){this.emit(`workflow-cancel`),this._set(`activeWorkflow`,null);try{await t.cancel(e)}finally{t.destroy()}}else try{await t.cancel(e),this._set(`activeWorkflow`,null),t.destroy()}catch{}}_createCreateFeaturesWorkflow(e,t){return this.formSystem===`legacy`?me.create({viewModel:this,creationInfo:e,sketchOptions:this.sketchOptions,snappingManager:this._snappingManager,startAt:t,applyEdits:(e,t,n)=>this._applyEdits(e,t,n),applyEditsFeatureService:(e,t,n)=>this._applyEditsFeatureService(e,t,n),addAttachmentsCallback:(e,t)=>this._addAttachments(e,t)}):R.create({viewModel:this,creationInfo:e,sketchOptions:this.sketchOptions,snappingManager:this._snappingManager,startAt:t,applyEdits:(e,t,n)=>this._applyEdits(e,t,n),applyEditsFeatureService:(e,t,n)=>this._applyEditsFeatureService(e,t,n),addAttachmentsCallback:(e,t)=>this._addAttachments(e,t)})}_createUpdateWorkflow(e,t){return this.formSystem===`legacy`?he.create({viewModel:this,sketchOptions:this.sketchOptions,snappingManager:this._snappingManager,startAt:e,...t,applyEdits:(e,t,n)=>this._applyEdits(e,t,n),applyEditsFeatureService:(e,t,n)=>this._applyEditsFeatureService(e,t,n),addAttachmentsCallback:(e,t)=>this._addAttachments(e,t)}):z.create({sketchOptions:this.sketchOptions,viewModel:this,snappingManager:this._snappingManager,startAt:e,...t,applyEdits:(e,t,n)=>this._applyEdits(e,t,n),applyEditsFeatureService:(e,t,n)=>this._applyEditsFeatureService(e,t,n),addAttachmentsCallback:(e,t)=>this._addAttachments(e,t),applyAttachmentEdits:(e,t)=>this._editAttachments(e,t)})}async _editAttachments(e,n){let r=[];return n.adds.forEach(t=>r.push(this._addAttachment(e,t))),n.updates.forEach(t=>r.push(this._updateAttachment(e,t))),n.deletes.forEach(t=>r.push(this._deleteAttachments(e,t))),(await Promise.all(r)).filter(t).flat()}_addAttachments(e,t){return Promise.all(t.map(t=>this._addAttachment(e,t)))}async _addAttachment(e,t){let n=null;if(!(`addAttachment`in e)||e.capabilities?.attachment==null)throw new a(`editor:attachments-not-supported`,`Adding attachments is not supported for this layer.`);let{feature:r,attachment:i,keywords:o}=t,s=o?{keywords:o}:void 0;return await this._queueOperation(async()=>(n=await e.addAttachment?.(r,i,s).catch(e=>{throw e?.error||e})??null,n)),n}async _updateAttachment(e,t){if(!(`updateAttachment`in e)||!e.updateAttachment||e.capabilities?.attachment==null)throw new a(`editor:attachments-not-supported`,`Updating attachments is not supported for this layer`);let{feature:n,attachmentId:r,attachment:i}=t,o=null;return await this._queueOperation(async()=>(o=await e.updateAttachment(n,r,i).catch(e=>{throw e?.error||e}),o)),o}async _deleteAttachments(e,t){if(!(`deleteAttachments`in e)||!e.deleteAttachments||e.capabilities?.attachment==null)throw new a(`editor:attachments-not-supported`,`Deleting attachments is not supported for this layer`);let{feature:n,attachmentIds:r}=t,i=null;return await this._queueOperation(async()=>(i=await e.deleteAttachments(n,r).catch(e=>{throw e?.error||e}),i)),i}async _applyEdits(e,t,n){let r=null,i=e.url?await E(e.url):null,a={returnServiceEditsOption:(!i||!D(i))&&!/\/hosted\//i.test(e.url)?`original-and-current-features`:void 0,editsRespectTrueCurves:!0,...n};return await this._queueOperation(async()=>{let{view:n}=this;if(!n)return null;let i=await W(n,e).catch(()=>null);return r=await e.applyEdits(t,a),i&&await x(()=>!i.updating),r}),r}async _applyEditsFeatureService(e,t,n){let r=null;return await this._queueOperation(async()=>r=await e.applyEdits(t,n)),r}_destroyWorkflowOnCommit(e){return v(()=>e,`commit`,()=>{e.destroy(),this.activeWorkflow===e&&this._set(`activeWorkflow`,null)})}_queueOperation(e){this._activityQueue.push(e);let t=(e,t)=>{let n=t.indexOf(e);n>-1&&t.splice(n,1)};return e().then(e=>(Array.isArray(e)?e.forEach(e=>this._handleEditsResultError(e)):this._handleEditsResultError(e),e)).catch(n=>{this._logError(`editing:operation-error`,`An error occurred.`,{error:n});let r={error:n,retry:()=>(t(r,this.failures),this._queueOperation(e)),cancel:()=>{t(r,this.failures)}};this._set(`failures`,[...this.failures,r])}).then(()=>{t(e,this._activityQueue)})}_handleEditsResultError(e){if(e!=null&&`error`in e&&e.error!=null)throw e.error;if(e!=null&&`addFeatureResults`in e){let{addFeatureResults:t,deleteFeatureResults:n,updateFeatureResults:r}=e,i=t.find(e=>!!e.error)||r.find(e=>!!e.error)||n.find(e=>!!e.error);if(i)throw i.error}}_createUpdatingResolver(){let e=Promise.withResolvers();return this._updatingHandles.consumePromise(e.promise),e}_logErrorAndCancelWorkflow(e){let{name:t,message:n,details:r}=e;this._logError(t??`editing:workflow-start-failed`,n??void 0,r??e),this._cancelWorkflow({force:!0})}_itemIsSuspended(e){let t=H(this.editorItems,e);return t!=null&&(!t.visible||t.disabled)}_logError(e,t,n){l.getLogger(this).error(new a(e,t,n))}_syncSelectionSources(){this._defaultSelectionManager.sources.items=this._selectionSources.toArray()}async _onSelectionComplete(e){if(e.aborted)return;let{operationType:t,selection:n}=e,{effectiveSelectionManager:r}=this;this._queuedSelectionTool=void 0;let i=[],a=[];n.forEach(e=>{let t=C(e),n=this.editorItemsLayerMap.get(t);n?.editable&&a.push(e),n?.visible!==!1&&i.push(e)});let o=i.length===1&&a.includes(i[0]);if(this.state===`ready`&&o&&t===`replace`)return this._queuedSelectionTool=e.toolName,this.startUpdateWorkflowAtFeatureEdit(i[0]);switch(t){case`remove`:r.updateSelection({current:[],added:[],removed:i});break;case`replace`:r.clear(),r.updateSelection({current:i,added:[],removed:[]});break;case`add`:r.updateSelection({current:i,added:[],removed:[]})}}async _startUpdateWorkflowWithLayerItem(e,t){if(!e.objectIds?.length)return;let n=e.featureItems.filter(e=>e.visible).map(e=>e.graphic),r=this.selectionListViewModel.filterText;if(n.length===1)return await this.startUpdateWorkflowAtFeatureEdit(n[0]);let i;if(r!=null&&r!==``){let e=U(n);if(e.length>1)throw new K;if(i=e[0],!i)throw new q(t===`merge`?2:1)}else i={layer:e.layer,objectIds:e.objectIds};t===`update`?await this.startUpdateFeaturesWorkflow(i):t===`merge`&&await this.startMergeFeaturesWorkflow(i)}_getWorkingFeatures(){let{sketchViewModel:e}=this;if(e?.createGraphic)return[e.createGraphic];if(e?.updateGraphics?.length)return e.updateGraphics.toArray();let{formViewModel:n}=this;return n?L(n)?[n.feature].filter(t):n.activeFeature?[n.activeFeature]:n.features.toArray():[]}};e([S()],$.prototype,`_defaultSelectionManager`,void 0),e([S()],$.prototype,`_featureTemplatesLayersAndTables`,null),e([S()],$.prototype,`_queuedSelectionTool`,void 0),e([S()],$.prototype,`_snappingManager`,void 0),e([S()],$.prototype,`_selectionSources`,null),e([S()],$.prototype,`activeFeatureCount`,null),e([S({readOnly:!0})],$.prototype,`activeWorkflow`,void 0),e([S()],$.prototype,`activeLeafWorkflow`,null),e([S({readOnly:!0})],$.prototype,`_activityQueue`,void 0),e([S({readOnly:!0})],$.prototype,`canCreate`,null),e([S()],$.prototype,`canCreateVisible`,null),e([S({readOnly:!0})],$.prototype,`canUpdate`,null),e([S()],$.prototype,`canUpdateVisible`,null),e([S()],$.prototype,`featureTemplatesLayers`,null),e([S()],$.prototype,`editorItems`,void 0),e([S()],$.prototype,`editorItemsLayerMap`,void 0),e([S()],$.prototype,`effectiveSelectionManager`,null),e([S({readOnly:!0})],$.prototype,`failures`,void 0),e([S()],$.prototype,`hideTemplatesForInactiveLayers`,void 0),e([S({type:A})],$.prototype,`attachmentsViewModel`,void 0),e([S()],$.prototype,`featureFormViewModel`,null),e([S()],$.prototype,`formViewModel`,null),e([S()],$.prototype,`utilityNetworkAssociationAddAssociationViewModel`,null),e([S({type:X})],$.prototype,`featureTemplatesViewModel`,void 0),e([S({type:se})],$.prototype,`labelOptions`,null),e([S()],$.prototype,`layerInfos`,void 0),e([S()],$.prototype,`useLegacyCreateTools`,null),e([S()],$.prototype,`isUsingLegacyCreateTools`,null),e([S()],$.prototype,`ownSketchViewModel`,void 0),e([S()],$.prototype,`selectionListViewModel`,void 0),e([S()],$.prototype,`selectionManager`,void 0),e([S()],$.prototype,`selectionToolbarViewModel`,void 0),e([S()],$.prototype,`sketchOptions`,void 0),e([S()],$.prototype,`sketchViewModel`,null),e([S({type:O,nonNullable:!0})],$.prototype,`snappingOptions`,void 0),e([S()],$.prototype,`spinnerViewModel`,void 0),e([S()],$.prototype,`state`,null),e([S({readOnly:!0})],$.prototype,`syncing`,null),e([S()],$.prototype,`syncViewSelection`,void 0),e([S()],$.prototype,`useViewOptions`,void 0),e([S()],$.prototype,`updating`,null),e([S({type:le})],$.prototype,`tooltipOptions`,null),e([S({type:ue})],$.prototype,`valueOptions`,null),e([S()],$.prototype,`view`,null),e([S()],$.prototype,`canZoomTo`,null),e([S()],$.prototype,`pageStack`,void 0),e([S()],$.prototype,`showDiscardEditsPrompt`,void 0),e([S()],$.prototype,`showConfirmationPrompt`,void 0),e([S()],$.prototype,`_candidateCommitted`,void 0),e([S()],$.prototype,`page`,null),e([S()],$.prototype,`formDisabled`,null),e([S()],$.prototype,`featureFormDisabled`,null),e([S()],$.prototype,`featureFormHasAssociation`,null),e([S()],$.prototype,`formHasAssociation`,null),e([S()],$.prototype,`formSystem`,void 0),e([S()],$.prototype,`canGoBack`,null),e([S()],$.prototype,`shouldShowDeleteButton`,null),e([S()],$.prototype,`hasPendingEdits`,null),e([S()],$.prototype,`snappingManager`,null),$=e([ee(`esri.widgets.Editor.EditorViewModel`)],$);const Ee=$;export{Ee as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import{isSome as t}from"../../core/arrayUtils.js";import{createTask as n}from"../../core/asyncUtils.js";import r from"../../core/Collection.js";import{deprecatedFunction as i}from"../../core/deprecate.js";import a from"../../core/Error.js";import{EventedAccessor as o}from"../../core/Evented.js";import{abortHandle as s,makeHandle as c}from"../../core/handleUtils.js";import"../../core/has.js";import l from"../../core/Logger.js";import{destroyMaybe as u,abortMaybe as d,removeMaybe as f}from"../../core/maybe.js";import{throwIfAborted as p}from"../../core/promiseUtils.js";import m from"../../core/ReactiveMap.js";import{watch as h,syncAndInitial as g,initial as _,on as v,when as y,sync as b,whenOnce as x}from"../../core/reactiveUtils.js";import{property as S,subclass as ee}from"../../core/accessorSupport/decorators.js";import{UpdatingHandles as te}from"../../core/support/UpdatingHandles.js";import{getTemplatesForLayers as ne}from"../../editing/templateUtils.js";import{getGraphicLayer as C}from"../../graphic/graphicOriginUtils.js";import w from"../../layers/GraphicsLayer.js";import{isEditableLayer as re}from"../../layers/support/editableLayers.js";import{isFeatureLayer as ie,isSubtypeGroupLayer as T,getOwningPortalUrl as E}from"../../layers/support/layerUtils.js";import{parseKnownArcGISOnlineDomain as D}from"../../portal/support/urlUtils.js";import ae from"../../views/SelectionManager.js";import{fetchFullFeaturesByObjectId as oe}from"../../views/draw/support/editingSessionUtils.js";import se from"../../views/interactive/options/LabelOptions.js";import O from"../../views/interactive/options/SnappingOptions.js";import ce from"../../views/interactive/options/TooltipOptions.js";import le from"../../views/interactive/options/ValueOptions.js";import ue from"../../views/interactive/sketch/SketchOptions.js";import{SnappingManager as de}from"../../views/interactive/snapping/SnappingManager.js";import{isSelectableLayer as k}from"../../views/support/selectionUtils.js";import A from"../Attachments/AttachmentsViewModel.js";import{isNextOrLegacyCreateFeaturesWorkflow as j,isNextOrLegacyUpdateRecordWorkflow as M,isNextOrLegacyUpdateFeaturesWorkflow as N,isNextOrLegacyMergeFeaturesWorkflow as P,isNextOrLegacySplitFeatureWorkflow as F,isNextOrLegacyUpdateWorkflow as I,isLegacyFeatureFormViewModel as L}from"./compatibilityAdapters.js";import R from"./CreateFeaturesWorkflow.js";import z from"./UpdateWorkflow.js";import{getLayersFromWorkflow as B,isBatchAttributeFormViewModel as V,findEditorItemForLayerOrThrow as H,toFeatureInfos as U,fetchFullFeatures as fe,findEditorItemForLayer as pe,whenEditorLayerView as W}from"./workflowUtils.js";import me from"./legacy/CreateFeaturesWorkflow.js";import he from"./legacy/UpdateWorkflow.js";import ge from"./support/EditorItem.js";import{assertViewNot3D as G,MultipleSourceLayersError as K,InsufficientFeatureCountError as q,MissingOriginLayerError as J,assertMergeWorkflowCapabilities as _e,FetchFullFeatureError as Y,assertSplitWorkflowCapabilities as ve}from"./support/errors.js";import{makeTemplateGroupInfoForLayer as ye}from"../FeatureTemplates/featureTemplatesUtils.js";import X from"../FeatureTemplates/FeatureTemplatesViewModel.js";import be from"../Sketch/SketchViewModel.js";import xe from"../Spinner/SpinnerViewModel.js";import{goTo as Z}from"../support/goToUtils.js";import{isFeatureItem as Q,isLayerItem as Se}from"../support/SelectionList/selectionListUtils.js";import Ce from"../support/SelectionList/SelectionListViewModel.js";import we from"../support/SelectionToolbar/SelectionToolbarViewModel.js";function Te(e,t){return e?.find(e=>e.layer===t)}let $=class extends o{constructor(e){super(e),this._defaultSelectionManager=new ae,this._queuedSelectionTool=null,this._sketchEventListenerHandle=null,this._sketchGraphicsLayer=new w({listMode:`hide`,internal:!0,title:`Editor sketch layer`}),this._snappingManager=null,this._templatesByLayer=new Map,this._updateItemsTask=null,this._updateTemplatesTask=null,this._updatingHandles=new te,this._featureTemplatesViewModelIsRestricted=!1,this.activeWorkflow=null,this._activityQueue=new r,this.editorItems=new r,this.editorItemsLayerMap=new m,this.failures=[],this.hideTemplatesForInactiveLayers=!1,this.attachmentsViewModel=new A({capabilities:{editing:!0}}),this.featureTemplatesViewModel=new X({disabledItemFunction:({layer:e})=>this._itemIsSuspended(e)}),this.layerInfos=null,this.ownSketchViewModel=new be({layer:this._sketchGraphicsLayer,useLegacyCreateTools:this._get(`useLegacyCreateTools`)??!0}),this.selectionListViewModel=new Ce,this.selectionManager=null,this.selectionToolbarViewModel=new we({continuousSelectionEnabled:!0,defaultOperationType:`replace`,persistSelection:!1,returnGeometry:!1}),this.sketchOptions=new ue,this.snappingOptions=new O({attributeRulesEnabled:!0}),this.spinnerViewModel=new xe,this.syncViewSelection=!1,this.useViewOptions=!1,this.pageStack=[],this.showDiscardEditsPrompt=()=>Promise.resolve(!0),this.showConfirmationPrompt=()=>Promise.resolve(!0),this._candidateCommitted=!1,this.formSystem=`legacy`,this.back=async()=>{this.state===`viewing-selection-list`?(this.selectionListViewModel.filterText=void 0,this.effectiveSelectionManager.clear()):this.canGoBack&&(this.activeWorkflow?.hasPreviousStep?await this.activeWorkflow.back(this.showDiscardEditsPrompt):await this._cancelWorkflow({force:!this.hasPendingEdits}))},this.saveWorkflow=async()=>await this.activeWorkflow?.save(this.showConfirmationPrompt),this.selectFeature=(e,t=!1)=>{let n=this.activeWorkflow;if(this._candidateCommitted||n?.type!==`update`)return;let{rootFeatures:r}=n.data;r.removeAll(),e&&r.add(e),t&&(n.next(),this._candidateCommitted=!0)}}initialize(){this.addHandles([h(()=>{let e=this.view,t=e?.map?.editableLayers.toArray();return[t,(e?.allLayerViews)?.filter(e=>!!t?.includes(e.layer)),this.layerInfos]},()=>this._updateEditorItems(),g),h(()=>this.hideTemplatesForInactiveLayers,()=>this.syncFeatureTemplates()),h(()=>this._selectionSources,()=>this._syncSelectionSources(),_),v(()=>this.activeWorkflow,`cancel`,()=>this.emit(`workflow-cancel`)),v(()=>this.activeWorkflow,`commit`,()=>this.emit(`workflow-commit`)),v(()=>this.activeWorkflow,`complete`,()=>{this.emit(`workflow-commit`),this._set(`activeWorkflow`,null)}),y(()=>!this.activeWorkflow&&this._queuedSelectionTool,()=>this._queuedSelectionTool&&this.selectionToolbarViewModel.activateTool(this._queuedSelectionTool)),h(()=>this.activeWorkflow,e=>this._defaultSelectionManager.highlightEnabled=!e),y(()=>this.view?.map,e=>e.add(this._sketchGraphicsLayer),_),v(()=>this.editorItems,`change`,()=>this._afterEditorItemsChange()),h(()=>[this.canCreate,this.canUpdateVisible],()=>this._afterEditorItemsChange()),h(()=>this.page,(e,t)=>{let n=[...this.pageStack];if(n.indexOf(e)===-1)n.push(e);else for(;n.length&&n.at(-1)!==e;)n.pop();this.pageStack=n},g),y(()=>this.state===`awaiting-update-feature-candidate`,()=>this._candidateCommitted=!1),v(()=>this.featureTemplatesViewModel,`select`,async({item:e,oldItem:t})=>{let{activeWorkflow:n}=this;if(n){let e=n.type===`update`&&n.activeWorkflow?.stepId===`awaiting-feature-creation-info`,r=n.type===`create-features`&&n.stepId===`awaiting-feature-creation-info`&&n.data.creationInfo?.layer&&!n.data.creationInfo?.template;if(e||r)return;try{await this.cancelWorkflow({force:!this.hasPendingEdits})}catch{this.featureTemplatesViewModel.select(t,{emit:!1});return}}if(!e)return;let r={layer:e.layer,template:e.template};if(e.supportsUpload)return this.featureTemplatesViewModel.select(t,{emit:!1}),this.startCreateFeaturesWorkflow(r);await this.startCreateFeaturesWorkflowAtFeatureCreation(r)}),h(()=>[this.view,this.featureTemplatesViewModel],([e,t])=>{t.view=e},g),v(()=>this.view,`key-down`,e=>{e.key===`Escape`&&this.activeWorkflow?.keyboardCancellationEnabled&&(e.stopPropagation(),this.back())}),v(()=>this.sketchViewModel,[`create`,`delete`,`update`],e=>{let{activeWorkflow:t}=this,n=B(t),r=`sketch-${e.type}`;this.emit(r,{type:r,detail:e,layer:n[0],layers:n})},b),h(()=>[this.sketchViewModel,this.useViewOptions],([e,t])=>{e&&(e.useViewOptions=t)},g),h(()=>this.view,e=>{if(this._snappingManager=u(this._snappingManager),!e)return;let t=this.snappingOptions;this._snappingManager=new de({view:e,options:t}),this.ownSketchViewModel.snappingManager=this._snappingManager},g),h(()=>this.snappingOptions,e=>{this._snappingManager&&(this._snappingManager.options=e)},g),v(()=>this.selectionToolbarViewModel,`complete`,e=>this._onSelectionComplete(e)),h(()=>({view:this.view,selectionManager:this.effectiveSelectionManager,selectionListViewModel:this.selectionListViewModel,selectionToolbarViewModel:this.selectionToolbarViewModel}),({view:e,selectionManager:t,selectionListViewModel:n,selectionToolbarViewModel:r})=>{t.view=e,n.view=e,r.view=e},g),h(()=>this.effectiveSelectionManager,e=>{this.selectionListViewModel.selectionManager=e,this.selectionToolbarViewModel.selectionManager=e},g)])}destroy(){this._cancelWorkflow({warnIfNoWorkflow:!1}).then(()=>{this.view?.map?.remove(this._sketchGraphicsLayer),this.view=null}),this._updateItemsTask=d(this._updateItemsTask),this._updatingHandles.destroy(),this._sketchEventListenerHandle=f(this._sketchEventListenerHandle),this.selectionListViewModel?.destroy(),this.selectionToolbarViewModel?.destroy(),this._defaultSelectionManager.destroy()}get _featureTemplatesLayersAndTables(){let e=new r;for(let t of this.editorItems){let n=this.hideTemplatesForInactiveLayers&&!t.visible;t.supportsCreateFeaturesWorkflow&&!n&&e.push(t.layer)}return e}get _selectionSources(){let e=new r;if(this.syncViewSelection||this.selectionManager)return e;for(let t of this.editorItems)k(t.layer)&&t.supportsUpdateWorkflow&&e.push(t.layer);return e}get activeFeatureCount(){let e=this.activeLeafWorkflow;return j(e)?e.pendingFeatures.length:M(e)&&e.data.edits.feature?1:N(e)?e.data.fullFeatures.length:P(e)?e.data.features.length:F(e)?2:0}get activeLeafWorkflow(){let e=this.activeWorkflow;return e&&I(e)?e.activeWorkflow??e:e}get canCreate(){return this.editorItems.some(e=>e.supportsCreateFeaturesWorkflow)}get canCreateVisible(){return!!this.featureTemplatesLayers.length}get canUpdate(){return this.editorItems.some(e=>e.supportsUpdateWorkflow)}get canUpdateVisible(){return this.editorItems.some(e=>e.supportsUpdateWorkflow&&e.visible)}get featureTemplatesLayers(){return this._featureTemplatesLayersAndTables.filter(e=>e.type===`scene`||!e.isTable)}get effectiveSelectionManager(){let e=this.view;return e&&this.syncViewSelection?e.selectionManager:this.selectionManager??this._defaultSelectionManager}get featureFormViewModel(){let e=this.activeWorkflow?.formViewModel;return L(e)?e:null}get formViewModel(){return this.activeWorkflow?.formViewModel}get utilityNetworkAssociationAddAssociationViewModel(){let{activeWorkflow:e}=this;return e?.type===`update`?e.activeUtilityNetworkAssociationAddAssociationViewModel:null}get labelOptions(){return this.sketchOptions.labels}set labelOptions(e){this.sketchOptions.labels=e}get useLegacyCreateTools(){return this.ownSketchViewModel.useLegacyCreateTools}set useLegacyCreateTools(e){this.ownSketchViewModel.useLegacyCreateTools=e}get isUsingLegacyCreateTools(){return this.useLegacyCreateTools||this.view?.type!==`2d`}get sketchViewModel(){let{activeWorkflow:e}=this;return e?.type===`update`?e.activeSketchViewModel:e?.type===`create-features`?e.sketchViewModel:this.ownSketchViewModel}get state(){if(!this.view?.ready)return`disabled`;let e=this.attachmentsViewModel.mode;if(e===`add`)return`adding-attachment`;if(e===`edit`)return`editing-attachment`;let{activeWorkflow:t}=this,n=!t?.stepId;return this.effectiveSelectionManager.count&&n?`viewing-selection-list`:n?`ready`:t.type===`update`&&t.activeWorkflow?.stepId?t.activeWorkflow.stepId:t.stepId}get syncing(){return this._activityQueue.length>0}get updating(){return this._updatingHandles.updating||this.activeWorkflow?.updating===!0}get tooltipOptions(){return this.sketchOptions.tooltips}set tooltipOptions(e){this.sketchOptions.tooltips=e}get valueOptions(){return this.sketchOptions.values}set valueOptions(e){this.sketchOptions.values=e}set view(e){this.ownSketchViewModel.view=e,this.spinnerViewModel.view=e,this._set(`view`,e)}get canZoomTo(){return this._getWorkingFeatures().some(e=>e.geometry)}get page(){let{activeWorkflow:e,state:t}=this;if(V(e?.formViewModel)){if(e?.type===`update`&&e.formViewModel?.activeAssociationsInput)return e.formViewModel.activeAssociationsInput.associatedLayer?`viewing-associated-features`:`viewing-associated-layers`}else if(e?.type===`update`&&e.formViewModel){let{associatedLayer:t,associationId:n}=e.formViewModel;if(t||n!=null)return`viewing-associated-features`}if(e?.type===`update`&&e.stepId===`awaiting-feature-to-update`)return`ready`;if(e?.type===`create-features`&&e.numPendingFeatures===0){let t=e.data.upload;if(t)return t.state==="default"?`ready`:`creating-features-upload-details`}return t??`disabled`}get formDisabled(){let{activeLeafWorkflow:e}=this;if(M(e)){let t=e.formViewModel,n=!L(t)&&t.readOnly;return e.data.editorItem?.capabilities.update.attributes===!1||t.disabled===!0||n}if(N(e)){let{formViewModel:t}=e;return t.disabled||t.readOnly}return!1}get featureFormDisabled(){let{activeLeafWorkflow:e}=this;if(M(e))return e.data.editorItem?.capabilities.update.attributes===!1||e.formViewModel.disabled===!0;if(N(e)){let{formViewModel:t}=e;return t.disabled||t.readOnly}return!1}get featureFormHasAssociation(){return!!this.featureFormViewModel?.activeAssociation}get formHasAssociation(){return!!this.formViewModel?.activeAssociation}get canGoBack(){return this.activeWorkflow!=null&&!this.syncing}get shouldShowDeleteButton(){let{activeLeafWorkflow:e}=this;if(M(e)){let{data:t}=e;return t.editorItem?.capabilities.delete.enabled&&!t.readOnly}return N(e)?e.data.editorItems.every(e=>e.capabilities.delete.enabled):!1}get hasPendingEdits(){return this.activeWorkflow?.hasPendingEdits??!1}get snappingManager(){return this._snappingManager}activateSelectionTool(e){return this.selectionToolbarViewModel.activateTool(e)}cancelSelectionTool(){this.selectionToolbarViewModel.cancel()}getTemplatesForLayer(e){return this._templatesByLayer.get(e)??[]}async startCreateFeaturesWorkflowAtFeatureTypeSelection(e){return this.startCreateFeaturesWorkflow(e)}async startCreateFeaturesWorkflowAtFeatureCreation(e){return this.startCreateFeaturesWorkflow(e,`creating-features`)}async startCreateFeaturesWorkflow(e,t=`awaiting-feature-creation-info`){if(await x(()=>!this.updating),!this.canCreate)throw new a(`editing:unsupported-workflow`,`Creating features is unsupported or disabled.`);let n=this._createUpdatingResolver();try{await this._cancelWorkflow();let n=this._createCreateFeaturesWorkflow(e,t);this._set(`activeWorkflow`,n),await n.start()}catch(e){this._logErrorAndCancelWorkflow(e)}finally{n.resolve()}}async startCreateFeaturesWorkflowAtFeatureEdit(e){await x(()=>!this.updating);let t=this._createUpdatingResolver();try{let{initialFeature:t}=e,n=t.sourceLayer=t.layer,r=n?H(this.editorItems,n):void 0;if(!r?.supportsCreateFeaturesWorkflow)throw new a(`editing:unsupported-workflow`,`Creating features is unsupported or disabled for this layer.`);await this._cancelWorkflow();let i=this._createCreateFeaturesWorkflow({initialFeature:t,layer:r.layer,maxFeatures:1},`creating-features`);this._set(`activeWorkflow`,i),await i.start()}catch(e){this._logErrorAndCancelWorkflow(e)}finally{t.resolve()}}async startMergeFeaturesWorkflow(e,t={}){await x(()=>!this.updating),G(this,`merge-features`);let n=Array.isArray(e)?U(e):[e];if(n.length>1)throw new K;if(n.length===0||n[0].objectIds.length<2)throw new q(2);let i=n[0],a=i.layer;if(!a)throw new J;let o=H(this.editorItems,a);_e(o);let c=this._createUpdatingResolver(),l=new AbortController;this.addHandles(s(l));try{await this._cancelWorkflow(),this.cancelSelectionTool();let e=await oe(i.objectIds,a,this.view?.spatialReference,l.signal);if(e.length!==i.objectIds.length)throw new Y;let n;if(t.keyFeature){let r=t.keyFeature.getObjectId();n=e.find(e=>e.getObjectId()===r)??t.keyFeature}let o=this._createUpdateWorkflow(`editing-existing-feature`,{rootFeatures:new r(e),rootWorkflowOptions:{type:`merge`,props:{...t,keyFeature:n}}});this._set(`activeWorkflow`,o),this.addHandles(this._destroyWorkflowOnCommit(o)),await o.start()}catch(e){this._logErrorAndCancelWorkflow(e)}finally{c.resolve()}}async startSplitFeatureWorkflow(e,t={}){await x(()=>!this.updating),G(this,`split-feature`);let n=C(e);if(!n)throw new J;let i=H(this.editorItems,n);ve(i);let a=this._createUpdatingResolver(),o=new AbortController;this.addHandles(s(o));try{await this._cancelWorkflow(),this.cancelSelectionTool();let i=await fe([e],n,this.view?.spatialReference,o.signal);if(i.length!==1)throw new Y;let a=this._createUpdateWorkflow(`editing-existing-feature`,{rootFeatures:new r(i),rootWorkflowOptions:{type:`split`,props:t}});this._set(`activeWorkflow`,a),this.addHandles(this._destroyWorkflowOnCommit(a)),await a.start()}catch(e){this._logErrorAndCancelWorkflow(e)}finally{a.resolve()}}async startUpdateFeaturesWorkflow(e){if(await x(()=>!this.updating),!this.canUpdate){this._logError(`editing:unsupported-workflow`,`Update features workflow is unsupported or disabled.`);return}let t=Array.isArray(e)?U(e):[e];if(t.length>1)throw new K;let n=this._createUpdatingResolver();try{await this._cancelWorkflow(),this.cancelSelectionTool();let e=this._createUpdateWorkflow(`editing-existing-feature`,{rootFeatureInfos:t,rootWorkflowOptions:{type:`update-multiple`}});e.addHandles(this._destroyWorkflowOnCommit(e)),this._set(`activeWorkflow`,e),await e.start()}catch(e){this._logErrorAndCancelWorkflow(e)}finally{n.resolve()}}async startUpdateWorkflowAtFeatureSelection(){if(await x(()=>!this.updating),!this.canUpdate){this._logError(`editing:unsupported-workflow`,`Update workflow is unsupported or disabled.`);return}let e=this._createUpdatingResolver();try{await this._cancelWorkflow();let e=this._createUpdateWorkflow();this._set(`activeWorkflow`,e),await e.start()}catch(e){this._logErrorAndCancelWorkflow(e)}finally{e.resolve()}}async startUpdateWorkflowAtMultipleFeatureSelection(e){if(await x(()=>!this.updating),!this.canUpdate){this._logError(`editing:unsupported-workflow`,`Update workflow is unsupported or disabled.`);return}let t=this._createUpdatingResolver();try{await this._cancelWorkflow();let t=this._createUpdateWorkflow(`awaiting-update-feature-candidate`);t.data.candidates=e,this._set(`activeWorkflow`,t),await t.start()}catch(e){this._logErrorAndCancelWorkflow(e)}finally{t.resolve()}}async startUpdateWorkflowAtFeatureEdit(e){if(await x(()=>!this.updating),!this.canUpdate){this._logError(`editing:unsupported-workflow`,`Update workflow is unsupported or disabled.`);return}let t=this._createUpdatingResolver();try{await this._cancelWorkflow(),this.cancelSelectionTool();let t=this._createUpdateWorkflow(`editing-existing-feature`,{rootFeatures:new r([e])});t.addHandles(this._destroyWorkflowOnCommit(t)),this._set(`activeWorkflow`,t),await t.start()}catch(e){this._logErrorAndCancelWorkflow(e)}finally{t.resolve()}}async startUpdateWorkflowWithActiveSelection(){let{selectionListViewModel:e}=this;if(!e.visibleFeatureCount||!e.visibleLayerCount)throw new a(`editing:missing-selection`,`Unable to determine visible selection.`);if(e.visibleLayerCount>1)throw new a(`editing:features-different-layers`,`Cannot start workflow with features from different layers.`);let t=e.layerItems.find(e=>e.visible);t&&await this._startUpdateWorkflowWithLayerItem(t,`update`)}async deleteFeatureFromWorkflow(){i(l.getLogger(this),`EditorViewModel.deleteFeatureFromWorkflow is deprecated. Use EditorViewModel.deleteFeatures instead.`,{version:`4.33`,replacement:`EditorViewModel.deleteFeatures`,warnOnce:!0}),await this.deleteFeatures()}async deleteFeatures(){let e=this.activeWorkflow;if(I(e))return e.deleteActiveFeatures();this._logError(`editing:unsupported-workflow`,`Deleting features requires an active update workflow.`)}async deleteAssociationFromWorkflow(){let{activeWorkflow:e}=this;!e||e.type!==`update`?this._logError(`editing:unsupported-workflow`,`Deleting an association requires an active update workflow.`):await e.deleteActiveAssociation()}async cancelWorkflow(e){return this._cancelWorkflow({warnIfNoWorkflow:!0,...e})}itemHasInvalidFormTemplate(e){return e!=null&&pe(this.editorItems,e.layer)?.hasInvalidFormTemplate===!0}syncFeatureTemplates(){this._featureTemplatesViewModelIsRestricted||this._updateTemplates()}zoomTo(e){let{view:n,sketchViewModel:r}=this;if(!n)return;let i=e??r?.createGraphic;if(i)i.geometry?.type===`mesh`?Z(n,i.geometry,void 0):Z(n,i,void 0);else{let e=this._getWorkingFeatures();n.type===`3d`&&e?.some(e=>e.geometry?.type===`mesh`)?Z(n,e.map(e=>e.geometry).filter(t),void 0):e&&Z(n,e,void 0)}}async toggleUpdateWorkflow(){this.canUpdate&&(!this.hasPendingEdits||await this.showDiscardEditsPrompt())&&(this.activeWorkflow&&this.state===`awaiting-feature-to-update`?await this.cancelWorkflow({force:!0}):await this.startUpdateWorkflowAtFeatureSelection())}async onSelectionListItemSelect(e){Q(e)&&await this.startUpdateWorkflowAtFeatureEdit(e.graphic)}async onSelectionListMenuItemSelect(e,t){Q(e)?await this.startUpdateWorkflowAtFeatureEdit(e.graphic):Se(e)&&await this._startUpdateWorkflowWithLayerItem(e,t)}restrictFeatureTemplatesViewModelToLayer(e){return this._featureTemplatesViewModelIsRestricted=!0,this._setFeatureTemplatesViewModelLayers([e]),c(()=>{this._featureTemplatesViewModelIsRestricted=!1,this._setFeatureTemplatesViewModelLayers(this.featureTemplatesLayers)})}async _getEditorItemCandidates(e){let{view:t}=this;if(!t?.map)return[];let{map:n}=t,r=n.editableLayers.toArray(),i=n.allTables.toArray().filter(e=>ie(e)||T(e));return await Promise.allSettled([...r.flatMap(e=>this._getLayerLoadPromise(e)),...i.flatMap(e=>this._getLayerLoadPromise(e))]),p(e),[...r.reverse(),...i.reverse()].filter(e=>re(e)&&(e.geometryType!==`mesh`||t.type===`3d`)).flatMap(e=>e.type===`subtype-group`?e.sublayers.toArray():e)}_getLayerLoadPromise(e){return T(e)?e.loadAll():e.load()}_drainEditorItems(){this.editorItems.drain(e=>e.destroy())}_updateEditorItems(){d(this._updateItemsTask);let{view:e}=this,t=n(async t=>{if(!e?.map||!e?.allLayerViews)return;let n=await this._getEditorItemCandidates(t);if(!n.length){this._drainEditorItems(),this.editorItemsLayerMap.clear();return}let r=[],i=[],a=[],{editorItemsLayerMap:o,layerInfos:s}=this;for(let t of n){let n=Te(s,t),c=await W(e,t).catch(()=>null),l=n?r:c?i:a,u=new ge({layer:t,layerInfo:n,layerView:c});l.push(u),o.set(t,u)}s?.length&&r.sort((e,t)=>s.findIndex(({layer:t})=>t===e.layer)-s.findIndex(({layer:e})=>e===t.layer));let c=[...r,...i,...a];t.aborted||(this._drainEditorItems(),this.editorItems.addMany(c))});this._updatingHandles.consumePromise(t.promise),this._updateItemsTask=t}_updateTemplates(){d(this._updateTemplatesTask);let e=n(async e=>{let t=this._templatesByLayer,n=this._featureTemplatesLayersAndTables.filter(e=>!t.has(e));if(n.length>0){let r=await ne({layers:n.toArray(),view:this.view,signal:e,queryOptions:{returnVisibleTemplatesOnly:!0}});for(let{layer:e,templates:n}of r)t.set(e,n)}this._setFeatureTemplatesViewModelLayers(this.featureTemplatesLayers)});this._updatingHandles.consumePromise(e.promise),this._updateTemplatesTask=e}_setFeatureTemplatesViewModelLayers(e){let t=this._templatesByLayer,n=[];for(let r of e){let e=t.get(r);e&&e.length>0&&n.push(ye(r,e))}this.featureTemplatesViewModel.templateInfos=n}_afterEditorItemsChange(){let{activeWorkflow:e}=this;if(this.syncFeatureTemplates(),!e)return;let{stepId:t}=e;e.type===`create-features`?t===`awaiting-feature-creation-info`&&!this.canCreate&&this._cancelWorkflow():e.type===`update`&&(t===`awaiting-feature-to-update`&&!this.canUpdateVisible||t===`awaiting-update-feature-candidate`&&!e.hasUpdatableCandidates)&&this._cancelWorkflow()}async _cancelWorkflow(e){let t=this.activeWorkflow;if(!t)e?.warnIfNoWorkflow&&this._logError(`editing:no-active-workflow`,`There is no active workflow to cancel.`);else if(!e||e.force!==!1){this.emit(`workflow-cancel`),this._set(`activeWorkflow`,null);try{await t.cancel(e)}finally{t.destroy()}}else try{await t.cancel(e),this._set(`activeWorkflow`,null),t.destroy()}catch{}}_createCreateFeaturesWorkflow(e,t){return this.formSystem===`legacy`?me.create({viewModel:this,creationInfo:e,sketchOptions:this.sketchOptions,snappingManager:this._snappingManager,startAt:t,applyEdits:(e,t,n)=>this._applyEdits(e,t,n),applyEditsFeatureService:(e,t,n)=>this._applyEditsFeatureService(e,t,n),addAttachmentsCallback:(e,t)=>this._addAttachments(e,t)}):R.create({viewModel:this,creationInfo:e,sketchOptions:this.sketchOptions,snappingManager:this._snappingManager,startAt:t,applyEdits:(e,t,n)=>this._applyEdits(e,t,n),applyEditsFeatureService:(e,t,n)=>this._applyEditsFeatureService(e,t,n),addAttachmentsCallback:(e,t)=>this._addAttachments(e,t)})}_createUpdateWorkflow(e,t){return this.formSystem===`legacy`?he.create({viewModel:this,sketchOptions:this.sketchOptions,snappingManager:this._snappingManager,startAt:e,...t,applyEdits:(e,t,n)=>this._applyEdits(e,t,n),applyEditsFeatureService:(e,t,n)=>this._applyEditsFeatureService(e,t,n),addAttachmentsCallback:(e,t)=>this._addAttachments(e,t)}):z.create({sketchOptions:this.sketchOptions,viewModel:this,snappingManager:this._snappingManager,startAt:e,...t,applyEdits:(e,t,n)=>this._applyEdits(e,t,n),applyEditsFeatureService:(e,t,n)=>this._applyEditsFeatureService(e,t,n),addAttachmentsCallback:(e,t)=>this._addAttachments(e,t),applyAttachmentEdits:(e,t)=>this._editAttachments(e,t)})}async _editAttachments(e,n){let r=[];return n.adds.forEach(t=>r.push(this._addAttachment(e,t))),n.updates.forEach(t=>r.push(this._updateAttachment(e,t))),n.deletes.forEach(t=>r.push(this._deleteAttachments(e,t))),(await Promise.all(r)).filter(t).flat()}_addAttachments(e,t){return Promise.all(t.map(t=>this._addAttachment(e,t)))}async _addAttachment(e,t){let n=null;if(!(`addAttachment`in e)||e.capabilities?.attachment==null)throw new a(`editor:attachments-not-supported`,`Adding attachments is not supported for this layer.`);let{feature:r,attachment:i,keywords:o}=t,s=o?{keywords:o}:void 0;return await this._queueOperation(async()=>(n=await e.addAttachment?.(r,i,s).catch(e=>{throw e?.error||e})??null,n)),n}async _updateAttachment(e,t){if(!(`updateAttachment`in e)||!e.updateAttachment||e.capabilities?.attachment==null)throw new a(`editor:attachments-not-supported`,`Updating attachments is not supported for this layer`);let{feature:n,attachmentId:r,attachment:i}=t,o=null;return await this._queueOperation(async()=>(o=await e.updateAttachment(n,r,i).catch(e=>{throw e?.error||e}),o)),o}async _deleteAttachments(e,t){if(!(`deleteAttachments`in e)||!e.deleteAttachments||e.capabilities?.attachment==null)throw new a(`editor:attachments-not-supported`,`Deleting attachments is not supported for this layer`);let{feature:n,attachmentIds:r}=t,i=null;return await this._queueOperation(async()=>(i=await e.deleteAttachments(n,r).catch(e=>{throw e?.error||e}),i)),i}async _applyEdits(e,t,n){let r=null,i=e.url?await E(e.url):null,a={returnServiceEditsOption:(!i||!D(i))&&!/\/hosted\//i.test(e.url)?`original-and-current-features`:void 0,editsRespectTrueCurves:!0,...n};return await this._queueOperation(async()=>{let{view:n}=this;if(!n)return null;let i=await W(n,e).catch(()=>null);return r=await e.applyEdits(t,a),i&&await x(()=>!i.updating),r}),r}async _applyEditsFeatureService(e,t,n){let r=null;return await this._queueOperation(async()=>r=await e.applyEdits(t,n)),r}_destroyWorkflowOnCommit(e){return v(()=>e,`commit`,()=>{e.destroy(),this.activeWorkflow===e&&this._set(`activeWorkflow`,null)})}_queueOperation(e){this._activityQueue.push(e);let t=(e,t)=>{let n=t.indexOf(e);n>-1&&t.splice(n,1)};return e().then(e=>(Array.isArray(e)?e.forEach(e=>this._handleEditsResultError(e)):this._handleEditsResultError(e),e)).catch(n=>{this._logError(`editing:operation-error`,`An error occurred.`,{error:n});let r={error:n,retry:()=>(t(r,this.failures),this._queueOperation(e)),cancel:()=>{t(r,this.failures)}};this._set(`failures`,[...this.failures,r])}).then(()=>{t(e,this._activityQueue)})}_handleEditsResultError(e){if(e!=null&&`error`in e&&e.error!=null)throw e.error;if(e!=null&&`addFeatureResults`in e){let{addFeatureResults:t,deleteFeatureResults:n,updateFeatureResults:r}=e,i=t.find(e=>!!e.error)||r.find(e=>!!e.error)||n.find(e=>!!e.error);if(i)throw i.error}}_createUpdatingResolver(){let e=Promise.withResolvers();return this._updatingHandles.consumePromise(e.promise),e}_logErrorAndCancelWorkflow(e){let{name:t,message:n,details:r}=e;this._logError(t??`editing:workflow-start-failed`,n??void 0,r??e),this._cancelWorkflow({force:!0})}_itemIsSuspended(e){let t=H(this.editorItems,e);return t!=null&&(!t.visible||t.disabled)}_logError(e,t,n){l.getLogger(this).error(new a(e,t,n))}_syncSelectionSources(){this._defaultSelectionManager.sources.items=this._selectionSources.toArray()}async _onSelectionComplete(e){if(e.aborted)return;let{operationType:t,selection:n}=e,{effectiveSelectionManager:r}=this;this._queuedSelectionTool=void 0;let i=[],a=[];n.forEach(e=>{let t=C(e),n=this.editorItemsLayerMap.get(t);n?.editable&&a.push(e),n?.visible!==!1&&i.push(e)});let o=i.length===1&&a.includes(i[0]);if(this.state===`ready`&&o&&t===`replace`)return this._queuedSelectionTool=e.toolName,this.startUpdateWorkflowAtFeatureEdit(i[0]);switch(t){case`remove`:r.updateSelection({current:[],added:[],removed:i});break;case`replace`:r.clear(),r.updateSelection({current:i,added:[],removed:[]});break;case`add`:r.updateSelection({current:i,added:[],removed:[]})}}async _startUpdateWorkflowWithLayerItem(e,t){if(!e.objectIds?.length)return;let n=e.featureItems.filter(e=>e.visible).map(e=>e.graphic),r=this.selectionListViewModel.filterText;if(n.length===1)return await this.startUpdateWorkflowAtFeatureEdit(n[0]);let i;if(r!=null&&r!==``){let e=U(n);if(e.length>1)throw new K;if(i=e[0],!i)throw new q(t===`merge`?2:1)}else i={layer:e.layer,objectIds:e.objectIds};t===`update`?await this.startUpdateFeaturesWorkflow(i):t===`merge`&&await this.startMergeFeaturesWorkflow(i)}_getWorkingFeatures(){let{sketchViewModel:e}=this;if(e?.createGraphic)return[e.createGraphic];if(e?.updateGraphics?.length)return e.updateGraphics.toArray();let{formViewModel:n}=this;return n?L(n)?[n.feature].filter(t):n.activeFeature?[n.activeFeature]:n.features.toArray():[]}};e([S()],$.prototype,`_defaultSelectionManager`,void 0),e([S()],$.prototype,`_featureTemplatesLayersAndTables`,null),e([S()],$.prototype,`_queuedSelectionTool`,void 0),e([S()],$.prototype,`_snappingManager`,void 0),e([S()],$.prototype,`_selectionSources`,null),e([S()],$.prototype,`activeFeatureCount`,null),e([S({readOnly:!0})],$.prototype,`activeWorkflow`,void 0),e([S()],$.prototype,`activeLeafWorkflow`,null),e([S({readOnly:!0})],$.prototype,`_activityQueue`,void 0),e([S({readOnly:!0})],$.prototype,`canCreate`,null),e([S()],$.prototype,`canCreateVisible`,null),e([S({readOnly:!0})],$.prototype,`canUpdate`,null),e([S()],$.prototype,`canUpdateVisible`,null),e([S()],$.prototype,`featureTemplatesLayers`,null),e([S()],$.prototype,`editorItems`,void 0),e([S()],$.prototype,`editorItemsLayerMap`,void 0),e([S()],$.prototype,`effectiveSelectionManager`,null),e([S({readOnly:!0})],$.prototype,`failures`,void 0),e([S()],$.prototype,`hideTemplatesForInactiveLayers`,void 0),e([S({type:A})],$.prototype,`attachmentsViewModel`,void 0),e([S()],$.prototype,`featureFormViewModel`,null),e([S()],$.prototype,`formViewModel`,null),e([S()],$.prototype,`utilityNetworkAssociationAddAssociationViewModel`,null),e([S({type:X})],$.prototype,`featureTemplatesViewModel`,void 0),e([S({type:se})],$.prototype,`labelOptions`,null),e([S()],$.prototype,`layerInfos`,void 0),e([S()],$.prototype,`useLegacyCreateTools`,null),e([S()],$.prototype,`isUsingLegacyCreateTools`,null),e([S()],$.prototype,`ownSketchViewModel`,void 0),e([S()],$.prototype,`selectionListViewModel`,void 0),e([S()],$.prototype,`selectionManager`,void 0),e([S()],$.prototype,`selectionToolbarViewModel`,void 0),e([S()],$.prototype,`sketchOptions`,void 0),e([S()],$.prototype,`sketchViewModel`,null),e([S({type:O,nonNullable:!0})],$.prototype,`snappingOptions`,void 0),e([S()],$.prototype,`spinnerViewModel`,void 0),e([S()],$.prototype,`state`,null),e([S({readOnly:!0})],$.prototype,`syncing`,null),e([S()],$.prototype,`syncViewSelection`,void 0),e([S()],$.prototype,`useViewOptions`,void 0),e([S()],$.prototype,`updating`,null),e([S({type:ce})],$.prototype,`tooltipOptions`,null),e([S({type:le})],$.prototype,`valueOptions`,null),e([S()],$.prototype,`view`,null),e([S()],$.prototype,`canZoomTo`,null),e([S()],$.prototype,`pageStack`,void 0),e([S()],$.prototype,`showDiscardEditsPrompt`,void 0),e([S()],$.prototype,`showConfirmationPrompt`,void 0),e([S()],$.prototype,`_candidateCommitted`,void 0),e([S()],$.prototype,`page`,null),e([S()],$.prototype,`formDisabled`,null),e([S()],$.prototype,`featureFormDisabled`,null),e([S()],$.prototype,`featureFormHasAssociation`,null),e([S()],$.prototype,`formHasAssociation`,null),e([S()],$.prototype,`formSystem`,void 0),e([S()],$.prototype,`canGoBack`,null),e([S()],$.prototype,`shouldShowDeleteButton`,null),e([S()],$.prototype,`hasPendingEdits`,null),e([S()],$.prototype,`snappingManager`,null),$=e([ee(`esri.widgets.Editor.EditorViewModel`)],$);const Ee=$;export{Ee as default};
|
package/widgets/Editor.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type Graphic from "../Graphic.js";
|
|
2
2
|
import type Collection from "../core/Collection.js";
|
|
3
3
|
import type SelectionManager from "../views/SelectionManager.js";
|
|
4
|
-
import type
|
|
5
|
-
import type
|
|
6
|
-
import type
|
|
7
|
-
import type
|
|
4
|
+
import type LabelOptions from "../views/interactive/options/LabelOptions.js";
|
|
5
|
+
import type SnappingOptions from "../views/interactive/options/SnappingOptions.js";
|
|
6
|
+
import type TooltipOptions from "../views/interactive/options/TooltipOptions.js";
|
|
7
|
+
import type ValueOptions from "../views/interactive/options/ValueOptions.js";
|
|
8
8
|
import type SelectionOperation from "../views/selection/SelectionOperation.js";
|
|
9
9
|
import type Widget from "./Widget.js";
|
|
10
10
|
import type EditorViewModel from "./Editor/EditorViewModel.js";
|
|
@@ -17,10 +17,10 @@ import type { WidgetProperties } from "./Widget.js";
|
|
|
17
17
|
import type { EditorViewModelEvents, EditorViewModelProperties } from "./Editor/EditorViewModel.js";
|
|
18
18
|
import type { CancelWorkflowOptions, CreationInfo, EditorStartCreateFeaturesWorkflowAtFeatureEditParameters as EditorStartCreateFeaturesWorkflowAtFeatureEditParametersExternal, EditorStartCreateFeaturesWorkflowAtFeatureTypeSelectionParameters, EditorStartMergeFeaturesWorkflowOptions as EditorStartMergeFeaturesWorkflowOptionExternal, EditorStartSplitFeatureWorkflowOptions as EditorStartSplitFeatureWorkflowOptionsExternal, FeatureInfo, LayerInfo, SupportingWidgetDefaults } from "./Editor/types.js";
|
|
19
19
|
import type { HeadingLevel } from "./support/types.js";
|
|
20
|
-
import type {
|
|
21
|
-
import type { SnappingOptionsProperties } from "../views/interactive/
|
|
22
|
-
import type {
|
|
23
|
-
import type {
|
|
20
|
+
import type { LabelOptionsProperties } from "../views/interactive/options/LabelOptions.js";
|
|
21
|
+
import type { SnappingOptionsProperties } from "../views/interactive/options/SnappingOptions.js";
|
|
22
|
+
import type { TooltipOptionsProperties } from "../views/interactive/options/TooltipOptions.js";
|
|
23
|
+
import type { ValueOptionsProperties } from "../views/interactive/options/ValueOptions.js";
|
|
24
24
|
import type { VisibleElementsProperties } from "./Editor/VisibleElements.js";
|
|
25
25
|
|
|
26
26
|
export interface EditorProperties extends WidgetProperties, Partial<Pick<Editor, "formSystem" | "headingLevel" | "layerInfos" | "selectionManager" | "supportingWidgetDefaults" | "syncViewSelection" | "syncWithViewSelectionManager" | "useLegacyCreateTools" | "useViewOptions" | "view">> {
|
|
@@ -45,9 +45,9 @@ export interface EditorProperties extends WidgetProperties, Partial<Pick<Editor,
|
|
|
45
45
|
*
|
|
46
46
|
* @since 4.24
|
|
47
47
|
*/
|
|
48
|
-
labelOptions?:
|
|
48
|
+
labelOptions?: LabelOptionsProperties;
|
|
49
49
|
/**
|
|
50
|
-
* The [SnappingOptions](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/
|
|
50
|
+
* The [SnappingOptions](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/SnappingOptions/) for editing. Supports self snapping and feature snapping. Starting with version 4.23, the [SnappingControls](https://developers.arcgis.com/javascript/latest/references/core/widgets/support/SnappingControls/) UI is automatically integrated into the Editor widget.
|
|
51
51
|
* Modify the `snappingOptions` if modifications are needed from what is provided in the default UI.
|
|
52
52
|
*
|
|
53
53
|
* @since 4.19
|
|
@@ -71,13 +71,13 @@ export interface EditorProperties extends WidgetProperties, Partial<Pick<Editor,
|
|
|
71
71
|
*
|
|
72
72
|
* @since 4.24
|
|
73
73
|
*/
|
|
74
|
-
tooltipOptions?:
|
|
74
|
+
tooltipOptions?: TooltipOptionsProperties;
|
|
75
75
|
/**
|
|
76
76
|
* Options to configure how values are displayed and input when creating or updating graphics.
|
|
77
77
|
*
|
|
78
78
|
* @since 4.29
|
|
79
79
|
*/
|
|
80
|
-
valueOptions?:
|
|
80
|
+
valueOptions?: ValueOptionsProperties;
|
|
81
81
|
/**
|
|
82
82
|
* The view model for this widget. This is a class that contains all the logic
|
|
83
83
|
* (properties and methods) that controls this widget's behavior. See the
|
|
@@ -192,7 +192,7 @@ export interface EditorEvents extends EditorViewModelEvents {}
|
|
|
192
192
|
* Coordinate inputs and editing constraints are helpful to achieve greater control while drawing features.
|
|
193
193
|
* Press `Tab` to activate the input mode while drawing a new feature, or when editing a point, mesh, or a selected vertex.
|
|
194
194
|
*
|
|
195
|
-
* See more about the available tooltip inputs and constraints under the [tooltip options](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/
|
|
195
|
+
* See more about the available tooltip inputs and constraints under the [tooltip options](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/TooltipOptions/) class.
|
|
196
196
|
*
|
|
197
197
|
* <video src="https://developers.arcgis.com/javascript/latest/assets/references/core/widgets/editor/editing-constraints.webm" aria-label="editing constraints" autoplay muted playsinline loop></video>
|
|
198
198
|
*
|
|
@@ -354,10 +354,10 @@ export interface EditorEvents extends EditorViewModelEvents {}
|
|
|
354
354
|
* @see [UpdateWorkflowData](https://developers.arcgis.com/javascript/latest/references/core/widgets/Editor/UpdateWorkflowData/)
|
|
355
355
|
* @see [DefaultUI](https://developers.arcgis.com/javascript/latest/references/core/views/ui/DefaultUI/)
|
|
356
356
|
* @see [FeatureLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/)
|
|
357
|
-
* @see [
|
|
358
|
-
* @see [
|
|
359
|
-
* @see [
|
|
360
|
-
* @see [SnappingOptions](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/
|
|
357
|
+
* @see [LabelOptions](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/LabelOptions/)
|
|
358
|
+
* @see [TooltipOptions](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/TooltipOptions/)
|
|
359
|
+
* @see [ValueOptions](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/ValueOptions/)
|
|
360
|
+
* @see [SnappingOptions](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/SnappingOptions/)
|
|
361
361
|
* @see [SnappingControls](https://developers.arcgis.com/javascript/latest/references/core/widgets/support/SnappingControls/)
|
|
362
362
|
* @example
|
|
363
363
|
* // At the very minimum, set the Editor's view
|
|
@@ -458,8 +458,8 @@ export default class Editor extends Widget {
|
|
|
458
458
|
*
|
|
459
459
|
* @since 4.24
|
|
460
460
|
*/
|
|
461
|
-
get labelOptions():
|
|
462
|
-
set labelOptions(value:
|
|
461
|
+
get labelOptions(): LabelOptions;
|
|
462
|
+
set labelOptions(value: LabelOptionsProperties);
|
|
463
463
|
/**
|
|
464
464
|
* An array of editing configurations for individual layers. It is possible to iterate through the map's [Map.editableLayers](https://developers.arcgis.com/javascript/latest/references/core/Map/#editableLayers) and configure these individual layers as needed.
|
|
465
465
|
*
|
|
@@ -503,7 +503,7 @@ export default class Editor extends Widget {
|
|
|
503
503
|
*/
|
|
504
504
|
accessor selectionManager: SelectionManager | null | undefined;
|
|
505
505
|
/**
|
|
506
|
-
* The [SnappingOptions](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/
|
|
506
|
+
* The [SnappingOptions](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/options/SnappingOptions/) for editing. Supports self snapping and feature snapping. Starting with version 4.23, the [SnappingControls](https://developers.arcgis.com/javascript/latest/references/core/widgets/support/SnappingControls/) UI is automatically integrated into the Editor widget.
|
|
507
507
|
* Modify the `snappingOptions` if modifications are needed from what is provided in the default UI.
|
|
508
508
|
*
|
|
509
509
|
* @since 4.19
|
|
@@ -560,8 +560,8 @@ export default class Editor extends Widget {
|
|
|
560
560
|
*
|
|
561
561
|
* @since 4.24
|
|
562
562
|
*/
|
|
563
|
-
get tooltipOptions():
|
|
564
|
-
set tooltipOptions(value:
|
|
563
|
+
get tooltipOptions(): TooltipOptions;
|
|
564
|
+
set tooltipOptions(value: TooltipOptionsProperties);
|
|
565
565
|
/**
|
|
566
566
|
* Starting with 5.0, Editor is transitioning to a next generation geometry
|
|
567
567
|
* creation experience. This new experience enables the use of advanced curve
|
|
@@ -613,8 +613,8 @@ export default class Editor extends Widget {
|
|
|
613
613
|
*
|
|
614
614
|
* @since 4.29
|
|
615
615
|
*/
|
|
616
|
-
get valueOptions():
|
|
617
|
-
set valueOptions(value:
|
|
616
|
+
get valueOptions(): ValueOptions;
|
|
617
|
+
set valueOptions(value: ValueOptionsProperties);
|
|
618
618
|
/** A reference to the [MapView](https://developers.arcgis.com/javascript/latest/references/core/views/MapView/) or [SceneView](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/). This view provides the editable layers for the Editor widget. */
|
|
619
619
|
accessor view: MapViewOrSceneView | null | undefined;
|
|
620
620
|
/**
|