@arcgis/core 4.25.0-next.20220921 → 4.25.0-next.20220923

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.
Files changed (128) hide show
  1. package/README.md +17 -9
  2. package/applications/SceneViewer/sceneViewerUtils.js +1 -1
  3. package/arcade.js +1 -1
  4. package/assets/esri/core/workers/RemoteClient.js +1 -1
  5. package/assets/esri/core/workers/chunks/10892098faaf2f36fd0a.js +1 -0
  6. package/assets/esri/core/workers/chunks/28932ef68b6f3784c760.js +1 -0
  7. package/assets/esri/core/workers/chunks/2dca9023f01864f724cb.js +1 -0
  8. package/assets/esri/core/workers/chunks/477e02c178d392cde5d3.js +1 -0
  9. package/assets/esri/core/workers/chunks/{cc7569489b572b8b3b53.js → 4ef7e925f94ee85f79bb.js} +1 -1
  10. package/assets/esri/core/workers/chunks/b175a80296002ee9bca8.js +1 -0
  11. package/assets/esri/core/workers/chunks/{b8eba8c9d5424a7ae5f2.js → c06e7bd2468646631db2.js} +1 -1
  12. package/assets/esri/core/workers/chunks/e00327925ca82b63fded.js +1 -0
  13. package/assets/esri/core/workers/chunks/{64de93865088bbe0398f.js → e57a4d66f74510ce7a61.js} +1 -1
  14. package/assets/esri/core/workers/chunks/fb82788888990fbea11e.js +1 -0
  15. package/assets/esri/libs/linkchartlayout/lclayout.wasm +0 -0
  16. package/assets/esri/themes/base/widgets/_BasemapGallery.scss +2 -2
  17. package/assets/esri/themes/dark/main.css +1 -1
  18. package/assets/esri/themes/dark/main.scss +7 -5
  19. package/assets/esri/themes/light/main.css +1 -1
  20. package/assets/esri/themes/light/view.css +1 -1
  21. package/assets/esri/widgets/Feature/t9n/Feature.json +1 -1
  22. package/assets/esri/widgets/Feature/t9n/Feature_ar.json +1 -1
  23. package/assets/esri/widgets/Feature/t9n/Feature_bg.json +1 -1
  24. package/assets/esri/widgets/Feature/t9n/Feature_bs.json +1 -1
  25. package/assets/esri/widgets/Feature/t9n/Feature_ca.json +1 -1
  26. package/assets/esri/widgets/Feature/t9n/Feature_cs.json +1 -1
  27. package/assets/esri/widgets/Feature/t9n/Feature_da.json +1 -1
  28. package/assets/esri/widgets/Feature/t9n/Feature_de.json +1 -1
  29. package/assets/esri/widgets/Feature/t9n/Feature_el.json +1 -1
  30. package/assets/esri/widgets/Feature/t9n/Feature_en.json +1 -1
  31. package/assets/esri/widgets/Feature/t9n/Feature_es.json +1 -1
  32. package/assets/esri/widgets/Feature/t9n/Feature_et.json +1 -1
  33. package/assets/esri/widgets/Feature/t9n/Feature_fi.json +1 -1
  34. package/assets/esri/widgets/Feature/t9n/Feature_fr.json +1 -1
  35. package/assets/esri/widgets/Feature/t9n/Feature_he.json +1 -1
  36. package/assets/esri/widgets/Feature/t9n/Feature_hr.json +1 -1
  37. package/assets/esri/widgets/Feature/t9n/Feature_hu.json +1 -1
  38. package/assets/esri/widgets/Feature/t9n/Feature_id.json +1 -1
  39. package/assets/esri/widgets/Feature/t9n/Feature_it.json +1 -1
  40. package/assets/esri/widgets/Feature/t9n/Feature_ja.json +1 -1
  41. package/assets/esri/widgets/Feature/t9n/Feature_ko.json +1 -1
  42. package/assets/esri/widgets/Feature/t9n/Feature_lt.json +1 -1
  43. package/assets/esri/widgets/Feature/t9n/Feature_lv.json +1 -1
  44. package/assets/esri/widgets/Feature/t9n/Feature_nb.json +1 -1
  45. package/assets/esri/widgets/Feature/t9n/Feature_nl.json +1 -1
  46. package/assets/esri/widgets/Feature/t9n/Feature_pl.json +1 -1
  47. package/assets/esri/widgets/Feature/t9n/Feature_pt-BR.json +1 -1
  48. package/assets/esri/widgets/Feature/t9n/Feature_pt-PT.json +1 -1
  49. package/assets/esri/widgets/Feature/t9n/Feature_ro.json +1 -1
  50. package/assets/esri/widgets/Feature/t9n/Feature_ru.json +1 -1
  51. package/assets/esri/widgets/Feature/t9n/Feature_sk.json +1 -1
  52. package/assets/esri/widgets/Feature/t9n/Feature_sl.json +1 -1
  53. package/assets/esri/widgets/Feature/t9n/Feature_sr.json +1 -1
  54. package/assets/esri/widgets/Feature/t9n/Feature_sv.json +1 -1
  55. package/assets/esri/widgets/Feature/t9n/Feature_th.json +1 -1
  56. package/assets/esri/widgets/Feature/t9n/Feature_tr.json +1 -1
  57. package/assets/esri/widgets/Feature/t9n/Feature_uk.json +1 -1
  58. package/assets/esri/widgets/Feature/t9n/Feature_vi.json +1 -1
  59. package/assets/esri/widgets/Feature/t9n/Feature_zh-CN.json +1 -1
  60. package/assets/esri/widgets/Feature/t9n/Feature_zh-HK.json +1 -1
  61. package/assets/esri/widgets/Feature/t9n/Feature_zh-TW.json +1 -1
  62. package/core/workers/workerFactory.js +1 -1
  63. package/form/elements/inputs/ComboBoxInput.js +1 -1
  64. package/form/elements/inputs/RadioButtonsInput.js +1 -1
  65. package/interfaces.d.ts +957 -5
  66. package/libs/linkchartlayout/LinkChartLayout.js +1 -1
  67. package/networks/Network.js +1 -1
  68. package/networks/UtilityNetwork.js +1 -1
  69. package/networks/support/NetworkSystemLayers.js +5 -0
  70. package/package.json +1 -1
  71. package/rest/knowledgeGraph/DataModel.d.ts +4 -0
  72. package/rest/knowledgeGraph/Entity.d.ts +4 -0
  73. package/rest/knowledgeGraph/EntityType.d.ts +4 -0
  74. package/rest/knowledgeGraph/FieldIndex.d.ts +4 -0
  75. package/rest/knowledgeGraph/GraphNamedObject.d.ts +4 -0
  76. package/rest/knowledgeGraph/GraphObject.d.ts +4 -0
  77. package/rest/knowledgeGraph/GraphObjectType.d.ts +4 -0
  78. package/rest/knowledgeGraph/GraphProperty.d.ts +4 -0
  79. package/rest/knowledgeGraph/GraphQuery.d.ts +4 -0
  80. package/rest/knowledgeGraph/GraphQueryResult.d.ts +4 -0
  81. package/rest/knowledgeGraph/GraphSearch.d.ts +4 -0
  82. package/rest/knowledgeGraph/KnowledgeGraph.d.ts +4 -0
  83. package/rest/knowledgeGraph/Path.d.ts +4 -0
  84. package/rest/knowledgeGraph/Relationship.d.ts +4 -0
  85. package/rest/knowledgeGraph/RelationshipType.d.ts +4 -0
  86. package/rest/knowledgeGraph/wasmInterface/wasmToUpdateResponseFactories.js +1 -1
  87. package/rest/knowledgeGraphService.d.ts +4 -0
  88. package/rest/support/AggregateFeatureSet.js +1 -1
  89. package/support/featureFlags.js +1 -1
  90. package/support/revision.js +1 -1
  91. package/support/webSceneUtils.js +1 -1
  92. package/views/2d/MapViewConstraints.js +1 -1
  93. package/views/2d/constraints/GeometryConstraint.js +1 -1
  94. package/views/2d/constraints/RotationConstraint.js +1 -1
  95. package/views/2d/constraints/ZoomConstraint.js +1 -1
  96. package/views/2d/layers/MapImageLayerView2D.js +1 -1
  97. package/views/2d/layers/features/controllers/FeatureController2D.js +1 -1
  98. package/views/2d/layers/features/schemaUtils.js +1 -1
  99. package/views/2d/layers/features/sources/DataTileSource.js +1 -1
  100. package/views/2d/layers/features/support/ClusterStore.js +1 -1
  101. package/views/2d/layers/features/support/FeatureSetReaderJSON.js +1 -1
  102. package/views/2d/layers/features/support/FeatureSetReaderPBF.js +1 -1
  103. package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
  104. package/views/3d/environment/EnvironmentRenderer.js +1 -1
  105. package/views/3d/interactive/editingTools/reshapeGraphic/ReshapeOperation.js +1 -1
  106. package/views/3d/layers/MapImageLayerView3D.js +1 -1
  107. package/views/3d/layers/SceneLayerFeatureView3D.js +5 -0
  108. package/views/3d/layers/SceneLayerView3D.js +1 -1
  109. package/views/interactive/tooltip/ReshapeTooltipInfos.js +1 -1
  110. package/views/interactive/tooltip/content/TooltipContentReshapeEdgeOffset.js +1 -1
  111. package/views/layers/MapImageLayerView.js +1 -1
  112. package/views/support/Scheduler.js +1 -1
  113. package/widgets/Feature/FeatureRelationship/FeatureRelationshipViewModel.js +1 -1
  114. package/widgets/Feature/FeatureRelationship.js +1 -1
  115. package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
  116. package/widgets/FeatureForm/FormExpressionArcadeExecutor.js +5 -0
  117. package/widgets/FeatureForm/FormExpressionsManager.js +5 -0
  118. package/widgets/FeatureForm/InputField.js +1 -1
  119. package/widgets/FeatureForm/InputFieldGroup.js +1 -1
  120. package/widgets/FeatureTable.js +1 -1
  121. package/widgets/Popup/PopupViewModel.js +1 -1
  122. package/assets/esri/core/workers/chunks/01ac91fc0bc6b4d4e3c6.js +0 -1
  123. package/assets/esri/core/workers/chunks/43e4560d65e5ddeeef6f.js +0 -1
  124. package/assets/esri/core/workers/chunks/58824250492b89ec24ea.js +0 -1
  125. package/assets/esri/core/workers/chunks/64a6b837f1d5d7ad7619.js +0 -1
  126. package/assets/esri/core/workers/chunks/d1be3ab7846e3a555b6c.js +0 -1
  127. package/assets/esri/core/workers/chunks/e20e99f8f76f5002437e.js +0 -1
  128. package/assets/esri/core/workers/chunks/ef95d6ab7b1c032ab4ad.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../Graphic.js";import"../../symbols.js";import i from"../../core/Collection.js";import s from"../../core/Error.js";import r from"../../core/Handles.js";import o from"../../core/Logger.js";import{unwrap as n,isNone as a}from"../../core/maybe.js";import{watch as l,when as h,sync as u}from"../../core/reactiveUtils.js";import{property as c}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as d}from"../../core/accessorSupport/decorators/subclass.js";import{geographicToWebMercator as p}from"../../geometry/support/webMercatorUtils.js";import g from"../../layers/Layer.js";import f from"../../support/actions/ActionBase.js";import m from"../../support/actions/ActionButton.js";import y from"../../support/actions/ActionToggle.js";import{getDisplayedSymbol as w}from"../../symbols/support/symbolUtils.js";import{ViewEventPriorities as F}from"../../views/input/InputManager.js";import{highlightsSupported as v}from"../../views/support/layerViewUtils.js";import _ from"../Feature/FeatureViewModel.js";import{zoomToFeature as b,zoomToClusteredFeatures as C,browseClusteredFeatures as P}from"./actions.js";import{triggerAction as E,isClusterFeature as V,getSelectedTarget as A,removeClusteredFeaturesForBrowsing as M,displayClusterExtent as j,browseAggregateFeatures as L}from"./actionUtils.js";import O from"../support/AnchorElementViewModel.js";import{GoToMixin as T}from"../support/GoTo.js";import x from"../../symbols/SimpleFillSymbol.js";import I from"../../geometry/Point.js";const S=i.ofType({key:"type",defaultKeyValue:"button",base:f,typeMap:{button:m,toggle:y}}),B=()=>[b.clone()],G=()=>[C.clone(),P.clone()];let R=class extends(T(O)){constructor(e){super(e),this._handles=new r,this._pendingPromises=new Set,this._fetchFeaturesController=null,this._selectedClusterFeature=null,this.featurePage=null,this.actions=new S,this.activeFeature=null,this.defaultPopupTemplateEnabled=!1,this.autoCloseEnabled=!1,this.autoOpenEnabled=!0,this.browseClusterEnabled=!1,this.content=null,this.featuresPerPage=20,this.featureViewModelAbilities=null,this.featureViewModels=[],this.highlightEnabled=!0,this.includeDefaultActions=!0,this.selectedClusterBoundaryFeature=new t({symbol:new x({outline:{width:1.5,color:"cyan"},style:"none"})}),this.title=null,this.updateLocationEnabled=!1,this.view=null,this.visible=!1,this.zoomFactor=4,this.zoomToLocation=null}get isLoadingFeature(){return this.featureViewModels.some((e=>e.waitingForContent))}initialize(){this._handles.add([l((()=>[this.autoOpenEnabled,this.view]),(()=>this._autoOpenEnabledChange())),this.on("view-change",(()=>this._autoClose())),l((()=>[this.highlightEnabled,this.selectedFeature,this.visible,this.view]),(()=>this._highlightSelectedFeature())),l((()=>[this.highlightEnabled,this.activeFeature,this.visible,this.view]),(()=>this._highlightActiveFeature())),l((()=>this.view?.animation?.state),(e=>this._animationStateChange(e))),l((()=>this.location),(e=>this._locationChange(e))),l((()=>this.selectedFeature),(e=>this._selectedFeatureChange(e))),l((()=>[this.selectedFeatureIndex,this.featureCount,this.featuresPerPage]),(()=>this._selectedFeatureIndexChange())),l((()=>[this.featurePage,this.selectedFeatureIndex,this.featureCount,this.featuresPerPage,this.featureViewModels]),(()=>this._setGraphicOnFeatureViewModels())),l((()=>this.featureViewModels),(()=>this._featureViewModelsChange())),this.on("trigger-action",(e=>E({event:e,view:this.view}))),h((()=>!this.waitingForResult),(()=>this._waitingForResultChange()),u),l((()=>[this.features,this.view?.map,this.view?.spatialReference]),(()=>this._updateFeatureVMs())),l((()=>this.view?.scale),(()=>this._viewScaleChange())),h((()=>!this.visible),(()=>this.browseClusterEnabled=!1)),l((()=>this.browseClusterEnabled),(e=>e?this.enableClusterBrowsing():this.disableClusterBrowsing()))])}destroy(){this._cancelFetchingFeatures(),this._handles.destroy(),this._handles=null,this._pendingPromises.clear(),this.browseClusterEnabled=!1,this.view=null}get active(){return!(!this.visible||this.waitingForResult)}get allActions(){const e=this._get("allActions")||new S;e.removeAll();const{actions:t,defaultActions:i,defaultPopupTemplateEnabled:s,includeDefaultActions:r,selectedFeature:o}=this,n=r?i.concat(t):t,a=o&&("function"==typeof o.getEffectivePopupTemplate&&o.getEffectivePopupTemplate(s)||o.popupTemplate),l=a&&a.actions,h=a&&a.overwriteActions?l:l?l.concat(n):n;return h&&h.filter(Boolean).forEach((t=>e.add(t))),e}get defaultActions(){const e=this._get("defaultActions")||new S;return e.removeAll(),e.addMany(V(this.selectedFeature)?G():B()),e}get featureCount(){return this.features.length}get features(){return this._get("features")||[]}set features(e){const t=e||[];this._set("features",t);const{pendingPromisesCount:i,promiseCount:s,selectedFeatureIndex:r}=this,o=s&&t.length;o&&i&&-1===r?this.selectedFeatureIndex=0:o&&-1!==r||(this.selectedFeatureIndex=t.length?0:-1)}get location(){return this._get("location")||null}set location(e){const t=this.get("view.spatialReference.isWebMercator");e&&e.get("spatialReference.isWGS84")&&t&&(e=p(e)),this._set("location",e)}get pendingPromisesCount(){return this._pendingPromises.size}get waitingForResult(){return!(!(!!this._fetchFeaturesController||this.pendingPromisesCount>0)||0!==this.featureCount)}get promiseCount(){return this.promises.length}get promises(){return this._get("promises")||[]}set promises(e){if(this._pendingPromises.clear(),this.features=[],!Array.isArray(e)||!e.length)return this._set("promises",[]),void this.notifyChange("pendingPromisesCount");this._set("promises",e),(e=e.slice(0)).forEach((e=>{this._pendingPromises.add(e);const t=t=>{this._pendingPromises.has(e)&&this._updateFeatures(t),this._updatePendingPromises(e)},i=()=>this._updatePendingPromises(e);e.then(t,i)})),this.notifyChange("pendingPromisesCount")}get selectedFeature(){const{features:e,selectedFeatureIndex:t}=this;if(-1===t)return null;return e[t]||null}get selectedFeatureIndex(){const e=this._get("selectedFeatureIndex");return"number"==typeof e?e:-1}set selectedFeatureIndex(e){const{featureCount:t}=this;e=isNaN(e)||e<-1||!t?-1:(e+t)%t,this.activeFeature=null,this._set("selectedFeatureIndex",e)}get selectedFeatureViewModel(){return this.featureViewModels[this.selectedFeatureIndex]||null}get state(){return this.get("view.ready")?"ready":"disabled"}centerAtLocation(){const{view:e}=this,t=A(this);return t?this.callGoTo({target:{target:t,scale:e.scale}}):Promise.reject(new s("center-at-location:invalid-target-or-view","Cannot center at a location without a target and view.",{target:t,view:e}))}zoomTo(e){return this.callGoTo(e)}clear(){this.set({promises:[],features:[],content:null,title:null,location:null,activeFeature:null})}fetchFeatures(e,t){const{view:i}=this;if(!i||!e)throw new s("fetch-features:invalid-screenpoint-or-view","Cannot fetch features without a screenPoint and view.",{screenPoint:e,view:i});return i.fetchPopupFeatures(e,{event:t&&t.event,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,signal:t&&t.signal})}open(e){const t={updateLocationEnabled:!1,promises:[],fetchFeatures:!1,...e,visible:!0},{fetchFeatures:i}=t;delete t.fetchFeatures,i&&this._setFetchFeaturesPromises(t.location);const s=["actionsMenuOpen","collapsed","featureMenuOpen"];for(const r of s)delete t[r];this.set(t)}triggerAction(e){const t=this.allActions.getItemAt(e);t&&!t.disabled&&this.emit("trigger-action",{action:t})}next(){return this.selectedFeatureIndex=this.selectedFeatureIndex+1,this}previous(){return this.selectedFeatureIndex=this.selectedFeatureIndex-1,this}disableClusterBrowsing(){M(this),this._clearBrowsedClusterGraphics()}async enableClusterBrowsing(){const{view:e,selectedFeature:t}=this;"2d"===e?.type?V(t)?(await j(this),await L(this)):o.getLogger(this.declaredClass).warn("enableClusterBrowsing:invalid-selectedFeature: Selected feature must represent an aggregate/cluster graphic.",t):o.getLogger(this.declaredClass).warn("enableClusterBrowsing:invalid-view: View must be 2d MapView.",t)}_animationStateChange(e){this.zoomToLocation||(b.disabled="waiting-for-target"===e)}_clearBrowsedClusterGraphics(){const e=this.view?.graphics;e&&(e.remove(this.selectedClusterBoundaryFeature),e.remove(this._selectedClusterFeature)),this._selectedClusterFeature=null,this.selectedClusterBoundaryFeature.geometry=null}_viewScaleChange(){if(V(this.selectedFeature))return this.browseClusterEnabled=!1,this.visible=!1,void this.clear();this.browseClusterEnabled&&(this.features=[this.selectedFeature])}_locationChange(e){const{selectedFeature:t,updateLocationEnabled:i}=this;i&&e&&(!t||t.geometry)&&this.centerAtLocation()}_selectedFeatureIndexChange(){this.featurePage=this.featureCount>1?Math.floor(this.selectedFeatureIndex/this.featuresPerPage)+1:null}_featureViewModelsChange(){this.featurePage=this.featureCount>1?1:null}_setGraphicOnFeatureViewModels(){const{features:e,featureCount:t,featurePage:i,featuresPerPage:s,featureViewModels:r}=this;if(null===i)return;const o=((i-1)*s+t)%t,n=o+s;r.slice(o,n).forEach(((t,i)=>{t&&!t.graphic&&(t.graphic=e[o+i])}))}async _selectedFeatureChange(e){if(!e)return;const{location:t,updateLocationEnabled:i,view:s}=this;if(this.browseClusterEnabled){if(this._selectedClusterFeature&&(s.graphics.remove(this._selectedClusterFeature),this._selectedClusterFeature=null),V(e))return;return e.symbol=await w(e),this._selectedClusterFeature=e,void s.graphics.add(this._selectedClusterFeature)}!i&&t||!e.geometry?i&&!e.geometry&&this.centerAtLocation().then((()=>{this.location=s.center.clone()})):this.location=n(this._getPointFromGeometry(e.geometry))}_waitingForResultChange(){!this.featureCount&&this.promises&&(this.visible=!1)}_setFetchFeaturesPromises(e){return this._fetchFeaturesWithController(this._getScreenPoint(e||this.location)).then((e=>{const{clientOnlyGraphics:t,promisesPerLayerView:i}=e,s=Promise.resolve(t),r=i.map((e=>e.promise));this.promises=[s,...r]}))}_destroyFeatureVMs(){this.featureViewModels.forEach((e=>e&&!e.destroyed&&e.destroy())),this._set("featureViewModels",[])}_updateFeatureVMs(){const{selectedFeature:e,features:t,featureViewModels:i}=this;if(V(e)||(this.browseClusterEnabled=!1),this._destroyFeatureVMs(),!t||!t.length)return;const s=i.slice(0),r=[];t.forEach(((t,i)=>{if(!t)return;let o=null;if(s.some(((e,i)=>(e&&e.graphic===t&&(o=e,s.splice(i,1)),!!o))),o)r[i]=o;else{const s=new _({abilities:this.featureViewModelAbilities,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,spatialReference:this.view?.spatialReference,graphic:t===e?t:null,map:this.view?.map,view:this.view});r[i]=s}})),s.forEach((e=>e&&!e.destroyed&&e.destroy())),this._set("featureViewModels",r)}_getScreenPoint(e){const{view:t}=this;return t&&e&&"function"==typeof t.toScreen?t.toScreen(e):null}_autoOpenEnabledChange(){const e="auto-fetch-features",{_handles:t,autoOpenEnabled:i}=this;if(t.remove(e),i&&this.view){const i=this.view.on("click",(e=>{"mouse"===e.pointerType&&0!==e.button||this._fetchFeaturesAndOpen(e)}),F.WIDGET);t.add(i,e)}}_cancelFetchingFeatures(){const e=this._fetchFeaturesController;e&&e.abort(),this._fetchFeaturesController=null,this.notifyChange("waitingForResult")}_fetchFeaturesWithController(e,t){this._cancelFetchingFeatures();const i=new AbortController,{signal:s}=i;this._fetchFeaturesController=i,this.notifyChange("waitingForResult");const r=this.fetchFeatures(e,{signal:s,event:t});return r.catch((()=>{})).then((()=>{this._fetchFeaturesController=null,this.notifyChange("waitingForResult")})),r}_fetchFeaturesAndOpen(e){const{screenPoint:t,mapPoint:i}=e,{view:s}=this;this._fetchFeaturesWithController(t,e).then((e=>{const{clientOnlyGraphics:t,promisesPerLayerView:r,location:o}=e,n=[Promise.resolve(t),...r.map((e=>e.promise))];return s.popup.open({location:o||i,promises:n}),e}))}_updatePendingPromises(e){e&&this._pendingPromises.has(e)&&(this._pendingPromises.delete(e),this.notifyChange("pendingPromisesCount"))}_autoClose(){this.autoCloseEnabled&&(this.visible=!1)}_getPointFromGeometry(e){return a(e)?null:"point"===e.type?e:"extent"===e.type?e.center:"polygon"===e.type?e.centroid:"multipoint"===e.type||"polyline"===e.type?e.extent?.center:null}async _getLayerView(e,t){return await e.when(),e.whenLayerView(t)}_getHighlightLayer(e){const{layer:t,sourceLayer:i}=e;return"map-notes"===i?.type||"subtype-group"===i?.type?i:t}_getHighlightTarget(e,t){const i="imagery"===t.type?void 0:"objectIdField"in t&&t.objectIdField,s=e.attributes;return s&&i&&s[i]||e}async _highlightActiveFeature(){const e="highlight-active-feature";this._handles.remove(e);const{highlightEnabled:t,view:i,activeFeature:s,visible:r}=this;if(!(s&&i&&t&&r))return;const o=this._getHighlightLayer(s);if(!(o&&o instanceof g))return;const n=this._getLayerView(i,o);this._highlightActiveFeaturePromise=n;const a=await n;if(!(a&&v(a)&&this._highlightActiveFeaturePromise===n&&this.activeFeature&&this.highlightEnabled))return;const l=a.highlight(this._getHighlightTarget(s,o));this._handles.add(l,e)}async _highlightSelectedFeature(){const e="highlight-selected-feature";this._handles.remove(e);const{selectedFeature:t,highlightEnabled:i,view:s,visible:r}=this;if(!(t&&s&&i&&r))return;const o=this._getHighlightLayer(t);if(!(o&&o instanceof g))return;const n=this._getLayerView(s,o);this._highlightSelectedFeaturePromise=n;const a=await n;if(!(a&&v(a)&&this._highlightSelectedFeaturePromise===n&&this.selectedFeature&&this.highlightEnabled&&this.visible))return;const l=a.highlight(this._getHighlightTarget(t,o));this._handles.add(l,e)}_updateFeatures(e){const{features:t}=this;if(!e||!e.length)return;if(!t.length)return void(this.features=e);const i=e.filter((e=>!t.includes(e)));this.features=t.concat(i)}};e([c()],R.prototype,"featurePage",void 0),e([c()],R.prototype,"isLoadingFeature",null),e([c({type:S})],R.prototype,"actions",void 0),e([c({readOnly:!0})],R.prototype,"active",null),e([c()],R.prototype,"activeFeature",void 0),e([c({readOnly:!0})],R.prototype,"allActions",null),e([c({type:Boolean})],R.prototype,"defaultPopupTemplateEnabled",void 0),e([c()],R.prototype,"autoCloseEnabled",void 0),e([c()],R.prototype,"autoOpenEnabled",void 0),e([c()],R.prototype,"browseClusterEnabled",void 0),e([c()],R.prototype,"content",void 0),e([c({type:S,readOnly:!0})],R.prototype,"defaultActions",null),e([c({readOnly:!0})],R.prototype,"featureCount",null),e([c()],R.prototype,"features",null),e([c()],R.prototype,"featuresPerPage",void 0),e([c()],R.prototype,"featureViewModelAbilities",void 0),e([c({readOnly:!0})],R.prototype,"featureViewModels",void 0),e([c()],R.prototype,"highlightEnabled",void 0),e([c()],R.prototype,"includeDefaultActions",void 0),e([c({type:I})],R.prototype,"location",null),e([c({readOnly:!0})],R.prototype,"pendingPromisesCount",null),e([c({readOnly:!0})],R.prototype,"selectedClusterBoundaryFeature",void 0),e([c({readOnly:!0})],R.prototype,"waitingForResult",null),e([c({readOnly:!0})],R.prototype,"promiseCount",null),e([c()],R.prototype,"promises",null),e([c({value:null,readOnly:!0})],R.prototype,"selectedFeature",null),e([c({value:-1})],R.prototype,"selectedFeatureIndex",null),e([c({readOnly:!0})],R.prototype,"selectedFeatureViewModel",null),e([c({readOnly:!0})],R.prototype,"state",null),e([c()],R.prototype,"title",void 0),e([c()],R.prototype,"updateLocationEnabled",void 0),e([c()],R.prototype,"view",void 0),e([c()],R.prototype,"visible",void 0),e([c()],R.prototype,"zoomFactor",void 0),e([c()],R.prototype,"zoomToLocation",void 0),e([c()],R.prototype,"centerAtLocation",null),R=e([d("esri.widgets.Popup.PopupViewModel")],R);const z=R;export{z as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import t from"../../Graphic.js";import"../../symbols.js";import i from"../../core/Collection.js";import s from"../../core/Error.js";import r from"../../core/Handles.js";import o from"../../core/Logger.js";import{unwrap as n,isNone as a}from"../../core/maybe.js";import{watch as l,when as h,sync as u}from"../../core/reactiveUtils.js";import{property as c}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as d}from"../../core/accessorSupport/decorators/subclass.js";import{geographicToWebMercator as p}from"../../geometry/support/webMercatorUtils.js";import g from"../../layers/Layer.js";import f from"../../support/actions/ActionBase.js";import m from"../../support/actions/ActionButton.js";import y from"../../support/actions/ActionToggle.js";import{getDisplayedSymbol as w}from"../../symbols/support/symbolUtils.js";import{ViewEventPriorities as F}from"../../views/input/InputManager.js";import{highlightsSupported as v}from"../../views/support/layerViewUtils.js";import _ from"../Feature/FeatureViewModel.js";import{zoomToFeature as b,zoomToClusteredFeatures as C,browseClusteredFeatures as P}from"./actions.js";import{triggerAction as E,isClusterFeature as V,getSelectedTarget as A,removeClusteredFeaturesForBrowsing as M,displayClusterExtent as j,browseAggregateFeatures as L}from"./actionUtils.js";import O from"../support/AnchorElementViewModel.js";import{GoToMixin as T}from"../support/GoTo.js";import x from"../../symbols/SimpleFillSymbol.js";import I from"../../geometry/Point.js";const S=i.ofType({key:"type",defaultKeyValue:"button",base:f,typeMap:{button:m,toggle:y}}),B=()=>[b.clone()],G=()=>[C.clone(),P.clone()];let R=class extends(T(O)){constructor(e){super(e),this._handles=new r,this._pendingPromises=new Set,this._fetchFeaturesController=null,this._selectedClusterFeature=null,this.featurePage=null,this.actions=new S,this.activeFeature=null,this.defaultPopupTemplateEnabled=!1,this.autoCloseEnabled=!1,this.autoOpenEnabled=!0,this.browseClusterEnabled=!1,this.content=null,this.featuresPerPage=20,this.featureViewModelAbilities=null,this.featureViewModels=[],this.highlightEnabled=!0,this.includeDefaultActions=!0,this.selectedClusterBoundaryFeature=new t({symbol:new x({outline:{width:1.5,color:"cyan"},style:"none"})}),this.title=null,this.updateLocationEnabled=!1,this.view=null,this.visible=!1,this.zoomFactor=4,this.zoomToLocation=null}get isLoadingFeature(){return this.featureViewModels.some((e=>e.waitingForContent))}initialize(){this._handles.add([l((()=>[this.autoOpenEnabled,this.view]),(()=>this._autoOpenEnabledChange())),this.on("view-change",(()=>this._autoClose())),l((()=>[this.highlightEnabled,this.selectedFeature,this.visible,this.view]),(()=>this._highlightSelectedFeature())),l((()=>[this.highlightEnabled,this.activeFeature,this.visible,this.view]),(()=>this._highlightActiveFeature())),l((()=>this.view?.animation?.state),(e=>this._animationStateChange(e))),l((()=>this.location),(e=>this._locationChange(e))),l((()=>this.selectedFeature),(e=>this._selectedFeatureChange(e))),l((()=>[this.selectedFeatureIndex,this.featureCount,this.featuresPerPage]),(()=>this._selectedFeatureIndexChange())),l((()=>[this.featurePage,this.selectedFeatureIndex,this.featureCount,this.featuresPerPage,this.featureViewModels]),(()=>this._setGraphicOnFeatureViewModels())),l((()=>this.featureViewModels),(()=>this._featureViewModelsChange())),this.on("trigger-action",(e=>E({event:e,view:this.view}))),h((()=>!this.waitingForResult),(()=>this._waitingForResultChange()),u),l((()=>[this.features,this.view?.map,this.view?.spatialReference]),(()=>this._updateFeatureVMs())),l((()=>this.view?.scale),(()=>this._viewScaleChange())),h((()=>!this.visible),(()=>this.browseClusterEnabled=!1)),l((()=>this.browseClusterEnabled),(e=>e?this.enableClusterBrowsing():this.disableClusterBrowsing()))])}destroy(){this._cancelFetchingFeatures(),this._handles.destroy(),this._handles=null,this._pendingPromises.clear(),this.browseClusterEnabled=!1,this.view=null}get active(){return!(!this.visible||this.waitingForResult)}get allActions(){const e=this._get("allActions")||new S;e.removeAll();const{actions:t,defaultActions:i,defaultPopupTemplateEnabled:s,includeDefaultActions:r,selectedFeature:o}=this,n=r?i.concat(t):t,a=o&&("function"==typeof o.getEffectivePopupTemplate&&o.getEffectivePopupTemplate(s)||o.popupTemplate),l=a&&a.actions,h=a&&a.overwriteActions?l:l?l.concat(n):n;return h&&h.filter(Boolean).forEach((t=>e.add(t))),e}get defaultActions(){const e=this._get("defaultActions")||new S;return e.removeAll(),e.addMany(V(this.selectedFeature)?G():B()),e}get featureCount(){return this.features.length}get features(){return this._get("features")||[]}set features(e){const t=e||[];this._set("features",t);const{pendingPromisesCount:i,promiseCount:s,selectedFeatureIndex:r}=this,o=s&&t.length;o&&i&&-1===r?this.selectedFeatureIndex=0:o&&-1!==r||(this.selectedFeatureIndex=t.length?0:-1)}get location(){return this._get("location")||null}set location(e){const t=this.get("view.spatialReference.isWebMercator");e&&e.get("spatialReference.isWGS84")&&t&&(e=p(e)),this._set("location",e)}get pendingPromisesCount(){return this._pendingPromises.size}get waitingForResult(){return!(!(!!this._fetchFeaturesController||this.pendingPromisesCount>0)||0!==this.featureCount)}get promiseCount(){return this.promises.length}get promises(){return this._get("promises")||[]}set promises(e){if(this._pendingPromises.clear(),this.features=[],!Array.isArray(e)||!e.length)return this._set("promises",[]),void this.notifyChange("pendingPromisesCount");this._set("promises",e),(e=e.slice(0)).forEach((e=>{this._pendingPromises.add(e);const t=t=>{this._pendingPromises.has(e)&&this._updateFeatures(t),this._updatePendingPromises(e)},i=()=>this._updatePendingPromises(e);e.then(t,i)})),this.notifyChange("pendingPromisesCount")}get selectedFeature(){const{features:e,selectedFeatureIndex:t}=this;if(-1===t)return null;return e[t]||null}get selectedFeatureIndex(){const e=this._get("selectedFeatureIndex");return"number"==typeof e?e:-1}set selectedFeatureIndex(e){const{featureCount:t}=this;e=isNaN(e)||e<-1||!t?-1:(e+t)%t,this.activeFeature=null,this._set("selectedFeatureIndex",e)}get selectedFeatureViewModel(){return this.featureViewModels[this.selectedFeatureIndex]||null}get state(){return this.get("view.ready")?"ready":"disabled"}centerAtLocation(){const{view:e}=this,t=A(this);return t?this.callGoTo({target:{target:t,scale:e.scale}}):Promise.reject(new s("center-at-location:invalid-target-or-view","Cannot center at a location without a target and view.",{target:t,view:e}))}zoomTo(e){return this.callGoTo(e)}clear(){this.set({promises:[],features:[],content:null,title:null,location:null,activeFeature:null})}fetchFeatures(e,t){const{view:i}=this;if(!i||!e)throw new s("fetch-features:invalid-screenpoint-or-view","Cannot fetch features without a screenPoint and view.",{screenPoint:e,view:i});return i.fetchPopupFeatures(e,{event:t&&t.event,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,signal:t&&t.signal})}open(e){const t={updateLocationEnabled:!1,promises:[],fetchFeatures:!1,...e,visible:!0},{fetchFeatures:i}=t;delete t.fetchFeatures,i&&this._setFetchFeaturesPromises(t.location);const s=["actionsMenuOpen","collapsed","featureMenuOpen"];for(const r of s)delete t[r];this.set(t)}triggerAction(e){const t=this.allActions.getItemAt(e);t&&!t.disabled&&this.emit("trigger-action",{action:t})}next(){return this.selectedFeatureIndex=this.selectedFeatureIndex+1,this}previous(){return this.selectedFeatureIndex=this.selectedFeatureIndex-1,this}disableClusterBrowsing(){M(this),this._clearBrowsedClusterGraphics()}async enableClusterBrowsing(){const{view:e,selectedFeature:t}=this;"2d"===e?.type?V(t)?(await j(this),await L(this)):o.getLogger(this.declaredClass).warn("enableClusterBrowsing:invalid-selectedFeature: Selected feature must represent an aggregate/cluster graphic.",t):o.getLogger(this.declaredClass).warn("enableClusterBrowsing:invalid-view: View must be 2d MapView.",t)}_animationStateChange(e){this.zoomToLocation||(b.disabled="waiting-for-target"===e)}_clearBrowsedClusterGraphics(){const e=this.view?.graphics;e&&(e.remove(this.selectedClusterBoundaryFeature),e.remove(this._selectedClusterFeature)),this._selectedClusterFeature=null,this.selectedClusterBoundaryFeature.geometry=null}_viewScaleChange(){if(V(this.selectedFeature))return this.browseClusterEnabled=!1,this.visible=!1,void this.clear();this.browseClusterEnabled&&(this.features=[this.selectedFeature])}_locationChange(e){const{selectedFeature:t,updateLocationEnabled:i}=this;i&&e&&(!t||t.geometry)&&this.centerAtLocation()}_selectedFeatureIndexChange(){this.featurePage=this.featureCount>1?Math.floor(this.selectedFeatureIndex/this.featuresPerPage)+1:null}_featureViewModelsChange(){this.featurePage=this.featureCount>1?1:null}_setGraphicOnFeatureViewModels(){const{features:e,featureCount:t,featurePage:i,featuresPerPage:s,featureViewModels:r}=this;if(null===i)return;const o=((i-1)*s+t)%t,n=o+s;r.slice(o,n).forEach(((t,i)=>{t&&!t.graphic&&(t.graphic=e[o+i])}))}async _selectedFeatureChange(e){if(!e)return;const{location:t,updateLocationEnabled:i,view:s}=this;if(this.browseClusterEnabled){if(this._selectedClusterFeature&&(s.graphics.remove(this._selectedClusterFeature),this._selectedClusterFeature=null),V(e))return;return e.symbol=await w(e),this._selectedClusterFeature=e,void s.graphics.add(this._selectedClusterFeature)}!i&&t||!e.geometry?i&&!e.geometry&&this.centerAtLocation().then((()=>{this.location=s.center.clone()})):this.location=n(this._getPointFromGeometry(e.geometry))}_waitingForResultChange(){!this.featureCount&&this.promises&&(this.visible=!1)}_setFetchFeaturesPromises(e){return this._fetchFeaturesWithController(this._getScreenPoint(e||this.location)).then((e=>{const{clientOnlyGraphics:t,promisesPerLayerView:i}=e,s=Promise.resolve(t),r=i.map((e=>e.promise));this.promises=[s,...r]}))}_destroyFeatureVMs(){this.featureViewModels.forEach((e=>e&&!e.destroyed&&e.destroy())),this._set("featureViewModels",[])}_updateFeatureVMs(){const{selectedFeature:e,features:t,featureViewModels:i}=this;if(V(e)||(this.browseClusterEnabled=!1),this._destroyFeatureVMs(),!t||!t.length)return;const s=i.slice(0),r=[];t.forEach(((t,i)=>{if(!t)return;let o=null;if(s.some(((e,i)=>(e&&e.graphic===t&&(o=e,s.splice(i,1)),!!o))),o)r[i]=o;else{const s=new _({abilities:this.featureViewModelAbilities,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,spatialReference:this.view?.spatialReference,graphic:t===e?t:null,map:this.view?.map,view:this.view});r[i]=s}})),s.forEach((e=>e&&!e.destroyed&&e.destroy())),this._set("featureViewModels",r)}_getScreenPoint(e){const{view:t}=this;return t&&e&&"function"==typeof t.toScreen?t.toScreen(e):null}_autoOpenEnabledChange(){const e="auto-fetch-features",{_handles:t,autoOpenEnabled:i}=this;if(t.remove(e),i&&this.view){const i=this.view.on("click",(e=>{"mouse"===e.pointerType&&0!==e.button||this._fetchFeaturesAndOpen(e)}),F.WIDGET);t.add(i,e)}}_cancelFetchingFeatures(){const e=this._fetchFeaturesController;e&&e.abort(),this._fetchFeaturesController=null,this.notifyChange("waitingForResult")}_fetchFeaturesWithController(e,t){this._cancelFetchingFeatures();const i=new AbortController,{signal:s}=i;this._fetchFeaturesController=i,this.notifyChange("waitingForResult");const r=this.fetchFeatures(e,{signal:s,event:t});return r.catch((()=>{})).then((()=>{this._fetchFeaturesController=null,this.notifyChange("waitingForResult")})),r}_fetchFeaturesAndOpen(e){const{screenPoint:t,mapPoint:i}=e,{view:s}=this;this._fetchFeaturesWithController(t,e).then((e=>{const{clientOnlyGraphics:t,promisesPerLayerView:r,location:o}=e,n=[Promise.resolve(t),...r.map((e=>e.promise))];return s.popup.open({location:o||i,promises:n}),e}))}_updatePendingPromises(e){e&&this._pendingPromises.has(e)&&(this._pendingPromises.delete(e),this.notifyChange("pendingPromisesCount"))}_autoClose(){this.autoCloseEnabled&&(this.visible=!1)}_getPointFromGeometry(e){return a(e)?null:"point"===e.type?e:"extent"===e.type?e.center:"polygon"===e.type?e.centroid:"multipoint"===e.type||"polyline"===e.type?e.extent?.center:null}async _getLayerView(e,t){return await e.when(),e.whenLayerView(t)}_getHighlightLayer(e){const{layer:t,sourceLayer:i}=e;return i&&"layer"in i&&i.layer?i.layer:"map-notes"===i?.type||"subtype-group"===i?.type?i:t}_getHighlightTarget(e,t){const i="imagery"===t.type?void 0:"objectIdField"in t&&t.objectIdField,s=e.attributes;return s&&i&&s[i]||e}async _highlightActiveFeature(){const e="highlight-active-feature";this._handles.remove(e);const{highlightEnabled:t,view:i,activeFeature:s,visible:r}=this;if(!(s&&i&&t&&r))return;const o=this._getHighlightLayer(s);if(!(o&&o instanceof g))return;const n=this._getLayerView(i,o);this._highlightActiveFeaturePromise=n;const a=await n;if(!(a&&v(a)&&this._highlightActiveFeaturePromise===n&&this.activeFeature&&this.highlightEnabled))return;const l=a.highlight(this._getHighlightTarget(s,o));this._handles.add(l,e)}async _highlightSelectedFeature(){const e="highlight-selected-feature";this._handles.remove(e);const{selectedFeature:t,highlightEnabled:i,view:s,visible:r}=this;if(!(t&&s&&i&&r))return;const o=this._getHighlightLayer(t);if(!(o&&o instanceof g))return;const n=this._getLayerView(s,o);this._highlightSelectedFeaturePromise=n;const a=await n;if(!(a&&v(a)&&this._highlightSelectedFeaturePromise===n&&this.selectedFeature&&this.highlightEnabled&&this.visible))return;const l=a.highlight(this._getHighlightTarget(t,o));this._handles.add(l,e)}_updateFeatures(e){const{features:t}=this;if(!e||!e.length)return;if(!t.length)return void(this.features=e);const i=e.filter((e=>!t.includes(e)));this.features=t.concat(i)}};e([c()],R.prototype,"featurePage",void 0),e([c()],R.prototype,"isLoadingFeature",null),e([c({type:S})],R.prototype,"actions",void 0),e([c({readOnly:!0})],R.prototype,"active",null),e([c()],R.prototype,"activeFeature",void 0),e([c({readOnly:!0})],R.prototype,"allActions",null),e([c({type:Boolean})],R.prototype,"defaultPopupTemplateEnabled",void 0),e([c()],R.prototype,"autoCloseEnabled",void 0),e([c()],R.prototype,"autoOpenEnabled",void 0),e([c()],R.prototype,"browseClusterEnabled",void 0),e([c()],R.prototype,"content",void 0),e([c({type:S,readOnly:!0})],R.prototype,"defaultActions",null),e([c({readOnly:!0})],R.prototype,"featureCount",null),e([c()],R.prototype,"features",null),e([c()],R.prototype,"featuresPerPage",void 0),e([c()],R.prototype,"featureViewModelAbilities",void 0),e([c({readOnly:!0})],R.prototype,"featureViewModels",void 0),e([c()],R.prototype,"highlightEnabled",void 0),e([c()],R.prototype,"includeDefaultActions",void 0),e([c({type:I})],R.prototype,"location",null),e([c({readOnly:!0})],R.prototype,"pendingPromisesCount",null),e([c({readOnly:!0})],R.prototype,"selectedClusterBoundaryFeature",void 0),e([c({readOnly:!0})],R.prototype,"waitingForResult",null),e([c({readOnly:!0})],R.prototype,"promiseCount",null),e([c()],R.prototype,"promises",null),e([c({value:null,readOnly:!0})],R.prototype,"selectedFeature",null),e([c({value:-1})],R.prototype,"selectedFeatureIndex",null),e([c({readOnly:!0})],R.prototype,"selectedFeatureViewModel",null),e([c({readOnly:!0})],R.prototype,"state",null),e([c()],R.prototype,"title",void 0),e([c()],R.prototype,"updateLocationEnabled",void 0),e([c()],R.prototype,"view",void 0),e([c()],R.prototype,"visible",void 0),e([c()],R.prototype,"zoomFactor",void 0),e([c()],R.prototype,"zoomToLocation",void 0),e([c()],R.prototype,"centerAtLocation",null),R=e([d("esri.widgets.Popup.PopupViewModel")],R);const z=R;export{z as default};