@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 t from"../../../Graphic.js";import r from"../../../core/Logger.js";import{isNone as i,isSome as s,applySome as o,destroyMaybe as l}from"../../../core/maybe.js";import{initial as n}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as u}from"../../../core/accessorSupport/decorators/subclass.js";import{WhereClause as d}from"../../../core/sql/WhereClause.js";import h from"../../../layers/support/FeatureFilter.js";import{getFloorFilterClause as p}from"../../../layers/support/floorFilterUtils.js";import c from"../../../rest/support/Query.js";import{I3SMeshView3D as y}from"./I3SMeshView3D.js";import{ForAllFeaturesReturnType as f,ForAllFeaturesVisibilityMode as g}from"./II3SMeshView3D.js";import{LayerView3D as m}from"./LayerView3D.js";import{createInteractiveEditSession as _,processAttributeEdits as F}from"./i3s/attributeEditing.js";import{createGetFeatureExtent as j}from"./i3s/I3SGeometryUtil.js";import{I3SMeshViewFilter as I}from"./i3s/I3SMeshViewFilter.js";import{NodeFilterImpact as S}from"./i3s/I3SNode.js";import{I3SQueryEngine as b}from"./i3s/I3SQueryEngine.js";import{I3SQueryFeatureAdapter as w}from"./i3s/I3SQueryFeatureAdapter.js";import{I3SQueryFeatureStore as E}from"./i3s/I3SQueryFeatureStore.js";import{getIndexCrs as v,objectIdFilter as x}from"./i3s/I3SUtil.js";import{DefinitionExpressionSceneLayerView as C}from"./support/DefinitionExpressionSceneLayerView.js";import{defineFieldProperties as Q}from"./support/fieldProperties.js";import{PopupSceneLayerView as A}from"./support/PopupSceneLayerView.js";import{SceneLayerViewRequiredFields as q}from"./support/SceneLayerViewRequiredFields.js";import{updatingProgress as L}from"../support/updatingProperties.js";import D from"../../layers/SceneLayerView.js";import{TaskPriority as R}from"../../support/Scheduler.js";const U=Q();let V=class extends(y(C(A(m(D))))){constructor(){super(...arguments),this.type="scene-layer-3d",this.progressiveLoadFactor=1,this._elevationContext="scene",this._isIntegratedMesh=!1,this._supportsLabeling=!0,this._interactiveEditingSessions=new Map,this._queryEngine=null}get i3slayer(){return this.layer}get filter(){return this._get("filter")}set filter(e){this._set("filter",I.checkSupport(e)?e:null)}get viewFilter(){const e=this.filter;if(i(e)&&i(this.layerFilter))return null;const t=this._get("viewFilter");return i(t)?new I({layerFilter:this.layerFilter,viewFilter:e,layerFieldsIndex:this.layer.fieldsIndex,loadAsyncModule:e=>this._loadAsyncModule(e),applyFilters:()=>this._applyFilters(!0),addSqlFilter:(e,t)=>this.addSqlFilter(e,t,this.logError)}):(t.viewFilter=this.filter,t.layerFilter=this.layerFilter,this.notifyChange("viewFilter"),t)}get requiredFields(){return this._fieldsHelper?.requiredFields??[]}get _floorFilterClause(){const e=p(this);return s(e)?d.create(e,this.layer.fieldsIndex):null}get _excludeObjectIdsSorted(){const e=this.layer.excludeObjectIds;return e.length?e.toArray().sort(((e,t)=>e-t)):null}get _objectQualitySettings(){return this.view?.qualitySettings?.sceneService?.object}get lodFactor(){return this._objectQualitySettings?.lodFactor??1}get lodCrossfadeinDuration(){return this._objectQualitySettings.lodCrossfadeinDuration??0}get lodCrossfadeoutDuration(){return this._objectQualitySettings.lodCrossfadeoutDuration??0}get lodCrossfadeUncoveredDuration(){return this._objectQualitySettings.lodCrossfadeUncoveredDuration??0}get updatingProgressValue(){return this._controller?.updatingProgress??0}initialize(){this._fieldsHelper=new q({layerView:this}),this.updatingHandles.add((()=>this.layer.rangeInfos),(e=>this._rangeInfosChanged(e)),n),this.updatingHandles.add((()=>this.layer.renderer),(e=>this.updatingHandles.addPromise(this._rendererChange(e))),n),this.updatingHandles.add((()=>[this.parsedDefinitionExpression,this.filter,this.layer.filter,this._floorFilterClause,this._excludeObjectIdsSorted,o(this.viewFilter,(e=>[e.parsedWhereClause,e.parsedGeometry,e.sortedObjectIds]))]),(()=>this._filterChange())),this.updatingHandles.add((()=>[this.filter,o(this.viewFilter,(e=>e.parsedGeometry))]),(()=>this._geometryFilterChange())),this.handles.add(this.layer.on("apply-edits",(e=>this.updatingHandles.addPromise(e.result)))),this.handles.add(this.layer.on("edits",(e=>this._handleEdits(e))))}destroy(){this._fieldsHelper=l(this._fieldsHelper)}_rangeInfosChanged(e){null!=e&&e.length>0&&r.getLogger(this.declaredClass).warn("Unsupported property: rangeInfos are currently only serialized to and from web scenes but do not affect rendering.")}createQuery(){const e={outFields:["*"],returnGeometry:!1,outSpatialReference:this.view.spatialReference};return s(this.filter)?this.filter.createQuery(e):new c(e)}queryExtent(e,t){return this._ensureQueryEngine().executeQueryForExtent(this._ensureQuery(e),t?.signal)}queryFeatureCount(e,t){return this._ensureQueryEngine().executeQueryForCount(this._ensureQuery(e),t?.signal)}queryFeatures(e,t){return this._ensureQueryEngine().executeQuery(this._ensureQuery(e),t?.signal).then((e=>{if(!e?.features)return e;const t=this.layer;for(const r of e.features)r.layer=t,r.sourceLayer=t;return e}))}queryObjectIds(e,t){return this._ensureQueryEngine().executeQueryForIds(this._ensureQuery(e),t?.signal)}_ensureQueryEngine(){return this._queryEngine||(this._queryEngine=this._createQueryEngine()),this._queryEngine}_createQueryEngine(){const e=j(this.view.spatialReference,this.view.renderSpatialReference,this._collection);return new b({layerView:this,priority:R.FEATURE_QUERY_ENGINE,spatialIndex:new E({featureAdapter:new w({objectIdField:this.layer.objectIdField,attributeStorageInfo:this.layer.attributeStorageInfo,getFeatureExtent:e}),toArray:()=>{const e=new Array;return this._forAllFeatures(((t,r,i)=>(e.push({id:t,index:r,meta:i}),f.CONTINUE)),null,g.ALL_IN_CLIPPING_AREA),e},forAllFeatures:(e,t)=>this._forAllFeatures(((t,r,i)=>e({id:t,index:r,meta:i})),t,g.ALL_IN_CLIPPING_AREA),getFeatureExtent:e,sourceSpatialReference:v(this.layer),viewSpatialReference:this.view.spatialReference})})}highlight(e){const t=this._highlights;if(e instanceof c){const{set:r,handle:i}=t.acquireSet();return this.queryObjectIds(e).then((e=>t.setFeatureIds(r,e))),i}return super.highlight(e)}createInteractiveEditSession(e){return _(this._attributeEditingContext,e)}_createLayerGraphic(e){const r=new t(null,null,e);return r.layer=this.layer,r.sourceLayer=this.layer,r}canResume(){return super.canResume()&&(!this._controller||this._controller.rootNodeVisible)}getFilters(){const e=super.getFilters(),t=this._excludeObjectIdsSorted;return s(t)&&e.push((e=>x(t,!1,e))),this._floorFilterClause&&this.addSqlFilter(e,this._floorFilterClause,this.logError),this.addSqlFilter(e,this.parsedDefinitionExpression,this.logError),s(this.viewFilter)&&this.viewFilter.addFilters(e,this.view,this._controller.crsIndex,this._collection),e}isUpdating(){return super.isUpdating()||this.layerFilterUpdating}_ensureQuery(e){return this._addDefinitionExpressionToQuery(i(e)?this.createQuery():c.from(e))}get _attributeEditingContext(){return{sessions:this._interactiveEditingSessions,fieldsIndex:this.layer.fieldsIndex,objectIdField:this._getObjectIdField(),forEachNode:e=>this._forAllNodes((t=>s(t)?e(t.node,t.featureIds):null)),attributeStorageInfo:this.i3slayer.attributeStorageInfo,attributeOverrides:this.attributeOverrides,getAttributeData:e=>this.getAttributeData(e),setAttributeData:(e,t)=>this.setAttributeData(e,t),clearMemCache:()=>this.clearMemCache()}}_handleEdits(e){F(this._attributeEditingContext,e)}get hasGeometryFilter(){const e=this.viewFilter;return s(e)&&s(e.parsedGeometry)}computeNodeFiltering(e){const t=this.viewFilter;return i(t)||t.isMBSGeometryVisible(e,this.view.spatialReference,this._controller.crsIndex)?S.Unmodified:S.Culled}};e([a()],V.prototype,"i3slayer",null),e([a(L)],V.prototype,"updatingProgress",void 0),e([a({type:h})],V.prototype,"filter",null),e([a({readOnly:!0})],V.prototype,"viewFilter",null),e([a(U.requiredFields)],V.prototype,"requiredFields",null),e([a(U.availableFields)],V.prototype,"availableFields",void 0),e([a()],V.prototype,"_fieldsHelper",void 0),e([a()],V.prototype,"_floorFilterClause",null),e([a()],V.prototype,"_excludeObjectIdsSorted",null),e([a()],V.prototype,"_objectQualitySettings",null),e([a()],V.prototype,"lodFactor",null),e([a()],V.prototype,"updatingProgressValue",null),V=e([u("esri.views.3d.layers.SceneLayerView3D")],V);const N=V;export{N as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Graphic.js";import r from"../../../core/Logger.js";import{isNone as i,isSome as s,applySome as o,destroyMaybe as l}from"../../../core/maybe.js";import{initial as n}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as u}from"../../../core/accessorSupport/decorators/subclass.js";import{WhereClause as d}from"../../../core/sql/WhereClause.js";import h from"../../../layers/support/FeatureFilter.js";import{getFloorFilterClause as p}from"../../../layers/support/floorFilterUtils.js";import c from"../../../rest/support/Query.js";import{sceneLayerEditingEnabled as y}from"../../../support/featureFlags.js";import{I3SMeshView3D as f}from"./I3SMeshView3D.js";import{ForAllFeaturesReturnType as g,ForAllFeaturesVisibilityMode as m}from"./II3SMeshView3D.js";import{LayerView3D as _}from"./LayerView3D.js";import{SceneLayerFeatureView3D as F}from"./SceneLayerFeatureView3D.js";import{createInteractiveEditSession as w,processAttributeEdits as j}from"./i3s/attributeEditing.js";import{createGetFeatureExtent as I}from"./i3s/I3SGeometryUtil.js";import{I3SMeshViewFilter as S}from"./i3s/I3SMeshViewFilter.js";import{NodeFilterImpact as b}from"./i3s/I3SNode.js";import{I3SQueryEngine as E}from"./i3s/I3SQueryEngine.js";import{I3SQueryFeatureAdapter as v}from"./i3s/I3SQueryFeatureAdapter.js";import{I3SQueryFeatureStore as x}from"./i3s/I3SQueryFeatureStore.js";import{getIndexCrs as C,objectIdFilter as Q}from"./i3s/I3SUtil.js";import{DefinitionExpressionSceneLayerView as V}from"./support/DefinitionExpressionSceneLayerView.js";import{defineFieldProperties as A}from"./support/fieldProperties.js";import{PopupSceneLayerView as L}from"./support/PopupSceneLayerView.js";import{SceneLayerViewRequiredFields as q}from"./support/SceneLayerViewRequiredFields.js";import{updatingProgress as D}from"../support/updatingProperties.js";import R from"../../layers/SceneLayerView.js";import{TaskPriority as U}from"../../support/Scheduler.js";const N=A();let O=class extends(f(V(L(_(R))))){constructor(){super(...arguments),this.type="scene-layer-3d",this.progressiveLoadFactor=1,this._elevationContext="scene",this._isIntegratedMesh=!1,this._supportsLabeling=!0,this._interactiveEditingSessions=new Map,this._queryEngine=null}get i3slayer(){return this.layer}get filter(){return this._get("filter")}set filter(e){this._set("filter",S.checkSupport(e)?e:null)}get viewFilter(){const e=this.filter;if(i(e)&&i(this.layerFilter))return null;const t=this._get("viewFilter");return i(t)?new S({layerFilter:this.layerFilter,viewFilter:e,layerFieldsIndex:this.layer.fieldsIndex,loadAsyncModule:e=>this._loadAsyncModule(e),applyFilters:()=>this._applyFilters(!0),addSqlFilter:(e,t)=>this.addSqlFilter(e,t,this.logError)}):(t.viewFilter=this.filter,t.layerFilter=this.layerFilter,this.notifyChange("viewFilter"),t)}get requiredFields(){return this._fieldsHelper?.requiredFields??[]}get _floorFilterClause(){const e=p(this);return s(e)?d.create(e,this.layer.fieldsIndex):null}get _excludeObjectIdsSorted(){let e=this.layer.excludeObjectIds.toArray();return s(this.featureView)&&(e=e.concat(this.featureView.objectIds)),e.length?e.sort(((e,t)=>e-t)):null}get _objectQualitySettings(){return this.view?.qualitySettings?.sceneService?.object}get lodFactor(){return this._objectQualitySettings?.lodFactor??1}get lodCrossfadeinDuration(){return this._objectQualitySettings.lodCrossfadeinDuration??0}get lodCrossfadeoutDuration(){return this._objectQualitySettings.lodCrossfadeoutDuration??0}get lodCrossfadeUncoveredDuration(){return this._objectQualitySettings.lodCrossfadeUncoveredDuration??0}get updatingProgressValue(){return this._controller?.updatingProgress??0}initialize(){this._fieldsHelper=new q({layerView:this}),this.updatingHandles.add((()=>this.layer.rangeInfos),(e=>this._rangeInfosChanged(e)),n),this.updatingHandles.add((()=>this.layer.renderer),(e=>this.updatingHandles.addPromise(this._rendererChange(e))),n),this.updatingHandles.add((()=>[this.parsedDefinitionExpression,this.filter,this.layer.filter,this._floorFilterClause,this._excludeObjectIdsSorted,o(this.viewFilter,(e=>[e.parsedWhereClause,e.parsedGeometry,e.sortedObjectIds]))]),(()=>this._filterChange())),this.updatingHandles.add((()=>[this.filter,o(this.viewFilter,(e=>e.parsedGeometry))]),(()=>this._geometryFilterChange())),this.handles.add(this.layer.on("apply-edits",(e=>this.updatingHandles.addPromise(e.result)))),this.handles.add(this.layer.on("edits",(e=>this._handleEdits(e))));const e=this.layer.associatedLayer;y()&&s(e)&&s(e.infoFor3D)&&(this.featureView=new F({associatedLayer:e,view:this.view}))}destroy(){this._fieldsHelper=l(this._fieldsHelper),this.featureView=l(this.featureView)}_rangeInfosChanged(e){null!=e&&e.length>0&&r.getLogger(this.declaredClass).warn("Unsupported property: rangeInfos are currently only serialized to and from web scenes but do not affect rendering.")}createQuery(){const e={outFields:["*"],returnGeometry:!1,outSpatialReference:this.view.spatialReference};return s(this.filter)?this.filter.createQuery(e):new c(e)}queryExtent(e,t){return this._ensureQueryEngine().executeQueryForExtent(this._ensureQuery(e),t?.signal)}queryFeatureCount(e,t){return this._ensureQueryEngine().executeQueryForCount(this._ensureQuery(e),t?.signal)}queryFeatures(e,t){return this._ensureQueryEngine().executeQuery(this._ensureQuery(e),t?.signal).then((e=>{if(!e?.features)return e;const t=this.layer;for(const r of e.features)r.layer=t,r.sourceLayer=t;return e}))}queryObjectIds(e,t){return this._ensureQueryEngine().executeQueryForIds(this._ensureQuery(e),t?.signal)}_ensureQueryEngine(){return this._queryEngine||(this._queryEngine=this._createQueryEngine()),this._queryEngine}_createQueryEngine(){const e=I(this.view.spatialReference,this.view.renderSpatialReference,this._collection);return new E({layerView:this,priority:U.FEATURE_QUERY_ENGINE,spatialIndex:new x({featureAdapter:new v({objectIdField:this.layer.objectIdField,attributeStorageInfo:this.layer.attributeStorageInfo,getFeatureExtent:e}),toArray:()=>{const e=new Array;return this._forAllFeatures(((t,r,i)=>(e.push({id:t,index:r,meta:i}),g.CONTINUE)),null,m.ALL_IN_CLIPPING_AREA),e},forAllFeatures:(e,t)=>this._forAllFeatures(((t,r,i)=>e({id:t,index:r,meta:i})),t,m.ALL_IN_CLIPPING_AREA),getFeatureExtent:e,sourceSpatialReference:C(this.layer),viewSpatialReference:this.view.spatialReference})})}highlight(e){const t=this._highlights;if(e instanceof c){const{set:r,handle:i}=t.acquireSet();return this.queryObjectIds(e).then((e=>t.setFeatureIds(r,e))),i}return super.highlight(e)}createInteractiveEditSession(e){return w(this._attributeEditingContext,e)}_createLayerGraphic(e){const r=new t(null,null,e);return r.layer=this.layer,r.sourceLayer=this.layer,r}canResume(){return super.canResume()&&(!this._controller||this._controller.rootNodeVisible)}getFilters(){const e=super.getFilters(),t=this._excludeObjectIdsSorted;return s(t)&&e.push((e=>Q(t,!1,e))),this._floorFilterClause&&this.addSqlFilter(e,this._floorFilterClause,this.logError),this.addSqlFilter(e,this.parsedDefinitionExpression,this.logError),s(this.viewFilter)&&this.viewFilter.addFilters(e,this.view,this._controller.crsIndex,this._collection),e}isUpdating(){return super.isUpdating()||this.layerFilterUpdating||s(this.featureView)&&this.featureView.updating}_ensureQuery(e){return this._addDefinitionExpressionToQuery(i(e)?this.createQuery():c.from(e))}get _attributeEditingContext(){return{sessions:this._interactiveEditingSessions,fieldsIndex:this.layer.fieldsIndex,objectIdField:this._getObjectIdField(),forEachNode:e=>this._forAllNodes((t=>s(t)?e(t.node,t.featureIds):null)),attributeStorageInfo:this.i3slayer.attributeStorageInfo,attributeOverrides:this.attributeOverrides,getAttributeData:e=>this.getAttributeData(e),setAttributeData:(e,t)=>this.setAttributeData(e,t),clearMemCache:()=>this.clearMemCache()}}_handleEdits(e){j(this._attributeEditingContext,e)}get hasGeometryFilter(){const e=this.viewFilter;return s(e)&&s(e.parsedGeometry)}computeNodeFiltering(e){const t=this.viewFilter;return i(t)||t.isMBSGeometryVisible(e,this.view.spatialReference,this._controller.crsIndex)?b.Unmodified:b.Culled}};e([a()],O.prototype,"i3slayer",null),e([a(D)],O.prototype,"updatingProgress",void 0),e([a({type:h})],O.prototype,"filter",null),e([a({readOnly:!0})],O.prototype,"viewFilter",null),e([a(N.requiredFields)],O.prototype,"requiredFields",null),e([a(N.availableFields)],O.prototype,"availableFields",void 0),e([a()],O.prototype,"_fieldsHelper",void 0),e([a()],O.prototype,"featureView",void 0),e([a()],O.prototype,"_floorFilterClause",null),e([a()],O.prototype,"_excludeObjectIdsSorted",null),e([a()],O.prototype,"_objectQualitySettings",null),e([a()],O.prototype,"lodFactor",null),e([a()],O.prototype,"updatingProgressValue",null),O=e([u("esri.views.3d.layers.SceneLayerView3D")],O);const P=O;export{P as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
4
  */
5
- import{_ as o}from"../../../chunks/tslib.es6.js";import{zeroMeters as r}from"../../../core/quantityUtils.js";import{property as t}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import{SketchTooltipInfo as e}from"./SketchTooltipInfo.js";let p=class extends e{constructor(o){super(o),this.type="reshape-edge-offset",this.distance=r}};o([t()],p.prototype,"type",void 0),o([t()],p.prototype,"distance",void 0),p=o([s("esri.views.interactive.tooltip.ReshapeEdgeOffsetTooltipInfo")],p);export{p as ReshapeEdgeOffsetTooltipInfo};
5
+ import{_ as o}from"../../../chunks/tslib.es6.js";import{zeroMeters as t}from"../../../core/quantityUtils.js";import{property as e}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as r}from"../../../core/accessorSupport/decorators/subclass.js";import{SketchTooltipInfo as s}from"./SketchTooltipInfo.js";let p=class extends s{constructor(o){super(o),this.type="reshape-edge-offset",this.distance=t,this.area=null,this.totalLength=null}};o([e()],p.prototype,"type",void 0),o([e()],p.prototype,"distance",void 0),o([e()],p.prototype,"area",void 0),o([e()],p.prototype,"totalLength",void 0),p=o([r("esri.views.interactive.tooltip.ReshapeEdgeOffsetTooltipInfo")],p);export{p as ReshapeEdgeOffsetTooltipInfo};
@@ -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 s}from"../../../../chunks/tslib.es6.js";import"../../../../core/Logger.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/Error.js";import{subclass as t}from"../../../../core/accessorSupport/decorators/subclass.js";import{CONTENT as o}from"../css.js";import{TooltipContent as e}from"./TooltipContent.js";import{TooltipField as r}from"../support/TooltipField.js";import"../../../../widgets/support/widgetUtils.js";import{tsx as i}from"../../../../widgets/support/jsxFactory.js";const p={base:`${o} ${`${o}--reshape-edge-offset`}`};let c=class extends e{render(){const{info:s}=this,{visibleElements:t}=s.tooltipOptions,o=this._messagesTooltip.sketch;return i("div",{class:p.base},t.distance&&i(r,{title:o.distance,value:this._formatRelativeLength(s.distance)}))}};c=s([t("esri.views.interactive.tooltip.content.TooltipContentReshapeEdgeOffset")],c);export{c as TooltipContentReshapeEdgeOffset};
5
+ import{_ as t}from"../../../../chunks/tslib.es6.js";import{isSome as e}from"../../../../core/maybe.js";import"../../../../core/Logger.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/Error.js";import{subclass as s}from"../../../../core/accessorSupport/decorators/subclass.js";import{CONTENT as o}from"../css.js";import{TooltipContent as r}from"./TooltipContent.js";import{TooltipField as i}from"../support/TooltipField.js";import"../../../../widgets/support/widgetUtils.js";import{tsx as a}from"../../../../widgets/support/jsxFactory.js";const p={base:`${o} ${`${o}--reshape-edge-offset`}`};let c=class extends r{render(){const{area:t,distance:s,totalLength:o,tooltipOptions:r}=this.info,{visibleElements:c}=r,l=this._messagesTooltip.sketch;return a("div",{class:p.base},c.distance&&a(i,{title:l.distance,value:this._formatRelativeLength(s)}),c.area&&e(t)&&a(i,{title:l.area,value:this._formatArea(t)}),c.totalLength&&e(o)&&a(i,{title:l.totalLength,value:this._formatLength(o)}))}};c=t([s("esri.views.interactive.tooltip.content.TooltipContentReshapeEdgeOffset")],c);export{c as TooltipContentReshapeEdgeOffset};
@@ -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 r from"../../core/Error.js";import has from"../../core/has.js";import{isNone as t,isSome as s}from"../../core/maybe.js";import{eachAlways as a}from"../../core/promiseUtils.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/accessorSupport/ensureType.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import p from"../../geometry/Extent.js";import{getResolutionForScale as n}from"../../geometry/support/scaleUtils.js";import{combinedViewLayerTimeExtentProperty as l}from"../../layers/support/commonProperties.js";import{ExportImageParameters as m}from"../../layers/support/ExportImageParameters.js";import{getLayerFloorFilterClause as c}from"../../layers/support/floorFilterUtils.js";import{calculateTolerance as u}from"../../renderers/support/clickToleranceUtils.js";import{identify as y}from"../../rest/identify.js";import h from"../../rest/support/IdentifyParameters.js";import{loadArcade as f}from"../../support/arcadeOnDemand.js";import{getRequiredFields as d,getFetchPopupTemplate as w}from"./support/popupUtils.js";const x=x=>{let P=class extends x{initialize(){this.exportImageParameters=new m({layer:this.layer})}destroy(){this.exportImageParameters.destroy(),this.exportImageParameters=null}get exportImageVersion(){return this.exportImageParameters?.commitProperty("version"),this.commitProperty("timeExtent"),(this._get("exportImageVersion")||0)+1}async fetchPopupFeatures(e,t){const{layer:s}=this;if(!e)throw new r("mapimagelayer:fetchPopupFeatures","Nothing to fetch without area",{layer:s});const a=this.layer.capabilities?.operations?.supportsQuery??!0;if(!((this.layer.capabilities?.operations?.supportsIdentify??!0)&&this.layer.version>=10.5)&&!a)throw new r("mapimagelayer:fetchPopupFeatures-not-supported","query operation is disabled for this service",{layer:s});return a?this._fetchPopupFeaturesUsingQueries(e,t):this._fetchPopupFeaturesUsingIdentify(e,t)}canResume(){return!!super.canResume()&&!this.timeExtent?.isEmpty}async _fetchPopupFeaturesUsingIdentify(e,r){const s=await this._createIdentifyParameters(e,r);if(t(s))return[];const{results:a}=await y(this.layer.parsedUrl,s);return a.map((e=>e.feature))}async _createIdentifyParameters(e,r){const{floors:t,spatialReference:a,scale:o}=this.view,i=s(r)?r.event:null,l=await this._collectPopupProviders(this.layer.sublayers,o,r);if(!l.length)return null;await Promise.all(l.map((({sublayer:e})=>e.load().catch((()=>{})))));const m=Math.min(has("mapimagelayer-popup-identify-max-tolerance"),this.layer.allSublayers.reduce(((e,r)=>r.renderer?u({renderer:r.renderer,event:i}):e),2)),c=this.createFetchPopupFeaturesQueryGeometry(e,m),y=n(o,a),f=Math.round(c.width/y),d=new p({xmin:c.center.x-y*f,ymin:c.center.y-y*f,xmax:c.center.x+y*f,ymax:c.center.y+y*f,spatialReference:c.spatialReference}),w=!1===this.layer.capabilities?.operations?.supportsQuery||await new Promise((e=>{let r=!1;Promise.all(l.map((async({popupTemplate:t})=>{if(t){const s=await this._loadArcadeModules(t);if(r)return;const a=s?.arcadeUtils.hasGeometryOperations(t);a&&(r=!0,e(!0))}}))).finally((()=>e(!1)))}));return new h({floors:t,gdbVersion:this.layer.gdbVersion,geometry:e,height:f,layerOption:"popup",mapExtent:d,maxAllowableOffset:w?0:y,returnGeometry:!0,spatialReference:a,sublayers:this.layer.sublayers,timeExtent:this.timeExtent,tolerance:m,width:f})}async _fetchPopupFeaturesUsingQueries(e,r){const t=await this._collectPopupProviders(this.layer.sublayers,this.view.scale,r),o=s(r)?r.event:null,i=t.map((async({sublayer:r,popupTemplate:t})=>{await r.load().catch((()=>{}));const a=r.createQuery(),i=u({renderer:r.renderer,event:o}),p=this.createFetchPopupFeaturesQueryGeometry(e,i);if(a.geometry=p,a.outFields=await d(r,t),a.timeExtent=this.timeExtent,"floors"in this.view){const e=this.view?.floors?.clone(),t=c(e,r);s(t)&&(a.where=a.where?`(${a.where}) AND (${t})`:t)}const n=await this._loadArcadeModules(t);n&&n.arcadeUtils.hasGeometryOperations(t)||(a.maxAllowableOffset=p.width/i);return(await r.queryFeatures(a)).features}));return(await a(i)).reduce(((e,r)=>r.value?[...e,...r.value]:e),[]).filter((e=>null!=e))}async _collectPopupProviders(e,r,t){const a=[],o=async e=>{const i=0===e.minScale||r<=e.minScale,p=0===e.maxScale||r>=e.maxScale;if(e.visible&&i&&p)if(e.sublayers)e.sublayers.forEach(o);else if(e.popupEnabled){const r=w(e,{...t,defaultPopupTemplateEnabled:!1});s(r)&&a.unshift({sublayer:e,popupTemplate:r})}},i=e.toArray().reverse().map(o);return await Promise.all(i),a}_loadArcadeModules(e){if(e.expressionInfos?.length||Array.isArray(e.content)&&e.content.some((e=>"expression"===e.type)))return f()}};return e([o()],P.prototype,"exportImageParameters",void 0),e([o({readOnly:!0})],P.prototype,"exportImageVersion",null),e([o()],P.prototype,"layer",void 0),e([o()],P.prototype,"suspended",void 0),e([o(l)],P.prototype,"timeExtent",void 0),P=e([i("esri.views.layers.MapImageLayerView")],P),P};export{x as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import"../../symbols.js";import t from"../../core/Error.js";import has from"../../core/has.js";import{getOrCreateMapValue as r}from"../../core/MapUtils.js";import{isNone as s,isSome as i}from"../../core/maybe.js";import{debounce as o,eachAlways as a}from"../../core/promiseUtils.js";import{on as p}from"../../core/reactiveUtils.js";import{getMetersPerUnitForSR as l}from"../../core/unitUtils.js";import{property as n}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/accessorSupport/ensureType.js";import{subclass as c}from"../../core/accessorSupport/decorators/subclass.js";import u from"../../geometry/Extent.js";import{getResolutionForScale as m}from"../../geometry/support/scaleUtils.js";import{combinedViewLayerTimeExtentProperty as h}from"../../layers/support/commonProperties.js";import{ExportImageParameters as y}from"../../layers/support/ExportImageParameters.js";import{getLayerFloorFilterClause as d}from"../../layers/support/floorFilterUtils.js";import{calculateTolerance as f}from"../../renderers/support/clickToleranceUtils.js";import{identify as g}from"../../rest/identify.js";import w from"../../rest/support/IdentifyParameters.js";import{loadArcade as b}from"../../support/arcadeOnDemand.js";import{GraphicsCollection as v}from"../../support/GraphicsCollection.js";import{getRequiredFields as x,getFetchPopupTemplate as P}from"./support/popupUtils.js";import j from"../../symbols/SimpleMarkerSymbol.js";let _=null;const F=F=>{let I=class extends F{constructor(){super(...arguments),this._featuresResolutions=new WeakMap,this.highlightGraphics=new v,this.updateHighlightedFeatures=o((async e=>{this.updatingHandles.addPromise(this._updateHighlightedFeaturesGeometries(e).catch((()=>{})))}))}initialize(){this.exportImageParameters=new y({layer:this.layer}),this.handles.add([p((()=>this.highlightGraphics),"change",(e=>{this.updatingHandles.addPromise(this._updateHighlightedFeaturesSymbols(e.added).catch((()=>{}))),this.updateHighlightedFeatures(this._highlightGeometriesResolution)}))])}destroy(){this.exportImageParameters.destroy(),this.exportImageParameters=null}get exportImageVersion(){return this.exportImageParameters?.commitProperty("version"),this.commitProperty("timeExtent"),(this._get("exportImageVersion")||0)+1}async fetchPopupFeatures(e,r){const{layer:s}=this;if(!e)throw new t("mapimagelayer:fetchPopupFeatures","Nothing to fetch without area",{layer:s});const i=this.layer.capabilities?.operations?.supportsQuery??!0;if(!((this.layer.capabilities?.operations?.supportsIdentify??!0)&&this.layer.version>=10.5)&&!i)throw new t("mapimagelayer:fetchPopupFeatures-not-supported","query operation is disabled for this service",{layer:s});return i?this._fetchPopupFeaturesUsingQueries(e,r):this._fetchPopupFeaturesUsingIdentify(e,r)}canResume(){return!!super.canResume()&&!this.timeExtent?.isEmpty}async _updateHighlightedFeaturesSymbols(e){for(const t of e){const e="renderer"in t.sourceLayer&&t.sourceLayer.renderer;"geometryType"in t.sourceLayer&&"point"===t.sourceLayer.geometryType&&e&&"getSymbolAsync"in e&&e.getSymbolAsync(t).then((async r=>{let s="size"in r&&r.size;const i="visualVariables"in e&&e.visualVariables?.find((e=>"size"===e.type));i&&(_||(_=(await import("../../renderers/visualVariables/support/visualVariableUtils.js")).getSize),s=_(i,t,{view:this.view.type,scale:this.view.scale,shape:"simple-marker"===r.type?r.style:null})),t.symbol=new j({style:"square",size:s}),t.visible=!0,this.highlightGraphicUpdated(t,"symbol")}))}}async _updateHighlightedFeaturesGeometries(e){this._highlightGeometriesResolution=e;const t=this.highlightGraphics,s=this._getTargetResolution(e),i=new Map;for(const p of t)if(!this._featuresResolutions.has(p)||this._featuresResolutions.get(p)>s){const e=p.sourceLayer;if(i.has(e))i.get(e).has(p.getObjectId())||i.get(e).set(p.getObjectId(),p);else{r(i,e,(()=>new Map)).set(p.getObjectId(),p)}}const o=Array.from(i,(([e,t])=>{const r=e.createQuery();return r.objectIds=[...t.keys()],r.outFields=[e.objectIdField],r.returnGeometry=!0,r.maxAllowableOffset=s,r.outSpatialReference=this.view.spatialReference,e.queryFeatures(r)})),a=await Promise.all(o);for(const{features:r}of a)for(const e of r){const t=e.sourceLayer,r=i.get(t).get(e.getObjectId());r&&(r.geometry=e.geometry,this.highlightGraphicUpdated(r,"geometry"),this._featuresResolutions.set(r,s))}i.clear()}_getTargetResolution(e){const t=e*l(this.view.spatialReference),r=t/16;return r<=10?0:e/t*r}async _fetchPopupFeaturesUsingIdentify(e,t){const r=await this._createIdentifyParameters(e,t);if(s(r))return[];const{results:i}=await g(this.layer.parsedUrl,r);return i.map((e=>e.feature))}async _createIdentifyParameters(e,t){const{floors:r,spatialReference:s,scale:o}=this.view,a=i(t)?t.event:null,p=await this._collectPopupProviders(this.layer.sublayers,o,t);if(!p.length)return null;await Promise.all(p.map((({sublayer:e})=>e.load().catch((()=>{})))));const l=Math.min(has("mapimagelayer-popup-identify-max-tolerance"),this.layer.allSublayers.reduce(((e,t)=>t.renderer?f({renderer:t.renderer,event:a}):e),2)),n=this.createFetchPopupFeaturesQueryGeometry(e,l),c=m(o,s),h=Math.round(n.width/c),y=new u({xmin:n.center.x-c*h,ymin:n.center.y-c*h,xmax:n.center.x+c*h,ymax:n.center.y+c*h,spatialReference:n.spatialReference});return new w({floors:r,gdbVersion:this.layer.gdbVersion,geometry:e,height:h,layerOption:"popup",mapExtent:y,returnGeometry:!0,spatialReference:s,sublayers:this.layer.sublayers,timeExtent:this.timeExtent,tolerance:l,width:h})}async _fetchPopupFeaturesUsingQueries(e,t){const r=await this._collectPopupProviders(this.layer.sublayers,this.view.scale,t),s=i(t)?t.event:null,o=r.map((async({sublayer:t,popupTemplate:r})=>{await t.load().catch((()=>{}));const o=t.createQuery(),a=f({renderer:t.renderer,event:s}),p=this.createFetchPopupFeaturesQueryGeometry(e,a);if(o.geometry=p,o.outFields=await x(t,r),o.timeExtent=this.timeExtent,"floors"in this.view){const e=this.view?.floors?.clone(),r=d(e,t);i(r)&&(o.where=o.where?`(${o.where}) AND (${r})`:r)}const l=this._getTargetResolution(p.width/a),n=await this._loadArcadeModules(r),c="point"===t.geometryType||n&&n.arcadeUtils.hasGeometryOperations(r);c||(o.maxAllowableOffset=l);const{features:u}=await t.queryFeatures(o),m=c?0:l;for(const e of u)this._featuresResolutions.set(e,m);return u}));return(await a(o)).reverse().reduce(((e,t)=>t.value?[...e,...t.value]:e),[]).filter((e=>null!=e))}async _collectPopupProviders(e,t,r){const s=[],o=async e=>{const a=0===e.minScale||t<=e.minScale,p=0===e.maxScale||t>=e.maxScale;if(e.visible&&a&&p)if(e.sublayers)e.sublayers.forEach(o);else if(e.popupEnabled){const t=P(e,{...r,defaultPopupTemplateEnabled:!1});i(t)&&s.unshift({sublayer:e,popupTemplate:t})}},a=e.toArray().reverse().map(o);return await Promise.all(a),s}_loadArcadeModules(e){if(e.expressionInfos?.length||Array.isArray(e.content)&&e.content.some((e=>"expression"===e.type)))return b()}};return e([n()],I.prototype,"highlightGraphics",void 0),e([n()],I.prototype,"exportImageParameters",void 0),e([n({readOnly:!0})],I.prototype,"exportImageVersion",null),e([n()],I.prototype,"layer",void 0),e([n()],I.prototype,"suspended",void 0),e([n(h)],I.prototype,"timeExtent",void 0),I=e([c("esri.views.layers.MapImageLayerView")],I),I};export{F 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.25/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../core/Handles.js";import t from"../../core/Logger.js";import{unwrapOr as s,removeMaybe as r,isNone as i,isSome as a}from"../../core/maybe.js";import n from"../../core/PerformanceSampler.js";import u from"../../core/PooledArray.js";import{isAborted as _,createAbortError as h,when as o}from"../../core/promiseUtils.js";import{watch as d,initial as l,when as E}from"../../core/reactiveUtils.js";import{Milliseconds as T}from"../../core/time.js";import{ObservableValue as c}from"../../core/accessorSupport/tracking/ObservableValue.js";import{PromiseQueue as m}from"../../layers/support/PromiseQueue.js";import g from"./debugFlags.js";import{RenderState as I}from"./RenderState.js";function R(){return new P.Scheduler}var f;!function(e){e.RESOURCE_CONTROLLER="schedule",e.SLIDE="slide",e.STREAM_DATA_LOADER="stream loader",e.ELEVATION_QUERY="elevation query",e.TERRAIN_SURFACE="terrain",e.SURFACE_GEOMETRY_UPDATES="surface geometry updates",e.GRAPHICS_CORE="Graphics3D",e.I3S_CONTROLLER="I3S",e.POINT_CLOUD_LAYER="point cloud",e.FEATURE_TILE_FETCHER="feature fetcher",e.OVERLAY="overlay",e.STAGE="stage",e.GRAPHICS_DECONFLICTOR="graphics deconflictor",e.FILTER_VISIBILITY="Graphics3D filter visibility",e.SCALE_VISIBILITY="Graphics3D scale visibility",e.FRUSTUM_VISIBILITY="Graphics3D frustum visibility",e.POINT_OF_INTEREST_FREQUENT="POI frequent",e.POINT_OF_INTEREST_INFREQUENT="POI infrequent",e.LABELER="labeler",e.FEATURE_QUERY_ENGINE="feature query",e.FEATURE_TILE_TREE="feature tile tree",e.FEATURE_TILE_TREE_ACTIVE="fast feature tile tree",e.ELEVATION_ALIGNMENT="elevation alignment",e.TEXT_TEXTURE_ATLAS="text texture atlas",e.TEXTURE_UNLOAD="texture unload",e.LINE_OF_SIGHT_TOOL="line of sight tool",e.LINE_OF_SIGHT_TOOL_INTERACTIVE="interactive line of sight tool",e.ELEVATION_PROFILE="elevation profile",e.SNAPPING="snapping",e.SHADOW_ACCUMULATOR="shadow accumulator",e.CLOUDS_GENERATOR="cloud generator",e[e.TEST_PRIO=1]="TEST_PRIO"}(f||(f={}));const p=0,A=new Map([[f.RESOURCE_CONTROLLER,p],[f.SLIDE,p],[f.STREAM_DATA_LOADER,p],[f.ELEVATION_QUERY,p],[f.TERRAIN_SURFACE,1],[f.SURFACE_GEOMETRY_UPDATES,1],[f.GRAPHICS_CORE,2],[f.I3S_CONTROLLER,2],[f.POINT_CLOUD_LAYER,2],[f.FEATURE_TILE_FETCHER,2],[f.OVERLAY,4],[f.STAGE,4],[f.GRAPHICS_DECONFLICTOR,4],[f.FILTER_VISIBILITY,4],[f.SCALE_VISIBILITY,4],[f.FRUSTUM_VISIBILITY,4],[f.CLOUDS_GENERATOR,4],[f.POINT_OF_INTEREST_FREQUENT,6],[f.POINT_OF_INTEREST_INFREQUENT,30],[f.LABELER,8],[f.FEATURE_QUERY_ENGINE,8],[f.FEATURE_TILE_TREE,16],[f.FEATURE_TILE_TREE_ACTIVE,p],[f.ELEVATION_ALIGNMENT,12],[f.TEXT_TEXTURE_ATLAS,12],[f.TEXTURE_UNLOAD,12],[f.LINE_OF_SIGHT_TOOL,16],[f.LINE_OF_SIGHT_TOOL_INTERACTIVE,p],[f.SNAPPING,p],[f.SHADOW_ACCUMULATOR,30]]);function L(e){return A.has(e)?A.get(e):"number"==typeof e?e:1}const b=T(6.5),S=T(1),k=T(30),O=T(1e3/30),U=T(100),N=.9;var P,F;!function(_){class h{constructor(){this._updating=new c(!0),this._microTaskQueued=!1,this._frameNumber=0,this.performanceInfo={total:new n("total"),tasks:new Map},this._frameTaskTimes=new Map,this._budget=new R,this._state=I.INTERACTING,this._tasks=new u,this._runQueue=new u,this._load=0,this._idleStateCallbacks=new u,this._idleUpdatesStartFired=!1,this._forceTask=!1,this._debug=!1,this._debugHandle=d((()=>g.SCHEDULER_LOG_SLOW_TASKS),(e=>this._debug=e),l);for(const s of Object.keys(f))this.performanceInfo.tasks.set(f[s],new n(f[s]));let e;const t=this;this._test={get state(){return s(e,t._state)},set state(t){e=t},FRAME_SAFETY_BUDGET:b,INTERACTING_BUDGET:O,IDLE_BUDGET:U,get availableBudget(){return t._budget.budget},usedBudget:0,getBudget:()=>t._budget,setBudget:e=>t._budget=e,updateTask:e=>this._updateTask(e),getState:e=>this._getState(e),getRuntime:e=>this._getRuntime(e),frameTaskTimes:this._frameTaskTimes,resetRuntimes:()=>this._resetRuntimes(),getRunning:()=>this._getRunning()}}get updating(){return this._updating.get()}set updating(e){this._updating.set(e)}destroy(){this._tasks.toArray().forEach((e=>e.remove())),this._tasks.clear(),r(this._debugHandle),this._microTaskQueued=!1,this._updating.set(!1)}activate(){this._budget.done||this._microTaskQueued||(this._microTaskQueued=!0,queueMicrotask((()=>{this._microTaskQueued&&(this._microTaskQueued=!1,!this._budget.done&&this._schedule()&&this.frame())})))}registerTask(e,t){const s=L(e),r=new o(this,e,t,s);return this._tasks.push(r),this.performanceInfo.tasks.has(e)||this.performanceInfo.tasks.set(e,new n(e)),r}registerIdleStateCallbacks(e,t){const s={idleBegin:e,idleEnd:t};this._idleStateCallbacks.push(s),this.state===I.IDLE&&this._idleUpdatesStartFired&&s.idleBegin();const r=this;return{remove:()=>this._removeIdleStateCallbacks(s),set idleBegin(e){r._idleUpdatesStartFired&&(s.idleEnd(),r._state===I.IDLE&&e()),s.idleBegin=e},set idleEnd(e){s.idleEnd=e}}}get load(){return this._load}set state(e){this._state!==e&&(this._state=e,this.state!==I.IDLE&&this._idleUpdatesStartFired&&(this._idleUpdatesStartFired=!1,this._idleStateCallbacks.forAll((e=>e.idleEnd()))))}get state(){return i(this._test.state)?this._state:this._test.state}updateBudget(e){this._test.usedBudget=0,++this._frameNumber;let t=b,s=e.frameDuration,r=S;switch(this.state){case I.IDLE:t=T(0),s=T(Math.max(U,e.frameDuration)),r=k;break;case I.INTERACTING:s=T(Math.max(O,e.frameDuration));case I.ANIMATING:}return s=T(s-e.elapsedFrameTime-t),this.state!==I.IDLE&&s<S&&!this._forceTask?(this._forceTask=!0,!1):(s=T(Math.max(s,r)),this._budget.reset(s,this.state),this._updateLoad(),this._schedule())}frame(){switch(this._forceTask=!1,this._microTaskQueued=!1,this.state){case I.IDLE:this._idleUpdatesStartFired||(this._idleUpdatesStartFired=!0,this._idleStateCallbacks.forAll((e=>e.idleBegin()))),this._runIdle();break;case I.INTERACTING:this._runInteracting();break;default:this._runAnimating()}this._test.usedBudget=this._budget.elapsed}stopFrame(){this._budget.reset(T(0),this._state),this._budget.madeProgress()}_removeIdleStateCallbacks(e){this._idleUpdatesStartFired&&e.idleEnd(),this._idleStateCallbacks.removeUnordered(e)}removeTask(e){this._tasks.removeUnordered(e),this._runQueue.removeUnordered(e)}_updateTask(e){this._tasks.forAll((t=>{t.name===e&&t.setPriority(e)}))}_getState(e){if(this._runQueue.some((t=>t.name===e)))return F.SCHEDULED;let t=F.IDLE;return this._tasks.forAll((s=>{s.name===e&&s.needsUpdate&&(s.schedulePriority<=1?t=F.READY:t!==F.READY&&(t=F.WAITING))})),t}_getRuntime(e){let t=0;return this._tasks.forAll((s=>{s.name===e&&(t+=s.runtime)})),t}_resetRuntimes(){this._tasks.forAll((e=>e.runtime=0))}_getRunning(){const e=new Map;if(this._tasks.forAll((t=>{t.needsUpdate&&e.set(t.name,(e.get(t.name)||0)+1)})),0===e.size)return null;let t="";return e.forEach(((e,s)=>{t+=e>1?` ${e}x ${s}`:` ${s}`})),t}_runIdle(){this._run()}_runInteracting(){this._run()}_runAnimating(){this._run()}_updateLoad(){const e=this._tasks.reduce(((e,t)=>t.needsUpdate?++e:e),0);this._load=this._load*N+e*(1-N)}_schedule(){for(this._runQueue.filterInPlace((e=>!!e.needsUpdate||(e.schedulePriority=e.basePriority,!1))),this._tasks.forAll((e=>{e.basePriority===p&&e.needsUpdate&&!this._runQueue.includes(e)&&this._runQueue.unshift(e)}));0===this._runQueue.length;){let e=!1,t=0;if(this._tasks.forAll((s=>{if(s.needsUpdate&&0!==s.schedulePriority&&s.basePriority!==p&&(!s.task.runOncePerFrame||s.lastFrameRun!==this._frameNumber))if(e=!0,t=Math.max(t,s.basePriority),1===s.schedulePriority)s.schedulePriority=0,this._runQueue.push(s);else--s.schedulePriority})),!e)return this._updating.set(!1),!1}return this._updating.set(!0),!0}_run(){const e=this._budget.now();this._startFrameTaskTimes();do{for(;this._runQueue.length>0;){const r=this._budget.now(),i=this._runQueue.pop();this._budget.resetProgress();try{i.task.runTask(this._budget)}catch(s){t.getLogger("esri.views.support.Scheduler").error(`Exception in task "${i.name}"`,s)}i.schedulePriority=i.basePriority,i.lastFrameRun=this._frameNumber;const a=this._budget.now()-r;if(i.runtime+=a,this._frameTaskTimes.set(i.priority,this._frameTaskTimes.get(i.priority)+a),this._debug&&a>2*this._budget.budget&&console.log("Task",i.name,"used",a,"of max",this._budget.budget,"ms"),this._budget.remaining<=0)return this._updating.set(this._tasks.some((e=>e.needsUpdate))),void this._recordFrameTaskTimes(this._budget.now()-e)}}while(this._schedule());this._updating.set(this._tasks.some((e=>e.needsUpdate))),this._recordFrameTaskTimes(this._budget.now()-e)}_startFrameTaskTimes(){for(const e of Object.keys(f))this._frameTaskTimes.set(f[e],0)}_recordFrameTaskTimes(e){this._frameTaskTimes.forEach(((e,t)=>this.performanceInfo.tasks.get(t).record(e))),this.performanceInfo.total.record(e)}get test(){return this._test}}_.Scheduler=h;class o{constructor(t,s,r,i){this._scheduler=t,this.name=s,this._basePriority=i,this.lastFrameRun=0,this.runtime=0,this._queue=new m,this._handles=new e,this.schedulePriority=this._basePriority,this._task=new c(a(r)?r:this._queue),this._handles.add(E((()=>this.task.running),(()=>t.activate())))}get task(){return this._task.get()}get updating(){return this._queue.running}remove(){this.processQueue(C),this._scheduler.removeTask(this),this.schedule=D.schedule,this.reschedule=D.reschedule,this._handles.destroy()}get basePriority(){return this._basePriority}setPriority(e){this.name=e;const t=L(e);this._basePriority!==p&&0===this.schedulePriority||(this.schedulePriority=t),this._basePriority=t}get priority(){return this.name}set priority(e){this.setPriority(e)}get needsUpdate(){return this.updating||this.task.running}schedule(e,t,s){return this._queue.push(e,t,s)}reschedule(e,t,s){return this._queue.unshift(e,t,s)}processQueue(e){this._queue.runTask(e)}}class R{constructor(){this._begin="undefined"!=typeof performance?performance.now():0,this._budget=0,this._state=I.IDLE,this._done=!1,this._enabled=!0}run(e){return!this.done&&(!0===e()&&this.madeProgress(),!0)}get done(){return this._done}get budget(){return this._budget}madeProgress(){this._done=this.elapsed>=this._budget&&this._enabled}get state(){return this._state}get enabled(){return this._enabled}set enabled(e){this._enabled=e}reset(e,t){this._begin=this.now(),this._budget=e,this._state=t,this._done=!1}get remaining(){return Math.max(this._budget-this.elapsed,0)}now(){return performance.now()}get elapsed(){return performance.now()-this._begin}resetProgress(){this._done=!1}get hasProgressed(){return this._done}}_.Budget=R}(P||(P={})),function(e){e.SCHEDULED="s",e.READY="r",e.WAITING="w",e.IDLE="i"}(F||(F={}));const C=(()=>{const e=new P.Budget;return e.enabled=!1,e})();class y{remove(){}processQueue(){}schedule(e,t,s){try{if(_(t)){const e=h();return s?Promise.resolve(s(e)):Promise.reject(e)}return o(e(C))}catch(r){return Promise.reject(r)}}reschedule(e,t,s){return this.schedule(e,t,s)}}const D=new y;export{D as ImmediateTask,f as TaskPriority,F as TaskState,L as getTaskPriority,R as newScheduler,C as noBudget,A as taskPriorities};
5
+ import e from"../../core/Handles.js";import t from"../../core/Logger.js";import{unwrapOr as s,removeMaybe as i,isNone as r,isSome as a}from"../../core/maybe.js";import n from"../../core/PerformanceSampler.js";import u from"../../core/PooledArray.js";import{isAborted as _,createAbortError as h,when as o}from"../../core/promiseUtils.js";import{watch as d,initial as l,when as E}from"../../core/reactiveUtils.js";import{Milliseconds as T}from"../../core/time.js";import{ObservableValue as c}from"../../core/accessorSupport/tracking/ObservableValue.js";import{PromiseQueue as m}from"../../layers/support/PromiseQueue.js";import g from"./debugFlags.js";import{RenderState as I}from"./RenderState.js";function R(){return new F.Scheduler}var p;!function(e){e.RESOURCE_CONTROLLER="schedule",e.SLIDE="slide",e.STREAM_DATA_LOADER="stream loader",e.ELEVATION_QUERY="elevation query",e.TERRAIN_SURFACE="terrain",e.SURFACE_GEOMETRY_UPDATES="surface geometry updates",e.GRAPHICS_CORE="Graphics3D",e.I3S_CONTROLLER="I3S",e.POINT_CLOUD_LAYER="point cloud",e.FEATURE_TILE_FETCHER="feature fetcher",e.OVERLAY="overlay",e.STAGE="stage",e.GRAPHICS_DECONFLICTOR="graphics deconflictor",e.FILTER_VISIBILITY="Graphics3D filter visibility",e.SCALE_VISIBILITY="Graphics3D scale visibility",e.FRUSTUM_VISIBILITY="Graphics3D frustum visibility",e.POINT_OF_INTEREST_FREQUENT="POI frequent",e.POINT_OF_INTEREST_INFREQUENT="POI infrequent",e.LABELER="labeler",e.FEATURE_QUERY_ENGINE="feature query",e.FEATURE_TILE_TREE="feature tile tree",e.FEATURE_TILE_TREE_ACTIVE="fast feature tile tree",e.ELEVATION_ALIGNMENT="elevation alignment",e.TEXT_TEXTURE_ATLAS="text texture atlas",e.TEXTURE_UNLOAD="texture unload",e.LINE_OF_SIGHT_TOOL="line of sight tool",e.LINE_OF_SIGHT_TOOL_INTERACTIVE="interactive line of sight tool",e.ELEVATION_PROFILE="elevation profile",e.SNAPPING="snapping",e.SHADOW_ACCUMULATOR="shadow accumulator",e.CLOUDS_GENERATOR="cloud generator",e[e.TEST_PRIO=1]="TEST_PRIO"}(p||(p={}));const f=0,A=new Map([[p.RESOURCE_CONTROLLER,f],[p.SLIDE,f],[p.STREAM_DATA_LOADER,f],[p.ELEVATION_QUERY,f],[p.TERRAIN_SURFACE,1],[p.SURFACE_GEOMETRY_UPDATES,1],[p.GRAPHICS_CORE,2],[p.I3S_CONTROLLER,2],[p.POINT_CLOUD_LAYER,2],[p.FEATURE_TILE_FETCHER,2],[p.OVERLAY,4],[p.STAGE,4],[p.GRAPHICS_DECONFLICTOR,4],[p.FILTER_VISIBILITY,4],[p.SCALE_VISIBILITY,4],[p.FRUSTUM_VISIBILITY,4],[p.CLOUDS_GENERATOR,4],[p.POINT_OF_INTEREST_FREQUENT,6],[p.POINT_OF_INTEREST_INFREQUENT,30],[p.LABELER,8],[p.FEATURE_QUERY_ENGINE,8],[p.FEATURE_TILE_TREE,16],[p.FEATURE_TILE_TREE_ACTIVE,f],[p.ELEVATION_ALIGNMENT,12],[p.TEXT_TEXTURE_ATLAS,12],[p.TEXTURE_UNLOAD,12],[p.LINE_OF_SIGHT_TOOL,16],[p.LINE_OF_SIGHT_TOOL_INTERACTIVE,f],[p.SNAPPING,f],[p.SHADOW_ACCUMULATOR,30]]),b=32;function L(e){return A.has(e)?A.get(e):"number"==typeof e?e:1}const S=T(6.5),k=T(1),O=T(30),U=T(1e3/30),N=T(100),P=.9;var F,C;!function(_){class h{constructor(){this._updating=new c(!0),this._microTaskQueued=!1,this._frameNumber=0,this.performanceInfo={total:new n("total"),tasks:new Map},this._frameTaskTimes=new Map,this._budget=new R,this._state=I.INTERACTING,this._tasks=new u,this._runQueue=new u,this._load=0,this._idleStateCallbacks=new u,this._idleUpdatesStartFired=!1,this._maxReschedule=b,this._forceTask=!1,this._debug=!1,this._debugHandle=d((()=>g.SCHEDULER_LOG_SLOW_TASKS),(e=>this._debug=e),l);for(const s of Object.keys(p))this.performanceInfo.tasks.set(p[s],new n(p[s]));let e;const t=this;this._test={get state(){return s(e,t._state)},set state(t){e=t},FRAME_SAFETY_BUDGET:S,INTERACTING_BUDGET:U,IDLE_BUDGET:N,get availableBudget(){return t._budget.budget},usedBudget:0,getBudget:()=>t._budget,setBudget:e=>t._budget=e,updateTask:e=>this._updateTask(e),getState:e=>this._getState(e),getRuntime:e=>this._getRuntime(e),frameTaskTimes:this._frameTaskTimes,resetRuntimes:()=>this._resetRuntimes(),getRunning:()=>this._getRunning()}}get updating(){return this._updating.get()}set updating(e){this._updating.set(e)}destroy(){this._tasks.toArray().forEach((e=>e.remove())),this._tasks.clear(),i(this._debugHandle),this._microTaskQueued=!1,this._updating.set(!1)}activate(){this._budget.done||this._microTaskQueued||(this._microTaskQueued=!0,queueMicrotask((()=>{this._microTaskQueued&&(this._microTaskQueued=!1,this._budget.done||(this._maxReschedule=b,this._schedule(),this.frame()))})))}registerTask(e,t){const s=L(e),i=new o(this,e,t,s);return this._tasks.push(i),this.performanceInfo.tasks.has(e)||this.performanceInfo.tasks.set(e,new n(e)),i}registerIdleStateCallbacks(e,t){const s={idleBegin:e,idleEnd:t};this._idleStateCallbacks.push(s),this.state===I.IDLE&&this._idleUpdatesStartFired&&s.idleBegin();const i=this;return{remove:()=>this._removeIdleStateCallbacks(s),set idleBegin(e){i._idleUpdatesStartFired&&(s.idleEnd(),i._state===I.IDLE&&e()),s.idleBegin=e},set idleEnd(e){s.idleEnd=e}}}get load(){return this._load}set state(e){this._state!==e&&(this._state=e,this.state!==I.IDLE&&this._idleUpdatesStartFired&&(this._idleUpdatesStartFired=!1,this._idleStateCallbacks.forAll((e=>e.idleEnd()))))}get state(){return r(this._test.state)?this._state:this._test.state}updateBudget(e){this._test.usedBudget=0,++this._frameNumber;let t=S,s=e.frameDuration,i=k;switch(this.state){case I.IDLE:t=T(0),s=T(Math.max(N,e.frameDuration)),i=O;break;case I.INTERACTING:s=T(Math.max(U,e.frameDuration));case I.ANIMATING:}return s=T(s-e.elapsedFrameTime-t),this.state!==I.IDLE&&s<k&&!this._forceTask?(this._forceTask=!0,!1):(s=T(Math.max(s,i)),this._budget.reset(s,this.state),this._maxReschedule=b,this._updateLoad(),this._schedule())}frame(){switch(this._forceTask=!1,this._microTaskQueued=!1,this.state){case I.IDLE:this._idleUpdatesStartFired||(this._idleUpdatesStartFired=!0,this._idleStateCallbacks.forAll((e=>e.idleBegin()))),this._runIdle();break;case I.INTERACTING:this._runInteracting();break;default:this._runAnimating()}this._test.usedBudget=this._budget.elapsed}stopFrame(){this._budget.reset(T(0),this._state),this._budget.madeProgress()}_removeIdleStateCallbacks(e){this._idleUpdatesStartFired&&e.idleEnd(),this._idleStateCallbacks.removeUnordered(e)}removeTask(e){this._tasks.removeUnordered(e),this._runQueue.removeUnordered(e)}_updateTask(e){this._tasks.forAll((t=>{t.name===e&&t.setPriority(e)}))}_getState(e){if(this._runQueue.some((t=>t.name===e)))return C.SCHEDULED;let t=C.IDLE;return this._tasks.forAll((s=>{s.name===e&&s.needsUpdate&&(s.schedulePriority<=1?t=C.READY:t!==C.READY&&(t=C.WAITING))})),t}_getRuntime(e){let t=0;return this._tasks.forAll((s=>{s.name===e&&(t+=s.runtime)})),t}_resetRuntimes(){this._tasks.forAll((e=>e.runtime=0))}_getRunning(){const e=new Map;if(this._tasks.forAll((t=>{t.needsUpdate&&e.set(t.name,(e.get(t.name)||0)+1)})),0===e.size)return null;let t="";return e.forEach(((e,s)=>{t+=e>1?` ${e}x ${s}`:` ${s}`})),t}_runIdle(){this._run()}_runInteracting(){this._run()}_runAnimating(){this._run()}_updateLoad(){const e=this._tasks.reduce(((e,t)=>t.needsUpdate?++e:e),0);this._load=this._load*P+e*(1-P)}_schedule(){if(this._maxReschedule<=0)return!1;for(this._runQueue.filterInPlace((e=>!!e.needsUpdate||(e.schedulePriority=e.basePriority,!1))),this._tasks.forAll((e=>{e.basePriority===f&&e.needsUpdate&&!this._runQueue.includes(e)&&this._runQueue.unshift(e)}));0===this._runQueue.length;){let e=!1,t=0;if(this._tasks.forAll((s=>{if(s.needsUpdate&&0!==s.schedulePriority&&s.basePriority!==f&&(!s.task.runOncePerFrame||s.lastFrameRun!==this._frameNumber))if(e=!0,t=Math.max(t,s.basePriority),1===s.schedulePriority)s.schedulePriority=0,this._runQueue.push(s);else--s.schedulePriority})),!e)return this._updating.set(!1),!1;--this._maxReschedule}return this._updating.set(!0),!0}_run(){const e=this._budget.now();this._startFrameTaskTimes();do{for(;this._runQueue.length>0;){const i=this._budget.now(),r=this._runQueue.pop();this._budget.resetProgress();try{r.task.runTask(this._budget)}catch(s){t.getLogger("esri.views.support.Scheduler").error(`Exception in task "${r.name}"`,s)}r.schedulePriority=r.basePriority,r.lastFrameRun=this._frameNumber;const a=this._budget.now()-i;if(r.runtime+=a,this._frameTaskTimes.set(r.priority,this._frameTaskTimes.get(r.priority)+a),this._debug&&this._budget.elapsed>2*this._budget.budget&&console.log("Task",r.name,"used",this._budget.elapsed,"of max",this._budget.budget,"ms"),this._budget.remaining<=0)return this._updating.set(this._tasks.some((e=>e.needsUpdate))),void this._recordFrameTaskTimes(this._budget.now()-e)}}while(this._schedule());this._updating.set(this._tasks.some((e=>e.needsUpdate))),this._recordFrameTaskTimes(this._budget.now()-e)}_startFrameTaskTimes(){for(const e of Object.keys(p))this._frameTaskTimes.set(p[e],0)}_recordFrameTaskTimes(e){this._frameTaskTimes.forEach(((e,t)=>this.performanceInfo.tasks.get(t).record(e))),this.performanceInfo.total.record(e)}get test(){return this._test}}_.Scheduler=h;class o{constructor(t,s,i,r){this._scheduler=t,this.name=s,this._basePriority=r,this.lastFrameRun=0,this.runtime=0,this._queue=new m,this._handles=new e,this.schedulePriority=this._basePriority,this._task=new c(a(i)?i:this._queue),this._handles.add(E((()=>this.task.running),(()=>t.activate())))}get task(){return this._task.get()}get updating(){return this._queue.running}remove(){this.processQueue(y),this._scheduler.removeTask(this),this.schedule=w.schedule,this.reschedule=w.reschedule,this._handles.destroy()}get basePriority(){return this._basePriority}setPriority(e){this.name=e;const t=L(e);this._basePriority!==f&&0===this.schedulePriority||(this.schedulePriority=t),this._basePriority=t}get priority(){return this.name}set priority(e){this.setPriority(e)}get needsUpdate(){return this.updating||this.task.running}schedule(e,t,s){return this._queue.push(e,t,s)}reschedule(e,t,s){return this._queue.unshift(e,t,s)}processQueue(e){this._queue.runTask(e)}}class R{constructor(){this._begin="undefined"!=typeof performance?performance.now():0,this._budget=0,this._state=I.IDLE,this._done=!1,this._enabled=!0}run(e){return!this.done&&(!0===e()&&this.madeProgress(),!0)}get done(){return this._done}get budget(){return this._budget}madeProgress(){this._done=this.elapsed>=this._budget&&this._enabled}get state(){return this._state}get enabled(){return this._enabled}set enabled(e){this._enabled=e}reset(e,t){this._begin=this.now(),this._budget=e,this._state=t,this._done=!1}get remaining(){return Math.max(this._budget-this.elapsed,0)}now(){return performance.now()}get elapsed(){return performance.now()-this._begin}resetProgress(){this._done=!1}get hasProgressed(){return this._done}}_.Budget=R}(F||(F={})),function(e){e.SCHEDULED="s",e.READY="r",e.WAITING="w",e.IDLE="i"}(C||(C={}));const y=(()=>{const e=new F.Budget;return e.enabled=!1,e})();class D{remove(){}processQueue(){}schedule(e,t,s){try{if(_(t)){const e=h();return s?Promise.resolve(s(e)):Promise.reject(e)}return o(e(y))}catch(i){return Promise.reject(i)}}reschedule(e,t,s){return this.schedule(e,t,s)}}const w=new D;export{w as ImmediateTask,p as TaskPriority,C as TaskState,L as getTaskPriority,R as newScheduler,y as noBudget,A as taskPriorities};
@@ -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 t from"../../../Graphic.js";import r from"../../../core/Accessor.js";import{ClonableMixin as o}from"../../../core/Clonable.js";import l from"../../../core/Collection.js";import{HandleOwnerMixin as s}from"../../../core/HandleOwner.js";import{IdentifiableMixin as a}from"../../../core/Identifiable.js";import{ignoreAbortErrors as i}from"../../../core/promiseUtils.js";import{watch as n,initial as u}from"../../../core/reactiveUtils.js";import{throttle as d}from"../../../core/throttle.js";import{property as y}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import p from"../../../rest/support/RelationshipQuery.js";import{getFixedFieldName as c,findRelatedLayer as C}from"../support/featureUtils.js";const _=100;let g=class extends(o(a(s(r)))){constructor(e){super(e),this._queryAbortController=null,this._queryPageAbortController=null,this._queryFeatureCountAbortController=null,this.featuresPerPage=10,this.description=null,this.graphic=null,this.layer=null,this.map=null,this.orderByFields=null,this.featureCount=0,this.relationshipId=null,this.showAllEnabled=!1,this.title=null,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()),this._queryAbortController===e&&(this._queryAbortController=null)},this._queryFeatureCountController=async()=>{this._cancelQueryFeatureCount();const e=new AbortController;this._queryFeatureCountAbortController=e,await i(this._queryFeatureCount()),this._queryFeatureCountAbortController===e&&(this._queryFeatureCountAbortController=null)},this._queryPageController=async()=>{const e=new AbortController;this._queryPageAbortController=e,await i(this._queryPage()),this._queryPageAbortController===e&&(this._queryPageAbortController=null)},this._queryThrottled=d(this._queryController,_,this),this._queryFeatureCountThrottled=d(this._queryFeatureCountController,_,this),this._queryPageThrottled=d(this._queryPageController,_,this),this._query=async()=>{const{_queryAbortController:e,relatedFeatures:t}=this;this._destroyRelatedFeatureViewModels(),this.featurePage=1,t.removeAll(),t.addMany(this._sliceFeatures(await this._queryRelatedFeatures({signal:e?.signal})))},this.handles.add([n((()=>[this.displayCount,this.graphic,this.layer,this.map,this.orderByFieldsFixedCasing,this.relationshipId,this.featuresPerPage,this.showAllEnabled]),(()=>this._queryThrottled()),u),n((()=>[this.featurePage,this.showAllEnabled]),(()=>this._queryPageThrottled())),n((()=>[this.layer,this.relationshipId,this.objectId]),(()=>this._queryFeatureCountThrottled()))])}destroy(){this._destroyRelatedFeatureViewModels(),this.relatedFeatures.removeAll(),this._cancelQuery(),this._cancelQueryFeatureCount(),this._cancelQueryPage()}set featurePage(e){const{featuresPerPage:t,featureCount:r}=this,o=1,l=Math.ceil(r/t)||1;this._set("featurePage",Math.min(Math.max(e,o),l))}get featurePage(){return this._get("featurePage")}get orderByFieldsFixedCasing(){const{orderByFields:e,relatedLayer:t}=this;return e&&t?.loaded?e.map((e=>{const r=e.clone(),o=c(e.field,t);return r.field=o,r})):e}get itemDescriptionFieldName(){return this.orderByFieldsFixedCasing?.[0]?.field||null}set displayCount(e){const t=0,r=10;this._set("displayCount",Math.min(Math.max(e,t),r))}get displayCount(){return this._get("displayCount")}get objectId(){return this.graphic?.attributes?.[this.objectIdField]??null}get objectIdField(){return this.layer?.objectIdField||null}get relatedFeatures(){return this._get("relatedFeatures")||new l}get relatedLayer(){const{layer:e,map:t,relationship:r}=this;return e?.loaded?C(t,e,r):null}get relationship(){return this.layer?.relationships?.find((({id:e})=>e===this.relationshipId))??null}get relatedFeatureViewModels(){return this._get("relatedFeatureViewModels")||new l}get state(){const{_queryAbortController:e,_queryFeatureCountAbortController:t,_queryPageAbortController:r,graphic:o,layer:l,relationshipId:s,map:a}=this;return t?"loading":e||r?"querying":o&&l&&"number"==typeof s&&a?"ready":"disabled"}_destroyRelatedFeatureViewModels(){this.relatedFeatureViewModels?.forEach((e=>!e.destroyed&&e.destroy())),this.relatedFeatureViewModels.removeAll()}async _queryFeatureCount(){const{layer:e,relationshipId:t,objectId:r,_queryFeatureCountAbortController:o}=this;if(await(e?.load()),"number"!=typeof r||!e?.capabilities?.queryRelated?.supportsCount)return void this._set("featureCount",0);const l=e.capabilities?.queryRelated?.supportsCacheHint??!1,s=new p({cacheHint:l,relationshipId:t,returnGeometry:!1,objectIds:[r]}),a=await e.queryRelatedFeaturesCount(s,{signal:o?.signal});this._set("featureCount",a[r]||0)}_sliceFeatures(e){const{showAllEnabled:t,displayCount:r}=this;return t?e:r?e.slice(0,r):[]}async _queryPage(){const{relatedFeatures:e,featurePage:t,showAllEnabled:r,_queryPageAbortController:o}=this;!r||t<2||e.addMany(await this._queryRelatedFeatures({signal:o?.signal}))}async _queryRelatedFeatures(e){const{orderByFieldsFixedCasing:t,showAllEnabled:r,featuresPerPage:o,displayCount:l,layer:s,relationshipId:a,featurePage:i,featureCount:n,relatedLayer:u,objectIdField:d}=this;await(s?.load());const{relationship:y,objectId:h}=this;if(!y||"number"!=typeof h||!s?.capabilities?.queryRelated?.supportsPagination)return[];const c=r?((i-1)*o+n)%n:0,C=r?o:l;if(!u)return[];await u.load();const _=[...t?.map((e=>e.field)),d],g=t?.map((e=>`${e.field} ${e.order}`)),b=s.capabilities?.queryRelated?.supportsCacheHint||!1,F=new p({orderByFields:g,start:c,num:C,outFields:_,cacheHint:b,relationshipId:a,returnGeometry:!1,objectIds:[h]}),m=(await s.queryRelatedFeatures(F,{signal:e?.signal}))[h]?.features||[];return m.forEach((e=>e.sourceLayer=u)),m}};e([y()],g.prototype,"_queryAbortController",void 0),e([y()],g.prototype,"_queryPageAbortController",void 0),e([y()],g.prototype,"_queryFeatureCountAbortController",void 0),e([y({value:1})],g.prototype,"featurePage",null),e([y()],g.prototype,"featuresPerPage",void 0),e([y({readOnly:!0})],g.prototype,"orderByFieldsFixedCasing",null),e([y()],g.prototype,"description",void 0),e([y({readOnly:!0})],g.prototype,"itemDescriptionFieldName",null),e([y({value:3})],g.prototype,"displayCount",null),e([y({type:t})],g.prototype,"graphic",void 0),e([y()],g.prototype,"layer",void 0),e([y()],g.prototype,"map",void 0),e([y({readOnly:!0})],g.prototype,"objectId",null),e([y({readOnly:!0})],g.prototype,"objectIdField",null),e([y()],g.prototype,"orderByFields",void 0),e([y({readOnly:!0})],g.prototype,"relatedFeatures",null),e([y({readOnly:!0})],g.prototype,"relatedLayer",null),e([y({readOnly:!0})],g.prototype,"relationship",null),e([y({readOnly:!0})],g.prototype,"featureCount",void 0),e([y({readOnly:!0})],g.prototype,"relatedFeatureViewModels",null),e([y()],g.prototype,"relationshipId",void 0),e([y()],g.prototype,"showAllEnabled",void 0),e([y({readOnly:!0})],g.prototype,"state",null),e([y()],g.prototype,"title",void 0),g=e([h("esri.widgets.Feature.FeatureRelationship.FeatureRelationshipViewModel")],g);const b=g;export{b as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Graphic.js";import r from"../../../core/Accessor.js";import{ClonableMixin as o}from"../../../core/Clonable.js";import l from"../../../core/Collection.js";import{HandleOwnerMixin as s}from"../../../core/HandleOwner.js";import{IdentifiableMixin as a}from"../../../core/Identifiable.js";import{ignoreAbortErrors as i}from"../../../core/promiseUtils.js";import{watch as n,initial as u}from"../../../core/reactiveUtils.js";import{throttle as d}from"../../../core/throttle.js";import{property as y}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import p from"../../../rest/support/RelationshipQuery.js";import{getFixedFieldName as c,findRelatedLayer as C}from"../support/featureUtils.js";const _=100;let g=class extends(o(a(s(r)))){constructor(e){super(e),this._queryAbortController=null,this._queryPageAbortController=null,this._queryFeatureCountAbortController=null,this.featuresPerPage=10,this.description=null,this.graphic=null,this.layer=null,this.map=null,this.orderByFields=null,this.featureCount=0,this.relationshipId=null,this.showAllEnabled=!1,this.title=null,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()),this._queryAbortController===e&&(this._queryAbortController=null)},this._queryFeatureCountController=async()=>{this._cancelQueryFeatureCount();const e=new AbortController;this._queryFeatureCountAbortController=e,await i(this._queryFeatureCount()),this._queryFeatureCountAbortController===e&&(this._queryFeatureCountAbortController=null)},this._queryPageController=async()=>{const e=new AbortController;this._queryPageAbortController=e,await i(this._queryPage()),this._queryPageAbortController===e&&(this._queryPageAbortController=null)},this._queryThrottled=d(this._queryController,_,this),this._queryFeatureCountThrottled=d(this._queryFeatureCountController,_,this),this._queryPageThrottled=d(this._queryPageController,_,this),this._query=async()=>{const{_queryAbortController:e,relatedFeatures:t}=this;this._destroyRelatedFeatureViewModels(),this.featurePage=1,t.removeAll(),t.addMany(this._sliceFeatures(await this._queryRelatedFeatures({signal:e?.signal})))},this.handles.add([n((()=>[this.displayCount,this.graphic,this.layer,this.map,this.orderByFieldsFixedCasing,this.relationshipId,this.featuresPerPage,this.showAllEnabled]),(()=>this._queryThrottled()),u),n((()=>[this.featurePage,this.showAllEnabled]),(()=>this._queryPageThrottled())),n((()=>[this.layer,this.relationshipId,this.objectId]),(()=>this._queryFeatureCountThrottled()))])}destroy(){this._destroyRelatedFeatureViewModels(),this.relatedFeatures.removeAll(),this._cancelQuery(),this._cancelQueryFeatureCount(),this._cancelQueryPage()}set featurePage(e){const{featuresPerPage:t,featureCount:r}=this,o=1,l=Math.ceil(r/t)||1;this._set("featurePage",Math.min(Math.max(e,o),l))}get featurePage(){return this._get("featurePage")}get orderByFieldsFixedCasing(){const{orderByFields:e,relatedLayer:t}=this;return e&&t?.loaded?e.map((e=>{const r=e.clone(),o=c(e.field,t);return r.field=o,r})):e}get itemDescriptionFieldName(){return this.orderByFieldsFixedCasing?.[0]?.field||null}set displayCount(e){const t=0,r=10;this._set("displayCount",Math.min(Math.max(e,t),r))}get displayCount(){return this._get("displayCount")}get objectId(){return this.graphic?.attributes?.[this.objectIdField]??null}get objectIdField(){return this.layer?.objectIdField||null}get relatedFeatures(){return this._get("relatedFeatures")||new l}get relatedLayer(){const{layer:e,map:t,relationship:r}=this;return e?.loaded?C(t,e,r):null}get relationship(){const{relationshipId:e,layer:t}=this;return"number"==typeof e?t?.relationships?.find((({id:t})=>t===e))??null:null}get relatedFeatureViewModels(){return this._get("relatedFeatureViewModels")||new l}get state(){const{_queryAbortController:e,_queryFeatureCountAbortController:t,_queryPageAbortController:r,graphic:o,relatedLayer:l}=this;return t?"loading":e||r?"querying":o&&l?"ready":"disabled"}_destroyRelatedFeatureViewModels(){this.relatedFeatureViewModels?.forEach((e=>!e.destroyed&&e.destroy())),this.relatedFeatureViewModels.removeAll()}async _queryFeatureCount(){const{layer:e,relationshipId:t,objectId:r,_queryFeatureCountAbortController:o}=this;if(await(e?.load()),"number"!=typeof r||!e?.capabilities?.queryRelated?.supportsCount)return void this._set("featureCount",0);const l=e.capabilities?.queryRelated?.supportsCacheHint??!1,s=new p({cacheHint:l,relationshipId:t,returnGeometry:!1,objectIds:[r]}),a=await e.queryRelatedFeaturesCount(s,{signal:o?.signal});this._set("featureCount",a[r]||0)}_sliceFeatures(e){const{showAllEnabled:t,displayCount:r}=this;return t?e:r?e.slice(0,r):[]}async _queryPage(){const{relatedFeatures:e,featurePage:t,showAllEnabled:r,_queryPageAbortController:o}=this;!r||t<2||e.addMany(await this._queryRelatedFeatures({signal:o?.signal}))}async _queryRelatedFeatures(e){const{orderByFieldsFixedCasing:t,showAllEnabled:r,featuresPerPage:o,displayCount:l,layer:s,relationshipId:a,featurePage:i,featureCount:n,relatedLayer:u,objectIdField:d}=this;await(s?.load());const{relationship:y,objectId:h}=this;if(!y||"number"!=typeof h||!s?.capabilities?.queryRelated?.supportsPagination)return[];const c=r?((i-1)*o+n)%n:0,C=r?o:l;if(!u)return[];await u.load();const _=[...t?.map((e=>e.field)),d],g=t?.map((e=>`${e.field} ${e.order}`)),b=s.capabilities?.queryRelated?.supportsCacheHint||!1,F=new p({orderByFields:g,start:c,num:C,outFields:_,cacheHint:b,relationshipId:a,returnGeometry:!1,objectIds:[h]}),m=(await s.queryRelatedFeatures(F,{signal:e?.signal}))[h]?.features||[];return m.forEach((e=>e.sourceLayer=u)),m}};e([y()],g.prototype,"_queryAbortController",void 0),e([y()],g.prototype,"_queryPageAbortController",void 0),e([y()],g.prototype,"_queryFeatureCountAbortController",void 0),e([y({value:1})],g.prototype,"featurePage",null),e([y()],g.prototype,"featuresPerPage",void 0),e([y({readOnly:!0})],g.prototype,"orderByFieldsFixedCasing",null),e([y()],g.prototype,"description",void 0),e([y({readOnly:!0})],g.prototype,"itemDescriptionFieldName",null),e([y({value:3})],g.prototype,"displayCount",null),e([y({type:t})],g.prototype,"graphic",void 0),e([y()],g.prototype,"layer",void 0),e([y()],g.prototype,"map",void 0),e([y({readOnly:!0})],g.prototype,"objectId",null),e([y({readOnly:!0})],g.prototype,"objectIdField",null),e([y()],g.prototype,"orderByFields",void 0),e([y({readOnly:!0})],g.prototype,"relatedFeatures",null),e([y({readOnly:!0})],g.prototype,"relatedLayer",null),e([y({readOnly:!0})],g.prototype,"relationship",null),e([y({readOnly:!0})],g.prototype,"featureCount",void 0),e([y({readOnly:!0})],g.prototype,"relatedFeatureViewModels",null),e([y()],g.prototype,"relationshipId",void 0),e([y()],g.prototype,"showAllEnabled",void 0),e([y({readOnly:!0})],g.prototype,"state",null),e([y()],g.prototype,"title",void 0),g=e([h("esri.widgets.Feature.FeatureRelationship.FeatureRelationshipViewModel")],g);const b=g;export{b 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.25/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{after as r}from"../../core/promiseUtils.js";import{watch as s,initial as i,on as o}from"../../core/reactiveUtils.js";import{property as n}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{cast as a}from"../../core/accessorSupport/decorators/cast.js";import{subclass as l}from"../../core/accessorSupport/decorators/subclass.js";import d from"../Widget.js";import c from"./FeatureRelationship/FeatureRelationshipViewModel.js";import u from"./support/FeatureElementInfo.js";import{isRTL as h}from"../support/widgetUtils.js";import{messageBundle as p}from"../support/decorators/messageBundle.js";import{tsx as m}from"../support/jsxFactory.js";import{substitute as v}from"../../intl/substitute.js";const g={base:"esri-feature-relationship",esriWidget:"esri-widget",noRelatedFeatures:"esri-feature__no-related-features-message",listContainer:"esri-feature-relationship__list",listContainerQuerying:"esri-feature-relationship__list--querying",featureObserver:"esri-feature__feature-observer",stickySpinnerContainer:"esri-feature__sticky-loading-container",loadingSpinnerContainer:"esri-feature__loading-container",spinner:"esri-feature__loading-spinner",iconLoading:"esri-icon-loading-indicator esri-rotating"},f={title:!0,description:!0};let b=class extends d{constructor(e,t){super(e,t),this._featureElementInfo=null,this._relatedFeatureIntersectionObserver=new IntersectionObserver((([e])=>{e?.isIntersecting&&this._increaseFeaturePage()}),{root:window.document}),this.headingLevel=2,this.viewModel=new c,this.messages=null,this.messagesCommon=null,this.visibleElements={...f},this._increaseFeaturePage=()=>{const{state:e,showAllEnabled:t,relatedFeatures:r,featuresPerPage:s,featurePage:i}=this.viewModel;"ready"===e&&t&&r.length>=s*i&&this.viewModel.featurePage++}}initialize(){this._featureElementInfo=new u,this.addHandles([s((()=>[this.viewModel.description,this.viewModel.title,this.headingLevel]),(()=>this._setupFeatureElementInfo()),i),s((()=>[this.viewModel.state,this.viewModel.showAllEnabled,this._relatedFeatureIntersectionObserverNode]),(()=>this._handleRelatedFeatureObserverChange())),o((()=>this.viewModel.relatedFeatureViewModels),"change",(()=>this._setupRelatedFeatureViewModels()))])}loadDependencies(){return Promise.all([import("@esri/calcite-components/dist/components/calcite-list.js"),import("@esri/calcite-components/dist/components/calcite-list-item.js"),import("@esri/calcite-components/dist/components/calcite-icon.js")])}destroy(){this._unobserveRelatedFeatureObserver(),this._featureElementInfo=t(this._featureElementInfo)}get description(){return this.viewModel.description}set description(e){this.viewModel.description=e}get featureCountDescription(){const{messages:e}=this,{featureCount:t}=this.viewModel;return v(1===t?e?.numberRecord:e?.numberRecords,{number:t})}get title(){return this.viewModel.title}set title(e){this.viewModel.title=e}castVisibleElements(e){return{...f,...e}}renderStickyLoading(){return"querying"===this.viewModel.state?m("div",{key:"sticky-loader",class:g.stickySpinnerContainer},this.renderLoadingIcon()):null}renderLoadingIcon(){return m("span",{class:this.classes(g.iconLoading,g.spinner)})}renderLoading(){return m("div",{key:"loading-container",class:g.loadingSpinnerContainer},this.renderLoadingIcon())}renderShowAllIconNode(){return m("calcite-icon",{scale:"s",icon:"list",slot:"content-end"})}renderChevronIconNode(){const e=h(this.container)?"chevron-left":"chevron-right";return m("calcite-icon",{scale:"s",icon:e,slot:"content-end"})}renderRelatedFeature(e){const{itemDescriptionFieldName:t}=this.viewModel,r=e.title;e.description=t&&e.formattedAttributes?.global[t];const s="loading"===e.state;return m("calcite-list-item",{key:e.uid,label:s?`${this.messagesCommon?.loading}…`:r,description:s?"…":e.description,onclick:()=>this.emit("select-record",{featureViewModel:e})},this.renderChevronIconNode())}renderRelatedFeatures(){const{messages:e,featureCountDescription:t,viewModel:r}=this,{featureCount:s,showAllEnabled:i,relatedFeatureViewModels:o,state:n,displayCount:a}=r,l=s>a||0===a,d=l||o.length,c=!i&&l?m("calcite-list-item",{key:"show-all-item",label:e.showAll,description:t,onclick:()=>this.emit("show-all-records")},this.renderShowAllIconNode()):null,u=d?m("calcite-list",null,o.toArray().map((e=>this.renderRelatedFeature(e))),c):"ready"===n?m("div",{key:"no-related-features-message",class:g.noRelatedFeatures},e?.noRelatedFeatures):null,h=m("div",{key:"feature-observer",class:g.featureObserver,bind:this,afterCreate:this._relatedFeatureIntersectionObserverCreated});return m("div",{key:"list-container",class:this.classes(g.listContainer,{[g.listContainerQuerying]:"querying"===n})},u,this.renderStickyLoading(),h)}render(){const{state:e}=this.viewModel;return m("div",{class:this.classes(g.base,g.esriWidget)},this._featureElementInfo?.render(),"loading"===e?this.renderLoading():"disabled"===e?null:this.renderRelatedFeatures())}_setupRelatedFeatureViewModels(){const{relatedFeatureViewModels:e}=this.viewModel,t="related-feature-viewmodels";this.removeHandles(t),e?.forEach((e=>{this.addHandles(s((()=>[e.title,e.state]),(()=>this.scheduleRender()),i),t)})),this.scheduleRender()}_setupFeatureElementInfo(){const{headingLevel:e,visibleElements:t}=this,r=t.description&&this.description,s=t.title&&this.title;this._featureElementInfo.set({description:r,title:s,headingLevel:e})}async _handleRelatedFeatureObserverChange(){this._unobserveRelatedFeatureObserver();const{state:e,showAllEnabled:t}=this.viewModel;await r(0),this._relatedFeatureIntersectionObserverNode&&"ready"===e&&t&&this._relatedFeatureIntersectionObserver.observe(this._relatedFeatureIntersectionObserverNode)}_relatedFeatureIntersectionObserverCreated(e){this._relatedFeatureIntersectionObserverNode=e}_unobserveRelatedFeatureObserver(){this._relatedFeatureIntersectionObserverNode&&this._relatedFeatureIntersectionObserver.unobserve(this._relatedFeatureIntersectionObserverNode)}};e([n()],b.prototype,"_relatedFeatureIntersectionObserverNode",void 0),e([n()],b.prototype,"description",null),e([n({readOnly:!0})],b.prototype,"featureCountDescription",null),e([n()],b.prototype,"headingLevel",void 0),e([n()],b.prototype,"title",null),e([n({type:c})],b.prototype,"viewModel",void 0),e([n(),p("esri/widgets/Feature/t9n/Feature")],b.prototype,"messages",void 0),e([n(),p("esri/t9n/common")],b.prototype,"messagesCommon",void 0),e([n()],b.prototype,"visibleElements",void 0),e([a("visibleElements")],b.prototype,"castVisibleElements",null),b=e([l("esri.widgets.Feature.FeatureRelationship")],b);const w=b;export{w as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import"../../intl.js";import{destroyMaybe as t}from"../../core/maybe.js";import{after as r}from"../../core/promiseUtils.js";import{watch as s,initial as i,on as o}from"../../core/reactiveUtils.js";import{property as n}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{cast as a}from"../../core/accessorSupport/decorators/cast.js";import{subclass as l}from"../../core/accessorSupport/decorators/subclass.js";import d from"../Widget.js";import c from"./FeatureRelationship/FeatureRelationshipViewModel.js";import u from"./support/FeatureElementInfo.js";import{isRTL as h}from"../support/widgetUtils.js";import{messageBundle as p}from"../support/decorators/messageBundle.js";import{tsx as m}from"../support/jsxFactory.js";import{substitute as v}from"../../intl/substitute.js";const g={base:"esri-feature-relationship",esriWidget:"esri-widget",listContainer:"esri-feature-relationship__list",listContainerQuerying:"esri-feature-relationship__list--querying",featureObserver:"esri-feature__feature-observer",stickySpinnerContainer:"esri-feature__sticky-loading-container",loadingSpinnerContainer:"esri-feature__loading-container",spinner:"esri-feature__loading-spinner",iconLoading:"esri-icon-loading-indicator esri-rotating"},f={title:!0,description:!0};let w=class extends d{constructor(e,t){super(e,t),this._featureElementInfo=null,this._relatedFeatureIntersectionObserver=new IntersectionObserver((([e])=>{e?.isIntersecting&&this._increaseFeaturePage()}),{root:window.document}),this.headingLevel=2,this.viewModel=new c,this.messages=null,this.messagesCommon=null,this.visibleElements={...f},this._increaseFeaturePage=()=>{const{state:e,showAllEnabled:t,relatedFeatures:r,featuresPerPage:s,featurePage:i}=this.viewModel;"ready"===e&&t&&r.length>=s*i&&this.viewModel.featurePage++}}initialize(){this._featureElementInfo=new u,this.addHandles([s((()=>[this.viewModel.description,this.viewModel.title,this.headingLevel]),(()=>this._setupFeatureElementInfo()),i),s((()=>[this.viewModel.state,this.viewModel.showAllEnabled,this._relatedFeatureIntersectionObserverNode]),(()=>this._handleRelatedFeatureObserverChange())),o((()=>this.viewModel.relatedFeatureViewModels),"change",(()=>this._setupRelatedFeatureViewModels()))])}loadDependencies(){return Promise.all([import("@esri/calcite-components/dist/components/calcite-list.js"),import("@esri/calcite-components/dist/components/calcite-list-item.js"),import("@esri/calcite-components/dist/components/calcite-icon.js"),import("@esri/calcite-components/dist/components/calcite-notice.js")])}destroy(){this._unobserveRelatedFeatureObserver(),this._featureElementInfo=t(this._featureElementInfo)}get displayShowAllButton(){const{showAllEnabled:e,featureCount:t,displayCount:r}=this.viewModel;return!e&&(t>r||0===r)}get displayListItems(){return this.displayShowAllButton||this.viewModel.relatedFeatureViewModels.length>0}get description(){return this.viewModel.description}set description(e){this.viewModel.description=e}get featureCountDescription(){const{messages:e}=this,{featureCount:t}=this.viewModel;return v(1===t?e?.numberRecord:e?.numberRecords,{number:t})}get title(){return this.viewModel.title}set title(e){this.viewModel.title=e}castVisibleElements(e){return{...f,...e}}renderStickyLoading(){return"querying"===this.viewModel.state?m("div",{key:"sticky-loader",class:g.stickySpinnerContainer},this.renderLoadingIcon()):null}renderLoadingIcon(){return m("span",{class:this.classes(g.iconLoading,g.spinner)})}renderLoading(){return m("div",{key:"loading-container",class:g.loadingSpinnerContainer},this.renderLoadingIcon())}renderShowAllIconNode(){return m("calcite-icon",{scale:"s",icon:"list",slot:"content-end"})}renderChevronIconNode(){const e=h(this.container)?"chevron-left":"chevron-right";return m("calcite-icon",{scale:"s",icon:e,slot:"content-end"})}renderRelatedFeature(e){const{itemDescriptionFieldName:t}=this.viewModel,r=e.title;e.description=t&&e.formattedAttributes?.global[t];const s="loading"===e.state;return m("calcite-list-item",{key:e.uid,label:s?`${this.messagesCommon?.loading}…`:r,description:s?"…":e.description,onclick:()=>this.emit("select-record",{featureViewModel:e})},this.renderChevronIconNode())}renderShowAllListItem(){return this.displayShowAllButton?m("calcite-list-item",{key:"show-all-item",label:this.messages?.showAll,description:this.featureCountDescription,onclick:()=>this.emit("show-all-records")},this.renderShowAllIconNode()):null}renderNoRelatedFeaturesMessage(){return m("calcite-notice",{key:"no-related-features-message",icon:"information",open:!0,color:"blue",scale:"s",width:"full"},m("div",{slot:"message"},this.messages?.noRelatedFeatures))}renderFeatureObserver(){return m("div",{key:"feature-observer",class:g.featureObserver,bind:this,afterCreate:this._relatedFeatureIntersectionObserverCreated})}renderList(){const{relatedFeatureViewModels:e}=this.viewModel;return m("calcite-list",null,e.toArray().map((e=>this.renderRelatedFeature(e))),this.renderShowAllListItem())}renderRelatedFeatures(){const{displayListItems:e}=this,{state:t}=this.viewModel;return m("div",{key:"list-container",class:this.classes(g.listContainer,{[g.listContainerQuerying]:"querying"===t})},e?this.renderList():"ready"===t?this.renderNoRelatedFeaturesMessage():null,this.renderStickyLoading(),this.renderFeatureObserver())}renderRelationshipNotFound(){return m("calcite-notice",{key:"relationship-not-found",icon:"exclamation-mark-triangle",open:!0,color:"red",scale:"s",width:"full"},m("div",{slot:"message"},this.messages?.relationshipNotFound))}render(){const{state:e}=this.viewModel;return m("div",{class:this.classes(g.base,g.esriWidget)},this._featureElementInfo?.render(),"loading"===e?this.renderLoading():"disabled"===e?this.renderRelationshipNotFound():this.renderRelatedFeatures())}_setupRelatedFeatureViewModels(){const{relatedFeatureViewModels:e}=this.viewModel,t="related-feature-viewmodels";this.removeHandles(t),e?.forEach((e=>{this.addHandles(s((()=>[e.title,e.state]),(()=>this.scheduleRender()),i),t)})),this.scheduleRender()}_setupFeatureElementInfo(){const{headingLevel:e,visibleElements:t}=this,r=t.description&&this.description,s=t.title&&this.title;this._featureElementInfo.set({description:r,title:s,headingLevel:e})}async _handleRelatedFeatureObserverChange(){this._unobserveRelatedFeatureObserver();const{state:e,showAllEnabled:t}=this.viewModel;await r(0),this._relatedFeatureIntersectionObserverNode&&"ready"===e&&t&&this._relatedFeatureIntersectionObserver.observe(this._relatedFeatureIntersectionObserverNode)}_relatedFeatureIntersectionObserverCreated(e){this._relatedFeatureIntersectionObserverNode=e}_unobserveRelatedFeatureObserver(){this._relatedFeatureIntersectionObserverNode&&this._relatedFeatureIntersectionObserver.unobserve(this._relatedFeatureIntersectionObserverNode)}};e([n()],w.prototype,"_relatedFeatureIntersectionObserverNode",void 0),e([n({readOnly:!0})],w.prototype,"displayShowAllButton",null),e([n({readOnly:!0})],w.prototype,"displayListItems",null),e([n()],w.prototype,"description",null),e([n({readOnly:!0})],w.prototype,"featureCountDescription",null),e([n()],w.prototype,"headingLevel",void 0),e([n()],w.prototype,"title",null),e([n({type:c})],w.prototype,"viewModel",void 0),e([n(),p("esri/widgets/Feature/t9n/Feature")],w.prototype,"messages",void 0),e([n(),p("esri/t9n/common")],w.prototype,"messagesCommon",void 0),e([n()],w.prototype,"visibleElements",void 0),e([a("visibleElements")],w.prototype,"castVisibleElements",null),w=e([l("esri.widgets.Feature.FeatureRelationship")],w);const b=w;export{b 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.25/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import"../../intl.js";import n from"../../core/Evented.js";import{HandleOwnerMixin as i}from"../../core/HandleOwner.js";import{makeHandle as s}from"../../core/handleUtils.js";import a from"../../core/Logger.js";import{destroyMaybe as r,isNone as o,isSome as l}from"../../core/maybe.js";import{EsriPromiseMixin as u}from"../../core/Promise.js";import{watch as c,syncAndInitial as d,initial as p}from"../../core/reactiveUtils.js";import{schedule as f}from"../../core/scheduling.js";import{property as h}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as m}from"../../core/accessorSupport/decorators/subclass.js";import g from"../../form/FormTemplate.js";import y from"../../layers/support/ContingentValue.js";import _ from"../../layers/support/LayerContingentValuesCache.js";import{loadArcade as C}from"../../support/arcadeOnDemand.js";import F from"./InputField.js";import v from"./InputFieldGroup.js";import{onLocaleChange as V}from"../../intl/locale.js";import{fetchMessageBundle as b}from"../../intl/messages.js";const j=new t({attributes:{}}),E=["editable","required","value","visibility"],x="#JSAPI_CONTINGENT_VALUE_EMPTY_HASH",I="#JSAPI_CONTINGENT_VALUE_ANY_HASH",w="#JSAPI_CONTINGENT_VALUE_NULL_HASH";let A=class extends(i(u(n.EventedAccessor))){constructor(e){super(e),this._arcade=null,this._compiledExpressionLookup=new Map,this._expressionLookup=new Map,this._expressionInvalidationCallbacks=new Set,this._contingentValuesCache=null,this._featureClone=j.clone(),this._initialFeature=j.clone(),this._arcadeGeometryOperationsEnabled=!1,this._inputFieldCache=[],this.arcadeContextVars={$editcontext:{editType:"NA"}},this.contingencyConstraintViolations=new Map,this.messages=null,this.strict=!1}initialize(){const e=async()=>this.messages=await b("esri/widgets/FeatureForm/t9n/FeatureForm");e();const t=c((()=>this.layer),(e=>{"feature"===e?.type&&this.addResolvingPromise(_.createLoadedLayerContingentValuesCache(e).then((e=>{this._contingentValuesCache=e,this.notifyChange("fieldsWithContingentValues")})))}),{initial:!0}),n=c((()=>this.feature?.geometry),(e=>{this._featureClone.geometry=e;for(const t of this._expressionInvalidationCallbacks)t()}));this.handles.add([V(e),t,n])}destroy(){this.feature=null,this.layer=null,this._contingentValuesCache=r(this._contingentValuesCache)}get allInputFields(){return this.inputFields.reduce(((e,t)=>T(t)?[...e,...t.inputFields]:[...e,t]),[])}get _layerFieldsByName(){return new Map(this.layer.fields.map((e=>[e.name,e])))}get feature(){return this._get("feature")}set feature(e){this._featureClone=e?e.clone():j.clone(),this._initialFeature=this._featureClone.clone(),this.contingencyConstraintViolations.clear(),this._clearInputFieldCache(),this._set("feature",e)}get fieldsWithContingentValues(){if(o(this._contingentValuesCache))return new Set;const e=this._contingentValuesCache.fieldGroups.flatMap((e=>e.fields));return new Set(e)}get formTemplate(){return this.layer&&"formTemplate"in this.layer?this.layer.formTemplate:null}set formTemplate(e){this._override("formTemplate",e)}get inputFields(){const{_arcade:e,arcadeContextVars:t,_featureClone:n,_initialFeature:i,_inputFieldCache:s,formTemplate:a,messages:r,layer:o,state:u,spatialReference:c}=this;if("ready"!==u)return[];const d={arcade:e,arcadeContextVars:t,feature:n,initialFeature:i,layer:o,messages:r,expressionTrackingProvider:{registerExpression:this._registerExpression.bind(this)},spatialReference:c},p=l(a)&&a.elements.length>0?this._updateInputFieldsFromElements(s,a.elements,d):this._updateInputFieldsFromLayerFields(s,o?.fields,d);return this._inputFieldCache=p,p}get joinedContingentValues(){return this._joinContingentValues()}get layer(){return this.feature?.sourceLayer&&"applyEdits"in this.feature.sourceLayer?this.feature.sourceLayer:null}set layer(e){this._override("layer",e)}get spatialReference(){return this.layer?.spatialReference??null}set spatialReference(e){this._override("spatialReference",e)}get state(){return this.messages&&this.get("layer.loaded")?"ready":"disabled"}get submittable(){return!!this.valid||this.allInputFields.filter((e=>!e.valid)).every((({submittable:e})=>e))}get valid(){const e=this.allInputFields;return e.length>0&&e.every((({valid:e})=>e))}findField(e){return this.allInputFields.find((t=>t.name===e))}getValue(e){const{_featureClone:t,layer:n}=this,i=!!n?.getField(e);return t.getAttribute(e)??(i?null:void 0)}setValue(e,t){const{_featureClone:n,strict:i}=this,s=this.findField(e);t=""===t?null:t,s&&n.getAttribute(e)!==t&&(s.value=t,i&&!s.valid||this._afterValueChange(s))}getValues(){return{...this._featureClone.attributes}}submit(){const e=this.allInputFields,t=new Set(e.filter((e=>e.valid)).map((({name:e})=>e))),n=e.filter((e=>!e.valid)).map((({name:e})=>e)),i=this.getValues();if(this.validateContingencyConstraints(i,{includeIncompleteViolations:!0}).length>0)for(const[s,a]of this.contingencyConstraintViolations.entries())"error"===a.type&&(t.delete(s),n.push(s));this.emit("submit",{valid:[...t],invalid:n,values:i})}validateContingencyConstraints(e,t){const{_contingentValuesCache:n}=this,i=new Map;if(this.contingencyConstraintViolations=i,o(n))return[];const{invalid:s,incomplete:a}=n.validateContingencyConstraints(e),r=[...s,...t?.includeIncompleteViolations?a:[]];for(const o of r)for(const e of o.fieldGroup.fields)i.set(e,o);return r}_emitChangeEvent({name:e,valid:t,value:n}){this.emit("value-change",{layer:this.layer,feature:this.feature,fieldName:e,value:n,valid:t})}_updateInputFieldsFromElements(e,t,n){const i=new Map;for(const a of e)if(T(a)){M(i,a.groupElement,a);for(const e of a.inputFields)M(i,e.fieldElement,e)}else M(i,a.fieldElement,a);const s=this._updateInputFieldsRecursive(i,t.filter(this._isSupportedElement),n);for(const[a,r]of i.entries())i.delete(a),r.destroy();return s}_updateInputFieldsRecursive(e,t,n,i=null){const s=[];for(const a of t){const t=e.has(a),r=t?e.get(a):k(a)?this._makeInputFieldGroupFromGroupElement(a,n):this._makeInputFieldFromFieldElement(a,n,i);if(s.push(r),t)if(e.delete(a),T(r)){const{arcade:e,feature:t,expressionTrackingProvider:i,spatialReference:s}=n;r.set({arcade:e,feature:t,expressionTrackingProvider:i,spatialReference:s})}else r.set(n);if(k(a)){const t=a.elements.filter((e=>this._isSupportedElement(e)));r.inputFields=this._updateInputFieldsRecursive(e,t,n,r)}}return s}_updateInputFieldsFromLayerFields(e,t,n){if(!Array.isArray(t))return a.getLogger(this.declaredClass).warn(this.declaredClass,"No attribute fields found."),[];const i=new Map;for(const a of e)if(T(a)){for(const e of a.inputFields)e.destroy();a.inputFields.length=0,a.destroy()}else i.set(a.field,a);const s=[],{feature:r,initialFeature:o,layer:l,messages:u,spatialReference:c}=n;for(const a of t){const e=i.get(a)??new F({field:a,feature:r,initialFeature:o,layer:l,messages:u,spatialReference:c,value:r.getAttribute(a.name)??null});e.set({fieldElement:null,requiredFunction:null,visibilityFunction:null,valueFunction:null,editableFunction:null}),s.push(e),i.delete(a)}for(const[a,d]of i.entries())i.delete(a),d.destroy();return s}_makeInputFieldFromFieldElement(e,t,n=null){const{arcade:i,arcadeContextVars:a,expressionTrackingProvider:r,feature:o,initialFeature:u,layer:h,messages:m,spatialReference:g}=t,y=new F({fieldElement:e,field:this._layerFieldsByName.get(e.fieldName),value:o.getAttribute(e.fieldName)??null,feature:o,initialFeature:u,layer:h,group:n,arcade:i,arcadeContextVars:a,expressionTrackingProvider:r,messages:m,spatialReference:g}),_=`watch-expression-field-${y.id}`,C=c((()=>y.fieldElement),(e=>{this.handles.remove(_),l(e)&&this.handles.add(E.map((t=>c((()=>e[`${t}Expression`]),(async e=>{e&&""!==e&&(y[`${t}Function`]=await this._getOrMakeCompiledExpression(e),y.arcade=this._arcade)}),d))),_)}),d),v=s((()=>this.handles.remove(_)));return y.addHandles([C,v]),f((()=>{y.destroyed||y.addHandles([c((()=>y.value),(()=>this._afterValueChange(y)),p)])})),y}_makeInputFieldGroupFromGroupElement(e,t){const{arcade:n,arcadeContextVars:i,expressionTrackingProvider:s,feature:a,initialFeature:r,spatialReference:o}=t,u=new v({groupElement:e,inputFields:[],feature:a,initialFeature:r,arcade:n,arcadeContextVars:i,expressionTrackingProvider:s,spatialReference:o});return u.addHandles(c((()=>u.groupElement),(e=>l(e)&&e.addHandles(c((()=>e.visibilityExpression),(async e=>{e&&""!==e&&(u.visibilityFunction=await this._getOrMakeCompiledExpression(e),u.arcade=this._arcade)}),d))),d)),u}_clearInputFieldCache(){for(const e of this._inputFieldCache){if(T(e))for(const t of e.inputFields)t.destroy();e.destroy()}this._inputFieldCache=[]}_afterValueChange(e){const{name:t,value:n}=e;if(this.get("layer.typeIdField")===t&&"types"in this.layer){const e=new Set;this.layer.types.forEach((t=>Object.keys(t.domains).forEach((t=>e.add(t))))),e.forEach((e=>{const t=this.findField(e);t&&t.notifyChange("domain")}))}this._featureClone.setAttribute(t,n);for(const i of this._expressionInvalidationCallbacks)i();this._emitChangeEvent(e)}_registerExpression(e){const{_expressionInvalidationCallbacks:t}=this;return t.add(e),s((()=>t.delete(e)))}async _getOrMakeCompiledExpression(e){{if(o(e)||""===e)return null;const t=this._expressionLookup.get(e)??this._addToExpressionLookup(e);if(this._compiledExpressionLookup.has(t))return this._compiledExpressionLookup.get(t);this._arcade||(this._arcade=await C());const n=this._arcade.arcadeUtils;return!this._arcadeGeometryOperationsEnabled&&n.hasGeometryOperations(t)&&(await n.enableGeometryOperations(),this._arcadeGeometryOperationsEnabled=!0),this._addToCompiledExpressionLookup(t)}}_addToCompiledExpressionLookup(e){const{_arcade:{arcadeUtils:t},_compiledExpressionLookup:n,arcadeContextVars:i}=this,s={vars:{$feature:"any",$originalfeature:"any",...Object.fromEntries(Array.from(Object.entries(i)).map((e=>[e[0],t.convertJsonToArcade(e[1])])))},spatialReference:null},a=t.createFunction(e,s);return n.set(e,a),a}_addToExpressionLookup(e){const{_expressionLookup:t,formTemplate:n}=this,i=(l(n)&&l(n.expressionInfos)?Object.values(n.expressionInfos).find((t=>t.name===e)):null)?.expression??e;return t.set(e,i),e!==i&&t.set(i,i),i}_isSupportedElement(e){return"field"===e.type||"group"===e.type||(a.getLogger(this.declaredClass).warn("form-info::unsupported-element-type","Only element types 'field' and 'group' are supported",`Element ${e.label} has unsupported type '${e.type}'`),!1)}_joinContingentValues(){const e=this._contingentValuesCache;if(o(e))return[];const t="typeIdField"in this.layer?this.layer.typeIdField:null,n=t?this.getValue(t):null,i=[];for(const r of e.fieldGroups){const{contingencies:e,fields:t,name:s}=r,a=[];for(const i of e)i.isRetired||l(i.subtype)&&i.subtype.code!==n||a.push({values:i.values});a.length>0&&i.push({name:s,fields:t,contingencies:a})}const[s,a]=this._generateJoinPlan(i);return[...s.flatMap((e=>this._joinFieldGroupContingencies(e))),...a.flatMap((e=>e.contingencies))]}_generateJoinPlan(e){const t=new Map,n=[],i=new Set;for(const l of e)for(const e of l.fields)if(t.has(e)){const s=t.get(e),a=l,r=[s.name,a.name].sort().join("|");if(i.has(r))continue;n.push([s,a]),i.add(r),t.set(e,a)}else t.set(e,l);const s=new Set(n.flat()),a=new Set(e);for(const l of s)a.delete(l);const r=new Map,o=new Map;for(const l of new Set(n.flat())){const e=Symbol(l.name);r.set(e,new Set([l])),o.set(l,e)}for(const[l,u]of n){const e=o.get(l),t=o.get(u);if(e===t)continue;const n=r.get(e),i=r.get(t);for(const s of i)n.add(s),o.set(s,e);r.delete(t)}return[[...r.values()].map((e=>[...e])),[...a]]}_joinFieldGroupContingencies(e){const t=e.slice(),n=t.shift();let i=t.shift(),s=this._generateJoinKey(n.fields,i.fields),a=new Set([...n.fields,...i.fields]),r=new Map;for(const o of n.contingencies){const[e]=this._hashContingency(o,s.codedValueFields,!0);r.has(e)?r.get(e).push(o):r.set(e,[o])}for(;t.length>0;){const e=new Map,n=t.shift(),l=this._generateJoinKey(a,n.fields);for(const t of i.contingencies){const[n,i]=this._hashContingency(t,s.codedValueFields),a=i?this._findMatchingContingenciesWithAnyHashMask(r,n):r.get(n);if(r.has(I)&&a.push(...this._findMatchingContingenciesContainingAny(t,r.get(I),s.codedValueFields)),!o(a))for(const r of a){const n=s.rangeFields.length>0?this._joinContingenciesWithRangeDomains(r,t,s.rangeFields):this._joinContingencies(r,t);if(o(n))break;const[i]=this._hashContingency(n,l.codedValueFields,!0);e.has(i)?e.get(i).push(n):e.set(i,[n])}}r=e,i=n,s=l,a=new Set([...a,...i.fields])}const u=[];for(const c of i.contingencies){const[e,t]=this._hashContingency(c,s.codedValueFields),n=t?this._findMatchingContingenciesWithAnyHashMask(r,e):r.get(e);if(r.has(I)&&n.push(...this._findMatchingContingenciesContainingAny(c,r.get(I),s.codedValueFields)),!o(n))for(const i of n){const e=s.rangeFields.length>0?this._joinContingenciesWithRangeDomains(i,c,s.rangeFields):this._joinContingencies(i,c);l(e)&&u.push(e)}}return u}_joinContingencies(e,t){const n={values:{...e.values,...t.values}};for(const[i,s]of Object.entries(n.values))"any"===s.objectType&&l(e.values[i])&&(n.values[i]=e.values[i]);return n}_joinContingenciesWithRangeDomains(e,t,n){const i=this._joinContingencies(e,t);for(const s of n){const n=e.values[s],a=t.values[s],{leftIsNull:r,rightIsNull:o,bothAreNull:l,leftIsAny:u,rightIsAny:c,bothAreAny:d,leftIsRange:p,rightIsRange:f}=this._compareObjectTypes(n.objectType,a.objectType);if(l||d)continue;if(r&&c||o&&u){i.values[s]=new y({objectType:"null"});continue}if(r&&f||o&&p)return null;u?(n.minValue=-1/0,n.maxValue=1/0):c&&(a.minValue=-1/0,a.maxValue=1/0);const h=Math.max(n.minValue,a.minValue),m=Math.min(n.maxValue,a.maxValue);if(h>m)return null;i.values[s]=new y({objectType:"range",minValue:h,maxValue:m})}return i}_findMatchingContingenciesContainingAny(e,t,n){return t.filter((t=>n.every((n=>{const i=t.values[n],s=e.values[n];return"any"===i.objectType||"any"===s.objectType||i.codedValue?.code===s.codedValue?.code}))))}_findMatchingContingenciesWithAnyHashMask(e,t){const n=RegExp(`${t}$`),i=[];for(const[s,a]of e){if(s===I)break;n.test(s)&&i.push(...a)}return i}_generateJoinKey(e,t){const n=Array.isArray(e)?new Set(e):e,i=Array.isArray(t)?new Set(t):t,s=n.size<i.size?n:i,a=s===n?i:n,r=new Set,l=new Set;for(const u of s)if(a.has(u)){const e=this.layer.getFieldDomain(u,{feature:this.feature});if(o(e))continue;switch(e.type){case"coded-value":r.add(u);break;case"range":l.add(u)}}return{codedValueFields:[...r],rangeFields:[...l]}}_hashContingency(e,t,n=!1){if(t.length<1)return[x,!1];const i=[];let s=!1;for(const a of t){const t=e.values[a];if("any"===t.objectType){if(n)return[I,!0];s=!0,i.push(`${a}:.*`)}else"null"===t.objectType?i.push(`${a}:${w}`):i.push(`${a}:${t.codedValue?.code}`)}return[i.sort().join("&"),s]}_compareObjectTypes(e,t){return{leftIsNull:"null"===e,rightIsNull:"null"===t,bothAreNull:"null"===e&&"null"===t,leftIsAny:"any"===e,rightIsAny:"any"===t,bothAreAny:"any"===e&&"any"===t,leftIsRange:"range"===e,rightIsRange:"range"===t}}};e([h({readOnly:!0})],A.prototype,"allInputFields",null),e([h()],A.prototype,"_layerFieldsByName",null),e([h()],A.prototype,"_inputFieldCache",void 0),e([h()],A.prototype,"arcadeContextVars",void 0),e([h()],A.prototype,"contingencyConstraintViolations",void 0),e([h()],A.prototype,"feature",null),e([h()],A.prototype,"fieldsWithContingentValues",null),e([h({type:g})],A.prototype,"formTemplate",null),e([h({readOnly:!0})],A.prototype,"inputFields",null),e([h()],A.prototype,"joinedContingentValues",null),e([h()],A.prototype,"layer",null),e([h()],A.prototype,"messages",void 0),e([h()],A.prototype,"spatialReference",null),e([h()],A.prototype,"state",null),e([h()],A.prototype,"strict",void 0),e([h()],A.prototype,"submittable",null),e([h()],A.prototype,"valid",null),e([h()],A.prototype,"getValues",null),e([h()],A.prototype,"submit",null),A=e([m("esri.widgets.FeatureForm.FeatureFormViewModel")],A);const T=e=>!!e.inputFields,k=e=>"group"===e.type,M=(e,t,n)=>{l(t)&&e.set(t,n)},R=A;export{R as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import"../../intl.js";import n from"../../core/Evented.js";import{HandleOwnerMixin as s}from"../../core/HandleOwner.js";import{makeHandle as i}from"../../core/handleUtils.js";import a from"../../core/Logger.js";import{destroyMaybe as r,isNone as o,isSome as l}from"../../core/maybe.js";import{EsriPromiseMixin as u}from"../../core/Promise.js";import{watch as c,syncAndInitial as d,initial as p}from"../../core/reactiveUtils.js";import{schedule as f}from"../../core/scheduling.js";import{property as h}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as m}from"../../core/accessorSupport/decorators/subclass.js";import g from"../../form/FormTemplate.js";import y from"../../layers/support/ContingentValue.js";import{fixFields as _}from"../../layers/support/fieldUtils.js";import C from"../../layers/support/LayerContingentValuesCache.js";import{loadArcade as F}from"../../support/arcadeOnDemand.js";import v from"./InputField.js";import V from"./InputFieldGroup.js";import{onLocaleChange as b}from"../../intl/locale.js";import{fetchMessageBundle as x}from"../../intl/messages.js";const j=new t({attributes:{}}),E=["editable","required","value","visibility"],I="#JSAPI_CONTINGENT_VALUE_EMPTY_HASH",w="#JSAPI_CONTINGENT_VALUE_ANY_HASH",T="#JSAPI_CONTINGENT_VALUE_NULL_HASH";let A=class extends(s(u(n.EventedAccessor))){constructor(e){super(e),this._arcade=null,this._compiledExpressionLookup=new Map,this._expressionLookup=new Map,this._expressionInvalidationCallbacks=new Set,this._contingentValuesCache=null,this._featureClone=j.clone(),this._initialFeature=j.clone(),this._arcadeGeometryOperationsEnabled=!1,this._inputFieldCache=[],this.arcadeContextVars={$editcontext:{editType:"NA"}},this.contingencyConstraintViolations=new Map,this.messages=null,this.strict=!1}initialize(){const e=async()=>this.messages=await x("esri/widgets/FeatureForm/t9n/FeatureForm");e();const t=c((()=>this.layer),(e=>{"feature"===e?.type&&this.addResolvingPromise(C.createLoadedLayerContingentValuesCache(e).then((e=>{this._contingentValuesCache=e,this.notifyChange("fieldsWithContingentValues")})))}),{initial:!0}),n=c((()=>this.feature?.geometry),(e=>{this._featureClone.geometry=e;for(const t of this._expressionInvalidationCallbacks)t()}));this.handles.add([b(e),t,n])}destroy(){this.feature=null,this.layer=null,this._contingentValuesCache=r(this._contingentValuesCache)}get allInputFields(){return this.inputFields.reduce(((e,t)=>k(t)?[...e,...t.inputFields]:[...e,t]),[])}get _layerFieldsByName(){return new Map(this.layer.fields.map((e=>[e.name,e])))}get feature(){return this._get("feature")}set feature(e){this._featureClone=e?e.clone():j.clone(),this._initialFeature=this._featureClone.clone(),this.contingencyConstraintViolations.clear(),this._clearInputFieldCache(),this._set("feature",e)}get fieldsWithContingentValues(){if(o(this._contingentValuesCache))return new Set;const e=this._contingentValuesCache.fieldGroups.flatMap((e=>e.fields));return new Set(e)}get formTemplate(){return this.layer&&"formTemplate"in this.layer?this.layer.formTemplate:null}set formTemplate(e){this._override("formTemplate",e)}get inputFields(){const{_arcade:e,arcadeContextVars:t,_featureClone:n,_initialFeature:s,_inputFieldCache:i,formTemplate:a,messages:r,layer:o,state:u,spatialReference:c}=this;if("ready"!==u)return[];const d={arcade:e,arcadeContextVars:t,feature:n,initialFeature:s,layer:o,messages:r,expressionTrackingProvider:{registerExpression:this._registerExpression.bind(this)},spatialReference:c},p=l(a)&&a.elements.length>0?this._updateInputFieldsFromElements(i,a.elements,d):this._updateInputFieldsFromLayerFields(i,o?.fields,d);return this._inputFieldCache=p,p}get joinedContingentValues(){return this._joinContingentValues()}get layer(){return this.feature?.sourceLayer&&"applyEdits"in this.feature.sourceLayer?this.feature.sourceLayer:null}set layer(e){this._override("layer",e)}get spatialReference(){return this.layer?.spatialReference??null}set spatialReference(e){this._override("spatialReference",e)}get state(){return this.messages&&this.get("layer.loaded")?"ready":"disabled"}get submittable(){return!!this.valid||this.allInputFields.filter((e=>!e.valid)).every((({submittable:e})=>e))}get valid(){const e=this.allInputFields;return e.length>0&&e.every((({valid:e})=>e))}findField(e){return this.allInputFields.find((t=>t.name===e))}getValue(e){const{_featureClone:t,layer:n}=this,s=!!n?.getField(e);return t.getAttribute(e)??(s?null:void 0)}setValue(e,t){const{_featureClone:n,strict:s}=this,i=this.findField(e);t=""===t?null:t,i&&n.getAttribute(e)!==t&&(i.value=t,s&&!i.valid||this._afterValueChange(i))}getValues(){return{...this._featureClone.attributes}}submit(){const e=this.allInputFields,t=new Set(e.filter((e=>e.valid)).map((({name:e})=>e))),n=e.filter((e=>!e.valid)).map((({name:e})=>e)),s=this.getValues();if(this.validateContingencyConstraints(s,{includeIncompleteViolations:!0}).length>0)for(const[i,a]of this.contingencyConstraintViolations.entries())"error"===a.type&&(t.delete(i),n.push(i));this.emit("submit",{valid:[...t],invalid:n,values:s})}validateContingencyConstraints(e,t){const{_contingentValuesCache:n}=this,s=new Map;if(this.contingencyConstraintViolations=s,o(n))return[];const{invalid:i,incomplete:a}=n.validateContingencyConstraints(e),r=[...i,...t?.includeIncompleteViolations?a:[]];for(const o of r)for(const e of o.fieldGroup.fields)s.set(e,o);return r}_emitChangeEvent({name:e,valid:t,value:n}){this.emit("value-change",{layer:this.layer,feature:this.feature,fieldName:e,value:n,valid:t})}_updateInputFieldsFromElements(e,t,n){const s=new Map;for(const a of e)if(k(a)){S(s,a.groupElement,a);for(const e of a.inputFields)S(s,e.fieldElement,e)}else S(s,a.fieldElement,a);const i=this._updateInputFieldsRecursive(s,t.filter(this._isSupportedElement),n);for(const[a,r]of s.entries())s.delete(a),r.destroy();return i}_updateInputFieldsRecursive(e,t,n,s=null){const i=[];for(const a of t){const t=e.has(a),r=t?e.get(a):M(a)?this._makeInputFieldGroupFromGroupElement(a,n):this._makeInputFieldFromFieldElement(a,n,s);if(i.push(r),t)if(e.delete(a),k(r)){const{arcade:e,feature:t,expressionTrackingProvider:s,spatialReference:i}=n;r.set({arcade:e,feature:t,expressionTrackingProvider:s,spatialReference:i})}else r.set(n);if(M(a)){const t=a.elements.filter((e=>this._isSupportedElement(e)));r.inputFields=this._updateInputFieldsRecursive(e,t,n,r)}}return i}_updateInputFieldsFromLayerFields(e,t,n){if(!Array.isArray(t))return a.getLogger(this.declaredClass).warn(this.declaredClass,"No attribute fields found."),[];const s=new Map;for(const a of e)if(k(a)){for(const e of a.inputFields)e.destroy();a.inputFields.length=0,a.destroy()}else s.set(a.field,a);const i=[],{feature:r,initialFeature:o,layer:l,messages:u,spatialReference:c}=n;for(const a of t){const e=s.get(a)??new v({field:a,feature:r,initialFeature:o,layer:l,messages:u,spatialReference:c,value:r.getAttribute(a.name)??null});e.set({fieldElement:null,requiredFunction:null,visibilityFunction:null,valueFunction:null,editableFunction:null}),i.push(e),s.delete(a)}for(const[a,d]of s.entries())s.delete(a),d.destroy();return i}_makeInputFieldFromFieldElement(e,t,n=null){const{arcade:s,arcadeContextVars:a,expressionTrackingProvider:r,feature:o,initialFeature:u,layer:h,messages:m,spatialReference:g}=t,y=new v({fieldElement:e,field:this._layerFieldsByName.get(e.fieldName),value:o.getAttribute(e.fieldName)??null,feature:o,initialFeature:u,layer:h,group:n,arcade:s,arcadeContextVars:a,expressionTrackingProvider:r,messages:m,spatialReference:g}),_=`watch-expression-field-${y.id}`,C=c((()=>y.fieldElement),(e=>{this.handles.remove(_),l(e)&&this.handles.add(E.map((t=>c((()=>e[`${t}Expression`]),(async e=>{e&&""!==e&&(y[`${t}Function`]=await this._getOrMakeCompiledExpression(e),y.arcade=this._arcade)}),d))),_)}),d),F=i((()=>this.handles.remove(_)));return y.addHandles([C,F]),f((()=>{y.destroyed||y.addHandles([c((()=>y.value),(()=>this._afterValueChange(y)),p)])})),y}_makeInputFieldGroupFromGroupElement(e,t){const{arcade:n,arcadeContextVars:s,expressionTrackingProvider:i,feature:a,initialFeature:r,spatialReference:o}=t,u=new V({groupElement:e,inputFields:[],feature:a,initialFeature:r,arcade:n,arcadeContextVars:s,expressionTrackingProvider:i,spatialReference:o});return u.addHandles(c((()=>u.groupElement),(e=>l(e)&&e.addHandles(c((()=>e.visibilityExpression),(async e=>{e&&""!==e&&(u.visibilityFunction=await this._getOrMakeCompiledExpression(e),u.arcade=this._arcade)}),d))),d)),u}_clearInputFieldCache(){for(const e of this._inputFieldCache){if(k(e))for(const t of e.inputFields)t.destroy();e.destroy()}this._inputFieldCache=[]}_afterValueChange(e){const{name:t,value:n}=e;if(this.get("layer.typeIdField")===t&&"types"in this.layer){const e=new Set;this.layer.types.forEach((t=>Object.keys(t.domains).forEach((t=>e.add(t))))),e.forEach((e=>{const t=this.findField(e);t&&t.notifyChange("domain")}))}this._featureClone.setAttribute(t,n);for(const s of this._expressionInvalidationCallbacks)s();this._emitChangeEvent(e)}_registerExpression(e){const{_expressionInvalidationCallbacks:t}=this;return t.add(e),i((()=>t.delete(e)))}async _getOrMakeCompiledExpression(e){{if(o(e)||""===e)return null;const t=this._expressionLookup.get(e)??this._addToExpressionLookup(e);if(this._compiledExpressionLookup.has(t))return this._compiledExpressionLookup.get(t);this._arcade||(this._arcade=await F());const n=this._arcade.arcadeUtils;return!this._arcadeGeometryOperationsEnabled&&n.hasGeometryOperations(t)&&(await n.enableGeometryOperations(),this._arcadeGeometryOperationsEnabled=!0),this._addToCompiledExpressionLookup(t)}}_addToCompiledExpressionLookup(e){const{_arcade:{arcadeUtils:t},_compiledExpressionLookup:n,arcadeContextVars:s,layer:i}=this,a={vars:{$feature:"any",$originalfeature:"any",...Object.fromEntries(Array.from(Object.entries(s)).map((e=>[e[0],t.convertJsonToArcade(e[1])])))},spatialReference:null},r=t.createSyntaxTree(e),o={sourceText:e,syntaxTree:r,compiledScript:t.createFunction(r,a),fieldsUsed:_(i.fieldsIndex,t.extractFieldNames(r))};return n.set(e,o),o}_addToExpressionLookup(e){const{_expressionLookup:t,formTemplate:n}=this,s=(l(n)&&l(n.expressionInfos)?Object.values(n.expressionInfos).find((t=>t.name===e)):null)?.expression??e;return t.set(e,s),e!==s&&t.set(s,s),s}_isSupportedElement(e){return"field"===e.type||"group"===e.type||(a.getLogger(this.declaredClass).warn("form-info::unsupported-element-type","Only element types 'field' and 'group' are supported",`Element ${e.label} has unsupported type '${e.type}'`),!1)}_joinContingentValues(){const e=this._contingentValuesCache;if(o(e))return[];const t="typeIdField"in this.layer?this.layer.typeIdField:null,n=t?this.getValue(t):null,s=[];for(const r of e.fieldGroups){const{contingencies:e,fields:t,name:i}=r,a=[];for(const s of e)s.isRetired||l(s.subtype)&&s.subtype.code!==n||a.push({values:s.values});a.length>0&&s.push({name:i,fields:t,contingencies:a})}const[i,a]=this._generateJoinPlan(s);return[...i.flatMap((e=>this._joinFieldGroupContingencies(e))),...a.flatMap((e=>e.contingencies))]}_generateJoinPlan(e){const t=new Map,n=[],s=new Set;for(const l of e)for(const e of l.fields)if(t.has(e)){const i=t.get(e),a=l,r=[i.name,a.name].sort().join("|");if(s.has(r))continue;n.push([i,a]),s.add(r),t.set(e,a)}else t.set(e,l);const i=new Set(n.flat()),a=new Set(e);for(const l of i)a.delete(l);const r=new Map,o=new Map;for(const l of new Set(n.flat())){const e=Symbol(l.name);r.set(e,new Set([l])),o.set(l,e)}for(const[l,u]of n){const e=o.get(l),t=o.get(u);if(e===t)continue;const n=r.get(e),s=r.get(t);for(const i of s)n.add(i),o.set(i,e);r.delete(t)}return[[...r.values()].map((e=>[...e])),[...a]]}_joinFieldGroupContingencies(e){const t=e.slice(),n=t.shift();let s=t.shift(),i=this._generateJoinKey(n.fields,s.fields),a=new Set([...n.fields,...s.fields]),r=new Map;for(const o of n.contingencies){const[e]=this._hashContingency(o,i.codedValueFields,!0);r.has(e)?r.get(e).push(o):r.set(e,[o])}for(;t.length>0;){const e=new Map,n=t.shift(),l=this._generateJoinKey(a,n.fields);for(const t of s.contingencies){const[n,s]=this._hashContingency(t,i.codedValueFields),a=s?this._findMatchingContingenciesWithAnyHashMask(r,n):r.get(n);if(r.has(w)&&a.push(...this._findMatchingContingenciesContainingAny(t,r.get(w),i.codedValueFields)),!o(a))for(const r of a){const n=i.rangeFields.length>0?this._joinContingenciesWithRangeDomains(r,t,i.rangeFields):this._joinContingencies(r,t);if(o(n))break;const[s]=this._hashContingency(n,l.codedValueFields,!0);e.has(s)?e.get(s).push(n):e.set(s,[n])}}r=e,s=n,i=l,a=new Set([...a,...s.fields])}const u=[];for(const c of s.contingencies){const[e,t]=this._hashContingency(c,i.codedValueFields),n=t?this._findMatchingContingenciesWithAnyHashMask(r,e):r.get(e);if(r.has(w)&&n.push(...this._findMatchingContingenciesContainingAny(c,r.get(w),i.codedValueFields)),!o(n))for(const s of n){const e=i.rangeFields.length>0?this._joinContingenciesWithRangeDomains(s,c,i.rangeFields):this._joinContingencies(s,c);l(e)&&u.push(e)}}return u}_joinContingencies(e,t){const n={values:{...e.values,...t.values}};for(const[s,i]of Object.entries(n.values))"any"===i.objectType&&l(e.values[s])&&(n.values[s]=e.values[s]);return n}_joinContingenciesWithRangeDomains(e,t,n){const s=this._joinContingencies(e,t);for(const i of n){const n=e.values[i],a=t.values[i],{leftIsNull:r,rightIsNull:o,bothAreNull:l,leftIsAny:u,rightIsAny:c,bothAreAny:d,leftIsRange:p,rightIsRange:f}=this._compareObjectTypes(n.objectType,a.objectType);if(l||d)continue;if(r&&c||o&&u){s.values[i]=new y({objectType:"null"});continue}if(r&&f||o&&p)return null;u?(n.minValue=-1/0,n.maxValue=1/0):c&&(a.minValue=-1/0,a.maxValue=1/0);const h=Math.max(n.minValue,a.minValue),m=Math.min(n.maxValue,a.maxValue);if(h>m)return null;s.values[i]=new y({objectType:"range",minValue:h,maxValue:m})}return s}_findMatchingContingenciesContainingAny(e,t,n){return t.filter((t=>n.every((n=>{const s=t.values[n],i=e.values[n];return"any"===s.objectType||"any"===i.objectType||s.codedValue?.code===i.codedValue?.code}))))}_findMatchingContingenciesWithAnyHashMask(e,t){const n=RegExp(`${t}$`),s=[];for(const[i,a]of e){if(i===w)break;n.test(i)&&s.push(...a)}return s}_generateJoinKey(e,t){const n=Array.isArray(e)?new Set(e):e,s=Array.isArray(t)?new Set(t):t,i=n.size<s.size?n:s,a=i===n?s:n,r=new Set,l=new Set;for(const u of i)if(a.has(u)){const e=this.layer.getFieldDomain(u,{feature:this.feature});if(o(e))continue;switch(e.type){case"coded-value":r.add(u);break;case"range":l.add(u)}}return{codedValueFields:[...r],rangeFields:[...l]}}_hashContingency(e,t,n=!1){if(t.length<1)return[I,!1];const s=[];let i=!1;for(const a of t){const t=e.values[a];if("any"===t.objectType){if(n)return[w,!0];i=!0,s.push(`${a}:.*`)}else"null"===t.objectType?s.push(`${a}:${T}`):s.push(`${a}:${t.codedValue?.code}`)}return[s.sort().join("&"),i]}_compareObjectTypes(e,t){return{leftIsNull:"null"===e,rightIsNull:"null"===t,bothAreNull:"null"===e&&"null"===t,leftIsAny:"any"===e,rightIsAny:"any"===t,bothAreAny:"any"===e&&"any"===t,leftIsRange:"range"===e,rightIsRange:"range"===t}}};e([h({readOnly:!0})],A.prototype,"allInputFields",null),e([h()],A.prototype,"_layerFieldsByName",null),e([h()],A.prototype,"_inputFieldCache",void 0),e([h()],A.prototype,"arcadeContextVars",void 0),e([h()],A.prototype,"contingencyConstraintViolations",void 0),e([h()],A.prototype,"feature",null),e([h()],A.prototype,"fieldsWithContingentValues",null),e([h({type:g})],A.prototype,"formTemplate",null),e([h({readOnly:!0})],A.prototype,"inputFields",null),e([h()],A.prototype,"joinedContingentValues",null),e([h()],A.prototype,"layer",null),e([h()],A.prototype,"messages",void 0),e([h()],A.prototype,"spatialReference",null),e([h()],A.prototype,"state",null),e([h()],A.prototype,"strict",void 0),e([h()],A.prototype,"submittable",null),e([h()],A.prototype,"valid",null),e([h()],A.prototype,"getValues",null),e([h()],A.prototype,"submit",null),A=e([m("esri.widgets.FeatureForm.FeatureFormViewModel")],A);const k=e=>!!e.inputFields,M=e=>"group"===e.type,S=(e,t,n)=>{l(t)&&e.set(t,n)},R=A;export{R as default};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
+ */
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import{createArcadeProfile as t,createArcadeExecutor as r}from"../../arcade.js";import s from"../../core/Accessor.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import{fixFields as l}from"../../layers/support/fieldUtils.js";var c;const i=Symbol("FormExpressionArcadeExecutor"),n=e=>e&&"object"==typeof e&&e[i];let u=class extends s{constructor(e){super(e),this[c]=!0,this._lastEvaluatedValue=null,this._abortController=new AbortController}get isAsync(){return this.executor.isAsync}get fieldsUsed(){return this.executor.fieldsUsed}get syntaxTree(){return this.executor.syntaxTree}get variablesUsed(){return this.executor.variablesUsed}get lastEvaluatedValue(){return this._lastEvaluatedValue}abort(){this._abortController.abort()}execute(e,t){this._abortController=new AbortController;const r=this.executor.execute(e,{...t,abortSignal:this._abortController.signal});return this._lastEvaluatedValue=r,r}async executeAsync(e,t){const r=await this.executor.executeAsync(e,{...t,abortSignal:this._abortController.signal});return this._lastEvaluatedValue=r,r}};c=i,e([o()],u.prototype,"_lastEvaluatedValue",void 0),e([o({constructOnly:!0})],u.prototype,"executor",void 0),e([o()],u.prototype,"isAsync",null),e([o()],u.prototype,"fieldsUsed",null),e([o()],u.prototype,"syntaxTree",null),e([o()],u.prototype,"variablesUsed",null),e([o()],u.prototype,"lastEvaluatedValue",null),u=e([a("esri.widgets.FeatureForm.FormExpressionArcadeExecutor")],u);const p=async(e,s)=>{const o=t("form-calculation"),a=await r(e,o,{});return s?.fieldsIndex&&(a.fieldsUsed=l(s.fieldsIndex,a.fieldsUsed)),new u({executor:a})};export{u as FormExpressionArcadeExecutor,p as createFormExpressionArcadeExecutor,n as isFormExpressionArcadeExecutor};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.25/esri/copyright.txt for details.
4
+ */
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Accessor.js";import o from"../../core/Logger.js";import{getOrCreateMapValue as r}from"../../core/MapUtils.js";import{isSome as s}from"../../core/maybe.js";import{createResolver as a}from"../../core/promiseUtils.js";import{property as n}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";const c="esri.widgets.FeatureForm.FormExpressionsManager";let p=class extends t{constructor(e){super(e),this._fieldReferencesLookup=new Map,this._fieldsAffectedLookup=new Map,this._latestFieldValues={...e.feature.attributes}}initialize(){this._dependencyGraph=this._buildDependencyGraph()}get _baseContext(){const{editType:e,layer:t,map:r,originalFeature:a,spatialReference:n}=this.arcadeContextInfo,i="feature"===t?.type?t:"scene"===t?.type&&s(t.associatedLayer)?t.associatedLayer:void 0;return[{$originalfeature:a,$editcontext:{editType:e},$layer:i,$featureset:i,$datastore:t?.url,$map:r},{spatialReference:n,console:o.getLogger(c).info}]}evaluateExpressions(e){return this._evaluate(e)}evaluateInvalidated(e){const{_fieldReferencesLookup:t,_latestFieldValues:o,feature:r}=this,s=new Set;for(const a of e)if(o[a]=r.getAttribute(a),t.has(a))for(const e of t.get(a))s.add(e);return this._evaluate([...s])}_buildDependencyGraph(){const{_fieldReferencesLookup:e,_fieldsAffectedLookup:t,executors:o}=this,a=new Map(this.inputFields.map((e=>[e.name,e]))),n=new Map(o.map((e=>[e,new Array])));for(const i of o)for(const o of i.fieldsUsed){r(e,o,(()=>new Set)).add(i);const c=a.get(o),{valueFunction:p,editableFunction:u}=c;if(s(p)){n.get(p).push(i);r(t,p,(()=>new Set)).add(c)}if(s(u)){n.get(u).push(i);r(t,u,(()=>new Set)).add(c)}}return n}_evaluate(e){const t=new Map,{_dependencyGraph:o,_fieldsAffectedLookup:r,_latestFieldValues:s}=this;for(const a of e)u(a,t,o);for(const[a,{resolver:n,dependencyPromises:i}]of t){Promise.all(i).then((async()=>{const[e,t]=this._makeContext(s);return a.executeAsync(e,t)})).then((()=>{if(r.has(a))for(const e of r.get(a))this._latestFieldValues[e.name]=e.value;n.resolve()}),(e=>n.reject(e)))}return Promise.all(Array.from(t.values(),(({resolver:e})=>e.promise)))}_makeContext(e){const[t,o]=this._baseContext,r=this.feature.clone();return r.attributes=e,[{...t,$feature:r},o]}};e([n()],p.prototype,"_baseContext",null),e([n()],p.prototype,"feature",void 0),e([n()],p.prototype,"executors",void 0),e([n()],p.prototype,"inputFields",void 0),e([n()],p.prototype,"arcadeContextInfo",void 0),p=e([i(c)],p);const u=(e,t,o)=>{if(t.has(e))return;const r=a();t.set(e,{resolver:r,dependencyPromises:[]}),e.abort();const s=o.get(e);for(const a of s)u(a,t,o),t.get(a).dependencyPromises.push(r.promise)};export{p as FormExpressionsManager};
@@ -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"../../intl.js";import t from"../../core/Accessor.js";import{HandleOwnerMixin as i}from"../../core/HandleOwner.js";import{isNone as r,unwrap as n,isSome as s,get as o}from"../../core/maybe.js";import{watch as l,syncAndInitial as a}from"../../core/reactiveUtils.js";import{generateUID as u}from"../../core/uid.js";import{property as d}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";import c from"../../layers/support/CodedValueDomain.js";import"../../layers/support/Domain.js";import"../../layers/support/InheritedDomain.js";import"../../layers/support/RangeDomain.js";import{validateDomainValue as h,DomainValidationError as m,getDomainRange as y}from"../../layers/support/domainUtils.js";import{isNumericField as f,isStringField as g,isDateField as v,TypeValidationError as E,validateFieldValue as _,getFeatureEditFields as b,getFeatureGeometryFields as x,NumericRangeValidationError as F,getFieldRange as T}from"../../layers/support/fieldUtils.js";import{substitute as V}from"../../intl/substitute.js";var O,U;!function(e){e.Text="text",e.Number="number",e.Date="date",e.Unsupported="unsupported"}(O||(O={})),function(e){e.TOO_SHORT="length-validation-error::too-short"}(U||(U={}));const j={type:"number"},A={type:"number",intlOptions:{notation:"scientific"}},D={type:"date",intlOptions:{day:"2-digit",month:"2-digit",year:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}};function C(e){return e>=1e7||e<=-1e7}const N=["editable","required","value","visibility"];let R=class extends(i(t)){constructor(e){super(e),this._storedValue=null,this._expressionTrackingHandles=new Map,this.arcade=null,this.editableFunction=null,this.id=u().toString(),this.requiredFunction=null,this.expressionTrackingProvider=null,this.valueFunction=null,this.visibilityFunction=null,this.feature=null,this.field=null,this.fieldElement=null,this.layer=null,this.error=null,this.group=null,this.messages=null}initialize(){const e=e=>"value"!==e,t=N.filter(e);this.addHandles(t.map((e=>l((()=>this.get(`${e}Function`)),(t=>{s(t)?this._registerExpressionWithTrackingProvider(e):this._unregisterExpressionWithTrackingProvider(e)}),a))))}destroy(){for(const e of this._expressionTrackingHandles.values())e.remove()}get _arcadeContext(){const{arcade:e,arcadeContextVars:t,feature:i,initialFeature:o,spatialReference:l}=this;if(r(e))return{};const{attributes:a,geometry:u,layer:d}=o??{},p=e.arcadeUtils.createFeature(a,n(u),s(d)&&"fields"in d?d:null),c=e.arcadeUtils.getViewInfo({spatialReference:l}),h=e.arcadeUtils.createExecContext(i,c),m=Object.fromEntries(Array.from(Object.entries(t)).map((t=>[t[0],e.arcadeUtils.convertJsonToArcade(t[1])])));return h.vars={...h.vars,...m,$originalfeature:p},h}get _configAllowsEdits(){const{fieldElement:e,layer:t,name:i}=this;if(s(e))return e.editableExpression?this.evaluatedEditableExpression:!1!==e.editable;return("subtype-group"!==t?.type?t?.popupTemplate?.fieldInfos?.find((({fieldName:e})=>e===i)):null)?.isEditable??!0}get _layerFieldAllowsEdits(){const{field:e,layer:t}=this;return t?.capabilities.operations.supportsEditing&&e?.editable}get isUsingValueExpression(){return this._shouldUseValueExpression()}get evaluatedEditableExpression(){const{_arcadeContext:e,editableFunction:t}=this;if(r(t))return null;const{arcade:i}=this;return i.arcadeUtils.executeFunction(t,e)}get evaluatedRequiredExpression(){const{_arcadeContext:e,requiredFunction:t}=this;if(r(t))return null;const{arcade:i}=this;return i.arcadeUtils.executeFunction(t,e)}get evaluatedVisibilityExpression(){const{_arcadeContext:e,visibilityFunction:t}=this;if(r(t))return null;const{arcade:i}=this;return i.arcadeUtils.executeFunction(t,e)}get evaluatedValueExpression(){const{_arcadeContext:e,valueFunction:t}=this;if(r(t))return null;const{arcade:i}=this;return i.arcadeUtils.executeFunction(t,e)}set initialFeature(e){this._set("initialFeature",e),this.notifyChange("valid")}get description(){return n(this.fieldElement)?.description}get domain(){const{typeIdField:e}=this.layer,t=e===this.name,i=this.field?.domain;if(t&&!i){const{layer:e}=this,t="subtype-group"===e.type?e.sublayers.map((({subtypeCode:e,title:t})=>({id:e,name:t}))):e.types.map((({id:e,name:t})=>({code:e,name:t})));return new c({name:"__internal-type-based-coded-value-domain__",codedValues:t})}const{feature:r}=this,n=e&&this.layer.getFieldDomain(this.name,{feature:r})||i,l=o(this.fieldElement,"domain");return s(l)&&this._isDomainCompatible(l)?l:n}get editable(){return!!this._layerFieldAllowsEdits&&(this.evaluatedEditableExpression??this._configAllowsEdits)}get inputType(){return n(this.fieldElement)?.input?.type}get errorMessage(){return this._toErrorMessage()}get hint(){return n(this.fieldElement)?.hint}get includeTime(){const{fieldElement:e}=this,t=s(e)&&"datetime-picker"===e.input?.type?e.input.includeTime:void 0;return void 0===t||t}get label(){return s(this.fieldElement)&&this.fieldElement.label||this.field.alias||this.field.name}get maxLength(){const e=-1;if(this.type===O.Date)return e;const{field:t,fieldElement:i}=this,r=t?.length,n=s(i)&&k(i.input)?i.input.maxLength:NaN;return!isNaN(n)&&n>=e&&(r===e||n<=r)?n:r}get minLength(){const e=-1;if(this.type===O.Date)return e;const{field:t,fieldElement:i}=this,r=t?.length,n=s(i)&&k(i.input)?i.input.minLength:NaN;return!isNaN(n)&&n>=e&&(r===e||n<=r)?n:e}get name(){return this.field?.name}get required(){const{editable:e,evaluatedRequiredExpression:t,field:i,visible:r}=this;return!!e&&(!1===i?.nullable||!(!r||!s(t))&&t)}set required(e){this._overrideIfSome("required",e)}get spatialReference(){return this.layer?.spatialReference??null}set spatialReference(e){this._override("spatialReference",e)}get submittable(){const{field:e,required:t,valid:i,value:n}=this;return(!t||!r(n))&&(!!i||this.initialFeature.getAttribute(e.name)===n)}get type(){const{field:e}=this;return f(e)?O.Number:g(e)?O.Text:v(e)?O.Date:O.Unsupported}get valid(){const e=this.editable?this._validate():null;return this._set("error",e),null===e}get value(){if(this._shouldUseValueExpression()){const e=this.evaluatedValueExpression;return this.type===O.Date&&e instanceof Date?e.getTime():s(e)&&"object"==typeof e?e.toString():e}return this.get("_storedValue")}set value(e){this.notifyChange("evaluatedVisibilityExpression"),this.set("_storedValue",e)}get visible(){return!this._isEditorField()&&(s(this.evaluatedVisibilityExpression)?this.evaluatedVisibilityExpression:!!s(this.fieldElement)||this._isVisibleByDefault())}_isDomainCompatible(e){const{field:t}=this;if("coded-value"===e?.type){const i=typeof e.codedValues[0].code;if("string"===i&&g(t)||"number"===i&&f(t))return!0}return!!("range"===e?.type&&f(t)||v(t))}_validate(){const{domain:e,field:t,initialFeature:i,minLength:r,required:n,type:s,valid:o,value:l}=this,a=n&&null===l,u=void 0!==o;return!a&&i.getAttribute(t.name)===l&&u?null:a?E.INVALID_TYPE:"text"===s&&r>-1&&"string"==typeof l&&l.length<r?U.TOO_SHORT:e?null!==l||n?h(e,l):null:_(t,l)}_isVisibleByDefault(){const e=this.field?.type;return"oid"!==e&&"global-id"!==e&&!this._isGeometryField()}_isEditorField(){return b(this.layer).includes(this.name)}_isGeometryField(){return x(this.layer).includes(this.name)}_shouldUseValueExpression(){const e=this._layerFieldAllowsEdits&&!this._configAllowsEdits&&s(this.valueFunction);return e?this._registerExpressionWithTrackingProvider("value"):this._unregisterExpressionWithTrackingProvider("value"),e}_toErrorMessage(){const{domain:e,field:t,messages:i,minLength:r,value:n,required:s,type:o}=this,l=this.error;if(s&&null===n)return i.validationErrors.cannotBeNull;if(l===m.VALUE_OUT_OF_RANGE||l===F.OUT_OF_RANGE){const r=y(e)||T(t);return V(i.validationErrors.outsideRange,r,{format:{max:"date"===o?D:C(r.max)?A:j,min:"date"===o?D:C(r.min)?A:j}})}return l===m.INVALID_CODED_VALUE?i.validationErrors.invalidCodedValue:l===E.INVALID_TYPE?i.validationErrors.invalidType:l===U.TOO_SHORT?V(i.validationErrors.tooShort,{min:r}):null}_registerExpressionWithTrackingProvider(e){const{_expressionTrackingHandles:t,expressionTrackingProvider:i}=this;if(r(i)||t.has(e))return;const n=i.registerExpression((()=>{this.notifyChange("_arcadeContext")}));t.set(e,n)}_unregisterExpressionWithTrackingProvider(e){const{_expressionTrackingHandles:t}=this,i=t.get(e);i&&(i.remove(),t.delete(e))}};function k(e){return!!e&&"maxLength"in e}e([d()],R.prototype,"_storedValue",void 0),e([d()],R.prototype,"_arcadeContext",null),e([d()],R.prototype,"_configAllowsEdits",null),e([d()],R.prototype,"_layerFieldAllowsEdits",null),e([d()],R.prototype,"arcade",void 0),e([d()],R.prototype,"arcadeContextVars",void 0),e([d()],R.prototype,"editableFunction",void 0),e([d()],R.prototype,"requiredFunction",void 0),e([d()],R.prototype,"expressionTrackingProvider",void 0),e([d()],R.prototype,"valueFunction",void 0),e([d()],R.prototype,"isUsingValueExpression",null),e([d()],R.prototype,"visibilityFunction",void 0),e([d()],R.prototype,"evaluatedEditableExpression",null),e([d()],R.prototype,"evaluatedRequiredExpression",null),e([d()],R.prototype,"evaluatedVisibilityExpression",null),e([d()],R.prototype,"evaluatedValueExpression",null),e([d()],R.prototype,"feature",void 0),e([d()],R.prototype,"field",void 0),e([d()],R.prototype,"fieldElement",void 0),e([d()],R.prototype,"initialFeature",null),e([d()],R.prototype,"layer",void 0),e([d({readOnly:!0})],R.prototype,"description",null),e([d()],R.prototype,"domain",null),e([d()],R.prototype,"editable",null),e([d({readOnly:!0})],R.prototype,"inputType",null),e([d({readOnly:!0})],R.prototype,"error",void 0),e([d({dependsOn:["error","messages","value"]})],R.prototype,"errorMessage",null),e([d()],R.prototype,"group",void 0),e([d({readOnly:!0})],R.prototype,"hint",null),e([d()],R.prototype,"includeTime",null),e([d()],R.prototype,"label",null),e([d()],R.prototype,"maxLength",null),e([d()],R.prototype,"minLength",null),e([d()],R.prototype,"messages",void 0),e([d({readOnly:!0})],R.prototype,"name",null),e([d()],R.prototype,"required",null),e([d()],R.prototype,"spatialReference",null),e([d()],R.prototype,"submittable",null),e([d()],R.prototype,"type",null),e([d()],R.prototype,"valid",null),e([d({value:null})],R.prototype,"value",null),e([d()],R.prototype,"visible",null),R=e([p("esri.widgets.FeatureForm.InputField")],R);const q=R;export{q as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import"../../intl.js";import t from"../../core/Accessor.js";import{HandleOwnerMixin as i}from"../../core/HandleOwner.js";import{isNone as r,unwrap as n,isSome as s,get as o}from"../../core/maybe.js";import{watch as l,syncAndInitial as a}from"../../core/reactiveUtils.js";import{generateUID as u}from"../../core/uid.js";import{property as d}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";import c from"../../layers/support/CodedValueDomain.js";import"../../layers/support/Domain.js";import"../../layers/support/InheritedDomain.js";import"../../layers/support/RangeDomain.js";import{validateDomainValue as h,DomainValidationError as m,getDomainRange as y}from"../../layers/support/domainUtils.js";import{isNumericField as f,isStringField as g,isDateField as v,TypeValidationError as E,validateFieldValue as _,getFeatureEditFields as x,getFeatureGeometryFields as b,NumericRangeValidationError as F,getFieldRange as T}from"../../layers/support/fieldUtils.js";import{isFormExpressionArcadeExecutor as V}from"./FormExpressionArcadeExecutor.js";import{substitute as O}from"../../intl/substitute.js";var j,U;!function(e){e.Text="text",e.Number="number",e.Date="date",e.Unsupported="unsupported"}(j||(j={})),function(e){e.TOO_SHORT="length-validation-error::too-short"}(U||(U={}));const A={type:"number"},D={type:"number",intlOptions:{notation:"scientific"}},C={type:"date",intlOptions:{day:"2-digit",month:"2-digit",year:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}};function N(e){return e>=1e7||e<=-1e7}const R=["editable","required","value","visibility"];let k=class extends(i(t)){constructor(e){super(e),this._storedValue=null,this._expressionTrackingHandles=new Map,this.arcade=null,this.editableFunction=null,this.id=u().toString(),this.requiredFunction=null,this.expressionTrackingProvider=null,this.valueFunction=null,this.visibilityFunction=null,this.feature=null,this.field=null,this.fieldElement=null,this.layer=null,this.error=null,this.group=null,this.messages=null}initialize(){const e=e=>"value"!==e,t=R.filter(e);this.addHandles(t.map((e=>l((()=>this.get(`${e}Function`)),(t=>{s(t)?this._registerExpressionWithTrackingProvider(e):this._unregisterExpressionWithTrackingProvider(e)}),a))))}destroy(){for(const e of this._expressionTrackingHandles.values())e.remove()}get _arcadeContext(){const{arcade:e,arcadeContextVars:t,feature:i,initialFeature:o,spatialReference:l}=this;if(r(e))return{};const{attributes:a,geometry:u,layer:d}=o??{},p=e.arcadeUtils.createFeature(a,n(u),s(d)&&"fields"in d?d:null),c=e.arcadeUtils.getViewInfo({spatialReference:l}),h=e.arcadeUtils.createExecContext(i,c),m=Object.fromEntries(Array.from(Object.entries(t)).map((t=>[t[0],e.arcadeUtils.convertJsonToArcade(t[1])])));return h.vars={...h.vars,...m,$originalfeature:p},h}get _configAllowsEdits(){const{fieldElement:e,layer:t,name:i}=this;if(s(e))return e.editableExpression?this.evaluatedEditableExpression:!1!==e.editable;return("subtype-group"!==t?.type?t?.popupTemplate?.fieldInfos?.find((({fieldName:e})=>e===i)):null)?.isEditable??!0}get _layerFieldAllowsEdits(){const{field:e,layer:t}=this;return t?.capabilities.operations.supportsEditing&&e?.editable}get isUsingValueExpression(){return this._shouldUseValueExpression()}get evaluatedEditableExpression(){const{_arcadeContext:e,editableFunction:t}=this;if(r(t))return null;if(V(t))return!!t.lastEvaluatedValue;const{arcade:i}=this;return i.arcadeUtils.executeFunction(t.compiledScript,e)}get evaluatedRequiredExpression(){const{_arcadeContext:e,requiredFunction:t}=this;if(r(t))return null;if(V(t))return!!t.lastEvaluatedValue;const{arcade:i}=this;return i.arcadeUtils.executeFunction(t.compiledScript,e)}get evaluatedVisibilityExpression(){const{_arcadeContext:e,visibilityFunction:t}=this;if(r(t))return null;if(V(t))return!!t.lastEvaluatedValue;const{arcade:i}=this;return i.arcadeUtils.executeFunction(t.compiledScript,e)}get evaluatedValueExpression(){const{valueFunction:e}=this;if(r(e))return null;if(V(e))return e.lastEvaluatedValue;const{_arcadeContext:t,arcade:i}=this;return i.arcadeUtils.executeFunction(e.compiledScript,t)}set initialFeature(e){this._set("initialFeature",e),this.notifyChange("valid")}get description(){return n(this.fieldElement)?.description}get domain(){const{typeIdField:e}=this.layer,t=e===this.name,i=this.field?.domain;if(t&&!i){const{layer:e}=this,t="subtype-group"===e.type?e.sublayers.map((({subtypeCode:e,title:t})=>({id:e,name:t}))):e.types.map((({id:e,name:t})=>({code:e,name:t})));return new c({name:"__internal-type-based-coded-value-domain__",codedValues:t})}const{feature:r}=this,n=e&&this.layer.getFieldDomain(this.name,{feature:r})||i,l=o(this.fieldElement,"domain");return s(l)&&this._isDomainCompatible(l)?l:n}get editable(){return!!this._layerFieldAllowsEdits&&(this.evaluatedEditableExpression??this._configAllowsEdits)}get inputType(){return n(this.fieldElement)?.input?.type}get errorMessage(){return this._toErrorMessage()}get hint(){return n(this.fieldElement)?.hint}get includeTime(){const{fieldElement:e}=this,t=s(e)&&"datetime-picker"===e.input?.type?e.input.includeTime:void 0;return void 0===t||t}get label(){return s(this.fieldElement)&&this.fieldElement.label||this.field.alias||this.field.name}get maxLength(){const e=-1;if(this.type===j.Date)return e;const{field:t,fieldElement:i}=this,r=t?.length,n=s(i)&&q(i.input)?i.input.maxLength:NaN;return!isNaN(n)&&n>=e&&(r===e||n<=r)?n:r}get minLength(){const e=-1;if(this.type===j.Date)return e;const{field:t,fieldElement:i}=this,r=t?.length,n=s(i)&&q(i.input)?i.input.minLength:NaN;return!isNaN(n)&&n>=e&&(r===e||n<=r)?n:e}get name(){return this.field?.name}get required(){const{editable:e,evaluatedRequiredExpression:t,field:i,visible:r}=this;return!!e&&(!1===i?.nullable||!(!r||!s(t))&&t)}set required(e){this._overrideIfSome("required",e)}get spatialReference(){return this.layer?.spatialReference??null}set spatialReference(e){this._override("spatialReference",e)}get submittable(){const{field:e,required:t,valid:i,value:n}=this;return(!t||!r(n))&&(!!i||this.initialFeature.getAttribute(e.name)===n)}get type(){const{field:e}=this;return f(e)?j.Number:g(e)?j.Text:v(e)?j.Date:j.Unsupported}get valid(){const e=this.editable?this._validate():null;return this._set("error",e),null===e}get value(){if(this._shouldUseValueExpression()){const e=this.evaluatedValueExpression;return this.type===j.Date&&e instanceof Date?e.getTime():s(e)&&"object"==typeof e?e.toString():e}return this.get("_storedValue")}set value(e){this.notifyChange("evaluatedVisibilityExpression"),this.set("_storedValue",e)}get visible(){return!this._isEditorField()&&(s(this.evaluatedVisibilityExpression)?this.evaluatedVisibilityExpression:!!s(this.fieldElement)||this._isVisibleByDefault())}_isDomainCompatible(e){const{field:t}=this;if("coded-value"===e?.type){const i=typeof e.codedValues[0].code;if("string"===i&&g(t)||"number"===i&&f(t))return!0}return!!("range"===e?.type&&f(t)||v(t))}_validate(){const{domain:e,field:t,initialFeature:i,minLength:r,required:n,type:s,valid:o,value:l}=this,a=n&&null===l,u=void 0!==o;return!a&&i.getAttribute(t.name)===l&&u?null:a?E.INVALID_TYPE:"text"===s&&r>-1&&"string"==typeof l&&l.length<r?U.TOO_SHORT:e?null!==l||n?h(e,l):null:_(t,l)}_isVisibleByDefault(){const e=this.field?.type;return"oid"!==e&&"global-id"!==e&&!this._isGeometryField()}_isEditorField(){return x(this.layer).includes(this.name)}_isGeometryField(){return b(this.layer).includes(this.name)}_shouldUseValueExpression(){const e=this._layerFieldAllowsEdits&&!this._configAllowsEdits&&s(this.valueFunction);return e?this._registerExpressionWithTrackingProvider("value"):this._unregisterExpressionWithTrackingProvider("value"),e}_toErrorMessage(){const{domain:e,field:t,messages:i,minLength:r,value:n,required:s,type:o}=this,l=this.error;if(s&&null===n)return i.validationErrors.cannotBeNull;if(l===m.VALUE_OUT_OF_RANGE||l===F.OUT_OF_RANGE){const r=y(e)||T(t);return O(i.validationErrors.outsideRange,r,{format:{max:"date"===o?C:N(r.max)?D:A,min:"date"===o?C:N(r.min)?D:A}})}return l===m.INVALID_CODED_VALUE?i.validationErrors.invalidCodedValue:l===E.INVALID_TYPE?i.validationErrors.invalidType:l===U.TOO_SHORT?O(i.validationErrors.tooShort,{min:r}):null}_registerExpressionWithTrackingProvider(e){const{_expressionTrackingHandles:t,expressionTrackingProvider:i}=this;if(r(i)||t.has(e))return;const n=i.registerExpression((()=>{this.notifyChange("_arcadeContext")}));t.set(e,n)}_unregisterExpressionWithTrackingProvider(e){const{_expressionTrackingHandles:t}=this,i=t.get(e);i&&(i.remove(),t.delete(e))}};function q(e){return!!e&&"maxLength"in e}e([d()],k.prototype,"_storedValue",void 0),e([d()],k.prototype,"_arcadeContext",null),e([d()],k.prototype,"_configAllowsEdits",null),e([d()],k.prototype,"_layerFieldAllowsEdits",null),e([d()],k.prototype,"arcade",void 0),e([d()],k.prototype,"arcadeContextVars",void 0),e([d()],k.prototype,"editableFunction",void 0),e([d()],k.prototype,"requiredFunction",void 0),e([d()],k.prototype,"expressionTrackingProvider",void 0),e([d()],k.prototype,"valueFunction",void 0),e([d()],k.prototype,"isUsingValueExpression",null),e([d()],k.prototype,"visibilityFunction",void 0),e([d()],k.prototype,"evaluatedEditableExpression",null),e([d()],k.prototype,"evaluatedRequiredExpression",null),e([d()],k.prototype,"evaluatedVisibilityExpression",null),e([d()],k.prototype,"evaluatedValueExpression",null),e([d()],k.prototype,"feature",void 0),e([d()],k.prototype,"field",void 0),e([d()],k.prototype,"fieldElement",void 0),e([d()],k.prototype,"initialFeature",null),e([d()],k.prototype,"layer",void 0),e([d({readOnly:!0})],k.prototype,"description",null),e([d()],k.prototype,"domain",null),e([d()],k.prototype,"editable",null),e([d({readOnly:!0})],k.prototype,"inputType",null),e([d({readOnly:!0})],k.prototype,"error",void 0),e([d({dependsOn:["error","messages","value"]})],k.prototype,"errorMessage",null),e([d()],k.prototype,"group",void 0),e([d({readOnly:!0})],k.prototype,"hint",null),e([d()],k.prototype,"includeTime",null),e([d()],k.prototype,"label",null),e([d()],k.prototype,"maxLength",null),e([d()],k.prototype,"minLength",null),e([d()],k.prototype,"messages",void 0),e([d({readOnly:!0})],k.prototype,"name",null),e([d()],k.prototype,"required",null),e([d()],k.prototype,"spatialReference",null),e([d()],k.prototype,"submittable",null),e([d()],k.prototype,"type",null),e([d()],k.prototype,"valid",null),e([d({value:null})],k.prototype,"value",null),e([d()],k.prototype,"visible",null),k=e([p("esri.widgets.FeatureForm.InputField")],k);const L=k;export{L 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.25/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import i from"../../core/Accessor.js";import{HandleOwnerMixin as t}from"../../core/HandleOwner.js";import{isNone as s,unwrap as r,isSome as o,applySome as n}from"../../core/maybe.js";import{watch as a,syncAndInitial as l}from"../../core/reactiveUtils.js";import{property as p}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as c}from"../../core/accessorSupport/decorators/subclass.js";const u=["visibility"];let d=class extends(t(i)){constructor(e){super(e),this._expressionTrackingHandles=new Map,this.arcade=null,this.expressionTrackingProvider=null,this.feature=null,this.groupElement=null,this.spatialReference=null}initialize(){this.addHandles([...u.map((e=>a((()=>this.get(`${e}Function`)),(i=>{o(i)?this._registerExpressionWithTrackingProvider(e):this._unregisterExpressionWithTrackingProvider(e)}),l))),a((()=>[this.visible,this.inputFields]),(([e])=>{const{inputFields:i}=this,t=!!e&&void 0;for(const s of i)s.required=t}),{initial:!0,equals:(e,i)=>i[0]===e[0]&&i[1]===e[1]})])}destroy(){for(const e of this._expressionTrackingHandles.values())e.remove()}get _arcadeContext(){const{arcade:e,arcadeContextVars:i,feature:t,initialFeature:n,spatialReference:a}=this;if(s(e))return{};const{attributes:l,geometry:p,layer:c}=n??{},u=e.arcadeUtils.createFeature(l,r(p),o(c)&&"fields"in c?c:null),d=e.arcadeUtils.getViewInfo({spatialReference:r(a)}),h=e.arcadeUtils.createExecContext(t,d),v=Object.fromEntries(Array.from(Object.entries(i)).map((i=>[i[0],e.arcadeUtils.convertJsonToArcade(i[1])])));return h.vars={...h.vars,...v,$originalfeature:u},h}get visibilityExpression(){return r(this.groupElement)?.visibilityExpression}set visibilityExpression(e){n(this.groupElement,(i=>{i.visibilityExpression=e}))}set visibilityFunction(e){this._set("visibilityFunction",e),o(e)?this._registerExpressionWithTrackingProvider("visibility"):this._unregisterExpressionWithTrackingProvider("visibility")}get evaluatedVisibilityExpression(){const{visibilityFunction:e}=this;if(s(e))return;const{arcade:i,_arcadeContext:t}=this;return i.arcadeUtils.executeFunction(e,t)}get description(){return r(this.groupElement)?.description}set description(e){n(this.groupElement,(i=>{i.description=e}))}get inputFields(){return this._get("inputFields")}set inputFields(e){this.handles.removeAll(),e&&this.handles.add(e.map((e=>a((()=>e.visible),(()=>this._dirtyEvaluatedVisibilityExpression()))))),this._set("inputFields",e)}get label(){return r(this.groupElement)?.label}set label(e){n(this.groupElement,(i=>{i.label=e}))}get state(){return o(this.groupElement)&&this.groupElement.initialState||"expanded"}set state(e){this._overrideIfSome("state",e)}get visible(){return!1!==this.evaluatedVisibilityExpression&&this.inputFields&&this.inputFields.some((e=>e.visible))}_registerExpressionWithTrackingProvider(e){const{_expressionTrackingHandles:i,expressionTrackingProvider:t}=this;if(s(t)||i.has(e))return;const r=`evaluated${h(e)}Expression`,o=t.registerExpression((()=>this.notifyChange(r)));i.set(e,o)}_unregisterExpressionWithTrackingProvider(e){const{_expressionTrackingHandles:i}=this,t=i.get(e);t&&(t.remove(),i.delete(e))}_dirtyEvaluatedVisibilityExpression(){const{groupElement:e}=this;o(e)&&e.visibilityExpression&&this.notifyChange("evaluatedVisibilityExpression")}};e([p()],d.prototype,"_arcadeContext",null),e([p()],d.prototype,"arcade",void 0),e([p()],d.prototype,"arcadeContextVars",void 0),e([p()],d.prototype,"visibilityExpression",null),e([p()],d.prototype,"visibilityFunction",null),e([p()],d.prototype,"evaluatedVisibilityExpression",null),e([p()],d.prototype,"description",null),e([p()],d.prototype,"expressionTrackingProvider",void 0),e([p()],d.prototype,"feature",void 0),e([p()],d.prototype,"groupElement",void 0),e([p()],d.prototype,"initialFeature",void 0),e([p()],d.prototype,"inputFields",null),e([p()],d.prototype,"label",null),e([p()],d.prototype,"spatialReference",void 0),e([p()],d.prototype,"state",null),e([p()],d.prototype,"visible",null),d=e([c("esri.widgets.FeatureForm.InputFieldGroup")],d);const h=e=>e.charAt(0).toUpperCase()+e.slice(1),v=d;export{v as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import i from"../../core/Accessor.js";import{HandleOwnerMixin as t}from"../../core/HandleOwner.js";import{isNone as r,unwrap as s,isSome as o,applySome as n}from"../../core/maybe.js";import{watch as a,syncAndInitial as l}from"../../core/reactiveUtils.js";import{property as p}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as c}from"../../core/accessorSupport/decorators/subclass.js";import{isFormExpressionArcadeExecutor as u}from"./FormExpressionArcadeExecutor.js";const d=["visibility"];let h=class extends(t(i)){constructor(e){super(e),this._expressionTrackingHandles=new Map,this.arcade=null,this.expressionTrackingProvider=null,this.feature=null,this.groupElement=null,this.spatialReference=null}initialize(){this.addHandles([...d.map((e=>a((()=>this.get(`${e}Function`)),(i=>{o(i)?this._registerExpressionWithTrackingProvider(e):this._unregisterExpressionWithTrackingProvider(e)}),l))),a((()=>[this.visible,this.inputFields]),(([e])=>{const{inputFields:i}=this,t=!!e&&void 0;for(const r of i)r.required=t}),{initial:!0,equals:(e,i)=>i[0]===e[0]&&i[1]===e[1]})])}destroy(){for(const e of this._expressionTrackingHandles.values())e.remove()}get _arcadeContext(){const{arcade:e,arcadeContextVars:i,feature:t,initialFeature:n,spatialReference:a}=this;if(r(e))return{};const{attributes:l,geometry:p,layer:c}=n??{},u=e.arcadeUtils.createFeature(l,s(p),o(c)&&"fields"in c?c:null),d=e.arcadeUtils.getViewInfo({spatialReference:s(a)}),h=e.arcadeUtils.createExecContext(t,d),v=Object.fromEntries(Array.from(Object.entries(i)).map((i=>[i[0],e.arcadeUtils.convertJsonToArcade(i[1])])));return h.vars={...h.vars,...v,$originalfeature:u},h}get visibilityExpression(){return s(this.groupElement)?.visibilityExpression}set visibilityExpression(e){n(this.groupElement,(i=>{i.visibilityExpression=e}))}set visibilityFunction(e){this._set("visibilityFunction",e),o(e)?this._registerExpressionWithTrackingProvider("visibility"):this._unregisterExpressionWithTrackingProvider("visibility")}get evaluatedVisibilityExpression(){const{visibilityFunction:e}=this;if(r(e))return null;if(u(e))return!!e.lastEvaluatedValue;const{arcade:i,_arcadeContext:t}=this;return i.arcadeUtils.executeFunction(e.compiledScript,t)}get description(){return s(this.groupElement)?.description}set description(e){n(this.groupElement,(i=>{i.description=e}))}get inputFields(){return this._get("inputFields")}set inputFields(e){this.handles.removeAll(),e&&this.handles.add(e.map((e=>a((()=>e.visible),(()=>this._dirtyEvaluatedVisibilityExpression()))))),this._set("inputFields",e)}get label(){return s(this.groupElement)?.label}set label(e){n(this.groupElement,(i=>{i.label=e}))}get state(){return o(this.groupElement)&&this.groupElement.initialState||"expanded"}set state(e){this._overrideIfSome("state",e)}get visible(){return!1!==this.evaluatedVisibilityExpression&&this.inputFields&&this.inputFields.some((e=>e.visible))}_registerExpressionWithTrackingProvider(e){const{_expressionTrackingHandles:i,expressionTrackingProvider:t}=this;if(r(t)||i.has(e))return;const s=`evaluated${v(e)}Expression`,o=t.registerExpression((()=>this.notifyChange(s)));i.set(e,o)}_unregisterExpressionWithTrackingProvider(e){const{_expressionTrackingHandles:i}=this,t=i.get(e);t&&(t.remove(),i.delete(e))}_dirtyEvaluatedVisibilityExpression(){const{groupElement:e}=this;o(e)&&e.visibilityExpression&&this.notifyChange("evaluatedVisibilityExpression")}};e([p()],h.prototype,"_arcadeContext",null),e([p()],h.prototype,"arcade",void 0),e([p()],h.prototype,"arcadeContextVars",void 0),e([p()],h.prototype,"visibilityExpression",null),e([p()],h.prototype,"visibilityFunction",null),e([p()],h.prototype,"evaluatedVisibilityExpression",null),e([p()],h.prototype,"description",null),e([p()],h.prototype,"expressionTrackingProvider",void 0),e([p()],h.prototype,"feature",void 0),e([p()],h.prototype,"groupElement",void 0),e([p()],h.prototype,"initialFeature",void 0),e([p()],h.prototype,"inputFields",null),e([p()],h.prototype,"label",null),e([p()],h.prototype,"spatialReference",void 0),e([p()],h.prototype,"state",null),e([p()],h.prototype,"visible",null),h=e([c("esri.widgets.FeatureForm.InputFieldGroup")],h);const v=e=>e.charAt(0).toUpperCase()+e.slice(1),g=h;export{g 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.25/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{HandleOwnerMixin as t}from"../core/HandleOwner.js";import{isSome as i}from"../core/maybe.js";import{on as l,watch as o}from"../core/reactiveUtils.js";import{property as s}from"../core/accessorSupport/decorators/property.js";import"../core/arrayUtils.js";import"../core/has.js";import{cast as n}from"../core/accessorSupport/decorators/cast.js";import{subclass as r}from"../core/accessorSupport/decorators/subclass.js";import a from"./Widget.js";import d from"./FeatureTable/FeatureTableViewModel.js";import c from"./FeatureTable/Grid/support/ButtonMenu.js";import h from"./FeatureTable/Grid/support/ButtonMenuItem.js";import{Heading as u}from"./support/Heading.js";import"./support/widgetUtils.js";import{messageBundle as m}from"./support/decorators/messageBundle.js";import{tsx as p}from"./support/jsxFactory.js";import{onLocaleChange as g}from"../intl/locale.js";import{substitute as b}from"../intl/substitute.js";import{fetchMessageBundle as w}from"../intl/messages.js";const v={header:!0,menu:!0,menuItems:{clearSelection:!0,refreshData:!0,toggleColumns:!0,selectedRecordsShowAllToggle:!0,selectedRecordsShowSelectedToggle:!0,zoomToSelection:!0,deleteSelection:!0},selectionColumn:!0,columnMenus:!0},_={base:"esri-feature-table",header:"esri-feature-table__header",title:"esri-feature-table__title",content:"esri-feature-table__content",loader:"esri-feature-table__loader",loaderContainer:"esri-feature-table__loader-container",menuContainer:"esri-feature-table__menu",menuIcon:"esri-icon-handle-horizontal",menuItemGroupOpenedIcon:"esri-icon-down",menuItemGroupClosedIcon:"esri-icon-right",checkmarkIcon:"esri-icon-check-mark",promptContainer:"esri-feature-table__prompt",promptHeader:"esri-feature-table__prompt__header",promptHeading:"esri-feature-table__prompt__header__heading",promptMessage:"esri-feature-table__prompt__message",promptDivider:"esri-feature-table__prompt__divider",promptActions:"esri-feature-table__prompt__actions",widget:"esri-widget"};let f=class extends(t(a)){constructor(e,t){super(e,t),this._prompt=null,this.messages=null,this.messagesCommon=null,this.menu=null,this.menuConfig=null,this.viewModel=new d,this.visibleElements={...v},this._showDeletePrompt=this._showDeletePrompt.bind(this),this._onDeleteSelectionClick=this._onDeleteSelectionClick.bind(this)}initialize(){const e=async()=>this.messages=await w("esri/widgets/FeatureTable/t9n/FeatureTable");e(),this.handles.add([g(e),l((()=>this.viewModel.columns),"change",(()=>this._syncMenuConfig())),l((()=>this.viewModel.activeFilters),"change",(()=>this._syncMenuConfig())),l((()=>this.grid.selectedItems),"change",(e=>{this._syncMenuConfig(),this._onSelectionChange(e)})),o((()=>[this.viewModel.store.querying,this.viewModel.store.syncing,this.editingEnabled]),(()=>this.scheduleRender())),o((()=>[this.menuConfig,this.editingEnabled]),(()=>this._syncMenuConfig())),o((()=>this.messages),(()=>{this.menu.label=this.messages?.options,this._syncMenuConfig()}))]),this._set("menu",new c({label:this.messages?.options,iconClass:_.menuIcon,...this.menuConfig}));const{attachmentsEnabled:t,relatedRecordsEnabled:i}=this;this.viewModel?.store?.set({attachmentsEnabled:t,relatedRecordsEnabled:i})}loadDependencies(){return Promise.all([import("@esri/calcite-components/dist/components/calcite-scrim.js"),import("@esri/calcite-components/dist/components/calcite-button.js"),import("@esri/calcite-components/dist/components/calcite-icon.js")])}destroy(){this._prompt=null,this.clearSelection(),this.handles.removeAll(),this.menu?.destroy()}get activeSortOrders(){return this.viewModel.activeSortOrders}get attachmentsEnabled(){return this.viewModel.attachmentsEnabled}set attachmentsEnabled(e){this.viewModel.attachmentsEnabled=e}get autoRefreshEnabled(){return this.viewModel.autoRefreshEnabled}set autoRefreshEnabled(e){this.viewModel.autoRefreshEnabled=e}get columnReorderingEnabled(){return this.viewModel.columnReorderingEnabled}set columnReorderingEnabled(e){this.viewModel.columnReorderingEnabled=e}get columns(){return this.viewModel.columns}get editingEnabled(){return this.viewModel.editingEnabled}set editingEnabled(e){this.viewModel.editingEnabled=e}get fieldConfigs(){return this.viewModel.fieldConfigs}set fieldConfigs(e){this.viewModel.fieldConfigs=e}get filterGeometry(){return this.viewModel.filterGeometry}set filterGeometry(e){this.viewModel.filterGeometry=e}get grid(){return this.viewModel.grid}get hiddenFields(){return this.viewModel.hiddenFields}set hiddenFields(e){this.viewModel.hiddenFields=e}get highlightOnRowSelectEnabled(){return this.viewModel.highlightOnRowSelectEnabled}set highlightOnRowSelectEnabled(e){this.viewModel.highlightOnRowSelectEnabled=e}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get multiSortEnabled(){return this.viewModel.multiSortEnabled}set multiSortEnabled(e){this.viewModel.multiSortEnabled=e}get pageSize(){return this.viewModel.pageSize}set pageSize(e){this.viewModel.pageSize=e}get relatedRecordsEnabled(){return this.viewModel.relatedRecordsEnabled}set relatedRecordsEnabled(e){this.viewModel.relatedRecordsEnabled=e}get selectedRowIds(){return this.viewModel.selectedRowIds}get state(){return this.viewModel.state}get tableTemplate(){return this.viewModel.tableTemplate}set tableTemplate(e){this.viewModel.tableTemplate=e}get timeExtent(){return this.viewModel.timeExtent}set timeExtent(e){this.viewModel.timeExtent=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}castVisibleElements(e){const t={...v,...e};return this.grid?.set("visibleElements",{...this.grid.visibleElements,selectionColumn:t.selectionColumn,columnMenus:t.columnMenus}),t}clearHighlights(){return this.viewModel.clearHighlights()}clearSelection(){return this.viewModel.clearSelection()}clearSelectionFilter(){return this.viewModel.clearSelectionFilter()}deselectRows(e){return this.viewModel.deselectRows(e)}filterBySelection(){return this.viewModel.filterBySelection()}findColumn(e){return this.viewModel.findColumn(e)}hideColumn(e){this.grid?.hideColumn(e),this._syncMenuConfig()}refresh(){return this.viewModel.refresh()}showAllColumns(){return this.viewModel.showAllColumns()}showColumn(e){this.grid?.showColumn(e),this._syncMenuConfig()}sortColumn(e,t){return this.viewModel.sortColumn(e,t)}selectRows(e){return this.viewModel.selectRows(e)}scrollToIndex(e){return this.viewModel.scrollToIndex(e)}zoomToSelection(){return this.viewModel.zoomToSelection()}render(){const{_prompt:e}=this,t=i(e)?p("calcite-scrim",null,this.renderPrompt(e)):null;return p("div",{bind:this,class:this.classes(_.base,_.widget)},this.visibleElements.header?this._renderHeader():null,p("div",{class:_.content},"disabled"!==this.state&&this.grid?.render()),t)}renderPrompt({title:e,message:t,context:i,actions:l}){const o=!!l.secondary,s=p("calcite-button",{appearance:"solid",color:"danger"===i?"red":"blue",width:o?"half":"full",onclick:l.primary.action,key:"prompt-primary-button"},l.primary.label),n=o?p("calcite-button",{appearance:"clear",color:"danger"===i?"red":"blue",width:"half",onclick:l.secondary.action,key:"prompt-secondary-button"},l.secondary.label):null;return p("div",{class:`${_.promptContainer}--${i}`},p("div",{class:_.promptHeader},p("calcite-icon",{icon:"exclamation-mark-triangle"}),p(u,{class:_.promptHeading,level:2},e)),p("div",{class:_.promptMessage},t),p("div",{class:_.promptDivider}),p("div",{class:_.promptActions},n,s))}_renderHeader(){return p("div",{key:"header",class:_.header},this._renderLoader(),this._renderTitle(),this.visibleElements.menu?this._renderMenu():null)}_renderTitle(){return p("div",{class:_.title,key:"title"},this._getTitle())}_getTitle(){const{grid:e,layer:t,messages:i,viewModel:{size:l}}=this;return e&&t?b(i.header,{title:t.title,count:l,selected:e.selectedItems.length||0}):""}_renderLoader(){const{state:e,store:t}=this.viewModel,i="loading"===e||t.syncing||t.querying;return p("div",{class:_.loaderContainer},i?p("div",{class:_.loader,key:"loader"}):null)}_renderMenu(){return p("div",{class:_.menuContainer},this.menu.render())}_onSelectionChange(e){const{added:t,removed:i}=e;this.emit("selection-change",{added:[...t],removed:[...i]})}_syncMenuConfig(){this.menu?.set({...this.menuConfig,items:this._getMenuItems()})}_getMenuItems(){const e=this.menuConfig?.items,t=this._getDefaultMenuItems(),i=[];return t?.length&&i.push(...t),e?.length&&i.push(...e),i}_getDefaultMenuItems(){const{messages:e,viewModel:t,visibleElements:i}=this,{menuItems:l}=i,o=[];if(l?.refreshData&&o.push(new h({selectionEnabled:!1,label:e?.refreshData,clickFunction:()=>this.refresh()})),this._hasActiveSelection()){const t=this.grid.selectedItems.length,i=this._getSelectionFilter();if(l?.clearSelection&&o.push(new h({selectionEnabled:!1,label:e?.clearSelection,clickFunction:()=>this.clearSelection()})),l?.zoomToSelection&&this.view&&o.push(new h({selectionEnabled:!1,label:e?.zoomToSelection,clickFunction:()=>this.viewModel.zoomToSelection()})),l?.selectedRecordsShowSelectedToggle&&(!i||t!==i.objectIds.length)){const t=e.showSelected,i=new h({selectionEnabled:!1,label:t,clickFunction:()=>{this.filterBySelection(),i.set("label",t)}});o.push(i)}l?.deleteSelection&&this.editingEnabled&&this.layer?.capabilities?.operations?.supportsDelete&&o.push(new h({selectionEnabled:!1,label:e.deleteSelection,clickFunction:this._showDeletePrompt}))}if(l?.selectedRecordsShowAllToggle&&this._hasSelectionFilter()){const t=e.showAllRecords,i=new h({selectionEnabled:!1,label:t,clickFunction:()=>{this.clearSelectionFilter(),i.set("label",t)}});o.push(i)}return l?.toggleColumns&&o.push(new h({iconClass:_.menuItemGroupClosedIcon,label:e?.toggleColumns,clickFunction:this._toggleMenuItemSelectedIcon,items:t?.columns?.items.map((({header:e,hidden:t,path:i})=>new h({label:e||i,selected:!t,selectionEnabled:!0,iconClass:_.checkmarkIcon,clickFunction:()=>this._toggleColumnFromMenuItem(i)})))})),o.length?o:null}_toggleMenuItemSelectedIcon({item:e}){e?.set("iconClass",e?.selected?_.menuItemGroupOpenedIcon:_.menuItemGroupClosedIcon)}_toggleColumnFromMenuItem(e){const{grid:t,viewModel:i}=this;i.findColumn(e)?.hidden?t.showColumn(e):t.hideColumn(e)}_showDeletePrompt(){const{messages:e,messagesCommon:t}=this,i=this.selectedRowIds.length||0,l=b(e.deleteSelectionCount,{count:i});this.menu.open=!1,this._prompt={title:l,message:e.deleteRecordsRemoved,context:"danger",actions:{primary:{label:t.delete,action:this._onDeleteSelectionClick},secondary:{label:e.keepRecords,action:()=>this._prompt=null}}}}async _onDeleteSelectionClick(){await this.viewModel.deleteSelection(),this._prompt=null}_hasActiveSelection(){return!!this.grid?.selectedItems?.length}_getSelectionFilter(){return this.viewModel.activeFilters?.find((e=>"selection"===e.type))}_hasSelectionFilter(){return!!this._getSelectionFilter()}};e([s({readOnly:!0})],f.prototype,"activeSortOrders",null),e([s()],f.prototype,"attachmentsEnabled",null),e([s()],f.prototype,"autoRefreshEnabled",null),e([s()],f.prototype,"columnReorderingEnabled",null),e([s({readOnly:!0})],f.prototype,"columns",null),e([s()],f.prototype,"editingEnabled",null),e([s()],f.prototype,"fieldConfigs",null),e([s()],f.prototype,"filterGeometry",null),e([s({readOnly:!0})],f.prototype,"grid",null),e([s()],f.prototype,"hiddenFields",null),e([s()],f.prototype,"highlightOnRowSelectEnabled",null),e([s()],f.prototype,"label",null),e([s()],f.prototype,"layer",null),e([s(),m("esri/widgets/FeatureTable/t9n/FeatureTable")],f.prototype,"messages",void 0),e([s(),m("esri/t9n/common")],f.prototype,"messagesCommon",void 0),e([s({readOnly:!0})],f.prototype,"menu",void 0),e([s()],f.prototype,"menuConfig",void 0),e([s()],f.prototype,"multiSortEnabled",null),e([s()],f.prototype,"pageSize",null),e([s()],f.prototype,"relatedRecordsEnabled",null),e([s({readOnly:!0})],f.prototype,"selectedRowIds",null),e([s({readOnly:!0})],f.prototype,"state",null),e([s()],f.prototype,"tableTemplate",null),e([s()],f.prototype,"timeExtent",null),e([s()],f.prototype,"view",null),e([s()],f.prototype,"viewModel",void 0),e([s()],f.prototype,"visibleElements",void 0),e([n("visibleElements")],f.prototype,"castVisibleElements",null),f=e([r("esri.widgets.FeatureTable")],f);const M=f;export{M as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{HandleOwnerMixin as t}from"../core/HandleOwner.js";import{isSome as i}from"../core/maybe.js";import{on as l,watch as s}from"../core/reactiveUtils.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import"../core/arrayUtils.js";import"../core/has.js";import{cast as n}from"../core/accessorSupport/decorators/cast.js";import{subclass as r}from"../core/accessorSupport/decorators/subclass.js";import a from"./Widget.js";import d from"./FeatureTable/FeatureTableViewModel.js";import c from"./FeatureTable/Grid/support/ButtonMenu.js";import h from"./FeatureTable/Grid/support/ButtonMenuItem.js";import{Heading as u}from"./support/Heading.js";import"./support/widgetUtils.js";import{messageBundle as m}from"./support/decorators/messageBundle.js";import{tsx as p}from"./support/jsxFactory.js";import{onLocaleChange as g}from"../intl/locale.js";import{substitute as b}from"../intl/substitute.js";import{fetchMessageBundle as w}from"../intl/messages.js";const v={header:!0,menu:!0,menuItems:{clearSelection:!0,refreshData:!0,toggleColumns:!0,selectedRecordsShowAllToggle:!0,selectedRecordsShowSelectedToggle:!0,zoomToSelection:!0,deleteSelection:!0},selectionColumn:!0,columnMenus:!0},_={base:"esri-feature-table",header:"esri-feature-table__header",title:"esri-feature-table__title",content:"esri-feature-table__content",loader:"esri-feature-table__loader",loaderContainer:"esri-feature-table__loader-container",menuContainer:"esri-feature-table__menu",menuIcon:"esri-icon-handle-horizontal",menuItemGroupOpenedIcon:"esri-icon-down",menuItemGroupClosedIcon:"esri-icon-right",checkmarkIcon:"esri-icon-check-mark",promptContainer:"esri-feature-table__prompt",promptHeader:"esri-feature-table__prompt__header",promptHeading:"esri-feature-table__prompt__header__heading",promptMessage:"esri-feature-table__prompt__message",promptDivider:"esri-feature-table__prompt__divider",promptActions:"esri-feature-table__prompt__actions",widget:"esri-widget"};let M=class extends(t(a)){constructor(e,t){super(e,t),this._prompt=null,this.messages=null,this.messagesCommon=null,this.menu=null,this.menuConfig=null,this.viewModel=new d,this.visibleElements={...v},this._showDeletePrompt=this._showDeletePrompt.bind(this),this._onDeleteSelectionClick=this._onDeleteSelectionClick.bind(this)}initialize(){const e=async()=>this.messages=await w("esri/widgets/FeatureTable/t9n/FeatureTable");e(),this.handles.add([g(e),l((()=>this.viewModel.columns),"change",(()=>this._syncMenuConfig())),l((()=>this.viewModel.activeFilters),"change",(()=>this._syncMenuConfig())),l((()=>this.grid.selectedItems),"change",(e=>{this._syncMenuConfig(),this._onSelectionChange(e)})),s((()=>[this.viewModel.store.querying,this.viewModel.store.syncing,this.editingEnabled]),(()=>this.scheduleRender())),s((()=>[this.menuConfig,this.editingEnabled]),(()=>this._syncMenuConfig())),s((()=>this.messages),(()=>{this.menu.label=this.messages?.options,this._syncMenuConfig()}))]),this._set("menu",new c({label:this.messages?.options,iconClass:_.menuIcon,...this.menuConfig}));const{attachmentsEnabled:t,relatedRecordsEnabled:i}=this;this.viewModel?.store?.set({attachmentsEnabled:t,relatedRecordsEnabled:i})}loadDependencies(){return Promise.all([import("@esri/calcite-components/dist/components/calcite-scrim.js"),import("@esri/calcite-components/dist/components/calcite-button.js"),import("@esri/calcite-components/dist/components/calcite-icon.js")])}destroy(){this._prompt=null,this.clearSelection(),this.handles.removeAll(),this.menu?.destroy()}get activeSortOrders(){return this.viewModel.activeSortOrders}get attachmentsEnabled(){return this.viewModel.attachmentsEnabled}set attachmentsEnabled(e){this.viewModel.attachmentsEnabled=e}get autoRefreshEnabled(){return this.viewModel.autoRefreshEnabled}set autoRefreshEnabled(e){this.viewModel.autoRefreshEnabled=e}get columnReorderingEnabled(){return this.viewModel.columnReorderingEnabled}set columnReorderingEnabled(e){this.viewModel.columnReorderingEnabled=e}get columns(){return this.viewModel.columns}get editingEnabled(){return this.viewModel.editingEnabled}set editingEnabled(e){this.viewModel.editingEnabled=e}get fieldConfigs(){return this.viewModel.fieldConfigs}set fieldConfigs(e){this.viewModel.fieldConfigs=e}get filterGeometry(){return this.viewModel.filterGeometry}set filterGeometry(e){this.viewModel.filterGeometry=e}get grid(){return this.viewModel.grid}get hiddenFields(){return this.viewModel.hiddenFields}set hiddenFields(e){this.viewModel.hiddenFields=e}get highlightOnRowSelectEnabled(){return this.viewModel.highlightOnRowSelectEnabled}set highlightOnRowSelectEnabled(e){this.viewModel.highlightOnRowSelectEnabled=e}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get multiSortEnabled(){return this.viewModel.multiSortEnabled}set multiSortEnabled(e){this.viewModel.multiSortEnabled=e}get pageSize(){return this.viewModel.pageSize}set pageSize(e){this.viewModel.pageSize=e}get relatedRecordsEnabled(){return this.viewModel.relatedRecordsEnabled}set relatedRecordsEnabled(e){this.viewModel.relatedRecordsEnabled=e}get selectedRowIds(){return this.viewModel.selectedRowIds}get state(){return this.viewModel.state}get tableTemplate(){return this.viewModel.tableTemplate}set tableTemplate(e){this.viewModel.tableTemplate=e}get timeExtent(){return this.viewModel.timeExtent}set timeExtent(e){this.viewModel.timeExtent=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}castVisibleElements(e){const t={...v,...e};return this.grid?.set("visibleElements",{...this.grid.visibleElements,selectionColumn:t.selectionColumn,columnMenus:t.columnMenus}),t}clearHighlights(){return this.viewModel.clearHighlights()}clearSelection(){return this.viewModel.clearSelection()}clearSelectionFilter(){return this.viewModel.clearSelectionFilter()}deleteSelection(e){return this.selectedRowIds?.length?e?(this._showDeletePrompt(),this.scheduleRender(),Promise.resolve()):this.viewModel.deleteSelection():Promise.resolve()}deselectRows(e){return this.viewModel.deselectRows(e)}filterBySelection(){return this.viewModel.filterBySelection()}findColumn(e){return this.viewModel.findColumn(e)}hideColumn(e){this.grid?.hideColumn(e),this._syncMenuConfig()}refresh(){return this.viewModel.refresh()}showAllColumns(){return this.viewModel.showAllColumns()}showColumn(e){this.grid?.showColumn(e),this._syncMenuConfig()}sortColumn(e,t){return this.viewModel.sortColumn(e,t)}selectRows(e){return this.viewModel.selectRows(e)}scrollToIndex(e){return this.viewModel.scrollToIndex(e)}zoomToSelection(){return this.viewModel.zoomToSelection()}render(){const{_prompt:e}=this,t=i(e)?p("calcite-scrim",null,this.renderPrompt(e)):null;return p("div",{bind:this,class:this.classes(_.base,_.widget)},this.visibleElements.header?this._renderHeader():null,p("div",{class:_.content},"disabled"!==this.state&&this.grid?.render()),t)}renderPrompt({title:e,message:t,context:i,actions:l}){const s=!!l.secondary,o=p("calcite-button",{appearance:"solid",color:"danger"===i?"red":"blue",width:s?"half":"full",onclick:l.primary.action,key:"prompt-primary-button"},l.primary.label),n=s?p("calcite-button",{appearance:"clear",color:"danger"===i?"red":"blue",width:"half",onclick:l.secondary.action,key:"prompt-secondary-button"},l.secondary.label):null;return p("div",{class:`${_.promptContainer}--${i}`},p("div",{class:_.promptHeader},p("calcite-icon",{icon:"exclamation-mark-triangle"}),p(u,{class:_.promptHeading,level:2},e)),p("div",{class:_.promptMessage},t),p("div",{class:_.promptDivider}),p("div",{class:_.promptActions},n,o))}_renderHeader(){return p("div",{key:"header",class:_.header},this._renderLoader(),this._renderTitle(),this.visibleElements.menu?this._renderMenu():null)}_renderTitle(){return p("div",{class:_.title,key:"title"},this._getTitle())}_getTitle(){const{grid:e,layer:t,messages:i,viewModel:{size:l}}=this;return e&&t?b(i.header,{title:t.title,count:l,selected:e.selectedItems.length||0}):""}_renderLoader(){const{state:e,store:t}=this.viewModel,i="loading"===e||t.syncing||t.querying;return p("div",{class:_.loaderContainer},i?p("div",{class:_.loader,key:"loader"}):null)}_renderMenu(){return p("div",{class:_.menuContainer},this.menu.render())}_onSelectionChange(e){const{added:t,removed:i}=e;this.emit("selection-change",{added:[...t],removed:[...i]})}_syncMenuConfig(){this.menu?.set({...this.menuConfig,items:this._getMenuItems()})}_getMenuItems(){const e=this.menuConfig?.items,t=this._getDefaultMenuItems(),i=[];return t?.length&&i.push(...t),e?.length&&i.push(...e),i}_getDefaultMenuItems(){const{messages:e,viewModel:t,visibleElements:i}=this,{menuItems:l}=i,s=[];if(l?.refreshData&&s.push(new h({selectionEnabled:!1,label:e?.refreshData,clickFunction:()=>this.refresh()})),this._hasActiveSelection()){const t=this.grid.selectedItems.length,i=this._getSelectionFilter();if(l?.clearSelection&&s.push(new h({selectionEnabled:!1,label:e?.clearSelection,clickFunction:()=>this.clearSelection()})),l?.zoomToSelection&&this.view&&s.push(new h({selectionEnabled:!1,label:e?.zoomToSelection,clickFunction:()=>this.viewModel.zoomToSelection()})),l?.selectedRecordsShowSelectedToggle&&(!i||t!==i.objectIds.length)){const t=e.showSelected,i=new h({selectionEnabled:!1,label:t,clickFunction:()=>{this.filterBySelection(),i.set("label",t)}});s.push(i)}l?.deleteSelection&&this.editingEnabled&&this.layer?.capabilities?.operations?.supportsDelete&&s.push(new h({selectionEnabled:!1,label:e.deleteSelection,clickFunction:this._showDeletePrompt}))}if(l?.selectedRecordsShowAllToggle&&this._hasSelectionFilter()){const t=e.showAllRecords,i=new h({selectionEnabled:!1,label:t,clickFunction:()=>{this.clearSelectionFilter(),i.set("label",t)}});s.push(i)}return l?.toggleColumns&&s.push(new h({iconClass:_.menuItemGroupClosedIcon,label:e?.toggleColumns,clickFunction:this._toggleMenuItemSelectedIcon,items:t?.columns?.items.map((({header:e,hidden:t,path:i})=>new h({label:e||i,selected:!t,selectionEnabled:!0,iconClass:_.checkmarkIcon,clickFunction:()=>this._toggleColumnFromMenuItem(i)})))})),s.length?s:null}_toggleMenuItemSelectedIcon({item:e}){e?.set("iconClass",e?.selected?_.menuItemGroupOpenedIcon:_.menuItemGroupClosedIcon)}_toggleColumnFromMenuItem(e){const{grid:t,viewModel:i}=this;i.findColumn(e)?.hidden?t.showColumn(e):t.hideColumn(e)}_showDeletePrompt(){const{messages:e,messagesCommon:t}=this,i=this.selectedRowIds.length||0,l=b(e.deleteSelectionCount,{count:i});this.menu.open=!1,this._prompt={title:l,message:e.deleteRecordsRemoved,context:"danger",actions:{primary:{label:t.delete,action:this._onDeleteSelectionClick},secondary:{label:e.keepRecords,action:()=>this._prompt=null}}}}async _onDeleteSelectionClick(){await this.viewModel.deleteSelection(),this._prompt=null}_hasActiveSelection(){return!!this.grid?.selectedItems?.length}_getSelectionFilter(){return this.viewModel.activeFilters?.find((e=>"selection"===e.type))}_hasSelectionFilter(){return!!this._getSelectionFilter()}};e([o({readOnly:!0})],M.prototype,"activeSortOrders",null),e([o()],M.prototype,"attachmentsEnabled",null),e([o()],M.prototype,"autoRefreshEnabled",null),e([o()],M.prototype,"columnReorderingEnabled",null),e([o({readOnly:!0})],M.prototype,"columns",null),e([o()],M.prototype,"editingEnabled",null),e([o()],M.prototype,"fieldConfigs",null),e([o()],M.prototype,"filterGeometry",null),e([o({readOnly:!0})],M.prototype,"grid",null),e([o()],M.prototype,"hiddenFields",null),e([o()],M.prototype,"highlightOnRowSelectEnabled",null),e([o()],M.prototype,"label",null),e([o()],M.prototype,"layer",null),e([o(),m("esri/widgets/FeatureTable/t9n/FeatureTable")],M.prototype,"messages",void 0),e([o(),m("esri/t9n/common")],M.prototype,"messagesCommon",void 0),e([o({readOnly:!0})],M.prototype,"menu",void 0),e([o()],M.prototype,"menuConfig",void 0),e([o()],M.prototype,"multiSortEnabled",null),e([o()],M.prototype,"pageSize",null),e([o()],M.prototype,"relatedRecordsEnabled",null),e([o({readOnly:!0})],M.prototype,"selectedRowIds",null),e([o({readOnly:!0})],M.prototype,"state",null),e([o()],M.prototype,"tableTemplate",null),e([o()],M.prototype,"timeExtent",null),e([o()],M.prototype,"view",null),e([o()],M.prototype,"viewModel",void 0),e([o()],M.prototype,"visibleElements",void 0),e([n("visibleElements")],M.prototype,"castVisibleElements",null),M=e([r("esri.widgets.FeatureTable")],M);const f=M;export{f as default};