@arcgis/core 5.2.0-next.113 → 5.2.0-next.115
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/Graphic.d.ts +5 -3
- package/Ground.d.ts +5 -4
- package/applications/Urban/LineImagePattern3D.js +1 -1
- package/arcgisGlobal.d.ts +2 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/02f94f9d704f03ddb5c6.js +1 -0
- package/assets/esri/core/workers/chunks/{c517e732cab41093b2e0.js → 0312c40d94b248ad71e3.js} +1 -1
- package/assets/esri/core/workers/chunks/0463c807b37f01bbc35c.js +1 -0
- package/assets/esri/core/workers/chunks/0ff13f7a18b0123d253e.js +1 -0
- package/assets/esri/core/workers/chunks/2e0fd0536408053ac6f5.js +1 -0
- package/assets/esri/core/workers/chunks/{6b264006b96cbf93d8ed.js → 48d3da636be15581fd7d.js} +1 -1
- package/assets/esri/core/workers/chunks/515fe302743c0b46f7e0.js +1 -0
- package/assets/esri/core/workers/chunks/{982a396bd4fffa62e911.js → 526cc64ae46dec3fbeda.js} +1 -1
- package/assets/esri/core/workers/chunks/{d13cf2e8b24e978ea77c.js → 7243d5721bb6a7329055.js} +1 -1
- package/assets/esri/core/workers/chunks/{785206da3962ba23de16.js → 84b89c523d3e16a5ee46.js} +1 -1
- package/assets/esri/core/workers/chunks/{484b3e2a220c440ccbb4.js → 9b92c41907e2da80c288.js} +1 -1
- package/assets/esri/core/workers/chunks/{4d2553219ffd223b0e90.js → a774006be107e449bc29.js} +1 -1
- package/assets/esri/core/workers/chunks/b45ebb1b64ee7314375e.js +1 -0
- package/assets/esri/core/workers/chunks/{e0f417992889a6c41095.js → baa8bce361a2677533ec.js} +1 -1
- package/assets/esri/core/workers/chunks/{96ebf76661b12128ddd5.js → be4de7111bc21bc69de1.js} +1 -1
- package/assets/esri/core/workers/chunks/f18ee2eaa96d103627a6.js +1 -0
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.ar.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.bg.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.bs.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.ca.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.cs.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.da.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.de.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.el.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.es.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.et.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.fi.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.fr.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.he.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.hr.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.hu.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.id.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.it.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.ja.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.ko.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.lt.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.lv.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.nl.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.no.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.pl.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.pt-BR.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.pt-PT.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.ro.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.ru.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.sk.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.sl.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.sr.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.sv.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.th.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.tr.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.uk.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.vi.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.zh-CN.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.zh-HK.json +1 -1
- package/assets/esri/views/3d/analysis/ShadowCast/t9n/messages.zh-TW.json +1 -1
- package/assets/esri/views/3d/analysis/VolumeMeasurement/t9n/messages.ja.json +1 -1
- package/assets/esri/views/3d/environment/resources/milkyway-band.ktx2 +0 -0
- package/assets/esri/widgets/DistanceMeasurement2D/t9n/messages.de.json +1 -1
- package/assets/esri/widgets/DistanceMeasurement2D/t9n/messages.ro.json +1 -1
- package/assets/esri/widgets/Expand/t9n/messages.id.json +1 -1
- package/assets/esri/widgets/Features/t9n/messages.he.json +1 -1
- package/assets/esri/widgets/Features/t9n/messages.uk.json +1 -1
- package/assets/esri/widgets/Home/t9n/messages.bs.json +1 -1
- package/assets/esri/widgets/Home/t9n/messages.de.json +1 -1
- package/assets/esri/widgets/Home/t9n/messages.et.json +1 -1
- package/assets/esri/widgets/Home/t9n/messages.fi.json +1 -1
- package/assets/esri/widgets/Home/t9n/messages.hr.json +1 -1
- package/assets/esri/widgets/Home/t9n/messages.hu.json +1 -1
- package/assets/esri/widgets/Home/t9n/messages.id.json +1 -1
- package/assets/esri/widgets/Home/t9n/messages.lv.json +1 -1
- package/assets/esri/widgets/Home/t9n/messages.nl.json +1 -1
- package/assets/esri/widgets/Home/t9n/messages.pt-PT.json +1 -1
- package/assets/esri/widgets/Home/t9n/messages.th.json +1 -1
- package/assets/esri/widgets/Home/t9n/messages.tr.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/messages.de.json +1 -1
- package/assets/esri/widgets/Print/t9n/messages.es.json +1 -1
- package/assets/esri/widgets/Print/t9n/messages.it.json +1 -1
- package/assets/esri/widgets/Print/t9n/messages.lt.json +1 -1
- package/assets/esri/widgets/Print/t9n/messages.pt-PT.json +1 -1
- package/assets/esri/widgets/Print/t9n/messages.sl.json +1 -1
- package/assets/esri/widgets/Print/t9n/messages.sr.json +1 -1
- package/assets/esri/widgets/Search/t9n/messages.bs.json +1 -1
- package/assets/esri/widgets/Search/t9n/messages.de.json +1 -1
- package/assets/esri/widgets/Search/t9n/messages.es.json +1 -1
- package/assets/esri/widgets/Search/t9n/messages.et.json +1 -1
- package/assets/esri/widgets/Search/t9n/messages.fi.json +1 -1
- package/assets/esri/widgets/Search/t9n/messages.he.json +1 -1
- package/assets/esri/widgets/Search/t9n/messages.hr.json +1 -1
- package/assets/esri/widgets/Search/t9n/messages.it.json +1 -1
- package/assets/esri/widgets/Search/t9n/messages.lv.json +1 -1
- package/assets/esri/widgets/smartMapping/HeatmapSlider/t9n/messages.ar.json +1 -1
- package/assets/esri/widgets/smartMapping/HeatmapSlider/t9n/messages.ca.json +1 -1
- package/assets/esri/widgets/smartMapping/HeatmapSlider/t9n/messages.cs.json +1 -1
- package/assets/esri/widgets/smartMapping/HeatmapSlider/t9n/messages.el.json +1 -1
- package/assets/esri/widgets/smartMapping/HeatmapSlider/t9n/messages.es.json +1 -1
- package/assets/esri/widgets/smartMapping/HeatmapSlider/t9n/messages.fi.json +1 -1
- package/assets/esri/widgets/smartMapping/HeatmapSlider/t9n/messages.he.json +1 -1
- package/assets/esri/widgets/smartMapping/HeatmapSlider/t9n/messages.it.json +1 -1
- package/assets/esri/widgets/smartMapping/HeatmapSlider/t9n/messages.lt.json +1 -1
- package/assets/esri/widgets/smartMapping/HeatmapSlider/t9n/messages.lv.json +1 -1
- package/assets/esri/widgets/smartMapping/HeatmapSlider/t9n/messages.pl.json +1 -1
- package/assets/esri/widgets/smartMapping/HeatmapSlider/t9n/messages.ro.json +1 -1
- package/assets/esri/widgets/smartMapping/HeatmapSlider/t9n/messages.ru.json +1 -1
- package/assets/esri/widgets/smartMapping/HeatmapSlider/t9n/messages.sl.json +1 -1
- package/assets/esri/widgets/smartMapping/HeatmapSlider/t9n/messages.uk.json +1 -1
- package/assets/esri/widgets/support/GridControls/t9n/messages.pt-BR.json +1 -1
- package/chunks/DeepSky.glsl.js +1 -1
- package/chunks/RibbonLine.glsl.js +63 -58
- package/config.js +1 -1
- package/core/Evented.d.ts +1 -1
- package/core/screenUtils.js +1 -1
- package/core/units.js +1 -1
- package/form/elements/AttachmentElement.d.ts +5 -5
- package/form/elements/inputs/attachments/AttachmentInput.d.ts +1 -1
- package/graphic/getGraphicOriginTitle.d.ts +10 -0
- package/graphic/getGraphicOriginTitle.js +2 -0
- package/kernel.js +1 -1
- package/layers/FeatureLayer.d.ts +2 -2
- package/layers/MapNotesLayer.js +1 -1
- package/layers/raster/functions/rasterProjectionHelper.js +1 -1
- package/layers/support/FeatureReductionBinning.d.ts +2 -2
- package/layers/support/FeatureReductionCluster.d.ts +2 -2
- package/layers/support/Field.js +1 -1
- package/layers/support/SubtypeSublayer.d.ts +1 -1
- package/layers/support/TimeSeriesInfo.d.ts +1 -1
- package/layers/support/featurePopupQueryUtils.js +1 -1
- package/layers/support/timeSeriesUtils.js +1 -1
- package/layers/support/types.d.ts +1 -1
- package/layers/types.d.ts +1 -2
- package/package.json +3 -3
- package/popup/FeatureContent.d.ts +7 -7
- package/portal/schemas/definitions.js +1 -1
- package/portal/types.d.ts +1 -1
- package/renderers/DotDensityRenderer.d.ts +2 -2
- package/rest/knowledgeGraph/ReplicaDefinition.d.ts +1 -1
- package/rest/knowledgeGraphService.d.ts +2 -2
- package/rest/support/OutDistance.d.ts +19 -18
- package/rest/support/Query.d.ts +49 -21
- package/rest/support/RelationshipQuery.d.ts +1 -1
- package/smartMapping/renderers/support/utils.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/LineSymbol3D.js +1 -1
- package/symbols/cim/types.d.ts +32 -0
- package/symbols/patterns/LinePattern3D.js +1 -1
- package/symbols/patterns/LineStylePattern3D.js +1 -1
- package/symbols/patterns/LineTemplatePattern3D.js +1 -1
- package/symbols/patterns/utils.js +1 -1
- package/views/2d/engine/webgl/util/DimensionMatcher.js +1 -1
- package/views/2d/layers/graphics/GraphicStore.js +1 -1
- package/views/2d/layers/support/annodime/DimensionInfo.js +1 -1
- package/views/2d/support/clippingUtils.js +1 -1
- package/views/2d/support/hitTestUtils.js +1 -1
- package/views/3d/analysis/ShadowCastAnalysisView3D.d.ts +1 -1
- package/views/3d/analysis/Viewshed/ViewshedEditTool.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedPlacementController.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
- package/views/3d/analysis/Viewshed/placementUtils.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
- package/views/3d/support/buffer/InterleavedLayout.js +1 -1
- package/views/3d/webgl-engine/effects/glow/BlurEmission.js +1 -1
- package/views/3d/webgl-engine/effects/stars/Stars.js +1 -1
- package/views/3d/webgl-engine/lib/AttributeView.js +2 -0
- package/views/3d/webgl-engine/lib/attributeViewUtils.js +2 -0
- package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/HUDMaterialBaseInstance.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLine.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLineTechniqueConfiguration.js +1 -1
- package/views/BreakpointsOwner.d.ts +2 -2
- package/views/PopupView.d.ts +64 -2
- package/views/SceneView.js +1 -1
- package/views/SelectionManager.d.ts +24 -24
- package/views/View.js +1 -1
- package/views/View2D.js +1 -1
- package/views/interactive/support/types.d.ts +0 -1
- package/views/layers/FeatureLikeLayerView.js +1 -1
- package/views/layers/support/MapServiceLayerViewHelper.js +1 -1
- package/views/support/DefaultsFromMap.js +1 -1
- package/widgets/Attachments/support/attachmentUtils.d.ts +8 -0
- package/widgets/BasemapLayerList/BasemapLayerListViewModel.d.ts +1 -0
- package/widgets/BasemapLayerList/BasemapLayerListViewModel.js +1 -1
- package/widgets/BasemapLayerList/BasemapLayerListVisibleElements.d.ts +5 -1
- package/widgets/BasemapLayerList/types.d.ts +15 -2
- package/widgets/BasemapLayerList.d.ts +1 -1
- package/widgets/BasemapLayerList.js +1 -1
- package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
- package/widgets/BatchAttributeForm/batchAttributeFormUtils.js +1 -1
- package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.d.ts +14 -0
- package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.js +1 -1
- package/widgets/BatchAttributeForm/inputs/BatchFormInputs.js +1 -1
- package/widgets/BatchAttributeForm/inputs/FieldInput.d.ts +29 -2
- package/widgets/BatchAttributeForm/inputs/FieldInput.js +1 -1
- package/widgets/BatchAttributeForm/inputs/support/MultipleChoiceController.d.ts +1 -5
- package/widgets/BatchAttributeForm/inputs/support/inputUtils.js +1 -1
- package/widgets/BatchAttributeForm/inputs/types.d.ts +8 -1
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/CatalogLayerList/CatalogLayerListViewModel.d.ts +2 -1
- package/widgets/CatalogLayerList/CatalogLayerListViewModel.js +1 -1
- package/widgets/CatalogLayerList/CatalogLayerListVisibleElements.d.ts +5 -1
- package/widgets/CatalogLayerList/types.d.ts +12 -1
- package/widgets/CatalogLayerList.d.ts +2 -1
- package/widgets/CatalogLayerList.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/EditorViewModel.d.ts +2 -2
- package/widgets/Editor.d.ts +2 -2
- package/widgets/FeatureTable/FeatureTableViewModel.d.ts +6 -6
- package/widgets/FeatureTable/support/FeatureStore.d.ts +2 -2
- package/widgets/FeatureTable.d.ts +5 -5
- package/widgets/LayerList/LayerListVisibleElements.d.ts +4 -1
- package/widgets/LayerList.js +1 -1
- package/widgets/TableList/ListItem.d.ts +2 -0
- package/widgets/TableList/ListItemPanel.d.ts +4 -0
- package/widgets/TableList/TableListViewModel.d.ts +4 -0
- package/widgets/TableList/TableListViewModel.js +1 -1
- package/widgets/TableList/TableListVisibleElements.d.ts +6 -1
- package/widgets/TableList/types.d.ts +12 -1
- package/widgets/TableList.d.ts +3 -0
- package/widgets/TableList.js +1 -1
- package/widgets/support/SelectionList/SelectionListViewModel.d.ts +1 -1
- package/assets/esri/core/workers/chunks/078ed48eb055dd213ee6.js +0 -1
- package/assets/esri/core/workers/chunks/1004e77593dfa506cd5d.js +0 -1
- package/assets/esri/core/workers/chunks/510a190a6f0a60ae38c3.js +0 -1
- package/assets/esri/core/workers/chunks/cd0f5cd0fefe7f49e3d8.js +0 -1
- package/assets/esri/core/workers/chunks/e6fb7b93cf73b05b1079.js +0 -1
- package/assets/esri/core/workers/chunks/f86ea5cf4814b458d50b.js +0 -1
- package/assets/esri/core/workers/chunks/f9b29d2ce1cd31c0fce1.js +0 -1
- package/graphic/graphicOrigins.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../Graphic.js";import a from"../../core/Collection.js";import i from"../../core/Error.js";import{makeHandle as r,handlesGroup as s,abortHandle as n}from"../../core/handleUtils.js";import"../../core/has.js";import o from"../../core/Logger.js";import{removeMaybe as l,destroyMaybe as d}from"../../core/maybe.js";import{isPromiseLike as c,debounce as u}from"../../core/promiseUtils.js";import{whenOnce as p,watch as h,initial as m,sync as f,syncAndInitial as g}from"../../core/reactiveUtils.js";import{generateBracedUUID as w}from"../../core/uuid.js";import{property as y,subclass as v}from"../../core/accessorSupport/decorators.js";import{isSharedTemplateOrMetadata as F,isSharedTemplate as _,getCreationAttributes as M,isStandardFeatureTemplate as b}from"../../editing/templateUtils.js";import{getFullTemplate as I}from"../../editing/sharedTemplates/templateLoader.js";import V from"../../layers/GraphicsLayer.js";import{isSceneLayer as k,isTable as S}from"../../layers/support/layerUtils.js";import{isNumber as T}from"../../support/guards.js";import{getDisplayedSymbol as P}from"../../symbols/support/symbolUtils.js";import{updateGraphicSymbolWhenRequired as E}from"../../views/draw/support/editingSessionUtils.js";import{getDrawHelpMessage as U}from"../../views/draw/support/helpMessageUtils.js";import A from"../../views/draw/support/HighlightHelper.js";import H from"../../views/interactive/sketch/SketchOptions.js";import C from"../../views/interactive/snapping/FeatureSnappingLayerSource.js";import{temporaryHighlightName as L}from"../../views/support/HighlightDefaults.js";import O from"../BatchAttributeForm/BatchAttributeFormViewModel.js";import j from"./CreateFeaturesWorkflowData.js";import{isModelUpload as x,handleModelUpload as D}from"./modelUploadUtils.js";import z from"./Workflow.js";import{activeSketchToolDrawsUnsupportedCurve as R,createToolFromGeometryType as G,containsUnsupportedCurve as W,findEditorItemForLayer as N,getServiceEditsFromWorkflowData as B,getServiceInfoForLayer as K,orderEditsByRelationshipDependencies as q,getServiceLayersById as Z,startCreatingNewFeature as J,syncUpdateOptions as Q,findLayerInfo as X,handleFormValuesChangeEvent as Y,isTerminalUpdateEventType as $,getVisualVariableAttributes as ee,startUpdatingFeatureGeometry as te,createWorkflowSteps as ae,avoidFeatureTemplateSelectionWithOnlyOneItem as ie,setUpSketchCreateWatchers as re,setRelationshipFields as se,showProgressCursor as ne,setVisualVariablesAndElevationInfoForUpdate as oe,visualVariableInteractiveUpdate as le}from"./workflowUtils.js";import{makeServiceEditsWithAttachments as de,makeEditsWithAttachments as ce,parseEditResultsAndCollectAddAttachmentData as ue}from"./support/attachmentUtils.js";import pe from"../Sketch/SketchViewModel.js";var he;const me=Symbol(),fe=Symbol(),ge=Symbol(),we=Symbol(),ye={point:["point"],multipoint:["multipoint"],polygon:["polygon","freehandPolygon","rectangle","circle"],polyline:["polyline","freehandPolyline"],mesh:[],multipatch:[]};let ve=he=class extends z{constructor(e){super(e),this.type="create-features",this.createFeatureState="create-new",this.data=void 0,this.isNested=!1,this._getDrawMeshHelpMessage=void 0,this._featureFormHandle=null,this._visualVariableAttributes={rotation:null,size:null},this._formViewModel=new O({attachmentsEnabled:!0}),this._sketchLayer=null,this._sketchViewModel=null,this._isActive=!0}initialize(){this.isNested&&(this._isActive=!1),this._initializeSketchViewModel()}destroy(){this._sketchViewModel.destroy()}get allowSave(){return!this.updating}get curveResizeDisabled(){return this.data.curveResizeDisabled}get curveUpdatesDisabled(){return this.data.curveUpdatesDisabled}get formViewModel(){return this._formViewModel}get hasInvalidFormTemplate(){return!!this.data.editorItem?.hasInvalidFormTemplate}get hasPendingEdits(){if(this.pendingFeatures.some(e=>!!this.data.getEditsForPendingFeature(e)?.modified))return!0;const{creationInfo:e,upload:t}=this.data,{activeComponent:a,createGraphic:i}=this._sketchViewModel,r=i?.geometry?.type;return!("polyline"!==r&&"polygon"!==r&&"multipoint"!==r||"draw-2d"!==a?.type&&"draw-3d"!==a?.type)&&a.drawOperation.committedVertices.length>0||(!(!t||"pending"!==t.state&&"success"!==t.state)||!!e?.geometryToPlace)}get hasPreviousStep(){return this.formViewModel.canGoBack||this._stepIndex>0||"update-pending"===this.createFeatureState&&!!this.data.selectedPendingFeature&&!this.parent&&!x(this.data.creationInfo)}get helpMessage(){const{creationInfo:e,viewModel:t}=this.data;if("creating-features"!==this.stepId||!e)return;const{_sketchViewModel:a}=this,{drawTool:i,isUsingLegacyCreateTools:r}=a;if(!r)return i?.helpMessageKey??"noTool";const s=e.layer.geometryType,n=a.createGraphic;if("mesh"===s){this._getDrawMeshHelpMessage||import("../../views/draw/support/helpMessageUtils3d.js").then(e=>{this._getDrawMeshHelpMessage=e.getDrawMeshHelpMessage});const{view:e}=t;return"3d"===e?.type?this._getDrawMeshHelpMessage?.(n,e):void 0}const{activeCreateToolDrawMode:o,activeTool:l}=a;return U("rectangle"===l||"circle"===l?l:s,n?.geometry,o)}get noticeMessage(){if(R(this._sketchViewModel,this.data.editorItem))return"curveToolDensifyWarning"}get layer(){return this.data.creationInfo?.layer}get numPendingFeatures(){return this.pendingFeatures.length}get numPendingFeaturesExcludingHidden(){return this.pendingFeatures.filter(e=>this.data.isDisplayable(e)).length}get parent(){return this.data.parent}get pendingFeatures(){return this.data.pendingFeatures}get keyboardCancellationEnabled(){return 0===this.numPendingFeatures}get reliesOnOwnerAdminPrivileges(){return this.data.editorItem?.capabilities.create.reliesOnOwnerAdminPrivileges??!1}get saveActionLabel(){return"create"}get shouldShowAttachments(){return(this.data.selectedPendingFeature&&this.data.editorItem?.capabilities.create.attachments.enabled)??!1}get shouldAllowAttachmentEditing(){return this.shouldShowAttachments}get sketchUpdateOptions(){const{editorItem:e}=this.data;return{enableScaling:!this.curveResizeDisabled,multipleSelectionEnabled:!1,reshapeOptions:{enableCreateCurveFromStraightEdge:!k(e?.layer)&&!!e?.capabilities.supportsTrueCurve}}}get sketchViewModel(){return this._sketchViewModel}get test(){}get availableCreateTools(){const e=this.data.creationInfo?.layer.geometryType,t=this.data.viewModel.view;if(!e)return[];if(this.data.creationInfo?.maxFeatures&&this.data.creationInfo.maxFeatures<=this.numPendingFeatures)return[];if(F(this.data.fullTemplate)){const{tool:t}=G(e,this.data.fullTemplate);return[t]}return"2d"!==t?.type&&"multipoint"===e?[]:[...ye[e]]}getUpdating(){return!!this._sketchViewModel?.updating}async enter(){this._isActive=!0,"awaiting-feature-creation-info"!==this.stepId&&await this._updatingHandles.addPromise(this._setUpCreatingFeaturesStep())}exit(){this._isActive=!1,this.removeHandles([ge])}async updatePendingFeature(e){if(e!==this.data.selectedPendingFeature)return this._sketchViewModel.cancel(),this._startUpdating({feature:e})}async start(){return await super.start(),S(this.data.creationInfo?.layer)?null:{enter:async()=>{},exit:async()=>{},viewModel:this._sketchViewModel}}async save(e){const{formViewModel:t}=this;if(t.pendingSubtypeChoice)return;await t.submit(),this._stashValidationState();const a=this.data.selectedPendingFeature,i=this._hasValidationErrors(a)?a:this.data.pendingFeatures.find(e=>this._hasValidationErrors(e));if(i)return await this._startUpdating({feature:i}),void await(t?.submit());const{pendingFeatures:r,editorItem:s}=this.data;if(s&&e&&W(r.toArray(),s)){if(!await e("curveEditingDensifyPrompt"))return this.reset()}return super.save()}back(e){return this._formViewModel.canGoBack?this._formViewModel.goBack():"update-pending"!==this.createFeatureState||!this.data.selectedPendingFeature||x(this.data.creationInfo)||this.parent?super.back(e):this._clearSelectedFeature()}previous(e){return this._formViewModel.canGoBack?this._formViewModel.goBack():"update-pending"===this.createFeatureState&&this.data.selectedPendingFeature&&!x(this.data.creationInfo)?this._clearSelectedFeature():super.previous(e)}cancelFeature(e){this.data.isSharedTemplateWorkflow?o.getLogger(this).warn("Cannot cancel individual features created by shared templates."):(this.data.removePendingFeature(e),this.sketchViewModel.removeGraphic(e))}static create(e){const{applyEdits:t,applyEditsFeatureService:a,addAttachmentsCallback:i,isNested:r,creationInfo:s,parent:n,snappingManager:o,startAt:l,viewModel:d}=e,c=e.sketchOptions??new H,u=s?.layer,p=u?N(d.editorItems,u):void 0,h=new he({data:new j({creationInfo:s,editorItem:p,parent:n,sketchOptions:c,snappingManager:o,viewModel:d}),isNested:r,onCommit:async e=>{const{creationInfo:r}=e;if(!r)return;h._sketchViewModel.cancel();const s=e.pendingFeatures.toArray(),{layer:n}=r,o=n.capabilities?.editing.supportsGlobalId&&"globalIdField"in n,{fullTemplate:l}=e,c=B(h.data),u=_(l)&&c;if(o){if(Me(s),u){let t=de(c,e);const i=await(K(n,d.view)?.load());i&&(t=q({edits:t,serviceInfo:i,view:d.view,findOriginalFeature:t=>e.getEditsForPendingFeature(t)?.initialFeature??t})),await a(l.featureService,t,{globalIdUsed:!0,honorSequenceOfEdits:!0,gdbVersion:l.layer.gdbVersion??void 0})}else await t(n,ce(s,e),{globalIdUsed:!0});return}const p=u?await a(l.featureService,c,{gdbVersion:l.layer.gdbVersion??void 0}):[await t(n,{addFeatures:s})];p?.length&&e.attachmentsModified&&!o&&await Promise.all(p.map(t=>{if(!t?.addFeatureResults)return;const a=ue(s,t.addFeatureResults,n,e);return i(n,a)}))}});return h._set("steps",this._createWorkflowSteps(h,l)),h}_fadeExistingFeatures(e){if("effect"in e){const t=e.effect;return e.effect="saturate(0.6) opacity(0.8)",r(()=>e.effect=t)}const t=e.opacity;return e.opacity=.7,r(()=>e.opacity=t)}async _initializeFullTemplateAndExecutorInfo(e){const{creationInfo:t}=e,{view:a}=e.viewModel;if(!t||!a)return null;const i=await I(a,t.template);if(e.fullTemplate=i,i&&_(i)){const{createTemplateExecutor:r}=await(import("../../editing/sharedTemplates/executor/createTemplateExecutor.js")),s={completionResults:[],executor:await r(i),serviceLayersById:Z(t.layer,a)};e.templateExecutorInfo=s}return i}async _startCreating(){this.removeHandles(fe);const{data:e}=this;if(!e.creationInfo)return;const t=this.data.creationInfo?.maxFeatures;if(t&&this.numPendingFeatures>=t)return this.sketchViewModel.cancel(),void(this.numPendingFeatures&&await this._startUpdating({feature:this.pendingFeatures.at(-1)}));this.createFeatureState="create-new",await J(this._sketchViewModel,this._sketchLayer,e)}async _clearSelectedFeature(){const e=this._formViewModel.pendingSubtypeChoice;e&&(e.resolve("undo"),await e.promise),this._stashValidationState(),this.sketchViewModel.cancel(),this.data.selectedPendingFeature=null,this._featureFormHandle=l(this._featureFormHandle),this._formViewModel.features=new a,this._formViewModel.activeFeatureIndex=-1}_stashValidationState(){const e=this._formViewModel.activeFeature,t=e&&this.data.getEditsForPendingFeature(e);t&&(t.submittable=this._formViewModel.valid)}async _selectFeatureForUpdate({feature:e,initialFeature:t=e}){this._stashValidationState();const{data:i,pendingFeatures:r}=this;r.includes(e)||i.addPendingFeature(e,t),i.selectedPendingFeature=e;const{_formViewModel:n,_sketchViewModel:o,sketchUpdateOptions:d}=this,{creationInfo:c,viewModel:u}=i,{layerInfos:m,view:f}=u;if(!f||!c)return;Q(o,d),l(this._featureFormHandle);const g=e.sourceLayer,w=X(m,g),y=f.spatialReference;n.set({editType:"INSERT",features:new a([e]),activeFeatureIndex:0,layerInfos:w?[w]:null,spatialReference:y,view:f}),await p(()=>!1===n.updating),await E(e,"2d"===f.type?f.scale:null);const v=i.getEditsForPendingFeature(e);v?.attachmentsModified&&n.applyStashedAttachmentEdits(v.attachmentEdits),this._featureFormHandle=s([n.on("values-change",Y({filter:e=>e===v?.feature,forEachValueChange:(e,t)=>{if(T(t)){const a=this._visualVariableAttributes;a.size&&!a.size.isUpdatingInteractively&&e===a.size.field&&a.size.setInitialValue(t),a.rotation&&!a.rotation.isUpdatingInteractively&&e===a.rotation.field&&a.rotation.setInitialValue(t)}},forEachFeature:e=>{v?.updateAttributes(n.getValues(e)),E(e,"2d"===f.type?f.scale:null)}})),n.on("attachments-change",e=>v?.setAttachmentEdits(e.attachmentEdits)),o.on(["update","undo","redo"],t=>{("undo"===t.type||"redo"===t.type||"update"===t.type&&null!=t.toolEventInfo&&$(t.toolEventInfo.type))&&n.notifyGeometriesChanged([e])}),h(()=>n.activeFeature?.sourceLayer,t=>e.sourceLayer=t),h(()=>[n.activeFeature,n.valid],()=>this._stashValidationState())]),this.createFeatureState="update-pending"}async _startUpdating({feature:e,initialFeature:t=e}){await this._selectFeatureForUpdate({feature:e,initialFeature:t});const{_sketchLayer:a,_sketchViewModel:i,data:r}=this,{creationInfo:s,viewModel:n}=r,{view:o}=n;if(!o||!s)return;const l=e.sourceLayer??s.layer;return S(l)?void 0:(this._visualVariableAttributes=ee(e),te({graphic:e,sketchLayer:a,sketchViewModel:i,sourceLayer:l,updateOptions:this.sketchUpdateOptions,visualVariables:this._visualVariableAttributes}))}static _createWorkflowSteps(e,t="awaiting-feature-creation-info"){const{data:a}=e,i=ae(["awaiting-feature-creation-info","creating-features","adding-attachment","editing-attachment"],t,{"awaiting-feature-creation-info":()=>({id:"awaiting-feature-creation-info",async setUp(){const{creationInfo:t,viewModel:i}=a,{view:r}=i;r&&(x(t)?e.addHandles(await D({view:r,data:a,next:()=>e.next(),cancel:()=>i.cancelWorkflow({warnIfNoWorkflow:!1})}),this.id):(a.parent&&t&&e.addHandles(i.restrictFeatureTemplatesViewModelToLayer(t.layer),this.id),e.addHandles(i.featureTemplatesViewModel.on("select",({item:t})=>{t&&(a.creationInfo={...a.creationInfo,layer:t.layer,template:t.template},e.next())}),this.id)))},async tearDown(){e.removeHandles(this.id)}}),"creating-features":()=>({id:"creating-features",async setUp(){e._isActive&&await e._setUpCreatingFeaturesStep()},async tearDown(t){t.canceled&&e.removeHandles([ge,me,fe,we])}}),"adding-attachment":()=>({id:"adding-attachment",parent:"creating-features",async setUp(){},async tearDown(){}}),"editing-attachment":()=>({id:"editing-attachment",parent:"creating-features",async setUp(){},async tearDown(){}})});return ie(a,i)}static _configureSketchViewModel(e){const{data:t,_sketchLayer:a,_sketchViewModel:i}=e,{creationInfo:n,viewModel:o}=t,{view:l}=o,d=[];if(!l)return r();if("2d"===l.type){n&&d.push(e._fadeExistingFeatures(n.layer));const t=u((e,t)=>Promise.all(e.map(e=>E(e,t))));d.push(h(()=>l.scale,e=>t(a.graphics,e)))}const c=M(t.fullTemplate,n?.attributeOverrides,n?.layer),p=h(()=>i.createGraphic&&i.activeComponent,()=>{i.createGraphic&&i.activeComponent&&!e.hasHandles(fe)&&e._updatingHandles.consumePromise(re({creationAttributes:c,data:t,sketchViewModel:i,view:l}).then(t=>e.addHandles(t,fe)))}),m=async t=>{if("cancel"!==t.state&&"complete"!==t.state||e.removeHandles(fe),"cancel"===t.state&&null!==l.activeTool&&l.activeTool!==e.sketchViewModel.activeComponent&&(await e._waitForActiveToolCleared(),await e._startCreating()),"complete"===t.state&&t.graphic){const a=await e._processEdits(t.graphic,{scale:"2d"===l.type?l.scale:null,useSourceLayer:!0});a&&(await e._waitForActiveToolCleared(),await e._startUpdating({feature:a}))}},f=async r=>{const{_formViewModel:s}=e;if(r.graphics.length>1)return void await e._clearSelectedFeature();const o=r.graphics[0];if("complete"===r.state){if(e.numPendingFeatures!==n?.maxFeatures&&s.valid||s.submit(),await e._clearSelectedFeature(),null==e.data.selectedPendingFeature&&(null==l.activeTool||l.activeTool===e.sketchViewModel.activeComponent)&&(await e.sketchViewModel.wait(),"ready"===e.sketchViewModel.state&&"mesh"!==e.data.creationInfo?.layer.geometryType))return e._startCreating()}else{if("start"===r.state)return o.sourceLayer??=t.creationInfo?.layer,await oe({graphic:o,sketchLayer:a,sketchViewModel:i,visualVariables:e._visualVariableAttributes,sourceLayer:o.sourceLayer}),e._selectFeatureForUpdate({feature:o});if("active"===r.state){await e.updatePendingFeature(o);const t=e._visualVariableAttributes;le(l,o,r,t)&&await E(o,"2d"===l.type?l.scale:null);const a=o.attributes,{rotation:i,size:n}=t;if(null!=i){const{field:t}=i;e._updatingHandles.consumePromise(s.setFieldValue(t,a[t]))}if(null!=n){const{field:t}=n;e._updatingHandles.consumePromise(s.setFieldValue(t,a[t]))}}}},g=async a=>{if(a.graphics.forEach(e=>{t.removePendingFeature(e)}),!x(t.creationInfo))return e._startCreating()},w=async()=>{if(x(t.creationInfo))try{await e.data.viewModel.back()}catch{}return e._startCreating()};d.push(p,i.on("create",t=>e._updatingHandles.addPromise(m(t))),i.on("update",t=>e._updatingHandles.addPromise(f(t))),i.on("delete",t=>e._updatingHandles.addPromise(g(t))),e._updatingHandles.addWhen(()=>!e.numPendingFeatures,()=>e._updatingHandles.addPromise(w())),r(()=>{i.cancel()}),Fe(i,a,t),..._e(t));const y=s(d);return i.addHandles(y),y}_initializeSketchViewModel(){const{data:e}=this,{view:t}=e.viewModel,a=new V({elevationInfo:e.creationInfo?.layer.elevationInfo,internal:!0,listMode:"hide",title:"createFeaturesWorkflow-internal"}),i=new pe({layer:a,creationMode:"single",sketchOptions:e.sketchOptions,snappingManager:e.snappingManager,useLegacyCreateTools:e.viewModel.useLegacyCreateTools,updateOnGraphicClick:!1,defaultUpdateOptions:this.sketchUpdateOptions,view:t});this._sketchLayer=a,this._sketchViewModel=i,t?.map.add(a),this.addHandles([r(()=>{t?.destroyed||t?.map.remove(a),d(a)}),h(()=>this.numPendingFeatures>0,e=>this._sketchViewModel.updateOnGraphicClick=e,m),h(()=>this.sketchUpdateOptions,e=>{i.defaultUpdateOptions=e,Q(i,e)},f)])}_hasValidationErrors(e){return!!e&&!this.data.isSubmittable(e)}async _processEdits(e,t){const{data:i,_formViewModel:r,_sketchLayer:s}=this,{layerInfos:n,view:o}=i.viewModel;r.editType="INSERT",r.spatialReference=o?.spatialReference,r.view=o;const{templateExecutorInfo:l}=i;if(!l){const t=e.clone();return t.geometry=null,await this._addAndInitializeEdits(e,t),e}s.remove(e);const{executor:d}=l,u=d(e.geometry,"completion"),h=c(u)?await u:u;l.completionResults.push(h),se(h.relationships),r.editType="INSERT",r.spatialReference=o?.spatialReference,r.view=o,h.primary&&i.creationInfo?.attributeOverrides&&(h.primary.graphic.attributes={...h.primary.graphic.attributes,...i.creationInfo.attributeOverrides});for(const a of h.edits){let e=null;if(a.addFeatures)for(const i of a.addFeatures){const a=i.clone();a.geometry=null,null!=i.geometry&&(i.symbol=await P(i,t),s.add(i)),i.sourceLayer!==e?.layer&&(e=X(n,i.sourceLayer));const r=!!h.associationGraphics?.has(i);await this._addAndInitializeEdits(i,a,e,r)}}r.features=new a,r.activeFeatureIndex=-1,await p(()=>!r.updating);return h.edits.reduce((e,t)=>e+(t.addFeatures?.length??0),0)>1?null:h.primary?.graphic}async _addAndInitializeEdits(e,t,i,r=!1){const{data:s,_formViewModel:n}=this,{layerInfos:o}=s.viewModel,l=s.addPendingFeature(e,t,{isAssociation:r});i??=X(o,e.sourceLayer),n.features=new a([e]),n.activeFeatureIndex=0,n.layerInfos=i?[i]:null,await p(()=>!n.updating),l.updateAttributes(n.getValues(e)),l.submittable=n.valid}async _setUpCreatingFeaturesStep(){if(this.hasHandles(ge))return;const{data:e,sketchViewModel:a}=this,{creationInfo:n,viewModel:o}=e,{view:d}=o;if(!d||!n?.layer)throw new i("missing-parameters","CreateFeaturesWorkflow requires a view and creationInfo.");const{initialFeature:c,layer:u}=n,p=[],f=[];this._featureFormHandle=l(this._featureFormHandle),this._visualVariableAttributes={rotation:null,size:null},e.editorItem=N(o.editorItems,n.layer),n.template&&(null==e.fullTemplate&&await this._initializeFullTemplateAndExecutorInfo(e),f.push(r(()=>{e.templateExecutorInfo&&(e.templateExecutorInfo.completionResults=[])}))),a.allowDeleteKey=!e.isSharedTemplateWorkflow;const g=ne(d);p.push(g);const w=S(n.layer),{template:y}=n,v=!y||b(y)||F(y)&&"feature"===y.type,_=w&&v;try{if(_){const a=c??new t({attributes:M(e.fullTemplate,n.attributeOverrides,u),sourceLayer:u}),i=await this._processEdits(a);i&&await this._startUpdating({feature:i})}else p.push(he._configureSketchViewModel(this)),c?(x(n)&&n.geometryToPlace&&(c.attributes=M(e.fullTemplate,n.attributeOverrides,u)),a.addGraphic(c),await this._startUpdating({feature:c})):await this._startCreating()}finally{g.remove()}const I=r(()=>{for(const t of e.pendingFeatures)a.removeGraphic(t),e.removePendingFeature(t)}),V=h(()=>d?.timeZone,e=>this.data.timeZone=e,m),k=r(()=>{x(n)&&o.cancelWorkflow({warnIfNoWorkflow:!1})});this._featureFormHandle&&p.push(this._featureFormHandle),this.addHandles(p,this._handleKeys.beforeCommit),this.addHandles(f,this._handleKeys.afterCommit),this.addHandles([s(p),s(f),k,I,V],ge)}async _waitForActiveToolCleared(){const e=this.data.viewModel.view;if(null==e?.activeTool)return;const t=new AbortController;this.addHandles(n(t),we),await p(()=>null==e?.activeTool,t.signal),t.abort()}};function Fe(e,t,a){let i=null;const n=()=>e.snappingOptions.featureSources,o=()=>(i=new C({layer:t}),n().add(i),i),l=()=>{null!=i&&(n().remove(i),i=d(i))};return s([h(()=>{const e=a.creationInfo?.layer,t=n().find(t=>t.layer===e);return{hasFeatureLayerSource:!!t,enabled:t?.enabled??!1}},({hasFeatureLayerSource:e,enabled:t})=>{if(!e)return l();i??=o(),i.enabled=t},g),r(l)])}function _e(e){const t=e.viewModel.view;if(!t)return[];const a=[];if("3d"===t.type){const i=new A({view:t});a.push(h(()=>e.selectedPendingFeature,(e,t)=>{i.remove(e),i.add(t)}),r(()=>i.destroy()))}const i=new A({view:t,highlightName:L});return a.push(h(()=>e.temporaryHighlightFeature,e=>{i.removeAll(),i.add(e)}),r(()=>i.destroy())),a}function Me(e){for(const t of e){const{sourceLayer:e}=t;e&&"globalIdField"in e&&null!=e.globalIdField&&(t.attributes[e.globalIdField]??=w())}}e([y()],ve.prototype,"allowSave",null),e([y()],ve.prototype,"createFeatureState",void 0),e([y()],ve.prototype,"curveResizeDisabled",null),e([y()],ve.prototype,"curveUpdatesDisabled",null),e([y()],ve.prototype,"data",void 0),e([y({constructOnly:!0})],ve.prototype,"isNested",void 0),e([y()],ve.prototype,"formViewModel",null),e([y()],ve.prototype,"hasInvalidFormTemplate",null),e([y()],ve.prototype,"hasPendingEdits",null),e([y()],ve.prototype,"hasPreviousStep",null),e([y()],ve.prototype,"_getDrawMeshHelpMessage",void 0),e([y()],ve.prototype,"helpMessage",null),e([y()],ve.prototype,"noticeMessage",null),e([y()],ve.prototype,"layer",null),e([y()],ve.prototype,"parent",null),e([y()],ve.prototype,"keyboardCancellationEnabled",null),e([y()],ve.prototype,"reliesOnOwnerAdminPrivileges",null),e([y()],ve.prototype,"saveActionLabel",null),e([y()],ve.prototype,"shouldShowAttachments",null),e([y()],ve.prototype,"shouldAllowAttachmentEditing",null),e([y()],ve.prototype,"sketchUpdateOptions",null),e([y()],ve.prototype,"sketchViewModel",null),e([y()],ve.prototype,"availableCreateTools",null),ve=he=e([v("esri.widgets.Editor.CreateFeaturesWorkflow")],ve);const be=ve;export{be as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../Graphic.js";import a from"../../core/Collection.js";import i from"../../core/Error.js";import{makeHandle as r,handlesGroup as s,abortHandle as n}from"../../core/handleUtils.js";import"../../core/has.js";import o from"../../core/Logger.js";import{removeMaybe as l,destroyMaybe as d}from"../../core/maybe.js";import{isPromiseLike as c,debounce as u}from"../../core/promiseUtils.js";import{whenOnce as p,watch as h,initial as m,sync as f,syncAndInitial as g}from"../../core/reactiveUtils.js";import{generateBracedUUID as w}from"../../core/uuid.js";import{property as y,subclass as v}from"../../core/accessorSupport/decorators.js";import{isSharedTemplateOrMetadata as F,isSharedTemplate as _,getCreationAttributes as M,isStandardFeatureTemplate as b}from"../../editing/templateUtils.js";import{getFullTemplate as I}from"../../editing/sharedTemplates/templateLoader.js";import V from"../../layers/GraphicsLayer.js";import{isSceneLayer as k,isTable as S}from"../../layers/support/layerUtils.js";import{isNumber as T}from"../../support/guards.js";import{getDisplayedSymbol as P}from"../../symbols/support/symbolUtils.js";import{updateGraphicSymbolWhenRequired as E}from"../../views/draw/support/editingSessionUtils.js";import{getDrawHelpMessage as A}from"../../views/draw/support/helpMessageUtils.js";import U from"../../views/draw/support/HighlightHelper.js";import H from"../../views/interactive/sketch/SketchOptions.js";import C from"../../views/interactive/snapping/FeatureSnappingLayerSource.js";import{temporaryHighlightName as L}from"../../views/support/HighlightDefaults.js";import O from"../BatchAttributeForm/BatchAttributeFormViewModel.js";import j from"./CreateFeaturesWorkflowData.js";import{isModelUpload as x,handleModelUpload as D}from"./modelUploadUtils.js";import z from"./Workflow.js";import{activeSketchToolDrawsUnsupportedCurve as R,createToolFromGeometryType as G,containsUnsupportedCurve as W,findEditorItemForLayer as N,getServiceEditsFromWorkflowData as B,getServiceInfoForLayer as K,orderEditsByRelationshipDependencies as q,getServiceLayersById as Z,startCreatingNewFeature as J,syncUpdateOptions as Q,findLayerInfo as X,handleFormValuesChangeEvent as Y,isTerminalUpdateEventType as $,getVisualVariableAttributes as ee,startUpdatingFeatureGeometry as te,createWorkflowSteps as ae,avoidFeatureTemplateSelectionWithOnlyOneItem as ie,setUpSketchCreateWatchers as re,setRelationshipFields as se,showProgressCursor as ne,setVisualVariablesAndElevationInfoForUpdate as oe,visualVariableInteractiveUpdate as le}from"./workflowUtils.js";import{makeServiceEditsWithAttachments as de,makeEditsWithAttachments as ce,parseEditResultsAndCollectAddAttachmentData as ue}from"./support/attachmentUtils.js";import pe from"../Sketch/SketchViewModel.js";var he;const me=Symbol(),fe=Symbol(),ge=Symbol(),we=Symbol(),ye={point:["point"],multipoint:["multipoint"],polygon:["polygon","freehandPolygon","rectangle","circle"],polyline:["polyline","freehandPolyline"],mesh:[],multipatch:[]};let ve=he=class extends z{constructor(e){super(e),this.type="create-features",this.createFeatureState="create-new",this.data=void 0,this.isNested=!1,this._getDrawMeshHelpMessage=void 0,this._featureFormHandle=null,this._visualVariableAttributes={rotation:null,size:null},this._formViewModel=new O({attachmentsEnabled:!0}),this._sketchLayer=null,this._sketchViewModel=null,this._isActive=!0}initialize(){this.isNested&&(this._isActive=!1),this._initializeSketchViewModel()}destroy(){this._sketchViewModel.destroy()}get allowSave(){return!this.updating}get curveResizeDisabled(){return this.data.curveResizeDisabled}get curveUpdatesDisabled(){return this.data.curveUpdatesDisabled}get formViewModel(){return this._formViewModel}get hasInvalidFormTemplate(){return!!this.data.editorItem?.hasInvalidFormTemplate}get hasPendingEdits(){if(this.pendingFeatures.some(e=>!!this.data.getEditsForPendingFeature(e)?.modified))return!0;const{creationInfo:e,upload:t}=this.data,{activeComponent:a,createGraphic:i}=this._sketchViewModel,r=i?.geometry?.type;return!("polyline"!==r&&"polygon"!==r&&"multipoint"!==r||"draw-2d"!==a?.type&&"draw-3d"!==a?.type)&&a.drawOperation.committedVertices.length>0||(!(!t||"pending"!==t.state&&"success"!==t.state)||!!e?.geometryToPlace)}get hasPreviousStep(){return this.formViewModel.canGoBack||this._stepIndex>0||"update-pending"===this.createFeatureState&&!!this.data.selectedPendingFeature&&!this.parent&&!x(this.data.creationInfo)}get helpMessage(){const{creationInfo:e,viewModel:t}=this.data;if("creating-features"!==this.stepId||!e)return;const{_sketchViewModel:a}=this,{drawTool:i,isUsingLegacyCreateTools:r}=a;if(!r)return i?.helpMessageKey??"noTool";const s=e.layer.geometryType,n=a.createGraphic;if("mesh"===s){this._getDrawMeshHelpMessage||import("../../views/draw/support/helpMessageUtils3d.js").then(e=>{this._getDrawMeshHelpMessage=e.getDrawMeshHelpMessage});const{view:e}=t;return"3d"===e?.type?this._getDrawMeshHelpMessage?.(n,e):void 0}const{activeCreateToolDrawMode:o,activeTool:l}=a;return A("rectangle"===l||"circle"===l?l:s,n?.geometry,o)}get noticeMessage(){if(R(this._sketchViewModel,this.data.editorItem))return"curveToolDensifyWarning"}get layer(){return this.data.creationInfo?.layer}get numPendingFeatures(){return this.pendingFeatures.length}get numPendingFeaturesExcludingHidden(){return this.pendingFeatures.filter(e=>this.data.isDisplayable(e)).length}get parent(){return this.data.parent}get pendingFeatures(){return this.data.pendingFeatures}get keyboardCancellationEnabled(){return 0===this.numPendingFeatures}get reliesOnOwnerAdminPrivileges(){return this.data.editorItem?.capabilities.create.reliesOnOwnerAdminPrivileges??!1}get saveActionLabel(){return"create"}get shouldShowAttachments(){return(this.data.selectedPendingFeature&&this.data.editorItem?.capabilities.create.attachments.enabled)??!1}get shouldAllowAttachmentEditing(){return this.shouldShowAttachments}get sketchUpdateOptions(){const{editorItem:e}=this.data;return{enableScaling:!this.curveResizeDisabled,multipleSelectionEnabled:!1,reshapeOptions:{enableCreateCurveFromStraightEdge:!k(e?.layer)&&!!e?.capabilities.supportsTrueCurve}}}get sketchViewModel(){return this._sketchViewModel}get test(){}get availableCreateTools(){const e=this.data.creationInfo?.layer.geometryType,t=this.data.viewModel.view;if(!e)return[];if(this.data.creationInfo?.maxFeatures&&this.data.creationInfo.maxFeatures<=this.numPendingFeatures)return[];if(F(this.data.fullTemplate)){const{tool:t}=G(e,this.data.fullTemplate);return[t]}return"2d"!==t?.type&&"multipoint"===e?[]:[...ye[e]]}getUpdating(){return!!this._sketchViewModel?.updating}async enter(){this._isActive=!0,"awaiting-feature-creation-info"!==this.stepId&&await this._updatingHandles.addPromise(this._setUpCreatingFeaturesStep())}exit(){this._isActive=!1,this.removeHandles([ge])}async updatePendingFeature(e){if(e!==this.data.selectedPendingFeature)return this._sketchViewModel.cancel(),this._startUpdating({feature:e})}async start(){return await super.start(),S(this.data.creationInfo?.layer)?null:{enter:async()=>{},exit:async()=>{},viewModel:this._sketchViewModel}}async save(e){const{formViewModel:t}=this;if(t.pendingSubtypeChoice)return;await t.submit(),this._stashValidationState();const a=this.data.selectedPendingFeature,i=this._hasValidationErrors(a)?a:this.data.pendingFeatures.find(e=>this._hasValidationErrors(e));if(i)return await this._startUpdating({feature:i}),void await(t?.submit());const{pendingFeatures:r,editorItem:s}=this.data;if(s&&e&&W(r.toArray(),s)){if(!await e("curveEditingDensifyPrompt"))return this.reset()}return super.save()}back(e){return this._formViewModel.canGoBack?this._formViewModel.goBack():"update-pending"!==this.createFeatureState||!this.data.selectedPendingFeature||x(this.data.creationInfo)||this.parent?super.back(e):this._clearSelectedFeature()}previous(e){return this._formViewModel.canGoBack?this._formViewModel.goBack():"update-pending"===this.createFeatureState&&this.data.selectedPendingFeature&&!x(this.data.creationInfo)?this._clearSelectedFeature():super.previous(e)}cancelFeature(e){this.data.isSharedTemplateWorkflow?o.getLogger(this).warn("Cannot cancel individual features created by shared templates."):(this.data.removePendingFeature(e),this.sketchViewModel.removeGraphic(e))}static create(e){const{applyEdits:t,applyEditsFeatureService:a,addAttachmentsCallback:i,isNested:r,creationInfo:s,parent:n,snappingManager:o,startAt:l,viewModel:d}=e,c=e.sketchOptions??new H,u=s?.layer,p=u?N(d.editorItems,u):void 0,h=new he({data:new j({creationInfo:s,editorItem:p,parent:n,sketchOptions:c,snappingManager:o,viewModel:d}),isNested:r,onCommit:async e=>{const{creationInfo:r}=e;if(!r)return;h._sketchViewModel.cancel();const s=e.pendingFeatures.toArray(),{layer:n}=r,o=n.capabilities?.editing.supportsGlobalId&&"globalIdField"in n,{fullTemplate:l}=e,c=B(h.data),u=_(l)&&c;if(o){if(Me(s),u){let t=de(c,e);const i=await(K(n,d.view)?.load());i&&(t=q({edits:t,serviceInfo:i,view:d.view,findOriginalFeature:t=>e.getEditsForPendingFeature(t)?.initialFeature??t})),await a(l.featureService,t,{globalIdUsed:!0,honorSequenceOfEdits:!0,gdbVersion:l.layer.gdbVersion??void 0})}else await t(n,ce(s,e),{globalIdUsed:!0});return}const p=u?await a(l.featureService,c,{gdbVersion:l.layer.gdbVersion??void 0}):[await t(n,{addFeatures:s})];p?.length&&e.attachmentsModified&&!o&&await Promise.all(p.map(t=>{if(!t?.addFeatureResults)return;const a=ue(s,t.addFeatureResults,n,e);return i(n,a)}))}});return h._set("steps",this._createWorkflowSteps(h,l)),h}_fadeExistingFeatures(e){if("effect"in e){const t=e.effect;return e.effect="saturate(0.6) opacity(0.8)",r(()=>e.effect=t)}const t=e.opacity;return e.opacity=.7,r(()=>e.opacity=t)}async _initializeFullTemplateAndExecutorInfo(e){const{creationInfo:t}=e,{view:a}=e.viewModel;if(!t||!a)return null;const i=await I(a,t.template);if(e.fullTemplate=i,i&&_(i)){const{createTemplateExecutor:r}=await(import("../../editing/sharedTemplates/executor/createTemplateExecutor.js")),s={completionResults:[],executor:await r(i),serviceLayersById:Z(t.layer,a)};e.templateExecutorInfo=s}return i}async _startCreating(){this.removeHandles(fe);const{data:e}=this;if(!e.creationInfo)return;const t=this.data.creationInfo?.maxFeatures;if(t&&this.numPendingFeatures>=t)return this.sketchViewModel.cancel(),void(this.numPendingFeatures&&await this._startUpdating({feature:this.pendingFeatures.at(-1)}));this.createFeatureState="create-new",await J(this._sketchViewModel,this._sketchLayer,e)}async _clearSelectedFeature(){const e=this._formViewModel.pendingSubtypeChoice;e&&(e.resolve("undo"),await e.promise),this._stashValidationState(),this.sketchViewModel.cancel(),this.data.selectedPendingFeature=null,this._featureFormHandle=l(this._featureFormHandle),this._formViewModel.features=new a,this._formViewModel.activeFeatureIndex=-1}_stashValidationState(){const e=this._formViewModel.activeFeature,t=e&&this.data.getEditsForPendingFeature(e);t&&(t.submittable=this._formViewModel.valid)}async _selectFeatureForUpdate({feature:e,initialFeature:t=e}){this._stashValidationState();const{data:i,pendingFeatures:r}=this;r.includes(e)||i.addPendingFeature(e,t),i.selectedPendingFeature=e;const{_formViewModel:n,_sketchViewModel:o,sketchUpdateOptions:d}=this,{creationInfo:c,viewModel:u}=i,{layerInfos:m,view:f}=u;if(!f||!c)return;Q(o,d),l(this._featureFormHandle);const g=e.sourceLayer,w=X(m,g),y=f.spatialReference;n.set({editType:"INSERT",features:new a([e]),activeFeatureIndex:0,layerInfos:w?[w]:null,spatialReference:y,view:f}),await p(()=>!1===n.updating),await E(e,"2d"===f.type?f.scale:null);const v=i.getEditsForPendingFeature(e);v?.attachmentsModified&&n.applyStashedAttachmentEdits(v.attachmentEdits),this._featureFormHandle=s([n.on("values-change",Y({filter:e=>e===v?.feature,forEachValueChange:(e,t)=>{if(T(t)){const a=this._visualVariableAttributes;a.size&&!a.size.isUpdatingInteractively&&e===a.size.field&&a.size.setInitialValue(t),a.rotation&&!a.rotation.isUpdatingInteractively&&e===a.rotation.field&&a.rotation.setInitialValue(t)}},forEachFeature:e=>{v?.updateAttributes(n.getValues(e)),E(e,"2d"===f.type?f.scale:null)}})),n.on("attachments-change",e=>v?.setAttachmentEdits(e.attachmentEdits)),o.on(["update","undo","redo"],t=>{("undo"===t.type||"redo"===t.type||"update"===t.type&&null!=t.toolEventInfo&&$(t.toolEventInfo.type))&&n.notifyGeometriesChanged([e])}),h(()=>n.activeFeature?.sourceLayer,t=>e.sourceLayer=t),h(()=>[n.activeFeature,n.valid],()=>this._stashValidationState())]),this.createFeatureState="update-pending"}async _startUpdating({feature:e,initialFeature:t=e}){await this._selectFeatureForUpdate({feature:e,initialFeature:t});const{_sketchLayer:a,_sketchViewModel:i,data:r}=this,{creationInfo:s,viewModel:n}=r,{view:o}=n;if(!o||!s)return;const l=e.sourceLayer??s.layer;return S(l)?void 0:(this._visualVariableAttributes=ee(e),te({graphic:e,sketchLayer:a,sketchViewModel:i,sourceLayer:l,updateOptions:this.sketchUpdateOptions,visualVariables:this._visualVariableAttributes}))}static _createWorkflowSteps(e,t="awaiting-feature-creation-info"){const{data:a}=e,i=ae(["awaiting-feature-creation-info","creating-features","adding-attachment","editing-attachment"],t,{"awaiting-feature-creation-info":()=>({id:"awaiting-feature-creation-info",async setUp(){const{creationInfo:t,viewModel:i}=a,{view:r}=i;r&&(x(t)?e.addHandles(await D({view:r,data:a,next:()=>e.next(),cancel:()=>i.cancelWorkflow({warnIfNoWorkflow:!1})}),this.id):(a.parent&&t&&e.addHandles(i.restrictFeatureTemplatesViewModelToLayer(t.layer),this.id),e.addHandles(i.featureTemplatesViewModel.on("select",({item:t})=>{t&&(a.creationInfo={...a.creationInfo,layer:t.layer,template:t.template},e.next())}),this.id)))},async tearDown(){e.removeHandles(this.id)}}),"creating-features":()=>({id:"creating-features",async setUp(){e._isActive&&await e._setUpCreatingFeaturesStep()},async tearDown(t){t.canceled&&e.removeHandles([ge,me,fe,we])}}),"adding-attachment":()=>({id:"adding-attachment",parent:"creating-features",async setUp(){},async tearDown(){}}),"editing-attachment":()=>({id:"editing-attachment",parent:"creating-features",async setUp(){},async tearDown(){}})});return ie(a,i)}static _configureSketchViewModel(e){const{data:t,_sketchLayer:a,_sketchViewModel:i}=e,{creationInfo:n,viewModel:o}=t,{view:l}=o,d=[];if(!l)return r();if("2d"===l.type){n&&d.push(e._fadeExistingFeatures(n.layer));const t=u((e,t)=>Promise.all(e.map(e=>E(e,t))));d.push(h(()=>l.scale,e=>t(a.graphics,e)))}const c=M(t.fullTemplate,n?.attributeOverrides,n?.layer),p=h(()=>i.createGraphic&&i.activeComponent,()=>{i.createGraphic&&i.activeComponent&&!e.hasHandles(fe)&&e._updatingHandles.consumePromise(re({creationAttributes:c,data:t,sketchViewModel:i,view:l}).then(t=>e.addHandles(t,fe)))}),m=async t=>{if("cancel"!==t.state&&"complete"!==t.state||e.removeHandles(fe),"cancel"===t.state&&null!==l.activeTool&&l.activeTool!==e.sketchViewModel.activeComponent&&(await e._waitForActiveToolCleared(),await e._startCreating()),"complete"===t.state&&t.graphic){const a=await e._processEdits(t.graphic,{scale:"2d"===l.type?l.scale:null,useSourceLayer:!0});a&&(await e._waitForActiveToolCleared(),await e._startUpdating({feature:a}))}},f=async r=>{const{_formViewModel:s}=e;if(r.graphics.length>1)return void await e._clearSelectedFeature();const o=r.graphics[0];if("complete"===r.state){if(e.numPendingFeatures!==n?.maxFeatures&&s.valid||s.activeForm.touchAll(),await e._clearSelectedFeature(),null==e.data.selectedPendingFeature&&(null==l.activeTool||l.activeTool===e.sketchViewModel.activeComponent)&&(await e.sketchViewModel.wait(),"ready"===e.sketchViewModel.state&&"mesh"!==e.data.creationInfo?.layer.geometryType))return e._startCreating()}else{if("start"===r.state)return o.sourceLayer??=t.creationInfo?.layer,await oe({graphic:o,sketchLayer:a,sketchViewModel:i,visualVariables:e._visualVariableAttributes,sourceLayer:o.sourceLayer}),e._selectFeatureForUpdate({feature:o});if("active"===r.state){await e.updatePendingFeature(o);const t=e._visualVariableAttributes;le(l,o,r,t)&&await E(o,"2d"===l.type?l.scale:null);const a=o.attributes,{rotation:i,size:n}=t;if(null!=i){const{field:t}=i;e._updatingHandles.consumePromise(s.setFieldValue(t,a[t]))}if(null!=n){const{field:t}=n;e._updatingHandles.consumePromise(s.setFieldValue(t,a[t]))}}}},g=async a=>{if(a.graphics.forEach(e=>{t.removePendingFeature(e)}),!x(t.creationInfo))return e._startCreating()},w=async()=>{if(x(t.creationInfo))try{await e.data.viewModel.back()}catch{}return e._startCreating()};d.push(p,i.on("create",t=>e._updatingHandles.addPromise(m(t))),i.on("update",t=>e._updatingHandles.addPromise(f(t))),i.on("delete",t=>e._updatingHandles.addPromise(g(t))),e._updatingHandles.addWhen(()=>!e.numPendingFeatures,()=>e._updatingHandles.addPromise(w())),r(()=>{i.cancel()}),Fe(i,a,t),..._e(t));const y=s(d);return i.addHandles(y),y}_initializeSketchViewModel(){const{data:e}=this,{view:t}=e.viewModel,a=new V({elevationInfo:e.creationInfo?.layer.elevationInfo,internal:!0,listMode:"hide",title:"createFeaturesWorkflow-internal"}),i=new pe({layer:a,creationMode:"single",sketchOptions:e.sketchOptions,snappingManager:e.snappingManager,useLegacyCreateTools:e.viewModel.useLegacyCreateTools,updateOnGraphicClick:!1,defaultUpdateOptions:this.sketchUpdateOptions,view:t});this._sketchLayer=a,this._sketchViewModel=i,t?.map.add(a),this.addHandles([r(()=>{t?.destroyed||t?.map.remove(a),d(a)}),h(()=>this.numPendingFeatures>0,e=>this._sketchViewModel.updateOnGraphicClick=e,m),h(()=>this.sketchUpdateOptions,e=>{i.defaultUpdateOptions=e,Q(i,e)},f)])}_hasValidationErrors(e){return!!e&&!this.data.isSubmittable(e)}async _processEdits(e,t){const{data:i,_formViewModel:r,_sketchLayer:s}=this,{layerInfos:n,view:o}=i.viewModel;r.editType="INSERT",r.spatialReference=o?.spatialReference,r.view=o;const{templateExecutorInfo:l}=i;if(!l){const t=e.clone();return t.geometry=null,await this._addAndInitializeEdits(e,t),e}s.remove(e);const{executor:d}=l,u=d(e.geometry,"completion"),h=c(u)?await u:u;l.completionResults.push(h),se(h.relationships),r.editType="INSERT",r.spatialReference=o?.spatialReference,r.view=o,h.primary&&i.creationInfo?.attributeOverrides&&(h.primary.graphic.attributes={...h.primary.graphic.attributes,...i.creationInfo.attributeOverrides});for(const a of h.edits){let e=null;if(a.addFeatures)for(const i of a.addFeatures){const a=i.clone();a.geometry=null,null!=i.geometry&&(i.symbol=await P(i,t),s.add(i)),i.sourceLayer!==e?.layer&&(e=X(n,i.sourceLayer));const r=!!h.associationGraphics?.has(i);await this._addAndInitializeEdits(i,a,e,r)}}r.features=new a,r.activeFeatureIndex=-1,await p(()=>!r.updating);return h.edits.reduce((e,t)=>e+(t.addFeatures?.length??0),0)>1?null:h.primary?.graphic}async _addAndInitializeEdits(e,t,i,r=!1){const{data:s,_formViewModel:n}=this,{layerInfos:o}=s.viewModel,l=s.addPendingFeature(e,t,{isAssociation:r});i??=X(o,e.sourceLayer),n.features=new a([e]),n.activeFeatureIndex=0,n.layerInfos=i?[i]:null,await p(()=>!n.updating),l.updateAttributes(n.getValues(e)),l.submittable=n.valid}async _setUpCreatingFeaturesStep(){if(this.hasHandles(ge))return;const{data:e,sketchViewModel:a}=this,{creationInfo:n,viewModel:o}=e,{view:d}=o;if(!d||!n?.layer)throw new i("missing-parameters","CreateFeaturesWorkflow requires a view and creationInfo.");const{initialFeature:c,layer:u}=n,p=[],f=[];this._featureFormHandle=l(this._featureFormHandle),this._visualVariableAttributes={rotation:null,size:null},e.editorItem=N(o.editorItems,n.layer),n.template&&(null==e.fullTemplate&&await this._initializeFullTemplateAndExecutorInfo(e),f.push(r(()=>{e.templateExecutorInfo&&(e.templateExecutorInfo.completionResults=[])}))),a.allowDeleteKey=!e.isSharedTemplateWorkflow;const g=ne(d);p.push(g);const w=S(n.layer),{template:y}=n,v=!y||b(y)||F(y)&&"feature"===y.type,_=w&&v;try{if(_){const a=c??new t({attributes:M(e.fullTemplate,n.attributeOverrides,u),sourceLayer:u}),i=await this._processEdits(a);i&&await this._startUpdating({feature:i})}else p.push(he._configureSketchViewModel(this)),c?(x(n)&&n.geometryToPlace&&(c.attributes=M(e.fullTemplate,n.attributeOverrides,u)),a.addGraphic(c),await this._startUpdating({feature:c})):await this._startCreating()}finally{g.remove()}const I=r(()=>{for(const t of e.pendingFeatures)a.removeGraphic(t),e.removePendingFeature(t)}),V=h(()=>d?.timeZone,e=>this.data.timeZone=e,m),k=r(()=>{x(n)&&o.cancelWorkflow({warnIfNoWorkflow:!1})});this._featureFormHandle&&p.push(this._featureFormHandle),this.addHandles(p,this._handleKeys.beforeCommit),this.addHandles(f,this._handleKeys.afterCommit),this.addHandles([s(p),s(f),k,I,V],ge)}async _waitForActiveToolCleared(){const e=this.data.viewModel.view;if(null==e?.activeTool)return;const t=new AbortController;this.addHandles(n(t),we),await p(()=>null==e?.activeTool,t.signal),t.abort()}};function Fe(e,t,a){let i=null;const n=()=>e.snappingOptions.featureSources,o=()=>(i=new C({layer:t}),n().add(i),i),l=()=>{null!=i&&(n().remove(i),i=d(i))};return s([h(()=>{const e=a.creationInfo?.layer,t=n().find(t=>t.layer===e);return{hasFeatureLayerSource:!!t,enabled:t?.enabled??!1}},({hasFeatureLayerSource:e,enabled:t})=>{if(!e)return l();i??=o(),i.enabled=t},g),r(l)])}function _e(e){const t=e.viewModel.view;if(!t)return[];const a=[];if("3d"===t.type){const i=new U({view:t});a.push(h(()=>e.selectedPendingFeature,(e,t)=>{i.remove(e),i.add(t)}),r(()=>i.destroy()))}const i=new U({view:t,highlightName:L});return a.push(h(()=>e.temporaryHighlightFeature,e=>{i.removeAll(),i.add(e)}),r(()=>i.destroy())),a}function Me(e){for(const t of e){const{sourceLayer:e}=t;e&&"globalIdField"in e&&null!=e.globalIdField&&(t.attributes[e.globalIdField]??=w())}}e([y()],ve.prototype,"allowSave",null),e([y()],ve.prototype,"createFeatureState",void 0),e([y()],ve.prototype,"curveResizeDisabled",null),e([y()],ve.prototype,"curveUpdatesDisabled",null),e([y()],ve.prototype,"data",void 0),e([y({constructOnly:!0})],ve.prototype,"isNested",void 0),e([y()],ve.prototype,"formViewModel",null),e([y()],ve.prototype,"hasInvalidFormTemplate",null),e([y()],ve.prototype,"hasPendingEdits",null),e([y()],ve.prototype,"hasPreviousStep",null),e([y()],ve.prototype,"_getDrawMeshHelpMessage",void 0),e([y()],ve.prototype,"helpMessage",null),e([y()],ve.prototype,"noticeMessage",null),e([y()],ve.prototype,"layer",null),e([y()],ve.prototype,"parent",null),e([y()],ve.prototype,"keyboardCancellationEnabled",null),e([y()],ve.prototype,"reliesOnOwnerAdminPrivileges",null),e([y()],ve.prototype,"saveActionLabel",null),e([y()],ve.prototype,"shouldShowAttachments",null),e([y()],ve.prototype,"shouldAllowAttachmentEditing",null),e([y()],ve.prototype,"sketchUpdateOptions",null),e([y()],ve.prototype,"sketchViewModel",null),e([y()],ve.prototype,"availableCreateTools",null),ve=he=e([v("esri.widgets.Editor.CreateFeaturesWorkflow")],ve);const be=ve;export{be as default};
|
|
@@ -239,7 +239,7 @@ export default class EditorViewModel extends EventedAccessor {
|
|
|
239
239
|
*/
|
|
240
240
|
accessor layerInfos: LayerInfo[] | null | undefined;
|
|
241
241
|
/**
|
|
242
|
-
* Use this property to supply a custom selection manager that overrides the default selection manager. This property is ignored if [syncViewSelection](
|
|
242
|
+
* Use this property to supply a custom selection manager that overrides the default selection manager. This property is ignored if [syncViewSelection](https://developers.arcgis.com/javascript/latest/references/core/widgets/Editor/EditorViewModel/#syncViewSelection) is `true`.
|
|
243
243
|
* This is useful when applications want to share selection sets between components, without relying on the view's selection manager.
|
|
244
244
|
*
|
|
245
245
|
* @since 5.0
|
|
@@ -281,7 +281,7 @@ export default class EditorViewModel extends EventedAccessor {
|
|
|
281
281
|
* Indicates whether the Editor should sync with the view's [selection manager](https://developers.arcgis.com/javascript/latest/references/core/views/SelectionManager/).
|
|
282
282
|
* Enabling this does not automatically inherit the [selection sources](https://developers.arcgis.com/javascript/latest/references/core/views/SelectionManager/#sources) from the [SelectionManager](https://developers.arcgis.com/javascript/latest/references/core/views/SelectionManager/), (e.g. which layers or graphics collections the view listens to for selections). If you need specific selection sources, configure them separately via [SelectionManager.sources](https://developers.arcgis.com/javascript/latest/references/core/views/SelectionManager/#sources).
|
|
283
283
|
*
|
|
284
|
-
* Setting this property takes precedence over the [selectionManager](
|
|
284
|
+
* Setting this property takes precedence over the [selectionManager](https://developers.arcgis.com/javascript/latest/references/core/widgets/Editor/EditorViewModel/#selectionManager) property.
|
|
285
285
|
*
|
|
286
286
|
* @default false
|
|
287
287
|
* @since 5.0
|
package/widgets/Editor.d.ts
CHANGED
|
@@ -485,7 +485,7 @@ export default class Editor extends Widget {
|
|
|
485
485
|
accessor layerInfos: LayerInfo[] | null | undefined;
|
|
486
486
|
/**
|
|
487
487
|
* Use this property to supply a custom selection manager that overrides the default selection manager.
|
|
488
|
-
* This is useful when applications want to share selection sets between components, without relying on the view's selection manager. This property is ignored if [syncViewSelection](
|
|
488
|
+
* This is useful when applications want to share selection sets between components, without relying on the view's selection manager. This property is ignored if [syncViewSelection](https://developers.arcgis.com/javascript/latest/references/core/widgets/Editor/#syncViewSelection) is `true`.
|
|
489
489
|
*
|
|
490
490
|
* @since 5.0
|
|
491
491
|
*/
|
|
@@ -530,7 +530,7 @@ export default class Editor extends Widget {
|
|
|
530
530
|
* Indicates whether the Editor should sync with the view's [selection manager](https://developers.arcgis.com/javascript/latest/references/core/views/SelectionManager/).
|
|
531
531
|
* Enabling this does not automatically inherit the [selection sources](https://developers.arcgis.com/javascript/latest/references/core/views/SelectionManager/#sources) from the [SelectionManager](https://developers.arcgis.com/javascript/latest/references/core/views/SelectionManager/), (e.g. which layers or graphics collections the view listens to for selections). If you need specific selection sources, configure them separately via [SelectionManager.sources](https://developers.arcgis.com/javascript/latest/references/core/views/SelectionManager/#sources).
|
|
532
532
|
*
|
|
533
|
-
* Setting this property takes precedence over the [selectionManager](
|
|
533
|
+
* Setting this property takes precedence over the [selectionManager](https://developers.arcgis.com/javascript/latest/references/core/widgets/Editor/#selectionManager) property.
|
|
534
534
|
*
|
|
535
535
|
* @default false
|
|
536
536
|
* @since 5.0
|
|
@@ -434,8 +434,8 @@ export default class FeatureTableViewModel extends GridViewModel {
|
|
|
434
434
|
*/
|
|
435
435
|
get columns(): Collection<SupportedColumn>;
|
|
436
436
|
/**
|
|
437
|
-
* A reference to the internal [selection manager](https://developers.arcgis.com/javascript/latest/references/core/views/SelectionManager/) used when a custom selection manager is not provided, and [syncViewSelection](
|
|
438
|
-
* When 'syncViewSelection' is true and a [view](
|
|
437
|
+
* A reference to the internal [selection manager](https://developers.arcgis.com/javascript/latest/references/core/views/SelectionManager/) used when a custom selection manager is not provided, and [syncViewSelection](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTable/FeatureTableViewModel/#syncViewSelection) is false.
|
|
438
|
+
* When 'syncViewSelection' is true and a [view](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTable/FeatureTableViewModel/#view) has been provided, the table will use that view's selection manager.
|
|
439
439
|
*
|
|
440
440
|
* @since 5.1
|
|
441
441
|
*/
|
|
@@ -601,7 +601,7 @@ export default class FeatureTableViewModel extends GridViewModel {
|
|
|
601
601
|
set hiddenFields(value: ReadonlyArrayOrCollection<string>);
|
|
602
602
|
/**
|
|
603
603
|
* Indicates whether to highlight the associated feature when a row is selected by checking the corresponding checkbox. This property is only applicable when working with a map and the [FeatureTable.view](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTable/#view) property is set.
|
|
604
|
-
* This property has no effect if [syncViewSelection](
|
|
604
|
+
* This property has no effect if [syncViewSelection](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTable/FeatureTableViewModel/#syncViewSelection) is `true` or a custom [selectionManager](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTable/FeatureTableViewModel/#selectionManager) has been provided.
|
|
605
605
|
*
|
|
606
606
|
* @since 4.25
|
|
607
607
|
*/
|
|
@@ -906,7 +906,7 @@ export default class FeatureTableViewModel extends GridViewModel {
|
|
|
906
906
|
/**
|
|
907
907
|
* Use this property to supply a custom selection manager that overrides the default selection manager.
|
|
908
908
|
* This is useful when applications want to share selection sets between components, without relying on the view's selection manager.
|
|
909
|
-
* This property is ignored if [syncViewSelection](
|
|
909
|
+
* This property is ignored if [syncViewSelection](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTable/FeatureTableViewModel/#syncViewSelection) is `true` and a 'view' has been provided.
|
|
910
910
|
*
|
|
911
911
|
* @since 5.0
|
|
912
912
|
*/
|
|
@@ -979,7 +979,7 @@ export default class FeatureTableViewModel extends GridViewModel {
|
|
|
979
979
|
* Enabling this does not automatically inherit the [selection sources](https://developers.arcgis.com/javascript/latest/references/core/views/SelectionManager/#sources) from the [SelectionManager](https://developers.arcgis.com/javascript/latest/references/core/views/SelectionManager/), (e.g. which layers or graphics collections the view listens to for selections).
|
|
980
980
|
* If you need specific selection sources, configure them separately via [SelectionManager.sources](https://developers.arcgis.com/javascript/latest/references/core/views/SelectionManager/#sources).
|
|
981
981
|
*
|
|
982
|
-
* This property takes precedence over the [selectionManager](
|
|
982
|
+
* This property takes precedence over the [selectionManager](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTable/FeatureTableViewModel/#selectionManager) property.
|
|
983
983
|
*
|
|
984
984
|
* @since 5.0
|
|
985
985
|
*/
|
|
@@ -993,7 +993,7 @@ export default class FeatureTableViewModel extends GridViewModel {
|
|
|
993
993
|
/**
|
|
994
994
|
* A reference to the instance of a table widget that is directly associated with this table. This only applies if this table is nested within another table widget. The parent table is responsible for creating this child table instance. The child table reacts to state changes on the parent table, including row selection.
|
|
995
995
|
*
|
|
996
|
-
* The parent table that this property references may also be nested, meaning it would refer to a different parent table. The top-level table can always be referenced via the [tableController](
|
|
996
|
+
* The parent table that this property references may also be nested, meaning it would refer to a different parent table. The top-level table can always be referenced via the [tableController](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTable/FeatureTableViewModel/#tableController) property. If only one nested table exists, then the values of [tableController](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTable/FeatureTableViewModel/#tableController) and `tableParent` are the same.
|
|
997
997
|
*
|
|
998
998
|
* @since 5.0
|
|
999
999
|
*/
|
|
@@ -342,7 +342,7 @@ export default class FeatureStore extends Accessor {
|
|
|
342
342
|
/**
|
|
343
343
|
* This property can be used to provide a custom selection manager that overrides the default selection manager.
|
|
344
344
|
* This is useful when applications want to share selection sets between components, without relying on the view's selection manager.
|
|
345
|
-
* This property is ignored if [syncViewSelection](
|
|
345
|
+
* This property is ignored if [syncViewSelection](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTable/support/FeatureStore/#syncViewSelection) is `true` and a 'view' has been provided.
|
|
346
346
|
*
|
|
347
347
|
* @internal
|
|
348
348
|
*/
|
|
@@ -467,7 +467,7 @@ export default class FeatureStore extends Accessor {
|
|
|
467
467
|
* Enabling this does not automatically inherit the [selection sources](https://developers.arcgis.com/javascript/latest/references/core/views/SelectionManager/#sources) from the [SelectionManager](https://developers.arcgis.com/javascript/latest/references/core/views/SelectionManager/), (e.g. which layers or graphics collections the view listens to for selections).
|
|
468
468
|
* If you need specific selection sources, configure them separately via [SelectionManager.sources](https://developers.arcgis.com/javascript/latest/references/core/views/SelectionManager/#sources).
|
|
469
469
|
*
|
|
470
|
-
* This property takes precedence over the [selectionManager](
|
|
470
|
+
* This property takes precedence over the [selectionManager](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTable/support/FeatureStore/#selectionManager) property.
|
|
471
471
|
*
|
|
472
472
|
* @default false
|
|
473
473
|
* @internal
|
|
@@ -926,8 +926,8 @@ export default class FeatureTable extends Widget<FeatureTableProperties> {
|
|
|
926
926
|
get container(): HTMLElement | null | undefined;
|
|
927
927
|
set container(value: HTMLElement | string | null | undefined);
|
|
928
928
|
/**
|
|
929
|
-
* A reference to the internal [selection manager](https://developers.arcgis.com/javascript/latest/references/core/views/SelectionManager/) used when a custom selection manager is not provided, and [syncViewSelection](
|
|
930
|
-
* When 'syncViewSelection' is true and a [view](
|
|
929
|
+
* A reference to the internal [selection manager](https://developers.arcgis.com/javascript/latest/references/core/views/SelectionManager/) used when a custom selection manager is not provided, and [syncViewSelection](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTable/#syncViewSelection) is false.
|
|
930
|
+
* When 'syncViewSelection' is true and a [view](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTable/#view) has been provided, the table will use that view's selection manager.
|
|
931
931
|
*
|
|
932
932
|
* @since 5.1
|
|
933
933
|
*/
|
|
@@ -1105,7 +1105,7 @@ export default class FeatureTable extends Widget<FeatureTableProperties> {
|
|
|
1105
1105
|
set hiddenFields(value: ReadonlyArrayOrCollection<string>);
|
|
1106
1106
|
/**
|
|
1107
1107
|
* Indicates whether to highlight the associated feature when a row is selected by checking the corresponding checkbox. This property is only applicable when working with a map and the [view](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTable/#view) property is set.
|
|
1108
|
-
* This property has no effect if [syncViewSelection](
|
|
1108
|
+
* This property has no effect if [syncViewSelection](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTable/#syncViewSelection) is `true` or a custom [selectionManager](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTable/#selectionManager) has been provided.
|
|
1109
1109
|
*
|
|
1110
1110
|
* @default true
|
|
1111
1111
|
* @since 4.25
|
|
@@ -1467,7 +1467,7 @@ export default class FeatureTable extends Widget<FeatureTableProperties> {
|
|
|
1467
1467
|
/**
|
|
1468
1468
|
* Use this property to supply a custom selection manager that overrides the default selection manager.
|
|
1469
1469
|
* This is useful when applications want to share selection sets between components, without relying on the view's selection manager.
|
|
1470
|
-
* This property is ignored if [syncViewSelection](
|
|
1470
|
+
* This property is ignored if [syncViewSelection](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTable/#syncViewSelection) is `true` and a 'view' has been provided.
|
|
1471
1471
|
*
|
|
1472
1472
|
* @since 5.0
|
|
1473
1473
|
*/
|
|
@@ -1540,7 +1540,7 @@ export default class FeatureTable extends Widget<FeatureTableProperties> {
|
|
|
1540
1540
|
* Enabling this does not automatically inherit the [selection sources](https://developers.arcgis.com/javascript/latest/references/core/views/SelectionManager/#sources) from the [SelectionManager](https://developers.arcgis.com/javascript/latest/references/core/views/SelectionManager/), (e.g. which layers or graphics collections the view listens to for selections).
|
|
1541
1541
|
* If you need specific selection sources, configure them separately via [SelectionManager.sources](https://developers.arcgis.com/javascript/latest/references/core/views/SelectionManager/#sources).
|
|
1542
1542
|
*
|
|
1543
|
-
* This property takes precedence over the [selectionManager](
|
|
1543
|
+
* This property takes precedence over the [selectionManager](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTable/#selectionManager) property.
|
|
1544
1544
|
*
|
|
1545
1545
|
* @default false
|
|
1546
1546
|
* @since 5.0
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type Accessor from "../../core/Accessor.js";
|
|
2
2
|
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated since version 5.2. Use the [Layer List (Next)](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-layer-list-next/) component instead.
|
|
5
|
+
* @since 5.0
|
|
6
|
+
*/
|
|
4
7
|
export interface LayerListVisibleElementsProperties extends Partial<Pick<LayerListVisibleElements, "catalogLayerList" | "closeButton" | "collapseButton" | "errors" | "filter" | "flow" | "heading" | "statusIndicators" | "temporaryLayerIndicators">> {}
|
|
5
8
|
|
|
6
9
|
/**
|
package/widgets/LayerList.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../core/Collection.js";import{deprecateWidget as i}from"../core/deprecate.js";import{IdentifiableMixin as o}from"../core/Identifiable.js";import s from"../core/Logger.js";import l from"../core/ReactiveMap.js";import{on as r,initial as a,watch as n}from"../core/reactiveUtils.js";import{property as d,subclass as p}from"../core/accessorSupport/decorators.js";import c from"./Widget.js";import{css as m}from"./LayerList/css.js";import h from"./LayerList/LayerListItem.js";import y from"./LayerList/LayerListViewModel.js";import u from"./LayerList/LayerListVisibleElements.js";import g from"./LayerList/ListItem.js";import{minDragEnabledItems as L,minFilterItems as _,getItem as f,getLayerType as v,removeDestroyedListItems as I,setFilterPredicate as w,sortLayersToIds as b,sortChildLayersToIds as C}from"./LayerList/support/layerListUtils.js";import{loadCalciteComponents as E}from"./support/componentsUtils.js";import{globalCss as F}from"./support/globalCss.js";import{calciteListFilterProps as M}from"./support/listUtils.js";import{tsx as O,messageBundle as T,vmEvent as P}from"./support/widget.js";import{setFocus as A}from"./support/widgetUtils.js";const D=t.ofType(g),R="nested";let k=class extends(o(c)){constructor(e,o){super(e,o),this._rootListEl=null,this._activeItem=null,this._tooltipReferenceMap=new l,this._focusRootFlowItem=!1,this._focusPanelFlowItem=!1,this._focusLayerFlowItem=null,this._layerListMap=new l,this._lastDragDetail=null,this._selectedDragItemLayerUid=null,this._rootGroupUid=`operational-${this.uid}`,this._openedLayersController=null,this.catalogLayerList=null,this.catalogOptions=null,this.collapsed=!1,this.dragEnabled=!1,this.filterPlaceholder="",this.filterPredicate=null,this.filterText="",this.headingLevel=2,this.knowledgeGraphOptions=null,this.layerTablesEnabled=new t(["knowledge-graph"]),this.listItemCanGiveFunction=null,this.listItemCanReceiveFunction=null,this.mapImageOptions=null,this.messages=null,this.messagesCommon=null,this.minDragEnabledItems=L,this.minFilterItems=_,this.openedLayers=new t,this.openedLayerLists=new t,this.selectedItems=new D,this.selectionMode="none",this.tableList=null,this.tileOptions=null,this.viewModel=new y({suppressDeprecationWarning:!0}),this.visibilityAppearance="default",this.visibleElements=new u,this._canMove=({dragEl:e,fromEl:t,toEl:i},o)=>{const s="pull"===o?this.listItemCanGiveFunction:this.listItemCanReceiveFunction,l=f(e);if(!l?.sortable)return!1;const r=f(t),a=v(t),n=f(i),d=v(i),p=!!a&&!!d&&a===d,c={selected:l,from:r,to:n},m=t.group,h=i.group,y=r?.layer?.type??"",u=n?.layer?.type??"",g=new Set(["map-image","catalog","knowledge-graph"]),L="sublayer";return m&&h&&"function"==typeof s?s.call(null,c):p&&!g.has(y)&&!g.has(u)&&l?.layer?.type!==L},this._onCatalogOpen=e=>{this.openedLayers.push(e.layer?.parent),this._focusLayerFlowItem=e.layer?.uid},this._onTablesOpen=e=>{this.openedLayers.push(e.layer),this._focusLayerFlowItem=e.layer?.uid},this._onPanelOpen=()=>{this._focusPanelFlowItem=!0},this._onTooltipReferenceChange=(e,t)=>{t?this._tooltipReferenceMap.set(e,t):this._tooltipReferenceMap.delete(e)},this._onSelectedDragItemLayerUidChange=e=>{this._selectedDragItemLayerUid=e},this._onTriggerAction=(e,t)=>{this.triggerAction(e,t)},this._clearActiveItem=()=>{this._activeItem=null},this._setActiveItem=e=>{if("default"!==this.visibilityAppearance)return;const t=Array.from(e.composedPath()).find(e=>e.classList?.contains(m.item));this._activeItem=f(t)},this._onCalciteListOrderChange=e=>{const{_lastDragDetail:t}=this,{toEl:i,fromEl:o,dragEl:s,newIndex:l}=e;if(o&&i&&!(t?.newIndex===l&&t?.dragEl===s&&t?.toEl===i&&t?.fromEl===o)){if(this._lastDragDetail=e,this._selectedDragItemLayerUid=s.value,o===i){const e=Array.from(o.children).filter(e=>e?.matches("calcite-list-item")).map(e=>e.value);return void this._sortLayers(o,e)}null!=l&&this._moveLayerFromChildList({toEl:i,fromEl:o,dragEl:s,newIndex:l})}},this.announceDeprecation=()=>{i(s.getLogger(this),"Layer List","arcgis-layer-list",{version:"5.0"})}}initialize(){this.addHandles([r(()=>this.openedLayers,"change",()=>this._handleOpenedLayersChange(),a),r(()=>this.viewModel.operationalItems,"change",()=>I(this.selectedItems),a),n(()=>[this.filterPredicate,this._rootListEl],()=>w(this._rootListEl,this.filterPredicate))])}loadDependencies(){return E({button:()=>import("@esri/calcite-components/dist/components/calcite-button"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip")})}destroy(){this._destroyOpenedLayerLists(),this._tooltipReferenceMap.clear()}get _totalItems(){return this.viewModel.operationalItems.flatten(e=>e.children.filter(e=>"catalog-dynamic-group"!==e.layer?.type)).length}get _visibleItems(){return this.operationalItems?.filter(e=>!e.hidden&&(this.visibleElements.errors||!e.error))}get _openedPanelItems(){return this._visibleItems.flatten(e=>e.children).filter(({hidden:e,panel:t})=>!e&&t?.open&&!t.disabled&&t.flowEnabled)}get _dragEnabled(){return this._totalItems>=this.minDragEnabledItems&&this.dragEnabled}get _filterEnabled(){return this._totalItems>=this.minFilterItems&&this.visibleElements.filter}get _renderedOpenLayerFlowItems(){const{openedLayers:e}=this;return e.toArray().map((t,i)=>this._renderLayerFlowItem(t,i===e.length-1))}get icon(){return"layers"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get listItemCreatedFunction(){return this.viewModel.listItemCreatedFunction}set listItemCreatedFunction(e){this.viewModel.listItemCreatedFunction=e}get operationalItems(){return this.viewModel.operationalItems}set operationalItems(e){this.viewModel.operationalItems=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}triggerAction(e,t){return this.viewModel.triggerAction(e,t)}render(){const e=this.viewModel?.state,t={[F.hidden]:"loading"===e,[F.disabled]:"disabled"===e};return O("div",{class:this.classes(m.base,F.widget,F.panel,t)},this._renderItemTooltips(),this._renderItems())}async _createFlowList(e,t){const{_layerListMap:i}=this,o=i.get(e);if(o)return o;const s="catalog"===e.type?await this._createCatalogLayerList(e):await this._createTableList(e);return t.aborted||i.set(e,s),s}async _handleOpenedLayersChange(){const{_layerListMap:e,openedLayers:t,openedLayerLists:i}=this;this._openedLayersController?.abort();const o=new AbortController,{signal:s}=o;this._openedLayersController=o,e.forEach((i,o)=>{t.includes(o)||(i.destroy(),e.delete(o))});const l=await Promise.all(t.map(e=>this._createFlowList(e,s)));if(s.aborted)return;i.removeAll(),i.addMany(l);const r=i.at(-1);r?"catalogLayer"in r?(this._set("catalogLayerList",r),this._set("tableList",null)):(this._set("catalogLayerList",null),this._set("tableList",r)):(this._set("catalogLayerList",null),this._set("tableList",null))}_destroyOpenedLayerLists(){this.openedLayerLists.destroyAll(),this.openedLayers.removeAll(),this._layerListMap.clear()}_renderItemTooltip(e){const{_tooltipReferenceMap:t,messages:i}=this;return e?O("calcite-tooltip",{key:`tooltip-${e.layer?.uid}`,overlayPositioning:"fixed",referenceElement:t.get(e.layer?.uid),topLayerDisabled:this.topLayerDisabled},i.layerIncompatibleTooltip):null}_renderItemTooltipNodes(e){return e.incompatible?this._renderItemTooltip(e):e.children?.filter(e=>!e.hidden).toArray().map(e=>this._renderItemTooltipNodes(e))}_renderItemTooltips(){return this._visibleItems?.toArray().map(e=>this._renderItemTooltipNodes(e))}_renderNoItemsMessage(){return O("div",{slot:"message"},this.messages.noItemsToDisplay)}_renderNoItems(){return O("div",{class:m.itemMessage,key:"esri-layer-list__no-items"},O("calcite-notice",{icon:"information",kind:"info",open:!0,width:"full"},this._renderNoItemsMessage()))}async _createCatalogLayerList(e){const{default:t}=await(import("./CatalogLayerList.js")),{headingLevel:i,catalogOptions:o,view:s,filterPlaceholder:l,listItemCreatedFunction:r,minFilterItems:a,selectionMode:n,visibilityAppearance:d,_onCatalogOpen:p,_onTablesOpen:c,layerTablesEnabled:m}=this;return new t({headingLevel:i,view:s,filterPlaceholder:l,listItemCreatedFunction:r,minFilterItems:a,selectionMode:n,visibilityAppearance:d,...o,catalogLayer:e,layerTablesEnabled:m,onCatalogOpen:p,onTablesOpen:c})}_getTableListParams(e){switch(e.type){case"knowledge-graph":return{...this.knowledgeGraphOptions,tables:e.tables};case"map-image":return{...this.mapImageOptions,tables:e.subtables};case"tile":return{...this.tileOptions,tables:e.subtables};default:return null}}async _createTableList(e){const{default:t}=await(import("./TableList.js")),{headingLevel:i,selectionMode:o,dragEnabled:s}=this;return new t({headingLevel:i,selectionMode:o,dragEnabled:s,...this._getTableListParams(e)})}_renderLayerFlowItem(e,t){const{messages:i,openedLayers:o}=this,s=e.title||this.messages.untitledLayer;return O("calcite-flow-item",{afterCreate:this._focusLayerFlowItemNode,afterUpdate:this._focusLayerFlowItemNode,bind:this,"data-layer-uid":e.uid,description:s,heading:i["catalog"===e.type?"catalogLayers":"tables"],headingLevel:this.headingLevel,key:`flow-layer-list-${e.uid}`,selected:t,onCalciteFlowItemBack:e=>{e.preventDefault(),o.pop();const t=o.at(-1);t?this._focusLayerFlowItem=t.uid:this._focusRootFlowItem=!0}},this._layerListMap.get(e)?.render())}_renderPanelFlowItems(){const{_openedPanelItems:e,openedLayers:t}=this;return e.toArray().map(({title:i,panel:o},s)=>{const l=()=>this._handlePanelFlowItemBack(o);return O("calcite-flow-item",{afterCreate:this._focusPanelFlowItemNode,afterUpdate:this._focusPanelFlowItemNode,bind:this,description:i,heading:o.title,headingLevel:this.headingLevel,key:`flow-panel-${o.uid}`,selected:!t.length&&s===e.length-1,onCalciteFlowItemBack:e=>{e.preventDefault(),l()}},o.render(),O("calcite-button",{appearance:"transparent",slot:"footer-start",width:"full",onclick:l},this.messagesCommon.back))})}_handlePanelFlowItemBack(e){e.open=!1,this._focusRootFlowItem=!0}_focusRootFlowItemNode(e){this._focusRootFlowItem&&(this._focusRootFlowItem=!1,A(e))}_focusLayerFlowItemNode(e){this._focusLayerFlowItem===e.dataset.layerUid&&(this._focusLayerFlowItem=null,A(e))}_focusPanelFlowItemNode(e){this._focusPanelFlowItem&&(this._focusPanelFlowItem=!1,A(e))}_renderItems(){const{visible:e,collapsed:t,_visibleItems:i,_openedPanelItems:o,_filterEnabled:s,_rootGroupUid:l,visibleElements:{closeButton:r,collapseButton:a,heading:n,flow:d},_dragEnabled:p,selectionMode:c,filterText:h,openedLayers:y,filterPlaceholder:u,messages:g}=this,L=[O("calcite-flow-item",{afterCreate:this._focusRootFlowItemNode,afterUpdate:this._focusRootFlowItemNode,bind:this,closable:r,closed:!e,collapsed:t,collapsible:a,heading:n?g.widgetLabel:void 0,headingLevel:this.headingLevel,key:"root-flow-item",selected:!y.length&&!o.length,onCalciteFlowItemClose:()=>this.visible=!1},i?.length?null:this._renderNoItems(),O("calcite-list",{afterCreate:e=>{this._rootListEl=e,e.addEventListener("focusin",this._setActiveItem),e.addEventListener("focusout",this._clearActiveItem)},afterRemoved:e=>{this._rootListEl=null,e.removeEventListener("focusin",this._setActiveItem),e.removeEventListener("focusout",this._clearActiveItem)},canPull:e=>this._canMove(e,"pull"),canPut:e=>this._canMove(e,"put"),"data-layer-type":l,displayMode:R,dragEnabled:p,filterEnabled:s,filterPlaceholder:u,filterProps:M,filterText:s?h:"",group:l,key:"root-list",label:g.widgetLabel,selectionAppearance:"border",selectionMode:c,onCalciteListChange:e=>this._handleCalciteListChange(e),onCalciteListDragEnd:e=>this._handleCalciteListDragEnd(e.detail),onCalciteListFilter:e=>this.filterText=e.currentTarget?.filterText??"",onCalciteListOrderChange:e=>this._onCalciteListOrderChange(e.detail),onmouseleave:this._clearActiveItem,onmouseover:this._setActiveItem},i.toArray().map(e=>this._renderItem(e)),s?O("div",{class:m.filterNoResults,slot:"filter-no-results"},O("calcite-notice",{kind:"info",open:!0,width:"full"},this._renderNoItemsMessage())):null)),this._renderPanelFlowItems(),this._renderedOpenLayerFlowItems];return e?d?O("calcite-flow",{key:"root-flow"},L):L:null}_renderItem(e,t,i){return O(h,{activeItem:this._activeItem,canMove:this._canMove,css:m,displayMode:R,dragEnabled:this.dragEnabled,item:e,key:`layerListItem-${e.layer?.uid}`,layerTablesEnabled:this.layerTablesEnabled,listModeDisabled:this.viewModel.listModeDisabled,messages:this.messages,messagesCommon:this.messagesCommon,parent:t,parentTitles:i,rootGroupUid:this._rootGroupUid,selectedDragItemLayerUid:this._selectedDragItemLayerUid,selectedItems:this.selectedItems,selectionMode:this.selectionMode,visibilityAppearance:this.visibilityAppearance,visibleElements:this.visibleElements,onAction:this._onTriggerAction,onCatalogOpen:this._onCatalogOpen,onPanelOpen:this._onPanelOpen,onSelectedDragItemLayerUidChange:this._onSelectedDragItemLayerUidChange,onTablesOpen:this._onTablesOpen,onTooltipReferenceChange:this._onTooltipReferenceChange})}_moveLayerFromChildList({toEl:e,fromEl:t,dragEl:i,newIndex:o}){const s=f(i),l=f(e),r=f(t);this.viewModel.moveListItem(s,r,l,o)}_handleCalciteListDragEnd({fromEl:e,dragEl:t,oldIndex:i}){null!=i&&e.insertBefore(t,e.children[i])}_sortLayers(e,t){if(e)if(e===this._rootListEl)b(this.view?.map?.layers,t);else{const i=f(e);if(!i)return;C(i,t)}}_handleCalciteListChange(e){const{selectionMode:t,selectedItems:i}=this;if("none"===t)return;const o=e.target.selectedItems.map(e=>f(e)).filter(Boolean);i.removeAll(),i.addMany(o)}};e([d()],k.prototype,"_rootListEl",void 0),e([d()],k.prototype,"_activeItem",void 0),e([d()],k.prototype,"_tooltipReferenceMap",void 0),e([d()],k.prototype,"_focusRootFlowItem",void 0),e([d()],k.prototype,"_focusPanelFlowItem",void 0),e([d()],k.prototype,"_focusLayerFlowItem",void 0),e([d()],k.prototype,"_layerListMap",void 0),e([d()],k.prototype,"_totalItems",null),e([d()],k.prototype,"_visibleItems",null),e([d()],k.prototype,"_openedPanelItems",null),e([d()],k.prototype,"_dragEnabled",null),e([d()],k.prototype,"_filterEnabled",null),e([d()],k.prototype,"_renderedOpenLayerFlowItems",null),e([d({readOnly:!0})],k.prototype,"catalogLayerList",void 0),e([d()],k.prototype,"catalogOptions",void 0),e([d()],k.prototype,"collapsed",void 0),e([d()],k.prototype,"dragEnabled",void 0),e([d()],k.prototype,"filterPlaceholder",void 0),e([d()],k.prototype,"filterPredicate",void 0),e([d()],k.prototype,"filterText",void 0),e([d()],k.prototype,"headingLevel",void 0),e([d()],k.prototype,"icon",null),e([d()],k.prototype,"knowledgeGraphOptions",void 0),e([d()],k.prototype,"label",null),e([d()],k.prototype,"layerTablesEnabled",void 0),e([d()],k.prototype,"listItemCanGiveFunction",void 0),e([d()],k.prototype,"listItemCanReceiveFunction",void 0),e([d()],k.prototype,"listItemCreatedFunction",null),e([d()],k.prototype,"mapImageOptions",void 0),e([d(),T("esri/widgets/LayerList/t9n/LayerList")],k.prototype,"messages",void 0),e([d(),T("esri/t9n/common")],k.prototype,"messagesCommon",void 0),e([d()],k.prototype,"minDragEnabledItems",void 0),e([d()],k.prototype,"minFilterItems",void 0),e([d({readOnly:!0})],k.prototype,"openedLayers",void 0),e([d({readOnly:!0})],k.prototype,"openedLayerLists",void 0),e([d()],k.prototype,"operationalItems",null),e([d()],k.prototype,"selectedItems",void 0),e([d()],k.prototype,"selectionMode",void 0),e([d({readOnly:!0})],k.prototype,"tableList",void 0),e([d()],k.prototype,"tileOptions",void 0),e([d()],k.prototype,"view",null),e([P("trigger-action"),d({type:y})],k.prototype,"viewModel",void 0),e([d()],k.prototype,"visibilityAppearance",void 0),e([d({type:u,nonNullable:!0})],k.prototype,"visibleElements",void 0),k=e([p("esri.widgets.LayerList")],k);const j=k;export{j as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../core/Collection.js";import{deprecateWidget as i}from"../core/deprecate.js";import{IdentifiableMixin as o}from"../core/Identifiable.js";import s from"../core/Logger.js";import l from"../core/ReactiveMap.js";import{on as r,initial as a,watch as n}from"../core/reactiveUtils.js";import{property as d,subclass as p}from"../core/accessorSupport/decorators.js";import c from"./Widget.js";import{css as m}from"./LayerList/css.js";import h from"./LayerList/LayerListItem.js";import y from"./LayerList/LayerListViewModel.js";import u from"./LayerList/LayerListVisibleElements.js";import g from"./LayerList/ListItem.js";import{minDragEnabledItems as L,minFilterItems as _,getItem as f,getLayerType as v,removeDestroyedListItems as I,setFilterPredicate as w,sortLayersToIds as b,sortChildLayersToIds as C}from"./LayerList/support/layerListUtils.js";import{loadCalciteComponents as E}from"./support/componentsUtils.js";import{globalCss as F}from"./support/globalCss.js";import{calciteListFilterProps as M}from"./support/listUtils.js";import{tsx as O,messageBundle as T,vmEvent as P}from"./support/widget.js";import{setFocus as A}from"./support/widgetUtils.js";const D=t.ofType(g),R="nested";let k=class extends(o(c)){constructor(e,o){super(e,o),this._rootListEl=null,this._activeItem=null,this._tooltipReferenceMap=new l,this._focusRootFlowItem=!1,this._focusPanelFlowItem=!1,this._focusLayerFlowItem=null,this._layerListMap=new l,this._lastDragDetail=null,this._selectedDragItemLayerUid=null,this._rootGroupUid=`operational-${this.uid}`,this._openedLayersController=null,this.catalogLayerList=null,this.catalogOptions=null,this.collapsed=!1,this.dragEnabled=!1,this.filterPlaceholder="",this.filterPredicate=null,this.filterText="",this.headingLevel=2,this.knowledgeGraphOptions=null,this.layerTablesEnabled=new t(["knowledge-graph"]),this.listItemCanGiveFunction=null,this.listItemCanReceiveFunction=null,this.mapImageOptions=null,this.messages=null,this.messagesCommon=null,this.minDragEnabledItems=L,this.minFilterItems=_,this.openedLayers=new t,this.openedLayerLists=new t,this.selectedItems=new D,this.selectionMode="none",this.tableList=null,this.tileOptions=null,this.viewModel=new y({suppressDeprecationWarning:!0}),this.visibilityAppearance="default",this.visibleElements=new u,this._canMove=({dragEl:e,fromEl:t,toEl:i},o)=>{const s="pull"===o?this.listItemCanGiveFunction:this.listItemCanReceiveFunction,l=f(e);if(!l?.sortable)return!1;const r=f(t),a=v(t),n=f(i),d=v(i),p=!!a&&!!d&&a===d,c={selected:l,from:r,to:n},m=t.group,h=i.group,y=r?.layer?.type??"",u=n?.layer?.type??"",g=new Set(["map-image","catalog","knowledge-graph"]),L="sublayer";return m&&h&&"function"==typeof s?s.call(null,c):p&&!g.has(y)&&!g.has(u)&&l?.layer?.type!==L},this._onCatalogOpen=e=>{this.openedLayers.push(e.layer?.parent),this._focusLayerFlowItem=e.layer?.uid},this._onTablesOpen=e=>{this.openedLayers.push(e.layer),this._focusLayerFlowItem=e.layer?.uid},this._onPanelOpen=()=>{this._focusPanelFlowItem=!0},this._onTooltipReferenceChange=(e,t)=>{t?this._tooltipReferenceMap.set(e,t):this._tooltipReferenceMap.delete(e)},this._onSelectedDragItemLayerUidChange=e=>{this._selectedDragItemLayerUid=e},this._onTriggerAction=(e,t)=>{this.triggerAction(e,t)},this._clearActiveItem=()=>{this._activeItem=null},this._setActiveItem=e=>{if("default"!==this.visibilityAppearance)return;const t=Array.from(e.composedPath()).find(e=>e.classList?.contains(m.item));this._activeItem=f(t)},this._onCalciteListOrderChange=e=>{const{_lastDragDetail:t}=this,{toEl:i,fromEl:o,dragEl:s,newIndex:l}=e;if(o&&i&&!(t?.newIndex===l&&t?.dragEl===s&&t?.toEl===i&&t?.fromEl===o)){if(this._lastDragDetail=e,this._selectedDragItemLayerUid=s.value,o===i){const e=Array.from(o.children).filter(e=>e?.matches("calcite-list-item")).map(e=>e.value);return void this._sortLayers(o,e)}null!=l&&this._moveLayerFromChildList({toEl:i,fromEl:o,dragEl:s,newIndex:l})}},this.announceDeprecation=()=>{i(s.getLogger(this),"Layer List","arcgis-layer-list",{version:"5.0"})}}initialize(){this.addHandles([r(()=>this.openedLayers,"change",()=>this._handleOpenedLayersChange(),a),r(()=>this.viewModel.operationalItems,"change",()=>I(this.selectedItems),a),n(()=>[this.filterPredicate,this._rootListEl],()=>w(this._rootListEl,this.filterPredicate))])}loadDependencies(){return E({button:()=>import("@esri/calcite-components/dist/components/calcite-button"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip")})}destroy(){this._destroyOpenedLayerLists(),this._tooltipReferenceMap.clear()}get _totalItems(){return this.viewModel.operationalItems.flatten(e=>e.children.filter(e=>"catalog-dynamic-group"!==e.layer?.type)).length}get _visibleItems(){return this.operationalItems?.filter(e=>!e.hidden&&(this.visibleElements.errors||!e.error))}get _openedPanelItems(){return this._visibleItems.flatten(e=>e.children).filter(({hidden:e,panel:t})=>!e&&t?.open&&!t.disabled&&t.flowEnabled)}get _dragEnabled(){return this._totalItems>=this.minDragEnabledItems&&this.dragEnabled}get _filterEnabled(){return this._totalItems>=this.minFilterItems&&this.visibleElements.filter}get _renderedOpenLayerFlowItems(){const{openedLayers:e}=this;return e.toArray().map((t,i)=>this._renderLayerFlowItem(t,i===e.length-1))}get icon(){return"layers"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get listItemCreatedFunction(){return this.viewModel.listItemCreatedFunction}set listItemCreatedFunction(e){this.viewModel.listItemCreatedFunction=e}get operationalItems(){return this.viewModel.operationalItems}set operationalItems(e){this.viewModel.operationalItems=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}triggerAction(e,t){return this.viewModel.triggerAction(e,t)}render(){const e=this.viewModel?.state,t={[F.hidden]:"loading"===e,[F.disabled]:"disabled"===e};return O("div",{class:this.classes(m.base,F.widget,F.panel,t)},this._renderItemTooltips(),this._renderItems())}async _createFlowList(e,t){const{_layerListMap:i}=this,o=i.get(e);if(o)return o;const s="catalog"===e.type?await this._createCatalogLayerList(e):await this._createTableList(e);return t.aborted||i.set(e,s),s}async _handleOpenedLayersChange(){const{_layerListMap:e,openedLayers:t,openedLayerLists:i}=this;this._openedLayersController?.abort();const o=new AbortController,{signal:s}=o;this._openedLayersController=o,e.forEach((i,o)=>{t.includes(o)||(i.destroy(),e.delete(o))});const l=await Promise.all(t.map(e=>this._createFlowList(e,s)));if(s.aborted)return;i.removeAll(),i.addMany(l);const r=i.at(-1);r?"catalogLayer"in r?(this._set("catalogLayerList",r),this._set("tableList",null)):(this._set("catalogLayerList",null),this._set("tableList",r)):(this._set("catalogLayerList",null),this._set("tableList",null))}_destroyOpenedLayerLists(){this.openedLayerLists.destroyAll(),this.openedLayers.removeAll(),this._layerListMap.clear()}_renderItemTooltip(e){const{_tooltipReferenceMap:t,messages:i}=this;return e?O("calcite-tooltip",{key:`tooltip-${e.layer?.uid}`,overlayPositioning:"fixed",referenceElement:t.get(e.layer?.uid),topLayerDisabled:this.topLayerDisabled},i.layerIncompatibleTooltip):null}_renderItemTooltipNodes(e){return e.incompatible?this._renderItemTooltip(e):e.children?.filter(e=>!e.hidden).toArray().map(e=>this._renderItemTooltipNodes(e))}_renderItemTooltips(){return this._visibleItems?.toArray().map(e=>this._renderItemTooltipNodes(e))}_renderNoItemsMessage(){return O("div",{slot:"message"},this.messages.noItemsToDisplay)}_renderNoItems(){return O("div",{class:m.itemMessage,key:"esri-layer-list__no-items"},O("calcite-notice",{icon:"information",kind:"info",open:!0,width:"full"},this._renderNoItemsMessage()))}async _createCatalogLayerList(e){const{default:t}=await(import("./CatalogLayerList.js")),{headingLevel:i,catalogOptions:o,view:s,filterPlaceholder:l,listItemCreatedFunction:r,minFilterItems:a,selectionMode:n,visibilityAppearance:d,_onCatalogOpen:p,_onTablesOpen:c,layerTablesEnabled:m}=this;return new t({headingLevel:i,view:s,filterPlaceholder:l,listItemCreatedFunction:r,minFilterItems:a,selectionMode:n,visibilityAppearance:d,...o,catalogLayer:e,layerTablesEnabled:m,onCatalogOpen:p,onTablesOpen:c,suppressDeprecationWarning:!0})}_getTableListParams(e){switch(e.type){case"knowledge-graph":return{...this.knowledgeGraphOptions,tables:e.tables};case"map-image":return{...this.mapImageOptions,tables:e.subtables};case"tile":return{...this.tileOptions,tables:e.subtables};default:return null}}async _createTableList(e){const{default:t}=await(import("./TableList.js")),{headingLevel:i,selectionMode:o,dragEnabled:s}=this;return new t({headingLevel:i,selectionMode:o,dragEnabled:s,...this._getTableListParams(e)})}_renderLayerFlowItem(e,t){const{messages:i,openedLayers:o}=this,s=e.title||this.messages.untitledLayer;return O("calcite-flow-item",{afterCreate:this._focusLayerFlowItemNode,afterUpdate:this._focusLayerFlowItemNode,bind:this,"data-layer-uid":e.uid,description:s,heading:i["catalog"===e.type?"catalogLayers":"tables"],headingLevel:this.headingLevel,key:`flow-layer-list-${e.uid}`,selected:t,onCalciteFlowItemBack:e=>{e.preventDefault(),o.pop();const t=o.at(-1);t?this._focusLayerFlowItem=t.uid:this._focusRootFlowItem=!0}},this._layerListMap.get(e)?.render())}_renderPanelFlowItems(){const{_openedPanelItems:e,openedLayers:t}=this;return e.toArray().map(({title:i,panel:o},s)=>{const l=()=>this._handlePanelFlowItemBack(o);return O("calcite-flow-item",{afterCreate:this._focusPanelFlowItemNode,afterUpdate:this._focusPanelFlowItemNode,bind:this,description:i,heading:o.title,headingLevel:this.headingLevel,key:`flow-panel-${o.uid}`,selected:!t.length&&s===e.length-1,onCalciteFlowItemBack:e=>{e.preventDefault(),l()}},o.render(),O("calcite-button",{appearance:"transparent",slot:"footer-start",width:"full",onclick:l},this.messagesCommon.back))})}_handlePanelFlowItemBack(e){e.open=!1,this._focusRootFlowItem=!0}_focusRootFlowItemNode(e){this._focusRootFlowItem&&(this._focusRootFlowItem=!1,A(e))}_focusLayerFlowItemNode(e){this._focusLayerFlowItem===e.dataset.layerUid&&(this._focusLayerFlowItem=null,A(e))}_focusPanelFlowItemNode(e){this._focusPanelFlowItem&&(this._focusPanelFlowItem=!1,A(e))}_renderItems(){const{visible:e,collapsed:t,_visibleItems:i,_openedPanelItems:o,_filterEnabled:s,_rootGroupUid:l,visibleElements:{closeButton:r,collapseButton:a,heading:n,flow:d},_dragEnabled:p,selectionMode:c,filterText:h,openedLayers:y,filterPlaceholder:u,messages:g}=this,L=[O("calcite-flow-item",{afterCreate:this._focusRootFlowItemNode,afterUpdate:this._focusRootFlowItemNode,bind:this,closable:r,closed:!e,collapsed:t,collapsible:a,heading:n?g.widgetLabel:void 0,headingLevel:this.headingLevel,key:"root-flow-item",selected:!y.length&&!o.length,onCalciteFlowItemClose:()=>this.visible=!1},i?.length?null:this._renderNoItems(),O("calcite-list",{afterCreate:e=>{this._rootListEl=e,e.addEventListener("focusin",this._setActiveItem),e.addEventListener("focusout",this._clearActiveItem)},afterRemoved:e=>{this._rootListEl=null,e.removeEventListener("focusin",this._setActiveItem),e.removeEventListener("focusout",this._clearActiveItem)},canPull:e=>this._canMove(e,"pull"),canPut:e=>this._canMove(e,"put"),"data-layer-type":l,displayMode:R,dragEnabled:p,filterEnabled:s,filterPlaceholder:u,filterProps:M,filterText:s?h:"",group:l,key:"root-list",label:g.widgetLabel,selectionAppearance:"border",selectionMode:c,onCalciteListChange:e=>this._handleCalciteListChange(e),onCalciteListDragEnd:e=>this._handleCalciteListDragEnd(e.detail),onCalciteListFilter:e=>this.filterText=e.currentTarget?.filterText??"",onCalciteListOrderChange:e=>this._onCalciteListOrderChange(e.detail),onmouseleave:this._clearActiveItem,onmouseover:this._setActiveItem},i.toArray().map(e=>this._renderItem(e)),s?O("div",{class:m.filterNoResults,slot:"filter-no-results"},O("calcite-notice",{kind:"info",open:!0,width:"full"},this._renderNoItemsMessage())):null)),this._renderPanelFlowItems(),this._renderedOpenLayerFlowItems];return e?d?O("calcite-flow",{key:"root-flow"},L):L:null}_renderItem(e,t,i){return O(h,{activeItem:this._activeItem,canMove:this._canMove,css:m,displayMode:R,dragEnabled:this.dragEnabled,item:e,key:`layerListItem-${e.layer?.uid}`,layerTablesEnabled:this.layerTablesEnabled,listModeDisabled:this.viewModel.listModeDisabled,messages:this.messages,messagesCommon:this.messagesCommon,parent:t,parentTitles:i,rootGroupUid:this._rootGroupUid,selectedDragItemLayerUid:this._selectedDragItemLayerUid,selectedItems:this.selectedItems,selectionMode:this.selectionMode,visibilityAppearance:this.visibilityAppearance,visibleElements:this.visibleElements,onAction:this._onTriggerAction,onCatalogOpen:this._onCatalogOpen,onPanelOpen:this._onPanelOpen,onSelectedDragItemLayerUidChange:this._onSelectedDragItemLayerUidChange,onTablesOpen:this._onTablesOpen,onTooltipReferenceChange:this._onTooltipReferenceChange})}_moveLayerFromChildList({toEl:e,fromEl:t,dragEl:i,newIndex:o}){const s=f(i),l=f(e),r=f(t);this.viewModel.moveListItem(s,r,l,o)}_handleCalciteListDragEnd({fromEl:e,dragEl:t,oldIndex:i}){null!=i&&e.insertBefore(t,e.children[i])}_sortLayers(e,t){if(e)if(e===this._rootListEl)b(this.view?.map?.layers,t);else{const i=f(e);if(!i)return;C(i,t)}}_handleCalciteListChange(e){const{selectionMode:t,selectedItems:i}=this;if("none"===t)return;const o=e.target.selectedItems.map(e=>f(e)).filter(Boolean);i.removeAll(),i.addMany(o)}};e([d()],k.prototype,"_rootListEl",void 0),e([d()],k.prototype,"_activeItem",void 0),e([d()],k.prototype,"_tooltipReferenceMap",void 0),e([d()],k.prototype,"_focusRootFlowItem",void 0),e([d()],k.prototype,"_focusPanelFlowItem",void 0),e([d()],k.prototype,"_focusLayerFlowItem",void 0),e([d()],k.prototype,"_layerListMap",void 0),e([d()],k.prototype,"_totalItems",null),e([d()],k.prototype,"_visibleItems",null),e([d()],k.prototype,"_openedPanelItems",null),e([d()],k.prototype,"_dragEnabled",null),e([d()],k.prototype,"_filterEnabled",null),e([d()],k.prototype,"_renderedOpenLayerFlowItems",null),e([d({readOnly:!0})],k.prototype,"catalogLayerList",void 0),e([d()],k.prototype,"catalogOptions",void 0),e([d()],k.prototype,"collapsed",void 0),e([d()],k.prototype,"dragEnabled",void 0),e([d()],k.prototype,"filterPlaceholder",void 0),e([d()],k.prototype,"filterPredicate",void 0),e([d()],k.prototype,"filterText",void 0),e([d()],k.prototype,"headingLevel",void 0),e([d()],k.prototype,"icon",null),e([d()],k.prototype,"knowledgeGraphOptions",void 0),e([d()],k.prototype,"label",null),e([d()],k.prototype,"layerTablesEnabled",void 0),e([d()],k.prototype,"listItemCanGiveFunction",void 0),e([d()],k.prototype,"listItemCanReceiveFunction",void 0),e([d()],k.prototype,"listItemCreatedFunction",null),e([d()],k.prototype,"mapImageOptions",void 0),e([d(),T("esri/widgets/LayerList/t9n/LayerList")],k.prototype,"messages",void 0),e([d(),T("esri/t9n/common")],k.prototype,"messagesCommon",void 0),e([d()],k.prototype,"minDragEnabledItems",void 0),e([d()],k.prototype,"minFilterItems",void 0),e([d({readOnly:!0})],k.prototype,"openedLayers",void 0),e([d({readOnly:!0})],k.prototype,"openedLayerLists",void 0),e([d()],k.prototype,"operationalItems",null),e([d()],k.prototype,"selectedItems",void 0),e([d()],k.prototype,"selectionMode",void 0),e([d({readOnly:!0})],k.prototype,"tableList",void 0),e([d()],k.prototype,"tileOptions",void 0),e([d()],k.prototype,"view",null),e([P("trigger-action"),d({type:y})],k.prototype,"viewModel",void 0),e([d()],k.prototype,"visibilityAppearance",void 0),e([d({type:u,nonNullable:!0})],k.prototype,"visibleElements",void 0),k=e([p("esri.widgets.LayerList")],k);const j=k;export{j as default};
|
|
@@ -13,6 +13,7 @@ import type { ActionButtonProperties } from "../../support/actions/ActionButton.
|
|
|
13
13
|
import type { ReadonlyArrayOrCollection } from "../../core/Collection.js";
|
|
14
14
|
import type { ListItemPanelProperties } from "./ListItemPanel.js";
|
|
15
15
|
|
|
16
|
+
/** @deprecated since 5.2. Use the [Table List (Next)](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-table-list-next/) component instead. */
|
|
16
17
|
export interface ListItemProperties extends IdentifiableMixinProperties, Partial<Pick<ListItem, "actionsOpen" | "hidden" | "layer" | "listModeDisabled" | "open" | "parent">> {
|
|
17
18
|
/** A nested 2-dimensional collection of actions that could be triggered on the item. */
|
|
18
19
|
actionsSections?: ReadonlyArrayOrCollection<ReadonlyArrayOrCollection<((ActionButtonProperties & { type: "button" }) | (ActionToggleProperties & { type: "toggle" }))>>;
|
|
@@ -51,6 +52,7 @@ export interface ListItemProperties extends IdentifiableMixinProperties, Partial
|
|
|
51
52
|
* associated properties and allows the developer to configure actions related to the table,
|
|
52
53
|
* and allows the developer to add content to the item related to the table.
|
|
53
54
|
*
|
|
55
|
+
* @deprecated since 5.2. Use the [Table List (Next)](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-table-list-next/) component instead.
|
|
54
56
|
* @since 4.17
|
|
55
57
|
* @see [TableList](https://developers.arcgis.com/javascript/latest/references/core/widgets/TableList/)
|
|
56
58
|
* @see [TableListViewModel](https://developers.arcgis.com/javascript/latest/references/core/widgets/TableList/TableListViewModel/)
|
|
@@ -4,6 +4,7 @@ import type { Icon } from "@esri/calcite-components/components/calcite-icon";
|
|
|
4
4
|
import type { IdentifiableMixin, IdentifiableMixinProperties } from "../../core/Identifiable.js";
|
|
5
5
|
import type { WidgetProperties } from "../Widget.js";
|
|
6
6
|
|
|
7
|
+
/** @deprecated since 5.2. Use the [Table List (Next)](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-table-list-next/) component instead. */
|
|
7
8
|
export interface ListItemPanelProperties extends WidgetProperties, IdentifiableMixinProperties, Partial<Pick<ListItemPanel, "content" | "disabled" | "flowEnabled" | "image" | "listItem" | "open" | "title">> {
|
|
8
9
|
/**
|
|
9
10
|
* Icon which represents the panel.
|
|
@@ -46,6 +47,7 @@ export interface ListItemPanelProperties extends WidgetProperties, IdentifiableM
|
|
|
46
47
|
* The content displayed in the ListItem panel. This can be a [String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String),
|
|
47
48
|
* a [Widget](https://developers.arcgis.com/javascript/latest/references/core/widgets/Widget/) instance, or an [HTMLElement](https://developer.mozilla.org/docs/Web/API/HTMLElement).
|
|
48
49
|
*
|
|
50
|
+
* @deprecated since 5.2. Use the [Table List (Next)](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-table-list-next/) component instead.
|
|
49
51
|
* @see [content](https://developers.arcgis.com/javascript/latest/references/core/widgets/TableList/ListItemPanel/#content)
|
|
50
52
|
*/
|
|
51
53
|
export type ListItemPanelContent = Widget | HTMLElement | string;
|
|
@@ -54,6 +56,7 @@ export type ListItemPanelContent = Widget | HTMLElement | string;
|
|
|
54
56
|
* Defines the content(s) that can be displayed in a ListItem panel. This can be a single content item
|
|
55
57
|
* or an array of content items, allowing for flexible panel layouts.
|
|
56
58
|
*
|
|
59
|
+
* @deprecated since 5.2. Use the [Table List (Next)](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-table-list-next/) component instead.
|
|
57
60
|
* @see [content](https://developers.arcgis.com/javascript/latest/references/core/widgets/TableList/ListItemPanel/#content)
|
|
58
61
|
*/
|
|
59
62
|
export type ListItemPanelContents = ListItemPanelContent | ListItemPanelContent[];
|
|
@@ -64,6 +67,7 @@ export type ListItemPanelContents = ListItemPanelContent | ListItemPanelContent[
|
|
|
64
67
|
* Rather, they are modified using the [TableList.listItemCreatedFunction](https://developers.arcgis.com/javascript/latest/references/core/widgets/TableList/#listItemCreatedFunction)
|
|
65
68
|
* property in the [TableList](https://developers.arcgis.com/javascript/latest/references/core/widgets/TableList/) widget.
|
|
66
69
|
*
|
|
70
|
+
* @deprecated since 5.2. Use the [Table List (Next)](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-table-list-next/) component instead.
|
|
67
71
|
* @since 4.29
|
|
68
72
|
* @see [TableList](https://developers.arcgis.com/javascript/latest/references/core/widgets/TableList/)
|
|
69
73
|
* @see [ListItem](https://developers.arcgis.com/javascript/latest/references/core/widgets/TableList/ListItem/)
|
|
@@ -9,8 +9,10 @@ import type { EventedAccessor } from "../../core/Evented.js";
|
|
|
9
9
|
import type { Action } from "../LayerList/types.js";
|
|
10
10
|
import type { ListItemModifier, State } from "./types.js";
|
|
11
11
|
|
|
12
|
+
/** @deprecated since 5.2. Use the [Table List (Next)](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-table-list-next/) component instead. */
|
|
12
13
|
export interface TableListViewModelProperties extends Partial<Pick<TableListViewModel, "checkPublishStatusEnabled" | "listItemCreatedFunction" | "listModeDisabled" | "map" | "tables">> {}
|
|
13
14
|
|
|
15
|
+
/** @deprecated since 5.2. Use the [Table List (Next)](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-table-list-next/) component instead. */
|
|
14
16
|
export interface TableListViewModelEvents {
|
|
15
17
|
/**
|
|
16
18
|
* Emitted when the user clicks an [action](https://developers.arcgis.com/javascript/latest/references/core/support/actions/ActionButton/) or
|
|
@@ -25,6 +27,7 @@ export interface TableListViewModelEvents {
|
|
|
25
27
|
/**
|
|
26
28
|
* The event object for the `trigger-action` event in the table list.
|
|
27
29
|
*
|
|
30
|
+
* @deprecated since 5.2. Use the [Table List (Next)](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-table-list-next/) component instead.
|
|
28
31
|
* @see [@trigger-action](https://developers.arcgis.com/javascript/latest/references/core/widgets/TableList/TableListViewModel/#event-trigger-action)
|
|
29
32
|
*/
|
|
30
33
|
export interface TableListViewModelTriggerActionEvent {
|
|
@@ -37,6 +40,7 @@ export interface TableListViewModelTriggerActionEvent {
|
|
|
37
40
|
/**
|
|
38
41
|
* Provides the logic for the [TableList](https://developers.arcgis.com/javascript/latest/references/core/widgets/TableList/) widget and [component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-table-list/).
|
|
39
42
|
*
|
|
43
|
+
* @deprecated since 5.2. Use the [Table List (Next)](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-table-list-next/) component instead.
|
|
40
44
|
* @since 4.17
|
|
41
45
|
* @see [TableList](https://developers.arcgis.com/javascript/latest/references/core/widgets/TableList/) widget
|
|
42
46
|
* @see [Table List component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-table-list/)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as t}from"tslib";import e from"../../core/Collection.js";import{
|
|
2
|
+
import{__decorate as t}from"tslib";import e from"../../core/Collection.js";import{deprecateUnnecessaryViewModel as s}from"../../core/deprecate.js";import{EventedAccessor as i}from"../../core/Evented.js";import o from"../../core/Logger.js";import{watch as l,initial as r}from"../../core/reactiveUtils.js";import{property as a,subclass as d}from"../../core/accessorSupport/decorators.js";import{findLayerListMode as n}from"../LayerList/support/layerListUtils.js";import m from"./ListItem.js";const c={map:"map",layerListMode:"layer-list-mode"},h="hide",p=e.ofType(m);let b=class extends i{constructor(t){super(t),this.checkPublishStatusEnabled=!1,this.listItemCreatedFunction=null,this.listModeDisabled=!1,this.tableItems=new p,this.map=null,t?.suppressDeprecationWarning||s(o.getLogger(this),"Table List (Next)","arcgis-table-list-next",{version:"5.2"})}normalizeCtorArgs(t){const{suppressDeprecationWarning:e,...s}=t??{};return s}initialize(){this.addHandles([l(()=>[this.tables?.toArray(),this.map?.allTables.toArray()],()=>this._compileList(),r),l(()=>[this.map?.loaded,this.listItemCreatedFunction,this.checkPublishStatusEnabled,this.listModeDisabled],()=>this._recompileList())],c.map)}destroy(){this._removeAllItems(),this.map=null,this.tables=null}get tables(){return this.map?.allTables}set tables(t){this._overrideIfSome("tables",t)}get state(){const{map:t,tables:e}=this;if(!t)return e?"ready":"disabled";const s=t?.loadStatus;return"string"==typeof s?"loaded"===s?"ready":"loading"===s?"loading":"disabled":"ready"}get totalItems(){return this.tableItems.length}triggerAction(t,e){t&&!t.disabled&&this.emit("trigger-action",{action:t,item:e})}_removeAllItems(){this.tableItems.destroyAll()}_getViewableTables(t){return t?this.listModeDisabled?t:t.filter(t=>n(t)!==h):void 0}_watchTablesListMode(t){this.removeHandles(c.layerListMode),t&&!this.listModeDisabled&&this.addHandles(l(()=>t.filter(t=>"listMode"in t).map(t=>t.listMode).toArray(),()=>this._compileList()),c.layerListMode)}_compileList(){const{tables:t}=this;this._watchTablesListMode(t);const e=this._getViewableTables(t);e?.length?(this._createNewItems(e),this._removeItems(e),this._sortItems(e)):this._removeAllItems()}_createNewItems(t){const{tableItems:e,listItemCreatedFunction:s,checkPublishStatusEnabled:i}=this;t.forEach(t=>{e.some(e=>e.layer===t)||e.add(new m({checkPublishStatusEnabled:i,layer:t,listItemCreatedFunction:s}))})}_removeItems(t){const{tableItems:e}=this;e.forEach(s=>{if(!s)return;const i=t?.find(t=>s.layer===t);i||(e.remove(s),s.destroy())})}_sortItems(t){const{tableItems:e}=this;e.sort((e,s)=>{const i=t.indexOf(e.layer),o=t.indexOf(s.layer);return i>o?-1:i<o?1:0})}_recompileList(){this._removeAllItems(),this._compileList()}};t([a()],b.prototype,"checkPublishStatusEnabled",void 0),t([a()],b.prototype,"listItemCreatedFunction",void 0),t([a({nonNullable:!0})],b.prototype,"listModeDisabled",void 0),t([a({type:p,readOnly:!0})],b.prototype,"tableItems",void 0),t([a()],b.prototype,"tables",null),t([a()],b.prototype,"map",void 0),t([a({readOnly:!0})],b.prototype,"state",null),t([a()],b.prototype,"totalItems",null),b=t([d("esri.widgets.TableList.TableListViewModel")],b);export{b as default};
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import type Accessor from "../../core/Accessor.js";
|
|
2
2
|
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated since 5.2. Use the [Table List (Next)](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-table-list-next/) component instead.
|
|
5
|
+
* @since 5.0
|
|
6
|
+
*/
|
|
4
7
|
export interface TableListVisibleElementsProperties extends Partial<Pick<TableListVisibleElements, "closeButton" | "collapseButton" | "errors" | "filter" | "flow" | "heading" | "statusIndicators" | "temporaryTableIndicators">> {}
|
|
5
8
|
|
|
6
9
|
/**
|
|
7
10
|
* The visible elements that are displayed within the table list.
|
|
8
11
|
* This provides the ability to turn on/off individual elements of the table list.
|
|
12
|
+
*
|
|
13
|
+
* @deprecated since 5.2. Use the [Table List (Next)](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-table-list-next/) component instead.
|
|
9
14
|
*/
|
|
10
15
|
export default class TableListVisibleElements extends Accessor {
|
|
11
16
|
constructor(properties?: TableListVisibleElementsProperties);
|
|
@@ -1,21 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types used by the [TableList](https://developers.arcgis.com/javascript/latest/references/core/widgets/TableList/) widget.
|
|
3
|
+
*
|
|
4
|
+
* @deprecated since 5.2. Use the [Table List (Next)](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-table-list-next/) component instead.
|
|
5
|
+
*/
|
|
1
6
|
import type ListItem from "./ListItem.js";
|
|
2
7
|
|
|
3
8
|
/**
|
|
4
9
|
* A function for customizing a list item as it is created in the table list.
|
|
5
10
|
*
|
|
6
11
|
* @param event - An object containing a list item created by the [TableList](https://developers.arcgis.com/javascript/latest/references/core/widgets/TableList/).
|
|
12
|
+
* @deprecated since 5.2. Use the [Table List (Next)](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-table-list-next/) component instead.
|
|
7
13
|
* @since 5.0
|
|
8
14
|
* @see [TableList.listItemCreatedFunction](https://developers.arcgis.com/javascript/latest/references/core/widgets/TableList/#listItemCreatedFunction)
|
|
9
15
|
* @see [TableListViewModel.listItemCreatedFunction](https://developers.arcgis.com/javascript/latest/references/core/widgets/TableList/TableListViewModel/#listItemCreatedFunction)
|
|
10
16
|
*/
|
|
11
17
|
export type ListItemModifier = (event: ListItemModifierEvent) => void;
|
|
12
18
|
|
|
13
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated since 5.2. Use the [Table List (Next)](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-table-list-next/) component instead.
|
|
21
|
+
* @since 5.0
|
|
22
|
+
*/
|
|
14
23
|
export interface ListItemModifierEvent {
|
|
15
24
|
/**
|
|
16
25
|
* The event object passed to a listItemCreatedFunction in the layer lists.
|
|
17
26
|
* Provides access to the list item being created, allowing you to customize its properties, actions, panel content, or visibility before rendering.
|
|
18
27
|
*
|
|
28
|
+
* @deprecated since 5.2. Use the [Table List (Next)](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-table-list-next/) component instead.
|
|
19
29
|
* @since 5.0
|
|
20
30
|
* @see [TableList.listItemCreatedFunction](https://developers.arcgis.com/javascript/latest/references/core/widgets/TableList/#listItemCreatedFunction)
|
|
21
31
|
* @see [TableListViewModel.listItemCreatedFunction](https://developers.arcgis.com/javascript/latest/references/core/widgets/TableList/TableListViewModel/#listItemCreatedFunction)
|
|
@@ -26,6 +36,7 @@ export interface ListItemModifierEvent {
|
|
|
26
36
|
/**
|
|
27
37
|
* Describes the current state of the list items in the [TableListViewModel](https://developers.arcgis.com/javascript/latest/references/core/widgets/TableList/TableListViewModel/).
|
|
28
38
|
*
|
|
39
|
+
* @deprecated since 5.2. Use the [Table List (Next)](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-table-list-next/) component instead.
|
|
29
40
|
* @since 5.0
|
|
30
41
|
* @see [TableListViewModel.state](https://developers.arcgis.com/javascript/latest/references/core/widgets/TableList/TableListViewModel/#state)
|
|
31
42
|
*/
|
package/widgets/TableList.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ import type { ListItemProperties } from "./TableList/ListItem.js";
|
|
|
15
15
|
import type { ReadonlyArrayOrCollection } from "../core/Collection.js";
|
|
16
16
|
import type { TableListVisibleElementsProperties } from "./TableList/TableListVisibleElements.js";
|
|
17
17
|
|
|
18
|
+
/** @deprecated since 5.2. Use the [Table List (Next)](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-table-list-next/) component instead. */
|
|
18
19
|
export interface TableListProperties extends WidgetProperties, IdentifiableMixinProperties, Partial<Pick<TableList, "collapsed" | "dragEnabled" | "filterPlaceholder" | "filterPredicate" | "filterText" | "headingLevel" | "listItemCreatedFunction" | "map" | "minDragEnabledItems" | "minFilterItems" | "selectionMode">> {
|
|
19
20
|
/**
|
|
20
21
|
* Icon which represents the widget. It is typically used when the widget is controlled by another
|
|
@@ -64,6 +65,7 @@ export interface TableListProperties extends WidgetProperties, IdentifiableMixin
|
|
|
64
65
|
visibleElements?: TableListVisibleElementsProperties;
|
|
65
66
|
}
|
|
66
67
|
|
|
68
|
+
/** @deprecated since 5.2. Use the [Table List (Next)](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-table-list-next/) component instead. */
|
|
67
69
|
export interface TableListEvents extends TableListViewModelEvents {}
|
|
68
70
|
|
|
69
71
|
/**
|
|
@@ -347,5 +349,6 @@ declare const TableListSuperclass: typeof Widget & typeof IdentifiableMixin
|
|
|
347
349
|
*
|
|
348
350
|
* @param item - A list item
|
|
349
351
|
* created by the TableList.
|
|
352
|
+
* @deprecated since 5.2. Use the [Table List (Next)](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-table-list-next/) component instead.
|
|
350
353
|
*/
|
|
351
354
|
export type FilterPredicate = (item: ListItem) => boolean;
|