@arcgis/core 4.33.0-next.20250219 → 4.33.0-next.20250220
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/applications/ExperienceBuilder/sketchUtils.d.ts +1 -0
- package/applications/ExperienceBuilder/sketchUtils.js +1 -1
- package/arcade/treeAnalysis.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/0c3930e40fc9f8a84599.js +2 -0
- package/assets/esri/core/workers/chunks/{ccee343fb8c415b59ce3.js.LICENSE.txt → 0c3930e40fc9f8a84599.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/333bb93a28209c997d8b.js +314 -0
- package/assets/esri/core/workers/chunks/469c50c49447f0d602c0.js +1 -0
- package/assets/esri/core/workers/chunks/486df1e042204b90b0dd.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/{c2d539359f321bba3432.js → 52c13b3c074c9f6dadde.js} +2 -2
- package/assets/esri/core/workers/chunks/{c2d539359f321bba3432.js.LICENSE.txt → 52c13b3c074c9f6dadde.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/5693d9ce4472a4c5959f.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/5b56b271afb0fadf48b4.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/6518954889df2e781c47.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/68322a63ec92d33701ea.js +1 -0
- package/assets/esri/core/workers/chunks/aacebda644be06ad1a61.js +1 -0
- package/assets/esri/core/workers/chunks/ac11b2168feee63d2f09.js +1 -0
- package/assets/esri/core/workers/chunks/b0952b81d5be214262dd.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/e2df18662cc4d6e47715.js +1 -0
- package/assets/esri/themes/base/widgets/_Editor.scss +3 -0
- package/assets/esri/themes/base/widgets/_ResponsiveToolbar.scss +9 -3
- package/assets/esri/themes/base/widgets/_Sketch.scss +32 -24
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ar.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_bg.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_bs.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ca.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_cs.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_da.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_de.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_el.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_es.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_et.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_fi.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_fr.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_he.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_hr.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_hu.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_id.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_it.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ja.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ko.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_lt.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_lv.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_nl.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_no.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pl.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pt-BR.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pt-PT.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ro.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ru.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sk.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sl.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sr.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sv.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_th.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_tr.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_uk.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_vi.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-CN.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-HK.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-TW.json +1 -1
- package/copyright.txt +20 -0
- package/interfaces.d.ts +315 -71
- package/layers/RouteLayer.js +1 -1
- package/layers/support/rasterFunctionUtils.d.ts +11 -0
- package/networks/UtilityNetwork.js +1 -1
- package/package.json +2 -2
- package/rest/route.js +1 -1
- package/rest/support/RouteParameters.js +1 -1
- package/rest/support/RouteSolveResult.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/CIMEffects.js +1 -1
- package/symbols/cim/effects/EffectAddControlPoints.js +1 -1
- package/symbols/cim/effects/EffectBuffer.js +1 -1
- package/symbols/cim/effects/EffectDonut.js +1 -1
- package/symbols/cim/effects/EffectOffset.js +1 -1
- package/views/2d/engine/webgl/TextureManager.js +1 -1
- package/views/2d/engine/webgl/Utils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
- package/views/2d/layers/FeatureLayerView2D.js +1 -1
- package/views/2d/layers/features/FeaturePipelineWorker.js +1 -1
- package/views/2d/layers/features/sources/FeatureSource.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/Overrides.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorker.js +1 -1
- package/views/3d/layers/graphics/pipeline/Tile.js +1 -1
- package/views/3d/layers/graphics/pipeline/Tile3DManager.js +1 -1
- package/views/3d/layers/graphics/pipeline/featureData/FeatureData.js +1 -1
- package/views/3d/layers/graphics/pipeline/featureData/FeatureDataSubset.js +5 -0
- package/views/3d/layers/graphics/pipeline/featureData/processingUtils.js +1 -1
- package/views/3d/layers/graphics/pipeline/featureSet/PBFPointFeatureSetView.js +1 -1
- package/views/3d/layers/graphics/pipeline/featureSet/TiledFeatureStore.js +1 -1
- package/views/3d/layers/graphics/pipeline/fetching/Tile3DFetcher.js +1 -1
- package/views/3d/layers/graphics/pipeline/symbolization/TestObjectSymbol.js +1 -1
- package/views/3d/layers/graphics/pipeline/symbolization/TestSymbol.js +1 -1
- package/views/3d/layers/graphics/pipeline/symbolization/UniqueValueFeatureRenderer.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentData.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObjectElevationAgnosticComponentBVH.js +1 -1
- package/views/3d/webgl-engine/collections/Component/IndexRange/ComponentRange.js +5 -0
- package/views/3d/webgl-engine/lib/ComponentUtils.js +1 -1
- package/webmap/utils.js +1 -1
- package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
- package/widgets/BatchAttributeForm/inputs/FieldInput.js +1 -1
- package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/Directions/DirectionsViewModel.js +1 -1
- package/widgets/Directions.js +1 -1
- package/widgets/ElevationProfile/components/LegendItem.js +1 -1
- package/widgets/ElevationProfile/components/SettingsButton.js +1 -1
- package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationItemList.js +1 -1
- package/widgets/FeatureForm/UtilityNetworkAssociationAddAssociationViewModel.js +1 -1
- package/widgets/FeatureForm/featureFormUtils.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FeatureTable/support/FeatureStore.js +1 -1
- package/widgets/Legend/styles/support/utils.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/imageMeasurementUtils.js +1 -1
- package/widgets/OrientedImageryViewer.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/Sketch/support/ResponsiveToolbar/OverflowGroup.js +1 -1
- package/widgets/Sketch/support/ResponsiveToolbar/ResponsiveToolbar.js +1 -1
- package/widgets/Sketch/support/ResponsiveToolbar/SplitButton.js +1 -1
- package/widgets/Sketch/support/sketchUtils.js +1 -1
- package/widgets/Sketch.js +1 -1
- package/widgets/support/UtilityNetworkAssociations/utilityNetworkUtils.js +1 -1
- package/assets/esri/core/workers/chunks/544ad8fa4777ba8ec177.js +0 -1
- package/assets/esri/core/workers/chunks/bdc9dec6a359d2e3705c.js +0 -1
- package/assets/esri/core/workers/chunks/bf127fe767174e2715b5.js +0 -1
- package/assets/esri/core/workers/chunks/ccee343fb8c415b59ce3.js +0 -2
- package/assets/esri/core/workers/chunks/dc68246df91af766593a.js +0 -1
- package/assets/esri/core/workers/chunks/e862f1b9ecafc6c92b86.js +0 -314
- package/assets/esri/core/workers/chunks/f06231c14c0c0e5525bd.js +0 -1
- package/views/3d/layers/graphics/pipeline/featureData/FeatureDataStore.js +0 -5
- package/views/3d/webgl-engine/collections/Component/IndexRange/ComponentRangeRunLengthEncoded.js +0 -5
package/widgets/Directions.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import{isSome as t}from"../core/arrayUtils.js";import i from"../core/Collection.js";import{makeHandle as s}from"../core/handleUtils.js";import{debounce as o,isAbortError as r}from"../core/promiseUtils.js";import{watch as a,initial as n,on as l}from"../core/reactiveUtils.js";import{escapeRegExpString as c}from"../core/string.js";import{property as d}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import{subclass as m}from"../core/accessorSupport/decorators/subclass.js";import p from"../portal/Portal.js";import{defaultUnitPropertyMetadata as h}from"../properties/defaultUnit.js";import u from"../rest/support/Stop.js";import v from"../symbols/SimpleMarkerSymbol.js";import _ from"./Search.js";import g from"./Widget.js";import{DirectionsSearchTool as w}from"./Directions/DirectionsSearchTool.js";import y from"./Directions/DirectionsViewModel.js";import b from"./Directions/DirectionsVisibleElements.js";import{formatDistance as f,formatDuration as S,DepartureTimeOption as M,getIconName as k}from"./Directions/support/directionsUtils.js";import{isArcGISWorldGeocoder as I,meteredArcGISLocatorUrl as F}from"./Search/support/locatorUtils.js";import{loadCalciteComponents as T}from"./support/componentsUtils.js";import{globalCss as D}from"./support/globalCss.js";import"./support/widgetUtils.js";import{messageBundle as x}from"./support/decorators/messageBundle.js";import{tsx as C}from"./support/jsxFactory.js";function E(e){const{branchName:i,displayText:s,exitName:o,intersectingName:r,name:a,towardName:n}=e;if(null==s)return null;const l=[i,o,r,a,n].filter(t).sort(((e,t)=>t.length-e.length)).map((e=>c(e)));if(!l.length)return s;const d=new RegExp(l.join("|"),"g"),m=s.matchAll(d);let p=0;const h=[];for(const{0:t,index:c}of m)h.push(s.slice(p,c),C("span",{class:R.labelEmphasize,key:`maneuver-${c}`},t)),p=c+t.length;return h.push(s.slice(p)),C("span",null,h)}function $(e){const t=new Date(e);return new Date(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate())}const L="esri-directions",R={base:L,accordion:`${L}__accordion`,actionContainer:`${L}__action-container`,addStopButton:`${L}__add-stop-button`,departureTime:`${L}__departure-time`,departureTimeOptions:`${L}__departure-time-options`,directionsHeader:`${L}__directions-header`,directionsHeaderStopName:`${L}__directions-header-stop-name`,editFooter:`${L}__edit-footer`,editToolbar:`${L}__edit-toolbar`,editToolbarContainer:`${L}__edit-toolbar-container`,flexColumn:`${L}__flex-column`,flexRow:`${L}__flex-row`,headerStops:`${L}__header-stops`,labelEmphasize:`${L}__label-emphasize`,labelNoBottomMargin:`${L}__label-no-bottom-margin`,marginInlineMedium:`${L}__margin-inline-medium`,optimizeSection:`${L}__optimize-section`,optimizeSwitches:`${L}__optimize-switches`,paddingMedium:`${L}__padding-medium`,primaryFlowItem:`${L}__primary-flow-item`,primaryFooter:`${L}__primary-footer`,primaryFooterCentered:`${L}__primary-footer-centered`,primaryFooterLoader:`${L}__primary-footer-loader`,routeItem:`${L}__route-item`,routeItemButton:`${L}__route-item-button`,routeItemButtonContent:`${L}__route-item-button-content`,routeItemLabel:`${L}__route-item-label`,routeItemDescription:`${L}__route-item-description`,saveError:`${L}__save-error`,saveErrorIcon:`${L}__save-error-icon`,saveErrorLabel:`${L}__save-error-label`,saveProcessLoader:`${L}__save-process-loader`,selectedFeatureContainer:`${L}__selected-feature-container`,separator:`${L}__separator`,solveRoute:`${L}__solve-route`,stopContainer:`${L}__stop-container`,stopList:`${L}__stop-list`,stopItem:`${L}__stop-item`};let A=class extends g{constructor(e,t){super(e,t),this._activeManeuver=null,this._placeholderStops=new i([new u,new u]),this._portalFolderCombobox=null,this._portalFolders=null,this._portalItemNameInput=null,this._portalUserName=null,this._sections=null,this._stopsToSearches=new Map,this._currentFlowItem="primary",this._parentFlowItem="primary",this._saveState="initialized",this._searchTool=null,this.headingLevel=2,this.messages=null,this.messagesUnits=null,this.searchProperties=null,this.viewModel=new y,this.visibleElements=new b,this._solveRouteDebounced=o((()=>this._solveRoute()))}initialize(){this.addHandles([a((()=>this.viewModel.layer),(()=>{try{this.viewModel.load()}catch{}}),n),a((()=>this.viewModel.layer?.routeInfo),(()=>{this._sections=this._getStopSections()}),n),a((()=>this.viewModel.layer?.stops.toArray()),(e=>{e&&this.view?.activeTool&&this._searchTool&&this.view.activeTool===this._searchTool&&!e.includes(this._searchTool.stop)&&(this.view.tools.remove(this._searchTool),this._searchTool=null)}))])}loadDependencies(){return T({accordion:()=>import("@esri/calcite-components/dist/components/calcite-accordion"),"accordion-item":()=>import("@esri/calcite-components/dist/components/calcite-accordion-item"),action:()=>import("@esri/calcite-components/dist/components/calcite-action"),"block-section":()=>import("@esri/calcite-components/dist/components/calcite-block-section"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),input:()=>import("@esri/calcite-components/dist/components/calcite-input"),"input-date-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-date-picker"),"input-time-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-time-picker"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),panel:()=>import("@esri/calcite-components/dist/components/calcite-panel"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch")})}get apiKey(){return this.viewModel.apiKey}set apiKey(e){this.viewModel.apiKey=e}get goToOverride(){return this.viewModel.goToOverride}set goToOverride(e){this.viewModel.goToOverride=e}get icon(){return"right"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get lastRoute(){return this.viewModel.lastRoute}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get maxStops(){return this.viewModel.maxStops}set maxStops(e){this.viewModel.maxStops=e}get unit(){return this.defaultUnit}set unit(e){this._overrideIfSome("unit",e)}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}acquireSearch(e){const{view:t}=this.viewModel;if(this._stopsToSearches.has(e)){const i=this._stopsToSearches.get(e);return i.view=t,this._overrideDefaultSources(i),i}const i=new _({icon:!1,popupEnabled:!1,resultGraphicEnabled:!1,view:t,...this.searchProperties});return this._normalizeSearchSources(i),this.addHandles([l((()=>i.allSources),"change",(()=>this._normalizeSearchSources(i))),i.on("search-clear",(()=>{e.geometry=null,e.name=null,this.viewModel.layer?.removeResult()})),i.on("select-result",(()=>{const t=i.selectedResult;e.geometry=t?.feature.geometry,e.name=t?.name,this._solveRouteDebounced()})),a((()=>i.searchTerm),(t=>{e.name=t}))],i),this._stopsToSearches.set(e,i),i}getDirections(){return this.viewModel.getDirections()}render(){return C("div",{class:this.classes(R.base,D.widget,D.panel)},C("calcite-flow",null,this._renderPrimaryFlowItem(),this._renderDirectionsFlowItem(),this._renderEditFlowItem(),this._renderSaveFlowItem()))}save(){return this.viewModel.save()}saveAs(e,t={}){return this.viewModel.saveAs(e,t)}zoomToRoute(){return this.viewModel.zoomToRoute()}_applyLocatorSourceOverrides({allSources:e}){for(const t of e)"url"in t&&t.url&&(t.locationType??="street",I(t.url)&&this.apiKey&&null==t.apiKey&&(t.apiKey=this.apiKey,t.url=F))}_disposeSearch(e){if(!e||!this._stopsToSearches.has(e))return;const t=this._stopsToSearches.get(e);this.removeHandles(t),t.destroy(),this._stopsToSearches.delete(e)}_getEffectiveStops(){return this.viewModel.layer?.stops??this._placeholderStops}_getErrorDescription(){switch(this.viewModel.lastError?.name){case"directions-view-model:unable-to-route":return this.messages.errors.unableToRoute;case"directions-view-model:service-metadata-unavailable":return this.messages.errors.unableToLoadServiceMetadata;default:return this.messages.errors.unknownError}}_getNetworkFeatureName(e){switch(e.type){case"stop":switch(e.locationType){case"stop":default:return this.messages.networkFeatures.stops.stop;case"waypoint":return this.messages.networkFeatures.stops.waypoint;case"break":return this.messages.networkFeatures.stops.break}case"point-barrier":return this.messages.networkFeatures.pointBarrier;case"polyline-barrier":return this.messages.networkFeatures.polylineBarrier;case"polygon-barrier":return this.messages.networkFeatures.polygonBarrier}}_getRouteCostSummary(){const e=this.viewModel.layer?.routeInfo;if(!e)return null;const t=e.totalDistance??0,i=e.totalDuration??0,{messagesUnits:s,unit:o}=this;return{distance:f(s,t,o),duration:S(i)}}_getStopSections(){if(!this.viewModel.layer)return null;const{directionPoints:e,directionLines:t,stops:i}=this.viewModel.layer;if(!e||!t)return null;const s=[];let o=null;for(const r of e){const{objectId:e,stopId:a}=r;if(null!=a){const e=i.find((({objectId:e})=>e===a));o&&o.stop===e||(o={stop:e,directions:[]},s.push(o));continue}if(null==o)continue;const n=t.find((({directionPointId:t})=>t===e));null!=n&&o.directions.push({directionPoint:r,directionLine:n})}return s}_handleLocateStopAction(e){const{view:t}=this;if(!t)return;const i="directions-search-tool";this.removeHandles(i),this._searchTool=new w({stop:e,view:t}),this.addHandles([this._searchTool.on("click",(async t=>{if(t.mapPoint&&this._stopsToSearches.has(e)){const i=this._stopsToSearches.get(e),s=await i.search(t.mapPoint),o=s?.results?.[0].results?.[0];if(o){const{feature:t,name:s}=o;i.searchTerm=s,e.geometry=t.geometry}}this.removeHandles(i)})),s((()=>{this._searchTool&&(this.view?.tools.remove(this._searchTool),this._searchTool=null)}))],i),t.addAndActivateTool(this._searchTool)}_handleEditingDoneClick(){this.viewModel.stopEditing(),this._currentFlowItem="primary"}async _handleSaveLayerAsAction(){const e=p.getDefault();try{await e.signIn()}catch(t){if(r(t)||"identity-manager:user-aborted"===t.name)return;return this._parentFlowItem=this._currentFlowItem,this._currentFlowItem="save",void(this._saveState="connect-to-portal-error")}this._saveState="fetch-portal-information",this._parentFlowItem=this._currentFlowItem,this._currentFlowItem="save",this._portalUserName=e.user?.username;try{this._portalFolders=await(e.user?.fetchFolders())}catch{return void(this._saveState="fetch-portal-information-error")}this._saveState="save-layer"}_normalizeSearchSources(e){this._overrideDefaultSources(e),this._applyLocatorSourceOverrides(e)}_overrideDefaultSources(e){for(const t of e.viewModel.defaultSources)t.autoNavigate=!1}_renderClearRouteAction(e){return C("calcite-action",{icon:"trash",key:"clear-route",onclick:()=>{this._currentFlowItem="primary",this.viewModel.reset()},...e,text:this.messages.common.clear,textEnabled:!0})}_renderDeleteStopAction(e){const t=this._getEffectiveStops();return C("calcite-action",{icon:"trash",onclick:()=>{t.remove(e),this._disposeSearch(e),this._solveRouteDebounced()},scale:"s",slot:"actions-end",text:this.messages.deleteStop,title:this.messages.deleteStop})}_renderDepartureTime(){const{DEPART_AT:e,NOW:t,UNSPECIFIED:i}=M;return C("calcite-label",{class:R.departureTime,key:"departure-time"},this.messages.departureTime,C("calcite-combobox",{clearDisabled:!0,label:this.messages.departureTime,overlayPositioning:"fixed",selectionMode:"single",onCalciteComboboxChange:({currentTarget:e})=>{const{selectedItems:t}=e;t.length&&(this.viewModel.departureOption=t[0].value,this._solveRouteDebounced())}},C("calcite-combobox-item",{heading:this.messages.leaveNow,key:t,label:this.messages.leaveNow,selected:this.viewModel.departureOption===t,value:t}),C("calcite-combobox-item",{heading:this.messages.departAt,key:e,label:this.messages.departAt,selected:this.viewModel.departureOption===e,value:e}),C("calcite-combobox-item",{heading:this.messages.timeUnspecified,key:i,label:this.messages.timeUnspecified,selected:this.viewModel.departureOption===i,value:i})))}_renderDepartureTimeOptions(){return this.viewModel.departureOption!==M.DEPART_AT?null:C("div",{class:R.departureTimeOptions},C("calcite-input-date-picker",{scale:"s",valueAsDate:$(this.viewModel.departureIsoDate),onCalciteInputDatePickerChange:({currentTarget:{value:e}})=>{this.viewModel.departureIsoDate=e,this._solveRouteDebounced()}}),C("calcite-input-time-picker",{scale:"s",value:this.viewModel.departureIsoTime,onCalciteInputTimePickerChange:({currentTarget:{value:e}})=>{this.viewModel.departureIsoTime=e,this._solveRouteDebounced()}}))}_renderDirectionsFlowItem(){if("directions"!==this._currentFlowItem)return null;const e=this._getRouteCostSummary();if(!this._sections||!e)return null;const{distance:t,duration:i}=e,{formattedEta:s}=this.viewModel,o=this._sections.at(0)?.stop.name??"",r=this._sections.at(-1)?.stop.name??"";return C("calcite-flow-item",{key:"directions-flow-item",overlayPositioning:"fixed",selected:"directions"===this._currentFlowItem,onCalciteFlowItemBack:e=>{e.stopPropagation(),this._currentFlowItem="primary"}},C("div",{class:R.directionsHeader,slot:"header-content"},C("div",{class:R.headerStops},C("span",null,this.messages.from)," ",C("span",{class:R.directionsHeaderStopName},o),C("span",null,this.messages.to)," ",C("span",{class:R.directionsHeaderStopName},r)),C("div",{class:R.flexColumn},C("span",null,`${i} (${t})`),s?C("span",null,s):null)),this._renderRouteLayerActions({slot:"header-menu-actions"}),C("calcite-accordion",{class:R.accordion,iconPosition:"start",selectionMode:"single"},this._sections.map(((e,t)=>{const{stop:i,directions:s}=e,{name:o}=i;return C("calcite-accordion-item",{expanded:0===t,heading:o??"",key:`stop-${t}`},C("calcite-action",{icon:"zoom-to-object",onclick:()=>{this.viewModel.centerAt(i)},slot:"actions-end",text:this.messages.panToStop}),this._renderDirectionTurns(s))}))))}_renderDirectionTurns(e){return C("calcite-list",{label:this.messages.drivingDirections,selectionMode:"none"},e.map(((e,t)=>{const{directionPoint:i,directionLine:s}=e,{distance:o,duration:r}=s,a=f(this.messagesUnits,o??0,this.unit),n=S(r??0),l=a&&n?`${a} | ${n}`:`${a||n}`,c=E(i),d=k(i.directionPointType);return C("calcite-list-item",{class:R.labelNoBottomMargin,key:`driving-direction-${t}`,onpointerenter:()=>{this.viewModel.highlight(s)},onpointerleave:()=>{this.viewModel.clearHighlights()},onCalciteListItemSelect:()=>{this._activeManeuver===s?this.zoomToRoute():(this._activeManeuver=s,this.viewModel.centerAt(s.geometry))}},C("calcite-icon",{icon:d,slot:"content-start"}),C("div",{slot:"content"},C("calcite-label",{layout:"inline",scale:"s"},c),C("calcite-label",{layout:"inline",scale:"s"},l)))})))}_renderEditFlowItem(){return"edit"!==this._currentFlowItem?null:C("calcite-flow-item",{heading:this.messages.editRoute,headingLevel:this.headingLevel,key:"edit-flow-item",loading:"routing"===this.viewModel.state,selected:"edit"===this._currentFlowItem,onCalciteFlowItemBack:e=>{e.stopPropagation(),this.viewModel.stopEditing(),this._currentFlowItem="primary"}},C("div",{class:R.flexColumn,key:"edit-container"},C("div",{class:R.editToolbarContainer},C("calcite-label",{layout:"inline",scale:"s"},this.messages.automaticallySolve,C("calcite-switch",{checked:this.viewModel.autoSolve,scale:"s",onCalciteSwitchChange:e=>{this.viewModel.autoSolve=e.target.checked}})),C("div",{class:R.editToolbar},C("calcite-action",{icon:"flag",onclick:()=>{this.viewModel.create("stop")},scale:"s",text:this.messages.networkFeatures.stops.stop,textEnabled:!0}),C("calcite-action",{icon:"line",onclick:()=>{this.viewModel.create("polyline-barrier")},scale:"s",text:this.messages.barrier,textEnabled:!0}),C("calcite-action",{class:R.solveRoute,disabled:this.viewModel.autoSolve,icon:"refresh",onclick:()=>{this._solveRouteDebounced()},scale:"s",text:this.messages.solve,textEnabled:!0}))),C("div",{class:R.selectedFeatureContainer},C("calcite-list",{label:this.messages.selectedNetworkFeatures,scale:"s",selectionMode:"none"},this.viewModel.selectedNetworkFeatures?.toArray().map(((e,t)=>C("calcite-list-item",{description:this._getNetworkFeatureName(e),key:`network-feature-${t}`,label:e.name??e.objectId?.toString()??this.messages.unnamed},C("calcite-action",{icon:"trash",onclick:()=>{this.viewModel.remove(e)},scale:"s",slot:"actions-end",text:this.messages.common.delete})))))),C("div",{class:R.editFooter},this._renderEditFooterContent())))}_renderEditFooterContent(){return this.viewModel.lastError?this._renderErrorNotice():C("calcite-button",{appearance:"outline-fill",bind:this,onclick:this._handleEditingDoneClick,width:"full"},this.messages.common.done)}_renderErrorNotice(){return C("calcite-notice",{icon:"exclamation-mark-circle",kind:"danger",open:!0},C("calcite-label",{class:R.labelNoBottomMargin,slot:"message"},this._getErrorDescription()))}_renderFooter(){if(!this.viewModel.layer)return C("div",{class:R.primaryFooter,key:"footer-missing-layer"},C("calcite-notice",{icon:"information",open:!0},C("calcite-label",{class:R.labelNoBottomMargin,slot:"message"},this.messages.missingLayer)));if("unauthenticated"===this.viewModel.state)return C("div",{class:R.primaryFooterCentered,key:"footer-sign-in"},C("calcite-label",null,this.messages.signInRequired),C("calcite-button",{onclick:()=>{this.viewModel.load().catch((()=>{}))}},this.messages.common.auth.signIn));if("routing"===this.viewModel.state)return C("div",{class:this.classes(R.primaryFooter,R.primaryFooterLoader),key:"footer-routing"},C("calcite-loader",{label:this.messages.solve,scale:"s"}));if("error"===this.viewModel.state)return C("div",{class:R.primaryFooter,key:"footer-service-error"},this._renderErrorNotice());if(!this.viewModel.layer?.routeInfo)return C("div",{class:R.primaryFooter,key:"footer-unsolved-route"},C("calcite-notice",{icon:"information",open:!0},C("calcite-label",{class:R.labelNoBottomMargin,slot:"message"},this.messages.directionsPlaceholder)));const e=this._getRouteCostSummary();if(!e||!this.viewModel.layer?.directionPoints)return C("div",{class:R.primaryFooter,key:"footer-invalid-route"},C("calcite-notice",{icon:"exclamation-mark-triangle",kind:"danger",open:!0},C("calcite-label",{class:R.labelNoBottomMargin,slot:"message"},this.messages.invalidRoute)));const{distance:t,duration:i}=e,{formattedEta:s}=this.viewModel;return C("div",{class:R.routeItem,key:"footer-directions-summary"},C("button",{"aria-busy":"false","aria-label":this.messages.viewDrivingDirections,"aria-live":"polite",class:R.routeItemButton,onclick:()=>{this._currentFlowItem="directions"},type:"button"},C("div",{class:R.routeItemButtonContent},C("span",{class:R.routeItemLabel},`${i} (${t})`),C("span",{class:R.routeItemDescription},s)),C("calcite-icon",{icon:"chevron-right",scale:"s"})),C("calcite-dropdown",null,C("calcite-action",{icon:"ellipsis",slot:"trigger",text:"Route actions"}),this._renderRouteLayerActions()))}_renderInteractiveRouteActions(){return C("div",{class:R.actionContainer,key:"interactive-route-action-container"},C("calcite-button",{appearance:"outline",class:R.addStopButton,disabled:this._getEffectiveStops().length>=this.maxStops,iconStart:"plus",kind:"neutral",label:this.messages.addStop,onclick:()=>{const e=new v;this.viewModel.layer?.stops.add(new u({symbol:e}))},width:"half"},this.messages.addStop),C("calcite-button",{appearance:"outline",disabled:"2d"!==this.viewModel.view?.type,iconStart:"pencil",kind:"neutral",label:this.messages.editRoute,onclick:()=>{this._currentFlowItem="edit",this.viewModel.startEditing()},width:"half"},this.messages.editRoute))}_renderLocateStopAction(e){if(null!=e.name||null!=e.geometry)return null;const t=this._getEffectiveStops().indexOf(e),i=!!this.view?.activeTool&&this.view.activeTool===this._searchTool&&this._searchTool.stop===e;return C("calcite-action",{active:i,icon:"crosshair",key:`stop-location-action-${t}`,onclick:()=>this._handleLocateStopAction(e),scale:"s",slot:"actions-end",text:this.messages.pickALocationOnTheMap,title:this.messages.pickALocationOnTheMap})}_renderOptimizeStopOrder(){const{routeParameters:e}=this.viewModel,{findBestSequence:t,preserveFirstStop:i,preserveLastStop:s}=e;return C("calcite-block-section",{class:R.optimizeSection,text:this.messages.optimizeOrder,toggleDisplay:"switch",onCalciteBlockSectionToggle:({target:t})=>{e.findBestSequence=t.open,t.open||this._resetStopSequence(),this._solveRouteDebounced()}},t?[C("calcite-label",{class:R.optimizeSwitches,key:"preserve-first-stop",layout:"inline-space-between"},this.messages.preserveFirstStop,C("calcite-switch",{checked:i,scale:"s",onCalciteSwitchChange:({target:{checked:t}})=>{e.preserveFirstStop=t,this._resetStopSequence(),this._solveRouteDebounced()}})),C("calcite-label",{class:R.optimizeSwitches,key:"preserve-last-stop",layout:"inline-space-between"},this.messages.preserveLastStop,C("calcite-switch",{checked:s,scale:"s",onCalciteSwitchChange:({target:{checked:t}})=>{e.preserveLastStop=t,this._resetStopSequence(),this._solveRouteDebounced()}}))]:null)}_renderPrimaryFlowItem(){return C("calcite-flow-item",{key:"primary-flow-item",loading:"initializing"===this.viewModel.state,selected:"primary"===this._currentFlowItem},C("calcite-panel",{class:R.primaryFlowItem,disabled:!this.viewModel.layer||"unauthenticated"===this.viewModel.state||"error"===this.viewModel.state&&!this.viewModel.serviceDescription},this._renderStops(),this._renderInteractiveRouteActions(),this._renderSeparator(),this._renderRouteSolveOptions()),this._renderFooter())}_renderRouteLayerActions(e){return[this._renderClearRouteAction(e),this._renderSaveLayerAction(e),this._renderSaveLayerAsAction(e),this._renderViewItemDetailsAction(e)]}_renderRouteSolveOptions(){return C("div",{class:R.marginInlineMedium,key:"route-solve-options"},this._renderTravelModes(),this._renderDepartureTime(),this._renderDepartureTimeOptions(),this._renderOptimizeStopOrder())}_renderSaveContent(){switch(this._saveState){case"initialized":return this._renderSaveInitialized();case"connect-to-portal":return this._renderSaveProcessing(this.messages.identity.lblSigning);case"connect-to-portal-error":return this._renderSaveError(this.messages.errors.authenticating);case"fetch-portal-information":return this._renderSaveProcessing(this.messages.processing.fetching);case"fetch-portal-information-error":return this._renderSaveError(this.messages.errors.fetching);case"save-layer":return this._renderSaveLayerSettings();case"saving":return this._renderSaveProcessing(this.messages.processing.saving);case"saving-error":return this._renderSaveError(this.messages.errors.saving)}}_renderSaveError(e){return C("calcite-panel",{class:R.paddingMedium,key:"save-layer-error"},C("div",{class:R.saveError},C("calcite-icon",{class:R.saveErrorIcon,icon:"exclamation-mark-triangle",scale:"l",textLabel:this.messages.common.errorMessage}),C("calcite-label",{class:R.saveErrorLabel},e)),C("calcite-button",{appearance:"outline",onclick:()=>{this._currentFlowItem=this._parentFlowItem},slot:"footer-actions",width:"full"},this.messages.common.close))}_renderSaveInitialized(){return C("calcite-panel",{class:R.paddingMedium,key:"save-layer-initialized"})}_renderSaveFlowItem(){return"save"!==this._currentFlowItem?null:C("calcite-flow-item",{heading:this.messages.saveLayer,headingLevel:this.headingLevel,key:"save-layer-flow-item",selected:"save"===this._currentFlowItem,onCalciteFlowItemBack:e=>{e.stopPropagation(),this._currentFlowItem=this._parentFlowItem}},this._renderSaveContent())}_renderSaveLayerAction(e){if(!this.visibleElements.saveButton)return null;const t=this.viewModel.layer,i=t?.routeInfo,s=t?.portalItem?.itemControl;return C("calcite-action",{disabled:!(!!i&&("admin"===s||"update"===s)),icon:"save",key:"save-route",onclick:()=>{this.viewModel.layer?.save()},...e,text:this.messages.common.save,textEnabled:!0})}_renderSaveLayerAsAction(e){if(!this.visibleElements.saveAsButton)return null;const t=!this.viewModel.layer?.routeInfo;return C("calcite-action",{disabled:t,icon:"save-as",key:"save-as-route",onclick:()=>{this._handleSaveLayerAsAction()},...e,text:this.messages.common.saveAs,textEnabled:!0})}_renderSaveLayerSettings(){if(null==this.layer||null==this._portalFolders||null==this._portalUserName)return this._renderSaveInitialized();const{stops:e}=this.layer,t=`${e.at(0).name} - ${e.at(-1).name}`,i=this._portalFolders.map((e=>C("calcite-combobox-item",{heading:e.title??"",key:`${L}-folder-${e.id}`,value:e.id})));return i.unshift(C("calcite-combobox-item",{heading:`${this._portalUserName} (${this.messages.common.home})`,key:`${L}-folder-home`,selected:!0,value:null})),C("calcite-panel",{key:"save-layer-panel"},C("div",{class:R.paddingMedium},C("calcite-label",null,this.messages.laverName,C("calcite-input",{afterCreate:e=>{this._portalItemNameInput=e},label:this.messages.laverName,value:t})),C("calcite-label",null,this.messages.saveInFolder,C("calcite-combobox",{afterCreate:e=>{this._portalFolderCombobox=e},label:this.messages.saveInFolder,overlayPositioning:"fixed",selectionMode:"single"},i))),C("calcite-button",{onclick:()=>{if(this._saveState="saving",null==this.layer||null==this._portalFolders)return;const e=this._portalItemNameInput?.value,t=this._portalFolderCombobox?.value,i=this._portalFolders.find((({id:e})=>e===t));this.layer.saveAs({title:e},{folder:i}).then((()=>{this._currentFlowItem=this._parentFlowItem})).catch((()=>{this._saveState="saving-error"}))},slot:"footer-actions",width:"full"},this.messages.common.save),C("calcite-button",{appearance:"outline",onclick:()=>{this._currentFlowItem=this._parentFlowItem},slot:"footer-actions",width:"full"},this.messages.common.cancel))}_renderSaveProcessing(e){return C("calcite-panel",{class:R.marginInlineMedium,key:"save-layer-processing"},C("calcite-loader",{class:R.saveProcessLoader,label:e,text:e}))}_renderSeparator(){return C("div",{class:R.separator})}_renderStop(e){const t=this.acquireSearch(e);null!=e.name&&(t.searchTerm=e.name);const i=this._getEffectiveStops(),s=this._renderLocateStopAction(e),o=i.length>2&&this._renderDeleteStopAction(e);return C("calcite-list-item",{key:e,value:e},s,o,C("div",{class:R.stopItem,slot:"content"},t.render()))}_renderStops(){const e=this._getEffectiveStops();for(const t of this._stopsToSearches.keys())e.includes(t)||this._disposeSearch(t);return C("div",{class:R.stopContainer,key:R.stopContainer},C("calcite-list",{class:R.stopList,dragEnabled:!0,label:this.messages.widgetLabel,scale:"s",onCalciteListOrderChange:({detail:t})=>{e.reorder(t.dragEl.value,t.newIndex),this._resetStopSequence(),this._solveRouteDebounced()}},e.toArray().map((e=>this._renderStop(e)))),2===e.length&&C("calcite-action",{icon:"arrow-up-down",onclick:()=>{e.reverse(),this._resetStopSequence(),this._solveRouteDebounced()},scale:"s",text:this.messages.reverseStops}))}_renderTravelModes(){return this.viewModel.travelModes.length?C("calcite-label",{key:"travel-modes"},this.messages.mode,C("calcite-combobox",{clearDisabled:!0,label:this.messages.mode,overlayPositioning:"fixed",selectionMode:"single",onCalciteComboboxChange:({currentTarget:e})=>{const{selectedItems:t}=e;t.length&&(this.viewModel.selectedTravelMode=t[0].value,this._solveRouteDebounced())}},this.viewModel.travelModes.map((e=>C("calcite-combobox-item",{heading:e.name,key:e.id,label:e.name,selected:this.viewModel.selectedTravelMode?.id===e.id,value:e}))))):null}_renderViewItemDetailsAction(e){if(!this.visibleElements.layerDetails)return null;const t=this.viewModel.layer?.portalItem;return C("calcite-action",{disabled:!t,icon:"launch",key:"open-route-details-link",onclick:()=>{t&&window.open(`${t.portal.url}/home/item.html?id=${t.id}`,"_blank")},...e,text:this.messages.viewLayerDetails,textEnabled:!0})}_resetStopSequence(){this.viewModel.layer?.stops.forEach((e=>{e.sequence=null}))}async _solveRoute(){this.viewModel.updateDepartureTime();if(!((this.viewModel.layer?.stops.filter((({geometry:e})=>!!e)).length??0)<2))try{await this.viewModel.getDirections()}catch{}}};e([d()],A.prototype,"_currentFlowItem",void 0),e([d()],A.prototype,"_saveState",void 0),e([d()],A.prototype,"_searchTool",void 0),e([d()],A.prototype,"apiKey",null),e([d(h)],A.prototype,"defaultUnit",void 0),e([d()],A.prototype,"goToOverride",null),e([d()],A.prototype,"headingLevel",void 0),e([d()],A.prototype,"icon",null),e([d()],A.prototype,"label",null),e([d({readOnly:!0})],A.prototype,"lastRoute",null),e([d()],A.prototype,"layer",null),e([d()],A.prototype,"maxStops",null),e([d(),x("esri/widgets/Directions/t9n/Directions")],A.prototype,"messages",void 0),e([d(),x("esri/core/t9n/Units")],A.prototype,"messagesUnits",void 0),e([d()],A.prototype,"searchProperties",void 0),e([d()],A.prototype,"unit",null),e([d()],A.prototype,"view",null),e([d({type:y})],A.prototype,"viewModel",void 0),e([d({type:b,nonNullable:!0})],A.prototype,"visibleElements",void 0),A=e([m("esri.widgets.Directions")],A);const N=A;export{N as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import{isSome as t}from"../core/arrayUtils.js";import i from"../core/Collection.js";import{makeHandle as s}from"../core/handleUtils.js";import{debounce as o,isAbortError as r}from"../core/promiseUtils.js";import{watch as a,initial as n,on as l}from"../core/reactiveUtils.js";import{escapeRegExpString as c}from"../core/string.js";import{property as d}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import{subclass as m}from"../core/accessorSupport/decorators/subclass.js";import p from"../portal/Portal.js";import{defaultUnitPropertyMetadata as h}from"../properties/defaultUnit.js";import u from"../rest/support/Stop.js";import v from"../symbols/SimpleMarkerSymbol.js";import _ from"./Search.js";import g from"./Widget.js";import{DirectionsSearchTool as w}from"./Directions/DirectionsSearchTool.js";import y from"./Directions/DirectionsViewModel.js";import b from"./Directions/DirectionsVisibleElements.js";import{formatDistance as f,formatDuration as S,DepartureTimeOption as M,getIconName as k}from"./Directions/support/directionsUtils.js";import{isArcGISWorldGeocoder as I,meteredArcGISLocatorUrl as F}from"./Search/support/locatorUtils.js";import{loadCalciteComponents as T}from"./support/componentsUtils.js";import{globalCss as D}from"./support/globalCss.js";import"./support/widgetUtils.js";import{messageBundle as x}from"./support/decorators/messageBundle.js";import{tsx as C}from"./support/jsxFactory.js";function E(e){const{branchName:i,displayText:s,exitName:o,intersectingName:r,name:a,towardName:n}=e;if(null==s)return null;const l=[i,o,r,a,n].filter(t).sort(((e,t)=>t.length-e.length)).map((e=>c(e)));if(!l.length)return s;const d=new RegExp(l.join("|"),"g"),m=s.matchAll(d);let p=0;const h=[];for(const{0:t,index:c}of m)h.push(s.slice(p,c),C("span",{class:A.labelEmphasize,key:`maneuver-${c}`},t)),p=c+t.length;return h.push(s.slice(p)),C("span",null,h)}function $(e){if(!e)return;const t=new Date(e);return new Date(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate())}const L="esri-directions",A={base:L,accordion:`${L}__accordion`,actionContainer:`${L}__action-container`,addStopButton:`${L}__add-stop-button`,departureTime:`${L}__departure-time`,departureTimeOptions:`${L}__departure-time-options`,directionsHeader:`${L}__directions-header`,directionsHeaderStopName:`${L}__directions-header-stop-name`,editFooter:`${L}__edit-footer`,editToolbar:`${L}__edit-toolbar`,editToolbarContainer:`${L}__edit-toolbar-container`,flexColumn:`${L}__flex-column`,flexRow:`${L}__flex-row`,headerStops:`${L}__header-stops`,labelEmphasize:`${L}__label-emphasize`,labelNoBottomMargin:`${L}__label-no-bottom-margin`,marginInlineMedium:`${L}__margin-inline-medium`,optimizeSection:`${L}__optimize-section`,optimizeSwitches:`${L}__optimize-switches`,paddingMedium:`${L}__padding-medium`,primaryFlowItem:`${L}__primary-flow-item`,primaryFooter:`${L}__primary-footer`,primaryFooterCentered:`${L}__primary-footer-centered`,primaryFooterLoader:`${L}__primary-footer-loader`,routeItem:`${L}__route-item`,routeItemButton:`${L}__route-item-button`,routeItemButtonContent:`${L}__route-item-button-content`,routeItemLabel:`${L}__route-item-label`,routeItemDescription:`${L}__route-item-description`,saveError:`${L}__save-error`,saveErrorIcon:`${L}__save-error-icon`,saveErrorLabel:`${L}__save-error-label`,saveProcessLoader:`${L}__save-process-loader`,selectedFeatureContainer:`${L}__selected-feature-container`,separator:`${L}__separator`,solveRoute:`${L}__solve-route`,stopContainer:`${L}__stop-container`,stopList:`${L}__stop-list`,stopItem:`${L}__stop-item`};let R=class extends g{constructor(e,t){super(e,t),this._activeManeuver=null,this._placeholderStops=new i([new u,new u]),this._portalFolderCombobox=null,this._portalFolders=null,this._portalItemNameInput=null,this._portalUserName=null,this._sections=null,this._stopsToSearches=new Map,this._currentFlowItem="primary",this._parentFlowItem="primary",this._saveState="initialized",this._searchTool=null,this.headingLevel=2,this.messages=null,this.messagesUnits=null,this.searchProperties=null,this.viewModel=new y,this.visibleElements=new b,this._solveRouteDebounced=o((()=>this._solveRoute()))}initialize(){this.addHandles([a((()=>this.viewModel.layer),(()=>{try{this.viewModel.load()}catch{}}),n),a((()=>this.viewModel.layer?.routeInfo),(()=>{this._sections=this._getStopSections()}),n),a((()=>this.viewModel.layer?.stops.toArray()),(e=>{e&&this.view?.activeTool&&this._searchTool&&this.view.activeTool===this._searchTool&&!e.includes(this._searchTool.stop)&&(this.view.tools.remove(this._searchTool),this._searchTool=null)}))])}loadDependencies(){return T({accordion:()=>import("@esri/calcite-components/dist/components/calcite-accordion"),"accordion-item":()=>import("@esri/calcite-components/dist/components/calcite-accordion-item"),action:()=>import("@esri/calcite-components/dist/components/calcite-action"),"block-section":()=>import("@esri/calcite-components/dist/components/calcite-block-section"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),input:()=>import("@esri/calcite-components/dist/components/calcite-input"),"input-date-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-date-picker"),"input-time-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-time-picker"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),panel:()=>import("@esri/calcite-components/dist/components/calcite-panel"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch")})}get apiKey(){return this.viewModel.apiKey}set apiKey(e){this.viewModel.apiKey=e}get goToOverride(){return this.viewModel.goToOverride}set goToOverride(e){this.viewModel.goToOverride=e}get icon(){return"right"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get lastRoute(){return this.viewModel.lastRoute}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get maxStops(){return this.viewModel.maxStops}set maxStops(e){this.viewModel.maxStops=e}get unit(){return this.defaultUnit}set unit(e){this._overrideIfSome("unit",e)}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}acquireSearch(e){const{view:t}=this.viewModel;if(this._stopsToSearches.has(e)){const i=this._stopsToSearches.get(e);return i.view=t,this._overrideDefaultSources(i),i}const i=new _({icon:!1,popupEnabled:!1,resultGraphicEnabled:!1,view:t,...this.searchProperties});return this._normalizeSearchSources(i),this.addHandles([l((()=>i.allSources),"change",(()=>this._normalizeSearchSources(i))),i.on("search-clear",(()=>{e.geometry=null,e.name=null,this.viewModel.layer?.removeResult()})),i.on("select-result",(()=>{const t=i.selectedResult;e.geometry=t?.feature.geometry,e.name=t?.name,this._solveRouteDebounced()})),a((()=>i.searchTerm),(t=>{e.name=t}))],i),this._stopsToSearches.set(e,i),i}getDirections(){return this.viewModel.getDirections()}render(){return C("div",{class:this.classes(A.base,D.widget,D.panel)},C("calcite-flow",null,this._renderPrimaryFlowItem(),this._renderDirectionsFlowItem(),this._renderEditFlowItem(),this._renderSaveFlowItem()))}save(){return this.viewModel.save()}saveAs(e,t={}){return this.viewModel.saveAs(e,t)}zoomToRoute(){return this.viewModel.zoomToRoute()}_applyLocatorSourceOverrides({allSources:e}){for(const t of e)"url"in t&&t.url&&(t.locationType??="street",I(t.url)&&this.apiKey&&null==t.apiKey&&(t.apiKey=this.apiKey,t.url=F))}_disposeSearch(e){if(!e||!this._stopsToSearches.has(e))return;const t=this._stopsToSearches.get(e);this.removeHandles(t),t.destroy(),this._stopsToSearches.delete(e)}_getEffectiveStops(){return this.viewModel.layer?.stops??this._placeholderStops}_getErrorDescription(){switch(this.viewModel.lastError?.name){case"directions-view-model:unable-to-route":return this.messages.errors.unableToRoute;case"directions-view-model:service-metadata-unavailable":return this.messages.errors.unableToLoadServiceMetadata;default:return this.messages.errors.unknownError}}_getNetworkFeatureName(e){switch(e.type){case"stop":switch(e.locationType){case"stop":default:return this.messages.networkFeatures.stops.stop;case"waypoint":return this.messages.networkFeatures.stops.waypoint;case"break":return this.messages.networkFeatures.stops.break}case"point-barrier":return this.messages.networkFeatures.pointBarrier;case"polyline-barrier":return this.messages.networkFeatures.polylineBarrier;case"polygon-barrier":return this.messages.networkFeatures.polygonBarrier}}_getRouteCostSummary(){const e=this.viewModel.layer?.routeInfo;if(!e)return null;const t=e.totalDistance??0,i=e.totalDuration??0,{messagesUnits:s,unit:o}=this;return{distance:f(s,t,o),duration:S(i)}}_getStopSections(){if(!this.viewModel.layer)return null;const{directionPoints:e,directionLines:t,stops:i}=this.viewModel.layer;if(!e||!t)return null;const s=[];let o=null;for(const r of e){const{objectId:e,stopId:a}=r;if(null!=a){const e=i.find((({objectId:e})=>e===a));o&&o.stop===e||(o={stop:e,directions:[]},s.push(o));continue}if(null==o)continue;const n=t.find((({directionPointId:t})=>t===e));null!=n&&o.directions.push({directionPoint:r,directionLine:n})}return s}_handleLocateStopAction(e){const{view:t}=this;if(!t)return;const i="directions-search-tool";this.removeHandles(i),this._searchTool=new w({stop:e,view:t}),this.addHandles([this._searchTool.on("click",(async t=>{if(t.mapPoint&&this._stopsToSearches.has(e)){const i=this._stopsToSearches.get(e),s=await i.search(t.mapPoint),o=s?.results?.[0].results?.[0];if(o){const{feature:t,name:s}=o;i.searchTerm=s,e.geometry=t.geometry}}this.removeHandles(i)})),s((()=>{this._searchTool&&(this.view?.tools.remove(this._searchTool),this._searchTool=null)}))],i),t.addAndActivateTool(this._searchTool)}_handleEditingDoneClick(){this.viewModel.stopEditing(),this._currentFlowItem="primary"}async _handleSaveLayerAsAction(){const e=p.getDefault();try{await e.signIn()}catch(t){if(r(t)||"identity-manager:user-aborted"===t.name)return;return this._parentFlowItem=this._currentFlowItem,this._currentFlowItem="save",void(this._saveState="connect-to-portal-error")}this._saveState="fetch-portal-information",this._parentFlowItem=this._currentFlowItem,this._currentFlowItem="save",this._portalUserName=e.user?.username;try{this._portalFolders=await(e.user?.fetchFolders())}catch{return void(this._saveState="fetch-portal-information-error")}this._saveState="save-layer"}_normalizeSearchSources(e){this._overrideDefaultSources(e),this._applyLocatorSourceOverrides(e)}_overrideDefaultSources(e){for(const t of e.viewModel.defaultSources)t.autoNavigate=!1}_renderClearRouteAction(e){return C("calcite-action",{icon:"trash",key:"clear-route",onclick:()=>{this._currentFlowItem="primary",this.viewModel.reset()},...e,text:this.messages.common.clear,textEnabled:!0})}_renderDeleteStopAction(e){const t=this._getEffectiveStops();return C("calcite-action",{icon:"trash",onclick:()=>{t.remove(e),this._disposeSearch(e),this._solveRouteDebounced()},scale:"s",slot:"actions-end",text:this.messages.deleteStop,title:this.messages.deleteStop})}_renderDepartureTime(){const{DEPART_AT:e,NOW:t,UNSPECIFIED:i}=M;return C("calcite-label",{class:A.departureTime,key:"departure-time"},this.messages.departureTime,C("calcite-combobox",{clearDisabled:!0,label:this.messages.departureTime,overlayPositioning:"fixed",selectionMode:"single",onCalciteComboboxChange:({currentTarget:e})=>{const{selectedItems:t}=e;t.length&&(this.viewModel.departureOption=t[0].value,this._solveRouteDebounced())}},C("calcite-combobox-item",{heading:this.messages.leaveNow,key:t,label:this.messages.leaveNow,selected:this.viewModel.departureOption===t,value:t}),C("calcite-combobox-item",{heading:this.messages.departAt,key:e,label:this.messages.departAt,selected:this.viewModel.departureOption===e,value:e}),C("calcite-combobox-item",{heading:this.messages.timeUnspecified,key:i,label:this.messages.timeUnspecified,selected:this.viewModel.departureOption===i,value:i})))}_renderDepartureTimeOptions(){return this.viewModel.departureOption!==M.DEPART_AT?null:C("div",{class:A.departureTimeOptions},C("calcite-input-date-picker",{scale:"s",valueAsDate:$(this.viewModel.departureIsoDate),onCalciteInputDatePickerChange:({currentTarget:{value:e}})=>{Array.isArray(e)||(this.viewModel.departureIsoDate=e,this._solveRouteDebounced())}}),C("calcite-input-time-picker",{scale:"s",value:this.viewModel.departureIsoTime,onCalciteInputTimePickerClose:({currentTarget:{value:e}})=>{this.viewModel.departureIsoTime=e,this._solveRouteDebounced()}}))}_renderDirectionsFlowItem(){if("directions"!==this._currentFlowItem)return null;const e=this._getRouteCostSummary();if(!this._sections||!e)return null;const{distance:t,duration:i}=e,{formattedEta:s}=this.viewModel,o=this._sections.at(0)?.stop.name??"",r=this._sections.at(-1)?.stop.name??"";return C("calcite-flow-item",{key:"directions-flow-item",overlayPositioning:"fixed",selected:"directions"===this._currentFlowItem,onCalciteFlowItemBack:e=>{e.stopPropagation(),this._currentFlowItem="primary"}},C("div",{class:A.directionsHeader,slot:"header-content"},C("div",{class:A.headerStops},C("span",null,this.messages.from)," ",C("span",{class:A.directionsHeaderStopName},o),C("span",null,this.messages.to)," ",C("span",{class:A.directionsHeaderStopName},r)),C("div",{class:A.flexColumn},C("span",null,`${i} (${t})`),s?C("span",null,s):null)),this._renderRouteLayerActions({slot:"header-menu-actions"}),C("calcite-accordion",{class:A.accordion,iconPosition:"start",selectionMode:"single"},this._sections.map(((e,t)=>{const{stop:i,directions:s}=e,{name:o}=i;return C("calcite-accordion-item",{expanded:0===t,heading:o??"",key:`stop-${t}`},C("calcite-action",{icon:"zoom-to-object",onclick:()=>{this.viewModel.centerAt(i)},slot:"actions-end",text:this.messages.panToStop}),this._renderDirectionTurns(s))}))))}_renderDirectionTurns(e){return C("calcite-list",{label:this.messages.drivingDirections,selectionMode:"none"},e.map(((e,t)=>{const{directionPoint:i,directionLine:s}=e,{distance:o,duration:r}=s,a=f(this.messagesUnits,o??0,this.unit),n=S(r??0),l=a&&n?`${a} | ${n}`:`${a||n}`,c=E(i),d=k(i.directionPointType);return C("calcite-list-item",{class:A.labelNoBottomMargin,key:`driving-direction-${t}`,onpointerenter:()=>{this.viewModel.highlight(s)},onpointerleave:()=>{this.viewModel.clearHighlights()},onCalciteListItemSelect:()=>{this._activeManeuver===s?this.zoomToRoute():(this._activeManeuver=s,this.viewModel.centerAt(s.geometry))}},C("calcite-icon",{icon:d,slot:"content-start"}),C("div",{slot:"content"},C("calcite-label",{layout:"inline",scale:"s"},c),C("calcite-label",{layout:"inline",scale:"s"},l)))})))}_renderEditFlowItem(){return"edit"!==this._currentFlowItem?null:C("calcite-flow-item",{heading:this.messages.editRoute,headingLevel:this.headingLevel,key:"edit-flow-item",loading:"routing"===this.viewModel.state,selected:"edit"===this._currentFlowItem,onCalciteFlowItemBack:e=>{e.stopPropagation(),this.viewModel.stopEditing(),this._currentFlowItem="primary"}},C("div",{class:A.flexColumn,key:"edit-container"},C("div",{class:A.editToolbarContainer},C("calcite-label",{layout:"inline",scale:"s"},this.messages.automaticallySolve,C("calcite-switch",{checked:this.viewModel.autoSolve,scale:"s",onCalciteSwitchChange:e=>{this.viewModel.autoSolve=e.target.checked}})),C("div",{class:A.editToolbar},C("calcite-action",{icon:"flag",onclick:()=>{this.viewModel.create("stop")},scale:"s",text:this.messages.networkFeatures.stops.stop,textEnabled:!0}),C("calcite-action",{icon:"line",onclick:()=>{this.viewModel.create("polyline-barrier")},scale:"s",text:this.messages.barrier,textEnabled:!0}),C("calcite-action",{class:A.solveRoute,disabled:this.viewModel.autoSolve,icon:"refresh",onclick:()=>{this._solveRouteDebounced()},scale:"s",text:this.messages.solve,textEnabled:!0}))),C("div",{class:A.selectedFeatureContainer},C("calcite-list",{label:this.messages.selectedNetworkFeatures,scale:"s",selectionMode:"none"},this.viewModel.selectedNetworkFeatures?.toArray().map(((e,t)=>C("calcite-list-item",{description:this._getNetworkFeatureName(e),key:`network-feature-${t}`,label:e.name??e.objectId?.toString()??this.messages.unnamed},C("calcite-action",{icon:"trash",onclick:()=>{this.viewModel.remove(e)},scale:"s",slot:"actions-end",text:this.messages.common.delete})))))),C("div",{class:A.editFooter},this._renderEditFooterContent())))}_renderEditFooterContent(){return this.viewModel.lastError?this._renderErrorNotice():C("calcite-button",{appearance:"outline-fill",bind:this,onclick:this._handleEditingDoneClick,width:"full"},this.messages.common.done)}_renderErrorNotice(){return C("calcite-notice",{icon:"exclamation-mark-circle",kind:"danger",open:!0},C("calcite-label",{class:A.labelNoBottomMargin,slot:"message"},this._getErrorDescription()))}_renderFooter(){if(!this.viewModel.layer)return C("div",{class:A.primaryFooter,key:"footer-missing-layer"},C("calcite-notice",{icon:"information",open:!0},C("calcite-label",{class:A.labelNoBottomMargin,slot:"message"},this.messages.missingLayer)));if("unauthenticated"===this.viewModel.state)return C("div",{class:A.primaryFooterCentered,key:"footer-sign-in"},C("calcite-label",null,this.messages.signInRequired),C("calcite-button",{onclick:()=>{this.viewModel.load().catch((()=>{}))}},this.messages.common.auth.signIn));if("routing"===this.viewModel.state)return C("div",{class:this.classes(A.primaryFooter,A.primaryFooterLoader),key:"footer-routing"},C("calcite-loader",{label:this.messages.solve,scale:"s"}));if("error"===this.viewModel.state)return C("div",{class:A.primaryFooter,key:"footer-service-error"},this._renderErrorNotice());if(!this.viewModel.layer?.routeInfo)return C("div",{class:A.primaryFooter,key:"footer-unsolved-route"},C("calcite-notice",{icon:"information",open:!0},C("calcite-label",{class:A.labelNoBottomMargin,slot:"message"},this.messages.directionsPlaceholder)));const e=this._getRouteCostSummary();if(!e||!this.viewModel.layer?.directionPoints)return C("div",{class:A.primaryFooter,key:"footer-invalid-route"},C("calcite-notice",{icon:"exclamation-mark-triangle",kind:"danger",open:!0},C("calcite-label",{class:A.labelNoBottomMargin,slot:"message"},this.messages.invalidRoute)));const{distance:t,duration:i}=e,{formattedEta:s}=this.viewModel;return C("div",{class:A.routeItem,key:"footer-directions-summary"},C("button",{"aria-busy":"false","aria-label":this.messages.viewDrivingDirections,"aria-live":"polite",class:A.routeItemButton,onclick:()=>{this._currentFlowItem="directions"},type:"button"},C("div",{class:A.routeItemButtonContent},C("span",{class:A.routeItemLabel},`${i} (${t})`),C("span",{class:A.routeItemDescription},s)),C("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s"})),C("calcite-dropdown",null,C("calcite-action",{icon:"ellipsis",slot:"trigger",text:"Route actions"}),this._renderRouteLayerActions()))}_renderInteractiveRouteActions(){return C("div",{class:A.actionContainer,key:"interactive-route-action-container"},C("calcite-button",{appearance:"outline",class:A.addStopButton,disabled:this._getEffectiveStops().length>=this.maxStops,iconStart:"plus",kind:"neutral",label:this.messages.addStop,onclick:()=>{const e=new v;this.viewModel.layer?.stops.add(new u({symbol:e}))},width:"half"},this.messages.addStop),C("calcite-button",{appearance:"outline",disabled:"2d"!==this.viewModel.view?.type,iconStart:"pencil",kind:"neutral",label:this.messages.editRoute,onclick:()=>{this._currentFlowItem="edit",this.viewModel.startEditing()},width:"half"},this.messages.editRoute))}_renderLocateStopAction(e){if(null!=e.name||null!=e.geometry)return null;const t=this._getEffectiveStops().indexOf(e),i=!!this.view?.activeTool&&this.view.activeTool===this._searchTool&&this._searchTool.stop===e;return C("calcite-action",{active:i,icon:"crosshair",key:`stop-location-action-${t}`,onclick:()=>this._handleLocateStopAction(e),scale:"s",slot:"actions-end",text:this.messages.pickALocationOnTheMap,title:this.messages.pickALocationOnTheMap})}_renderOptimizeStopOrder(){const{routeParameters:e}=this.viewModel,{findBestSequence:t,preserveFirstStop:i,preserveLastStop:s}=e;return C("calcite-block-section",{class:A.optimizeSection,text:this.messages.optimizeOrder,toggleDisplay:"switch",onCalciteBlockSectionToggle:({target:t})=>{e.findBestSequence=t.open,t.open||this._resetStopSequence(),this._solveRouteDebounced()}},t?[C("calcite-label",{class:A.optimizeSwitches,key:"preserve-first-stop",layout:"inline-space-between"},this.messages.preserveFirstStop,C("calcite-switch",{checked:i,scale:"s",onCalciteSwitchChange:({target:{checked:t}})=>{e.preserveFirstStop=t,this._resetStopSequence(),this._solveRouteDebounced()}})),C("calcite-label",{class:A.optimizeSwitches,key:"preserve-last-stop",layout:"inline-space-between"},this.messages.preserveLastStop,C("calcite-switch",{checked:s,scale:"s",onCalciteSwitchChange:({target:{checked:t}})=>{e.preserveLastStop=t,this._resetStopSequence(),this._solveRouteDebounced()}}))]:null)}_renderPrimaryFlowItem(){return C("calcite-flow-item",{key:"primary-flow-item",loading:"initializing"===this.viewModel.state,selected:"primary"===this._currentFlowItem},C("calcite-panel",{class:A.primaryFlowItem,disabled:!this.viewModel.layer||"unauthenticated"===this.viewModel.state||"error"===this.viewModel.state&&!this.viewModel.serviceDescription},this._renderStops(),this._renderInteractiveRouteActions(),this._renderSeparator(),this._renderRouteSolveOptions()),this._renderFooter())}_renderRouteLayerActions(e){return[this._renderClearRouteAction(e),this._renderSaveLayerAction(e),this._renderSaveLayerAsAction(e),this._renderViewItemDetailsAction(e)]}_renderRouteSolveOptions(){return C("div",{class:A.marginInlineMedium,key:"route-solve-options"},this._renderTravelModes(),this._renderDepartureTime(),this._renderDepartureTimeOptions(),this._renderOptimizeStopOrder())}_renderSaveContent(){switch(this._saveState){case"initialized":return this._renderSaveInitialized();case"connect-to-portal":return this._renderSaveProcessing(this.messages.identity.lblSigning);case"connect-to-portal-error":return this._renderSaveError(this.messages.errors.authenticating);case"fetch-portal-information":return this._renderSaveProcessing(this.messages.processing.fetching);case"fetch-portal-information-error":return this._renderSaveError(this.messages.errors.fetching);case"save-layer":return this._renderSaveLayerSettings();case"saving":return this._renderSaveProcessing(this.messages.processing.saving);case"saving-error":return this._renderSaveError(this.messages.errors.saving)}}_renderSaveError(e){return C("calcite-panel",{class:A.paddingMedium,key:"save-layer-error"},C("div",{class:A.saveError},C("calcite-icon",{class:A.saveErrorIcon,icon:"exclamation-mark-triangle",scale:"l",textLabel:this.messages.common.errorMessage}),C("calcite-label",{class:A.saveErrorLabel},e)),C("calcite-button",{appearance:"outline",onclick:()=>{this._currentFlowItem=this._parentFlowItem},slot:"footer-actions",width:"full"},this.messages.common.close))}_renderSaveInitialized(){return C("calcite-panel",{class:A.paddingMedium,key:"save-layer-initialized"})}_renderSaveFlowItem(){return"save"!==this._currentFlowItem?null:C("calcite-flow-item",{heading:this.messages.saveLayer,headingLevel:this.headingLevel,key:"save-layer-flow-item",selected:"save"===this._currentFlowItem,onCalciteFlowItemBack:e=>{e.stopPropagation(),this._currentFlowItem=this._parentFlowItem}},this._renderSaveContent())}_renderSaveLayerAction(e){if(!this.visibleElements.saveButton)return null;const t=this.viewModel.layer,i=t?.routeInfo,s=t?.portalItem?.itemControl;return C("calcite-action",{disabled:!(!!i&&("admin"===s||"update"===s)),icon:"save",key:"save-route",onclick:()=>{this.viewModel.layer?.save()},...e,text:this.messages.common.save,textEnabled:!0})}_renderSaveLayerAsAction(e){if(!this.visibleElements.saveAsButton)return null;const t=!this.viewModel.layer?.routeInfo;return C("calcite-action",{disabled:t,icon:"save-as",key:"save-as-route",onclick:()=>{this._handleSaveLayerAsAction()},...e,text:this.messages.common.saveAs,textEnabled:!0})}_renderSaveLayerSettings(){if(null==this.layer||null==this._portalFolders||null==this._portalUserName)return this._renderSaveInitialized();const{stops:e}=this.layer,t=`${e.at(0).name} - ${e.at(-1).name}`,i=this._portalFolders.map((e=>C("calcite-combobox-item",{heading:e.title??"",key:`${L}-folder-${e.id}`,value:e.id})));return i.unshift(C("calcite-combobox-item",{heading:`${this._portalUserName} (${this.messages.common.home})`,key:`${L}-folder-home`,selected:!0,value:null})),C("calcite-panel",{key:"save-layer-panel"},C("div",{class:A.paddingMedium},C("calcite-label",null,this.messages.laverName,C("calcite-input",{afterCreate:e=>{this._portalItemNameInput=e},label:this.messages.laverName,value:t})),C("calcite-label",null,this.messages.saveInFolder,C("calcite-combobox",{afterCreate:e=>{this._portalFolderCombobox=e},label:this.messages.saveInFolder,overlayPositioning:"fixed",selectionMode:"single"},i))),C("calcite-button",{onclick:()=>{if(this._saveState="saving",null==this.layer||null==this._portalFolders)return;const e=this._portalItemNameInput?.value,t=this._portalFolderCombobox?.value,i=this._portalFolders.find((({id:e})=>e===t));this.layer.saveAs({title:e},{folder:i}).then((()=>{this._currentFlowItem=this._parentFlowItem})).catch((()=>{this._saveState="saving-error"}))},slot:"footer-actions",width:"full"},this.messages.common.save),C("calcite-button",{appearance:"outline",onclick:()=>{this._currentFlowItem=this._parentFlowItem},slot:"footer-actions",width:"full"},this.messages.common.cancel))}_renderSaveProcessing(e){return C("calcite-panel",{class:A.marginInlineMedium,key:"save-layer-processing"},C("calcite-loader",{class:A.saveProcessLoader,label:e,text:e}))}_renderSeparator(){return C("div",{class:A.separator})}_renderStop(e){const t=this.acquireSearch(e);null!=e.name&&(t.searchTerm=e.name);const i=this._getEffectiveStops(),s=this._renderLocateStopAction(e),o=i.length>2&&this._renderDeleteStopAction(e);return C("calcite-list-item",{key:e,value:e},s,o,C("div",{class:A.stopItem,slot:"content"},t.render()))}_renderStops(){const e=this._getEffectiveStops();for(const t of this._stopsToSearches.keys())e.includes(t)||this._disposeSearch(t);return C("div",{class:A.stopContainer,key:A.stopContainer},C("calcite-list",{class:A.stopList,dragEnabled:!0,label:this.messages.widgetLabel,scale:"s",onCalciteListOrderChange:({detail:t})=>{e.reorder(t.dragEl.value,t.newIndex),this._resetStopSequence(),this._solveRouteDebounced()}},e.toArray().map((e=>this._renderStop(e)))),2===e.length&&C("calcite-action",{icon:"arrow-up-down",onclick:()=>{e.reverse(),this._resetStopSequence(),this._solveRouteDebounced()},scale:"s",text:this.messages.reverseStops}))}_renderTravelModes(){return this.viewModel.travelModes.length?C("calcite-label",{key:"travel-modes"},this.messages.mode,C("calcite-combobox",{clearDisabled:!0,label:this.messages.mode,overlayPositioning:"fixed",selectionMode:"single",onCalciteComboboxChange:({currentTarget:e})=>{const{selectedItems:t}=e;t.length&&(this.viewModel.selectedTravelMode=t[0].value,this._solveRouteDebounced())}},this.viewModel.travelModes.map((e=>C("calcite-combobox-item",{heading:e.name,key:e.id,label:e.name,selected:this.viewModel.selectedTravelMode?.id===e.id,value:e}))))):null}_renderViewItemDetailsAction(e){if(!this.visibleElements.layerDetails)return null;const t=this.viewModel.layer?.portalItem;return C("calcite-action",{disabled:!t,icon:"launch",key:"open-route-details-link",onclick:()=>{t&&window.open(`${t.portal.url}/home/item.html?id=${t.id}`,"_blank")},...e,text:this.messages.viewLayerDetails,textEnabled:!0})}_resetStopSequence(){this.viewModel.layer?.stops.forEach((e=>{e.sequence=null}))}async _solveRoute(){this.viewModel.updateDepartureTime();if(!((this.viewModel.layer?.stops.filter((({geometry:e})=>!!e)).length??0)<2))try{await this.viewModel.getDirections()}catch{}}};e([d()],R.prototype,"_currentFlowItem",void 0),e([d()],R.prototype,"_saveState",void 0),e([d()],R.prototype,"_searchTool",void 0),e([d()],R.prototype,"apiKey",null),e([d(h)],R.prototype,"defaultUnit",void 0),e([d()],R.prototype,"goToOverride",null),e([d()],R.prototype,"headingLevel",void 0),e([d()],R.prototype,"icon",null),e([d()],R.prototype,"label",null),e([d({readOnly:!0})],R.prototype,"lastRoute",null),e([d()],R.prototype,"layer",null),e([d()],R.prototype,"maxStops",null),e([d(),x("esri/widgets/Directions/t9n/Directions")],R.prototype,"messages",void 0),e([d(),x("esri/core/t9n/Units")],R.prototype,"messagesUnits",void 0),e([d()],R.prototype,"searchProperties",void 0),e([d()],R.prototype,"unit",null),e([d()],R.prototype,"view",null),e([d({type:y})],R.prototype,"viewModel",void 0),e([d({type:b,nonNullable:!0})],R.prototype,"visibleElements",void 0),R=e([m("esri.widgets.Directions")],R);const N=R;export{N as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../intl.js";import{destroyMaybe as t}from"../../../core/maybe.js";import{watch as s}from"../../../core/reactiveUtils.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as i}from"../../../core/accessorSupport/decorators/subclass.js";import r from"../../Widget.js";import{legendItemCss as
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../intl.js";import{destroyMaybe as t}from"../../../core/maybe.js";import{watch as s}from"../../../core/reactiveUtils.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as i}from"../../../core/accessorSupport/decorators/subclass.js";import r from"../../Widget.js";import{legendItemCss as l}from"../css.js";import{Statistics as c}from"./Statistics.js";import{getTranslatedLineTitle as n}from"../support/intlUtils.js";import{loadCalciteComponents as a}from"../../support/componentsUtils.js";import"../../support/widgetUtils.js";import{tsx as d}from"../../support/jsxFactory.js";import{substitute as p}from"../../../intl/substitute.js";let h=class extends r{constructor(e,t){super(e,t),this.checkboxVisible=!0,this.expanded=!1}loadDependencies(){return a({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),checkbox:()=>import("@esri/calcite-components/dist/components/calcite-checkbox"),label:()=>import("@esri/calcite-components/dist/components/calcite-label")})}initialize(){this._statistics=new c(this._statisticsProps),this.addHandles(s((()=>this._statisticsProps),(e=>this._statistics.set(e))))}destroy(){this._statistics=t(this._statistics)}render(){const e=this.expanded;return d("div",{class:this.classes(l.base,{[l.disabled]:this.disabled,[l.expanded]:e}),key:this},this._renderColorIndicator(),d("div",{class:l.header,key:"header"},this._renderLabelWithCheckbox(),this._renderCollapseToggleButton()),e?d("div",{class:l.content,key:"content"},this._statistics.render()):null)}get disabled(){return!this.line.available}get _statisticsProps(){return{line:this.line,effectiveUnits:this.effectiveUnits}}_renderColorIndicator(){return d("div",{class:l.colorIndicator,key:"color-indicator",styles:{backgroundColor:this.line.color.toCss()}})}_renderCollapseToggleButton(){const{expanded:e,messages:t}=this,s=e?t.hideDetails:t.showDetails;return d("calcite-action",{appearance:"transparent",bind:this,class:l.collapseToggle,"data-testid":"legend-toggle",icon:e?"chevron-up":"chevron-down",key:"collapse-toggle",onclick:this._onCollapseToggleClick,scale:"s",text:s,title:s})}_onCollapseToggleClick(){this.onExpandedToggle()}_renderLabelWithCheckbox(){const{line:e,checkboxVisible:t,disabled:s,messages:o}=this;return d("calcite-label",{class:l.label,disabled:s,key:`label-${e.id}`,layout:"inline"},t?this._renderCheckbox():null,n(e,o))}_renderCheckbox(){const{disabled:e,line:t,messages:s}=this,o=t.visible,i=o?s.hideProfile:s.showProfile,r=p(i,{name:n(t,s)});return d("calcite-checkbox",{checked:o,class:l.checkbox,disabled:e,title:r,onCalciteCheckboxChange:()=>t.toggleVisibility()})}};e([o()],h.prototype,"checkboxVisible",void 0),e([o()],h.prototype,"disabled",null),e([o({nonNullable:!0})],h.prototype,"effectiveUnits",void 0),e([o()],h.prototype,"expanded",void 0),e([o({nonNullable:!0})],h.prototype,"line",void 0),e([o()],h.prototype,"messages",void 0),e([o()],h.prototype,"onExpandedToggle",void 0),e([o()],h.prototype,"_statistics",void 0),h=e([i("esri.widgets.ElevationProfile.components.LegendItem")],h);export{h as LegendItem};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import{property as t}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import{property as t}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import n from"../../Widget.js";import{settingsCss as r}from"../css.js";import{loadCalciteComponents as i}from"../../support/componentsUtils.js";import{UnitSelect as s}from"../../support/UnitSelect.js";import"../../support/widgetUtils.js";import{tsx as c}from"../../support/jsxFactory.js";let a=class extends n{constructor(){super(...arguments),this.messages=null,this._popoverIsOpen=!1,this._referenceElement=null,this._onUniformChartScalingChange=e=>{this.onUniformChartScalingChange(e.currentTarget.checked)}}loadDependencies(){return i({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),checkbox:()=>import("@esri/calcite-components/dist/components/calcite-checkbox"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),popover:()=>import("@esri/calcite-components/dist/components/calcite-popover")})}render(){const{id:e,messages:t,visibleElements:o}=this,{unitSelector:n,uniformChartScalingToggle:i}=o;if(!t||!n&&!i)return c("div",{key:`${e}-empty`});const s=this._popoverIsOpen?t.hideSettings:t.showSettings;return c("div",{class:r.base,key:this},c("calcite-action",{afterCreate:e=>{this._referenceElement=e},appearance:"transparent","data-testid":"settings-button",icon:"gear",scale:"s",text:s,title:s}),this._referenceElement?c("calcite-popover",{autoClose:!0,label:s,placement:"bottom-end",referenceElement:this._referenceElement,onCalcitePopoverClose:()=>{this._popoverIsOpen=!1},onCalcitePopoverOpen:()=>{this._popoverIsOpen=!0}},this._renderPopoverContent()):null)}_renderPopoverContent(){const{unitSelector:e,uniformChartScalingToggle:t}=this.visibleElements;return c("div",{class:r.popoverContent},e?this._renderUnitSelector():null,t?this._renderUniformChartScalingToggle():null)}_renderUnitSelector(){const{messages:e}=this;return c(s,{key:"unit-selector-label",options:this.unitOptions,selectLabel:e?.unitSelectLabel??"",value:this.unit,onChange:this.onUnitChange})}_renderUniformChartScalingToggle(){const{messages:e}=this,t=this.uniformChartScaling,o=e?.[t?"uniformChartScalingDisable":"uniformChartScalingEnable"]??"";return c("calcite-label",{class:r.uniformChartScalingLabel,key:"uniform-chart-scaling-label",layout:"inline"},c("calcite-checkbox",{checked:t,class:r.uniformChartScalingCheckbox,title:o,onCalciteCheckboxChange:this._onUniformChartScalingChange}),e?.uniformChartScalingLabel)}};e([t()],a.prototype,"messages",void 0),e([t()],a.prototype,"onUniformChartScalingChange",void 0),e([t()],a.prototype,"onUnitChange",void 0),e([t()],a.prototype,"uniformChartScaling",void 0),e([t()],a.prototype,"unit",void 0),e([t()],a.prototype,"unitOptions",void 0),e([t()],a.prototype,"visibleElements",void 0),e([t()],a.prototype,"_popoverIsOpen",void 0),e([t()],a.prototype,"_referenceElement",void 0),a=e([o("esri.widgets.ElevationProfile.components.SettingsButton")],a);export{a as SettingsButton};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../intl.js";import{watch as t}from"../../../core/reactiveUtils.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as i}from"../../../core/accessorSupport/decorators/subclass.js";import s from"../../Widget.js";import o from"../UtilityNetworkAssociationAddAssociationViewModel.js";import{loadCalciteComponents as
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../intl.js";import{watch as t}from"../../../core/reactiveUtils.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as i}from"../../../core/accessorSupport/decorators/subclass.js";import s from"../../Widget.js";import o from"../UtilityNetworkAssociationAddAssociationViewModel.js";import{loadCalciteComponents as l}from"../../support/componentsUtils.js";import n from"../../support/FilterBuilder.js";import{globalCss as a}from"../../support/globalCss.js";import{Heading as d}from"../../support/Heading.js";import"../../support/widgetUtils.js";import{messageBundle as c}from"../../support/decorators/messageBundle.js";import{tsx as u}from"../../support/jsxFactory.js";import{getFeatureTitle as p}from"../../support/UtilityNetworkAssociations/utilityNetworkUtils.js";import{substitute as h}from"../../../intl/substitute.js";const m="esri-feature-form-utility-network-association-layers",_={base:m,header:`${m}__header`,headingContent:`${m}__heading-content`,featureObserver:`${m}__feature-observer`,filterContainer:`${m}__filter-container`,filterOptionsContainer:`${m}__filter-options-container`,filterOptionsHeader:`${m}__filter-options-header`,listContainer:`${m}__list-container`,stickySpinnerContainer:`${m}__sticky-loading-container`,loadingContainer:`${m}__loading-container`};let f=class extends s{constructor(e,t){super(e,t),this.headingLevel=5,this.messagesCommon=null,this.messagesFeature=null,this.messagesFeatureForm=null,this.messagesFilterBuilder=null,this.viewModel=new o,this._filterBuilder=new n,this._featureFilterText="",this._layerFilterText="",this._observer=new IntersectionObserver((([e])=>{e?.isIntersecting&&this._increaseFeaturePage()}),{root:window.document}),this._observerNode=null}initialize(){this.addHandles([t((()=>this.viewModel),(()=>this.reset())),t((()=>[this.viewModel.state,this._observerNode]),(()=>this._onObserverChange())),t((()=>this.selectedLayer),(e=>{this._filterBuilder.layer=e,e||(this.filterOptionsVisible=!1,this._featureFilterText="")}))])}loadDependencies(){return l({action:()=>import("@esri/calcite-components/dist/components/calcite-action"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),input:()=>import("@esri/calcite-components/dist/components/calcite-input"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader")})}get filterOptionsVisible(){return this.viewModel.filterOptionsVisible}set filterOptionsVisible(e){this.viewModel.filterOptionsVisible=e}get selectedLayer(){return this.viewModel.selectedLayer}set selectedLayer(e){this.viewModel.selectedLayer=e}get selectedFeature(){return this.viewModel.selectedFeature}set selectedFeature(e){this.viewModel.selectedFeature=e}get filterWhereClause(){return this.viewModel.filterWhereClause}set filterWhereClause(e){this.viewModel.filterWhereClause=e,e||this._filterBuilder.reset()}get _filteredFeatureItems(){const{_featureFilterText:e}=this;return this.viewModel.featureItems.map((e=>({label:p(e),graphic:e,layer:e.sourceLayer}))).filter((t=>t.label?.toLowerCase().includes(e)??!1))}render(){const{state:e,filterOptionsVisible:t}=this.viewModel;return u("div",{class:this.classes(_.base,a.widget)},"loading"===e?this._renderLoading():t?this._renderFilterOptions():this.selectedLayer?this._renderFeatures():this._renderLayers())}applyFilterOptions(){const{selectedLayer:e}=this;this.filterOptionsVisible=!1,e&&(this.filterWhereClause=this._filterBuilder.whereClause)}reset(){this.filterWhereClause=null,this._featureFilterText="",this._layerFilterText="",this.filterOptionsVisible=!1}async _onObserverChange(){this._observerNode&&this._observer.unobserve(this._observerNode);const{state:e}=this.viewModel;this._observerNode&&"ready"===e&&this._observer.observe(this._observerNode)}_increaseFeaturePage(){const{featureCount:e,featurePage:t,state:r}=this.viewModel;e||1===t?"ready"===r&&this.viewModel.featurePage++:this.viewModel.featurePage=1}_renderStickyLoading(){return"querying"===this.viewModel.state?u("div",{class:_.stickySpinnerContainer,key:"sticky-loader"},this._renderLoadingIcon()):null}_renderLoading(){return u("div",{class:_.loadingContainer,key:"loading-container"},this._renderLoadingIcon())}_renderLoadingIcon(){return u("calcite-loader",{inline:!0,label:this.messagesCommon.loading})}_renderFilterOptions(){return u("div",{class:_.filterOptionsContainer},u("div",{class:_.filterOptionsHeader},u("span",null,this.messagesFilterBuilder.widgetLabel),u("calcite-button",{appearance:"transparent",onclick:()=>this._filterBuilder.reset()},this.messagesCommon.clear)),this._filterBuilder.render())}_renderLayers(){const e=this.messagesFeatureForm.associations,t=e.availableLayers,r=e.filterLayers;return u("div",null,this._renderHeader({heading:t,placeholder:r,renderFilterOptions:!1,renderTotal:!1}),u("div",{class:_.listContainer},u("calcite-list",{label:e.associatedFeatures},this._renderLayerItems(),this._renderStickyLoading())))}_renderLayerItems(){const{_layerFilterText:e,viewModel:t,messagesCommon:r}=this,{layerItems:i}=t;return i.map((e=>({label:e.title??r.untitled,layer:e}))).filter((t=>t.label?.toLowerCase().includes(e)??!1)).toArray().map((e=>this._renderLayerItem(e)))}_renderLayerItem(e){const{label:t,layer:r}=e;return u("calcite-list-item",{key:`layer-item-${r.id}`,label:t,onCalciteListItemSelect:()=>{this.selectedLayer=r}},u("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"}))}_renderFeatures(){const{selectedLayer:e}=this;if(!e)return;const t=this.messagesFeatureForm.associations,r=e.title??this.messagesCommon.untitled,i=t.filterFeatures;return u("div",null,this._renderHeader({heading:r,placeholder:i,renderFilterOptions:!0,renderTotal:!0}),u("div",{class:_.listContainer},u("calcite-list",{label:t.associatedFeatures},this._renderFeatureItems(),this._renderStickyLoading(),this._renderFeatureObserver())))}_renderFeatureItems(){return this._filteredFeatureItems.toArray().map((e=>this._renderFeatureItem(e)))}_renderFeatureItem(e){const{label:t,graphic:r}=e;return u("calcite-list-item",{key:`feature-item-${r.uid}`,label:t,onCalciteListItemSelect:()=>{this.selectedFeature=r}},u("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s",slot:"content-end"}))}_onObserverCreate(e){this._observerNode=e}_renderFeatureObserver(){return u("div",{afterCreate:this._onObserverCreate,bind:this,class:_.featureObserver,key:"feature-observer"})}_renderHeader(e){return u("div",{class:_.header,key:"filter"},this._renderHeading(e.heading),this._renderFilter(e.placeholder,e.renderFilterOptions),e.renderTotal?this._renderTotal():null)}_renderHeading(e){return e?u(d,{key:"title",level:this.headingLevel},u("div",{class:_.headingContent},u("calcite-icon",{icon:"layer"}),e)):null}_renderFilter(e,t){const r=!this.selectedLayer,i=r?this._layerFilterText:this._featureFilterText;return u("div",{class:_.filterContainer,key:"filter"},u("calcite-input",{icon:"search",placeholder:e,type:"search",value:i,onCalciteInputInput:e=>{r?this._layerFilterText=e.currentTarget.value.trim().toLowerCase():this._featureFilterText=e.currentTarget.value.trim().toLowerCase()}},t?this._renderFilterOptionsAction():null))}_renderFilterOptionsAction(){const e=this.messagesFeatureForm.associations.filterOptions;return u("calcite-action",{appearance:"transparent",icon:"sliders",indicator:!!this._filterBuilder.whereClause,onclick:()=>{this.viewModel.filterOptionsVisible=!this.viewModel.filterOptionsVisible},scale:"s",slot:"action",text:e,title:e})}_renderTotal(){const{messagesFeature:e,viewModel:t}=this,r=h(e.numberRecords,{number:t.featureCount});return u("div",{key:"total"},r)}};e([r()],f.prototype,"filterOptionsVisible",null),e([r()],f.prototype,"headingLevel",void 0),e([r(),c("esri/t9n/common")],f.prototype,"messagesCommon",void 0),e([r(),c("esri/widgets/Feature/t9n/Feature")],f.prototype,"messagesFeature",void 0),e([r(),c("esri/widgets/FeatureForm/t9n/FeatureForm")],f.prototype,"messagesFeatureForm",void 0),e([r(),c("esri/widgets/support/FilterBuilder/t9n/FilterBuilder")],f.prototype,"messagesFilterBuilder",void 0),e([r()],f.prototype,"selectedLayer",null),e([r({type:o})],f.prototype,"viewModel",void 0),e([r()],f.prototype,"selectedFeature",null),e([r()],f.prototype,"filterWhereClause",null),e([r()],f.prototype,"_filterBuilder",void 0),e([r()],f.prototype,"_featureFilterText",void 0),e([r()],f.prototype,"_layerFilterText",void 0),e([r()],f.prototype,"_observer",void 0),e([r()],f.prototype,"_filteredFeatureItems",null),e([r()],f.prototype,"_observerNode",void 0),f=e([i("esri.widgets.FeatureForm.FeatureFormUtilityNetworkAssociations.UtilityNetworkAssociationItemList")],f);const v=f;export{v as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import r from"../../core/Accessor.js";import{createTask as o}from"../../core/asyncUtils.js";import s from"../../core/Collection.js";import{abortMaybe as a}from"../../core/maybe.js";import{ignoreAbortErrors as i,debounce as n}from"../../core/promiseUtils.js";import{watch as u,initial as l}from"../../core/reactiveUtils.js";import{property as c}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as y}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as h}from"../../core/support/UpdatingHandles.js";import{isLayerFromCatalog as p}from"../../layers/catalog/catalogUtils.js";import{isSubtypeSublayer as d,isKnowledgeGraphLayer as g,isSubtypeGroupLayer as _}from"../../layers/support/layerUtils.js";import{isAssociatedFeatureSupportedLayer as m}from"../Feature/support/featureUtils.js";import{isMapImageLayer as f}from"../FeatureTable/support/tableUtils.js";import{createAssociation as C}from"../support/UtilityNetworkAssociations/utilityNetworkUtils.js";const b=100;let A=class extends r{constructor(e){super(e),this.graphic=null,this.layer=null,this.map=null,this.utilityNetwork=null,this.associationType=null,this.featureCount=0,this._queryAbortController=null,this._queryPageAbortController=null,this._queryFeatureCountAbortController=null,this.featuresPerPage=30,this.selectedFeature=null,this.association=null,this.filterOptionsVisible=!1,this.filterWhereClause=null,this._rulesTable=null,this._canAssociate=!1,this._whereClause=null,this._setUpItemsTask=null,this._updatingHandlesSetUp=new h,this._validateAssociationTask=null,this._updatingHandlesAssociation=new h,this._cancelQuery=()=>{const{_queryAbortController:e}=this;e&&e.abort(),this._queryAbortController=null},this._cancelQueryFeatureCount=()=>{const{_queryFeatureCountAbortController:e}=this;e&&e.abort(),this._queryFeatureCountAbortController=null},this._cancelQueryPage=()=>{const{_queryPageAbortController:e}=this;e&&e.abort(),this._queryPageAbortController=null},this._queryController=async()=>{this._cancelQuery();const e=new AbortController;this._queryAbortController=e,await i(this._query()).catch((()=>this._cancelQuery())),this._queryAbortController===e&&(this._queryAbortController=null)},this._queryFeatureCountController=async e=>{this._cancelQueryFeatureCount();const t=new AbortController;this._queryFeatureCountAbortController=t,await i(this._queryFeatureCount(e)).catch((()=>this._cancelQueryFeatureCount())),this._queryFeatureCountAbortController===t&&(this._queryFeatureCountAbortController=null)},this._queryPageController=async()=>{const e=new AbortController;this._queryPageAbortController=e,await i(this._queryPage()).catch((()=>this._cancelQueryPage())),this._queryPageAbortController===e&&(this._queryPageAbortController=null)},this._queryDebounced=n(this._queryController,b),this._queryFeatureCountDebounced=n(this._queryFeatureCountController,b),this._queryPageDebounced=n(this._queryPageController,b)}initialize(){this.addHandles([u((()=>[this.graphic,this.layer,this.map,this.utilityNetwork,this.globalId,this.associationType]),(()=>this._syncLayerItems()),l),u((()=>[this.selectedLayer,this.filterWhereClause]),(()=>{this.selectedLayer&&this._setUpFeatures()})),u((()=>this.selectedFeature),(()=>{this._setUpAssociation()})),u((()=>[this.featureCount,this.featuresPerPage,this.map,this.graphic,this.associationType]),(()=>this._queryDebounced())),u((()=>this.featurePage),(()=>this._queryPageDebounced()))])}destroy(){this._setUpItemsTask=a(this._setUpItemsTask),this._updatingHandlesSetUp.destroy(),this._validateAssociationTask=a(this._validateAssociationTask),this._updatingHandlesAssociation.destroy(),this._cancelQuery(),this._cancelQueryFeatureCount(),this._cancelQueryPage()}get mapLayers(){const{map:e}=this;if(!e)return null;const t=new Set,r=e=>{!m(e)||_(e)||t.has(e)||t.add(e)},o=e=>{p(e)||"catalog-footprint"===e.type||(g(e)?(e.layers?.forEach(r),e.tables?.forEach(r)):f(e)?(e.sublayers?.forEach(r),e.subtables?.forEach(r)):_(e)?e.sublayers?.forEach(r):r(e))};return e.allLayers.forEach(o),e.allTables.forEach(o),new s([...t])}get state(){const{_queryAbortController:e,_queryPageAbortController:t,canQuery:r}=this;return this.canLoad&&this._updatingHandlesSetUp.updating?"loading":this._updatingHandlesAssociation.updating?"validating":e||t?"querying":r?"ready":"disabled"}get canAddAssociation(){return!(this.updating||!this.association)&&this._canAssociate}get globalId(){return(this.globalIdField&&this.graphic?.attributes?.[this.globalIdField])??null}get globalIdField(){const{layer:e}=this;return e?.globalIdField??null}get layerItems(){return this._get("layerItems")||new s}get featureItems(){return this._get("featureItems")||new s}set featurePage(e){const{featuresPerPage:t,featureCount:r}=this,o=1,s=Math.ceil(r/t)||1;this._set("featurePage",Math.min(Math.max(e,o),s))}get featurePage(){return this._get("featurePage")}get canLoad(){const{map:e,utilityNetwork:t,graphic:r,associationType:o}=this;return!!(e&&t&&r&&o)}get canQuery(){const{utilityNetwork:e,graphic:t,associationType:r,selectedLayer:o}=this;return!!(e&&t&&r&&o)}get updating(){return this._updatingHandlesSetUp.updating||this._updatingHandlesAssociation.updating}get selectedLayer(){return this._get("selectedLayer")}set selectedLayer(e){e!==this.selectedLayer&&(this.filterWhereClause=null),this._set("selectedLayer",e)}get queryWhereClause(){const{_whereClause:e,filterWhereClause:t}=this;return t?`(${t}) AND ${e}`:e}async _queryFeatureCount(e){const{selectedLayer:t,_queryFeatureCountAbortController:r}=this;if(this._set("featureCount",0),!t)return;await t.load();const o=t.createQuery();o.returnGeometry=!1,o.where=o.where?`${o.where} AND ${e}`:e;const s=await t.queryFeatureCount(o,{signal:r?.signal});s>0&&this._set("featureCount",s)}async _query(){const{canQuery:e,queryWhereClause:t,_queryAbortController:r,featureItems:o}=this;e&&(this.featurePage=1,o.destroyAll(),this.featureCount&&!this.destroyed&&o.addMany(await this._queryAssociatedFeatures(t,{signal:r?.signal})))}async _queryPage(){const{canQuery:e,queryWhereClause:t,featurePage:r,_queryPageAbortController:o,featureCount:s,featureItems:a}=this;e&&(r<2||!s||a.addMany(await this._queryAssociatedFeatures(t,{signal:o?.signal})))}_convertTypeToDirection(e){switch(e){case"attachment":return[{type:"attachment",direction:"from"}];case"connectivity":return[{type:"junction-junction-connectivity"},{type:"junction-edge-from-connectivity"},{type:"junction-edge-midspan-connectivity"},{type:"junction-edge-to-connectivity"}];case"container":return[{type:"containment",direction:"to"}];case"content":return[{type:"containment",direction:"from"}];case"structure":return[{type:"attachment",direction:"to"}]}}async getRulesTable(){const{utilityNetwork:e}=this;if(!e)return null;if(this._rulesTable)return this._rulesTable;const t=await e.getRulesTable();return await(t?.load()),this._rulesTable=t,t}async _syncLayerItems(){a(this._setUpItemsTask);const{graphic:e,associationType:t,layerItems:r,canLoad:s}=this,i=o((async o=>{if(this.selectedLayer=null,r.destroyAll(),!s)return;const a=this.mapLayers?.toArray();if(!a)return;if(o.aborted)return;const i=await this.getRulesTable(),n=this._convertTypeToDirection(t.type),u=i?.getLayersCanAssociateWith(e,a,n);o.aborted||r.addMany(u||[])}));this._updatingHandlesSetUp.addPromise(i.promise),this._setUpItemsTask=i}async _setUpFeatures(){a(this._setUpItemsTask);const{graphic:e,associationType:t,selectedLayer:r,canQuery:s}=this;if(!s)return;const i=o((async o=>{const s=await this.getRulesTable(),a=this._convertTypeToDirection(t.type),i=s?.getFeaturesCanAssociateWithClause(e,r,a);this._whereClause=i,o.aborted||this._queryFeatureCountDebounced(this.queryWhereClause)}));this._updatingHandlesSetUp.addPromise(i.promise),this._setUpItemsTask=i}_determineFromAndTo(e,t,r){return"from"===r?{fromFeature:e,toFeature:t}:{fromFeature:t,toFeature:e}}_determineJunctionEdgeConnectivity(e,t){const{utilityNetwork:r}=this,o=d(e.sourceLayer)?e.sourceLayer.parent:e.sourceLayer,s=d(t.sourceLayer)?t.sourceLayer.parent:t.sourceLayer;if(!(r&&o&&"layerId"in o&&s&&"layerId"in s))return{fromFeature:e,toFeature:t,type:"junction-junction-connectivity"};const a=r.getSourceIdByLayerId(o.layerId),i=r.getSourceIdByLayerId(s.layerId);if(!a||!i)return{fromFeature:e,toFeature:t,type:"junction-junction-connectivity"};const n="junction"===r.getSourceTypeById(a),u="junction"===r.getSourceTypeById(i);return n&&u?{fromFeature:e,toFeature:t,type:"junction-junction-connectivity"}:u?{fromFeature:t,toFeature:e,type:"junction-edge-midspan-connectivity"}:{fromFeature:e,toFeature:t,type:"junction-edge-midspan-connectivity"}}_setUpAssociation(){const{utilityNetwork:e,graphic:t,selectedFeature:r,associationType:o}=this;if(!(e&&t&&r&&o))return void(this.association=null);const s=this._convertTypeToDirection(o.type);if(s.length>1){const{fromFeature:o,toFeature:s,type:a}=this._determineJunctionEdgeConnectivity(t,r);return this.association=C({fromFeature:o,toFeature:s,utilityNetwork:e,associationType:a}),void this.validateAssociation()}const{fromFeature:a,toFeature:i}=this._determineFromAndTo(t,r,s[0].direction);this.association=C({fromFeature:a,toFeature:i,utilityNetwork:e,associationType:s[0].type}),this.validateAssociation()}async _queryAssociatedFeatures(e,t){const{featuresPerPage:r,layer:o,featurePage:s,featureCount:a,selectedLayer:i}=this,{canQuery:n,globalId:u}=this;if(!n||!o||!i||null==u)return[];const l=((s-1)*r+a)%a,c=r,{historicMoment:y,gdbVersion:h}=i,p=i.createQuery();p.where=p.where?`${p.where} AND ${e}`:e,p.start=l,p.num=c,p.returnGeometry=!1,p.historicMoment=y,p.gdbVersion=h,p.outFields=["*"];return(await i.queryFeatures(p,{signal:t?.signal})).features}validateAssociation(){a(this._validateAssociationTask);const{utilityNetwork:e,association:t}=this,r=o((async()=>{e&&t&&(this._canAssociate=await e.canAddAssociation(t))}));this._updatingHandlesAssociation.addPromise(r.promise),this._validateAssociationTask=r}};e([c({type:t})],A.prototype,"graphic",void 0),e([c()],A.prototype,"layer",void 0),e([c()],A.prototype,"map",void 0),e([c({readOnly:!0})],A.prototype,"mapLayers",null),e([c()],A.prototype,"utilityNetwork",void 0),e([c()],A.prototype,"associationType",void 0),e([c()],A.prototype,"state",null),e([c({readOnly:!0})],A.prototype,"canAddAssociation",null),e([c({readOnly:!0})],A.prototype,"globalId",null),e([c({readOnly:!0})],A.prototype,"globalIdField",null),e([c()],A.prototype,"featureCount",void 0),e([c({readOnly:!0})],A.prototype,"layerItems",null),e([c({readOnly:!0})],A.prototype,"featureItems",null),e([c()],A.prototype,"_queryAbortController",void 0),e([c()],A.prototype,"_queryPageAbortController",void 0),e([c()],A.prototype,"_queryFeatureCountAbortController",void 0),e([c({value:1})],A.prototype,"featurePage",null),e([c()],A.prototype,"featuresPerPage",void 0),e([c({readOnly:!0})],A.prototype,"canLoad",null),e([c({readOnly:!0})],A.prototype,"canQuery",null),e([c({readOnly:!0})],A.prototype,"updating",null),e([c()],A.prototype,"selectedLayer",null),e([c()],A.prototype,"selectedFeature",void 0),e([c()],A.prototype,"association",void 0),e([c()],A.prototype,"filterOptionsVisible",void 0),e([c()],A.prototype,"filterWhereClause",void 0),e([c()],A.prototype,"queryWhereClause",null),e([c()],A.prototype,"_rulesTable",void 0),e([c()],A.prototype,"_canAssociate",void 0),e([c()],A.prototype,"_whereClause",void 0),A=e([y("esri.widgets.FeatureForm.UtilityNetworkAssociationAddAssociationViewModel")],A);const F=A;export{F as default};
|
|
5
|
+
import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../Graphic.js";import r from"../../core/Accessor.js";import{createTask as o}from"../../core/asyncUtils.js";import s from"../../core/Collection.js";import{abortMaybe as a}from"../../core/maybe.js";import{ignoreAbortErrors as i,debounce as n}from"../../core/promiseUtils.js";import{watch as u,initial as l}from"../../core/reactiveUtils.js";import{property as c}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as y}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as h}from"../../core/support/UpdatingHandles.js";import{isLayerFromCatalog as p}from"../../layers/catalog/catalogUtils.js";import{isSubtypeSublayer as d,isKnowledgeGraphLayer as g,isSubtypeGroupLayer as _}from"../../layers/support/layerUtils.js";import{isAssociatedFeatureSupportedLayer as m}from"../Feature/support/featureUtils.js";import{isMapImageLayer as f}from"../FeatureTable/support/tableUtils.js";import{createAssociation as C}from"../support/UtilityNetworkAssociations/utilityNetworkUtils.js";const b=100,A="association-key";let F=class extends r{constructor(t){super(t),this.graphic=null,this.layer=null,this.map=null,this.utilityNetwork=null,this.associationType=null,this.featureCount=0,this._queryAbortController=null,this._queryPageAbortController=null,this._queryFeatureCountAbortController=null,this.featuresPerPage=30,this.selectedFeature=null,this.association=null,this.filterOptionsVisible=!1,this.filterWhereClause=null,this._rulesTable=null,this._canAssociate=!1,this._whereClause=null,this._setUpItemsTask=null,this._updatingHandlesSetUp=new h,this._validateAssociationTask=null,this._updatingHandlesAssociation=new h,this._cancelQuery=()=>{const{_queryAbortController:t}=this;t&&t.abort(),this._queryAbortController=null},this._cancelQueryFeatureCount=()=>{const{_queryFeatureCountAbortController:t}=this;t&&t.abort(),this._queryFeatureCountAbortController=null},this._cancelQueryPage=()=>{const{_queryPageAbortController:t}=this;t&&t.abort(),this._queryPageAbortController=null},this._queryController=async()=>{this._cancelQuery();const t=new AbortController;this._queryAbortController=t,await i(this._query()).catch((()=>this._cancelQuery())),this._queryAbortController===t&&(this._queryAbortController=null)},this._queryFeatureCountController=async t=>{this._cancelQueryFeatureCount();const e=new AbortController;this._queryFeatureCountAbortController=e,await i(this._queryFeatureCount(t)).catch((()=>this._cancelQueryFeatureCount())),this._queryFeatureCountAbortController===e&&(this._queryFeatureCountAbortController=null)},this._queryPageController=async()=>{const t=new AbortController;this._queryPageAbortController=t,await i(this._queryPage()).catch((()=>this._cancelQueryPage())),this._queryPageAbortController===t&&(this._queryPageAbortController=null)},this._queryDebounced=n(this._queryController,b),this._queryFeatureCountDebounced=n(this._queryFeatureCountController,b),this._queryPageDebounced=n(this._queryPageController,b)}initialize(){this.addHandles([u((()=>[this.graphic,this.layer,this.map,this.utilityNetwork,this.globalId,this.associationType]),(()=>this._syncLayerItems()),l),u((()=>[this.selectedLayer,this.filterWhereClause]),(()=>{this.selectedLayer&&this._setUpFeatures()})),u((()=>this.selectedFeature),(()=>{this._setUpAssociation()})),u((()=>[this.featureCount,this.featuresPerPage,this.map,this.graphic,this.associationType]),(()=>this._queryDebounced())),u((()=>this.featurePage),(()=>this._queryPageDebounced()))])}destroy(){this._setUpItemsTask=a(this._setUpItemsTask),this._updatingHandlesSetUp.destroy(),this._validateAssociationTask=a(this._validateAssociationTask),this._updatingHandlesAssociation.destroy(),this._cancelQuery(),this._cancelQueryFeatureCount(),this._cancelQueryPage()}get mapLayers(){const{map:t}=this;if(!t)return null;const e=new Set,r=t=>{!m(t)||_(t)||e.has(t)||e.add(t)},o=t=>{p(t)||"catalog-footprint"===t.type||(g(t)?(t.layers?.forEach(r),t.tables?.forEach(r)):f(t)?(t.sublayers?.forEach(r),t.subtables?.forEach(r)):_(t)?t.sublayers?.forEach(r):r(t))};return t.allLayers.forEach(o),t.allTables.forEach(o),new s([...e])}get state(){const{_queryAbortController:t,_queryPageAbortController:e,canQuery:r}=this;return this.canLoad&&this._updatingHandlesSetUp.updating?"loading":this._updatingHandlesAssociation.updating?"validating":t||e?"querying":r?"ready":"disabled"}get canAddAssociation(){return!(this.updating||!this.association)&&this._canAssociate}get globalId(){return(this.globalIdField&&this.graphic?.attributes?.[this.globalIdField])??null}get globalIdField(){const{layer:t}=this;return t?.globalIdField??null}get layerItems(){return this._get("layerItems")||new s}get featureItems(){return this._get("featureItems")||new s}set featurePage(t){const{featuresPerPage:e,featureCount:r}=this,o=1,s=Math.ceil(r/e)||1;this._set("featurePage",Math.min(Math.max(t,o),s))}get featurePage(){return this._get("featurePage")}get canLoad(){const{map:t,utilityNetwork:e,graphic:r,associationType:o}=this;return!!(t&&e&&r&&o)}get canQuery(){const{utilityNetwork:t,graphic:e,associationType:r,selectedLayer:o}=this;return!!(t&&e&&r&&o)}get updating(){return this._updatingHandlesSetUp.updating||this._updatingHandlesAssociation.updating}get selectedLayer(){return this._get("selectedLayer")}set selectedLayer(t){t!==this.selectedLayer&&(this.filterWhereClause=null),this._set("selectedLayer",t)}get queryWhereClause(){const{_whereClause:t,filterWhereClause:e}=this;return e?`(${e}) AND ${t}`:t}async _queryFeatureCount(t){const{selectedLayer:e,_queryFeatureCountAbortController:r}=this;if(this._set("featureCount",0),!e)return;await e.load();const o=e.createQuery();o.returnGeometry=!1,o.where=o.where?`${o.where} AND ${t}`:t;const s=await e.queryFeatureCount(o,{signal:r?.signal});s>0&&this._set("featureCount",s)}async _query(){const{canQuery:t,queryWhereClause:e,_queryAbortController:r,featureItems:o}=this;t&&(this.featurePage=1,o.destroyAll(),this.featureCount&&!this.destroyed&&o.addMany(await this._queryAssociatedFeatures(e,{signal:r?.signal})))}async _queryPage(){const{canQuery:t,queryWhereClause:e,featurePage:r,_queryPageAbortController:o,featureCount:s,featureItems:a}=this;t&&(r<2||!s||a.addMany(await this._queryAssociatedFeatures(e,{signal:o?.signal})))}_convertTypeToDirection(t){switch(t){case"attachment":return[{type:"attachment",direction:"from"}];case"connectivity":return[{type:"junction-junction-connectivity"},{type:"junction-edge-from-connectivity"},{type:"junction-edge-midspan-connectivity"},{type:"junction-edge-to-connectivity"}];case"container":return[{type:"containment",direction:"to"}];case"content":return[{type:"containment",direction:"from"}];case"structure":return[{type:"attachment",direction:"to"}]}}async getRulesTable(){const{utilityNetwork:t}=this;if(!t)return null;if(this._rulesTable)return this._rulesTable;const e=await t.getRulesTable();return await(e?.load()),this._rulesTable=e,e}async _syncLayerItems(){a(this._setUpItemsTask);const{graphic:t,associationType:e,layerItems:r,canLoad:s}=this,i=o((async o=>{if(this.selectedLayer=null,r.destroyAll(),!s)return;const a=this.mapLayers?.toArray();if(!a)return;if(o.aborted)return;const i=await this.getRulesTable(),n=this._convertTypeToDirection(e.type),u=i?.getLayersCanAssociateWith(t,a,n);o.aborted||r.addMany(u||[])}));this._updatingHandlesSetUp.addPromise(i.promise),this._setUpItemsTask=i}async _setUpFeatures(){a(this._setUpItemsTask);const{graphic:t,associationType:e,selectedLayer:r,canQuery:s}=this;if(!s)return;const i=o((async o=>{const s=await this.getRulesTable(),a=this._convertTypeToDirection(e.type),i=s?.getFeaturesCanAssociateWithClause(t,r,a);this._whereClause=i,o.aborted||this._queryFeatureCountDebounced(this.queryWhereClause)}));this._updatingHandlesSetUp.addPromise(i.promise),this._setUpItemsTask=i}_determineFromAndTo(t,e,r){return"from"===r?{fromFeature:t,toFeature:e}:{fromFeature:e,toFeature:t}}_determineJunctionEdgeConnectivity(t,e){const{utilityNetwork:r}=this,o=d(t.sourceLayer)?t.sourceLayer.parent:t.sourceLayer,s=d(e.sourceLayer)?e.sourceLayer.parent:e.sourceLayer;if(!(r&&o&&"layerId"in o&&s&&"layerId"in s))return{fromFeature:t,toFeature:e,type:"junction-junction-connectivity"};const a=r.getSourceIdByLayerId(o.layerId),i=r.getSourceIdByLayerId(s.layerId);if(!a||!i)return{fromFeature:t,toFeature:e,type:"junction-junction-connectivity"};const n="junction"===r.getSourceTypeById(a),u="junction"===r.getSourceTypeById(i);return n&&u?{fromFeature:t,toFeature:e,type:"junction-junction-connectivity"}:u?{fromFeature:e,toFeature:t,type:"junction-edge-midspan-connectivity"}:{fromFeature:t,toFeature:e,type:"junction-edge-midspan-connectivity"}}_setUpAssociationHandles(){this.removeHandles(A),this.association&&this.addHandles(u((()=>[this.association?.associationType,this.association?.fromNetworkElement,this.association?.fromNetworkElement?.terminalId,this.association?.toNetworkElement,this.association?.toNetworkElement?.terminalId]),(()=>this.validateAssociation()),l),A)}_setUpAssociation(){const{utilityNetwork:t,graphic:e,selectedFeature:r,associationType:o}=this;if(!(t&&e&&r&&o))return void(this.association=null);const s=this._convertTypeToDirection(o.type);if(s.length>1){const{fromFeature:o,toFeature:s,type:a}=this._determineJunctionEdgeConnectivity(e,r);return this.association=C({fromFeature:o,toFeature:s,utilityNetwork:t,associationType:a}),void this._setUpAssociationHandles()}const{fromFeature:a,toFeature:i}=this._determineFromAndTo(e,r,s[0].direction);this.association=C({fromFeature:a,toFeature:i,utilityNetwork:t,associationType:s[0].type}),this._setUpAssociationHandles()}async _queryAssociatedFeatures(t,e){const{featuresPerPage:r,layer:o,featurePage:s,featureCount:a,selectedLayer:i}=this,{canQuery:n,globalId:u}=this;if(!n||!o||!i||null==u)return[];const l=((s-1)*r+a)%a,c=r,{historicMoment:y,gdbVersion:h}=i,p=i.createQuery();p.where=p.where?`${p.where} AND ${t}`:t,p.start=l,p.num=c,p.returnGeometry=!1,p.historicMoment=y,p.gdbVersion=h,p.outFields=["*"];return(await i.queryFeatures(p,{signal:e?.signal})).features}validateAssociation(){a(this._validateAssociationTask);const{utilityNetwork:t,association:e}=this,r=o((async()=>{t&&e&&(this._canAssociate=await t.canAddAssociation(e))}));this._updatingHandlesAssociation.addPromise(r.promise),this._validateAssociationTask=r}};t([c({type:e})],F.prototype,"graphic",void 0),t([c()],F.prototype,"layer",void 0),t([c()],F.prototype,"map",void 0),t([c({readOnly:!0})],F.prototype,"mapLayers",null),t([c()],F.prototype,"utilityNetwork",void 0),t([c()],F.prototype,"associationType",void 0),t([c()],F.prototype,"state",null),t([c({readOnly:!0})],F.prototype,"canAddAssociation",null),t([c({readOnly:!0})],F.prototype,"globalId",null),t([c({readOnly:!0})],F.prototype,"globalIdField",null),t([c()],F.prototype,"featureCount",void 0),t([c({readOnly:!0})],F.prototype,"layerItems",null),t([c({readOnly:!0})],F.prototype,"featureItems",null),t([c()],F.prototype,"_queryAbortController",void 0),t([c()],F.prototype,"_queryPageAbortController",void 0),t([c()],F.prototype,"_queryFeatureCountAbortController",void 0),t([c({value:1})],F.prototype,"featurePage",null),t([c()],F.prototype,"featuresPerPage",void 0),t([c({readOnly:!0})],F.prototype,"canLoad",null),t([c({readOnly:!0})],F.prototype,"canQuery",null),t([c({readOnly:!0})],F.prototype,"updating",null),t([c()],F.prototype,"selectedLayer",null),t([c()],F.prototype,"selectedFeature",void 0),t([c()],F.prototype,"association",void 0),t([c()],F.prototype,"filterOptionsVisible",void 0),t([c()],F.prototype,"filterWhereClause",void 0),t([c()],F.prototype,"queryWhereClause",null),t([c()],F.prototype,"_rulesTable",void 0),t([c()],F.prototype,"_canAssociate",void 0),t([c()],F.prototype,"_whereClause",void 0),F=t([y("esri.widgets.FeatureForm.UtilityNetworkAssociationAddAssociationViewModel")],F);const q=F;export{q as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../intl.js";import{isSome as e}from"../../core/arrayUtils.js";import{neverReached as t}from"../../core/compilerUtils.js";import{equalsShallow as r}from"../../core/lang.js";import n from"../../core/Logger.js";import{templateHasKey as o,replace as i}from"../../core/string.js";import{isFieldElement as l}from"../../form/support/formUtils.js";import{DomainValidationError as s}from"../../layers/support/domainUtils.js";import{isTimeOnlyField as u,NumericRangeValidationError as a,TypeValidationError as p}from"../../layers/support/fieldUtils.js";import{getSubtypesFromLayer as
|
|
5
|
+
import"../../intl.js";import{isSome as e}from"../../core/arrayUtils.js";import{neverReached as t}from"../../core/compilerUtils.js";import{equalsShallow as r}from"../../core/lang.js";import n from"../../core/Logger.js";import{templateHasKey as o,replace as i}from"../../core/string.js";import{isFieldElement as l}from"../../form/support/formUtils.js";import{DomainValidationError as s}from"../../layers/support/domainUtils.js";import{isTimeOnlyField as u,NumericRangeValidationError as a,TypeValidationError as p}from"../../layers/support/fieldUtils.js";import{isSubtypeSublayer as m,getSubtypesFromLayer as d}from"../../layers/support/layerUtils.js";import{isAnyDateField as f}from"../../smartMapping/support/utils.js";import{getLabelForDateFieldValue as c,getIntlOptionsForField as y}from"../support/dateUtils.js";import{InputValidationError as b,getRangeErrorMessage as g,shouldUseScientificNotation as j,scientificNumberFormatOptions as T,numberFormatOptions as x}from"../support/forms/formUtils.js";import{substitute as F}from"../../intl/substitute.js";const N=e=>"field"===e?.type,O=e=>"group"===e?.type,V=e=>"relationship"===e?.type,h=e=>"text"===e.type,v=e=>"utilityNetworkAssociations"===e.type,E=e=>!O(e)&&null!=e.group,U=e=>e.reduce(((e,t)=>O(t)?[...e,...t.inputs]:[...e,t]),[]),_=e=>U(e).filter(N),L=e=>U(e).filter(V),A=e=>U(e).filter(v),I=e=>null!=e&&($(e,"combo-box")||$(e,"radio-buttons")),$=(e,t)=>null!=e&&e.input?.type===t,w=({domain:e,inputType:t="text-box",dataType:r})=>"number"===r&&"text-box"===t&&(!e||"coded-value"!==e.type);function C(e){const{title:t,feature:r}=e??{},{attributes:n,sourceLayer:o}=r??{},i=o&&"displayField"in o?o.displayField:null,l=i?n?.[i]:null,s=r?.getObjectId()?.toString();return t||l||s||""}function Z(t){const{attributes:r,fieldsIndex:n,label:i,timeZone:l}=t;if(!r||"object"!=typeof r)return i;const s=Object.keys(r).filter((e=>o(i,e))),u=s.map((e=>r[e])),a=s.map((e=>n.get(e))).filter(e);return Y(i,W({values:u,fields:a,timeZone:l}))}const D="expression/",S="expr/",G="field/";function R(e){const[t,r]=e.split(D);return""===t&&r?r:(n.getLogger("esri.widgets.FeatureForm/featureFormUtils").error("extractExpressionNameFromString:invalid-input",`The string ${e} is not a valid expression reference of the form '${D}/expressionName'`),"")}function k(e){return`${D}${e}`}function B(e){return`${G}${e}`}function M(e){return e.startsWith(D)}function P(e){return e.startsWith(S)}function W(e){const{fields:t,values:r}=e,n=e.timeZone??void 0,o=t.map(((e,t)=>{let o=r[t];if(e.domain&&"coded-value"===e.domain.type){const t=e.domain.codedValues.find((e=>e.code===o));t?.name&&(o=t.name)}return(f(e)||u(e))&&(o=c(e,o,{timeZone:n,...y(e)})),[e.name,o]}));return Object.fromEntries(o)}function Y(e,t){return i(i(e,(e=>`{${e.toLowerCase()}}`)),Object.fromEntries(Object.entries(t).map((([e,t])=>[e.toLowerCase(),t]))))}const H=e=>{const t={typeFieldName:null,types:[]};return e?(m(e)?(t.typeFieldName=e.parent?.subtypeField,t.types=e.parent?.subtypes??[]):"subtype-group"===e.type||"feature"===e.type&&e.subtypes?.length?(t.typeFieldName=e.subtypeField,t.types=e.subtypes??[]):"types"in e&&e.types&&(t.typeFieldName=e.typeIdField,t.types=e.types.map((({id:e,name:t,domains:r})=>({code:e,name:t,domains:r})))),null!=t.typeFieldName&&(t.typeFieldName=e.getField(t.typeFieldName)?.name??t.typeFieldName),t):t},q=(e,t,r)=>{const{dataType:n,error:o,minLength:i}=e,l=t?.validationErrors;if(!l||!o)return null;if(o===b.CANNOT_BE_EMPTY)return l.cannotBeNull;if(o===s.VALUE_OUT_OF_RANGE||o===a.OUT_OF_RANGE){const{field:t,range:o}=e,i={type:"date",intlOptions:{timeZone:"date"===t.type&&r?r:void 0,...y(t)}},s=g(o,l);return F(s,o,{format:{max:"date"===n?i:null!=o.max&&j(o.max)?T:x,min:"date"===n?i:null!=o.min&&j(o.min)?T:x}})}return o===s.INVALID_CODED_VALUE?l.invalidCodedValue:o===p.INVALID_TYPE?l.invalidType:o===b.TOO_SHORT?F(l.tooShort,{min:i}):(b.TOO_LONG,null)},z=e=>{if(!e)return;const t=e.layer,r=t&&"geometryType"in t?t.geometryType:void 0,n=e.geometry?.type;return"polyline"===n||"polyline"===r?"line":"mesh"===n||"mesh"===r||"multipatch"===r?"cube":"multipoint"===n||"multipoint"===r?"point":n||r||"table"},J=e=>{const t=[];if(e.formTemplate){const{description:r,title:n}=e.formTemplate;e.fields?.forEach((e=>{const i=n&&o(n,e.name),l=r&&o(r,e.name);(i||l)&&t.push(e.name)}))}return t};function K(e,t){const r=t??("formTemplate"in e&&e.formTemplate);if(r){return(r.elements?.filter(l)??[]).some((({fieldName:t})=>!e.fieldsIndex.get(t)))}return!1}function Q(e,t){return null==e||t.onValue!==e&&t.offValue!==e}function X(e,r){switch(r.objectType){case"any":return!0;case"null":return null==e;case"code":return e===r.codedValue?.code;case"range":return null!=e&&null!=r.minValue&&null!=r.maxValue&&+e>=r.minValue&&+e<=r.maxValue;default:return t(r.objectType),!1}}function ee(e,t,n){const o=d(e),i=o?.find((e=>e.code===n));if(!i)return!1;const l=o?.find((e=>e.code===t));return!r(i.defaultValues,l?.defaultValues)&&Object.values(i.defaultValues).some((e=>null!=e))}export{R as extractExpressionNameFromString,A as flattenAssociationInputs,_ as flattenFieldInputs,U as flattenInputs,L as flattenRelationshipInputs,K as formTemplateHasInvalidFields,W as getComputedAttributes,q as getErrorMessageForFieldInput,C as getFeatureFormTitle,J as getFieldsInTitleAndDesc,z as getIconForFeature,H as getNormalizedFeatureTypeInfo,M as isExpressionReference,$ as isFieldElementWithInputType,I as isFieldElementWithShowNoValueOptionInput,N as isFieldInput,O as isGroupInput,E as isInputInGroupInput,P as isLegacyFieldMapsExpressionReference,w as isNumberFieldInput,V as isRelationshipInput,h as isTextElementInput,v as isUtilityNetworkAssociationInput,Z as parseFormTemplateString,k as prependExpressionPrefix,B as prependFieldPrefix,Y as substituteFieldTemplatesInString,ee as subtypeChangeShouldPrompt,Q as valueIsInvalidSwitchValue,X as valueIsValidContingentValue};
|