@arcgis/core 4.28.0-next.20230818 → 4.28.0-next.20230821

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 (200) hide show
  1. package/arcade/functions/centroid.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/003744a45b07865f1be9.js +1 -0
  4. package/assets/esri/core/workers/chunks/034accc7cab6c88a3b31.js +1 -0
  5. package/assets/esri/core/workers/chunks/05ab09713d599687afa3.js +1 -0
  6. package/assets/esri/core/workers/chunks/{3724f23b6f5ac8ec2568.js → 12b8fe0374fa9ab4ca09.js} +1 -1
  7. package/assets/esri/core/workers/chunks/16d1a72014074e87ecb9.js +1 -0
  8. package/assets/esri/core/workers/chunks/{e4b6565c16430b28ad93.js → 19857e5420cdf23c5f2e.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{1a804dea42c0fb5e5c07.js → 1bab408eaffd2c18976d.js} +1 -1
  10. package/assets/esri/core/workers/chunks/201365f53509e3f78e17.js +1 -0
  11. package/assets/esri/core/workers/chunks/{2031451b82ff70fb201a.js → 2f48f4a9a0a056ac5e1c.js} +1 -1
  12. package/assets/esri/core/workers/chunks/318b51fdee09c1fd750f.js +1 -0
  13. package/assets/esri/core/workers/chunks/{5b799dc155adeb728c74.js → 3361e3e8385f8de8820c.js} +1 -1
  14. package/assets/esri/core/workers/chunks/3ce1870c28ab6ac3648e.js +1 -0
  15. package/assets/esri/core/workers/chunks/41929e4531787389804b.js +1 -0
  16. package/assets/esri/core/workers/chunks/{55ac725127c5ea9fb942.js → 4e39252f40bc57be9d12.js} +1 -1
  17. package/assets/esri/core/workers/chunks/4e496b03ce24b1206f86.js +1 -0
  18. package/assets/esri/core/workers/chunks/{ee5f17c1790dc07f9d9e.js → 50455c84131b634ca6b4.js} +1 -1
  19. package/assets/esri/core/workers/chunks/54513578f735d274a20e.js +1 -0
  20. package/assets/esri/core/workers/chunks/{d46f8ef92e79d12384c9.js → 587437526ea77f764986.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{ab720e2f0a35138564b2.js → 5ffabd1a90c5b08109aa.js} +1 -1
  22. package/assets/esri/core/workers/chunks/6108d72faf48a592c8ba.js +1 -0
  23. package/assets/esri/core/workers/chunks/6479439afae01f9bb5e6.js +1 -0
  24. package/assets/esri/core/workers/chunks/69306dfc89e877539223.js +1 -0
  25. package/assets/esri/core/workers/chunks/6db4a6f9d25691830829.js +1 -0
  26. package/assets/esri/core/workers/chunks/{61393fd3376ea599a447.js → 76e27cece1559ae815df.js} +1 -1
  27. package/assets/esri/core/workers/chunks/81526909c0fa11639038.js +1 -0
  28. package/assets/esri/core/workers/chunks/873111ddf4813cdd4903.js +1 -0
  29. package/assets/esri/core/workers/chunks/8d4f1170394a8be15da9.js +1 -0
  30. package/assets/esri/core/workers/chunks/8d8bdfda09c24e363f78.js +1 -0
  31. package/assets/esri/core/workers/chunks/9b54b5bdb6367c36f6e9.js +1 -0
  32. package/assets/esri/core/workers/chunks/b2752e038c5fa3c21e49.js +1 -0
  33. package/assets/esri/core/workers/chunks/{dd3b7cfc6f78552249a4.js → b78dc6cbe14e5817b4d9.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{e31d0c7363cbceeb5ac9.js → c35b850fbfcb28133235.js} +1 -1
  35. package/assets/esri/core/workers/chunks/c83e1be4ee64320cf2fe.js +1 -0
  36. package/assets/esri/core/workers/chunks/c88869d2a647c22dc3e6.js +1 -0
  37. package/assets/esri/core/workers/chunks/cb0a5bc6deaa98026bb5.js +1 -0
  38. package/assets/esri/core/workers/chunks/{767467738aeabec14abd.js → d0c4367a197b193e95d4.js} +1 -1
  39. package/assets/esri/core/workers/chunks/{f113141e254505116b82.js → d1cc2c050423595e54e0.js} +1 -1
  40. package/assets/esri/core/workers/chunks/{7f34945036495ad7c3f8.js → d2a8bf2d090b94cb294b.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{08af7f7f1950a59a8e47.js → d6c96a20e9640b433719.js} +4 -4
  42. package/assets/esri/core/workers/chunks/da5453e67d00ff546640.js +1 -0
  43. package/assets/esri/core/workers/chunks/daa79c14150c12d8bc3d.js +1 -0
  44. package/assets/esri/core/workers/chunks/ef03b78659c72de93076.js +1 -0
  45. package/assets/esri/core/workers/chunks/{c3cace5b25b5170228ba.js → f2fe89b6ac6bf6817e71.js} +1 -1
  46. package/assets/esri/core/workers/chunks/f3554627664a419e00fa.js +1 -0
  47. package/assets/esri/themes/base/_core.scss +2 -0
  48. package/assets/esri/themes/base/widgets/_DirectionalPad.scss +76 -0
  49. package/assets/esri/themes/base/widgets/_Editor.scss +65 -4
  50. package/assets/esri/themes/base/widgets/_UtilityNetworkAssociations.scss +97 -39
  51. package/assets/esri/themes/dark/main.css +1 -1
  52. package/assets/esri/themes/light/main.css +1 -1
  53. package/assets/esri/themes/light/view.css +1 -1
  54. package/assets/esri/widgets/DirectionalPad/t9n/DirectionalPad.json +1 -0
  55. package/assets/esri/widgets/DirectionalPad/t9n/DirectionalPad_en.json +1 -0
  56. package/assets/esri/widgets/Editor/t9n/Editor.json +1 -1
  57. package/assets/esri/widgets/Editor/t9n/Editor_en.json +1 -1
  58. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-caps/butt.png +0 -0
  59. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-caps/round.png +0 -0
  60. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-caps/square.png +0 -0
  61. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/dash-dot.png +0 -0
  62. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/dash.png +0 -0
  63. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/dot.png +0 -0
  64. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/long-dash-dot-dot.png +0 -0
  65. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/long-dash-dot.png +0 -0
  66. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/long-dash.png +0 -0
  67. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/short-dash-dot-dot.png +0 -0
  68. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/short-dash-dot.png +0 -0
  69. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/short-dash.png +0 -0
  70. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/short-dot.png +0 -0
  71. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/solid.png +0 -0
  72. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations.json +1 -1
  73. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_en.json +1 -1
  74. package/chunks/HighlightBlur.glsl.js +3 -3
  75. package/chunks/HighlightDownsample.glsl.js +24 -6
  76. package/chunks/SSAO.glsl.js +2 -2
  77. package/core/timeUtils.js +1 -1
  78. package/interfaces.d.ts +182 -2
  79. package/intl/date.js +1 -1
  80. package/layers/FeatureLayer.js +1 -1
  81. package/layers/ImageryLayer.js +1 -1
  82. package/layers/ImageryTileLayer.js +1 -1
  83. package/layers/StreamLayer.js +1 -1
  84. package/layers/SubtypeGroupLayer.js +1 -1
  85. package/layers/VoxelWasmPerSceneView.js +1 -1
  86. package/layers/graphics/sources/support/uploads.js +1 -1
  87. package/layers/mixins/ArcGISImageService.js +1 -1
  88. package/layers/mixins/ImageryTileMixin.js +1 -1
  89. package/layers/save/featureLayerUtils.js +1 -1
  90. package/layers/save/imageryUtils.js +1 -1
  91. package/layers/save/streamLayerUtils.js +1 -1
  92. package/libs/maquette-advanced-projector/utils.js +1 -1
  93. package/package.json +1 -1
  94. package/popup/support/FieldInfoFormat.js +1 -1
  95. package/portal/PortalItem.js +1 -1
  96. package/support/revision.js +1 -1
  97. package/views/2d/navigation/MapViewNavigation.js +1 -1
  98. package/views/3d/environment/EnvironmentRenderer.js +1 -1
  99. package/views/3d/externalRenderers/ExternalRendererStore.js +1 -1
  100. package/views/3d/layers/i3s/PointRenderer.js +1 -1
  101. package/views/3d/support/LaserLineRenderer.js +1 -1
  102. package/views/3d/terrain/OverlayRenderer.js +1 -1
  103. package/views/3d/terrain/TerrainRenderer.js +1 -1
  104. package/views/3d/terrain/TerrainSurface.js +1 -1
  105. package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
  106. package/views/3d/webgl-engine/effects/RenderPlugin.js +1 -1
  107. package/views/3d/webgl-engine/effects/RenderPluginManager.js +1 -1
  108. package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
  109. package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
  110. package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
  111. package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
  112. package/views/3d/webgl-engine/lib/GLMaterialRepository.js +1 -1
  113. package/views/3d/webgl-engine/lib/GLMaterials.js +1 -1
  114. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  115. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  116. package/views/3d/webgl-engine/materials/CheckerBoardMaterial.js +1 -1
  117. package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
  118. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  119. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  120. package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
  121. package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
  122. package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
  123. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  124. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  125. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  126. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  127. package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
  128. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  129. package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
  130. package/views/3d/webgl-engine/materials/SlicePlaneMaterial.js +1 -1
  131. package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
  132. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  133. package/views/3d/webgl-engine/shaders/HighlightDownsample.glsl.js +1 -1
  134. package/views/draw/DrawGraphicTool.js +1 -1
  135. package/views/draw/DrawOperation.js +1 -1
  136. package/views/interactive/sketch/constraints.js +1 -1
  137. package/views/interactive/sketch/normalizedPoint.js +1 -1
  138. package/views/interactive/snapping/SnappingManager.js +1 -1
  139. package/views/interactive/snapping/candidates/IntersectionSnappingCandidate.js +1 -1
  140. package/views/interactive/tooltip/TooltipEditableField.js +1 -1
  141. package/views/interactive/tooltip/TooltipEditableFieldAngle.js +1 -1
  142. package/views/interactive/tooltip/constraintUtils.js +5 -0
  143. package/views/support/angularMeasurementUtils.js +1 -1
  144. package/widgets/Compass/CompassViewModel.js +1 -1
  145. package/widgets/Compass/utils.js +5 -0
  146. package/widgets/DirectionalPad/DirectionalPadViewModel.d.ts +4 -0
  147. package/widgets/DirectionalPad/DirectionalPadViewModel.js +5 -0
  148. package/widgets/DirectionalPad/VisibleElements.js +5 -0
  149. package/widgets/DirectionalPad/constants.js +5 -0
  150. package/widgets/DirectionalPad/css.js +5 -0
  151. package/widgets/DirectionalPad/utils.js +5 -0
  152. package/widgets/DirectionalPad.d.ts +4 -0
  153. package/widgets/DirectionalPad.js +5 -0
  154. package/widgets/Editor/EditorViewModel.js +1 -1
  155. package/widgets/Editor/Upload.js +1 -1
  156. package/widgets/Editor/components/CreateFeaturesPanelContent.js +1 -1
  157. package/widgets/Editor/components/UploadDetails.js +1 -1
  158. package/widgets/Editor/modelUploadUtils.js +1 -1
  159. package/widgets/Editor.js +1 -1
  160. package/widgets/ElevationProfile/support/chartUtils.js +1 -1
  161. package/widgets/ElevationProfile.js +1 -1
  162. package/widgets/Feature/FeatureViewModel.js +1 -1
  163. package/widgets/Feature/support/featureUtils.js +1 -1
  164. package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
  165. package/widgets/FeatureForm/FieldInput.js +1 -1
  166. package/widgets/FeatureForm/FormExpressionsManager.js +1 -1
  167. package/widgets/FeatureForm/InputBase.js +1 -1
  168. package/widgets/FeatureForm.js +1 -1
  169. package/widgets/UtilityNetworkAssociations/UtilityNetworkAssociationsLineSymbolPicker.js +5 -0
  170. package/widgets/UtilityNetworkAssociations/UtilityNetworkAssociationsViewModel.js +1 -1
  171. package/widgets/UtilityNetworkAssociations/VisibleElements.js +5 -0
  172. package/widgets/UtilityNetworkAssociations/VisibleElementsSettingsPane.js +5 -0
  173. package/widgets/UtilityNetworkAssociations.js +1 -1
  174. package/assets/esri/core/workers/chunks/11abbbf97093b55e2417.js +0 -1
  175. package/assets/esri/core/workers/chunks/1b2a081f2c3b97ba7e00.js +0 -1
  176. package/assets/esri/core/workers/chunks/235f333177ed7ea21e01.js +0 -1
  177. package/assets/esri/core/workers/chunks/3725dd14c2da0f47198f.js +0 -1
  178. package/assets/esri/core/workers/chunks/39467e1da18924cfb9b6.js +0 -1
  179. package/assets/esri/core/workers/chunks/42595c4870c673ed451c.js +0 -1
  180. package/assets/esri/core/workers/chunks/481cdd2a4bc40c6fef66.js +0 -1
  181. package/assets/esri/core/workers/chunks/54893132e70c515ea7e3.js +0 -1
  182. package/assets/esri/core/workers/chunks/6509a4198972b323d9b6.js +0 -1
  183. package/assets/esri/core/workers/chunks/68598d2806d4aa3d8acc.js +0 -1
  184. package/assets/esri/core/workers/chunks/718d2e8ea61f3b7b70c5.js +0 -1
  185. package/assets/esri/core/workers/chunks/7bce4b5eec630ef57f1e.js +0 -1
  186. package/assets/esri/core/workers/chunks/81df7304f97d1fc3ba16.js +0 -1
  187. package/assets/esri/core/workers/chunks/8706dc9f852df9b2095d.js +0 -1
  188. package/assets/esri/core/workers/chunks/8ef26aac0fe7feb8c324.js +0 -1
  189. package/assets/esri/core/workers/chunks/91e61da22f258d9e86c5.js +0 -1
  190. package/assets/esri/core/workers/chunks/9f039bf79b34d8fd75ae.js +0 -1
  191. package/assets/esri/core/workers/chunks/a1f3352301472e4b8956.js +0 -1
  192. package/assets/esri/core/workers/chunks/a20fd9e7db37b3c3b041.js +0 -1
  193. package/assets/esri/core/workers/chunks/aa83dce42d64034a0a13.js +0 -1
  194. package/assets/esri/core/workers/chunks/c8c8471b59700914ee9d.js +0 -1
  195. package/assets/esri/core/workers/chunks/cdcf0a5e05283d37b3ac.js +0 -1
  196. package/assets/esri/core/workers/chunks/d4f9106bf2ea5d66d96a.js +0 -1
  197. package/assets/esri/core/workers/chunks/e6bfbc4347fa13db4df2.js +0 -1
  198. package/assets/esri/core/workers/chunks/f1d5487f2d828fb142ba.js +0 -1
  199. package/assets/esri/core/workers/chunks/f97f165d05439e668e05.js +0 -1
  200. package/assets/esri/core/workers/chunks/fe973d8155c22d73a4f9.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.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import{FeatureSetQueryInterceptor as i}from"../../arcade/featureset/support/FeatureSetQueryInterceptor.js";import r from"../../core/Accessor.js";import{isSome as s}from"../../core/arrayUtils.js";import{IdentifiableMixin as o}from"../../core/Identifiable.js";import n from"../../core/Logger.js";import{isAbortError as a,eachAlways as l}from"../../core/promiseUtils.js";import{watch as p,on as c,initial as d}from"../../core/reactiveUtils.js";import{throttle as u}from"../../core/throttle.js";import{property as h}from"../../core/accessorSupport/decorators/property.js";import{cast as f}from"../../core/accessorSupport/decorators/cast.js";import"../../core/has.js";import{subclass as m}from"../../core/accessorSupport/decorators/subclass.js";import _ from"../../popup/content/TextContent.js";import y from"./FeatureAttachments/FeatureAttachmentsViewModel.js";import g from"./FeatureContent/FeatureContentViewModel.js";import b from"./FeatureExpression/FeatureExpressionViewModel.js";import I from"./FeatureFields/FeatureFieldsViewModel.js";import A from"./FeatureMedia/FeatureMediaViewModel.js";import M from"./FeatureRelationship/FeatureRelationshipViewModel.js";import{createCompiledExpressions as w}from"./support/arcadeFeatureUtils.js";import{createfieldInfoMap as x,getAllFieldInfos as F,getSourceLayer as v,querySourceLayer as C,isRelatableFeatureSupportedLayer as T,substituteFieldsInLinksAndAttributes as E,isExpressionField as V,isRelatedField as j,formatEditInfo as P,graphicCallback as R,queryUpdatedFeature as L,formatAttributes as O,preLayerQueryCallback as S,preRequestCallback as k}from"./support/featureUtils.js";import{queryLayerInfos as H,queryRelatedFeatures as U,setRelatedFeatures as D,getRelatedFieldInfo as N,createRelatedInfo as q,updateRelatedInfo as B}from"./support/relatedFeatureUtils.js";var Q;const G=1,z="content-view-models",J="relationship-view-models",K={attachmentsContent:!0,chartAnimation:!0,customContent:!0,expressionContent:!0,fieldsContent:!0,mediaContent:!0,textContent:!0,relationshipContent:!0};let W=Q=class extends(o(r)){constructor(e){super(e),this._error=null,this._featureAbortController=null,this._graphicChangedThrottled=u(this._graphicChanged,G,this),this._expressionAttributes=null,this._graphicExpressionAttributes=null,this.abilities={...K},this.content=null,this.contentViewModels=[],this.description=null,this.defaultPopupTemplateEnabled=!1,this.formattedAttributes=null,this.lastEditInfo=null,this.relatedInfos=new Map,this.title="",this.view=null,this._isAllowedContentType=e=>{const{abilities:t}=this;return"attachments"===e.type&&!!t.attachmentsContent||"custom"===e.type&&!!t.customContent||"fields"===e.type&&!!t.fieldsContent||"media"===e.type&&!!t.mediaContent||"text"===e.type&&!!t.textContent||"expression"===e.type&&!!t.expressionContent||"relationship"===e.type&&!!t.relationshipContent},this.addHandles(p((()=>[this.graphic,this._effectivePopupTemplate,this.abilities]),(()=>this._graphicChangedThrottled()),d))}initialize(){this.addHandles(this._graphicChangedThrottled)}destroy(){this._clear(),this._cancelFeatureQuery(),this._error=null,this.graphic=null,this._destroyContentViewModels(),this.relatedInfos.clear()}get _effectivePopupTemplate(){return null!=this.graphic?this.graphic.getEffectivePopupTemplate(this.defaultPopupTemplateEnabled):null}get _fieldInfoMap(){return x(F(this._effectivePopupTemplate),this._sourceLayer)}get _sourceLayer(){return v(this.graphic)}castAbilities(e){return{...K,...e}}get isTable(){return this._sourceLayer?.isTable||!1}get state(){return this.graphic?this._error?"error":this.waitingForContent?"loading":"ready":"disabled"}set graphic(e){this._set("graphic",e?e.clone():null)}get spatialReference(){return this.view?.spatialReference??null}set spatialReference(e){this._override("spatialReference",e)}get map(){return this.view?.map||null}set map(e){this._override("map",e)}get waitingForContent(){return!!this._featureAbortController}setActiveMedia(e,t){const i=this.contentViewModels[e];i instanceof A&&i.setActiveMedia(t)}nextMedia(e){const t=this.contentViewModels[e];t instanceof A&&t.next()}previousMedia(e){const t=this.contentViewModels[e];t instanceof A&&t.previous()}async updateGeometry(){const{graphic:e,spatialReference:t,_sourceLayer:i}=this;await(i?.load());const r=i?.objectIdField;if(!r||!e||!i)return;const s=e?.attributes?.[r];if(null==s)return;const o=[s];if(!e.geometry){const r=await C({layer:i,graphic:e,outFields:[],objectIds:o,returnGeometry:!0,spatialReference:t}),s=r?.geometry;s&&(e.geometry=s)}}_clear(){this._set("title",""),this._set("content",null),this._set("formattedAttributes",null)}async _graphicChanged(){this._cancelFeatureQuery(),this._error=null,this._clear();const{graphic:e}=this;if(!e)return;const t=new AbortController;this._featureAbortController=t;try{await this._queryFeature({signal:t.signal})}catch(i){a(i)||(this._error=i,n.getLogger(this).error("error","The popupTemplate could not be displayed for this feature.",{error:i,graphic:e,popupTemplate:this._effectivePopupTemplate}))}this._featureAbortController===t&&(this._featureAbortController=null)}_cancelFeatureQuery(){const{_featureAbortController:e}=this;e&&e.abort(),this._featureAbortController=null}_compileContentElement(e,t){return"attachments"===e.type?this._compileAttachments(e,t):"custom"===e.type?this._compileCustom(e,t):"fields"===e.type?this._compileFields(e,t):"media"===e.type?this._compileMedia(e,t):"text"===e.type?this._compileText(e,t):"expression"===e.type?this._compileExpression(e,t):"relationship"===e.type?this._compileRelationship(e,t):void 0}_compileContent(e){if(this._destroyContentViewModels(),this.graphic)return Array.isArray(e)?e.filter(this._isAllowedContentType).map(((e,t)=>this._compileContentElement(e,t))).filter(s):"string"==typeof e?this._compileText(new _({text:e}),0).text:e}_destroyContentViewModels(){this.removeHandles(J),this.removeHandles(z),this.contentViewModels.forEach((e=>e&&!e.destroyed&&e.destroy())),this._set("contentViewModels",[])}_matchesFeature(e,t){const i=e?.graphic?.getObjectId(),r=t?.getObjectId();return null!=i&&null!=r&&i===r}_setRelatedFeaturesViewModels({relatedFeatureViewModels:e,relatedFeatures:t,map:i}){const{view:r,spatialReference:s}=this;t?.filter(Boolean).forEach((t=>{e.find((e=>this._matchesFeature(e,t)))||e.add(new Q({abilities:{relationshipContent:!1},map:i,view:r,spatialReference:s,graphic:t}))})),e.forEach((i=>{const r=t?.find((e=>this._matchesFeature(i,e)));r||e.remove(i)}))}_setExpressionContentVM(e,t){const i=this.formattedAttributes,{contentElement:r,contentElementViewModel:s}=e,o=r?.type;s&&o&&("fields"===o&&(this._createFieldsFormattedAttributes({contentElement:r,contentElementIndex:t,formattedAttributes:i}),s.set(this._createFieldsVMParams(r,t))),"media"===o&&(this._createMediaFormattedAttributes({contentElement:r,contentElementIndex:t,formattedAttributes:i}),s.set(this._createMediaVMParams(r,t))),"text"===o&&s.set(this._createTextVMParams(r)))}_compileRelationship(e,t){const{displayCount:i,orderByFields:r,relationshipId:s,title:o,description:n}=e,{_sourceLayer:a,graphic:l,map:p}=this;if(!T(a))return;const d=new M({displayCount:i,graphic:l,orderByFields:r,relationshipId:s,layer:a,map:p,...this._compileTitleAndDesc({title:o,description:n})});return this.contentViewModels[t]=d,this.addHandles(c((()=>d.relatedFeatures),"change",(()=>this._setRelatedFeaturesViewModels(d))),J),e}_compileExpression(e,t){const{expressionInfo:i}=e,{graphic:r,map:s,spatialReference:o,view:n}=this,a=new b({expressionInfo:i,graphic:r,interceptor:Q.interceptor,map:s,spatialReference:o,view:n});return this.contentViewModels[t]=a,this.addHandles(p((()=>a.contentElementViewModel),(()=>this._setExpressionContentVM(a,t)),d),z),e}_compileAttachments(e,t){const{graphic:i}=this,{description:r,title:s}=e;return this.contentViewModels[t]=new y({graphic:i,...this._compileTitleAndDesc({title:s,description:r})}),e}_compileCustom(e,t){const{graphic:i}=this,{creator:r,destroyer:s}=e;return this.contentViewModels[t]=new g({graphic:i,creator:r,destroyer:s}),e}_compileTitleAndDesc({title:e,description:t}){const{_fieldInfoMap:i,_sourceLayer:r,graphic:s,formattedAttributes:o}=this,n=s?.attributes,a=this._expressionAttributes,l=o.global;return{title:E({attributes:n,fieldInfoMap:i,globalAttributes:l,expressionAttributes:a,layer:r,text:e}),description:E({attributes:n,fieldInfoMap:i,globalAttributes:l,expressionAttributes:a,layer:r,text:t})}}_createFieldsVMParams(e,t){const i=this._effectivePopupTemplate,r=this.formattedAttributes,s={...r?.global,...r?.content[t]},o=e?.fieldInfos||i?.fieldInfos,n=o?.filter((({fieldName:e})=>V(e)||j(e)||s.hasOwnProperty(e))),a=i?.expressionInfos,{description:l,title:p}=e;return{attributes:s,expressionInfos:a,fieldInfos:n,...this._compileTitleAndDesc({title:p,description:l})}}_compileFields(e,t){const i=e.clone(),r=new I(this._createFieldsVMParams(e,t));return this.contentViewModels[t]=r,i.fieldInfos=r.formattedFieldInfos.slice(0),i}_createMediaVMParams(e,t){const{abilities:i,graphic:r,_fieldInfoMap:s,_effectivePopupTemplate:o,relatedInfos:n,_sourceLayer:a,_expressionAttributes:l}=this,p=this.formattedAttributes,c=r?.attributes??{},{description:d,mediaInfos:u,title:h}=e;return{abilities:{chartAnimation:i.chartAnimation},activeMediaInfoIndex:e.activeMediaInfoIndex||0,attributes:c,isAggregate:r?.isAggregate,layer:a,fieldInfoMap:s,formattedAttributes:{...p?.global,...p?.content[t]},expressionAttributes:l,mediaInfos:u,popupTemplate:o,relatedInfos:n,...this._compileTitleAndDesc({title:h,description:d})}}_compileMedia(e,t){const i=e.clone(),r=new A(this._createMediaVMParams(e,t));return i.mediaInfos=r.formattedMediaInfos.slice(0),this.contentViewModels[t]=r,i}_createTextVMParams(e){const{graphic:t,_fieldInfoMap:i,_sourceLayer:r,_expressionAttributes:s}=this;if(e&&e.text){const o=t?.attributes??{},n=this.formattedAttributes?.global??{};e.text=E({attributes:o,fieldInfoMap:i,globalAttributes:n,expressionAttributes:s,layer:r,text:e.text})}return{graphic:t,creator:e.text}}_compileText(e,t){const i=e.clone();return this.contentViewModels[t]=new g(this._createTextVMParams(i)),i}_compileLastEditInfo(){const{_effectivePopupTemplate:e,_sourceLayer:t,graphic:i}=this;if(!e)return;const{lastEditInfoEnabled:r}=e,s=t?.editFieldsInfo;return r&&s?P(s,i?.attributes):void 0}_compileTitle(e){const{_fieldInfoMap:t,_sourceLayer:i,graphic:r,_expressionAttributes:s}=this,o=r?.attributes??{},n=this.formattedAttributes?.global??{};return E({attributes:o,fieldInfoMap:t,globalAttributes:n,expressionAttributes:s,layer:i,text:e})}async _getTitle(){const{_effectivePopupTemplate:e,graphic:t}=this;if(!t)return null;const i=e?.title;return R(i,{graphic:t})}async _getContent(){const{_effectivePopupTemplate:e,graphic:t}=this;if(!t)return null;const i=e?.content;return R(i,{graphic:t})}async _queryFeature(e){const{_featureAbortController:t,_sourceLayer:i,graphic:r,_effectivePopupTemplate:s}=this,o=this.map,n=this.view,a=this.spatialReference;if(t!==this._featureAbortController||!r)return;await L({graphic:r,popupTemplate:s,layer:i,spatialReference:a},e);const{content:{value:p},title:{value:c}}=await l({content:this._getContent(),title:this._getTitle()}),{expressionAttributes:{value:d}}=await l({checkForRelatedFeatures:this._checkForRelatedFeatures(e),expressionAttributes:w({expressionInfos:s?.expressionInfos,spatialReference:a,graphic:r,map:o,interceptor:Q.interceptor,view:n})});t===this._featureAbortController&&r&&(this._expressionAttributes=d,this._graphicExpressionAttributes={...r.attributes,...d},this._set("formattedAttributes",this._createFormattedAttributes(p)),this._set("title",this._compileTitle(c)),this._set("lastEditInfo",this._compileLastEditInfo()||null),this._set("content",this._compileContent(p)||null))}_createMediaFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:i}){const{_effectivePopupTemplate:r,graphic:s,relatedInfos:o,_sourceLayer:n,_fieldInfoMap:a,_graphicExpressionAttributes:l}=this;i.content[t]=O({fieldInfos:r?.fieldInfos,graphic:s,attributes:{...l,...e.attributes},layer:n,fieldInfoMap:a,relatedInfos:o})}_createFieldsFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:i}){if(e.fieldInfos){const{graphic:r,relatedInfos:s,_sourceLayer:o,_fieldInfoMap:n,_graphicExpressionAttributes:a}=this;i.content[t]=O({fieldInfos:e.fieldInfos,graphic:r,attributes:{...a,...e.attributes},layer:o,fieldInfoMap:n,relatedInfos:s})}}_createFormattedAttributes(e){const{_effectivePopupTemplate:t,graphic:i,relatedInfos:r,_sourceLayer:s,_fieldInfoMap:o,_graphicExpressionAttributes:n}=this,a=t?.fieldInfos,l={global:O({fieldInfos:a,graphic:i,attributes:n,layer:s,fieldInfoMap:o,relatedInfos:r}),content:[]};return Array.isArray(e)&&e.forEach(((e,t)=>{"fields"===e.type&&this._createFieldsFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:l}),"media"===e.type&&this._createMediaFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:l})})),l}_checkForRelatedFeatures(e){const{graphic:t,_effectivePopupTemplate:i}=this;return this._queryRelatedInfos(t,F(i),e)}async _queryRelatedInfos(e,t,i){const{relatedInfos:r,_sourceLayer:s}=this;r.clear();const o=null!=s?.associatedLayer?await(s?.associatedLayer.load(i)):s;if(!o||!e)return;const n=t.filter((e=>e&&j(e.fieldName)));if(!n||!n.length)return;t.forEach((e=>this._configureRelatedInfo(e,o)));const a=await H({relatedInfos:r,layer:o},i);Object.keys(a).forEach((e=>{const t=r.get(e.toString()),i=a[e]?.value;t&&i&&(t.layerInfo=i.data)}));const l=await U({graphic:e,relatedInfos:r,layer:o},i);Object.keys(l).forEach((e=>{D(l[e]?.value,r.get(e.toString()))}))}_configureRelatedInfo(e,t){const{relatedInfos:i}=this,r=N(e.fieldName);if(!r)return;const{layerId:s,fieldName:o}=r;if(!s)return;const n=i.get(s.toString())||q(s,t);n&&(B({relatedInfo:n,fieldName:o,fieldInfo:e}),this.relatedInfos.set(s,n))}};W.interceptor=new i(S,k),e([h()],W.prototype,"_error",void 0),e([h()],W.prototype,"_featureAbortController",void 0),e([h({readOnly:!0})],W.prototype,"_effectivePopupTemplate",null),e([h({readOnly:!0})],W.prototype,"_fieldInfoMap",null),e([h({readOnly:!0})],W.prototype,"_sourceLayer",null),e([h()],W.prototype,"abilities",void 0),e([f("abilities")],W.prototype,"castAbilities",null),e([h({readOnly:!0})],W.prototype,"content",void 0),e([h({readOnly:!0})],W.prototype,"contentViewModels",void 0),e([h()],W.prototype,"description",void 0),e([h({type:Boolean})],W.prototype,"defaultPopupTemplateEnabled",void 0),e([h({readOnly:!0})],W.prototype,"isTable",null),e([h({readOnly:!0})],W.prototype,"state",null),e([h({readOnly:!0})],W.prototype,"formattedAttributes",void 0),e([h({type:t,value:null})],W.prototype,"graphic",null),e([h({readOnly:!0})],W.prototype,"lastEditInfo",void 0),e([h({readOnly:!0})],W.prototype,"relatedInfos",void 0),e([h()],W.prototype,"spatialReference",null),e([h({readOnly:!0})],W.prototype,"title",void 0),e([h()],W.prototype,"map",null),e([h({readOnly:!0})],W.prototype,"waitingForContent",null),e([h()],W.prototype,"view",void 0),W=Q=e([m("esri.widgets.FeatureViewModel")],W);const X=W;export{X as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import{FeatureSetQueryInterceptor as i}from"../../arcade/featureset/support/FeatureSetQueryInterceptor.js";import r from"../../core/Accessor.js";import{isSome as s}from"../../core/arrayUtils.js";import{IdentifiableMixin as o}from"../../core/Identifiable.js";import n from"../../core/Logger.js";import{isAbortError as a,eachAlways as l}from"../../core/promiseUtils.js";import{watch as p,on as c,initial as d}from"../../core/reactiveUtils.js";import{throttle as u}from"../../core/throttle.js";import{property as h}from"../../core/accessorSupport/decorators/property.js";import{cast as f}from"../../core/accessorSupport/decorators/cast.js";import"../../core/has.js";import{subclass as m}from"../../core/accessorSupport/decorators/subclass.js";import _ from"../../popup/content/TextContent.js";import y from"./FeatureAttachments/FeatureAttachmentsViewModel.js";import g from"./FeatureContent/FeatureContentViewModel.js";import b from"./FeatureExpression/FeatureExpressionViewModel.js";import I from"./FeatureFields/FeatureFieldsViewModel.js";import A from"./FeatureMedia/FeatureMediaViewModel.js";import M from"./FeatureRelationship/FeatureRelationshipViewModel.js";import{createCompiledExpressions as w}from"./support/arcadeFeatureUtils.js";import{createfieldInfoMap as x,getAllFieldInfos as v,getSourceLayer as F,querySourceLayer as C,isRelatableFeatureSupportedLayer as T,substituteFieldsInLinksAndAttributes as E,isExpressionField as V,isRelatedField as j,formatEditInfo as P,graphicCallback as R,queryUpdatedFeature as L,formatAttributes as O,preLayerQueryCallback as S,preRequestCallback as k}from"./support/featureUtils.js";import{queryLayerInfos as H,queryRelatedFeatures as U,setRelatedFeatures as Z,getRelatedFieldInfo as D,createRelatedInfo as N,updateRelatedInfo as q}from"./support/relatedFeatureUtils.js";var B;const Q=1,G="content-view-models",z="relationship-view-models",J={attachmentsContent:!0,chartAnimation:!0,customContent:!0,expressionContent:!0,fieldsContent:!0,mediaContent:!0,textContent:!0,relationshipContent:!0};let K=B=class extends(o(r)){constructor(e){super(e),this._error=null,this._featureAbortController=null,this._graphicChangedThrottled=u(this._graphicChanged,Q,this),this._expressionAttributes=null,this._graphicExpressionAttributes=null,this.abilities={...J},this.content=null,this.contentViewModels=[],this.description=null,this.defaultPopupTemplateEnabled=!1,this.formattedAttributes=null,this.lastEditInfo=null,this.relatedInfos=new Map,this.title="",this.view=null,this._isAllowedContentType=e=>{const{abilities:t}=this;return"attachments"===e.type&&!!t.attachmentsContent||"custom"===e.type&&!!t.customContent||"fields"===e.type&&!!t.fieldsContent||"media"===e.type&&!!t.mediaContent||"text"===e.type&&!!t.textContent||"expression"===e.type&&!!t.expressionContent||"relationship"===e.type&&!!t.relationshipContent},this.addHandles(p((()=>[this.graphic,this._effectivePopupTemplate,this.abilities]),(()=>this._graphicChangedThrottled()),d))}initialize(){this.addHandles(this._graphicChangedThrottled)}destroy(){this._clear(),this._cancelFeatureQuery(),this._error=null,this.graphic=null,this._destroyContentViewModels(),this.relatedInfos.clear()}get _effectivePopupTemplate(){return null!=this.graphic?this.graphic.getEffectivePopupTemplate(this.defaultPopupTemplateEnabled):null}get _fieldInfoMap(){return x(v(this._effectivePopupTemplate),this._sourceLayer)}get _sourceLayer(){return F(this.graphic)}castAbilities(e){return{...J,...e}}get isTable(){return this._sourceLayer?.isTable||!1}get state(){return this.graphic?this._error?"error":this.waitingForContent?"loading":"ready":"disabled"}set graphic(e){this._set("graphic",e?e.clone():null)}get spatialReference(){return this.view?.spatialReference??null}set spatialReference(e){this._override("spatialReference",e)}get map(){return this.view?.map||null}set map(e){this._override("map",e)}get waitingForContent(){return!!this._featureAbortController}setActiveMedia(e,t){const i=this.contentViewModels[e];i instanceof A&&i.setActiveMedia(t)}nextMedia(e){const t=this.contentViewModels[e];t instanceof A&&t.next()}previousMedia(e){const t=this.contentViewModels[e];t instanceof A&&t.previous()}async updateGeometry(){const{graphic:e,spatialReference:t,_sourceLayer:i}=this;await(i?.load());const r=i?.objectIdField;if(!r||!e||!i)return;const s=e?.attributes?.[r];if(null==s)return;const o=[s];if(!e.geometry){const r=await C({layer:i,graphic:e,outFields:[],objectIds:o,returnGeometry:!0,spatialReference:t}),s=r?.geometry;s&&(e.geometry=s)}}_clear(){this._set("title",""),this._set("content",null),this._set("formattedAttributes",null)}async _graphicChanged(){this._cancelFeatureQuery(),this._error=null,this._clear();const{graphic:e}=this;if(!e)return;const t=new AbortController;this._featureAbortController=t;try{await this._queryFeature({signal:t.signal})}catch(i){a(i)||(this._error=i,n.getLogger(this).error("error","The popupTemplate could not be displayed for this feature.",{error:i,graphic:e,popupTemplate:this._effectivePopupTemplate}))}this._featureAbortController===t&&(this._featureAbortController=null)}_cancelFeatureQuery(){const{_featureAbortController:e}=this;e&&e.abort(),this._featureAbortController=null}_compileContentElement(e,t){return"attachments"===e.type?this._compileAttachments(e,t):"custom"===e.type?this._compileCustom(e,t):"fields"===e.type?this._compileFields(e,t):"media"===e.type?this._compileMedia(e,t):"text"===e.type?this._compileText(e,t):"expression"===e.type?this._compileExpression(e,t):"relationship"===e.type?this._compileRelationship(e,t):void 0}_compileContent(e){if(this._destroyContentViewModels(),this.graphic)return Array.isArray(e)?e.filter(this._isAllowedContentType).map(((e,t)=>this._compileContentElement(e,t))).filter(s):"string"==typeof e?this._compileText(new _({text:e}),0).text:e}_destroyContentViewModels(){this.removeHandles(z),this.removeHandles(G),this.contentViewModels.forEach((e=>e&&!e.destroyed&&e.destroy())),this._set("contentViewModels",[])}_matchesFeature(e,t){const i=e?.graphic?.getObjectId(),r=t?.getObjectId();return null!=i&&null!=r&&i===r}_setRelatedFeaturesViewModels({relatedFeatureViewModels:e,relatedFeatures:t,map:i}){const{view:r,spatialReference:s}=this;t?.filter(Boolean).forEach((t=>{e.find((e=>this._matchesFeature(e,t)))||e.add(new B({abilities:{relationshipContent:!1},map:i,view:r,spatialReference:s,graphic:t}))})),e.forEach((i=>{const r=t?.find((e=>this._matchesFeature(i,e)));r||e.remove(i)}))}_setExpressionContentVM(e,t){const i=this.formattedAttributes,{contentElement:r,contentElementViewModel:s}=e,o=r?.type;s&&o&&("fields"===o&&(this._createFieldsFormattedAttributes({contentElement:r,contentElementIndex:t,formattedAttributes:i}),s.set(this._createFieldsVMParams(r,t))),"media"===o&&(this._createMediaFormattedAttributes({contentElement:r,contentElementIndex:t,formattedAttributes:i}),s.set(this._createMediaVMParams(r,t))),"text"===o&&s.set(this._createTextVMParams(r)))}_compileRelationship(e,t){const{displayCount:i,orderByFields:r,relationshipId:s,title:o,description:n}=e,{_sourceLayer:a,graphic:l,map:p}=this;if(!T(a))return;const d=new M({displayCount:i,graphic:l,orderByFields:r,relationshipId:s,layer:a,map:p,...this._compileTitleAndDesc({title:o,description:n})});return this.contentViewModels[t]=d,this.addHandles(c((()=>d.relatedFeatures),"change",(()=>this._setRelatedFeaturesViewModels(d))),z),e}_compileExpression(e,t){const{expressionInfo:i}=e,{graphic:r,map:s,spatialReference:o,view:n}=this,a=new b({expressionInfo:i,graphic:r,interceptor:B.interceptor,map:s,spatialReference:o,view:n});return this.contentViewModels[t]=a,this.addHandles(p((()=>a.contentElementViewModel),(()=>this._setExpressionContentVM(a,t)),d),G),e}_compileAttachments(e,t){const{graphic:i}=this,{description:r,title:s}=e;return this.contentViewModels[t]=new y({graphic:i,...this._compileTitleAndDesc({title:s,description:r})}),e}_compileCustom(e,t){const{graphic:i}=this,{creator:r,destroyer:s}=e;return this.contentViewModels[t]=new g({graphic:i,creator:r,destroyer:s}),e}_compileTitleAndDesc({title:e,description:t}){const{_fieldInfoMap:i,_sourceLayer:r,graphic:s,formattedAttributes:o}=this,n=s?.attributes,a=this._expressionAttributes,l=o.global;return{title:E({attributes:n,fieldInfoMap:i,globalAttributes:l,expressionAttributes:a,layer:r,text:e}),description:E({attributes:n,fieldInfoMap:i,globalAttributes:l,expressionAttributes:a,layer:r,text:t})}}_createFieldsVMParams(e,t){const i=this._effectivePopupTemplate,r=this.formattedAttributes,s={...r?.global,...r?.content[t]},o=e?.fieldInfos||i?.fieldInfos,n=o?.filter((({fieldName:e})=>V(e)||j(e)||s.hasOwnProperty(e))),a=i?.expressionInfos,{description:l,title:p}=e;return{attributes:s,expressionInfos:a,fieldInfos:n,...this._compileTitleAndDesc({title:p,description:l})}}_compileFields(e,t){const i=e.clone(),r=new I(this._createFieldsVMParams(e,t));return this.contentViewModels[t]=r,i.fieldInfos=r.formattedFieldInfos.slice(0),i}_createMediaVMParams(e,t){const{abilities:i,graphic:r,_fieldInfoMap:s,_effectivePopupTemplate:o,relatedInfos:n,_sourceLayer:a,_expressionAttributes:l}=this,p=this.formattedAttributes,c=r?.attributes??{},{description:d,mediaInfos:u,title:h}=e;return{abilities:{chartAnimation:i.chartAnimation},activeMediaInfoIndex:e.activeMediaInfoIndex||0,attributes:c,isAggregate:r?.isAggregate,layer:a,fieldInfoMap:s,formattedAttributes:{...p?.global,...p?.content[t]},expressionAttributes:l,mediaInfos:u,popupTemplate:o,relatedInfos:n,...this._compileTitleAndDesc({title:h,description:d})}}_compileMedia(e,t){const i=e.clone(),r=new A(this._createMediaVMParams(e,t));return i.mediaInfos=r.formattedMediaInfos.slice(0),this.contentViewModels[t]=r,i}_createTextVMParams(e){const{graphic:t,_fieldInfoMap:i,_sourceLayer:r,_expressionAttributes:s}=this;if(e&&e.text){const o=t?.attributes??{},n=this.formattedAttributes?.global??{};e.text=E({attributes:o,fieldInfoMap:i,globalAttributes:n,expressionAttributes:s,layer:r,text:e.text})}return{graphic:t,creator:e.text}}_compileText(e,t){const i=e.clone();return this.contentViewModels[t]=new g(this._createTextVMParams(i)),i}_compileLastEditInfo(){const{_effectivePopupTemplate:e,_sourceLayer:t,graphic:i}=this;if(!e)return;const{lastEditInfoEnabled:r}=e,s=t?.editFieldsInfo;return r&&s?P(s,i?.attributes):void 0}_compileTitle(e){const{_fieldInfoMap:t,_sourceLayer:i,graphic:r,_expressionAttributes:s}=this,o=r?.attributes??{},n=this.formattedAttributes?.global??{};return E({attributes:o,fieldInfoMap:t,globalAttributes:n,expressionAttributes:s,layer:i,text:e})}async _getTitle(){const{_effectivePopupTemplate:e,graphic:t}=this;if(!t)return null;const i=e?.title;return R(i,{graphic:t})}async _getContent(){const{_effectivePopupTemplate:e,graphic:t}=this;if(!t)return null;const i=e?.content;return R(i,{graphic:t})}async _queryFeature(e){const{_featureAbortController:t,_sourceLayer:i,graphic:r,_effectivePopupTemplate:s}=this,o=this.map,n=this.view,a=this.spatialReference;if(t!==this._featureAbortController||!r)return;await L({graphic:r,popupTemplate:s,layer:i,spatialReference:a},e);const{content:{value:p},title:{value:c}}=await l({content:this._getContent(),title:this._getTitle()}),{expressionAttributes:{value:d}}=await l({checkForRelatedFeatures:this._checkForRelatedFeatures(e),expressionAttributes:w({expressionInfos:s?.expressionInfos,spatialReference:a,graphic:r,map:o,interceptor:B.interceptor,view:n})});t===this._featureAbortController&&r&&(this._expressionAttributes=d,this._graphicExpressionAttributes={...r.attributes,...d},this._set("formattedAttributes",this._createFormattedAttributes(p)),this._set("title",this._compileTitle(c)),this._set("lastEditInfo",this._compileLastEditInfo()||null),this._set("content",this._compileContent(p)||null))}_createMediaFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:i}){const{_effectivePopupTemplate:r,graphic:s,relatedInfos:o,_sourceLayer:n,_fieldInfoMap:a,_graphicExpressionAttributes:l}=this;i.content[t]=O({fieldInfos:r?.fieldInfos,graphic:s,attributes:{...l,...e.attributes},layer:n,fieldInfoMap:a,relatedInfos:o,timeZone:this.view?.timeZone??"system"})}_createFieldsFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:i}){if(e.fieldInfos){const{graphic:r,relatedInfos:s,_sourceLayer:o,_fieldInfoMap:n,_graphicExpressionAttributes:a}=this;i.content[t]=O({fieldInfos:e.fieldInfos,graphic:r,attributes:{...a,...e.attributes},layer:o,fieldInfoMap:n,relatedInfos:s,timeZone:this.view?.timeZone??"system"})}}_createFormattedAttributes(e){const{_effectivePopupTemplate:t,graphic:i,relatedInfos:r,_sourceLayer:s,_fieldInfoMap:o,_graphicExpressionAttributes:n}=this,a=t?.fieldInfos,l={global:O({fieldInfos:a,graphic:i,attributes:n,layer:s,fieldInfoMap:o,relatedInfos:r,timeZone:this.view?.timeZone??"system"}),content:[]};return Array.isArray(e)&&e.forEach(((e,t)=>{"fields"===e.type&&this._createFieldsFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:l}),"media"===e.type&&this._createMediaFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:l})})),l}_checkForRelatedFeatures(e){const{graphic:t,_effectivePopupTemplate:i}=this;return this._queryRelatedInfos(t,v(i),e)}async _queryRelatedInfos(e,t,i){const{relatedInfos:r,_sourceLayer:s}=this;r.clear();const o=null!=s?.associatedLayer?await(s?.associatedLayer.load(i)):s;if(!o||!e)return;const n=t.filter((e=>e&&j(e.fieldName)));if(!n||!n.length)return;t.forEach((e=>this._configureRelatedInfo(e,o)));const a=await H({relatedInfos:r,layer:o},i);Object.keys(a).forEach((e=>{const t=r.get(e.toString()),i=a[e]?.value;t&&i&&(t.layerInfo=i.data)}));const l=await U({graphic:e,relatedInfos:r,layer:o},i);Object.keys(l).forEach((e=>{Z(l[e]?.value,r.get(e.toString()))}))}_configureRelatedInfo(e,t){const{relatedInfos:i}=this,r=D(e.fieldName);if(!r)return;const{layerId:s,fieldName:o}=r;if(!s)return;const n=i.get(s.toString())||N(s,t);n&&(q({relatedInfo:n,fieldName:o,fieldInfo:e}),this.relatedInfos.set(s,n))}};K.interceptor=new i(S,k),e([h()],K.prototype,"_error",void 0),e([h()],K.prototype,"_featureAbortController",void 0),e([h({readOnly:!0})],K.prototype,"_effectivePopupTemplate",null),e([h({readOnly:!0})],K.prototype,"_fieldInfoMap",null),e([h({readOnly:!0})],K.prototype,"_sourceLayer",null),e([h()],K.prototype,"abilities",void 0),e([f("abilities")],K.prototype,"castAbilities",null),e([h({readOnly:!0})],K.prototype,"content",void 0),e([h({readOnly:!0})],K.prototype,"contentViewModels",void 0),e([h()],K.prototype,"description",void 0),e([h({type:Boolean})],K.prototype,"defaultPopupTemplateEnabled",void 0),e([h({readOnly:!0})],K.prototype,"isTable",null),e([h({readOnly:!0})],K.prototype,"state",null),e([h({readOnly:!0})],K.prototype,"formattedAttributes",void 0),e([h({type:t,value:null})],K.prototype,"graphic",null),e([h({readOnly:!0})],K.prototype,"lastEditInfo",void 0),e([h({readOnly:!0})],K.prototype,"relatedInfos",void 0),e([h()],K.prototype,"spatialReference",null),e([h({readOnly:!0})],K.prototype,"title",void 0),e([h()],K.prototype,"map",null),e([h({readOnly:!0})],K.prototype,"waitingForContent",null),e([h()],K.prototype,"view",void 0),K=B=e([m("esri.widgets.FeatureViewModel")],K);const W=K;export{W 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.28/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../core/Logger.js";import{replace as t}from"../../../core/string.js";import{formatDate as r,convertDateFormatToIntlOptions as n,formatTimestamp as i,formatTimeOnly as o,formatDateOnly as a}from"../../../intl/date.js";import{formatNumber as l,convertNumberFormatToIntlOptions as u}from"../../../intl/number.js";import{isRasterPixelValueField as s,featureHasFields as f}from"../../../layers/support/fieldUtils.js";import{isFeatureLayer as c,getEffectiveLayerCapabilities as d}from"../../../layers/support/layerUtils.js";import p from"../../../popup/support/FieldInfoFormat.js";import{loadArcade as y}from"../../../support/arcadeOnDemand.js";const m="esri.widgets.Feature.support.featureUtils",g=e.getLogger(m),h=/href=(""|'')/gi,I=/(\{([^\{\r\n]+)\})/g,b=/\'/g,F=/^\s*expression\//i,w=/(\n)/gi,j=/[\u00A0-\u9999<>\&]/gim,N=/href\s*=\s*(?:\"([^\"]+)\"|\'([^\']+)\')/gi,E=/^(?:mailto:|tel:)/,T="relationships/",x=n("short-date-short-time");function C(e){if(null!=e)return(e.sourceLayer||e.layer)??void 0}async function q(e,t){return"function"==typeof e?e(t):e}function A(e=""){if(e)return!E.test(e.trim().toLowerCase())}function M(e){return!!e&&F.test(e)}function R(e,t){if(!M(t)||!e)return null;const r=t.replace(F,"").toLowerCase();let n=null;return e.some((e=>e.name.toLowerCase()===r&&(n=e,!0))),n}function L(e,t){const r=R(t,e?.fieldName);return r?r.title||null:e?e.label||e.fieldName:null}function v(e,t){const r=t.get(e.toLowerCase());return`{${r&&r.fieldName||e}}`}function D(e){return e.replaceAll(h,"")}function $(e,t){const r=O(t,e);return r?r.name:e}function U(e,t){return e&&e.map((e=>$(e,t)))}function O(e,t){return e&&"function"==typeof e.getField&&t?e.getField(t)??null:null}function S(e){return`${e}`.trim()}function G({attributes:e,globalAttributes:t,layer:r,text:n,expressionAttributes:i,fieldInfoMap:o}){return n?k({formattedAttributes:t,template:H(n,{...t,...i,...e},r),fieldInfoMap:o}):""}function k({formattedAttributes:e,template:r,fieldInfoMap:n}){return S(D(t(t(r,(e=>v(e,n))),e)))}function P(e,t,r=!1){const n=t[e];if("string"==typeof n){const i="%27",o=(r?encodeURIComponent(n):n).replaceAll(b,i);t[e]=o}}function Q(e,t=!1){const r={...e};return Object.keys(r).forEach((e=>P(e,r,t))),r}function _(e,r,n){const i=(r=S(r))&&"{"!==r[0];return t(e,Q(n,i||!1))}function z(e,t){return e.replaceAll(I,((e,r,n)=>{const i=O(t,n);return i?`{${i.name}}`:r}))}function H(e,t,r){const n=z(e,r);return n?n.replaceAll(N,((e,r,n)=>_(e,r||n,t))):n}function V(e,t){if("string"==typeof e&&t&&null==t.dateFormat&&(null!=t.places||null!=t.digitSeparator)){const t=Number(e);if(!isNaN(t))return t}return e}function Z(e){return null!=e&&"object"==typeof e&&"layer"in e&&!!e.layer}function B(e){return null!=e&&"object"==typeof e&&"type"in e&&"map-image"===e.type}function J(e){return null!=e&&"object"==typeof e&&"fieldsIndex"in e&&"geometryType"in e&&"getField"in e&&"load"in e&&"loaded"in e&&"objectIdField"in e&&"spatialReference"in e&&"type"in e&&"feature"===e.type&&"when"in e}function K(e){return null!=e&&"object"==typeof e&&"createQuery"in e&&"queryFeatureCount"in e&&"queryObjectIds"in e&&"queryRelatedFeatures"in e&&"queryRelatedFeaturesCount"in e&&"relationships"in e}function W(e){return J(e)&&K(e)}function X(e){return!!e&&"object"==typeof e&&"sourceLayer"in e&&W(e.sourceLayer)}function Y(e,t){const{fieldInfos:r,fieldName:n,preventPlacesFormatting:i,layer:o}=t,a=ee(r,n),f=a?.clone(),d=O(o,n);if(f&&!s(n)){const t=d?.type;if("date"===t||"date-only"===t||"time-only"===t||"timestamp-offset"===t||f.format?.dateFormat){const r=f.format??new p;if(r.dateFormat??="date-only"===t?"short-date":"short-date-short-time","number"==typeof e){const t=!Z(o)&&c(o)&&o.datesInUnknownTimezone||Z(o)&&B(o.layer)&&o.layer.datesInUnknownTimezone;return r.formatDate(e,t)}switch(t){case"date-only":return r.formatDateOnly(e);case"time-only":return r.formatTimeOnly(e);case"timestamp-offset":return r.formatTimestamp(e)}}}const y=f?.format;return"string"==typeof e&&s(n)&&y?y.formatRasterPixelValue(e):"string"==typeof(e=V(e,y))||null==e||null==y?le(e):i?l(e,{...u(y),minimumFractionDigits:0,maximumFractionDigits:20}):y.formatNumber(e)}function ee(e,t){if(e&&e.length&&t)return e.find((e=>e.fieldName?.toLowerCase()===t.toLowerCase()))}function te({fieldName:e,graphic:t,layer:r}){if(pe(e))return null;if(!r||"function"!=typeof r.getFeatureType)return null;const{typeIdField:n}=r;if(!n||e!==n)return null;const i=r.getFeatureType(t);return i?i.name:null}function re({fieldName:e,value:t,graphic:r,layer:n}){if(pe(e))return null;if(!n||"function"!=typeof n.getFieldDomain)return null;const i=r&&n.getFieldDomain(e,{feature:r});return i&&"coded-value"===i.type?i.getName(t):null}function ne(e,t){const{creatorField:n,creationDateField:i,editorField:o,editDateField:a}=e;if(!t)return;const l=t[a];if("number"==typeof l){const e=t[o];return{type:"edit",date:r(l,x),user:e}}const u=t[i];if("number"==typeof u){const e=t[n];return{type:"create",date:r(u,x),user:e}}return null}function ie(e,t){const r=new Map;return e?(e.forEach((e=>{const n=$(e.fieldName,t);e.fieldName=n,r.set(n.toLowerCase(),e)})),r):r}function oe(e){const t=[];if(!e)return t;const{fieldInfos:r,content:n}=e;return r&&t.push(...r),n&&Array.isArray(n)?(n.forEach((e=>{if("fields"===e.type){const r=e&&e.fieldInfos;r&&t.push(...r)}})),t):t}function ae(e){return e.replaceAll(j,(e=>`&#${e.charCodeAt(0)};`))}function le(e){return"string"==typeof e?e.replaceAll(w,'<br class="esri-text-new-line" />'):e}function ue(e){const{value:t,fieldName:n,fieldInfos:l,fieldInfoMap:u,layer:s,graphic:f}=e;if(null==t)return"";const c=re({fieldName:n,value:t,graphic:f,layer:s});if(c)return c;const d=te({fieldName:n,graphic:f,layer:s});if(d)return d;if(u.get(n.toLowerCase()))return Y(t,{fieldInfos:l||Array.from(u.values()),fieldName:n,layer:s});switch(s?.fieldsIndex?.get(n)?.type){case"date":return r(t);case"date-only":return a(t);case"time-only":return o(t);case"timestamp-offset":return i(t)}return le(t)}function se({fieldInfos:e,attributes:t,layer:r,graphic:n,fieldInfoMap:i,relatedInfos:o}){const a={};return o?.forEach((t=>ge({attributes:a,relatedInfo:t,fieldInfoMap:i,fieldInfos:e,layer:r}))),t&&Object.keys(t).forEach((o=>{const l=t[o];a[o]=ue({fieldName:o,fieldInfos:e,fieldInfoMap:i,layer:r,value:l,graphic:n})})),a}async function fe(e,t){const{layer:r,graphic:n,outFields:i,objectIds:o,returnGeometry:a,spatialReference:l}=e,u=o[0];if("number"!=typeof u&&"string"!=typeof u){const e="Could not query required fields for the specified feature. The feature's ID is invalid.",t={layer:r,graphic:n,objectId:u,requiredFields:i};return g.warn(e,t),null}if(!d(r)?.operations?.supportsQuery){const e="The specified layer cannot be queried. The following fields will not be available.",t={layer:r,graphic:n,requiredFields:i,returnGeometry:a};return g.warn(e,t),null}const s=r.createQuery();s.objectIds=o,s.outFields=i?.length?i:[r.objectIdField],s.returnGeometry=!!a,s.returnZ=!!a,s.returnM=!!a,s.outSpatialReference=l;return(await r.queryFeatures(s,t)).features[0]}async function ce(e){if(!e.expressionInfos?.length)return!1;const t=await y(),{arcadeUtils:{hasGeometryFunctions:r}}=t;return r(e)}async function de({graphic:e,popupTemplate:t,layer:r,spatialReference:n},i){if(!r||!t)return;if("function"==typeof r.load&&await r.load(i),!e.attributes)return;const o=e.attributes[r.objectIdField];if(null==o)return;const a=[o],l=await t.getRequiredFields(r.fieldsIndex),u=f(l,e),s=u?[]:l,c=t.returnGeometry||await ce(t);if(u&&!c)return;const d=await fe({layer:r,graphic:e,outFields:s,objectIds:a,returnGeometry:c,spatialReference:n},i);d&&(d.geometry&&(e.geometry=d.geometry),d.attributes&&(e.attributes={...e.attributes,...d.attributes}))}function pe(e=""){return!!e&&e.includes(T)}function ye(e){return e?`${T}${e.layerId}/${e.fieldName}`:""}function me({attributes:e,graphic:t,relatedInfo:r,fieldInfos:n,fieldInfoMap:i,layer:o}){e&&t&&r&&Object.keys(t.attributes).forEach((a=>{const l=ye({layerId:r.relation.id.toString(),fieldName:a}),u=t.attributes[a];e[l]=ue({fieldName:l,fieldInfos:n,fieldInfoMap:i,layer:o,value:u,graphic:t})}))}function ge({attributes:e,relatedInfo:t,fieldInfoMap:r,fieldInfos:n,layer:i}){e&&t&&(t.relatedFeatures&&t.relatedFeatures&&t.relatedFeatures.forEach((o=>me({attributes:e,graphic:o,relatedInfo:t,fieldInfoMap:r,fieldInfos:n,layer:i}))),t.relatedStatsFeatures&&t.relatedStatsFeatures&&t.relatedStatsFeatures.forEach((o=>me({attributes:e,graphic:o,relatedInfo:t,fieldInfoMap:r,fieldInfos:n,layer:i}))))}const he=e=>{if(!e)return!1;const t=e.toUpperCase();return t.includes("CURRENT_TIMESTAMP")||t.includes("CURRENT_DATE")||t.includes("CURRENT_TIME")},Ie=({layer:e,method:t,query:r,definitionExpression:n})=>{if(!e.capabilities?.query?.supportsCacheHint||"attachments"===t)return;const i=null!=r.where?r.where:null,o=null!=r.geometry?r.geometry:null;he(n)||he(i)||"extent"===o?.type||"tile"===r.resultType||(r.cacheHint=!0)},be=({query:e,layer:t,method:r})=>{Ie({layer:t,method:r,query:e,definitionExpression:`${t.definitionExpression} ${t.serviceDefinitionExpression}`})},Fe=({queryPayload:e,layer:t,method:r})=>{Ie({layer:t,method:r,query:e,definitionExpression:`${t.definitionExpression} ${t.serviceDefinitionExpression}`})};function we(e,t,r){return e&&t&&r?je(e.allLayers,t,r)||je(e.allTables,t,r):null}function je(e,t,r){return e.filter(W).find((e=>e!==t&&e.url===t.url&&e.layerId===r.relatedTableId))}function Ne(e){const t=e.getObjectId();return null!=t?`oid:${t}`:`uid:${e.uid}`}export{le as applyTextFormattingHTML,ie as createfieldInfoMap,we as findRelatedLayer,z as fixTokens,se as formatAttributes,ne as formatEditInfo,Y as formatValueToFieldInfo,oe as getAllFieldInfos,ee as getFieldInfo,L as getFieldInfoLabel,$ as getFixedFieldName,U as getFixedFieldNames,Ne as getHighlightKeyForFeature,C as getSourceLayer,q as graphicCallback,ae as htmlEntities,M as isExpressionField,J as isFeatureSupportedLayer,X as isGraphicForRelatableFeatureSupportedLayer,W as isRelatableFeatureSupportedLayer,K as isRelatableLayer,pe as isRelatedField,be as preLayerQueryCallback,Fe as preRequestCallback,fe as querySourceLayer,de as queryUpdatedFeature,A as shouldOpenInNewTab,k as substituteAttributes,G as substituteFieldsInLinksAndAttributes};
5
+ import e from"../../../core/Logger.js";import{replace as t}from"../../../core/string.js";import{utcTimeZone as n,formatDate as r,convertDateFormatToIntlOptions as i,formatTimestamp as o,formatTimeOnly as a,formatDateOnly as l}from"../../../intl/date.js";import{formatNumber as u,convertNumberFormatToIntlOptions as f}from"../../../intl/number.js";import{isRasterPixelValueField as s,featureHasFields as c}from"../../../layers/support/fieldUtils.js";import{isFeatureLayer as d,getEffectiveLayerCapabilities as p}from"../../../layers/support/layerUtils.js";import m from"../../../popup/support/FieldInfoFormat.js";import{loadArcade as y}from"../../../support/arcadeOnDemand.js";const g="esri.widgets.Feature.support.featureUtils",h=e.getLogger(g),I=/href=(""|'')/gi,b=/(\{([^\{\r\n]+)\})/g,F=/\'/g,w=/^\s*expression\//i,j=/(\n)/gi,N=/[\u00A0-\u9999<>\&]/gim,E=/href\s*=\s*(?:\"([^\"]+)\"|\'([^\']+)\')/gi,T=/^(?:mailto:|tel:)/,x="relationships/",C=i("short-date-short-time");function q(e){if(null!=e)return(e.sourceLayer||e.layer)??void 0}async function A(e,t){return"function"==typeof e?e(t):e}function M(e=""){if(e)return!T.test(e.trim().toLowerCase())}function R(e){return!!e&&w.test(e)}function L(e,t){if(!R(t)||!e)return null;const n=t.replace(w,"").toLowerCase();let r=null;return e.some((e=>e.name.toLowerCase()===n&&(r=e,!0))),r}function v(e,t){const n=L(t,e?.fieldName);return n?n.title||null:e?e.label||e.fieldName:null}function D(e,t){const n=t.get(e.toLowerCase());return`{${n&&n.fieldName||e}}`}function Z(e){return e.replaceAll(I,"")}function $(e,t){const n=O(t,e);return n?n.name:e}function U(e,t){return e&&e.map((e=>$(e,t)))}function O(e,t){return e&&"function"==typeof e.getField&&t?e.getField(t)??null:null}function G(e){return`${e}`.trim()}function k({attributes:e,globalAttributes:t,layer:n,text:r,expressionAttributes:i,fieldInfoMap:o}){return r?S({formattedAttributes:t,template:H(r,{...t,...i,...e},n),fieldInfoMap:o}):""}function S({formattedAttributes:e,template:n,fieldInfoMap:r}){return G(Z(t(t(n,(e=>D(e,r))),e)))}function P(e,t,n=!1){const r=t[e];if("string"==typeof r){const i="%27",o=(n?encodeURIComponent(r):r).replaceAll(F,i);t[e]=o}}function Q(e,t=!1){const n={...e};return Object.keys(n).forEach((e=>P(e,n,t))),n}function _(e,n,r){const i=(n=G(n))&&"{"!==n[0];return t(e,Q(r,i||!1))}function z(e,t){return e.replaceAll(b,((e,n,r)=>{const i=O(t,r);return i?`{${i.name}}`:n}))}function H(e,t,n){const r=z(e,n);return r?r.replaceAll(E,((e,n,r)=>_(e,n||r,t))):r}function V(e,t){if("string"==typeof e&&t&&null==t.dateFormat&&(null!=t.places||null!=t.digitSeparator)){const t=Number(e);if(!isNaN(t))return t}return e}function B(e){return null!=e&&"object"==typeof e&&"layer"in e&&!!e.layer}function J(e){return null!=e&&"object"==typeof e&&"type"in e&&"map-image"===e.type}function K(e){return null!=e&&"object"==typeof e&&"fieldsIndex"in e&&"geometryType"in e&&"getField"in e&&"load"in e&&"loaded"in e&&"objectIdField"in e&&"spatialReference"in e&&"type"in e&&"feature"===e.type&&"when"in e}function W(e){return null!=e&&"object"==typeof e&&"createQuery"in e&&"queryFeatureCount"in e&&"queryObjectIds"in e&&"queryRelatedFeatures"in e&&"queryRelatedFeaturesCount"in e&&"relationships"in e}function X(e){return K(e)&&W(e)}function Y(e){return!!e&&"object"==typeof e&&"sourceLayer"in e&&X(e.sourceLayer)}function ee(e,t){const{fieldInfos:r,fieldName:i,preventPlacesFormatting:o,layer:a,timeZone:l}=t,c=te(r,i),p=c?.clone(),y=O(a,i);if(p&&!s(i)){const t=y?.type;if("date"===t||"date-only"===t||"time-only"===t||"timestamp-offset"===t||p.format?.dateFormat){const r=p.format??new m;if(r.dateFormat??="date-only"===t?"short-date":"short-date-short-time","number"==typeof e){const t=!B(a)&&d(a)&&a.datesInUnknownTimezone||B(a)&&J(a.layer)&&a.layer.datesInUnknownTimezone;return r.formatDate(e,t?n.timeZone:l)}switch(t){case"date-only":return r.formatDateOnly(e);case"time-only":return r.formatTimeOnly(e);case"timestamp-offset":return r.formatTimestamp(e,l)}}}const g=p?.format;return"string"==typeof e&&s(i)&&g?g.formatRasterPixelValue(e):"string"==typeof(e=V(e,g))||null==e||null==g?ue(e):o?u(e,{...f(g),minimumFractionDigits:0,maximumFractionDigits:20}):g.formatNumber(e)}function te(e,t){if(e&&e.length&&t)return e.find((e=>e.fieldName?.toLowerCase()===t.toLowerCase()))}function ne({fieldName:e,graphic:t,layer:n}){if(me(e))return null;if(!n||"function"!=typeof n.getFeatureType)return null;const{typeIdField:r}=n;if(!r||e!==r)return null;const i=n.getFeatureType(t);return i?i.name:null}function re({fieldName:e,value:t,graphic:n,layer:r}){if(me(e))return null;if(!r||"function"!=typeof r.getFieldDomain)return null;const i=n&&r.getFieldDomain(e,{feature:n});return i&&"coded-value"===i.type?i.getName(t):null}function ie(e,t){const{creatorField:n,creationDateField:i,editorField:o,editDateField:a}=e;if(!t)return;const l=t[a];if("number"==typeof l){const e=t[o];return{type:"edit",date:r(l,C),user:e}}const u=t[i];if("number"==typeof u){const e=t[n];return{type:"create",date:r(u,C),user:e}}return null}function oe(e,t){const n=new Map;return e?(e.forEach((e=>{const r=$(e.fieldName,t);e.fieldName=r,n.set(r.toLowerCase(),e)})),n):n}function ae(e){const t=[];if(!e)return t;const{fieldInfos:n,content:r}=e;return n&&t.push(...n),r&&Array.isArray(r)?(r.forEach((e=>{if("fields"===e.type){const n=e&&e.fieldInfos;n&&t.push(...n)}})),t):t}function le(e){return e.replaceAll(N,(e=>`&#${e.charCodeAt(0)};`))}function ue(e){return"string"==typeof e?e.replaceAll(j,'<br class="esri-text-new-line" />'):e}function fe(e){const{value:t,fieldName:n,fieldInfos:i,fieldInfoMap:u,layer:f,graphic:s,timeZone:c}=e;if(null==t)return"";const d=re({fieldName:n,value:t,graphic:s,layer:f});if(d)return d;const p=ne({fieldName:n,graphic:s,layer:f});if(p)return p;if(u.get(n.toLowerCase()))return ee(t,{fieldInfos:i||Array.from(u.values()),fieldName:n,layer:f,timeZone:c});switch(f?.fieldsIndex?.get(n)?.type){case"date":return r(t);case"date-only":return l(t);case"time-only":return a(t);case"timestamp-offset":return o(t)}return ue(t)}function se({fieldInfos:e,attributes:t,layer:n,graphic:r,fieldInfoMap:i,relatedInfos:o,timeZone:a}){const l={};return o?.forEach((t=>he({attributes:l,relatedInfo:t,fieldInfoMap:i,fieldInfos:e,layer:n,timeZone:a}))),t&&Object.keys(t).forEach((o=>{const u=t[o];l[o]=fe({fieldName:o,fieldInfos:e,fieldInfoMap:i,layer:n,value:u,graphic:r,timeZone:a})})),l}async function ce(e,t){const{layer:n,graphic:r,outFields:i,objectIds:o,returnGeometry:a,spatialReference:l}=e,u=o[0];if("number"!=typeof u&&"string"!=typeof u){const e="Could not query required fields for the specified feature. The feature's ID is invalid.",t={layer:n,graphic:r,objectId:u,requiredFields:i};return h.warn(e,t),null}if(!p(n)?.operations?.supportsQuery){const e="The specified layer cannot be queried. The following fields will not be available.",t={layer:n,graphic:r,requiredFields:i,returnGeometry:a};return h.warn(e,t),null}const f=n.createQuery();f.objectIds=o,f.outFields=i?.length?i:[n.objectIdField],f.returnGeometry=!!a,f.returnZ=!!a,f.returnM=!!a,f.outSpatialReference=l;return(await n.queryFeatures(f,t)).features[0]}async function de(e){if(!e.expressionInfos?.length)return!1;const t=await y(),{arcadeUtils:{hasGeometryFunctions:n}}=t;return n(e)}async function pe({graphic:e,popupTemplate:t,layer:n,spatialReference:r},i){if(!n||!t)return;if("function"==typeof n.load&&await n.load(i),!e.attributes)return;const o=e.attributes[n.objectIdField];if(null==o)return;const a=[o],l=await t.getRequiredFields(n.fieldsIndex),u=c(l,e),f=u?[]:l,s=t.returnGeometry||await de(t);if(u&&!s)return;const d=await ce({layer:n,graphic:e,outFields:f,objectIds:a,returnGeometry:s,spatialReference:r},i);d&&(d.geometry&&(e.geometry=d.geometry),d.attributes&&(e.attributes={...e.attributes,...d.attributes}))}function me(e=""){return!!e&&e.includes(x)}function ye(e){return e?`${x}${e.layerId}/${e.fieldName}`:""}function ge({attributes:e,graphic:t,relatedInfo:n,fieldInfos:r,fieldInfoMap:i,layer:o,timeZone:a}){e&&t&&n&&Object.keys(t.attributes).forEach((l=>{const u=ye({layerId:n.relation.id.toString(),fieldName:l}),f=t.attributes[l];e[u]=fe({fieldName:u,fieldInfos:r,fieldInfoMap:i,layer:o,value:f,graphic:t,timeZone:a})}))}function he({attributes:e,relatedInfo:t,fieldInfoMap:n,fieldInfos:r,layer:i,timeZone:o}){e&&t&&(t.relatedFeatures?.forEach((a=>ge({attributes:e,graphic:a,relatedInfo:t,fieldInfoMap:n,fieldInfos:r,layer:i,timeZone:o}))),t.relatedStatsFeatures?.forEach((a=>ge({attributes:e,graphic:a,relatedInfo:t,fieldInfoMap:n,fieldInfos:r,layer:i,timeZone:o}))))}const Ie=e=>{if(!e)return!1;const t=e.toUpperCase();return t.includes("CURRENT_TIMESTAMP")||t.includes("CURRENT_DATE")||t.includes("CURRENT_TIME")},be=({layer:e,method:t,query:n,definitionExpression:r})=>{if(!e.capabilities?.query?.supportsCacheHint||"attachments"===t)return;const i=null!=n.where?n.where:null,o=null!=n.geometry?n.geometry:null;Ie(r)||Ie(i)||"extent"===o?.type||"tile"===n.resultType||(n.cacheHint=!0)},Fe=({query:e,layer:t,method:n})=>{be({layer:t,method:n,query:e,definitionExpression:`${t.definitionExpression} ${t.serviceDefinitionExpression}`})},we=({queryPayload:e,layer:t,method:n})=>{be({layer:t,method:n,query:e,definitionExpression:`${t.definitionExpression} ${t.serviceDefinitionExpression}`})};function je(e,t,n){return e&&t&&n?Ne(e.allLayers,t,n)||Ne(e.allTables,t,n):null}function Ne(e,t,n){return e.filter(X).find((e=>e!==t&&e.url===t.url&&e.layerId===n.relatedTableId))}function Ee(e){const t=e.getObjectId();return null!=t?`oid:${t}`:`uid:${e.uid}`}export{ue as applyTextFormattingHTML,oe as createfieldInfoMap,je as findRelatedLayer,z as fixTokens,se as formatAttributes,ie as formatEditInfo,ee as formatValueToFieldInfo,ae as getAllFieldInfos,te as getFieldInfo,v as getFieldInfoLabel,$ as getFixedFieldName,U as getFixedFieldNames,Ee as getHighlightKeyForFeature,q as getSourceLayer,A as graphicCallback,le as htmlEntities,R as isExpressionField,K as isFeatureSupportedLayer,Y as isGraphicForRelatableFeatureSupportedLayer,X as isRelatableFeatureSupportedLayer,W as isRelatableLayer,me as isRelatedField,Fe as preLayerQueryCallback,we as preRequestCallback,ce as querySourceLayer,pe as queryUpdatedFeature,M as shouldOpenInNewTab,S as substituteAttributes,k as substituteFieldsInLinksAndAttributes};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import{deprecatedProperty as n}from"../../core/deprecate.js";import s from"../../core/Evented.js";import i from"../../core/Logger.js";import{destroyMaybe as o}from"../../core/maybe.js";import{EsriPromiseMixin as r}from"../../core/Promise.js";import{watch as a}from"../../core/reactiveUtils.js";import{templateHasKey as l}from"../../core/string.js";import{property as u}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as c}from"../../core/support/UpdatingHandles.js";import d from"../../form/FormTemplate.js";import h from"../../layers/support/ContingentValue.js";import{isEditableLayer as f}from"../../layers/support/editableLayers.js";import m from"../../layers/support/LayerContingentValuesCache.js";import{flattenFieldInputs as g,flattenRelationshipInputs as y,parseFormTemplateString as _,isGroupInput as v,isGroupElement as I,isFieldElement as E,isRelationshipElement as C,isRelationshipInput as x,isFieldInput as F,getNormalizedFeatureTypeInfo as b}from"./featureFormUtils.js";import V from"./FieldInput.js";import{createFormExpressionArcadeExecutor as w}from"./FormExpressionArcadeExecutor.js";import{FormExpressionsManager as j}from"./FormExpressionsManager.js";import A from"./GroupInput.js";import T from"./RelationshipInput.js";const M=new t({attributes:{}}),R=["editableExpression","requiredExpression","valueExpression","visibilityExpression"],N=["visibilityExpression"],S=["editableExpression","visibilityExpression"],L="#JSAPI_CONTINGENT_VALUE_EMPTY_HASH",k="#JSAPI_CONTINGENT_VALUE_ANY_HASH",U="#JSAPI_CONTINGENT_VALUE_NULL_HASH",H="esri.widgets.FeatureForm.FeatureFormViewModel",P=i.getLogger(H);let G=class extends(r(s.EventedAccessor)){constructor(e){super(e),this._expressionExecutorsInUse=new Set,this._expressionExecutorLookup=new Map,this._expressionsManager=null,this._contingentValuesCache=null,this._featureClone=M.clone(),this._initialFeature=M.clone(),this._updatingHandles=new c,this.arcadeEditType="NA",this.contingencyConstraintViolations=new Map,this.disabled=!1,this.inputs=[],this.map=null,this.relatedRecordCallbacks=null,this.strict=!1}initialize(){const e=a((()=>[this.layer,!!this.layer?.loaded,this.formTemplate,this.feature,this.arcadeEditType]),(async([e,t])=>{null!=e&&(t?this._updatingHandles.addPromise(this._updateInputs()):e.load().catch((()=>{})))}),{equals:([e,t,n,s,i],[o,r,a,l,u])=>e===o&&t===r&&n===a&&s===l&&i===u,initial:!0}),t=a((()=>this._arcadeContextInfo),(e=>{null!=this._expressionsManager&&(this._expressionsManager.arcadeContextInfo=e)})),n=a((()=>this.layer),(e=>{const t="subtype-sublayer"===e?.type?e.parent:"feature"===e?.type?e:null;t&&this.addResolvingPromise(m.createLoadedLayerContingentValuesCache(t).then((e=>{this._contingentValuesCache=e,this.notifyChange("fieldsWithContingentValues")})))}),{initial:!0});this.addHandles([e,t,n])}destroy(){this.feature=null,this.layer=null,this._contingentValuesCache=o(this._contingentValuesCache),this._updatingHandles.destroy()}get _expressionInfosLookup(){return new Map(this.formTemplate?.expressionInfos?.map((e=>[e.name,e])))}get activeRelationshipInput(){return this.allRelationshipInputs.find((e=>e.relationshipId===this.relationshipId))}get _arcadeContextInfo(){const{_initialFeature:e,arcadeEditType:t,layer:n,map:s,spatialReference:i}=this;return{layer:f(n)?n:null,originalFeature:e,editType:t,map:s,spatialReference:i}}get allFieldInputs(){return g(this.inputs)}get allRelationshipInputs(){return y(this.inputs)}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():M.clone(),this._initialFeature=this._featureClone.clone(),this._expressionsManager&&(this._expressionsManager.feature=this._featureClone),e?(this._resetFieldInputValues(this._featureClone),this.allRelationshipInputs.forEach((t=>t.feature=e))):(this.inputs.forEach((e=>e.destroy())),this.inputs.length=0),this.contingencyConstraintViolations.clear(),this._set("feature",e)}get fieldsWithContingentValues(){if(null==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){void 0===e?this._clearOverride("formTemplate"):this._override("formTemplate",e)}get formDescription(){const{formTemplate:e,layer:t}=this;return null!=e&&e.description&&t?_(e.description,this.getValues(),t.fieldsIndex):null}get formTitle(){const{formTemplate:e,layer:t}=this;return null!=e&&e.title&&t?_(e.title,this.getValues(),t.fieldsIndex):null}formHeaderVisible(){const{activeRelationshipInput:e,formDescription:t,formTitle:n}=this;return!(e||!t&&!n)}set inputFields(e){n(P,"inputFields",{replacement:"FeatureFormViewModel.inputs",version:"4.27"}),this.inputs=e}get inputFields(){return n(P,"inputFields",{replacement:"FeatureFormViewModel.inputs",version:"4.27"}),this.inputs}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 relationshipId(){return this._get("relationshipId")}set relationshipId(e){const t=this.allRelationshipInputs;if(null!=e&&e===this.relationshipId||t.forEach((e=>e.showAllEnabled=!1)),null!=e){const n=t.find((t=>t.relationshipId===e));n&&(n.showAllEnabled=!0)}this._set("relationshipId",e)}get spatialReference(){return this.layer?.spatialReference??null}set spatialReference(e){this._override("spatialReference",e)}get state(){return this.layer?.loaded?"ready":"disabled"}get submittable(){return!!this.valid||this.allFieldInputs.filter((e=>!e.valid)).every((({submittable:e})=>e))}get updating(){return this._updatingHandles.updating}get valid(){const e=this.allFieldInputs;return e.length>0&&e.every((({valid:e})=>e))}get view(){return n(P,"view",{replacement:"FeatureForm.map",version:"4.27"}),this._get("view")}set view(e){n(P,"view",{replacement:"FeatureForm.map",version:"4.27"}),this._set("view",e),e?.map&&(this.map=e.map)}findField(e){return this.allFieldInputs.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),null!=this._expressionsManager&&this._updatingHandles.addPromise(this._expressionsManager.evaluateInvalidated([i.name]).finally((()=>this._afterExpressionsEvaluated())))))}getValues(){return{...this._featureClone.attributes}}overrideInitialFeature(e){this._initialFeature=e}submit(){const e=this.allFieldInputs,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,o]of this.contingencyConstraintViolations.entries())"error"===o.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,null==n)return[];const{invalid:i,incomplete:o}=n.validateContingencyConstraints(e),r=[...i,...t?.includeIncompleteViolations?o:[]];for(const a of r)for(const e of a.fieldGroup.fields)s.set(e,a);return r}notifyFeatureGeometryChanged(){const{_expressionsManager:e,feature:t,_featureClone:n}=this;n.geometry=t.geometry,null!=e&&this._updatingHandles.addPromise(e.evaluateInvalidatedByGeometry().finally((()=>this._afterExpressionsEvaluated())))}_emitChangeEvent({name:e,valid:t,value:n}){this.emit("value-change",{layer:this.layer,feature:this.feature,fieldName:e,value:n,valid:t})}async _updateInputs(){this._stopExpressions();const{_featureClone:e,_initialFeature:t,arcadeEditType:n,formTemplate:s,inputs:i,layer:o}=this;if(!o)return;const r={arcadeEditType:n,feature:e,initialFeature:t,layer:o},a=i.slice(),l=null!=s&&s.elements&&s.elements.length>0?await this._updateInputsUsingFormElements(a,s.elements,r):this._updateInputsUsingLayerFields(a,o?.fields,r);this.inputs=l,await this._startExpressions()}async _updateInputsUsingFormElements(e,t,n){const s=new Map;for(const r of e)if(v(r)){s.set(r.element,r);for(const e of r.inputs)e.element&&s.set(e.element,e)}else r.element&&s.set(r.element,r);const i=new Map,o=this._updateInputsUsingFormElementsRecursive({existingInputsByElement:s,updatedElements:t.filter(O),sharedInitializationProperties:n,group:null,newExpressionExecutorPromises:i});for(const[r,a]of s.entries())s.delete(r),a.destroy();return await Promise.all(Array.from(i.values())),o}_updateInputsUsingFormElementsRecursive(e){const{existingInputsByElement:t,updatedElements:n,sharedInitializationProperties:s,group:i,newExpressionExecutorPromises:o}=e,r=[];for(const a of n){const e=t.has(a),n=e?t.get(a):I(a)?this._makeGroupInputFromElement(a,s):E(a)?this._makeFieldInputFromElement(a,s,i):C(a)?this._makeRelationshipInputFromElement(a,s,i):null;if(n){if(r.push(n),this._assignExpressionExecutors(n,a,o),e)if(t.delete(a),v(n)){const{feature:e}=s;n.set({feature:e})}else if(x(n)){const e=this.relationshipId===a.relationshipId;n.set(s),n.set({map:this.map,showAllEnabled:e})}else n.set(s);if(I(a)){const e=a.elements.filter((e=>O(e)));n.inputs=this._updateInputsUsingFormElementsRecursive({existingInputsByElement:t,updatedElements:e,sharedInitializationProperties:s,group:n,newExpressionExecutorPromises:o})}}}return r}_updateInputsUsingLayerFields(e,t,n){if(!Array.isArray(t))return i.getLogger(this).warn(this.declaredClass,"No attribute fields found."),[];const s=new Map;for(const i of e)if(v(i)){for(const e of i.inputs)e.destroy();i.inputs.length=0,i.destroy()}else x(i)?i.destroy():F(i)&&(null!==i.element?i.destroy():s.set(i.field,i));const o=[],{arcadeEditType:r,feature:a,initialFeature:l,layer:u}=n;for(const i of t){const e=s.get(i)??new V({arcadeEditType:r,field:i,feature:a,initialFeature:l,layer:u,value:a?.getAttribute(i.name)??null});o.push(e),s.delete(i)}for(const[i,p]of s.entries())s.delete(i),p.destroy();return o}_resetFieldInputValues(e){for(const t of this.allFieldInputs)t.value=e.getAttribute(t.name)}_makeFieldInputFromElement(e,t,n){const{arcadeEditType:s,feature:i,initialFeature:o,layer:r}=t,{fieldName:a}=e,l=a&&this._layerFieldsByName.get(a);return l?new V({arcadeEditType:s,element:e,field:l,value:i?.getAttribute(e.fieldName)??null,feature:i,initialFeature:o,layer:r,group:n}):null}_makeGroupInputFromElement(e,t){const{feature:n,layer:s}=t;return new A({element:e,inputs:[],feature:n,layer:s})}_makeRelationshipInputFromElement(e,t,n=null){const{map:s}=this,{feature:i,layer:o}=t;return new T({element:e,feature:i,group:n,layer:o,map:s})}_assignExpressionExecutors(e,t,n){const s=I(t)?N:C(t)?S:R,i=[];for(const o of s){const s=`${o}Executor`;if(e[s]){this._useExecutor(e[s]);continue}const i=t[o],{_expressionExecutorLookup:r}=this;if(null!=i&&""!==i){const t=this._expressionInfosLookup.get(i)?.expression??i;if(r.has(t))e[s]=this._useExecutor(r.get(t));else if(n.has(t)){const i=n.get(t).then((t=>(e[s]=t,t)));n.set(t,i)}else{const i=w(t,this.layer).then((n=>(e[s]=this._useExecutor(n),r.set(t,n),n)));n.set(t,i)}}}return i}_createExpressionsManager(e){const{_arcadeContextInfo:t,_featureClone:n,allFieldInputs:s}=this;this._expressionsManager=new j({executors:e,feature:n,arcadeContextInfo:t,fieldInputs:s})}async _startExpressions(){if(0===this._expressionExecutorsInUse.size)return;const e=Array.from(this._expressionExecutorsInUse);this._createExpressionsManager(e),await this._expressionsManager.evaluateAll().finally((()=>this._afterExpressionsEvaluated()))}_stopExpressions(){this._expressionsManager=o(this._expressionsManager),this._expressionExecutorsInUse.clear()}_useExecutor(e){return this._expressionExecutorsInUse.add(e),e}_afterValueChange(e){const{name:t,value:n}=e,{_featureClone:s,formTemplate:i,layer:o}=this;if(!o)return;const r=s.getAttribute(t);s.setAttribute(t,n);const{typeFieldName:a,types:u}=b(o);if(t===a&&n!==r){if("subtype-sublayer"===o.type){const e=o.parent?.findSublayerForFeature(s);s.sourceLayer=this.feature.sourceLayer=e}const e=new Set;for(const t of u)if(t.domains&&"object"==typeof t.domains)for(const n of Object.keys(t.domains))e.add(n);for(const t of e){const e=this.findField(t);e&&e.notifyChange("domain")}}if(null!=i){const{description:e,title:n}=i;n&&l(n,t)&&this.notifyChange("formTitle"),e&&l(e,t)&&this.notifyChange("formDescription")}this._emitChangeEvent(e)}_afterExpressionsEvaluated(){const{_featureClone:e}=this;for(const t of this.allFieldInputs)t.value!==e.getAttribute(t.name)&&this._afterValueChange(t)}_joinContingentValues(){const e=this._contingentValuesCache;if(null==e)return[];const{typeFieldName:t}=b(this.layer),n=t?this.getValue(t):null,s=[];for(const r of e.fieldGroups){const{contingencies:e,fields:t,name:i}=r,o=[];for(const s of e)s.isRetired||null!=s.subtype&&s.subtype.code!==n||o.push({values:s.values});o.length>0&&s.push({name:i,fields:t,contingencies:o})}const[i,o]=this._generateJoinPlan(s);return[...i.flatMap((e=>this._joinFieldGroupContingencies(e))),...o.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),o=l,r=[i.name,o.name].sort().join("|");if(s.has(r))continue;n.push([i,o]),s.add(r),t.set(e,o)}else t.set(e,l);const i=new Set(n.flat()),o=new Set(e);for(const l of i)o.delete(l);const r=new Map,a=new Map;for(const l of new Set(n.flat())){const e=Symbol(l.name);r.set(e,new Set([l])),a.set(l,e)}for(const[l,u]of n){const e=a.get(l),t=a.get(u);if(e===t)continue;const n=r.get(e),s=r.get(t);for(const i of s)n.add(i),a.set(i,e);r.delete(t)}return[[...r.values()].map((e=>[...e])),[...o]]}_joinFieldGroupContingencies(e){const t=e.slice(),n=t.shift();let s=t.shift(),i=this._generateJoinKey(n.fields,s.fields),o=new Set([...n.fields,...s.fields]),r=new Map;for(const l of n.contingencies){const[e]=this._hashContingency(l,i.codedValueFields,!0);r.has(e)?r.get(e)?.push(l):r.set(e,[l])}for(;t.length>0;){const e=new Map,n=t.shift(),a=this._generateJoinKey(o,n.fields);for(const t of s.contingencies){const[n,s]=this._hashContingency(t,i.codedValueFields),o=s?this._findMatchingContingenciesWithAnyHashMask(r,n):r.get(n);if(r.has(k)&&o?.push(...this._findMatchingContingenciesContainingAny(t,r.get(k),i.codedValueFields)),null!=o)for(const r of o){const n=i.rangeFields.length>0?this._joinContingenciesWithRangeDomains(r,t,i.rangeFields):this._joinContingencies(r,t);if(null==n)break;const[s]=this._hashContingency(n,a.codedValueFields,!0);e.has(s)?e.get(s)?.push(n):e.set(s,[n])}}r=e,s=n,i=a,o=new Set([...o,...s.fields])}const a=[];for(const l of s.contingencies){const[e,t]=this._hashContingency(l,i.codedValueFields),n=t?this._findMatchingContingenciesWithAnyHashMask(r,e):r.get(e);if(r.has(k)&&n.push(...this._findMatchingContingenciesContainingAny(l,r.get(k),i.codedValueFields)),null!=n)for(const s of n){const e=i.rangeFields.length>0?this._joinContingenciesWithRangeDomains(s,l,i.rangeFields):this._joinContingencies(s,l);null!=e&&a.push(e)}}return a}_joinContingencies(e,t){const n={values:{...e.values,...t.values}};for(const[s,i]of Object.entries(n.values))"any"===i.objectType&&null!=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],o=t.values[i],{leftIsNull:r,rightIsNull:a,bothAreNull:l,leftIsAny:u,rightIsAny:p,bothAreAny:c,leftIsRange:d,rightIsRange:f}=this._compareObjectTypes(n.objectType,o.objectType);if(l||c)continue;if(r&&p||a&&u){s.values[i]=new h({objectType:"null"});continue}if(r&&f||a&&d)return null;u?(n.minValue=-1/0,n.maxValue=1/0):p&&(o.minValue=-1/0,o.maxValue=1/0);const m=Math.max(n.minValue,o.minValue),g=Math.min(n.maxValue,o.maxValue);if(m>g)return null;s.values[i]=new h({objectType:"range",minValue:m,maxValue:g})}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,o]of e){if(i===k)break;n.test(i)&&s.push(...o)}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,o=i===n?s:n,r=new Set,a=new Set;for(const l of i)if(o.has(l)){const e=this.layer?.getFieldDomain(l,{feature:this.feature});if(null==e)continue;switch(e.type){case"coded-value":r.add(l);break;case"range":a.add(l)}}return{codedValueFields:[...r],rangeFields:[...a]}}_hashContingency(e,t,n=!1){if(t.length<1)return[L,!1];const s=[];let i=!1;for(const o of t){const t=e.values[o];if("any"===t.objectType){if(n)return[k,!0];i=!0,s.push(`${o}:.*`)}else"null"===t.objectType?s.push(`${o}:${U}`):s.push(`${o}:${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}}};function O(e){return"field"===e.type||"group"===e.type||"relationship"===e.type||(i.getLogger(H).warn("form-info::unsupported-element-type","Only element types 'field', 'group' and 'relationship' are supported",`Element ${e.label} has unsupported type '${e.type}'`),!1)}e([u()],G.prototype,"_expressionInfosLookup",null),e([u()],G.prototype,"_featureClone",void 0),e([u()],G.prototype,"activeRelationshipInput",null),e([u()],G.prototype,"_arcadeContextInfo",null),e([u({readOnly:!0})],G.prototype,"allFieldInputs",null),e([u()],G.prototype,"allRelationshipInputs",null),e([u()],G.prototype,"_layerFieldsByName",null),e([u()],G.prototype,"arcadeEditType",void 0),e([u()],G.prototype,"contingencyConstraintViolations",void 0),e([u()],G.prototype,"disabled",void 0),e([u()],G.prototype,"feature",null),e([u()],G.prototype,"fieldsWithContingentValues",null),e([u({type:d})],G.prototype,"formTemplate",null),e([u()],G.prototype,"formDescription",null),e([u()],G.prototype,"formTitle",null),e([u()],G.prototype,"formHeaderVisible",null),e([u()],G.prototype,"inputs",void 0),e([u()],G.prototype,"inputFields",null),e([u()],G.prototype,"joinedContingentValues",null),e([u()],G.prototype,"layer",null),e([u()],G.prototype,"map",void 0),e([u()],G.prototype,"relatedRecordCallbacks",void 0),e([u()],G.prototype,"relationshipId",null),e([u()],G.prototype,"spatialReference",null),e([u()],G.prototype,"state",null),e([u()],G.prototype,"strict",void 0),e([u()],G.prototype,"submittable",null),e([u()],G.prototype,"updating",null),e([u()],G.prototype,"valid",null),e([u()],G.prototype,"view",null),e([u()],G.prototype,"getValues",null),e([u()],G.prototype,"submit",null),G=e([p(H)],G);const $=G;export{$ as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import{deprecatedProperty as n}from"../../core/deprecate.js";import s from"../../core/Evented.js";import i from"../../core/Logger.js";import{destroyMaybe as o}from"../../core/maybe.js";import{EsriPromiseMixin as r}from"../../core/Promise.js";import{watch as a}from"../../core/reactiveUtils.js";import{templateHasKey as l}from"../../core/string.js";import{property as u}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as c}from"../../core/support/UpdatingHandles.js";import d from"../../form/FormTemplate.js";import h from"../../layers/support/ContingentValue.js";import{isEditableLayer as f}from"../../layers/support/editableLayers.js";import m from"../../layers/support/LayerContingentValuesCache.js";import{flattenFieldInputs as g,flattenRelationshipInputs as y,parseFormTemplateString as _,isGroupInput as v,isGroupElement as F,isFieldElement as I,isRelationshipElement as C,isRelationshipInput as E,isFieldInput as x,getNormalizedFeatureTypeInfo as V,valueIsValidContingentValue as b}from"./featureFormUtils.js";import w from"./FieldInput.js";import{createFormExpressionArcadeExecutor as j}from"./FormExpressionArcadeExecutor.js";import{FormExpressionsManager as T}from"./FormExpressionsManager.js";import A from"./GroupInput.js";import M from"./RelationshipInput.js";const R=new t({attributes:{}}),S=["editableExpression","requiredExpression","valueExpression","visibilityExpression"],N=["visibilityExpression"],H=["editableExpression","visibilityExpression"],L="#JSAPI_CONTINGENT_VALUE_EMPTY_HASH",k="#JSAPI_CONTINGENT_VALUE_ANY_HASH",U="#JSAPI_CONTINGENT_VALUE_NULL_HASH",P="esri.widgets.FeatureForm.FeatureFormViewModel",W=i.getLogger(P);let O=class extends(r(s.EventedAccessor)){constructor(e){super(e),this._expressionExecutorsInUse=new Set,this._expressionExecutorLookup=new Map,this._expressionsManager=null,this._contingentValuesCache=null,this._featureClone=R.clone(),this._initialFeature=R.clone(),this._updatingHandles=new c,this.arcadeEditType="NA",this.contingencyConstraintViolations=new Map,this.disabled=!1,this.inputs=[],this.map=null,this.relatedRecordCallbacks=null,this.strict=!1}initialize(){const e=a((()=>[this.layer,!!this.layer?.loaded,this.formTemplate,this.feature,this.arcadeEditType]),(async([e,t])=>{null!=e&&(t?this._updatingHandles.addPromise(this._updateInputs()):e.load().catch((()=>{})))}),{equals:([e,t,n,s,i],[o,r,a,l,u])=>e===o&&t===r&&n===a&&s===l&&i===u,initial:!0}),t=a((()=>this._arcadeContextInfo),(e=>{null!=this._expressionsManager&&(this._expressionsManager.arcadeContextInfo=e)})),n=a((()=>this.layer),(e=>{const t="subtype-sublayer"===e?.type?e.parent:"feature"===e?.type?e:null;t&&this.addResolvingPromise(m.createLoadedLayerContingentValuesCache(t).then((e=>{this._contingentValuesCache=e,this.notifyChange("fieldsWithContingentValues")})))}),{initial:!0});this.addHandles([e,t,n])}destroy(){this.feature=null,this.layer=null,this._contingentValuesCache=o(this._contingentValuesCache),this._updatingHandles.destroy()}get _expressionInfosLookup(){return new Map(this.formTemplate?.expressionInfos?.map((e=>[e.name,e])))}get activeRelationshipInput(){return this.allRelationshipInputs.find((e=>e.relationshipId===this.relationshipId))}get _arcadeContextInfo(){const{_initialFeature:e,arcadeEditType:t,layer:n,map:s,spatialReference:i}=this;return{layer:f(n)?n:null,originalFeature:e,editType:t,map:s,spatialReference:i}}get allFieldInputs(){return g(this.inputs)}get allRelationshipInputs(){return y(this.inputs)}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():R.clone(),this._initialFeature=this._featureClone.clone(),this._expressionsManager&&(this._expressionsManager.feature=this._featureClone),e?(this._resetFieldInputValues(this._featureClone),this.allRelationshipInputs.forEach((t=>t.feature=e))):(this.inputs.forEach((e=>e.destroy())),this.inputs.length=0),this.contingencyConstraintViolations.clear(),this._set("feature",e)}get fieldsWithContingentValues(){if(null==this._contingentValuesCache)return new Set;const e=this._contingentValuesCache.fieldGroups.flatMap((e=>e.fields));return new Set(e)}get fieldsWithInvalidCodedValue(){const e=this.allFieldInputs;return new Set(e.filter((e=>{const{name:t,domain:n,value:s}=e;if("coded-value"===n?.type){const e=this.getFieldValueOptionsForField(t);return null!=s&&""!==s&&!e.flat().some((e=>e.value===s))}return!1})))}get formTemplate(){return this.layer&&"formTemplate"in this.layer?this.layer.formTemplate:null}set formTemplate(e){void 0===e?this._clearOverride("formTemplate"):this._override("formTemplate",e)}get formDescription(){const{formTemplate:e,layer:t}=this;return null!=e&&e.description&&t?_(e.description,this.getValues(),t.fieldsIndex):null}get formTitle(){const{formTemplate:e,layer:t}=this;return null!=e&&e.title&&t?_(e.title,this.getValues(),t.fieldsIndex):null}formHeaderVisible(){const{activeRelationshipInput:e,formDescription:t,formTitle:n}=this;return!(e||!t&&!n)}set inputFields(e){n(W,"inputFields",{replacement:"FeatureFormViewModel.inputs",version:"4.27"}),this.inputs=e}get inputFields(){return n(W,"inputFields",{replacement:"FeatureFormViewModel.inputs",version:"4.27"}),this.inputs}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 relationshipId(){return this._get("relationshipId")}set relationshipId(e){const t=this.allRelationshipInputs;if(null!=e&&e===this.relationshipId||t.forEach((e=>e.showAllEnabled=!1)),null!=e){const n=t.find((t=>t.relationshipId===e));n&&(n.showAllEnabled=!0)}this._set("relationshipId",e)}get spatialReference(){return this.layer?.spatialReference??null}set spatialReference(e){this._override("spatialReference",e)}get state(){return this.layer?.loaded?"ready":"disabled"}get submittable(){return!!this.valid||this.allFieldInputs.filter((e=>!e.valid)).every((({submittable:e})=>e))}get updating(){return this._updatingHandles.updating}get valid(){const e=this.allFieldInputs;return e.length>0&&e.every((({valid:e})=>e))}get view(){return n(W,"view",{replacement:"FeatureForm.map",version:"4.27"}),this._get("view")}set view(e){n(W,"view",{replacement:"FeatureForm.map",version:"4.27"}),this._set("view",e),e?.map&&(this.map=e.map)}findField(e){return this.allFieldInputs.find((t=>t.name===e))}getFieldValueOptionsForField(e,t){const n=this.findField(e);if(!n)return[[],[]];const s="coded-value"===n.domain?.type?n.domain.codedValues.map((({name:e,code:t})=>({name:e,value:t}))):[],i=this.fieldsWithContingentValues.has(e)?this._getContingentValueOptionsForField(e,t):[];if(i.length>0){const e=new Set(i.map((e=>e.value)));return[i,s.filter((t=>!e.has(t.value)))]}return[s,[]]}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),null!=this._expressionsManager&&this._updatingHandles.addPromise(this._expressionsManager.evaluateInvalidated([i.name]).finally((()=>this._afterExpressionsEvaluated())))))}getValues(){return{...this._featureClone.attributes}}overrideInitialFeature(e){this._initialFeature=e}submit(){const e=this.allFieldInputs,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,o]of this.contingencyConstraintViolations.entries())"error"===o.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,null==n)return[];const{invalid:i,incomplete:o}=n.validateContingencyConstraints(e),r=[...i,...t?.includeIncompleteViolations?o:[]];for(const a of r)for(const e of a.fieldGroup.fields)s.set(e,a);return r}notifyFeatureGeometryChanged(){const{_expressionsManager:e,feature:t,_featureClone:n}=this;n.geometry=t.geometry,null!=e&&this._updatingHandles.addPromise(e.evaluateInvalidatedByGeometry().finally((()=>this._afterExpressionsEvaluated())))}_emitChangeEvent({name:e,valid:t,value:n}){this.emit("value-change",{layer:this.layer,feature:this.feature,fieldName:e,value:n,valid:t})}async _updateInputs(){this._stopExpressions();const{_featureClone:e,_initialFeature:t,arcadeEditType:n,formTemplate:s,inputs:i,layer:o}=this;if(!o)return;const r={arcadeEditType:n,feature:e,initialFeature:t,layer:o},a=i.slice(),l=null!=s&&s.elements&&s.elements.length>0?await this._updateInputsUsingFormElements(a,s.elements,r):this._updateInputsUsingLayerFields(a,o?.fields,r);this.inputs=l,await this._startExpressions()}async _updateInputsUsingFormElements(e,t,n){const s=new Map;for(const r of e)if(v(r)){s.set(r.element,r);for(const e of r.inputs)e.element&&s.set(e.element,e)}else r.element&&s.set(r.element,r);const i=new Map,o=this._updateInputsUsingFormElementsRecursive({existingInputsByElement:s,updatedElements:t.filter(G),sharedInitializationProperties:n,group:null,newExpressionExecutorPromises:i});for(const[r,a]of s.entries())s.delete(r),a.destroy();return await Promise.all(Array.from(i.values())),o}_updateInputsUsingFormElementsRecursive(e){const{existingInputsByElement:t,updatedElements:n,sharedInitializationProperties:s,group:i,newExpressionExecutorPromises:o}=e,r=[];for(const a of n){const e=t.has(a),n=e?t.get(a):F(a)?this._makeGroupInputFromElement(a,s):I(a)?this._makeFieldInputFromElement(a,s,i):C(a)?this._makeRelationshipInputFromElement(a,s,i):null;if(n){if(r.push(n),this._assignExpressionExecutors(n,a,o),e)if(t.delete(a),v(n)){const{feature:e}=s;n.set({feature:e})}else if(E(n)){const e=this.relationshipId===a.relationshipId;n.set(s),n.set({map:this.map,showAllEnabled:e})}else n.set(s);if(F(a)){const e=a.elements.filter((e=>G(e)));n.inputs=this._updateInputsUsingFormElementsRecursive({existingInputsByElement:t,updatedElements:e,sharedInitializationProperties:s,group:n,newExpressionExecutorPromises:o})}}}return r}_updateInputsUsingLayerFields(e,t,n){if(!Array.isArray(t))return i.getLogger(this).warn(this.declaredClass,"No attribute fields found."),[];const s=new Map;for(const i of e)if(v(i)){for(const e of i.inputs)e.destroy();i.inputs.length=0,i.destroy()}else E(i)?i.destroy():x(i)&&(null!==i.element?i.destroy():s.set(i.field,i));const o=[],{arcadeEditType:r,feature:a,initialFeature:l,layer:u}=n;for(const i of t){const e=s.get(i)??new w({arcadeEditType:r,field:i,feature:a,initialFeature:l,layer:u,value:a?.getAttribute(i.name)??null,preservesValueWhenHidden:this.formTemplate?.preserveFieldValuesWhenHidden});o.push(e),s.delete(i)}for(const[i,p]of s.entries())s.delete(i),p.destroy();return o}_resetFieldInputValues(e){for(const t of this.allFieldInputs)t.value=e.getAttribute(t.name)}_makeFieldInputFromElement(e,t,n){const{arcadeEditType:s,feature:i,initialFeature:o,layer:r}=t,{fieldName:a}=e,l=a&&this._layerFieldsByName.get(a);return l?new w({arcadeEditType:s,element:e,field:l,value:i?.getAttribute(e.fieldName)??null,feature:i,initialFeature:o,layer:r,group:n,preservesValueWhenHidden:this.formTemplate?.preserveFieldValuesWhenHidden}):null}_makeGroupInputFromElement(e,t){const{feature:n,layer:s}=t;return new A({element:e,inputs:[],feature:n,layer:s})}_makeRelationshipInputFromElement(e,t,n=null){const{map:s}=this,{feature:i,layer:o}=t;return new M({element:e,feature:i,group:n,layer:o,map:s})}_assignExpressionExecutors(e,t,n){const s=F(t)?N:C(t)?H:S,i=[];for(const o of s){const s=`${o}Executor`;if(e[s]){this._useExecutor(e[s]);continue}const i=t[o],{_expressionExecutorLookup:r}=this;if(null!=i&&""!==i){const t=this._expressionInfosLookup.get(i)?.expression??i;if(r.has(t))e[s]=this._useExecutor(r.get(t));else if(n.has(t)){const i=n.get(t).then((t=>(e[s]=t,t)));n.set(t,i)}else{const i=j(t,this.layer).then((n=>(e[s]=this._useExecutor(n),r.set(t,n),n)));n.set(t,i)}}}return i}_createExpressionsManager(e){const{_arcadeContextInfo:t,_featureClone:n,allFieldInputs:s,formTemplate:i}=this;this._expressionsManager=new T({executors:e,feature:n,arcadeContextInfo:t,fieldInputs:s,preserveFieldValuesWhenHidden:!0===i?.preserveFieldValuesWhenHidden})}async _startExpressions(){if(0===this._expressionExecutorsInUse.size)return;const e=Array.from(this._expressionExecutorsInUse);this._createExpressionsManager(e),await this._expressionsManager.evaluateAll().finally((()=>this._afterExpressionsEvaluated()))}_stopExpressions(){this._expressionsManager=o(this._expressionsManager),this._expressionExecutorsInUse.clear()}_useExecutor(e){return this._expressionExecutorsInUse.add(e),e}_afterValueChange(e){const{name:t,value:n}=e,{_featureClone:s,formTemplate:i,layer:o}=this;if(!o)return;const r=s.getAttribute(t);s.setAttribute(t,n);const{typeFieldName:a,types:u}=V(o);if(t===a&&n!==r){if("subtype-sublayer"===o.type){const e=o.parent?.findSublayerForFeature(s);s.sourceLayer=this.feature.sourceLayer=e}const e=new Set;for(const t of u)if(t.domains&&"object"==typeof t.domains)for(const n of Object.keys(t.domains))e.add(n);for(const t of e){const e=this.findField(t);e&&e.notifyChange("domain")}}if(null!=i){const{description:e,title:n}=i;n&&l(n,t)&&this.notifyChange("formTitle"),e&&l(e,t)&&this.notifyChange("formDescription")}this._emitChangeEvent(e)}_afterExpressionsEvaluated(){const{_featureClone:e}=this;for(const t of this.allFieldInputs)t.value!==e.getAttribute(t.name)&&this._afterValueChange(t)}_joinContingentValues(){const e=this._contingentValuesCache;if(null==e)return[];const{typeFieldName:t}=V(this.layer),n=t?this.getValue(t):null,s=[];for(const r of e.fieldGroups){const{contingencies:e,fields:t,name:i}=r,o=[];for(const s of e)s.isRetired||null!=s.subtype&&s.subtype.code!==n||o.push({values:s.values});o.length>0&&s.push({name:i,fields:t,contingencies:o})}const[i,o]=this._generateJoinPlan(s);return[...i.flatMap((e=>this._joinFieldGroupContingencies(e))),...o.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),o=l,r=[i.name,o.name].sort().join("|");if(s.has(r))continue;n.push([i,o]),s.add(r),t.set(e,o)}else t.set(e,l);const i=new Set(n.flat()),o=new Set(e);for(const l of i)o.delete(l);const r=new Map,a=new Map;for(const l of new Set(n.flat())){const e=Symbol(l.name);r.set(e,new Set([l])),a.set(l,e)}for(const[l,u]of n){const e=a.get(l),t=a.get(u);if(e===t)continue;const n=r.get(e),s=r.get(t);for(const i of s)n.add(i),a.set(i,e);r.delete(t)}return[[...r.values()].map((e=>[...e])),[...o]]}_joinFieldGroupContingencies(e){const t=e.slice(),n=t.shift();let s=t.shift(),i=this._generateJoinKey(n.fields,s.fields),o=new Set([...n.fields,...s.fields]),r=new Map;for(const l of n.contingencies){const[e]=this._hashContingency(l,i.codedValueFields,!0);r.has(e)?r.get(e)?.push(l):r.set(e,[l])}for(;t.length>0;){const e=new Map,n=t.shift(),a=this._generateJoinKey(o,n.fields);for(const t of s.contingencies){const[n,s]=this._hashContingency(t,i.codedValueFields),o=s?this._findMatchingContingenciesWithAnyHashMask(r,n):r.get(n);if(r.has(k)&&o?.push(...this._findMatchingContingenciesContainingAny(t,r.get(k),i.codedValueFields)),null!=o)for(const r of o){const n=i.rangeFields.length>0?this._joinContingenciesWithRangeDomains(r,t,i.rangeFields):this._joinContingencies(r,t);if(null==n)break;const[s]=this._hashContingency(n,a.codedValueFields,!0);e.has(s)?e.get(s)?.push(n):e.set(s,[n])}}r=e,s=n,i=a,o=new Set([...o,...s.fields])}const a=[];for(const l of s.contingencies){const[e,t]=this._hashContingency(l,i.codedValueFields),n=t?this._findMatchingContingenciesWithAnyHashMask(r,e):r.get(e);if(r.has(k)&&n.push(...this._findMatchingContingenciesContainingAny(l,r.get(k),i.codedValueFields)),null!=n)for(const s of n){const e=i.rangeFields.length>0?this._joinContingenciesWithRangeDomains(s,l,i.rangeFields):this._joinContingencies(s,l);null!=e&&a.push(e)}}return a}_joinContingencies(e,t){const n={values:{...e.values,...t.values}};for(const[s,i]of Object.entries(n.values))"any"===i.objectType&&null!=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],o=t.values[i],{leftIsNull:r,rightIsNull:a,bothAreNull:l,leftIsAny:u,rightIsAny:p,bothAreAny:c,leftIsRange:d,rightIsRange:f}=this._compareObjectTypes(n.objectType,o.objectType);if(l||c)continue;if(r&&p||a&&u){s.values[i]=new h({objectType:"null"});continue}if(r&&f||a&&d)return null;u?(n.minValue=-1/0,n.maxValue=1/0):p&&(o.minValue=-1/0,o.maxValue=1/0);const m=Math.max(n.minValue,o.minValue),g=Math.min(n.maxValue,o.maxValue);if(m>g)return null;s.values[i]=new h({objectType:"range",minValue:m,maxValue:g})}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,o]of e){if(i===k)break;n.test(i)&&s.push(...o)}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,o=i===n?s:n,r=new Set,a=new Set;for(const l of i)if(o.has(l)){const e=this.layer?.getFieldDomain(l,{feature:this.feature});if(null==e)continue;switch(e.type){case"coded-value":r.add(l);break;case"range":a.add(l)}}return{codedValueFields:[...r],rangeFields:[...a]}}_contingencyIsValid(e,t){const n={};for(const{name:s,value:i}of this.allFieldInputs)this.fieldsWithContingentValues.has(s)&&null!=i&&s!==e&&(n[s]=i);return Object.entries(n).every((([e,n])=>!t.values.hasOwnProperty(e)||b(n,t.values[e])))}_getContingentValueOptionsForField(e,t){const n=this.joinedContingentValues.slice(),s=new Map,i={code:"",name:t??"No value"};for(const o of n){const t=o.values[e];if("code"===t?.objectType||"null"===t?.objectType){const{code:n,name:r}=t.codedValue&&"null"!==t.objectType?t.codedValue:i;!s.has(n)&&this._contingencyIsValid(e,o)&&s.set(n,{name:r,value:n})}}return[...s.values()]}_hashContingency(e,t,n=!1){if(t.length<1)return[L,!1];const s=[];let i=!1;for(const o of t){const t=e.values[o];if("any"===t.objectType){if(n)return[k,!0];i=!0,s.push(`${o}:.*`)}else"null"===t.objectType?s.push(`${o}:${U}`):s.push(`${o}:${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}}};function G(e){return"field"===e.type||"group"===e.type||"relationship"===e.type||(i.getLogger(P).warn("form-info::unsupported-element-type","Only element types 'field', 'group' and 'relationship' are supported",`Element ${e.label} has unsupported type '${e.type}'`),!1)}e([u()],O.prototype,"_expressionInfosLookup",null),e([u()],O.prototype,"_featureClone",void 0),e([u()],O.prototype,"activeRelationshipInput",null),e([u()],O.prototype,"_arcadeContextInfo",null),e([u({readOnly:!0})],O.prototype,"allFieldInputs",null),e([u()],O.prototype,"allRelationshipInputs",null),e([u()],O.prototype,"_layerFieldsByName",null),e([u()],O.prototype,"arcadeEditType",void 0),e([u()],O.prototype,"contingencyConstraintViolations",void 0),e([u()],O.prototype,"disabled",void 0),e([u()],O.prototype,"feature",null),e([u()],O.prototype,"fieldsWithContingentValues",null),e([u()],O.prototype,"fieldsWithInvalidCodedValue",null),e([u({type:d})],O.prototype,"formTemplate",null),e([u()],O.prototype,"formDescription",null),e([u()],O.prototype,"formTitle",null),e([u()],O.prototype,"formHeaderVisible",null),e([u()],O.prototype,"inputs",void 0),e([u()],O.prototype,"inputFields",null),e([u()],O.prototype,"joinedContingentValues",null),e([u()],O.prototype,"layer",null),e([u()],O.prototype,"map",void 0),e([u()],O.prototype,"relatedRecordCallbacks",void 0),e([u()],O.prototype,"relationshipId",null),e([u()],O.prototype,"spatialReference",null),e([u()],O.prototype,"state",null),e([u()],O.prototype,"strict",void 0),e([u()],O.prototype,"submittable",null),e([u()],O.prototype,"updating",null),e([u()],O.prototype,"valid",null),e([u()],O.prototype,"view",null),e([u()],O.prototype,"getValues",null),e([u()],O.prototype,"submit",null),O=e([p(P)],O);const $=O;export{$ 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.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import{property as t}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import{CodedValue as l}from"../../layers/support/CodedValue.js";import n from"../../layers/support/CodedValueDomain.js";import"../../layers/support/Domain.js";import"../../layers/support/InheritedDomain.js";import"../../layers/support/RangeDomain.js";import{getDomainRange as r,validateDomainValue as s}from"../../layers/support/domainUtils.js";import{isFieldVisibleByDefault as o,getLowerCaseEditTrackingFields as u,isNumericField as a,isStringField as p,isDateField as d,getFieldRange as m,TypeValidationError as y,validateFieldValue as h}from"../../layers/support/fieldUtils.js";import{isRelatableFeatureSupportedLayer as c}from"../Feature/support/featureUtils.js";import g from"./EditableInput.js";import{getNormalizedFeatureTypeInfo as f,isFieldElementWithTextInput as E,isFieldElementWithShowNoValueOptionInput as v,LengthValidationError as x}from"./featureFormUtils.js";var b;!function(e){e.Text="text",e.Number="number",e.Date="date",e.Unsupported="unsupported"}(b||(b={}));const _="__internal-type-based-coded-value-domain__";let T=class extends g{constructor(e){super(e),this._storedValue=null,this._valueOriginIsExpression=!1,this.error=null,this.field=null,this.group=null,this.requiredExpressionExecutor=null,this.type="field",this.valueExpressionExecutor=null}get _dateRange(){const{element:e}=this;if("datetime-picker"===e?.input?.type){const{max:t,min:i}=e.input;return{max:t,min:i}}return{min:null,max:null}}get _configAllowsEdits(){const{element:e,layer:t,name:i}=this;if(null!=e)return e.editableExpression?!!this.evaluatedEditableExpression:!1!==e.editable;if(t?.userHasUpdateItemPrivileges)return!0;const l=t&&"popupTemplate"in t?t?.popupTemplate?.fieldInfos?.find((({fieldName:e})=>e===i)):null;return l?.isEditable??!0}get _layerAndFieldAllowEdits(){return this.layerAllowsEdits&&this.field?.editable}get _isVisibleByDefault(){const{field:e,layer:t}=this;return!!e?.visible&&o(e,t)}get _isEditTrackingField(){return u(this.layer).includes(this.name?.toLowerCase())}get _shouldUseValueExpression(){return this._layerAndFieldAllowEdits&&!this._configAllowsEdits&&null!=this.valueExpressionExecutor}get dataType(){const{field:e}=this;return a(e)?b.Number:p(e)?b.Text:d(e)?b.Date:b.Unsupported}get dateDataType(){if(this.dataType===b.Date)return"date"!==this.field.type?"string":"number"}get domain(){const{layer:e}=this,{typeFieldName:t,types:i}=f(e);if(t===this.name&&null==this.field.domain)return new n({name:_,codedValues:i.map((({code:e,name:t})=>new l({code:e,name:t})))});const{feature:r}=this,s=e?.getFieldDomain(this.name,{feature:r}),o=this.element?.domain;return null!=o&&this._isDomainCompatible(o)?o:s}get editable(){return!!this._layerAndFieldAllowEdits&&(this.evaluatedEditableExpression??this._configAllowsEdits)}get evaluatedRequiredExpression(){const{requiredExpressionExecutor:e}=this;return null!=e?!!e.lastEvaluatedValue:null}get evaluatedValueExpression(){const{valueExpressionExecutor:e}=this;return null!=e?e.lastEvaluatedValue:null}get hint(){return this.element?.hint}get includeDate(){return!(this.dataType!==b.Date||"time-only"===this.field.type)}get includeTime(){const{element:e,field:t}=this;if(this.dataType!==b.Date)return!1;if("time-only"===t.type)return!0;if("date-only"===t.type)return!1;const i="datetime-picker"===e?.input?.type?e.input.includeTime:void 0;return void 0===i||i}get includeTimestamp(){return"timestamp-offset"===this.field.type}set initialFeature(e){this._set("initialFeature",e),this.notifyChange("valid")}get inputType(){return this.element?.input?.type}get isRelationshipKeyField(){const{field:e,layer:t}=this;return c(t)&&!!t.relationships?.some((t=>t.keyField===e.name))}get label(){return this.element?.label||this.field.alias||this.field.name}get maxLength(){const e=-1;if(this.dataType===b.Date)return e;const{field:t,element:i}=this,l=t?.length,n=E(i)?i.input.maxLength:NaN;return null!=n&&!isNaN(n)&&n>=e&&(l===e||n<=l)?n:l}get minLength(){const e=-1;if(this.dataType===b.Date)return e;const{field:t,element:i}=this,l=t?.length,n=E(i)?i.input.minLength:NaN;return null!=n&&!isNaN(n)&&n>=e&&(l===e||n<=l)?n:e}get name(){return this.field?.name}get range(){const{_dateRange:e,domain:t,field:i}=this,{max:l,min:n}=e,s=null!=l&&V(l)?l.getTime():null,o=null!=n&&V(n)?n.getTime():null,u=r(t)||m(i);if(!u)return{max:s,min:o};const a=u.max===Number.MAX_VALUE?null:u.max,p=u.min===Number.MIN_VALUE?null:u.min;return{max:null!=s&&(null===a||null!=a&&s<a)?s:a,min:null!=o&&(null===p||null!=p&&o>p)?o:p}}get required(){const{editable:e,evaluatedRequiredExpression:t,field:i,visible:l}=this;return!!e&&(!1===i?.nullable||!(!l||null==t)&&t)}set required(e){this._overrideIfSome("required",e)}get showNoValueOptionEnabled(){const{element:e}=this;return!this.required&&(!v(e)||e.input.showNoValueOption)}get showNoValueLabel(){const{element:e}=this;return v(e)?e.input.noValueOptionLabel:null}get submittable(){const{field:e,required:t,valid:i,value:l}=this;return(!t||null!=l)&&(!!i||this.initialFeature.getAttribute(e.name)===l)}get updating(){const{editableExpressionExecutor:e,valueExpressionExecutor:t}=this;return null!=t&&t.updating||null!=e&&e.updating}get valid(){const e=this.editable?this._validate():null;return this._set("error",e),null===e}get value(){if(this._shouldUseValueExpression){this._valueOriginIsExpression=!0;const e=this.evaluatedValueExpression;if(this.dataType===b.Date){if(e instanceof Date)return e.getTime();if("number"!=typeof e)return parseInt(e,10)}return null!=e&&"object"==typeof e?e.toString():e}return this._valueOriginIsExpression=!1,this._storedValue}set value(e){this.notifyChange("evaluatedVisibilityExpression"),this.set("_storedValue",e)}get valueOriginIsExpression(){return this._valueOriginIsExpression}get visible(){return!this._isEditTrackingField&&(null!=this.evaluatedVisibilityExpression?this.evaluatedVisibilityExpression:null!=this.element||this._isVisibleByDefault)}_isDomainCompatible(e){const{field:t}=this;if("coded-value"===e?.type){const i=typeof e.codedValues[0].code;if("string"===i&&p(t)||"number"===i&&a(t))return!0}return!!("range"===e?.type&&a(t)||d(t))}_validate(){const{dataType:e,domain:t,field:i,initialFeature:l,minLength:n,required:r,valid:o,value:u}=this,a=r&&null==u,p=void 0!==o;return!a&&l.getAttribute(i.name)===u&&p?null:a?y.INVALID_TYPE:"text"===e&&n>-1&&"string"==typeof u&&u.length<n?x.TOO_SHORT:t?null!==u||r?s(t,u):null:h(i,u)}};e([t()],T.prototype,"_storedValue",void 0),e([t()],T.prototype,"_configAllowsEdits",null),e([t()],T.prototype,"_layerAndFieldAllowEdits",null),e([t()],T.prototype,"_isVisibleByDefault",null),e([t()],T.prototype,"_isEditTrackingField",null),e([t()],T.prototype,"_shouldUseValueExpression",null),e([t()],T.prototype,"_valueOriginIsExpression",void 0),e([t()],T.prototype,"dataType",null),e([t()],T.prototype,"dateDataType",null),e([t()],T.prototype,"domain",null),e([t()],T.prototype,"editable",null),e([t({readOnly:!0})],T.prototype,"error",void 0),e([t()],T.prototype,"evaluatedRequiredExpression",null),e([t()],T.prototype,"evaluatedValueExpression",null),e([t()],T.prototype,"field",void 0),e([t()],T.prototype,"group",void 0),e([t({readOnly:!0})],T.prototype,"hint",null),e([t()],T.prototype,"includeDate",null),e([t()],T.prototype,"includeTime",null),e([t()],T.prototype,"includeTimestamp",null),e([t()],T.prototype,"initialFeature",null),e([t({readOnly:!0})],T.prototype,"inputType",null),e([t()],T.prototype,"label",null),e([t()],T.prototype,"maxLength",null),e([t()],T.prototype,"minLength",null),e([t({readOnly:!0})],T.prototype,"name",null),e([t()],T.prototype,"range",null),e([t()],T.prototype,"required",null),e([t()],T.prototype,"requiredExpressionExecutor",void 0),e([t()],T.prototype,"showNoValueOptionEnabled",null),e([t()],T.prototype,"submittable",null),e([t({readOnly:!0})],T.prototype,"type",void 0),e([t()],T.prototype,"updating",null),e([t()],T.prototype,"valid",null),e([t({value:null})],T.prototype,"value",null),e([t()],T.prototype,"valueExpressionExecutor",void 0),e([t()],T.prototype,"valueOriginIsExpression",null),e([t()],T.prototype,"visible",null),T=e([i("esri.widgets.FeatureForm.FieldInput")],T);const V=e=>e&&!Number.isNaN(e.valueOf()),D=T;export{D as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import{property as t}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import{CodedValue as l}from"../../layers/support/CodedValue.js";import n from"../../layers/support/CodedValueDomain.js";import"../../layers/support/Domain.js";import"../../layers/support/InheritedDomain.js";import"../../layers/support/RangeDomain.js";import{getDomainRange as r,validateDomainValue as s}from"../../layers/support/domainUtils.js";import{isFieldVisibleByDefault as o,getLowerCaseEditTrackingFields as u,isNumericField as a,isStringField as p,isDateField as d,getFieldRange as m,TypeValidationError as h,validateFieldValue as y}from"../../layers/support/fieldUtils.js";import{isRelatableFeatureSupportedLayer as c}from"../Feature/support/featureUtils.js";import g from"./EditableInput.js";import{getNormalizedFeatureTypeInfo as f,isFieldElementWithInputType as v,valueIsInvalidSwitchValue as E,isFieldElementWithTextInput as x,isFieldElementWithShowNoValueOptionInput as b,LengthValidationError as _}from"./featureFormUtils.js";var V;!function(e){e.Text="text",e.Number="number",e.Date="date",e.Unsupported="unsupported"}(V||(V={}));const T="__internal-type-based-coded-value-domain__";let D=class extends g{constructor(e){super(e),this._storedValue=null,this._valueOriginIsExpression=!1,this.error=null,this.preservesValueWhenHidden=!0,this.field=null,this.group=null,this.requiredExpressionExecutor=null,this.type="field",this.valueExpressionExecutor=null}get _dateRange(){const{element:e}=this;if("datetime-picker"===e?.input?.type){const{max:t,min:i}=e.input;return{max:t,min:i}}return{min:null,max:null}}get _configAllowsEdits(){const{element:e,layer:t,name:i}=this;if(null!=e)return e.editableExpression?!!this.evaluatedEditableExpression:!1!==e.editable;if(t?.userHasUpdateItemPrivileges)return!0;const l=t&&"popupTemplate"in t?t?.popupTemplate?.fieldInfos?.find((({fieldName:e})=>e===i)):null;return l?.isEditable??!0}get _layerAndFieldAllowEdits(){return this.layerAllowsEdits&&this.field?.editable}get _isVisibleByDefault(){const{field:e,layer:t}=this;return!!e?.visible&&o(e,t)}get _isEditTrackingField(){return u(this.layer).includes(this.name?.toLowerCase())}get _shouldUseValueExpression(){return this._layerAndFieldAllowEdits&&!this._configAllowsEdits&&null!=this.valueExpressionExecutor}get dataType(){const{field:e}=this;return a(e)?V.Number:p(e)?V.Text:d(e)?V.Date:V.Unsupported}get dateDataType(){if(this.dataType===V.Date)return"date"!==this.field.type?"string":"number"}get domain(){const{layer:e}=this,{typeFieldName:t,types:i}=f(e);if(t===this.name&&null==this.field.domain)return new n({name:T,codedValues:i.map((({code:e,name:t})=>new l({code:e,name:t})))});const{feature:r}=this,s=e?.getFieldDomain(this.name,{feature:r}),o=this.element?.domain;return null!=o&&this._isDomainCompatible(o)?o:s}get editable(){return!!this._layerAndFieldAllowEdits&&(this.evaluatedEditableExpression??this._configAllowsEdits)}get evaluatedRequiredExpression(){const{requiredExpressionExecutor:e}=this;return null!=e?!!e.lastEvaluatedValue:null}get evaluatedValueExpression(){const{valueExpressionExecutor:e}=this;return null!=e?e.lastEvaluatedValue:null}get hint(){return this.element?.hint}get includeDate(){return!(this.dataType!==V.Date||"time-only"===this.field.type)}get includeTime(){const{element:e,field:t}=this;if(this.dataType!==V.Date)return!1;if("time-only"===t.type)return!0;if("date-only"===t.type)return!1;const i="datetime-picker"===e?.input?.type?e.input.includeTime:void 0;return void 0===i||i}get includeTimestamp(){return"timestamp-offset"===this.field.type}set initialFeature(e){this._set("initialFeature",e),this.notifyChange("valid")}get inputType(){return this.element?.input?.type}get hasInvalidSwitchValue(){const{element:e}=this,t=v(e,"switch")?e.input:null;return!t||E(this.value,t)}get isRelationshipKeyField(){const{field:e,layer:t}=this;return c(t)&&!!t.relationships?.some((t=>t.keyField===e.name))}get label(){return this.element?.label||this.field.alias||this.field.name}get maxLength(){const e=-1;if(this.dataType===V.Date)return e;const{field:t,element:i}=this,l=t?.length,n=x(i)?i.input.maxLength:NaN;return null!=n&&!isNaN(n)&&n>=e&&(l===e||n<=l)?n:l}get minLength(){const e=-1;if(this.dataType===V.Date)return e;const{field:t,element:i}=this,l=t?.length,n=x(i)?i.input.minLength:NaN;return null!=n&&!isNaN(n)&&n>=e&&(l===e||n<=l)?n:e}get name(){return this.field?.name}get range(){const{_dateRange:e,domain:t,field:i}=this,{max:l,min:n}=e,s=null!=l&&N(l)?l.getTime():null,o=null!=n&&N(n)?n.getTime():null,u=r(t)||m(i);if(!u)return{max:s,min:o};const a=u.max===Number.MAX_VALUE?null:u.max,p=u.min===Number.MIN_VALUE?null:u.min;return{max:null!=s&&(null===a||null!=a&&s<a)?s:a,min:null!=o&&(null===p||null!=p&&o>p)?o:p}}get required(){const{editable:e,evaluatedRequiredExpression:t,field:i,visible:l}=this;return!!e&&(!1===i?.nullable||!(!l||null==t)&&t)}set required(e){this._overrideIfSome("required",e)}get showNoValueOptionEnabled(){const{element:e}=this;return!this.required&&(!b(e)||e.input.showNoValueOption)}get showNoValueLabel(){const{element:e}=this;return b(e)?e.input.noValueOptionLabel:null}get submittable(){const{field:e,required:t,valid:i,value:l}=this;return(!t||null!=l)&&(!!i||this.initialFeature.getAttribute(e.name)===l)}get updating(){const{editableExpressionExecutor:e,valueExpressionExecutor:t,visibilityExpressionExecutor:i,preservesValueWhenHidden:l}=this;return null!=t&&t.updating||null!=e&&e.updating||!1===l&&null!=i&&i.updating}get valid(){const e=this.editable?this._validate():null;return this._set("error",e),null===e}get value(){if(!1===this.preservesValueWhenHidden&&(!1===this.evaluatedVisibilityExpression||!1===this.group?.evaluatedVisibilityExpression)){this._valueOriginIsExpression=!0;const e=this.field.defaultValue??null;return this._storedValue!==e&&this.set("_storedValue",e),e}if(this._shouldUseValueExpression){this._valueOriginIsExpression=!0;const e=this.evaluatedValueExpression;if(this.dataType===V.Date){if(e instanceof Date)return e.getTime();if("number"!=typeof e)return parseInt(e,10)}return null!=e&&"object"==typeof e?e.toString():e}return this._valueOriginIsExpression=!1,this._storedValue}set value(e){this.notifyChange("evaluatedVisibilityExpression"),this.set("_storedValue",e)}get valueOriginIsExpression(){return this._valueOriginIsExpression}get visible(){return!this._isEditTrackingField&&(null!=this.evaluatedVisibilityExpression?this.evaluatedVisibilityExpression:null!=this.element||this._isVisibleByDefault)}_isDomainCompatible(e){const{field:t}=this;if("coded-value"===e?.type){const i=typeof e.codedValues[0].code;if("string"===i&&p(t)||"number"===i&&a(t))return!0}return!!("range"===e?.type&&a(t)||d(t))}_validate(){const{dataType:e,domain:t,field:i,initialFeature:l,minLength:n,required:r,valid:o,value:u}=this,a=r&&null==u,p=void 0!==o;return!a&&l.getAttribute(i.name)===u&&p?null:a?h.INVALID_TYPE:"text"===e&&n>-1&&"string"==typeof u&&u.length<n?_.TOO_SHORT:t?null!==u||r?s(t,u):null:y(i,u)}};e([t()],D.prototype,"_storedValue",void 0),e([t()],D.prototype,"_configAllowsEdits",null),e([t()],D.prototype,"_layerAndFieldAllowEdits",null),e([t()],D.prototype,"_isVisibleByDefault",null),e([t()],D.prototype,"_isEditTrackingField",null),e([t()],D.prototype,"_shouldUseValueExpression",null),e([t()],D.prototype,"_valueOriginIsExpression",void 0),e([t()],D.prototype,"dataType",null),e([t()],D.prototype,"dateDataType",null),e([t()],D.prototype,"domain",null),e([t()],D.prototype,"editable",null),e([t({readOnly:!0})],D.prototype,"error",void 0),e([t({constructOnly:!0})],D.prototype,"preservesValueWhenHidden",void 0),e([t()],D.prototype,"evaluatedRequiredExpression",null),e([t()],D.prototype,"evaluatedValueExpression",null),e([t()],D.prototype,"field",void 0),e([t()],D.prototype,"group",void 0),e([t({readOnly:!0})],D.prototype,"hint",null),e([t()],D.prototype,"includeDate",null),e([t()],D.prototype,"includeTime",null),e([t()],D.prototype,"includeTimestamp",null),e([t()],D.prototype,"initialFeature",null),e([t({readOnly:!0})],D.prototype,"inputType",null),e([t()],D.prototype,"hasInvalidSwitchValue",null),e([t()],D.prototype,"isRelationshipKeyField",null),e([t()],D.prototype,"label",null),e([t()],D.prototype,"maxLength",null),e([t()],D.prototype,"minLength",null),e([t({readOnly:!0})],D.prototype,"name",null),e([t()],D.prototype,"range",null),e([t()],D.prototype,"required",null),e([t()],D.prototype,"requiredExpressionExecutor",void 0),e([t()],D.prototype,"showNoValueOptionEnabled",null),e([t()],D.prototype,"submittable",null),e([t({readOnly:!0})],D.prototype,"type",void 0),e([t()],D.prototype,"updating",null),e([t()],D.prototype,"valid",null),e([t({value:null})],D.prototype,"value",null),e([t()],D.prototype,"valueExpressionExecutor",void 0),e([t()],D.prototype,"valueOriginIsExpression",null),e([t()],D.prototype,"visible",null),D=e([i("esri.widgets.FeatureForm.FieldInput")],D);const N=e=>e&&!Number.isNaN(e.valueOf()),F=D;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.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Accessor.js";import{getOrCreateMapValue as s}from"../../core/MapUtils.js";import{isAbortError as r,createResolver as o}from"../../core/promiseUtils.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as n}from"../../core/accessorSupport/decorators/subclass.js";const i="#JSAPI_FORM_EXPRESSIONS_MANAGER_GEOMETRY",c="esri.widgets.FeatureForm.FormExpressionsManager";let l=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()}destroy(){this.resetExecutors()}get _baseContext(){const{editType:e,layer:t,map:s,originalFeature:r,spatialReference:o}=this.arcadeContextInfo,a="feature"===t?.type?t:"scene"===t?.type&&null!=t.associatedLayer?t.associatedLayer:void 0;return[{$originalfeature:r,$editcontext:{editType:e},$layer:a,$featureset:a,$datastore:t?.url,$map:s},{spatialReference:o??void 0}]}set feature(e){this._latestFieldValues={...e?.attributes},this._set("feature",e)}evaluateAll(){return this._evaluate(this.executors)}evaluateExpressions(e){return this._evaluate(e)}evaluateInvalidated(e){const{_fieldReferencesLookup:t,_latestFieldValues:s,feature:r}=this,o=new Set;for(const a of e)if(s[a]=r.getAttribute(a),t.has(a))for(const e of t.get(a))o.add(e);return this._evaluate([...o])}async evaluateInvalidatedByGeometry(){if(this._fieldReferencesLookup.has(i))return this._evaluate([...this._fieldReferencesLookup.get(i)])}resetExecutors(){for(const e of this.executors)e.reset()}_buildDependencyGraph(){const{_fieldReferencesLookup:e,_fieldsAffectedLookup:t,executors:r}=this,o=new Map(this.fieldInputs.map((e=>[e.name,e]))),a=new Map(r.map((e=>[e,new Array])));for(const n of r){for(const r of n.fieldsUsed){s(e,r,(()=>new Set)).add(n);const i=o.get(r),c=i?.valueExpressionExecutor,l=i?.editableExpressionExecutor;if(null!=c&&c!==n){a.get(c).push(n);s(t,c,(()=>new Set)).add(i)}if(null!=l&&l!==n){a.get(l).push(n);s(t,l,(()=>new Set)).add(i)}}if(n.geometryUsed){s(e,i,(()=>new Set)).add(n)}}return a}async _evaluate(e){const t=new Map,{_dependencyGraph:s,_fieldsAffectedLookup:o,_latestFieldValues:a}=this;for(const r of e)u(r,t,s);for(const[i,{resolver:c,dependencyPromises:l}]of t){Promise.all(l).then((async()=>{const[e,t]=this._makeContext(a);return i.executeAsync(e,t)})).then((()=>{if(o.has(i))for(const e of o.get(i))this._latestFieldValues[e.name]=e.value;c.resolve()}),(e=>{!e||r(e)||p(e)||i.markStale(),c.reject(e)}))}const n=(await Promise.allSettled(Array.from(t.values(),(({resolver:e})=>e.promise)))).filter((e=>"rejected"===e.status&&!(r(e.reason)||p(e.reason))));if(n.length>0)throw new AggregateError(n,"One or more expression executions failed")}_makeContext(e){const[t,s]=this._baseContext,r=this.feature.clone();return r.attributes=e,[{...t,$feature:r},s]}};e([a()],l.prototype,"_baseContext",null),e([a()],l.prototype,"feature",null),e([a()],l.prototype,"executors",void 0),e([a()],l.prototype,"fieldInputs",void 0),e([a()],l.prototype,"arcadeContextInfo",void 0),l=e([n(c)],l);const u=(e,t,s)=>{if(t.has(e))return;const r=o();t.set(e,{resolver:r,dependencyPromises:[]}),e.abort();const a=s.get(e);for(const o of a)u(o,t,s),t.get(o).dependencyPromises.push(r.promise)},p=e=>e&&"object"==typeof e&&"message"in e&&"Cancelled"===e.message;export{l as FormExpressionsManager};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Accessor.js";import{getOrCreateMapValue as s}from"../../core/MapUtils.js";import{isAbortError as r,createResolver as o}from"../../core/promiseUtils.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";const n="#JSAPI_FORM_EXPRESSIONS_MANAGER_GEOMETRY",l="esri.widgets.FeatureForm.FormExpressionsManager";let c=class extends t{constructor(e){super(e),this._fieldReferencesLookup=new Map,this._fieldsAffectedLookup=new Map,this.preserveFieldValuesWhenHidden=!0,this._latestFieldValues={...e.feature.attributes}}initialize(){this._dependencyGraph=this._buildDependencyGraph()}destroy(){this.resetExecutors()}get _baseContext(){const{editType:e,layer:t,map:s,originalFeature:r,spatialReference:o}=this.arcadeContextInfo,a="feature"===t?.type?t:"scene"===t?.type&&null!=t.associatedLayer?t.associatedLayer:void 0;return[{$originalfeature:r,$editcontext:{editType:e},$layer:a,$featureset:a,$datastore:t?.url,$map:s},{spatialReference:o??void 0}]}set feature(e){this._latestFieldValues={...e?.attributes},this._set("feature",e)}evaluateAll(){return this._evaluate(this.executors)}evaluateExpressions(e){return this._evaluate(e)}evaluateInvalidated(e){const{_fieldReferencesLookup:t,_latestFieldValues:s,feature:r}=this,o=new Set;for(const a of e)if(s[a]=r.getAttribute(a),t.has(a))for(const e of t.get(a))o.add(e);return this._evaluate([...o])}async evaluateInvalidatedByGeometry(){if(this._fieldReferencesLookup.has(n))return this._evaluate([...this._fieldReferencesLookup.get(n)])}resetExecutors(){for(const e of this.executors)e.reset()}_buildDependencyGraph(){const{_fieldReferencesLookup:e,_fieldsAffectedLookup:t,executors:r,preserveFieldValuesWhenHidden:o}=this,a=new Map(this.fieldInputs.map((e=>[e.name,e]))),i=!1===o,l=new Map(r.map((e=>[e,new Array])));for(const c of r){for(const r of c.fieldsUsed){s(e,r,(()=>new Set)).add(c);const o=a.get(r);[o?.valueExpressionExecutor,o?.editableExpressionExecutor,i?o?.group?.visibilityExpressionExecutor:null,i?o?.visibilityExpressionExecutor:null].filter((e=>null!=e&&e!==c)).forEach((e=>{l.get(e).push(c);s(t,e,(()=>new Set)).add(o)}))}if(c.geometryUsed){s(e,n,(()=>new Set)).add(c)}}return l}async _evaluate(e){const t=new Map,{_dependencyGraph:s,_fieldsAffectedLookup:o,_latestFieldValues:a}=this;for(const r of e)u(r,t,s);for(const[n,{resolver:l,dependencyPromises:c}]of t){Promise.all(c).then((async()=>{const[e,t]=this._makeContext(a);return n.executeAsync(e,t)})).then((()=>{if(o.has(n))for(const e of o.get(n))this._latestFieldValues[e.name]=e.value;l.resolve()}),(e=>{!e||r(e)||p(e)||n.markStale(),l.reject(e)}))}const i=(await Promise.allSettled(Array.from(t.values(),(({resolver:e})=>e.promise)))).filter((e=>"rejected"===e.status&&!(r(e.reason)||p(e.reason))));if(i.length>0)throw new AggregateError(i,"One or more expression executions failed")}_makeContext(e){const[t,s]=this._baseContext,r=this.feature.clone();return r.attributes=e,[{...t,$feature:r},s]}};e([a()],c.prototype,"_baseContext",null),e([a()],c.prototype,"feature",null),e([a({constructOnly:!0})],c.prototype,"preserveFieldValuesWhenHidden",void 0),e([a()],c.prototype,"executors",void 0),e([a()],c.prototype,"fieldInputs",void 0),e([a()],c.prototype,"arcadeContextInfo",void 0),c=e([i(l)],c);const u=(e,t,s)=>{if(t.has(e))return;const r=o();t.set(e,{resolver:r,dependencyPromises:[]}),e.abort();const a=s.get(e);for(const o of a)u(o,t,s),t.get(o).dependencyPromises.push(r.promise)},p=e=>e&&"object"==typeof e&&"message"in e&&"Cancelled"===e.message;export{c 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.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Accessor.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";let i=class extends t{constructor(e){super(e),this.element=null,this.feature=null,this.layer=null,this.type=null,this.visibilityExpressionExecutor=null}get description(){return this.element?.description}get evaluatedVisibilityExpression(){const{visibilityExpressionExecutor:e}=this;return null!=e?!!e.lastEvaluatedValue:null}get label(){return this.element?.label}get visible(){return null!=this.evaluatedVisibilityExpression?this.evaluatedVisibilityExpression:null!=this.element}};e([s({readOnly:!0})],i.prototype,"description",null),e([s({constructOnly:!0})],i.prototype,"element",void 0),e([s()],i.prototype,"evaluatedVisibilityExpression",null),e([s()],i.prototype,"feature",void 0),e([s()],i.prototype,"label",null),e([s()],i.prototype,"layer",void 0),e([s()],i.prototype,"type",void 0),e([s()],i.prototype,"visible",null),e([s()],i.prototype,"visibilityExpressionExecutor",void 0),i=e([r("esri.widgets.FeatureForm.InputBase")],i);const o=i;export{o as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Accessor.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";let i=class extends t{constructor(e){super(e),this.element=null,this.feature=null,this.layer=null,this.type=null,this.visibilityExpressionExecutor=null}get description(){return this.element?.description}get evaluatedVisibilityExpression(){const{visibilityExpressionExecutor:e}=this;return null!=e&&null!=e.lastEvaluatedValue?!!e.lastEvaluatedValue:null}get label(){return this.element?.label}get visible(){return null!=this.evaluatedVisibilityExpression?this.evaluatedVisibilityExpression:null!=this.element}};e([s({readOnly:!0})],i.prototype,"description",null),e([s({constructOnly:!0})],i.prototype,"element",void 0),e([s()],i.prototype,"evaluatedVisibilityExpression",null),e([s()],i.prototype,"feature",void 0),e([s()],i.prototype,"label",null),e([s()],i.prototype,"layer",void 0),e([s()],i.prototype,"type",void 0),e([s()],i.prototype,"visible",null),e([s()],i.prototype,"visibilityExpressionExecutor",void 0),i=e([r("esri.widgets.FeatureForm.InputBase")],i);const o=i;export{o 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.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{isSome as t}from"../core/arrayUtils.js";import{deprecatedProperty as i}from"../core/deprecate.js";import s from"../core/Logger.js";import{watch as n}from"../core/reactiveUtils.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import"../core/has.js";import{subclass as a}from"../core/accessorSupport/decorators/subclass.js";import r from"./Widget.js";import{CSS as l}from"./FeatureForm/css.js";import{isGroupInput as d,isFieldInput as c,isRelationshipInput as u,isInputInGroupInput as p,isFieldElementWithInputType as m,valueIsInvalidSwitchValue as h,getErrorMessageForFieldInput as v,getIconForFeature as b,valueIsValidContingentValue as _,isNumberFieldInput as g}from"./FeatureForm/featureFormUtils.js";import f from"./FeatureForm/FeatureFormViewModel.js";import{loadCalciteComponents as C}from"./support/componentsUtils.js";import{getLabelForDateFieldValue as y,prepareFieldValueForDateComponents as w,NUMBERING_SYSTEM as F,getFieldValueFromDateComponent as R,getFieldValueFromDateComponents as I,isCalciteDateComponent as O}from"./support/dateUtils.js";import{Heading as M,incrementHeadingLevel as k}from"./support/Heading.js";import"./support/widgetUtils.js";import{messageBundle as x}from"./support/decorators/messageBundle.js";import{vmEvent as V}from"./support/decorators/vmEvent.js";import{tsx as N}from"./support/jsxFactory.js";import{substitute as E}from"../intl/substitute.js";const D="data-field-name",T="esri.widgets.FeatureForm",L=s.getLogger(T);let j=class extends r{constructor(e,t){super(e,t),this._activeNumberFieldEdit=null,this._attemptFocusOnNextRender=!1,this._dateComponentMap=new Map,this._inputsWithChanges=new Set,this._focusedFieldName="",this._inputsWithInvalidCodedValue=new Map,this._inputsWithInvalidSwitchValue=new Set,this._listObserverNode=null,this._listObserver=new IntersectionObserver((e=>{e.length&&e[0].isIntersecting&&this._incrementRelatedRecordPage()}),{root:window.document}),this.groupDisplay="all",this.headingLevel=2,this.messages=null,this.messagesCommon=null,this.messagesFeature=null,this.messagesTemplates=null,this.viewModel=new f,this._onShowAllRelatedRecordsClick=e=>{const{feature:t,relatedRecordCallbacks:i}=this;t&&i?.showAllRelatedRecords&&i.showAllRelatedRecords({parentFeature:t,relationshipId:e})},this._onAddRelatedRecordsClick=(e,t)=>{const{feature:i,relatedRecordCallbacks:s}=this;i&&s?.addRelatedRecord&&s.addRelatedRecord({parentFeature:i,relatedLayer:t,relationshipId:e})},this._handleInputInput=e=>{this._saveValueFromComponent(e.currentTarget)},this._onFormKeyDown=this._onFormKeyDown.bind(this),this._onFormSubmit=this._onFormSubmit.bind(this),this._onGroupClick=this._onGroupClick.bind(this),this._onComponentBlur=this._onComponentBlur.bind(this),this._onComponentFocus=this._onComponentFocus.bind(this),this._onComponentKeyDown=this._onComponentKeyDown.bind(this),this._afterComponentCreateOrUpdate=this._afterComponentCreateOrUpdate.bind(this),this._afterDateComponentCreateOrUpdate=this._afterDateComponentCreateOrUpdate.bind(this),this._handleNumberInputMouseDown=this._handleNumberInputMouseDown.bind(this)}initialize(){this.addHandles([n((()=>this.feature),(()=>{const e=this._getFocusableInput("forward");this._focusedFieldName=e?.name||"",this._inputsWithChanges.clear(),this._inputsWithInvalidCodedValue.clear(),this._inputsWithInvalidSwitchValue.clear(),this._dateComponentMap.clear(),this._attemptFocusOnNextRender=!0})),this.on("submit",(e=>{if(e.invalid.length>0){const[t]=e.invalid;e.invalid.forEach((e=>this._inputsWithChanges.add(e))),this._focusedFieldName=t,this._attemptFocusOnNextRender=!0,this.scheduleRender()}})),n((()=>[this.viewModel.activeRelationshipInput,this._listObserverNode]),(()=>this._onObserverChange()))])}loadDependencies(){return C({button:()=>import("@esri/calcite-components/dist/components/calcite-button.js"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox.js"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item.js"),"combobox-item-group":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item-group.js"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js"),"input-date-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-date-picker.js"),"input-message":()=>import("@esri/calcite-components/dist/components/calcite-input-message.js"),"input-time-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-time-picker.js"),list:()=>import("@esri/calcite-components/dist/components/calcite-list.js"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item.js"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader.js"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice.js"),progress:()=>import("@esri/calcite-components/dist/components/calcite-progress.js"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch.js")})}destroy(){this._listObserverNode&&this._listObserver.unobserve(this._listObserverNode)}get _relatedRecordsEnabled(){const e=this.relatedRecordCallbacks;return!(!e||!(e.addRelatedRecord||e.editRelatedRecord||e.showAllRelatedRecords))}get disabled(){return this.viewModel.disabled}set disabled(e){this.viewModel.disabled=e}get feature(){return this.viewModel.feature}set feature(e){this.viewModel.feature=e}get formTemplate(){return this.viewModel.formTemplate}set formTemplate(e){this.viewModel.formTemplate=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 map(){return this.viewModel.map}set map(e){this.viewModel.map=e}get relatedRecordCallbacks(){return this.viewModel.relatedRecordCallbacks}set relatedRecordCallbacks(e){this.viewModel.relatedRecordCallbacks=e}get relationshipId(){return this.viewModel.relationshipId}set relationshipId(e){this.viewModel.relationshipId=e}get spatialReference(){return this.viewModel.spatialReference}set spatialReference(e){this.viewModel.spatialReference=e}get strict(){return this.viewModel.strict}set strict(e){this.viewModel.strict=e}get view(){return i(L,"view",{replacement:"Use FeatureForm.map instead.",version:"4.27"}),this.viewModel.view}set view(e){i(L,"view",{replacement:"Use FeatureForm.map instead.",version:"4.27"}),this.viewModel.view=e}getValues(){return this.viewModel.getValues()}submit(){return this.viewModel.submit()}render(){const{state:e}=this.viewModel;return N("div",{class:this.classes(l.base,l.widget,l.panel)},"ready"===e?this._renderForm():null)}_renderForm(){return N("form",{class:l.form,novalidate:!0,onsubmit:this._onFormSubmit,onkeydown:this._onFormKeyDown},this._renderHeader(),this._renderContent())}_renderHeader(){const e=this.viewModel;if(!e.formHeaderVisible)return;const t=null!=e.formTitle&&N(M,{key:"title",level:this.headingLevel},e.formTitle),i=null!=e.formDescription&&N("p",{class:l.description,key:"description"},e.formDescription);return N("div",{class:l.formHeader},t,i)}_renderContent(){const{viewModel:e}=this;return e.activeRelationshipInput?this._renderActiveRelationshipInput(e.activeRelationshipInput):e.inputs.filter(t).filter((e=>e.visible)).map(((e,t)=>d(e)?this._renderGroup(e,t):c(e)?this._renderLabeledField(e):u(e)?this._renderRelationshipInput(e):void 0))}_renderActiveRelationshipInput(e){return this._renderRelationshipInput(e)}_renderDescriptionOrEmpty(e,t){return null==e?null:N("div",{class:this.classes(l.description),id:t},e)}_renderGroup(e,t){const{formTemplate:i,disabled:s}=this,{description:n,inputs:o,label:a,state:r}=e,d=o.filter((e=>e.visible)),p=this.viewModel.findField(this._focusedFieldName),m=!(!p||p.group!==e),h=`${this.id}_group_${t}`,v=`${this.id}_group-label_${t}`,b=`${this.id}_group-description_${t}`,_=this._renderDescriptionOrEmpty(n,b),g="sequential"===this.groupDisplay,f=g?m:"expanded"===r,C=f?l.collapseIcon:l.expandIcon;return N("fieldset",{"aria-expanded":f.toString(),"aria-labelledby":v,"aria-describedby":n?b:"",class:this.classes(l.group,g?l.groupSequential:null,f?null:l.groupCollapsed,m?l.groupActive:null,s?l.inputDisabled:null),disabled:s,"data-group":e,id:h,key:t,onclick:this._onGroupClick},N("button",{role:g?"presentation":void 0,class:l.groupHeader,type:"button",tabIndex:g?-1:0},N("div",{class:l.groupTitle},N(M,{class:l.groupLabel,id:v,level:null!=i&&i.title?k(this.headingLevel):this.headingLevel},a),_),g?null:N("span",{class:this.classes(C,l.groupToggleIcon)})),d.map((e=>c(e)?this._renderLabeledField(e):u(e)?this._renderRelationshipInput(e):void 0)))}_getFocusableInput(e,t){const i=this.viewModel.allFieldInputs,s="forward"===e?i:i.slice().reverse();let n;if(!t||u(t))n=0;else if(d(t)){const e=t.inputs.find(c);n=e?s.indexOf(e):0}else{let i;if(p(t)&&"collapsed"===t.group.state){const s=t.group.inputs.filter(c);i="forward"===e?s[s.length-1]:s[0]}else i=t;n=s.indexOf(i)+1}for(let o=n;o<s.length;o++){const e=s[o];if(e.visible&&c(e))return e}return null}_renderLabeledField(e){const{dataType:t,feature:i,label:s,layer:n}=e;return N("label",{key:`${n.id}-${i.uid}-${e.name}`,class:l.label},[s,"unsupported"!==t?this._renderFieldInput(e):this._renderReadOnlyComponent(e),this._renderAuxiliaryText(e)])}_renderFieldInput(e){const{dataType:t,domain:i,element:s,inputType:n,name:o,updating:a,value:r}=e,d=this.getCommonInputProps(e);if("coded-value"===i?.type){if(m(s,"switch")){if(!this._inputsWithInvalidSwitchValue.has(o)&&!h(r,s.input))return this._renderSwitchComponent(e,d);this._inputsWithInvalidSwitchValue.add(o)}return"radio-buttons"===n?this._renderRadioButtonComponents(e,i.codedValues.map((({code:e,name:t})=>({value:e,name:t}))),d):this._renderComboBoxComponent(e,this._getFieldValueOptions(o,i),d)}if("datetime-picker"===n||"date"===t)return this._renderDateComponents(e,d);const c="number"===t?N("input",{type:"number",...d,value:null!=this._activeNumberFieldEdit&&this._activeNumberFieldEdit.fieldName===e.name?this._activeNumberFieldEdit.value:`${d.value}`}):"text-area"===n?N("textarea",{...d}):N("input",{type:"text",...d});return a?N("div",{key:`${d.key}-input-updating-wrapper`,class:l.fieldInputWrapper},c,N("div",{class:l.fieldInputLoader},N("calcite-progress",{type:"indeterminate"}))):c}_renderDateComponents(e,t){const{dateDataType:i,includeTime:s,label:n,name:o,valid:a,value:r}=e,{class:d,max:c,min:u,key:p,readOnly:m,required:h}=t;if("string"===i)return this._renderReadOnlyComponent(e,y(e.field,t.value));const{date:v,time:b}=w(r),_=null!=c?w(c):void 0,g=null!=u?w(u):void 0,f=_?.date??void 0,C=g?.date??void 0,R={afterCreate:this._afterDateComponentCreateOrUpdate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!a,label:n,numberingSystem:F,overlayPositioning:"fixed",readOnly:m,required:h,tabIndex:0,[D]:o};return N("div",{key:`${p}-date-time-container`,class:l.dateInputContainer},N("calcite-input-date-picker",{bind:this,...R,class:this.classes(d,l.inputDate),"data-date-part":"date",key:`${p}-date-input`,valueAsDate:v??void 0,maxAsDate:f,minAsDate:C,onCalciteInputDatePickerChange:e=>this._saveValueFromDateComponent(e.target),onblur:e=>this._saveValueFromDateComponent(e.target,!0)}),s?N("calcite-input-time-picker",{bind:this,...R,class:this.classes(d,l.inputTime),"data-date-part":"time",key:`${p}-time-input`,value:b??void 0,step:1,onCalciteInputTimePickerChange:e=>this._saveValueFromDateComponent(e.target),onfocus:e=>{e.target.calciteTimePickerEl&&(e.target.calciteTimePickerEl.showSecond=!0)},onblur:e=>this._saveValueFromDateComponent(e.target,!0)}):null)}_renderReadOnlyComponent(e,t){const i=this.getCommonInputProps(e);return N("input",{afterCreate:i.afterCreate,afterUpdate:i.afterUpdate,class:this.classes(l.input,l.fieldInput,l.inputDisabled),onfocus:i.onfocus,readOnly:!0,tabIndex:i.tabIndex,type:"text",value:null!=t?`${t}`:i.value,[D]:i[D]})}_renderComboBoxComponent(e,t,i){const{value:s,name:n}=e,{messages:o,messagesTemplates:a,viewModel:r,_inputsWithChanges:l}=this,d=t.map((e=>e.map((({name:e,value:t})=>N("calcite-combobox-item",{key:`#${t}`,selected:s===t,textLabel:e,value:`${t}`}))))),[c,u]=d;this._registerIncompatibleValue(s,t.flat(),e,(e=>{u.unshift(N("calcite-combobox-item",{key:"incompatible-option",readOnly:!0,textLabel:`${e}`,value:`${e}`}))}));const p=u.length>0?[N("calcite-combobox-item-group",{key:"recommended",label:o.recommended},c),N("calcite-combobox-item-group",{key:"other",label:a.other},u)]:c,m="INSERT"===r.arcadeEditType,h=l.has(n),v=null==s&&(!m||h);if(e.showNoValueOptionEnabled){const t="",i=e.showNoValueLabel||o.empty;p.unshift(N("calcite-combobox-item",{value:t,textLabel:o.empty,selected:v,key:"empty-option"},i))}const b=m&&e.showNoValueOptionEnabled&&!h?()=>{}:i.onblur;return N("calcite-combobox",{...i,selectionMode:"single",disabled:i.readOnly,allowCustomValues:!1,clearDisabled:!0,overlayPositioning:"fixed",onblur:b,onCalciteComboboxChange:({target:e})=>{v&&0===e.selectedItems.length?this._ignoreDeselectionOfNoValueOption(e):this._saveValueFromComponent(e)}},p)}_registerIncompatibleValue(e,t,{name:i},s){const n=this._inputsWithInvalidCodedValue,o=n.has(i);(o||null!=e&&""!==e&&!t.some((t=>t.value===e)))&&(o||n.set(i,e),s?.(e))}_renderRadioButtonComponents(e,t,i){const{name:s,value:n}=e,o=t.map((({name:e,value:t})=>this._renderRadioButtonComponent({key:e,label:e,name:s,value:t,selected:t===n,props:i})));if(this._registerIncompatibleValue(n,t,e),e.showNoValueOptionEnabled){const t="",a=e.showNoValueLabel||this.messages.empty,r=n===t||null===n;o.unshift(this._renderRadioButtonComponent({key:"empty-option",label:a,name:s,value:t,selected:r,props:i}))}return N("div",{key:`${i.key}-radio`,class:l.inputRadioGroup},o)}_renderSwitchComponent(e,t){const{value:i}=e,s=!!m(e.element,"switch")&&i===e.element.input.onValue;return N("calcite-switch",{...t,class:l.inputSwitch,onCalciteSwitchChange:e=>this._saveValueFromComponent(e.target),checked:s,disabled:t.readOnly})}_renderRadioButtonComponent({key:e,name:t,value:i,selected:s,label:n,props:o}){return N("label",{key:e,class:l.inputRadioLabel},N("input",{...o,class:l.inputRadio,name:t,type:"radio",value:`${i}`,checked:s,disabled:o.readOnly,onchange:e=>this._saveValueFromComponent(e.target)}),n)}_renderAuxiliaryText(e){const t=e.name,i=this._inputsWithChanges.has(t)&&!e.valid?v(e,this.messages):null!=this.viewModel.contingencyConstraintViolations.get(t)?this.messages.validationErrors.valuesIncompatible:null!=e.valueExpressionExecutor&&e.valueExpressionExecutor.stale?this.messages.valueExpressionError:null;return null!=i?N("calcite-input-message",{status:"invalid",icon:!0},i):this._renderDescriptionOrEmpty(e.description)}_renderShowAllRelatedRecordsListItem(e){const{featureCount:t,relationshipId:i,showAllActionVisible:s}=e,{relatedRecordCallbacks:n}=this;if(!s||!n?.showAllRelatedRecords)return;const o=this.messages;return N("calcite-list-item",{description:E(o.totalCount,{count:t}),label:o.showAll,value:!0,onCalciteListItemSelect:()=>this._onShowAllRelatedRecordsClick(i)},N("calcite-icon",{slot:"content-end",scale:"s",icon:"list"}))}_renderAddRelatedRecordButton(e){const{canAddRelatedFeature:t,relationshipId:i,relatedLayer:s}=e,{relatedRecordCallbacks:n}=this;if(t&&n?.addRelatedRecord&&s)return N("calcite-button",{alignment:"center",appearance:"outline-fill",class:l.centeredButton,disabled:e.updating,iconStart:"plus",key:`${i}-add-button`,round:!0,scale:"s",width:"half",onclick:()=>this._onAddRelatedRecordsClick(i,s)},this.messages.addRecord)}_renderRelatedRecordListItem(e,t){const{feature:i,description:s,title:n}=e,{feature:o,relatedRecordCallbacks:a}=this,r=()=>{a?.editRelatedRecord&&o&&a.editRelatedRecord({parentFeature:o,relationshipId:t,relatedFeature:i})};return N("calcite-list-item",{bind:this,description:s,label:n,key:`${t}-${i.uid}`,value:n,onclick:r},N("calcite-icon",{slot:"content-start",scale:"m",icon:b(i)}),N("calcite-icon",{slot:"content-end",scale:"s",icon:"chevron-right"}))}_renderRelationshipInput(e){if(!this._relatedRecordsEnabled||!e.editable)return;const{featureCount:t,relationshipId:i,showAllEnabled:s}=e,n=s?null:this._renderDescriptionOrEmpty(e.description),o=t>0?this._renderRelatedRecordsList(e):e.loaded?this._renderNoRelatedRecordsNotice():void 0;return N("label",{class:this.classes(l.label,l.relationshipLabel),key:`relationship-${i}-container`},N("div",null,this._renderRelatedRecordsHeaderContainer(e),n,o),this._renderAddRelatedRecordButton(e))}_renderRelatedRecordsHeaderContainer(e){const t=e.updating||!e.loaded;return N("div",{class:l.relatedRecordsHeader,key:`relationship-${e.relationshipId}-header`},N("span",null,e.label),t?N("calcite-loader",{label:this.messagesCommon?.loading,inline:!0,key:"loader",scale:"s",type:"indeterminate"}):void 0)}_renderRelatedRecordsList(e){const{relationshipId:t}=e;return N("calcite-list",{class:l.relatedRecordsList},e.relatedFeatureInfos.map((e=>this._renderRelatedRecordListItem(e,t))),this._renderShowAllRelatedRecordsListItem(e),this._renderObserverNode())}_renderNoRelatedRecordsNotice(){return N("calcite-notice",{open:!0,scale:"s",kind:"brand",icon:"information",width:"full"},N("div",{slot:"message"},this.messagesFeature.noRelatedFeatures))}_renderObserverNode(){if(this.viewModel.activeRelationshipInput?.showAllEnabled)return N("div",{key:"feature-observer",class:l.listObserver,bind:this,afterCreate:this._afterListObserverCreated,afterRemoved:this._afterListObserverRemoved})}getCommonInputProps(e){const{disabled:t,groupDisplay:i}=this,{dataType:s,editable:n,group:o,hint:a,label:r,maxLength:d,minLength:c,name:u,required:p,valid:m,value:h}=e,v=this._inputsWithChanges.has(u),b=!n||t,_="all"===i&&null!=o&&"collapsed"===o.state;return{afterCreate:this._afterComponentCreateOrUpdate,afterUpdate:this._afterComponentCreateOrUpdate,"aria-invalid":m?"false":"true",class:this.classes(l.input,l.fieldInput,b?l.inputDisabled:null,v&&!m?l.inputInvalid:null),key:u,label:r,minlength:c>-1?`${c}`:"",maxlength:d>-1?`${d}`:"",...e.range,readOnly:b,value:null==h?"":`${h}`,[D]:u,onfocus:this._onComponentFocus,oninput:this._handleInputInput,onblur:this._onComponentBlur,onkeydown:this._onComponentKeyDown,onmousedown:"number"===s?this._handleNumberInputMouseDown:void 0,placeholder:"number"===s||"text"===s?a??void 0:"",required:p,tabIndex:_?-1:0}}_handleNumberInputMouseDown({target:e}){e.focus(),this.scheduleRender()}_getFieldValueOptions(e,t){const i=t.codedValues.map((({code:e,name:t})=>({value:e,name:t}))),s=this.viewModel.fieldsWithContingentValues.has(e)?this._getContingentValueOptions(e):[];if(s.length>0){const e=new Set(s.map((e=>e.value)));return[s,i.filter((t=>!e.has(t.value)))]}return[i,[]]}_getContingentValueOptions(e){const t={};for(const n of this.viewModel.allFieldInputs){const{name:i,value:s}=n;null!=s&&i!==e&&this.viewModel.fieldsWithContingentValues.has(i)&&(t[i]=s)}const i=this.viewModel.joinedContingentValues.slice(),s=new Map;for(const n of i){const i=n.values[e];if(null==i||"code"!==i.objectType&&"null"!==i.objectType)continue;const{code:o,name:a}=i.codedValue&&"null"!==i.objectType?i.codedValue:{code:"",name:this.messages.empty};if(s.has(o))continue;Object.entries(t).every((([e,t])=>!n.values.hasOwnProperty(e)||_(t,n.values[e])))&&s.set(o,{name:a,value:o})}return[...s.values()]}_getFieldInputFromHTMLElement(e){return this.viewModel.findField(e.getAttribute(D))}_afterDateComponentCreateOrUpdate(e){const{name:t}=this._getFieldInputFromHTMLElement(e),i=this._dateComponentMap.get(t),s=O(e);null!=i?s?i.date=e:i.time=e:this._dateComponentMap.set(t,{[s?"date":"time"]:e}),this._afterComponentCreateOrUpdate(e)}_afterComponentCreateOrUpdate(e){const{viewModel:t}=this,i=this._getFieldInputFromHTMLElement(e),s=t.findField(this._focusedFieldName),n=this._inputsWithInvalidCodedValue.get(i.name)===i.value;this._attemptFocusOnNextRender&&s===i&&("radio-buttons"!==i.inputType||n||e.checked)&&(this._attemptFocusOnNextRender=!1,p(i)&&(i.group.state="expanded"),e.focus())}_onComponentFocus(e){const t=e.target,i=this._getFieldInputFromHTMLElement(t);this._focusedFieldName=i.name,g(i)&&(this._activeNumberFieldEdit={fieldName:i.name,input:t,value:t.value})}_onComponentBlur(e){const t=e.target,i=this._getFieldInputFromHTMLElement(t);"number"===i.dataType&&null!=this._activeNumberFieldEdit&&(this._activeNumberFieldEdit.input.value=`${i.value}`,this._activeNumberFieldEdit=null),this._saveValueFromComponent(t),this.scheduleRender()}_saveValueFromDateComponent(e,t=!1){const{name:i}=this._getFieldInputFromHTMLElement(e);if(!this._dateComponentMap.has(i))return;const s=this._dateComponentMap.get(i);if(!s||!s.date)return;const n=R(e),o=this._getFieldInputFromHTMLElement(s.date),a=I(o,s.date,s.time);this.viewModel.getValue(i)!==a&&(null!==n&&null!==a?this._updateFieldValue(i,a):t&&this._updateFieldValue(i,null))}_saveValueFromComponent(e){const t=this._getFieldInputFromHTMLElement(e);null!=this._activeNumberFieldEdit&&g(t)&&(this._activeNumberFieldEdit.value=e.value),this._updateFieldValue(t.name,this._parseValue(e))}_onComponentKeyDown(e){const{key:t,altKey:i,ctrlKey:s,metaKey:n}=e,o=this._getFieldInputFromHTMLElement(e.target);if("Enter"===t)p(o)&&"collapsed"===o.group.state&&(o.group.state="expanded");else{const{type:a}=o.field,r="single"===a||"double"===a;if(("integer"===a||"small-integer"===a||r)&&(!i&&!s&&!n)&&1===t.length){const i=Number(t),s=["-","+"],n=["e","."],o=r?[...s,...n]:s;isNaN(i)&&!o.includes(t)&&e.preventDefault()}}}_updateFieldValue(e,t){if(this.viewModel.setValue(e,t),this._inputsWithChanges.add(e),this.viewModel.fieldsWithContingentValues.has(e)){const e=Object.fromEntries(Object.entries(this.getValues()).filter((([e,t])=>null!=t)));this.viewModel.validateContingencyConstraints(e)}}_parseValue(e){const t=this._getFieldInputFromHTMLElement(e),i=e.value;if(m(t.element,"switch")&&"CALCITE-COMBOBOX"!==e.tagName)return e.checked?t.element.input.onValue:t.element.input.offValue;return"radio-buttons"===t.inputType&&"radio"===e.type&&!e.checked?t.value:"number"===t.dataType?i?parseFloat(i):null:i}_ignoreDeselectionOfNoValueOption(e){const{firstChild:t,selectedItems:i}=e;0===i.length&&t&&"selected"in t?t.selected=!0:L.warnOnce("Failed to override user attempt to deselect 'No value' option.")}_onGroupClick(e){const t=e.currentTarget["data-group"],i="expanded"===t.state,s="sequential"===this.groupDisplay,n=`.${l.groupHeader}`;if(!(i&&!e.target.closest(n))){if(this._focusedFieldName=this._getFocusableInput("forward",t)?.name||"",s){const s=e.target.closest(n);if(i&&!s)return;this.viewModel.inputs.forEach((e=>{d(e)&&e!==t&&(e.state="collapsed")}))}t.state=i?"collapsed":"expanded",this._attemptFocusOnNextRender=s,this.scheduleRender()}}_onFormSubmit(e){e.preventDefault()}_onFormKeyDown(e){"Enter"===e.key&&this.viewModel.submit()}_afterListObserverCreated(e){this.viewModel.activeRelationshipInput&&(this._listObserverNode=e)}_afterListObserverRemoved(){this._listObserverNode=null}async _onObserverChange(){this._listObserverNode&&this._listObserver.unobserve(this._listObserverNode);const e=this.viewModel.activeRelationshipInput;if(!e)return;const{showAllEnabled:t,updating:i}=e;this._listObserverNode&&!i&&t&&this._listObserver.observe(this._listObserverNode)}_incrementRelatedRecordPage(){const e=this.viewModel.activeRelationshipInput;e?.incrementPage()}};e([o()],j.prototype,"_listObserverNode",void 0),e([o()],j.prototype,"_relatedRecordsEnabled",null),e([o()],j.prototype,"disabled",null),e([o()],j.prototype,"feature",null),e([o()],j.prototype,"formTemplate",null),e([o()],j.prototype,"groupDisplay",void 0),e([o()],j.prototype,"headingLevel",void 0),e([o()],j.prototype,"label",null),e([o()],j.prototype,"layer",null),e([o()],j.prototype,"map",null),e([o(),x("esri/widgets/FeatureForm/t9n/FeatureForm")],j.prototype,"messages",void 0),e([o(),x("esri/t9n/common")],j.prototype,"messagesCommon",void 0),e([o(),x("esri/widgets/Feature/t9n/Feature")],j.prototype,"messagesFeature",void 0),e([o(),x("esri/widgets/FeatureTemplates/t9n/FeatureTemplates")],j.prototype,"messagesTemplates",void 0),e([o()],j.prototype,"relatedRecordCallbacks",null),e([o()],j.prototype,"relationshipId",null),e([o()],j.prototype,"spatialReference",null),e([o()],j.prototype,"strict",null),e([o()],j.prototype,"view",null),e([o(),V(["value-change","submit"])],j.prototype,"viewModel",void 0),j=e([a(T)],j);const $=j;export{$ as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{isSome as t}from"../core/arrayUtils.js";import{deprecatedProperty as i}from"../core/deprecate.js";import s from"../core/Logger.js";import{watch as o}from"../core/reactiveUtils.js";import{property as n}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import"../core/has.js";import{subclass as r}from"../core/accessorSupport/decorators/subclass.js";import a from"./Widget.js";import{CSS as l}from"./FeatureForm/css.js";import{isGroupInput as d,isFieldInput as c,isRelationshipInput as p,isInputInGroupInput as u,isFieldElementWithInputType as m,getErrorMessageForFieldInput as h,getIconForFeature as v,isNumberFieldInput as b}from"./FeatureForm/featureFormUtils.js";import _ from"./FeatureForm/FeatureFormViewModel.js";import{loadCalciteComponents as g}from"./support/componentsUtils.js";import{getLabelForDateFieldValue as f,prepareFieldValueForDateComponents as C,NUMBERING_SYSTEM as y,getFieldValueFromDateComponent as F,getFieldValueFromDateComponents as w,isCalciteDateComponent as R}from"./support/dateUtils.js";import{Heading as I,incrementHeadingLevel as O}from"./support/Heading.js";import"./support/widgetUtils.js";import{messageBundle as k}from"./support/decorators/messageBundle.js";import{vmEvent as M}from"./support/decorators/vmEvent.js";import{tsx as x}from"./support/jsxFactory.js";import{substitute as N}from"../intl/substitute.js";const E="data-field-name",D="esri.widgets.FeatureForm",L=s.getLogger(D);let T=class extends a{constructor(e,t){super(e,t),this._activeNumberFieldEdit=null,this._attemptFocusOnNextRender=!1,this._dateComponentMap=new Map,this._inputsWithChanges=new Set,this._focusedFieldName="",this._listObserverNode=null,this._listObserver=new IntersectionObserver((e=>{e.length&&e[0].isIntersecting&&this._incrementRelatedRecordPage()}),{root:window.document}),this.groupDisplay="all",this.headingLevel=2,this.messages=null,this.messagesCommon=null,this.messagesFeature=null,this.messagesTemplates=null,this.viewModel=new _,this._onShowAllRelatedRecordsClick=e=>{const{feature:t,relatedRecordCallbacks:i}=this;t&&i?.showAllRelatedRecords&&i.showAllRelatedRecords({parentFeature:t,relationshipId:e})},this._onAddRelatedRecordsClick=(e,t)=>{const{feature:i,relatedRecordCallbacks:s}=this;i&&s?.addRelatedRecord&&s.addRelatedRecord({parentFeature:i,relatedLayer:t,relationshipId:e})},this._handleInputInput=e=>{this._saveValueFromComponent(e.currentTarget)},this._onFormKeyDown=this._onFormKeyDown.bind(this),this._onFormSubmit=this._onFormSubmit.bind(this),this._onGroupClick=this._onGroupClick.bind(this),this._onComponentBlur=this._onComponentBlur.bind(this),this._onComponentFocus=this._onComponentFocus.bind(this),this._onComponentKeyDown=this._onComponentKeyDown.bind(this),this._afterComponentCreateOrUpdate=this._afterComponentCreateOrUpdate.bind(this),this._afterDateComponentCreateOrUpdate=this._afterDateComponentCreateOrUpdate.bind(this),this._handleNumberInputMouseDown=this._handleNumberInputMouseDown.bind(this)}initialize(){this.addHandles([o((()=>this.feature),(()=>{const e=this._getFocusableInput("forward");this._focusedFieldName=e?.name||"",this._inputsWithChanges.clear(),this._dateComponentMap.clear(),this._attemptFocusOnNextRender=!0})),this.on("submit",(e=>{if(e.invalid.length>0){const[t]=e.invalid;e.invalid.forEach((e=>this._inputsWithChanges.add(e))),this._focusedFieldName=t,this._attemptFocusOnNextRender=!0,this.scheduleRender()}})),o((()=>[this.viewModel.activeRelationshipInput,this._listObserverNode]),(()=>this._onObserverChange()))])}loadDependencies(){return g({button:()=>import("@esri/calcite-components/dist/components/calcite-button.js"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox.js"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item.js"),"combobox-item-group":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item-group.js"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js"),"input-date-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-date-picker.js"),"input-message":()=>import("@esri/calcite-components/dist/components/calcite-input-message.js"),"input-time-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-time-picker.js"),list:()=>import("@esri/calcite-components/dist/components/calcite-list.js"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item.js"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader.js"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice.js"),progress:()=>import("@esri/calcite-components/dist/components/calcite-progress.js"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch.js")})}destroy(){this._listObserverNode&&this._listObserver.unobserve(this._listObserverNode)}get _relatedRecordsEnabled(){const e=this.relatedRecordCallbacks;return!(!e||!(e.addRelatedRecord||e.editRelatedRecord||e.showAllRelatedRecords))}get disabled(){return this.viewModel.disabled}set disabled(e){this.viewModel.disabled=e}get feature(){return this.viewModel.feature}set feature(e){this.viewModel.feature=e}get formTemplate(){return this.viewModel.formTemplate}set formTemplate(e){this.viewModel.formTemplate=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 map(){return this.viewModel.map}set map(e){this.viewModel.map=e}get relatedRecordCallbacks(){return this.viewModel.relatedRecordCallbacks}set relatedRecordCallbacks(e){this.viewModel.relatedRecordCallbacks=e}get relationshipId(){return this.viewModel.relationshipId}set relationshipId(e){this.viewModel.relationshipId=e}get spatialReference(){return this.viewModel.spatialReference}set spatialReference(e){this.viewModel.spatialReference=e}get strict(){return this.viewModel.strict}set strict(e){this.viewModel.strict=e}get view(){return i(L,"view",{replacement:"Use FeatureForm.map instead.",version:"4.27"}),this.viewModel.view}set view(e){i(L,"view",{replacement:"Use FeatureForm.map instead.",version:"4.27"}),this.viewModel.view=e}getValues(){return this.viewModel.getValues()}submit(){return this.viewModel.submit()}render(){const{state:e}=this.viewModel;return x("div",{class:this.classes(l.base,l.widget,l.panel)},"ready"===e?this._renderForm():null)}_renderForm(){return x("form",{class:l.form,novalidate:!0,onsubmit:this._onFormSubmit,onkeydown:this._onFormKeyDown},this._renderHeader(),this._renderContent())}_renderHeader(){const e=this.viewModel;if(!e.formHeaderVisible)return;const t=null!=e.formTitle&&x(I,{key:"title",level:this.headingLevel},e.formTitle),i=null!=e.formDescription&&x("p",{class:l.description,key:"description"},e.formDescription);return x("div",{class:l.formHeader},t,i)}_renderContent(){const{viewModel:e}=this;return e.activeRelationshipInput?this._renderActiveRelationshipInput(e.activeRelationshipInput):e.inputs.filter(t).filter((e=>e.visible)).map(((e,t)=>d(e)?this._renderGroup(e,t):c(e)?this._renderLabeledField(e):p(e)?this._renderRelationshipInput(e):void 0))}_renderActiveRelationshipInput(e){return this._renderRelationshipInput(e)}_renderDescriptionOrEmpty(e,t){return null==e?null:x("div",{class:this.classes(l.description),id:t},e)}_renderGroup(e,t){const{formTemplate:i,disabled:s}=this,{description:o,inputs:n,label:r,state:a}=e,d=n.filter((e=>e.visible)),u=this.viewModel.findField(this._focusedFieldName),m=!(!u||u.group!==e),h=`${this.id}_group_${t}`,v=`${this.id}_group-label_${t}`,b=`${this.id}_group-description_${t}`,_=this._renderDescriptionOrEmpty(o,b),g="sequential"===this.groupDisplay,f=g?m:"expanded"===a,C=f?l.collapseIcon:l.expandIcon;return x("fieldset",{"aria-expanded":f.toString(),"aria-labelledby":v,"aria-describedby":o?b:"",class:this.classes(l.group,g?l.groupSequential:null,f?null:l.groupCollapsed,m?l.groupActive:null,s?l.inputDisabled:null),disabled:s,"data-group":e,id:h,key:t,onclick:this._onGroupClick},x("button",{role:g?"presentation":void 0,class:l.groupHeader,type:"button",tabIndex:g?-1:0},x("div",{class:l.groupTitle},x(I,{class:l.groupLabel,id:v,level:null!=i&&i.title?O(this.headingLevel):this.headingLevel},r),_),g?null:x("span",{class:this.classes(C,l.groupToggleIcon)})),d.map((e=>c(e)?this._renderLabeledField(e):p(e)?this._renderRelationshipInput(e):void 0)))}_getFocusableInput(e,t){const i=this.viewModel.allFieldInputs,s="forward"===e?i:i.slice().reverse();let o;if(!t||p(t))o=0;else if(d(t)){const e=t.inputs.find(c);o=e?s.indexOf(e):0}else{let i;if(u(t)&&"collapsed"===t.group.state){const s=t.group.inputs.filter(c);i="forward"===e?s[s.length-1]:s[0]}else i=t;o=s.indexOf(i)+1}for(let n=o;n<s.length;n++){const e=s[n];if(e.visible&&c(e))return e}return null}_renderLabeledField(e){const{dataType:t,feature:i,label:s,layer:o}=e;return x("label",{key:`${o.id}-${i.uid}-${e.name}`,class:l.label},[s,"unsupported"!==t?this._renderFieldInput(e):this._renderReadOnlyComponent(e),this._renderAuxiliaryText(e)])}_renderFieldInput(e){const{dataType:t,domain:i,inputType:s,name:o,updating:n}=e,r=this.getCommonInputProps(e);if("coded-value"===i?.type){const t=this.viewModel.getFieldValueOptionsForField(o,this.messages.empty);return"switch"!==s||e.hasInvalidSwitchValue?"radio-buttons"===s?this._renderRadioButtonComponents(e,t.flat(),r):this._renderComboBoxComponent(e,t,r):this._renderSwitchComponent(e,r)}if("datetime-picker"===s||"date"===t)return this._renderDateComponents(e,r);const a="number"===t?x("input",{type:"number",...r,value:null!=this._activeNumberFieldEdit&&this._activeNumberFieldEdit.fieldName===e.name?this._activeNumberFieldEdit.value:`${r.value}`}):"text-area"===s?x("textarea",{...r}):x("input",{type:"text",...r});return n?x("div",{key:`${r.key}-input-updating-wrapper`,class:l.fieldInputWrapper},a,x("div",{class:l.fieldInputLoader},x("calcite-progress",{type:"indeterminate"}))):a}_renderDateComponents(e,t){const{dateDataType:i,includeTime:s,label:o,name:n,valid:r,value:a}=e,{class:d,max:c,min:p,key:u,readOnly:m,required:h}=t;if("string"===i)return this._renderReadOnlyComponent(e,f(e.field,t.value));const{date:v,time:b}=C(a),_=null!=c?C(c):void 0,g=null!=p?C(p):void 0,F=_?.date??void 0,w=g?.date??void 0,R={afterCreate:this._afterDateComponentCreateOrUpdate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!r,label:o,numberingSystem:y,overlayPositioning:"fixed",readOnly:m,required:h,tabIndex:0,[E]:n};return x("div",{key:`${u}-date-time-container`,class:l.dateInputContainer},x("calcite-input-date-picker",{bind:this,...R,class:this.classes(d,l.inputDate),"data-date-part":"date",key:`${u}-date-input`,valueAsDate:v??void 0,maxAsDate:F,minAsDate:w,onCalciteInputDatePickerChange:e=>this._saveValueFromDateComponent(e.target),onblur:e=>this._saveValueFromDateComponent(e.target,!0)}),s?x("calcite-input-time-picker",{bind:this,...R,class:this.classes(d,l.inputTime),"data-date-part":"time",key:`${u}-time-input`,value:b??void 0,step:1,onCalciteInputTimePickerChange:e=>this._saveValueFromDateComponent(e.target),onfocus:e=>{e.target.calciteTimePickerEl&&(e.target.calciteTimePickerEl.showSecond=!0)},onblur:e=>this._saveValueFromDateComponent(e.target,!0)}):null)}_renderReadOnlyComponent(e,t){const i=this.getCommonInputProps(e);return x("input",{afterCreate:i.afterCreate,afterUpdate:i.afterUpdate,class:this.classes(l.input,l.fieldInput,l.inputDisabled),onfocus:i.onfocus,readOnly:!0,tabIndex:i.tabIndex,type:"text",value:null!=t?`${t}`:i.value,[E]:i[E]})}_renderComboBoxComponent(e,t,i){const{value:s,name:o}=e,{messages:n,messagesTemplates:r,viewModel:a,_inputsWithChanges:l}=this,d=t.map((e=>e.map((({name:e,value:t})=>x("calcite-combobox-item",{key:`#${t}`,selected:s===t,textLabel:e,value:`${t}`}))))),[c,p]=d;this.viewModel.fieldsWithInvalidCodedValue.has(e)&&p.unshift(x("calcite-combobox-item",{key:"incompatible-option",readOnly:!0,textLabel:`${e.value}`,value:`${e.value}`}));const u=p.length>0?[x("calcite-combobox-item-group",{key:"recommended",label:n.recommended},c),x("calcite-combobox-item-group",{key:"other",label:r.other},p)]:c,m="INSERT"===a.arcadeEditType,h=l.has(o),v=null==s&&(!m||h);if(e.showNoValueOptionEnabled){const t="",i=e.showNoValueLabel||n.empty;u.unshift(x("calcite-combobox-item",{value:t,textLabel:n.empty,selected:v,key:"empty-option"},i))}const b=m&&e.showNoValueOptionEnabled&&!h?()=>{}:i.onblur;return x("calcite-combobox",{...i,selectionMode:"single",disabled:i.readOnly,allowCustomValues:!1,clearDisabled:!0,overlayPositioning:"fixed",onblur:b,onCalciteComboboxChange:({target:e})=>{v&&0===e.selectedItems.length?this._ignoreDeselectionOfNoValueOption(e):this._saveValueFromComponent(e)}},u)}_renderRadioButtonComponents(e,t,i){const{name:s,value:o}=e,n=t.map((({name:e,value:t})=>this._renderRadioButtonComponent({key:e,label:e,name:s,value:t,selected:t===o,props:i})));if(e.showNoValueOptionEnabled){const t="",r=e.showNoValueLabel||this.messages.empty,a=o===t||null===o;n.unshift(this._renderRadioButtonComponent({key:"empty-option",label:r,name:s,value:t,selected:a,props:i}))}return x("div",{key:`${i.key}-radio`,class:l.inputRadioGroup},n)}_renderSwitchComponent(e,t){const{value:i}=e,s=!!m(e.element,"switch")&&i===e.element.input.onValue;return x("calcite-switch",{...t,class:l.inputSwitch,onCalciteSwitchChange:e=>this._saveValueFromComponent(e.target),checked:s,disabled:t.readOnly})}_renderRadioButtonComponent({key:e,name:t,value:i,selected:s,label:o,props:n}){return x("label",{key:e,class:l.inputRadioLabel},x("input",{...n,class:l.inputRadio,name:t,type:"radio",value:`${i}`,checked:s,disabled:n.readOnly,onchange:e=>this._saveValueFromComponent(e.target)}),o)}_renderAuxiliaryText(e){const t=e.name,i=this._inputsWithChanges.has(t)&&!e.valid?h(e,this.messages):null!=this.viewModel.contingencyConstraintViolations.get(t)?this.messages.validationErrors.valuesIncompatible:null!=e.valueExpressionExecutor&&e.valueExpressionExecutor.stale?this.messages.valueExpressionError:null;return null!=i?x("calcite-input-message",{status:"invalid",icon:!0},i):this._renderDescriptionOrEmpty(e.description)}_renderShowAllRelatedRecordsListItem(e){const{featureCount:t,relationshipId:i,showAllActionVisible:s}=e,{relatedRecordCallbacks:o}=this;if(!s||!o?.showAllRelatedRecords)return;const n=this.messages;return x("calcite-list-item",{description:N(n.totalCount,{count:t}),label:n.showAll,value:!0,onCalciteListItemSelect:()=>this._onShowAllRelatedRecordsClick(i)},x("calcite-icon",{slot:"content-end",scale:"s",icon:"list"}))}_renderAddRelatedRecordButton(e){const{canAddRelatedFeature:t,relationshipId:i,relatedLayer:s}=e,{relatedRecordCallbacks:o}=this;if(t&&o?.addRelatedRecord&&s)return x("calcite-button",{alignment:"center",appearance:"outline-fill",class:l.centeredButton,disabled:e.updating,iconStart:"plus",key:`${i}-add-button`,round:!0,scale:"s",width:"half",onclick:()=>this._onAddRelatedRecordsClick(i,s)},this.messages.addRecord)}_renderRelatedRecordListItem(e,t){const{feature:i,description:s,title:o}=e,{feature:n,relatedRecordCallbacks:r}=this,a=()=>{r?.editRelatedRecord&&n&&r.editRelatedRecord({parentFeature:n,relationshipId:t,relatedFeature:i})};return x("calcite-list-item",{bind:this,description:s,label:o,key:`${t}-${i.uid}`,value:o,onclick:a},x("calcite-icon",{slot:"content-start",scale:"m",icon:v(i)}),x("calcite-icon",{slot:"content-end",scale:"s",icon:"chevron-right"}))}_renderRelationshipInput(e){if(!this._relatedRecordsEnabled||!e.editable)return;const{featureCount:t,relationshipId:i,showAllEnabled:s}=e,o=s?null:this._renderDescriptionOrEmpty(e.description),n=t>0?this._renderRelatedRecordsList(e):e.loaded?this._renderNoRelatedRecordsNotice():void 0;return x("label",{class:this.classes(l.label,l.relationshipLabel),key:`relationship-${i}-container`},x("div",null,this._renderRelatedRecordsHeaderContainer(e),o,n),this._renderAddRelatedRecordButton(e))}_renderRelatedRecordsHeaderContainer(e){const t=e.updating||!e.loaded;return x("div",{class:l.relatedRecordsHeader,key:`relationship-${e.relationshipId}-header`},x("span",null,e.label),t?x("calcite-loader",{label:this.messagesCommon?.loading,inline:!0,key:"loader",scale:"s",type:"indeterminate"}):void 0)}_renderRelatedRecordsList(e){const{relationshipId:t}=e;return x("calcite-list",{class:l.relatedRecordsList},e.relatedFeatureInfos.map((e=>this._renderRelatedRecordListItem(e,t))),this._renderShowAllRelatedRecordsListItem(e),this._renderObserverNode())}_renderNoRelatedRecordsNotice(){return x("calcite-notice",{open:!0,scale:"s",kind:"brand",icon:"information",width:"full"},x("div",{slot:"message"},this.messagesFeature.noRelatedFeatures))}_renderObserverNode(){if(this.viewModel.activeRelationshipInput?.showAllEnabled)return x("div",{key:"feature-observer",class:l.listObserver,bind:this,afterCreate:this._afterListObserverCreated,afterRemoved:this._afterListObserverRemoved})}getCommonInputProps(e){const{disabled:t,groupDisplay:i}=this,{dataType:s,editable:o,group:n,hint:r,label:a,maxLength:d,minLength:c,name:p,required:u,valid:m,value:h}=e,v=this._inputsWithChanges.has(p),b=!o||t,_="all"===i&&null!=n&&"collapsed"===n.state;return{afterCreate:this._afterComponentCreateOrUpdate,afterUpdate:this._afterComponentCreateOrUpdate,"aria-invalid":m?"false":"true",class:this.classes(l.input,l.fieldInput,b?l.inputDisabled:null,v&&!m?l.inputInvalid:null),key:p,label:a,minlength:c>-1?`${c}`:"",maxlength:d>-1?`${d}`:"",...e.range,readOnly:b,value:null==h?"":`${h}`,[E]:p,onfocus:this._onComponentFocus,oninput:this._handleInputInput,onblur:this._onComponentBlur,onkeydown:this._onComponentKeyDown,onmousedown:"number"===s?this._handleNumberInputMouseDown:void 0,placeholder:"number"===s||"text"===s?r??void 0:"",required:u,tabIndex:_?-1:0}}_handleNumberInputMouseDown({target:e}){e.focus(),this.scheduleRender()}_getFieldInputFromHTMLElement(e){return this.viewModel.findField(e.getAttribute(E))}_afterDateComponentCreateOrUpdate(e){const{name:t}=this._getFieldInputFromHTMLElement(e),i=this._dateComponentMap.get(t),s=R(e);null!=i?s?i.date=e:i.time=e:this._dateComponentMap.set(t,{[s?"date":"time"]:e}),this._afterComponentCreateOrUpdate(e)}_afterComponentCreateOrUpdate(e){const{viewModel:t}=this,i=this._getFieldInputFromHTMLElement(e),s=t.findField(this._focusedFieldName),o=t.fieldsWithInvalidCodedValue.has(i);this._attemptFocusOnNextRender&&s===i&&("radio-buttons"!==i.inputType||o||e.checked)&&(this._attemptFocusOnNextRender=!1,u(i)&&(i.group.state="expanded"),e.focus())}_onComponentFocus(e){const t=e.target,i=this._getFieldInputFromHTMLElement(t);this._focusedFieldName=i.name,b(i)&&(this._activeNumberFieldEdit={fieldName:i.name,input:t,value:t.value})}_onComponentBlur(e){const t=e.target,i=this._getFieldInputFromHTMLElement(t);"number"===i.dataType&&null!=this._activeNumberFieldEdit&&(this._activeNumberFieldEdit.input.value=`${i.value}`,this._activeNumberFieldEdit=null),this._saveValueFromComponent(t),this.scheduleRender()}_saveValueFromDateComponent(e,t=!1){const{name:i}=this._getFieldInputFromHTMLElement(e);if(!this._dateComponentMap.has(i))return;const s=this._dateComponentMap.get(i);if(!s||!s.date)return;const o=F(e),n=this._getFieldInputFromHTMLElement(s.date),r=w(n,s.date,s.time);this.viewModel.getValue(i)!==r&&(null!==o&&null!==r?this._updateFieldValue(i,r):t&&this._updateFieldValue(i,null))}_saveValueFromComponent(e){const t=this._getFieldInputFromHTMLElement(e);null!=this._activeNumberFieldEdit&&b(t)&&(this._activeNumberFieldEdit.value=e.value),this._updateFieldValue(t.name,this._parseValue(e))}_onComponentKeyDown(e){const{key:t,altKey:i,ctrlKey:s,metaKey:o}=e,n=this._getFieldInputFromHTMLElement(e.target);if("Enter"===t)u(n)&&"collapsed"===n.group.state&&(n.group.state="expanded");else{const{type:r}=n.field,a="single"===r||"double"===r;if(("integer"===r||"small-integer"===r||a)&&(!i&&!s&&!o)&&1===t.length){const i=Number(t),s=["-","+"],o=["e","."],n=a?[...s,...o]:s;isNaN(i)&&!n.includes(t)&&e.preventDefault()}}}_updateFieldValue(e,t){if(this.viewModel.setValue(e,t),this._inputsWithChanges.add(e),this.viewModel.fieldsWithContingentValues.has(e)){const e=Object.fromEntries(Object.entries(this.getValues()).filter((([e,t])=>null!=t)));this.viewModel.validateContingencyConstraints(e)}}_parseValue(e){const t=this._getFieldInputFromHTMLElement(e),i=e.value;if(m(t.element,"switch")&&"CALCITE-COMBOBOX"!==e.tagName)return e.checked?t.element.input.onValue:t.element.input.offValue;return"radio-buttons"===t.inputType&&"radio"===e.type&&!e.checked?t.value:"number"===t.dataType?i?parseFloat(i):null:i}_ignoreDeselectionOfNoValueOption(e){const{firstChild:t,selectedItems:i}=e;0===i.length&&t&&"selected"in t?t.selected=!0:L.warnOnce("Failed to override user attempt to deselect 'No value' option.")}_onGroupClick(e){const t=e.currentTarget["data-group"],i="expanded"===t.state,s="sequential"===this.groupDisplay,o=`.${l.groupHeader}`;if(!(i&&!e.target.closest(o))){if(this._focusedFieldName=this._getFocusableInput("forward",t)?.name||"",s){const s=e.target.closest(o);if(i&&!s)return;this.viewModel.inputs.forEach((e=>{d(e)&&e!==t&&(e.state="collapsed")}))}t.state=i?"collapsed":"expanded",this._attemptFocusOnNextRender=s,this.scheduleRender()}}_onFormSubmit(e){e.preventDefault()}_onFormKeyDown(e){"Enter"===e.key&&this.viewModel.submit()}_afterListObserverCreated(e){this.viewModel.activeRelationshipInput&&(this._listObserverNode=e)}_afterListObserverRemoved(){this._listObserverNode=null}async _onObserverChange(){this._listObserverNode&&this._listObserver.unobserve(this._listObserverNode);const e=this.viewModel.activeRelationshipInput;if(!e)return;const{showAllEnabled:t,updating:i}=e;this._listObserverNode&&!i&&t&&this._listObserver.observe(this._listObserverNode)}_incrementRelatedRecordPage(){const e=this.viewModel.activeRelationshipInput;e?.incrementPage()}};e([n()],T.prototype,"_listObserverNode",void 0),e([n()],T.prototype,"_relatedRecordsEnabled",null),e([n()],T.prototype,"disabled",null),e([n()],T.prototype,"feature",null),e([n()],T.prototype,"formTemplate",null),e([n()],T.prototype,"groupDisplay",void 0),e([n()],T.prototype,"headingLevel",void 0),e([n()],T.prototype,"label",null),e([n()],T.prototype,"layer",null),e([n()],T.prototype,"map",null),e([n(),k("esri/widgets/FeatureForm/t9n/FeatureForm")],T.prototype,"messages",void 0),e([n(),k("esri/t9n/common")],T.prototype,"messagesCommon",void 0),e([n(),k("esri/widgets/Feature/t9n/Feature")],T.prototype,"messagesFeature",void 0),e([n(),k("esri/widgets/FeatureTemplates/t9n/FeatureTemplates")],T.prototype,"messagesTemplates",void 0),e([n()],T.prototype,"relatedRecordCallbacks",null),e([n()],T.prototype,"relationshipId",null),e([n()],T.prototype,"spatialReference",null),e([n()],T.prototype,"strict",null),e([n()],T.prototype,"view",null),e([n(),M(["value-change","submit"])],T.prototype,"viewModel",void 0),T=e([r(D)],T);const V=T;export{V 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.28/esri/copyright.txt for details.
4
+ */
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import{getAssetUrl as t}from"../../assets.js";import o from"../../Color.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";import i from"../../symbols/LineSymbolMarker.js";import n from"../../symbols/SimpleLineSymbol.js";import l from"../Widget.js";import{loadCalciteComponents as c}from"../support/componentsUtils.js";import"../support/widgetUtils.js";import{messageBundle as a}from"../support/decorators/messageBundle.js";import{tsx as p}from"../support/jsxFactory.js";import d from"./VisibleElementsSettingsPane.js";const m="esri-un-associations",u={divControlsSymbolPicker:`${m}__div-controls-symbol-picker`,dropdown:`${m}__dropdown`,dropdownItemLineCap:`${m}__dropdown-item-line-cap`,dropdownItemLinePattern:`${m}__dropdown-item-line-pattern`,dropdownSelectedItemLineCap:`${m}__dropdown-selected-item-line-cap`,dropdownSelectedItemLinePattern:`${m}__dropdown-selected-item-line-pattern`,dropdownTrigger:`${m}__dropdown-trigger`,labelAndToggle:`${m}__label-and-toggle`};let w=class extends l{constructor(e,t){super(e,t),this._lineCapTypes=["butt","round","square"],this._lineStyleTypes=["solid","dash","dash-dot","dot","long-dash","long-dash-dot","long-dash-dot-dot","short-dash","short-dash-dot","short-dash-dot-dot","short-dot"],this.lineSymbol=new n,this.messages=null,this.showArrows=!1,this.visibleElements=new d,this._afterComponentCreate=this._afterComponentCreate.bind(this)}render(){const{messages:{input:{lineCap:e,lineColor:t,lineStyle:o,lineWidth:s,showArrows:r}},visibleElements:i}=this,n=this.lineSymbol;return p("div",{class:u.divControlsSymbolPicker},i.arrowsToggle?this._renderToggle(r,this.showArrows,n,"marker"):void 0,i.capSelect?this._renderLineStylePicker(e,this._lineCapTypes,n,"cap"):void 0,i.colorPicker&&n.color?this._renderColorPicker(t,n.color.toHex(),n,"color"):void 0,i.stylePicker?this._renderLineStylePicker(o,this._lineStyleTypes,n,"style"):void 0,i.widthInput?this._renderNumberInput(s,n.width.toString(),n,"width"):void 0)}loadDependencies(){return c({dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown.js"),"dropdown-group":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-group.js"),"dropdown-item":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-item.js"),input:()=>import("@esri/calcite-components/dist/components/calcite-input.js"),"input-number":()=>import("@esri/calcite-components/dist/components/calcite-input-number.js"),label:()=>import("@esri/calcite-components/dist/components/calcite-label.js"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch.js")})}_afterComponentCreate(e){"value"in e&&null!=e.value&&"setNumberValue"in e&&e.setNumberValue({committing:!1,value:e.value,origin:"direct"})}_renderColorPicker(e,t,s,r){return p("calcite-label",{scale:"s"},e,p("calcite-input",{scale:"s",type:"color",value:t,onCalciteInputInput:e=>{const t=e.target;s.set(r,new o(t.value))}}))}_renderLineStylePicker(e,o,s,r){const i="style"===r,n="esri/widgets/UtilityNetworkAssociations/assets/img";function l(e,o){return p("calcite-dropdown-item",{selected:s[o]===e,label:e},p("div",{class:i?u.dropdownItemLinePattern:u.dropdownItemLineCap,style:`background-image:url(${t(`${n}/line-${i?"patterns":"caps"}/${e}.png`)})`}))}return p("calcite-label",{scale:"s"},e,p("calcite-dropdown",{onCalciteDropdownSelect:e=>{const t=e.target;s.set(r,t.selectedItems[0].label)},class:u.dropdown},p("div",{role:"button",slot:"trigger",class:u.dropdownTrigger},p("div",{class:i?u.dropdownSelectedItemLinePattern:u.dropdownSelectedItemLineCap,style:`background-image:url(${t(`${n}/line-${i?"patterns":"caps"}/${s[r]}.png`)})`})),p("calcite-dropdown-group",null,o.map((e=>l(e,r))))))}_renderNumberInput(e,t,o,s){return p("calcite-label",{scale:"s"},e,p("calcite-input-number",{afterCreate:this._afterComponentCreate,scale:"s",type:"number",step:1,value:t,min:1,max:10,onCalciteInputNumberChange:e=>{const t=e.target;o.set(s,t.value)}}))}_renderToggle(e,t,o,s){return p("div",{class:u.labelAndToggle},p("calcite-label",{scale:"s"},e),p("calcite-switch",{bind:this,scale:"m",checked:t,onCalciteSwitchChange:e=>{e.target.checked?o.set(s,new i({style:"arrow"})):o.set(s,null)}}))}};e([s()],w.prototype,"lineSymbol",void 0),e([s(),a("esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations")],w.prototype,"messages",void 0),e([s()],w.prototype,"showArrows",void 0),e([s({type:d,nonNullable:!0})],w.prototype,"visibleElements",void 0),w=e([r("esri.widgets.UtilityNetworkAssociations.UtilityNetworkAssociationsLineSymbolPicker")],w);const g=w;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.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../chunks/tslib.es6.js";import i from"../../Graphic.js";import"../../intl.js";import s from"../../core/Accessor.js";import e from"../../core/Collection.js";import o from"../../core/Error.js";import{HandleOwnerMixin as r}from"../../core/HandleOwner.js";import n from"../../core/Logger.js";import{watch as a}from"../../core/reactiveUtils.js";import{property as c}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as l}from"../../core/accessorSupport/decorators/subclass.js";import h from"../../geometry/Extent.js";import m from"../../geometry/Point.js";import{load as y,project as p,isLoaded as u}from"../../geometry/projection.js";import w from"../../layers/GraphicsLayer.js";import{synthesizeAssociationGeometries as A}from"../../rest/networks/synthesizeAssociationGeometries.js";import d from"../../rest/networks/support/SynthesizeAssociationGeometriesParameters.js";import v from"../../symbols/LineSymbolMarker.js";import L from"../../symbols/SimpleLineSymbol.js";import{addUniqueLayer as S}from"../../views/draw/support/layerUtils.js";import{onLocaleChange as g}from"../../intl/locale.js";import{fetchMessageBundle as _}from"../../intl/messages.js";let b=class extends(r(s)){constructor(t){super(t),this._internalGraphicsLayerConnectivity=this._createInternalGraphicsLayer("Connectivity Associations (Internal)"),this._internalGraphicsLayerStructuralAttachment=this._createInternalGraphicsLayer("Structural Attachment Associations (Internal)"),this._initialValidationsFinished=!1,this.autoRefreshAssociations=!1,this.connectivityAssociationsLineSymbol=new L({style:"short-dash",width:2,color:[190,159,159,1]}),this.executionError="",this.loadError="",this.loadErrors=new e,this.maxAllowableAssociations=250,this.showAssociationsEnabled=!1,this.showArrowsConnectivity=!1,this.showArrowsStructuralAttachment=!1,this.structuralAttachmentAssociationsLineSymbol=new L({style:"short-dash",width:2,color:[159,190,159,1]})}initialize(){const t=async()=>{this.messages||(this.messages=await _("esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations"))};t().then((()=>{this.view||(this.view=null),this.utilityNetwork||(this.utilityNetwork=null),this.addHandles([a((()=>[this.view,this.utilityNetwork]),(async()=>{const{loadErrors:t,messages:i}=this,{noUtilityNetwork:s,noView:e}=i.info;this._initialValidationsFinished=!1,t.removeAll();let r=!1,a=!1;this._set("loadError",""),this.removeAssociations(),this.utilityNetwork&&"utility"===this.utilityNetwork.type?(this.utilityNetwork.loaded||await this.utilityNetwork.load(),r=!0):(this.loadErrors.push(s),this._set("loadError",s),n.getLogger(this).error(new o("utilityNetworkAssociations:missing-property",s))),this.view&&"2d"===this.view.type?(S(this.view,this._internalGraphicsLayerConnectivity),S(this.view,this._internalGraphicsLayerStructuralAttachment),a=!0):(this.loadErrors.push(e),this._set("loadError",e),n.getLogger(this).error(new o("utilityNetworkAssociations:missing-property",e))),r&&a&&this.showAssociationsEnabled&&await this.showAssociations(),this._internalGraphicsLayerConnectivity.visible=this.includeConnectivityAssociations,this._internalGraphicsLayerStructuralAttachment.visible=this.includeStructuralAttachmentAssociations,this._initialValidationsFinished=!0}),{initial:!0}),a((()=>[this.view?.stationary,this.showAssociationsEnabled,this.maxAllowableAssociations]),(async()=>{this.view?.stationary&&this.showAssociationsEnabled&&(this.includeConnectivityAssociations||this.includeStructuralAttachmentAssociations)&&await this.showAssociations()})),a((()=>[this.showArrowsConnectivity]),(()=>{const t=this.connectivityAssociationsLineSymbol.clone();t.marker=null,this.showArrowsConnectivity&&(t.marker=new v({color:this.connectivityAssociationsLineSymbol.color,placement:"end",style:"arrow"})),this._internalGraphicsLayerConnectivity.graphics.length>0&&this._internalGraphicsLayerConnectivity.graphics.map((i=>{i.symbol=t}))})),a((()=>[this.showArrowsStructuralAttachment]),(()=>{const t=this.structuralAttachmentAssociationsLineSymbol.clone();t.marker=null,this.showArrowsStructuralAttachment&&(t.marker=new v({color:this.structuralAttachmentAssociationsLineSymbol.color,placement:"end",style:"arrow"})),this._internalGraphicsLayerStructuralAttachment.graphics.length>0&&this._internalGraphicsLayerStructuralAttachment.graphics.map((i=>{i.symbol=t}))})),g(t)])}))}destroy(){this.view=null,this._removeInternalGraphicsLayers()}set includeConnectivityAssociations(t){this._set("includeConnectivityAssociations",t),this._internalGraphicsLayerConnectivity.visible=t}set includeStructuralAttachmentAssociations(t){this._set("includeStructuralAttachmentAssociations",t),this._internalGraphicsLayerStructuralAttachment.visible=t}get state(){return""!==this.loadError?"disabled":this.updatingHandles.updating?"executing":""!==this.executionError?"warning":this._initialValidationsFinished?"ready":"loading"}set utilityNetwork(t){this._get("utilityNetwork")!==t&&this._set("utilityNetwork",t)}set view(t){this._get("view")!==t&&this._set("view",t)}removeAssociations(){this._internalGraphicsLayerConnectivity.removeAll(),this._internalGraphicsLayerStructuralAttachment.removeAll()}async showAssociations(){const{messages:t}=this,{maxAllowableAssociationsExceeded:s,noAssociationsFound:e}=t.info,o=this.utilityNetwork?.spatialReference;if(u()||await y(),!this.view)return;const{spatialReference:r,extent:{xmin:n,ymin:a,xmax:c,ymax:l}}=this.view,w=p(new m({x:n,y:a,spatialReference:r}),o),L=p(new m({x:c,y:l,spatialReference:r}),o),S=new h({xmin:w.x,ymin:w.y,xmax:L.x,ymax:L.y,spatialReference:o});let g="";this.utilityNetwork?.networkServiceUrl&&(g=this.utilityNetwork?.networkServiceUrl);const _=new d({returnConnectivityAssociations:this.includeConnectivityAssociations,returnAttachmentAssociations:this.includeStructuralAttachmentAssociations,extent:S,outSpatialReference:this.utilityNetwork?.spatialReference,maxGeometryCount:this.maxAllowableAssociations,gdbVersion:(this.view?.map.allLayers?.items.find((t=>"feature"===t.type))).gdbVersion,moment:this.moment});this._set("executionError",""),this.removeAssociations(),this.updatingHandles.addPromise(A(g,_).then((t=>{let o=[],r=[];!0!==t?.maxGeometryCountExceeded?0!==t?.associations.length?t&&(o=t?.associations.filter((({associationType:t})=>"connectivity"===t)).map((t=>(this.connectivityAssociationsLineSymbol.marker=null,this.showArrowsConnectivity&&(this.connectivityAssociationsLineSymbol.marker=new v({color:this.connectivityAssociationsLineSymbol.color,placement:"end",style:"arrow"})),new i({geometry:t.geometry.clone(),symbol:this.connectivityAssociationsLineSymbol})))),r=t.associations.filter((({associationType:t})=>"attachment"===t)).map((t=>(this.structuralAttachmentAssociationsLineSymbol.marker=null,this.showArrowsStructuralAttachment&&(this.structuralAttachmentAssociationsLineSymbol.marker=new v({color:this.structuralAttachmentAssociationsLineSymbol.color,placement:"end",style:"arrow"})),new i({geometry:t.geometry.clone(),symbol:this.structuralAttachmentAssociationsLineSymbol})))),o.length>0&&this._internalGraphicsLayerConnectivity.addMany(o),r.length>0&&this._internalGraphicsLayerStructuralAttachment.addMany(r)):this._set("executionError",e):this._set("executionError",s)}),(({message:t})=>{this._set("executionError",t)})))}_createInternalGraphicsLayer(t){return new w({listMode:"hide",internal:!0,title:t})}_removeInternalGraphicsLayers(){this._internalGraphicsLayerConnectivity&&this._internalGraphicsLayerStructuralAttachment&&this.view&&this.view.map&&(this.view.map.remove(this._internalGraphicsLayerConnectivity),this.view.map.remove(this._internalGraphicsLayerStructuralAttachment))}};t([c()],b.prototype,"_initialValidationsFinished",void 0),t([c()],b.prototype,"autoRefreshAssociations",void 0),t([c()],b.prototype,"connectivityAssociationsLineSymbol",void 0),t([c({readOnly:!0})],b.prototype,"executionError",void 0),t([c({type:Boolean,value:!0})],b.prototype,"includeConnectivityAssociations",null),t([c({type:Boolean,value:!0})],b.prototype,"includeStructuralAttachmentAssociations",null),t([c({readOnly:!0})],b.prototype,"loadError",void 0),t([c()],b.prototype,"loadErrors",void 0),t([c()],b.prototype,"maxAllowableAssociations",void 0),t([c()],b.prototype,"messages",void 0),t([c()],b.prototype,"moment",void 0),t([c()],b.prototype,"showAssociationsEnabled",void 0),t([c()],b.prototype,"showArrowsConnectivity",void 0),t([c()],b.prototype,"showArrowsStructuralAttachment",void 0),t([c({readOnly:!0})],b.prototype,"state",null),t([c()],b.prototype,"structuralAttachmentAssociationsLineSymbol",void 0),t([c()],b.prototype,"utilityNetwork",null),t([c()],b.prototype,"view",null),b=t([l("esri.widgets.UtilityNetworkAssociations.UtilityNetworkAssociationsViewModel")],b);const f=b;export{f as default};
5
+ import{_ as t}from"../../chunks/tslib.es6.js";import i from"../../Graphic.js";import"../../intl.js";import s from"../../core/Accessor.js";import e from"../../core/Collection.js";import o from"../../core/Error.js";import{HandleOwnerMixin as r}from"../../core/HandleOwner.js";import n from"../../core/Logger.js";import{watch as a}from"../../core/reactiveUtils.js";import{property as c}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as l}from"../../core/accessorSupport/decorators/subclass.js";import h from"../../geometry/Extent.js";import m from"../../geometry/Point.js";import{load as y,project as u,isLoaded as p}from"../../geometry/projection.js";import w from"../../layers/GraphicsLayer.js";import{synthesizeAssociationGeometries as A}from"../../rest/networks/synthesizeAssociationGeometries.js";import d from"../../rest/networks/support/SynthesizeAssociationGeometriesParameters.js";import v from"../../symbols/LineSymbolMarker.js";import S from"../../symbols/SimpleLineSymbol.js";import{addUniqueLayer as L}from"../../views/draw/support/layerUtils.js";import{onLocaleChange as b}from"../../intl/locale.js";import{fetchMessageBundle as f}from"../../intl/messages.js";let g=class extends(r(s)){constructor(t){super(t),this._internalGraphicsLayerConnectivity=this._createInternalGraphicsLayer("Connectivity Associations (Internal)"),this._internalGraphicsLayerStructuralAttachment=this._createInternalGraphicsLayer("Structural Attachment Associations (Internal)"),this._initialValidationsFinished=!1,this.autoRefreshAssociations=!1,this.connectivityAssociationsLineSymbol=new S({style:"short-dash",width:2,color:[190,159,159,1]}),this.executionError="",this.loadError="",this.loadErrors=new e,this.maxAllowableAssociations=250,this.showAssociationsEnabled=!1,this.showArrowsConnectivity=!1,this.showArrowsStructuralAttachment=!1,this.structuralAttachmentAssociationsLineSymbol=new S({style:"short-dash",width:2,color:[159,190,159,1]})}initialize(){const t=async()=>{this.messages||(this.messages=await f("esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations"))};t().then((()=>{this.view||(this.view=null),this.utilityNetwork||(this.utilityNetwork=null),this.addHandles([a((()=>[this.view,this.utilityNetwork]),(async()=>{const{loadErrors:t,messages:i}=this,{noUtilityNetwork:s,noView:e}=i.info;this._initialValidationsFinished=!1,t.removeAll();let r=!1,a=!1;this._set("loadError",""),this.removeAssociations(),this.utilityNetwork&&"utility"===this.utilityNetwork.type?(this.utilityNetwork.loaded||await this.utilityNetwork.load(),r=!0):(this.loadErrors.push(s),this._set("loadError",s),n.getLogger(this).error(new o("utilityNetworkAssociations:missing-property",s))),this.view&&"2d"===this.view.type?(L(this.view,this._internalGraphicsLayerConnectivity),L(this.view,this._internalGraphicsLayerStructuralAttachment),a=!0):(this.loadErrors.push(e),this._set("loadError",e),n.getLogger(this).error(new o("utilityNetworkAssociations:missing-property",e))),r&&a&&this.showAssociationsEnabled&&await this.showAssociations(),this._internalGraphicsLayerConnectivity.visible=this.includeConnectivityAssociations,this._internalGraphicsLayerStructuralAttachment.visible=this.includeStructuralAttachmentAssociations,this._initialValidationsFinished=!0}),{initial:!0}),a((()=>[this.view?.stationary,this.showAssociationsEnabled,this.maxAllowableAssociations]),(async()=>{this.view?.stationary&&this.showAssociationsEnabled&&(this.includeConnectivityAssociations||this.includeStructuralAttachmentAssociations)&&await this.showAssociations()})),a((()=>[this.showArrowsConnectivity]),(()=>{const t=this.connectivityAssociationsLineSymbol.clone();t.marker=null,this.showArrowsConnectivity&&(t.marker=new v({color:this.connectivityAssociationsLineSymbol.color,placement:"end",style:"arrow"}));for(const i of this._internalGraphicsLayerConnectivity.graphics)i.symbol=t})),a((()=>[this.showArrowsStructuralAttachment]),(()=>{const t=this.structuralAttachmentAssociationsLineSymbol.clone();t.marker=null,this.showArrowsStructuralAttachment&&(t.marker=new v({color:this.structuralAttachmentAssociationsLineSymbol.color,placement:"end",style:"arrow"}));for(const i of this._internalGraphicsLayerStructuralAttachment.graphics)i.symbol=t})),a((()=>{const{cap:t,color:i,style:s,width:e,marker:o}=this.connectivityAssociationsLineSymbol;return[t,i,s,e,o]}),(()=>{const t=this.connectivityAssociationsLineSymbol.clone();for(const i of this._internalGraphicsLayerConnectivity.graphics)i.symbol=t;this.showArrowsConnectivity=!1,t.marker=null,this.connectivityAssociationsLineSymbol.marker&&(this.showArrowsConnectivity=!0,t.marker=new v({color:this.connectivityAssociationsLineSymbol.color,placement:"end",style:"arrow"}))})),a((()=>{const{cap:t,color:i,style:s,width:e,marker:o}=this.structuralAttachmentAssociationsLineSymbol;return[t,i,s,e,o]}),(()=>{const t=this.structuralAttachmentAssociationsLineSymbol.clone();for(const i of this._internalGraphicsLayerStructuralAttachment.graphics)i.symbol=t;this.showArrowsStructuralAttachment=!1,t.marker=null,this.structuralAttachmentAssociationsLineSymbol.marker&&(this.showArrowsStructuralAttachment=!0,t.marker=new v({color:this.structuralAttachmentAssociationsLineSymbol.color,placement:"end",style:"arrow"}))})),b(t)])}))}destroy(){this.view=null,this._removeInternalGraphicsLayers()}set includeConnectivityAssociations(t){this._set("includeConnectivityAssociations",t),this._internalGraphicsLayerConnectivity.visible=t}set includeStructuralAttachmentAssociations(t){this._set("includeStructuralAttachmentAssociations",t),this._internalGraphicsLayerStructuralAttachment.visible=t}get state(){return""!==this.loadError?"disabled":this.updatingHandles.updating?"executing":""!==this.executionError?"warning":this._initialValidationsFinished?"ready":"loading"}set utilityNetwork(t){this._get("utilityNetwork")!==t&&this._set("utilityNetwork",t)}set view(t){this._get("view")!==t&&this._set("view",t)}removeAssociations(){this._internalGraphicsLayerConnectivity.removeAll(),this._internalGraphicsLayerStructuralAttachment.removeAll()}async showAssociations(){const{messages:t}=this,{maxAllowableAssociationsExceeded:s,noAssociationsFound:e}=t.info,o=this.utilityNetwork?.spatialReference;if(p()||await y(),!this.view)return;const{spatialReference:r,extent:{xmin:n,ymin:a,xmax:c,ymax:l}}=this.view,w=u(new m({x:n,y:a,spatialReference:r}),o),S=u(new m({x:c,y:l,spatialReference:r}),o),L=new h({xmin:w.x,ymin:w.y,xmax:S.x,ymax:S.y,spatialReference:o});let b="";this.utilityNetwork?.networkServiceUrl&&(b=this.utilityNetwork?.networkServiceUrl);const f=new d({returnConnectivityAssociations:this.includeConnectivityAssociations,returnAttachmentAssociations:this.includeStructuralAttachmentAssociations,extent:L,outSpatialReference:this.utilityNetwork?.spatialReference,maxGeometryCount:this.maxAllowableAssociations,gdbVersion:(this.view?.map.allLayers?.items.find((t=>"feature"===t.type))).gdbVersion,moment:this.moment});this._set("executionError",""),this.removeAssociations(),this.updatingHandles.addPromise(A(b,f).then((t=>{let o=[],r=[];!0!==t?.maxGeometryCountExceeded?0!==t?.associations.length?t&&(o=t?.associations.filter((({associationType:t})=>"connectivity"===t)).map((t=>(this.connectivityAssociationsLineSymbol.marker=null,this.showArrowsConnectivity&&(this.connectivityAssociationsLineSymbol.marker=new v({color:this.connectivityAssociationsLineSymbol.color,placement:"end",style:"arrow"})),new i({geometry:t.geometry.clone(),symbol:this.connectivityAssociationsLineSymbol})))),r=t.associations.filter((({associationType:t})=>"attachment"===t)).map((t=>(this.structuralAttachmentAssociationsLineSymbol.marker=null,this.showArrowsStructuralAttachment&&(this.structuralAttachmentAssociationsLineSymbol.marker=new v({color:this.structuralAttachmentAssociationsLineSymbol.color,placement:"end",style:"arrow"})),new i({geometry:t.geometry.clone(),symbol:this.structuralAttachmentAssociationsLineSymbol})))),o.length>0&&this._internalGraphicsLayerConnectivity.addMany(o),r.length>0&&this._internalGraphicsLayerStructuralAttachment.addMany(r)):this._set("executionError",e):this._set("executionError",s)}),(({message:t})=>{this._set("executionError",t)})))}_createInternalGraphicsLayer(t){return new w({listMode:"hide",internal:!0,title:t})}_removeInternalGraphicsLayers(){this._internalGraphicsLayerConnectivity&&this._internalGraphicsLayerStructuralAttachment&&this.view&&this.view.map&&(this.view.map.remove(this._internalGraphicsLayerConnectivity),this.view.map.remove(this._internalGraphicsLayerStructuralAttachment))}};t([c()],g.prototype,"_initialValidationsFinished",void 0),t([c()],g.prototype,"autoRefreshAssociations",void 0),t([c({type:S,nonNullable:!0})],g.prototype,"connectivityAssociationsLineSymbol",void 0),t([c({readOnly:!0})],g.prototype,"executionError",void 0),t([c({type:Boolean,value:!0})],g.prototype,"includeConnectivityAssociations",null),t([c({type:Boolean,value:!0})],g.prototype,"includeStructuralAttachmentAssociations",null),t([c({readOnly:!0})],g.prototype,"loadError",void 0),t([c()],g.prototype,"loadErrors",void 0),t([c()],g.prototype,"maxAllowableAssociations",void 0),t([c()],g.prototype,"messages",void 0),t([c()],g.prototype,"moment",void 0),t([c()],g.prototype,"showAssociationsEnabled",void 0),t([c()],g.prototype,"showArrowsConnectivity",void 0),t([c()],g.prototype,"showArrowsStructuralAttachment",void 0),t([c({readOnly:!0})],g.prototype,"state",null),t([c({type:S,nonNullable:!0})],g.prototype,"structuralAttachmentAssociationsLineSymbol",void 0),t([c()],g.prototype,"utilityNetwork",null),t([c()],g.prototype,"view",null),g=t([l("esri.widgets.UtilityNetworkAssociations.UtilityNetworkAssociationsViewModel")],g);const k=g;export{k 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.28/esri/copyright.txt for details.
4
+ */
5
+ import{_ as s}from"../../chunks/tslib.es6.js";import t from"../../core/Accessor.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as e}from"../../core/accessorSupport/decorators/subclass.js";import r from"./VisibleElementsSettingsPane.js";let i=class extends t{constructor(){super(...arguments),this.maxAllowableAssociationsSlider=!1,this.connectivityAssociationsSettings=null,this.structuralAttachmentAssociationsSettings=null}};s([o({type:Boolean})],i.prototype,"maxAllowableAssociationsSlider",void 0),s([o({type:r})],i.prototype,"connectivityAssociationsSettings",void 0),s([o({type:r})],i.prototype,"structuralAttachmentAssociationsSettings",void 0),i=s([e("esri.widgets.UtilityNetworkAssociations.VisibleElements")],i);const c=i;export{c 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.28/esri/copyright.txt for details.
4
+ */
5
+ import{_ as o}from"../../chunks/tslib.es6.js";import e from"../../core/Accessor.js";import{property as t}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";let s=class extends e{constructor(){super(...arguments),this.arrowsToggle=!1,this.capSelect=!1,this.colorPicker=!0,this.stylePicker=!0,this.widthInput=!0}};o([t({type:Boolean})],s.prototype,"arrowsToggle",void 0),o([t({type:Boolean})],s.prototype,"capSelect",void 0),o([t({type:Boolean})],s.prototype,"colorPicker",void 0),o([t({type:Boolean})],s.prototype,"stylePicker",void 0),o([t({type:Boolean})],s.prototype,"widthInput",void 0),s=o([r("esri.widgets.UtilityNetworkAssociations.VisibleElementsSettingsPane")],s);const p=s;export{p as default};