@arcgis/core 6.0.0-next.6 → 6.0.0-next.8

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 (257) hide show
  1. package/arcade/functions/knowledgegraph.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/{f09c9d9a554c33a753b4.js → 02253bdffbd580af22d8.js} +1 -1
  4. package/assets/esri/core/workers/chunks/06ab24a083c3229228dd.js +1 -0
  5. package/assets/esri/core/workers/chunks/09a63cc1987f8636c5b0.js +1 -0
  6. package/assets/esri/core/workers/chunks/{8ba32d3a0df4a206ef1c.js → 15cc2c295682f48030f9.js} +1 -1
  7. package/assets/esri/core/workers/chunks/17b76e0d401c7e396d10.js +1 -0
  8. package/assets/esri/core/workers/chunks/{c18189710d6198516175.js → 19b9d393046a780e6c3f.js} +1 -1
  9. package/assets/esri/core/workers/chunks/1b35ec54968fbeec17ce.js +1 -0
  10. package/assets/esri/core/workers/chunks/1c0c5cb13c2590aae906.js +1 -0
  11. package/assets/esri/core/workers/chunks/1e0d2715d603f48a7e0b.js +1 -0
  12. package/assets/esri/core/workers/chunks/{83589144eeeb08f45557.js → 2aeb5cc32284dd3e4d22.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{9a7fc93cc693fd12b5d8.js → 2b6c74646ff475a6e302.js} +1 -1
  14. package/assets/esri/core/workers/chunks/2d9a1f23ec6ce90723ac.js +1 -0
  15. package/assets/esri/core/workers/chunks/340621182db9e8edbec2.js +1 -0
  16. package/assets/esri/core/workers/chunks/{71f739bb3f7350704af6.js → 384ae10053d35940de73.js} +1 -1
  17. package/assets/esri/core/workers/chunks/3b3e519f15ed52c83f0c.js +1 -0
  18. package/assets/esri/core/workers/chunks/{72019baeba520edb6bb0.js → 3b737dae6efed627406e.js} +1 -1
  19. package/assets/esri/core/workers/chunks/3c0ed15b544df6fb0903.js +1 -0
  20. package/assets/esri/core/workers/chunks/3ffda5bf0b91700dc308.js +1 -0
  21. package/assets/esri/core/workers/chunks/{1317ecdfd0cfa683a493.js → 42323093827adffe56d3.js} +1 -1
  22. package/assets/esri/core/workers/chunks/451d7d456df0f4466563.js +1 -0
  23. package/assets/esri/core/workers/chunks/4a6b92ecbb1f1c55cc43.js +1 -0
  24. package/assets/esri/core/workers/chunks/4e544de61f07ca660236.js +1 -0
  25. package/assets/esri/core/workers/chunks/{67ac6b326bf80fc3d33d.js → 53be85d04cd2da4f391d.js} +1 -1
  26. package/assets/esri/core/workers/chunks/54778dec1598818d93cb.js +1 -0
  27. package/assets/esri/core/workers/chunks/{06e7400f5ebe0719b81c.js → 5a5d80c2519aa3ea8878.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{fb4ff0ac2bc445fec413.js → 5b434e8c98e7119d4a3b.js} +1 -1
  29. package/assets/esri/core/workers/chunks/606ea251075fe81a1206.js +1 -0
  30. package/assets/esri/core/workers/chunks/{3ac9dcbb0571a2580236.js → 62c8c9ad09e0166207fd.js} +1 -1
  31. package/assets/esri/core/workers/chunks/6588725275c75fae0d9c.js +1 -0
  32. package/assets/esri/core/workers/chunks/{ac4cc49104d26c384e98.js → 658b2642ab6880770e4e.js} +1 -1
  33. package/assets/esri/core/workers/chunks/68be3fb88ca61f82fb90.js +1 -0
  34. package/assets/esri/core/workers/chunks/6c9266120d46e8c69dbf.js +1 -0
  35. package/assets/esri/core/workers/chunks/6ebe73f69ae822053b70.js +1 -0
  36. package/assets/esri/core/workers/chunks/6ef647b7769d27529f9c.js +1 -0
  37. package/assets/esri/core/workers/chunks/709e019885822b1f6f3e.js +1 -0
  38. package/assets/esri/core/workers/chunks/70cc2d79653d66e85b58.js +1 -0
  39. package/assets/esri/core/workers/chunks/{cbe6c0f32608cb504695.js → 776ae25a34352d3468bc.js} +1 -1
  40. package/assets/esri/core/workers/chunks/8730e7e6e0296f43f10b.js +1 -0
  41. package/assets/esri/core/workers/chunks/8bea0d706ede6f84f8aa.js +1 -0
  42. package/assets/esri/core/workers/chunks/900181f68449d8f82eeb.js +1 -0
  43. package/assets/esri/core/workers/chunks/939942b00ba380e2957e.js +1 -0
  44. package/assets/esri/core/workers/chunks/{1ef39aef6b33c530cbe4.js → 966d0832a3c1f03668a0.js} +1 -1
  45. package/assets/esri/core/workers/chunks/9a28a66807a1e3557018.js +1 -0
  46. package/assets/esri/core/workers/chunks/{2f9033890c465acff698.js → 9bf48a907f91ea004648.js} +1 -1
  47. package/assets/esri/core/workers/chunks/9c7fa9d324fa0bf64d9c.js +1 -0
  48. package/assets/esri/core/workers/chunks/9ce91a909eccc4dfe388.js +1 -0
  49. package/assets/esri/core/workers/chunks/{1ba1f705b6ce5c8ea702.js → a655ebdb4bf0660615a2.js} +1 -1
  50. package/assets/esri/core/workers/chunks/ad76f7ab2f3e6d5a5b3c.js +1 -0
  51. package/assets/esri/core/workers/chunks/af349c7bc8ef41a0e1bd.js +1 -0
  52. package/assets/esri/core/workers/chunks/{250d3be6d3849d71fed8.js → c29c474c4b1049352d3e.js} +1 -1
  53. package/assets/esri/core/workers/chunks/c8ba0673d1b87216e619.js +1 -0
  54. package/assets/esri/core/workers/chunks/{4d3f97a48046021713a6.js → ceb112fe7aef354f8051.js} +1 -1
  55. package/assets/esri/core/workers/chunks/d6ad4390df576198e45b.js +1 -0
  56. package/assets/esri/core/workers/chunks/ddf0671976648f621269.js +1 -0
  57. package/assets/esri/core/workers/chunks/ded8b64a46992c3ae693.js +1 -0
  58. package/assets/esri/core/workers/chunks/{0b36abcbf03037b4073d.js → e1af43e2a8f2ef1059e3.js} +1 -1
  59. package/assets/esri/core/workers/chunks/eaf6d587477399a83088.js +1 -0
  60. package/assets/esri/core/workers/chunks/ecaac39dde7ec4213264.js +1 -0
  61. package/assets/esri/core/workers/chunks/f122c18af10e56f9ec2b.js +1 -0
  62. package/assets/esri/core/workers/chunks/f31b424a3667686af10c.js +1 -0
  63. package/assets/esri/core/workers/chunks/{711cfb84659cb4437679.js → f528ac5c648ca6a98582.js} +1 -1
  64. package/assets/esri/core/workers/chunks/f92364afaefbac7e8f77.js +1 -0
  65. package/assets/esri/core/workers/chunks/fb444954be74c1962ced.js +1 -0
  66. package/assets/esri/core/workers/chunks/fecaf0bc28aeea4d15db.js +1 -0
  67. package/assets/esri/themes/base/widgets/_FeatureFormUtilityNetworkAssociationSettings.scss +1 -1
  68. package/assets/esri/themes/base/widgets/_Features.scss +1 -1
  69. package/assets/esri/themes/base/widgets/_OrientedImageryViewer.scss +5 -9
  70. package/assets/esri/themes/base/widgets/_SelectionToolbar.scss +2 -4
  71. package/assets/esri/themes/base/widgets/_Tooltip.scss +1 -1
  72. package/assets/esri/themes/dark/main.css +1 -1
  73. package/assets/esri/themes/light/main.css +1 -1
  74. package/assets/esri/themes/light/view.css +1 -1
  75. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.en.json +1 -1
  76. package/chunks/GlobalIllumination.glsl.js +4 -2
  77. package/chunks/GlobalIlluminationBlur.glsl.js +3 -5
  78. package/chunks/GlobalIlluminationUpscale.glsl.js +1 -1
  79. package/config.js +1 -1
  80. package/core/colorUtils.js +1 -1
  81. package/core/has.js +1 -1
  82. package/core/workers/workerFactory.js +1 -1
  83. package/form/elements/inputs/DynamicChoiceInput.d.ts +35 -5
  84. package/geometry/projectionUtils.js +1 -1
  85. package/geometry/support/scaleUtils.js +1 -1
  86. package/kernel.js +1 -1
  87. package/layers/ParquetLayer.d.ts +3 -2
  88. package/layers/ParquetLayer.js +1 -1
  89. package/layers/graphics/data/FeatureStore.js +1 -1
  90. package/layers/graphics/data/QueryEngineResult.js +1 -1
  91. package/layers/graphics/data/geometryUtils.js +1 -1
  92. package/layers/graphics/data/projectionSupport.js +1 -1
  93. package/layers/knowledgeGraph/layerUtils.js +1 -1
  94. package/layers/knowledgeGraph/nodeMovementUtils.js +1 -1
  95. package/layers/mixins/ScaleRangeLayer.js +1 -1
  96. package/layers/mixins/SublayersOwner.js +1 -1
  97. package/layers/raster/datasets/TIFFRaster.js +1 -1
  98. package/layers/support/Sublayer.js +1 -1
  99. package/layers/support/SubtypeSublayer.js +1 -1
  100. package/package.json +2 -2
  101. package/popup/FeaturesModel.d.ts +26 -5
  102. package/popup/FeaturesModel.js +1 -1
  103. package/rest/support/printTaskUtils.js +1 -1
  104. package/symbols/cim/CIMSymbolHelper.js +1 -1
  105. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/hittestUtils.js +1 -1
  106. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
  107. package/views/2d/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiles2D.js +1 -1
  108. package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
  109. package/views/2d/layers/LayerView2D.js +1 -1
  110. package/views/2d/layers/features/FeatureSourceEventLog.js +1 -1
  111. package/views/2d/layers/features/layerAdapters/ParquetLayerAdapter.js +1 -1
  112. package/views/2d/layers/features/sources/FeatureSource.js +1 -1
  113. package/views/2d/layers/features/sources/FeatureSourceQueryInfo.js +1 -1
  114. package/views/2d/layers/features/sources/strategies/AFeatureTileLoadStrategy.js +1 -1
  115. package/views/2d/layers/features/sources/strategies/ParquetTileLoadStrategy.js +1 -1
  116. package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
  117. package/views/2d/layers/features/support/FeatureSetReaderIndirect.js +1 -1
  118. package/views/2d/layers/features/support/FeatureSetReaderJSON.js +1 -1
  119. package/views/2d/layers/features/support/FeatureSetReaderPBF.js +1 -1
  120. package/views/2d/layers/features/support/FeatureSetReaderPBFHeader.js +1 -1
  121. package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
  122. package/views/3d/analysis/Viewshed/ViewshedPlacementController.js +1 -1
  123. package/views/3d/analysis/Viewshed/types.d.ts +3 -1
  124. package/views/3d/environment/Environment.d.ts +2 -2
  125. package/views/3d/environment/Environment.js +1 -1
  126. package/views/3d/environment/EnvironmentView.js +2 -0
  127. package/views/3d/layers/BuildingComponentSublayerView3D.js +1 -1
  128. package/views/3d/layers/BuildingSceneLayerView3D.js +1 -1
  129. package/views/3d/layers/DynamicLayerView3D.js +1 -1
  130. package/views/3d/layers/FeatureLikeLayerViewBase3D.js +1 -1
  131. package/views/3d/layers/FlowSubView3D.js +1 -1
  132. package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
  133. package/views/3d/layers/GraphicsLayerView3D.js +1 -1
  134. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  135. package/views/3d/layers/IntegratedMeshLayerView3D.js +1 -1
  136. package/views/3d/layers/MediaLayerView3D.js +1 -1
  137. package/views/3d/layers/PointCloudLayerView3D.js +1 -1
  138. package/views/3d/layers/RouteLayerView3D.js +1 -1
  139. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  140. package/views/3d/layers/SceneLayerView3D.js +1 -1
  141. package/views/3d/layers/TiledLayerView3D.js +1 -1
  142. package/views/3d/layers/VoxelLayerView3D.js +1 -1
  143. package/views/3d/layers/graphics/Graphics3DScaleVisibility.js +1 -1
  144. package/views/3d/layers/graphics/Labeler.js +1 -1
  145. package/views/3d/layers/support/FeatureTile.js +1 -1
  146. package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
  147. package/views/3d/layers/support/ImageHighlightHelper3D.js +1 -1
  148. package/views/3d/layers/support/SampledGeometryMaxDistanceRatio.js +1 -1
  149. package/views/3d/support/elevationUpdateUtils.js +1 -1
  150. package/views/3d/support/popupHitTest.js +1 -1
  151. package/views/3d/terrain/TerrainRenderer.js +1 -1
  152. package/views/3d/webgl-engine/effects/WeatherFader.js +1 -1
  153. package/views/3d/webgl-engine/effects/clouds/CloudsComposition.js +1 -1
  154. package/views/3d/webgl-engine/effects/fog/Fog.js +1 -1
  155. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationColorQuantization.glsl.js +2 -2
  156. package/views/3d/webgl-engine/lib/EmissionComposite.js +1 -1
  157. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  158. package/views/SceneView.js +1 -1
  159. package/views/draw/Draw.d.ts +1 -1
  160. package/views/draw/support/InteractiveHandle.js +1 -1
  161. package/views/interactive/options/SnappingOptions.d.ts +1 -0
  162. package/views/interactive/options/TooltipOptions.d.ts +1 -0
  163. package/views/interactive/options/ViewOptions.d.ts +1 -0
  164. package/views/interactive/snapping/FeatureSnappingSourceInfo.js +1 -1
  165. package/views/interactive/support/Units.d.ts +1 -0
  166. package/views/interactive/tooltip/components/DrawHeaderActions.js +1 -1
  167. package/views/interactive/tooltip/components/ElevationModeSelect.js +1 -1
  168. package/views/layers/LayerView.js +1 -1
  169. package/views/layers/LineOfSightLayerView.d.ts +3 -4
  170. package/views/layers/ViewshedLayerView.d.ts +5 -6
  171. package/views/support/layerViewUtils.js +1 -1
  172. package/views/support/projectionUtils.js +1 -1
  173. package/widgets/BasemapLayerList.js +1 -1
  174. package/widgets/BatchAttributeForm.js +1 -1
  175. package/widgets/DirectionalPad.js +1 -1
  176. package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
  177. package/widgets/Editor.d.ts +10 -0
  178. package/widgets/Expand.js +1 -1
  179. package/widgets/FeatureForm.d.ts +2 -2
  180. package/widgets/FeatureForm.js +1 -1
  181. package/widgets/FeatureTable/FieldColumn.js +1 -1
  182. package/widgets/FeatureTable.js +1 -1
  183. package/widgets/Features/FeaturesDrillIn.js +1 -1
  184. package/widgets/Features.js +1 -1
  185. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  186. package/widgets/OrientedImageryViewer/adapters/view/SceneViewAdapter.js +1 -1
  187. package/widgets/OrientedImageryViewer/components/SequentialNavigationUI.js +1 -1
  188. package/widgets/OrientedImageryViewer/components/SketchTools.js +1 -1
  189. package/widgets/PanoramicVideoViewer.js +1 -1
  190. package/widgets/Print.js +1 -1
  191. package/widgets/ScaleRangeSlider.js +1 -1
  192. package/widgets/Search/SearchResultRenderer.js +1 -1
  193. package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
  194. package/widgets/Sketch/SketchViewModel.d.ts +1 -1
  195. package/widgets/Sketch/support/ResponsiveToolbar/ResponsiveToolbar.js +1 -1
  196. package/widgets/Sketch.d.ts +1 -1
  197. package/widgets/Track/TrackViewModel.d.ts +1 -1
  198. package/widgets/UtilityNetworkAssociations.js +1 -1
  199. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceFeature.js +1 -1
  200. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceFeaturesDrillIn.js +1 -1
  201. package/widgets/UtilityNetworkTrace/types.d.ts +2 -2
  202. package/widgets/UtilityNetworkTrace.js +1 -1
  203. package/widgets/UtilityNetworkValidateTopology.js +1 -1
  204. package/widgets/ValuePicker.js +1 -1
  205. package/widgets/VideoPlayer/components/PlayerActionsGroup.js +1 -1
  206. package/widgets/VideoPlayer/components/PlayerControlsGroup.js +1 -1
  207. package/widgets/support/GridControls.js +1 -1
  208. package/widgets/support/PluginSettingsControls.js +1 -1
  209. package/widgets/support/SelectionToolbar.js +1 -1
  210. package/widgets/support/SnappingControls.js +1 -1
  211. package/widgets/support/componentsUtils.js +1 -1
  212. package/assets/esri/core/workers/chunks/00a600c71ceebe7bfeee.js +0 -1
  213. package/assets/esri/core/workers/chunks/00d24415bdeb0adae3df.js +0 -1
  214. package/assets/esri/core/workers/chunks/0193df3f9fb23633da87.js +0 -1
  215. package/assets/esri/core/workers/chunks/02d4f91652a79d2b637e.js +0 -1
  216. package/assets/esri/core/workers/chunks/07aa6d36f1006b6ab7ff.js +0 -1
  217. package/assets/esri/core/workers/chunks/107b025dc5b09465a78f.js +0 -1
  218. package/assets/esri/core/workers/chunks/1f43e06dcfe56229bb0f.js +0 -1
  219. package/assets/esri/core/workers/chunks/25d6c674b1c4829f040f.js +0 -1
  220. package/assets/esri/core/workers/chunks/25e6013e2c095629b236.js +0 -1
  221. package/assets/esri/core/workers/chunks/2a570ce6b99dac6ee996.js +0 -1
  222. package/assets/esri/core/workers/chunks/2c90f7a6432cd716db8b.js +0 -1
  223. package/assets/esri/core/workers/chunks/2e6a2f4d686b71249c0e.js +0 -1
  224. package/assets/esri/core/workers/chunks/303fde8f3459dde16555.js +0 -1
  225. package/assets/esri/core/workers/chunks/350540770781b281c39a.js +0 -1
  226. package/assets/esri/core/workers/chunks/3880d2c7fb14955d7f93.js +0 -1
  227. package/assets/esri/core/workers/chunks/3b017b718ea2d4ed498f.js +0 -1
  228. package/assets/esri/core/workers/chunks/43fc42405167a5537039.js +0 -1
  229. package/assets/esri/core/workers/chunks/4d82db661365daa513a6.js +0 -1
  230. package/assets/esri/core/workers/chunks/56851011276de0b3e318.js +0 -1
  231. package/assets/esri/core/workers/chunks/5f3ab77a79c408423fde.js +0 -1
  232. package/assets/esri/core/workers/chunks/633a9051580c5302d2f7.js +0 -1
  233. package/assets/esri/core/workers/chunks/6469c0d18d3663e7da4b.js +0 -1
  234. package/assets/esri/core/workers/chunks/65654e481cce9ae40e54.js +0 -1
  235. package/assets/esri/core/workers/chunks/669e39c3437d7273f0c7.js +0 -1
  236. package/assets/esri/core/workers/chunks/798a63653f82c0e842c5.js +0 -1
  237. package/assets/esri/core/workers/chunks/84fcbf7a1d04f01685d1.js +0 -1
  238. package/assets/esri/core/workers/chunks/8b54589f173259c1ba55.js +0 -1
  239. package/assets/esri/core/workers/chunks/8e511079918e2fd9261f.js +0 -1
  240. package/assets/esri/core/workers/chunks/95b82cbbe355266c65d7.js +0 -1
  241. package/assets/esri/core/workers/chunks/9673a9efec86040b8c13.js +0 -1
  242. package/assets/esri/core/workers/chunks/a010d2e4e34eb7bc1fec.js +0 -1
  243. package/assets/esri/core/workers/chunks/b05a41a60e30935644be.js +0 -1
  244. package/assets/esri/core/workers/chunks/bff767ec5bb4c0d6b324.js +0 -1
  245. package/assets/esri/core/workers/chunks/c906f984b2b6e7578c06.js +0 -1
  246. package/assets/esri/core/workers/chunks/d21257d2e2a37266c0f7.js +0 -1
  247. package/assets/esri/core/workers/chunks/d270cc9807161033686e.js +0 -1
  248. package/assets/esri/core/workers/chunks/de02a6a1f4810f99e9bb.js +0 -1
  249. package/assets/esri/core/workers/chunks/e5943f3a4bbc12c06c4d.js +0 -1
  250. package/assets/esri/core/workers/chunks/ec9a2425b4a498054a19.js +0 -1
  251. package/assets/esri/core/workers/chunks/f0a68d2900d24f56afa0.js +0 -1
  252. package/assets/esri/core/workers/chunks/f0aaa646b17ffdbdcefa.js +0 -1
  253. package/assets/esri/core/workers/chunks/f46a0d7cf588ba1b4157.js +0 -1
  254. package/assets/esri/core/workers/chunks/f762f70e7d39634ce797.js +0 -1
  255. package/assets/esri/core/workers/chunks/fccbb902fe08448f91de.js +0 -1
  256. package/assets/esri/core/workers/chunks/fd0254c6fc6c03ec11ba.js +0 -1
  257. package/views/3d/environment/EnvironmentManager.js +0 -2
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{substitute as t,formatNumber as n}from"../intl.js";import{isSome as r}from"../core/arrayUtils.js";import{deprecateWidget as i}from"../core/deprecate.js";import a from"../core/Logger.js";import o from"../core/ReactiveMap.js";import{watch as s,whenOnce as c,initial as l}from"../core/reactiveUtils.js";import{property as u,subclass as d}from"../core/accessorSupport/decorators.js";import{isIntegerField as f}from"../layers/support/fieldUtils.js";import{isSubtypeGroupLayer as p,getSubtypesFromLayer as m}from"../layers/support/layerUtils.js";import{isRelatableFeatureSupportedLayer as h}from"../popup/support/featureUtils.js";import{isString as g}from"../support/guards.js";import _ from"./Widget.js";import{Prompt as v}from"./Editor/components/Prompt.js";import{css as y}from"./FeatureForm/css.js";import{isUtilityNetworkAssociationInput as b,isGroupInput as x,isFieldInput as S,isRelationshipInput as C,isTextElementInput as w,flattenInputs as T,isInputInGroupInput as E,isFieldElementWithInputType as D,getErrorMessageForFieldInput as O,getIconForFeature as k,isNumberFieldInput as A,isInputInThisGroupInput as j,subtypeChangeShouldPrompt as M}from"./FeatureForm/featureFormUtils.js";import N from"./FeatureForm/FeatureFormViewModel.js";import P from"./FeatureForm/VisibleElements.js";import{loadCalciteComponents as F}from"./support/componentsUtils.js";import{getLabelForDateFieldValue as I,getIntlOptionsForField as L,numberingSystem as R,prepareISOFieldValueForDateComponents as z,prepareUnixFieldValueForDateComponents as B,normalizeTimeOnlyString as V,getISOFieldValueFromDateComponents as H,getUnixFieldValueFromDateComponents as U}from"./support/dateUtils.js";import{globalCss as W}from"./support/globalCss.js";import{Heading as G,incrementHeadingLevel as K}from"./support/Heading.js";import{messageBundle as q,vmEvent as J,tsx as Y}from"./support/widget.js";import{setFocus as X}from"./support/widgetUtils.js";const Z=`data-field-name`;let Q=class extends _{constructor(e,t){super(e,t),this._associationsWidgetsMap=new o,this._attemptFocusOnNextRender=!1,this._dateComponentMap=new Map,this._inputsWithChanges=new Set,this._focusedFieldName=null,this._pendingSubtypeChoice=null,this._listObserverNode=null,this._listObserver=new IntersectionObserver(e=>{e.length&&e[0].isIntersecting&&this._incrementRelatedRecordPage()},{root:window.document}),this._prompt=null,this._featureFormUNAssociationList=null,this.groupDisplay=`all`,this.headingLevel=2,this.messages=null,this.messagesCommon=null,this.messagesFeature=null,this.messagesTemplates=null,this.viewModel=new N,this.visibleElements=new P,this._onShowAllRelatedRecordsClick=e=>{let{feature:t,callbacks:n}=this;t&&n?.showAllRelatedRecords&&n.showAllRelatedRecords({parentFeature:t,relationshipId:e})},this._onAddRelatedRecordsClick=(e,t,n)=>{let{feature:r,callbacks:i}=this,a=n;if(r&&i?.addRelatedRecord){if(p(n)&&e.activeCategory){let t=e.activeCategory.value,r=n.findSublayerForSubtypeCode(t);r&&h(r)&&(a=r)}i.addRelatedRecord({parentFeature:r,relatedLayer:a,relationshipId:t})}},e?.suppressDeprecationWarning||(this.announceDeprecation=()=>{i(a.getLogger(this),`Feature Form`,`arcgis-feature-form`,{version:`5.0`})}),this._onFormKeyDown=this._onFormKeyDown.bind(this),this._onFormSubmit=this._onFormSubmit.bind(this),this._onGroupToggle=this._onGroupToggle.bind(this),this._onComponentBlur=this._onComponentBlur.bind(this),this._onComponentFocus=this._onComponentFocus.bind(this),this._onComponentKeyDown=this._onComponentKeyDown.bind(this),this._afterComponentCreate=this._afterComponentCreate.bind(this),this._afterComponentCreateOrUpdate=this._afterComponentCreateOrUpdate.bind(this),this._afterDateComponentCreate=this._afterDateComponentCreate.bind(this),this._afterDateComponentCreateOrUpdate=this._afterDateComponentCreateOrUpdate.bind(this),this._afterRadioGroupCreateOrUpdate=this._afterRadioGroupCreateOrUpdate.bind(this),this._afterGroupCreate=this._afterGroupCreate.bind(this)}normalizeCtorArgs(e={}){let{suppressDeprecationWarning:t,...n}=e;return n}initialize(){this.addHandles([s(()=>this.feature,()=>{this._inputsWithChanges.clear(),this._dateComponentMap.clear(),c(()=>!this.viewModel.updating).then(()=>{let e=this._getFocusableInput(`forward`);this._syncGroupInputStates(),this._focusedFieldName=e?.name||null,this._attemptFocusOnNextRender=!0})}),s(()=>[this._featureFormUNAssociationList,this.visibleElements.associationDetails],([e,t])=>{e&&(e.visibleElements.associationDetails=t)},l),s(()=>this.groupDisplay,()=>this._syncGroupInputStates()),this.on(`submit`,e=>{if(e.invalid.length>0){let[t]=e.invalid;e.invalid.forEach(e=>this._inputsWithChanges.add(e)),this._focusedFieldName=t,this._attemptFocusOnNextRender=!0,this.scheduleRender()}}),s(()=>[this.viewModel.activeRelationshipInput,this._listObserverNode],()=>this._onObserverChange()),s(()=>this.viewModel.activeAssociationInput,e=>{e&&this._featureFormUNAssociationList&&(this._featureFormUNAssociationList.associationInput=e,this._featureFormUNAssociationList.viewModel=e.viewModel)}),s(()=>this.viewModel.inputs.filter(b),async e=>{this._featureFormUNAssociationList||await this._setUpUtilityNetworkAssociationList();for(let t of e)this._associationsWidgetsMap.has(t)||this._associationsWidgetsMap.set(t,await this._makeAssociationsWidget(t))})])}loadDependencies(){return F({block:()=>import(`@esri/calcite-components/dist/components/calcite-block`),button:()=>import(`@esri/calcite-components/dist/components/calcite-button`),chip:()=>import(`@esri/calcite-components/dist/components/calcite-chip`),combobox:()=>import(`@esri/calcite-components/dist/components/calcite-combobox`),"combobox-item":()=>import(`@esri/calcite-components/dist/components/calcite-combobox-item`),"combobox-item-group":()=>import(`@esri/calcite-components/dist/components/calcite-combobox-item-group`),icon:()=>import(`@esri/calcite-components/dist/components/calcite-icon`),input:()=>import(`@esri/calcite-components/dist/components/calcite-input`),"input-date-picker":()=>import(`@esri/calcite-components/dist/components/calcite-input-date-picker`),"input-message":()=>import(`@esri/calcite-components/dist/components/calcite-input-message`),"input-number":()=>import(`@esri/calcite-components/dist/components/calcite-input-number`),"input-time-picker":()=>import(`@esri/calcite-components/dist/components/calcite-input-time-picker`),"input-time-zone":()=>import(`@esri/calcite-components/dist/components/calcite-input-time-zone`),label:()=>import(`@esri/calcite-components/dist/components/calcite-label`),list:()=>import(`@esri/calcite-components/dist/components/calcite-list`),"list-item":()=>import(`@esri/calcite-components/dist/components/calcite-list-item`),loader:()=>import(`@esri/calcite-components/dist/components/calcite-loader`),notice:()=>import(`@esri/calcite-components/dist/components/calcite-notice`),"radio-button":()=>import(`@esri/calcite-components/dist/components/calcite-radio-button`),"radio-button-group":()=>import(`@esri/calcite-components/dist/components/calcite-radio-button-group`),switch:()=>import(`@esri/calcite-components/dist/components/calcite-switch`),"text-area":()=>import(`@esri/calcite-components/dist/components/calcite-text-area`)})}destroy(){this._listObserverNode&&this._listObserver.unobserve(this._listObserverNode)}get _relatedRecordsEnabled(){let{callbacks:e}=this;return!!(e&&(e.addRelatedRecord||e.editRelatedRecord||e.showAllRelatedRecords))}get _utilityNetworkAssociationsEnabled(){let{callbacks:e}=this;return!!(e?.viewAssociatedLayers&&e.viewAssociatedFeatures)}get _subtypes(){return m(this.layer)}get associationId(){return this.viewModel.associationId}set associationId(e){this.viewModel.associationId=e}get associatedLayer(){return this.viewModel.associatedLayer}set associatedLayer(e){this.viewModel.associatedLayer=e}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 icon(){return`form-field`}set icon(e){this._overrideIfSome(`icon`,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 callbacks(){return this.viewModel.callbacks}set callbacks(e){this.viewModel.callbacks=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 timeZone(){return this.viewModel.timeZone}set timeZone(e){this.viewModel.timeZone=e}get showPrompt(){return e=>{this._prompt?.cancel?.(),this._prompt=e}}set showPrompt(e){this._overrideIfSome(`showPrompt`,e)}get clearPrompt(){return()=>this._prompt=null}set clearPrompt(e){this._overrideIfSome(`clearPrompt`,e)}getValues(){return this.viewModel.getValues()}submit(){return this.viewModel.submit()}render(){let{state:e}=this.viewModel;return Y(`div`,{class:this.classes(y.base,W.widget,W.panel)},e===`ready`?this._renderForm():null)}_renderForm(){return Y(`div`,null,Y(`form`,{class:y.form,inert:!!this._prompt,novalidate:!0,onkeydown:this._onFormKeyDown,onsubmit:this._onFormSubmit},this._renderReadOnlyNotice(),this._renderHeader(),this._renderContent()),this._prompt?Y(v,{...this._prompt,headingLevel:this.headingLevel}):void 0)}_renderReadOnlyNotice(){let{disabled:e,messages:t}=this;if(e&&this.visibleElements.readOnlyNotice)return Y(`calcite-notice`,{class:y.disabledNotice,"data-testid":`read-only-notice`,icon:`read-only-non-editable`,kind:`brand`,open:!0,scale:`s`,width:`full`},Y(`div`,{slot:`message`},t.disabledForm))}_renderHeader(){let e=this.viewModel,{formTitle:t,formDescription:n}=e;if(!e.formHeaderVisible)return;let r=t!=null&&Y(G,{key:`title`,level:this.headingLevel},t),i=n!=null&&Y(`p`,{class:y.description,key:`description`},n);return Y(`div`,{class:y.formHeader},r,i)}_renderContent(){let{viewModel:e}=this;return e.activeRelationshipInput?this._renderRelationshipInput(e.activeRelationshipInput):e.activeAssociationInput?this._renderFeatureFormUtilityNetworkAssociationList():e.inputs.filter(r).filter(e=>e.visible).map(e=>this._renderInput(e))}_renderInput(e){if(x(e))return this._renderGroup(e);if(S(e))return this._renderLabeledField(e);if(C(e))return this._renderRelationshipInput(e);if(w(e))return this._renderTextElementInput(e);if(b(e))return this._renderUtilityNetworkAssociationsElementInput(e)}_renderFeatureFormUtilityNetworkAssociationList(){return this._featureFormUNAssociationList?.render()}_selectAssociatedLayer(e){let{feature:t,callbacks:n}=this;t&&n?.viewAssociatedFeatures&&n.viewAssociatedFeatures({associatedLayer:e.layer})}async _selectAssociatedFeature(e){let{feature:t,callbacks:n}=this;t&&n?.selectAssociatedFeature&&await n.selectAssociatedFeature({parentFeature:t,...e})}_onAddAssociation(e){let{feature:t,callbacks:n}=this;t&&n?.addAssociation&&n.addAssociation(e)}async _setUpUtilityNetworkAssociationList(){if(!this._featureFormUNAssociationList){let e=(await import(`./FeatureForm/FeatureFormUtilityNetworkAssociations/FeatureFormUtilityNetworkAssociationList.js`)).default;this._featureFormUNAssociationList=new e({onSelectLayer:this._selectAssociatedLayer.bind(this),onSelectFeature:this._selectAssociatedFeature.bind(this),onAddAssociation:this._onAddAssociation.bind(this)})}}async _makeAssociationsWidget(e){let t=(await import(`./Feature/FeatureUtilityNetworkAssociations.js`)).default;return new t({onSelectAssociationType:({viewModel:t,listType:n})=>{t.activeAssociationType=n;let{feature:r,callbacks:i}=this;r&&i?.viewAssociatedLayers&&i.viewAssociatedLayers({associationId:e.uid})},viewModel:e.associationsViewModel})}_renderUtilityNetworkAssociationsElementInput(e){if(this._utilityNetworkAssociationsEnabled)return this._associationsWidgetsMap.get(e)?.render()}_renderDescriptionOrEmpty(e,t){return e==null?null:Y(`div`,{class:this.classes(y.description),id:t},e)}_renderGroup(e){let{formTemplate:t,headingLevel:n}=this,{description:r,id:i,inputs:a,label:o,open:s}=e,c=a.filter(e=>e.visible),l=this.viewModel.findField(this._focusedFieldName)?.group===e,u=this.groupDisplay===`sequential`;return Y(`calcite-block`,{afterCreate:this._afterGroupCreate,class:this.classes(y.group,u?y.groupSequential:null,l?y.groupActive:null),collapsible:!0,"data-group":e,description:r||void 0,expanded:s,heading:o??``,headingLevel:t?.title?K(n):n,id:i,key:i,onCalciteBlockToggle:({currentTarget:t})=>this._onGroupToggle(t,e)},c.map(e=>this._renderInput(e)))}_getFocusableInput(e,t){let n=T(this.viewModel.inputs);e===`backward`&&n.reverse();let r;if(!t)r=0;else if(x(t)){let e=t.inputs.find(e=>e.visible);r=e?n.indexOf(e):0}else{let i;if(E(t)&&!t.group.open){let n=t.group.inputs.filter(S);i=e===`forward`?n[n.length-1]:n[0]}else i=t;r=n.indexOf(i)+1}for(let e=r;e<n.length;e++){let t=n[e];if(t.visible&&S(t)){if(this.disabled&&t.inputType&&(t.inputType===`switch`||t.inputType===`radio-buttons`))continue;return t}}return null}_renderLabeledField(e){let{dataType:n,feature:r,label:i,layer:a,required:o}=e,s={"aria-label":o?t(this.messages.requiredFieldLabel,{name:i}):i,class:y.label,key:`${a.id}-${r.uid}-${e.name}`},c=[Y(`div`,{class:y.labelTextContent,key:`labelTextContainer`},i,o?Y(`span`,{"aria-hidden":`true`,title:this.messagesCommon.required},`*`):void 0),n===`unsupported`?this._renderReadOnlyComponent(e):this._renderFieldInput(e),this._renderAuxiliaryText(e)];return Y(`calcite-label`,{...s},c)}_renderFieldInput(e){let{dataType:t,domain:n,inputType:r,name:i}=e,a=this.getCommonInputProps(e);if(n?.type===`coded-value`){let t=this.viewModel.getFieldValueOptionsForField(i,this.messages.empty);return r===`switch`&&!e.hasInvalidSwitchValue?this._renderSwitchComponent(e,a):r===`radio-buttons`?this._renderRadioButtonComponents(e,t.flat(),a):this._renderComboBoxComponent(e,t,a)}return r===`datetime-picker`||t===`date`?this._renderDateComponents(e,a):t===`number`?this._renderNumberComponent(e,a):this._renderStringComponent(e,a)}_renderStringComponent(e,t){return e.inputType===`text-area`?t.readOnly?Y(`calcite-text-area`,{...t,onCalciteTextAreaInput:e=>this._saveValueFromComponent(e.currentTarget)}):Y(`calcite-text-area`,{...t,resize:`vertical`,onCalciteTextAreaInput:e=>this._saveValueFromComponent(e.currentTarget)}):Y(`calcite-input`,{...t,loading:e.updating,type:`text`,onCalciteInputInput:e=>this._saveValueFromComponent(e.currentTarget)})}_renderNumberComponent(e,t){let n=f(e.field),r=n&&t.value!==``?Math.round(parseFloat(t.value)).toString():t.value;return Y(`calcite-input-number`,{...t,integer:n,loading:e.updating,step:n?1:`any`,type:`number`,value:r,onCalciteInputNumberInput:e=>this._saveValueFromComponent(e.currentTarget)})}_renderDateComponents(e,t){let{field:n}=e;switch(n.type){case`date`:return this._renderDateFieldComponents(e,t);case`date-only`:return this._renderDateOnlyFieldComponent(e,t);case`time-only`:return this._renderTimeOnlyFieldComponent(e,t);case`timestamp-offset`:return this._renderTimestampOffsetFieldComponents(e,t);default:return this._renderReadOnlyComponent(e,I(n,t.value,{timeZone:this.timeZone,...L(n)}))}}_renderDateOnlyFieldComponent(e,t){let{range:n,valid:r,value:i}=e,{class:a,key:o,readOnly:s}=t,{rawMax:c,rawMin:l}=n;return Y(`calcite-input-date-picker`,{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!r,class:a,"data-date-part":`date`,"data-field-name":t[Z],key:`${o}-date-input`,max:g(c)?c:void 0,min:g(l)?l:void 0,numberingSystem:R,overlayPositioning:`fixed`,readOnly:s,topLayerDisabled:this.topLayerDisabled,value:i==null?void 0:`${i}`,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},onCalciteInputDatePickerChange:e=>this._saveValueFromDateComponent(e.currentTarget),onfocus:this._onComponentFocus})}_renderTimeOnlyFieldComponent(e,t){let{valid:n,value:r}=e,{class:i,key:a,readOnly:o}=t;return Y(`calcite-input-time-picker`,{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!n,class:i,"data-date-part":`time`,"data-field-name":t[Z],key:`${a}-time-input`,numberingSystem:R,overlayPositioning:`fixed`,readOnly:o,step:e.timeStep,value:r==null?void 0:`${r}`,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},onCalciteInputTimePickerChange:e=>this._saveValueFromDateComponent(e.currentTarget),onfocus:this._onComponentFocus})}_renderTimestampOffsetFieldComponents(e,t){let{name:n,range:r,timeZone:i,valid:a,value:o}=e,{class:s,key:c,readOnly:l}=t,{rawMax:u,rawMin:d}=r,f={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!a,numberingSystem:R,overlayPositioning:`fixed`,readOnly:l,[Z]:n,onfocus:this._onComponentFocus},p=z(u,i),m=z(d,i),h=z(o,i);return Y(`div`,{class:y.dateInputContainer,key:`${c}-date-time-container`},Y(`calcite-input-date-picker`,{...f,class:s,"data-date-part":`date`,key:`${c}-date-input`,max:p?.date??void 0,min:m?.date??void 0,topLayerDisabled:this.topLayerDisabled,value:h.date??void 0,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},onCalciteInputDatePickerChange:e=>this._saveValueFromDateComponent(e.currentTarget)}),Y(`calcite-input-time-picker`,{...f,class:s,"data-date-part":`time`,key:`${c}-time-input`,step:e.timeStep,value:h.time??void 0,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},onCalciteInputTimePickerChange:e=>this._saveValueFromDateComponent(e.currentTarget)}),e.includeTimeOffset?Y(`calcite-input-time-zone`,{...f,class:s,"data-date-part":`timeZone`,disabled:l,key:`${c}-timezone-input`,value:h.timeZoneOffset??`0`,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},onCalciteInputTimeZoneChange:e=>this._saveValueFromDateComponent(e.currentTarget)}):null)}_renderDateFieldComponents(e,t){let{includeTime:n,name:r,valid:i,value:a}=e,{class:o,key:s,max:c,min:l,readOnly:u}=t,{timeZone:d}=this,f={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!i,numberingSystem:R,overlayPositioning:`fixed`,readOnly:u,[Z]:r,onfocus:this._onComponentFocus},p=B(a,d),m=B(c,d),h=B(l,d);return Y(`div`,{class:y.dateInputContainer,key:`${s}-date-time-container`},Y(`calcite-input-date-picker`,{...f,class:o,"data-date-part":`date`,key:`${s}-date-input`,max:m?.date??void 0,min:h?.date??void 0,topLayerDisabled:this.topLayerDisabled,value:p.date??void 0,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},onCalciteInputDatePickerChange:e=>this._saveValueFromDateComponent(e.currentTarget)}),n?Y(`calcite-input-time-picker`,{...f,class:o,"data-date-part":`time`,key:`${s}-time-input`,step:1,value:p.time??void 0,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},onCalciteInputTimePickerChange:e=>this._saveValueFromDateComponent(e.currentTarget)}):null)}_renderReadOnlyComponent(e,t){let n=this.getCommonInputProps(e);return Y(`calcite-input`,{...n,class:this.classes(y.fieldInput,y.inputDisabled),readOnly:!0,type:`text`,value:t==null?n.value:`${t}`})}_renderComboBoxComponent(e,t,n){let{value:r,name:i}=e,{viewModel:a,_inputsWithChanges:o}=this,s=a.editType===`INSERT`,c=o.has(i),l=r==null&&(!s||c),u=s&&e.showNoValueOptionEnabled&&!c?()=>{}:n.onblur;return Y(`calcite-combobox`,{...n,allowCustomValues:!1,clearDisabled:!0,overlayPositioning:`fixed`,selectionMode:`single`,topLayerDisabled:this.topLayerDisabled,onblur:u,onCalciteComboboxChange:({currentTarget:t})=>{l&&t.selectedItems.length===0?this._ignoreDeselectionOfNoValueOption(t):e.isSubtypeField&&t.selectedItems.length===0?t.value=`${e.value}`:this._saveValueFromComponent(t)}},this.renderComboboxOptionsList(e,t))}renderComboboxOptionsList(e,t){let{value:n,name:r}=e,{messages:i,messagesTemplates:a,viewModel:o,_inputsWithChanges:s}=this,[c,l,u]=t.map(e=>e.map(({name:e,value:t})=>Y(`calcite-combobox-item`,{heading:e,key:`#${t}`,selected:n===t,value:`${t}`}))),d=[];l.length>0&&d.push(Y(`calcite-combobox-item-group`,{key:`other`,label:a.other},l)),u.length>0&&d.push(Y(`calcite-combobox-item-group`,{key:`unsupported`,label:i.subtypes.unsupportedDomainGroupTitle},u)),d.length>0?d.unshift(Y(`calcite-combobox-item-group`,{key:`recommended`,label:i.recommended},c)):d.push(...c);let f=o.editType===`INSERT`,p=s.has(r),m=n==null&&(!f||p);return e.showNoValueOptionEnabled&&d.unshift(Y(`calcite-combobox-item`,{heading:e.showNoValueLabel||i.empty,key:`empty-option`,selected:m,value:``})),d}_renderRadioButtonComponents(e,t,n){let{value:r}=e,i=t.map(({name:e,value:t})=>this._renderRadioButtonComponent({key:e,label:e,value:t,selected:t===r,props:n}));if(e.showNoValueOptionEnabled){let t=e.showNoValueLabel||this.messages.empty,a=r===``||r===null;i.unshift(this._renderRadioButtonComponent({key:`empty-option`,label:t,value:``,selected:a,props:n}))}return Y(`calcite-radio-button-group`,{afterCreate:this._afterRadioGroupCreateOrUpdate,afterUpdate:this._afterRadioGroupCreateOrUpdate,class:y.inputRadioGroup,"data-field-name":n[Z],key:`${n.key}-radio-group`,layout:`vertical`,name:`${n.key}-${this.id}`,required:n.required},i)}_renderSwitchComponent(e,t){let{value:n}=e,r=D(e.element,`switch`)?n===e.element.input.onValue:!1;return Y(`calcite-switch`,{...t,checked:r,class:y.inputSwitch,disabled:t.readOnly,onblur:()=>{this._focusedFieldName=null},onCalciteSwitchChange:e=>this._saveValueFromComponent(e.currentTarget)})}_renderRadioButtonComponent({key:e,value:t,selected:n,label:r,props:i}){return Y(`calcite-label`,{class:y.inputRadioLabel,key:e,layout:`inline`},Y(`calcite-radio-button`,{...i,afterCreate:void 0,afterUpdate:void 0,checked:n,class:y.inputRadio,disabled:i.readOnly,value:t,onblur:()=>{this._focusedFieldName=null},onCalciteRadioButtonChange:({currentTarget:e})=>{e.checked&&this._saveValueFromComponent(e)}}),r)}_renderAuxiliaryText(e){let t=e.name,n=this._inputsWithChanges.has(t)&&!e.submittable?O(e,this.messages,this.timeZone):this.viewModel.contingencyConstraintViolations.get(t)==null?e.valueExpressionExecutor!=null&&e.valueExpressionExecutor.stale?this.messages.valueExpressionError:null:this.messages.validationErrors.valuesIncompatible;return n==null?this._inputsWithChanges.has(t)&&e.valueIsOutOfDomain?Y(`calcite-input-message`,{icon:!0,status:`idle`},this.messages.subtypes.fieldOutOfSubtypeDomainWarning):this._renderDescriptionOrEmpty(e.description):Y(`calcite-input-message`,{icon:!0,status:`invalid`},n)}_renderShowAllRelatedRecordsListItem(e){if(!e.showAllActionVisible||!this.callbacks?.showAllRelatedRecords)return;let n=this.messages;return Y(`calcite-list-item`,{description:t(n.totalCount,{count:e.featureCount}),key:`show-all-related-features`,label:n.showAll,value:!0,onCalciteListItemSelect:()=>this._onShowAllRelatedRecordsClick(e.relationshipId)},Y(`calcite-icon`,{icon:`list`,scale:`s`,slot:`content-end`}))}_renderAddRelatedRecordButton(e){let{canAddRelatedFeature:t,relationshipId:n,relatedLayer:r,editable:i}=e,{messages:a,callbacks:o,disabled:s}=this,c=!i||s;if(t&&o?.addRelatedRecord&&r&&!c)return Y(`calcite-button`,{alignment:`center`,appearance:`outline-fill`,class:y.centeredButton,disabled:e.updating||!e.originHasValidKey,iconStart:`plus`,key:`${n}-add-button`,round:!0,scale:`s`,width:`full`,onclick:()=>{!e.updating&&e.originHasValidKey&&this._onAddRelatedRecordsClick(e,n,r)}},e.relatedLayerIsTable?a.addRecord:a.addFeature)}_renderRelatedRecordListItem(e,t,n){let{feature:r,description:i,title:a}=e,{feature:o,callbacks:s}=this,{highlightHelper:c}=this.viewModel,l=()=>{c?.removeAll(),s?.editRelatedRecord&&o&&s.editRelatedRecord({parentFeature:o,relationshipId:t,relatedFeature:r,readOnly:n})},u=c?()=>c.add(r):void 0,d=c?()=>c.remove(r):void 0;return Y(`calcite-list-item`,{bind:this,description:i,key:`${t}-${r.uid}`,label:a,value:a,onCalciteListItemSelect:l,onmouseenter:u,onmouseleave:d},Y(`calcite-icon`,{icon:k(r),slot:`content-start`}),Y(`calcite-icon`,{flipRtl:!0,icon:`chevron-right`,scale:`s`,slot:`content-end`}))}_renderRelationshipInput(e){if(!this._relatedRecordsEnabled)return;let{relationshipId:t,activeCategory:n}=e,r=n?null:this._renderDescriptionOrEmpty(e.description);return Y(`calcite-label`,{class:this.classes(y.label,y.relatedRecordsLabel),key:`relationship-${t}-container`},Y(`div`,null,this._renderRelatedRecordsHeaderContainer(e),r,this._renderRelationshipInputContent(e)),this._renderAddRelatedRecordButton(e))}_renderRelationshipInputContent(e){if(e.featureCount>0)return this._renderRelatedRecordsList(e);if(e.activeCategory&&e.featureCount===0)return this._renderNoRelatedRecordsNotice();if(e.allCategories?.length)return this._renderCategoryList(e);if(e.loaded)return e.originHasValidKey?this._renderNoRelatedRecordsNotice():this._renderNoValidOriginKeyNotice(e)}_renderCategoryList(e){return Y(`calcite-list`,{displayMode:`flat`,label:this.messages.relatedRecordsList,loading:e.updating},e.categories?.map(t=>this._renderCategory(e,t)),this._renderShowAllCategoriesListItem(e))}_renderCategory(e,t){let{count:r,name:i,value:a}=t,o=n(r);return Y(`calcite-list-item`,{key:`${i}-${a}`,label:i,onCalciteListItemSelect:()=>this._selectCategory(e,t)},Y(`calcite-chip`,{label:o,scale:`s`,slot:`content-end`},o),Y(`calcite-icon`,{flipRtl:!0,icon:`chevron-right`,scale:`s`,slot:`content-end`}))}_selectCategory(e,t){this.relationshipId=e.relationshipId,e.activeCategory=t}_renderShowAllCategoriesListItem(e){if(!e.showAllCategoriesVisible)return;let n=this.messages;return Y(`calcite-list-item`,{description:t(n.totalCount,{count:e.allCategories?.length??0}),key:`show-all-categories`,label:n.showAll,value:!0,onCalciteListItemSelect:()=>e.showAllEnabled=!0},Y(`calcite-icon`,{icon:`list`,scale:`s`,slot:`content-end`}))}_renderRelatedRecordsHeaderContainer(e){let t=e.updating||!e.loaded;return Y(`div`,{class:y.relatedRecordsHeader,key:`relationship-${e.relationshipId}-header`},Y(`span`,null,e.label),t?Y(`calcite-loader`,{inline:!0,key:`loader`,label:this.messagesCommon?.loading,scale:`s`,type:`indeterminate`}):void 0)}_renderRelatedRecordsList(e){let{relationshipId:t,editable:n}=e,{disabled:r}=this,i=!n||r;return Y(`calcite-list`,{class:y.relatedRecordsList,label:this.messages?.relatedRecordsList},e.relatedFeatureInfos.map(e=>this._renderRelatedRecordListItem(e,t,i)),this._renderShowAllRelatedRecordsListItem(e),this._renderObserverNode())}_renderNoValidOriginKeyNotice(e){let{messages:n}=this,r=e.relatedLayerIsTable?n.noOriginKeyRecord:n.noOriginKeyFeature,i=e.relationship?.keyField,a=this.viewModel.findField(i),o=e.layer?.fieldsIndex.get(i),s=a?.label||o?.alias||i,c=t(r,{relatedLayerName:e.relatedLayer?.title,originKeyField:s});return Y(`calcite-notice`,{icon:`information`,kind:`brand`,open:!0,scale:`s`,width:`full`},Y(`div`,{slot:`message`},c))}_renderNoRelatedRecordsNotice(){return Y(`calcite-notice`,{icon:`information`,kind:`brand`,open:!0,scale:`s`,width:`full`},Y(`div`,{slot:`message`},this.messagesFeature.noRelatedFeatures))}_renderObserverNode(){if(this.viewModel.activeRelationshipInput?.showAllEnabled)return Y(`div`,{afterCreate:this._afterListObserverCreated,afterRemoved:this._afterListObserverRemoved,bind:this,class:y.listObserver,key:`feature-observer`})}_renderTextElementInput(e){return Y(`div`,{class:y.textElement,"data-testid":`text-element-${e.label}`,innerHTML:e.text,key:e.id})}getCommonInputProps(e){let{disabled:t}=this,{editable:n,hint:r,label:i,maxLength:a,minLength:o,name:s,range:{max:c,min:l},required:u,valid:d,value:f}=e,p=this._inputsWithChanges.has(s),m=!n||t;return{afterCreate:this._afterComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,"aria-invalid":d?`false`:`true`,class:this.classes(y.fieldInput,m?y.inputDisabled:null),status:p&&!d?`invalid`:`idle`,key:s,label:i,max:c??void 0,min:l??void 0,maxLength:a>-1?a:void 0,minLength:o>-1?o:void 0,placeholder:r??void 0,readOnly:m,required:u,value:f==null?``:`${f}`,onblur:this._onComponentBlur,onfocus:this._onComponentFocus,onkeydown:this._onComponentKeyDown,[Z]:s}}_getFieldInputFromHTMLElement(e){return this.viewModel.findField(e.getAttribute(Z))}_afterDateComponentCreate(e){let t=this._getFieldInputFromHTMLElement(e),n=e.dataset.datePart,r=this._dateComponentMap.get(t.name);if(`valueAsDate`in e&&e.value!=null&&t.value!=null){let n=new ResizeObserver(()=>{switch(e.value=void 0,t.field.type){case`date`:e.value=B(t.value,this.timeZone).date??``;break;case`timestamp-offset`:e.value=z(t.value,this.timeZone).date??``;break;default:e.value=`${t.value}`}n.unobserve(e)});n.observe(e)}if(r!=null)switch(n){case`date`:r.date=e;break;case`time`:r.time=e;break;case`timeZone`:r.timeZone=e}else this._dateComponentMap.set(t.name,{[n]:e});this._afterDateComponentCreateOrUpdate(e)}_afterDateComponentCreateOrUpdate(e){this._afterComponentCreateOrUpdate(e)}_afterComponentCreate(e){let t=this._getFieldInputFromHTMLElement(e);A(t)&&e.value!=null&&`setNumberValue`in e&&e.setNumberValue({committing:!1,value:e.value,origin:`direct`}),this._afterComponentCreateOrUpdate(e)}_afterRadioGroupCreateOrUpdate(e){let t=e.selectedItem,n=e.querySelector(`calcite-radio-button`),r=t||n;r&&this._afterComponentCreateOrUpdate(r)}_afterComponentCreateOrUpdate(e){let{viewModel:t}=this,n=this._getFieldInputFromHTMLElement(e),r=t.findField(this._focusedFieldName);this._attemptFocusOnNextRender&&r===n&&(this._attemptFocusOnNextRender=!1,E(n)&&(n.group.open=!0),X(e))}async _afterGroupCreate(e){let t=this.viewModel.findGroup(e.id),n=this.viewModel.findField(this._focusedFieldName);n&&t&&j(n,t)&&(!n.editable||this.disabled)&&(await e.componentOnReady(),this._attemptFocusOnNextRender=!0,this.scheduleRender())}_onComponentFocus(e){let t=e.target,n=this._getFieldInputFromHTMLElement(t);this._focusedFieldName=n.name}_onComponentBlur(e){let t=e.target;this._focusedFieldName=null,`readOnly`in t&&t.readOnly||this._saveValueFromComponent(t)}_saveValueFromDateComponent(e){let{timeZone:t}=this,n=this._getFieldInputFromHTMLElement(e),r=n.field.type,{name:i,range:a}=n,o=this._dateComponentMap.get(i);if(!o)return;let s=this.viewModel.getValue(i),c=null;r===`date-only`?c=Array.isArray(e.value)?e.value[0]:e.value:r===`time-only`?(s=V(s),c=V(e.value)):c=r===`timestamp-offset`?e.value==null?null:H({dateComponent:o.date,timeComponent:o.time,timeZoneComponent:o.timeZone,oldValue:s,defaultTimeZone:t}):e.value==null?null:U({oldValue:s,dateComponent:o.date,timeComponent:o.time,timeZone:t,max:a.max,min:a.min}),c===null||!e.value?this._updateFieldValue(i,null):s!==c&&this._updateFieldValue(i,c)}_saveValueFromComponent(e){let t=this._getFieldInputFromHTMLElement(e),n=this._parseValue(e),r=t.value;!t.isSubtypeField||!M(this.layer,r,n)?this._updateFieldValue(t.name,n):!this._pendingSubtypeChoice&&n!==r&&(this._pendingSubtypeChoice=this._handleSubtypeChoice(t,n))}async _handleSubtypeChoice(e,n){let{value:r,name:i}=e,{messages:a,viewModel:o,messagesCommon:s,_subtypes:c}=this;if(this._updateFieldValue(i,n),!c?.length)return;let l=c.find(e=>e.code===n),u=c.find(e=>e.code===r)?.name??`${r}`;if(!l)return;let d=Promise.withResolvers();o.pendingSubtypeChoice=d;let f=`update-fields`,p=[{label:a.subtypes.useDefaultValuesOption,value:`update-fields`},{label:a.subtypes.keepCurrentValuesOption,value:`keep-existing`}],m={context:`info`,title:a.subtypes.changeWarningTitle,message:t(a.subtypes.changeWarning,{originalType:u,newType:l.name}),radios:p,defaultRadioSelection:`update-fields`,onRadioSelection:e=>f=e,actions:{primary:{label:s.apply,action:()=>d.resolve(f),type:`positive`},secondary:{label:s.cancel,type:`neutral`,action:()=>d.resolve(`undo`)}},cancel:()=>d.reject()};try{switch(this.showPrompt(m),await d.promise){case`update-fields`:o.applySubtypeDefaults(l),this._validateContingenciesForNonNullFields();break;case`keep-existing`:this._validateContingenciesForNonNullFields();break;case`undo`:this._updateFieldValue(e.name,r)}}finally{o.pendingSubtypeChoice=null,this.clearPrompt(),this._pendingSubtypeChoice=null}}_onComponentKeyDown({key:e,target:t}){let n=this._getFieldInputFromHTMLElement(t);e===`Enter`&&E(n)&&!n.group.open&&(n.group.open=!0)}_updateFieldValue(e,t){let n=this.viewModel.getValue(e);this.viewModel.setValue(e,t),this._inputsWithChanges.add(e),n!==t&&this.viewModel.fieldsWithContingentValues.has(e)&&this._validateContingenciesForNonNullFields()}_validateContingenciesForNonNullFields(){let e=Object.fromEntries(Object.entries(this.getValues()).filter(([e,t])=>t!=null));this.viewModel.validateContingencyConstraints(e)}_parseValue(e){let t=this._getFieldInputFromHTMLElement(e),n=e.value;return D(t.element,`switch`)?e.checked?t.element.input.onValue:t.element.input.offValue:n==null||n===``?null:t.dataType===`number`?n===`-0`||n===`-0.`||n===`-0,`?n:parseFloat(n):t.field.type===`date`?parseFloat(n):n}_ignoreDeselectionOfNoValueOption(e){let{firstChild:t,selectedItems:n}=e;n.length===0&&t&&`selected`in t?t.selected=!0:a.getLogger(this).warnOnce(`Failed to override user attempt to deselect 'No value' option.`)}_onGroupToggle(e,t){e.expanded?(t.open=!0,this._focusedFieldName=this._getFocusableInput(`forward`,t)?.name||null,this._attemptFocusOnNextRender=!0,this.groupDisplay===`sequential`&&this.viewModel.allGroupInputs.forEach(e=>{e!==t&&(e.open=!1)})):t.open=!1,this.scheduleRender()}_onFormSubmit(e){e.preventDefault()}_onFormKeyDown(e){e.key===`Enter`&&this.viewModel.submit()}_afterListObserverCreated(e){this.viewModel.activeRelationshipInput&&(this._listObserverNode=e)}_afterListObserverRemoved(){this._listObserverNode=null}_onObserverChange(){this._listObserverNode&&this._listObserver.unobserve(this._listObserverNode);let e=this.viewModel.activeRelationshipInput;e&&this._listObserverNode&&e.showAllEnabled&&this._listObserver.observe(this._listObserverNode)}_incrementRelatedRecordPage(){this.viewModel.activeRelationshipInput?.incrementPage()}_syncGroupInputStates(){if(this.groupDisplay!==`sequential`)return;let e=this.viewModel.allGroupInputs;if(!e.length)return;let t=e.filter(e=>e.open);t.length===0?e[0].open=!0:t.length>1&&t.slice(1).forEach(e=>e.open=!1)}get test(){return{inputsWithChanges:this._inputsWithChanges,updateValue:this._saveValueFromComponent.bind(this)}}};e([u()],Q.prototype,`_listObserverNode`,void 0),e([u()],Q.prototype,`_relatedRecordsEnabled`,null),e([u()],Q.prototype,`_utilityNetworkAssociationsEnabled`,null),e([u()],Q.prototype,`_prompt`,void 0),e([u()],Q.prototype,`_subtypes`,null),e([u()],Q.prototype,`associationId`,null),e([u()],Q.prototype,`associatedLayer`,null),e([u()],Q.prototype,`disabled`,null),e([u()],Q.prototype,`feature`,null),e([u()],Q.prototype,`_featureFormUNAssociationList`,void 0),e([u()],Q.prototype,`formTemplate`,null),e([u()],Q.prototype,`groupDisplay`,void 0),e([u()],Q.prototype,`headingLevel`,void 0),e([u()],Q.prototype,`icon`,null),e([u()],Q.prototype,`label`,null),e([u()],Q.prototype,`layer`,null),e([u()],Q.prototype,`map`,null),e([u(),q(`esri/widgets/FeatureForm/t9n/FeatureForm`)],Q.prototype,`messages`,void 0),e([u(),q(`esri/t9n/common`)],Q.prototype,`messagesCommon`,void 0),e([u(),q(`esri/widgets/Feature/t9n/Feature`)],Q.prototype,`messagesFeature`,void 0),e([u(),q(`esri/widgets/FeatureTemplates/t9n/FeatureTemplates`)],Q.prototype,`messagesTemplates`,void 0),e([u()],Q.prototype,`callbacks`,null),e([u()],Q.prototype,`relationshipId`,null),e([u()],Q.prototype,`spatialReference`,null),e([u()],Q.prototype,`strict`,null),e([u()],Q.prototype,`timeZone`,null),e([u()],Q.prototype,`showPrompt`,null),e([u()],Q.prototype,`clearPrompt`,null),e([u({type:N}),J([`value-change`,`submit`])],Q.prototype,`viewModel`,void 0),e([u({type:P,nonNullable:!0})],Q.prototype,`visibleElements`,void 0),e([u()],Q.prototype,`test`,null),Q=e([d(`esri.widgets.FeatureForm`)],Q);const $=Q;export{$ as default};
2
+ import{__decorate as e}from"tslib";import{substitute as t,formatNumber as n}from"../intl.js";import{isSome as r}from"../core/arrayUtils.js";import{deprecateWidget as i}from"../core/deprecate.js";import a from"../core/Logger.js";import o from"../core/ReactiveMap.js";import{watch as s,whenOnce as c,initial as l}from"../core/reactiveUtils.js";import{property as u,subclass as d}from"../core/accessorSupport/decorators.js";import{isIntegerField as f}from"../layers/support/fieldUtils.js";import{isSubtypeGroupLayer as p,getSubtypesFromLayer as m}from"../layers/support/layerUtils.js";import{isRelatableFeatureSupportedLayer as h}from"../popup/support/featureUtils.js";import{isString as g}from"../support/guards.js";import _ from"./Widget.js";import{Prompt as v}from"./Editor/components/Prompt.js";import{css as y}from"./FeatureForm/css.js";import{isUtilityNetworkAssociationInput as b,isGroupInput as x,isFieldInput as S,isRelationshipInput as C,isTextElementInput as w,flattenInputs as T,isInputInGroupInput as E,isFieldElementWithInputType as D,getErrorMessageForFieldInput as O,getIconForFeature as k,isNumberFieldInput as A,isInputInThisGroupInput as j,subtypeChangeShouldPrompt as M}from"./FeatureForm/featureFormUtils.js";import N from"./FeatureForm/FeatureFormViewModel.js";import P from"./FeatureForm/VisibleElements.js";import{loadCalciteComponents as F}from"./support/componentsUtils.js";import{getLabelForDateFieldValue as I,getIntlOptionsForField as L,numberingSystem as R,prepareISOFieldValueForDateComponents as z,prepareUnixFieldValueForDateComponents as B,normalizeTimeOnlyString as V,getISOFieldValueFromDateComponents as H,getUnixFieldValueFromDateComponents as U}from"./support/dateUtils.js";import{globalCss as W}from"./support/globalCss.js";import{Heading as G,incrementHeadingLevel as K}from"./support/Heading.js";import{messageBundle as q,vmEvent as J,tsx as Y}from"./support/widget.js";import{setFocus as X}from"./support/widgetUtils.js";const Z=`data-field-name`;let Q=class extends _{constructor(e,t){super(e,t),this._associationsWidgetsMap=new o,this._attemptFocusOnNextRender=!1,this._dateComponentMap=new Map,this._inputsWithChanges=new Set,this._focusedFieldName=null,this._pendingSubtypeChoice=null,this._listObserverNode=null,this._listObserver=new IntersectionObserver(e=>{e.length&&e[0].isIntersecting&&this._incrementRelatedRecordPage()},{root:window.document}),this._prompt=null,this._featureFormUNAssociationList=null,this.groupDisplay=`all`,this.headingLevel=2,this.messages=null,this.messagesCommon=null,this.messagesFeature=null,this.messagesTemplates=null,this.viewModel=new N,this.visibleElements=new P,this._onShowAllRelatedRecordsClick=e=>{let{feature:t,callbacks:n}=this;t&&n?.showAllRelatedRecords&&n.showAllRelatedRecords({parentFeature:t,relationshipId:e})},this._onAddRelatedRecordsClick=(e,t,n)=>{let{feature:r,callbacks:i}=this,a=n;if(r&&i?.addRelatedRecord){if(p(n)&&e.activeCategory){let t=e.activeCategory.value,r=n.findSublayerForSubtypeCode(t);r&&h(r)&&(a=r)}i.addRelatedRecord({parentFeature:r,relatedLayer:a,relationshipId:t})}},e?.suppressDeprecationWarning||(this.announceDeprecation=()=>{i(a.getLogger(this),`Feature Form`,`arcgis-feature-form`,{version:`5.0`})}),this._onFormKeyDown=this._onFormKeyDown.bind(this),this._onFormSubmit=this._onFormSubmit.bind(this),this._onGroupToggle=this._onGroupToggle.bind(this),this._onComponentBlur=this._onComponentBlur.bind(this),this._onComponentFocus=this._onComponentFocus.bind(this),this._onComponentKeyDown=this._onComponentKeyDown.bind(this),this._afterComponentCreate=this._afterComponentCreate.bind(this),this._afterComponentCreateOrUpdate=this._afterComponentCreateOrUpdate.bind(this),this._afterDateComponentCreate=this._afterDateComponentCreate.bind(this),this._afterDateComponentCreateOrUpdate=this._afterDateComponentCreateOrUpdate.bind(this),this._afterRadioGroupCreateOrUpdate=this._afterRadioGroupCreateOrUpdate.bind(this),this._afterGroupCreate=this._afterGroupCreate.bind(this)}normalizeCtorArgs(e={}){let{suppressDeprecationWarning:t,...n}=e;return n}initialize(){this.addHandles([s(()=>this.feature,()=>{this._inputsWithChanges.clear(),this._dateComponentMap.clear(),c(()=>!this.viewModel.updating).then(()=>{let e=this._getFocusableInput(`forward`);this._syncGroupInputStates(),this._focusedFieldName=e?.name||null,this._attemptFocusOnNextRender=!0})}),s(()=>[this._featureFormUNAssociationList,this.visibleElements.associationDetails],([e,t])=>{e&&(e.visibleElements.associationDetails=t)},l),s(()=>this.groupDisplay,()=>this._syncGroupInputStates()),this.on(`submit`,e=>{if(e.invalid.length>0){let[t]=e.invalid;e.invalid.forEach(e=>this._inputsWithChanges.add(e)),this._focusedFieldName=t,this._attemptFocusOnNextRender=!0,this.scheduleRender()}}),s(()=>[this.viewModel.activeRelationshipInput,this._listObserverNode],()=>this._onObserverChange()),s(()=>this.viewModel.activeAssociationInput,e=>{e&&this._featureFormUNAssociationList&&(this._featureFormUNAssociationList.associationInput=e,this._featureFormUNAssociationList.viewModel=e.viewModel)}),s(()=>this.viewModel.inputs.filter(b),async e=>{this._featureFormUNAssociationList||await this._setUpUtilityNetworkAssociationList();for(let t of e)this._associationsWidgetsMap.has(t)||this._associationsWidgetsMap.set(t,await this._makeAssociationsWidget(t))})])}loadDependencies(){return F({block:()=>import(`@esri/calcite-components/dist/components/calcite-block`),button:()=>import(`@esri/calcite-components/dist/components/calcite-button`),chip:()=>import(`@esri/calcite-components/dist/components/calcite-chip`),combobox:()=>import(`@esri/calcite-components/dist/components/calcite-combobox`),"combobox-item":()=>import(`@esri/calcite-components/dist/components/calcite-combobox-item`),"combobox-item-group":()=>import(`@esri/calcite-components/dist/components/calcite-combobox-item-group`),icon:()=>import(`@esri/calcite-components/dist/components/calcite-icon`),input:()=>import(`@esri/calcite-components/dist/components/calcite-input`),"input-date-picker":()=>import(`@esri/calcite-components/dist/components/calcite-input-date-picker`),"input-message":()=>import(`@esri/calcite-components/dist/components/calcite-input-message`),"input-number":()=>import(`@esri/calcite-components/dist/components/calcite-input-number`),"input-time-picker":()=>import(`@esri/calcite-components/dist/components/calcite-input-time-picker`),"input-time-zone":()=>import(`@esri/calcite-components/dist/components/calcite-input-time-zone`),label:()=>import(`@esri/calcite-components/dist/components/calcite-label`),list:()=>import(`@esri/calcite-components/dist/components/calcite-list`),"list-item":()=>import(`@esri/calcite-components/dist/components/calcite-list-item`),loader:()=>import(`@esri/calcite-components/dist/components/calcite-loader`),notice:()=>import(`@esri/calcite-components/dist/components/calcite-notice`),"radio-button":()=>import(`@esri/calcite-components/dist/components/calcite-radio-button`),"radio-button-group":()=>import(`@esri/calcite-components/dist/components/calcite-radio-button-group`),switch:()=>import(`@esri/calcite-components/dist/components/calcite-switch`),"text-area":()=>import(`@esri/calcite-components/dist/components/calcite-text-area`)})}destroy(){this._listObserverNode&&this._listObserver.unobserve(this._listObserverNode)}get _relatedRecordsEnabled(){let{callbacks:e}=this;return!!(e&&(e.addRelatedRecord||e.editRelatedRecord||e.showAllRelatedRecords))}get _utilityNetworkAssociationsEnabled(){let{callbacks:e}=this;return!!(e?.viewAssociatedLayers&&e.viewAssociatedFeatures)}get _subtypes(){return m(this.layer)}get associationId(){return this.viewModel.associationId}set associationId(e){this.viewModel.associationId=e}get associatedLayer(){return this.viewModel.associatedLayer}set associatedLayer(e){this.viewModel.associatedLayer=e}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 icon(){return`form-field`}set icon(e){this._overrideIfSome(`icon`,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 callbacks(){return this.viewModel.callbacks}set callbacks(e){this.viewModel.callbacks=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 timeZone(){return this.viewModel.timeZone}set timeZone(e){this.viewModel.timeZone=e}get showPrompt(){return e=>{this._prompt?.cancel?.(),this._prompt=e}}set showPrompt(e){this._overrideIfSome(`showPrompt`,e)}get clearPrompt(){return()=>this._prompt=null}set clearPrompt(e){this._overrideIfSome(`clearPrompt`,e)}getValues(){return this.viewModel.getValues()}submit(){return this.viewModel.submit()}render(){let{state:e}=this.viewModel;return Y(`div`,{class:this.classes(y.base,W.widget,W.panel)},e===`ready`?this._renderForm():null)}_renderForm(){return Y(`div`,null,Y(`form`,{class:y.form,inert:!!this._prompt,novalidate:!0,onkeydown:this._onFormKeyDown,onsubmit:this._onFormSubmit},this._renderReadOnlyNotice(),this._renderHeader(),this._renderContent()),this._prompt?Y(v,{...this._prompt,headingLevel:this.headingLevel}):void 0)}_renderReadOnlyNotice(){let{disabled:e,messages:t}=this;if(e&&this.visibleElements.readOnlyNotice)return Y(`calcite-notice`,{class:y.disabledNotice,"data-testid":`read-only-notice`,icon:`read-only-non-editable`,kind:`brand`,open:!0,scale:`s`,width:`full`},Y(`div`,{slot:`message`},t.disabledForm))}_renderHeader(){let e=this.viewModel,{formTitle:t,formDescription:n}=e;if(!e.formHeaderVisible)return;let r=t!=null&&Y(G,{key:`title`,level:this.headingLevel},t),i=n!=null&&Y(`p`,{class:y.description,key:`description`},n);return Y(`div`,{class:y.formHeader},r,i)}_renderContent(){let{viewModel:e}=this;return e.activeRelationshipInput?this._renderRelationshipInput(e.activeRelationshipInput):e.activeAssociationInput?this._renderFeatureFormUtilityNetworkAssociationList():e.inputs.filter(r).filter(e=>e.visible).map(e=>this._renderInput(e))}_renderInput(e){if(x(e))return this._renderGroup(e);if(S(e))return this._renderLabeledField(e);if(C(e))return this._renderRelationshipInput(e);if(w(e))return this._renderTextElementInput(e);if(b(e))return this._renderUtilityNetworkAssociationsElementInput(e)}_renderFeatureFormUtilityNetworkAssociationList(){return this._featureFormUNAssociationList?.render()}_selectAssociatedLayer(e){let{feature:t,callbacks:n}=this;t&&n?.viewAssociatedFeatures&&n.viewAssociatedFeatures({associatedLayer:e.layer})}async _selectAssociatedFeature(e){let{feature:t,callbacks:n}=this;t&&n?.selectAssociatedFeature&&await n.selectAssociatedFeature({parentFeature:t,...e})}_onAddAssociation(e){let{feature:t,callbacks:n}=this;t&&n?.addAssociation&&n.addAssociation(e)}async _setUpUtilityNetworkAssociationList(){if(!this._featureFormUNAssociationList){let e=(await import(`./FeatureForm/FeatureFormUtilityNetworkAssociations/FeatureFormUtilityNetworkAssociationList.js`)).default;this._featureFormUNAssociationList=new e({onSelectLayer:this._selectAssociatedLayer.bind(this),onSelectFeature:this._selectAssociatedFeature.bind(this),onAddAssociation:this._onAddAssociation.bind(this)})}}async _makeAssociationsWidget(e){let t=(await import(`./Feature/FeatureUtilityNetworkAssociations.js`)).default;return new t({onSelectAssociationType:({viewModel:t,listType:n})=>{t.activeAssociationType=n;let{feature:r,callbacks:i}=this;r&&i?.viewAssociatedLayers&&i.viewAssociatedLayers({associationId:e.uid})},viewModel:e.associationsViewModel})}_renderUtilityNetworkAssociationsElementInput(e){if(this._utilityNetworkAssociationsEnabled)return this._associationsWidgetsMap.get(e)?.render()}_renderDescriptionOrEmpty(e,t){return e==null?null:Y(`div`,{class:this.classes(y.description),id:t},e)}_renderGroup(e){let{formTemplate:t,headingLevel:n}=this,{description:r,id:i,inputs:a,label:o,open:s}=e,c=a.filter(e=>e.visible),l=this.viewModel.findField(this._focusedFieldName)?.group===e,u=this.groupDisplay===`sequential`;return Y(`calcite-block`,{afterCreate:this._afterGroupCreate,class:this.classes(y.group,u?y.groupSequential:null,l?y.groupActive:null),"data-group":e,description:r||void 0,expandable:!0,expanded:s,heading:o??``,headingLevel:t?.title?K(n):n,id:i,key:i,onCalciteBlockToggle:({currentTarget:t})=>this._onGroupToggle(t,e)},c.map(e=>this._renderInput(e)))}_getFocusableInput(e,t){let n=T(this.viewModel.inputs);e===`backward`&&n.reverse();let r;if(!t)r=0;else if(x(t)){let e=t.inputs.find(e=>e.visible);r=e?n.indexOf(e):0}else{let i;if(E(t)&&!t.group.open){let n=t.group.inputs.filter(S);i=e===`forward`?n[n.length-1]:n[0]}else i=t;r=n.indexOf(i)+1}for(let e=r;e<n.length;e++){let t=n[e];if(t.visible&&S(t)){if(this.disabled&&t.inputType&&(t.inputType===`switch`||t.inputType===`radio-buttons`))continue;return t}}return null}_renderLabeledField(e){let{dataType:n,feature:r,label:i,layer:a,required:o}=e,s={"aria-label":o?t(this.messages.requiredFieldLabel,{name:i}):i,class:y.label,key:`${a.id}-${r.uid}-${e.name}`},c=[Y(`div`,{class:y.labelTextContent,key:`labelTextContainer`},i,o?Y(`span`,{"aria-hidden":`true`,title:this.messagesCommon.required},`*`):void 0),n===`unsupported`?this._renderReadOnlyComponent(e):this._renderFieldInput(e),this._renderAuxiliaryText(e)];return Y(`calcite-label`,{...s},c)}_renderFieldInput(e){let{dataType:t,domain:n,inputType:r,name:i}=e,a=this.getCommonInputProps(e);if(n?.type===`coded-value`){let t=this.viewModel.getFieldValueOptionsForField(i,this.messages.empty);return r===`switch`&&!e.hasInvalidSwitchValue?this._renderSwitchComponent(e,a):r===`radio-buttons`?this._renderRadioButtonComponents(e,t.flat(),a):this._renderComboBoxComponent(e,t,a)}return r===`datetime-picker`||t===`date`?this._renderDateComponents(e,a):t===`number`?this._renderNumberComponent(e,a):this._renderStringComponent(e,a)}_renderStringComponent(e,t){return e.inputType===`text-area`?t.readOnly?Y(`calcite-text-area`,{...t,onCalciteTextAreaInput:e=>this._saveValueFromComponent(e.currentTarget)}):Y(`calcite-text-area`,{...t,resize:`vertical`,onCalciteTextAreaInput:e=>this._saveValueFromComponent(e.currentTarget)}):Y(`calcite-input`,{...t,loading:e.updating,type:`text`,onCalciteInputInput:e=>this._saveValueFromComponent(e.currentTarget)})}_renderNumberComponent(e,t){let n=f(e.field),r=n&&t.value!==``?Math.round(parseFloat(t.value)).toString():t.value;return Y(`calcite-input-number`,{...t,integer:n,loading:e.updating,step:n?1:`any`,type:`number`,value:r,onCalciteInputNumberInput:e=>this._saveValueFromComponent(e.currentTarget)})}_renderDateComponents(e,t){let{field:n}=e;switch(n.type){case`date`:return this._renderDateFieldComponents(e,t);case`date-only`:return this._renderDateOnlyFieldComponent(e,t);case`time-only`:return this._renderTimeOnlyFieldComponent(e,t);case`timestamp-offset`:return this._renderTimestampOffsetFieldComponents(e,t);default:return this._renderReadOnlyComponent(e,I(n,t.value,{timeZone:this.timeZone,...L(n)}))}}_renderDateOnlyFieldComponent(e,t){let{range:n,valid:r,value:i}=e,{class:a,key:o,readOnly:s}=t,{rawMax:c,rawMin:l}=n;return Y(`calcite-input-date-picker`,{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!r,class:a,"data-date-part":`date`,"data-field-name":t[Z],key:`${o}-date-input`,max:g(c)?c:void 0,min:g(l)?l:void 0,numberingSystem:R,overlayPositioning:`fixed`,readOnly:s,topLayerDisabled:this.topLayerDisabled,value:i==null?void 0:`${i}`,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},onCalciteInputDatePickerChange:e=>this._saveValueFromDateComponent(e.currentTarget),onfocus:this._onComponentFocus})}_renderTimeOnlyFieldComponent(e,t){let{valid:n,value:r}=e,{class:i,key:a,readOnly:o}=t;return Y(`calcite-input-time-picker`,{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!n,class:i,"data-date-part":`time`,"data-field-name":t[Z],key:`${a}-time-input`,numberingSystem:R,overlayPositioning:`fixed`,readOnly:o,step:e.timeStep,value:r==null?void 0:`${r}`,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},onCalciteInputTimePickerChange:e=>this._saveValueFromDateComponent(e.currentTarget),onfocus:this._onComponentFocus})}_renderTimestampOffsetFieldComponents(e,t){let{name:n,range:r,timeZone:i,valid:a,value:o}=e,{class:s,key:c,readOnly:l}=t,{rawMax:u,rawMin:d}=r,f={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!a,numberingSystem:R,overlayPositioning:`fixed`,readOnly:l,[Z]:n,onfocus:this._onComponentFocus},p=z(u,i),m=z(d,i),h=z(o,i);return Y(`div`,{class:y.dateInputContainer,key:`${c}-date-time-container`},Y(`calcite-input-date-picker`,{...f,class:s,"data-date-part":`date`,key:`${c}-date-input`,max:p?.date??void 0,min:m?.date??void 0,topLayerDisabled:this.topLayerDisabled,value:h.date??void 0,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},onCalciteInputDatePickerChange:e=>this._saveValueFromDateComponent(e.currentTarget)}),Y(`calcite-input-time-picker`,{...f,class:s,"data-date-part":`time`,key:`${c}-time-input`,step:e.timeStep,value:h.time??void 0,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},onCalciteInputTimePickerChange:e=>this._saveValueFromDateComponent(e.currentTarget)}),e.includeTimeOffset?Y(`calcite-input-time-zone`,{...f,class:s,"data-date-part":`timeZone`,disabled:l,key:`${c}-timezone-input`,value:h.timeZoneOffset??`0`,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},onCalciteInputTimeZoneChange:e=>this._saveValueFromDateComponent(e.currentTarget)}):null)}_renderDateFieldComponents(e,t){let{includeTime:n,name:r,valid:i,value:a}=e,{class:o,key:s,max:c,min:l,readOnly:u}=t,{timeZone:d}=this,f={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!i,numberingSystem:R,overlayPositioning:`fixed`,readOnly:u,[Z]:r,onfocus:this._onComponentFocus},p=B(a,d),m=B(c,d),h=B(l,d);return Y(`div`,{class:y.dateInputContainer,key:`${s}-date-time-container`},Y(`calcite-input-date-picker`,{...f,class:o,"data-date-part":`date`,key:`${s}-date-input`,max:m?.date??void 0,min:h?.date??void 0,topLayerDisabled:this.topLayerDisabled,value:p.date??void 0,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},onCalciteInputDatePickerChange:e=>this._saveValueFromDateComponent(e.currentTarget)}),n?Y(`calcite-input-time-picker`,{...f,class:o,"data-date-part":`time`,key:`${s}-time-input`,step:1,value:p.time??void 0,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},onCalciteInputTimePickerChange:e=>this._saveValueFromDateComponent(e.currentTarget)}):null)}_renderReadOnlyComponent(e,t){let n=this.getCommonInputProps(e);return Y(`calcite-input`,{...n,class:this.classes(y.fieldInput,y.inputDisabled),readOnly:!0,type:`text`,value:t==null?n.value:`${t}`})}_renderComboBoxComponent(e,t,n){let{value:r,name:i}=e,{viewModel:a,_inputsWithChanges:o}=this,s=a.editType===`INSERT`,c=o.has(i),l=r==null&&(!s||c),u=s&&e.showNoValueOptionEnabled&&!c?()=>{}:n.onblur;return Y(`calcite-combobox`,{...n,allowCustomValues:!1,clearDisabled:!0,overlayPositioning:`fixed`,selectionMode:`single`,topLayerDisabled:this.topLayerDisabled,onblur:u,onCalciteComboboxChange:({currentTarget:t})=>{l&&t.selectedItems.length===0?this._ignoreDeselectionOfNoValueOption(t):e.isSubtypeField&&t.selectedItems.length===0?t.value=`${e.value}`:this._saveValueFromComponent(t)}},this.renderComboboxOptionsList(e,t))}renderComboboxOptionsList(e,t){let{value:n,name:r}=e,{messages:i,messagesTemplates:a,viewModel:o,_inputsWithChanges:s}=this,[c,l,u]=t.map(e=>e.map(({name:e,value:t})=>Y(`calcite-combobox-item`,{heading:e,key:`#${t}`,selected:n===t,value:`${t}`}))),d=[];l.length>0&&d.push(Y(`calcite-combobox-item-group`,{key:`other`,label:a.other},l)),u.length>0&&d.push(Y(`calcite-combobox-item-group`,{key:`unsupported`,label:i.subtypes.unsupportedDomainGroupTitle},u)),d.length>0?d.unshift(Y(`calcite-combobox-item-group`,{key:`recommended`,label:i.recommended},c)):d.push(...c);let f=o.editType===`INSERT`,p=s.has(r),m=n==null&&(!f||p);return e.showNoValueOptionEnabled&&d.unshift(Y(`calcite-combobox-item`,{heading:e.showNoValueLabel||i.empty,key:`empty-option`,selected:m,value:``})),d}_renderRadioButtonComponents(e,t,n){let{value:r}=e,i=t.map(({name:e,value:t})=>this._renderRadioButtonComponent({key:e,label:e,value:t,selected:t===r,props:n}));if(e.showNoValueOptionEnabled){let t=e.showNoValueLabel||this.messages.empty,a=r===``||r===null;i.unshift(this._renderRadioButtonComponent({key:`empty-option`,label:t,value:``,selected:a,props:n}))}return Y(`calcite-radio-button-group`,{afterCreate:this._afterRadioGroupCreateOrUpdate,afterUpdate:this._afterRadioGroupCreateOrUpdate,class:y.inputRadioGroup,"data-field-name":n[Z],key:`${n.key}-radio-group`,layout:`vertical`,name:`${n.key}-${this.id}`,required:n.required},i)}_renderSwitchComponent(e,t){let{value:n}=e,r=D(e.element,`switch`)?n===e.element.input.onValue:!1;return Y(`calcite-switch`,{...t,checked:r,class:y.inputSwitch,disabled:t.readOnly,onblur:()=>{this._focusedFieldName=null},onCalciteSwitchChange:e=>this._saveValueFromComponent(e.currentTarget)})}_renderRadioButtonComponent({key:e,value:t,selected:n,label:r,props:i}){return Y(`calcite-label`,{class:y.inputRadioLabel,key:e,layout:`inline`},Y(`calcite-radio-button`,{...i,afterCreate:void 0,afterUpdate:void 0,checked:n,class:y.inputRadio,disabled:i.readOnly,value:t,onblur:()=>{this._focusedFieldName=null},onCalciteRadioButtonChange:({currentTarget:e})=>{e.checked&&this._saveValueFromComponent(e)}}),r)}_renderAuxiliaryText(e){let t=e.name,n=this._inputsWithChanges.has(t)&&!e.submittable?O(e,this.messages,this.timeZone):this.viewModel.contingencyConstraintViolations.get(t)==null?e.valueExpressionExecutor!=null&&e.valueExpressionExecutor.stale?this.messages.valueExpressionError:null:this.messages.validationErrors.valuesIncompatible;return n==null?this._inputsWithChanges.has(t)&&e.valueIsOutOfDomain?Y(`calcite-input-message`,{icon:!0,status:`idle`},this.messages.subtypes.fieldOutOfSubtypeDomainWarning):this._renderDescriptionOrEmpty(e.description):Y(`calcite-input-message`,{icon:!0,status:`invalid`},n)}_renderShowAllRelatedRecordsListItem(e){if(!e.showAllActionVisible||!this.callbacks?.showAllRelatedRecords)return;let n=this.messages;return Y(`calcite-list-item`,{description:t(n.totalCount,{count:e.featureCount}),key:`show-all-related-features`,label:n.showAll,value:!0,onCalciteListItemSelect:()=>this._onShowAllRelatedRecordsClick(e.relationshipId)},Y(`calcite-icon`,{icon:`list`,scale:`s`,slot:`content-end`}))}_renderAddRelatedRecordButton(e){let{canAddRelatedFeature:t,relationshipId:n,relatedLayer:r,editable:i}=e,{messages:a,callbacks:o,disabled:s}=this,c=!i||s;if(t&&o?.addRelatedRecord&&r&&!c)return Y(`calcite-button`,{alignment:`center`,appearance:`outline-fill`,class:y.centeredButton,disabled:e.updating||!e.originHasValidKey,iconStart:`plus`,key:`${n}-add-button`,round:!0,scale:`s`,width:`full`,onclick:()=>{!e.updating&&e.originHasValidKey&&this._onAddRelatedRecordsClick(e,n,r)}},e.relatedLayerIsTable?a.addRecord:a.addFeature)}_renderRelatedRecordListItem(e,t,n){let{feature:r,description:i,title:a}=e,{feature:o,callbacks:s}=this,{highlightHelper:c}=this.viewModel,l=()=>{c?.removeAll(),s?.editRelatedRecord&&o&&s.editRelatedRecord({parentFeature:o,relationshipId:t,relatedFeature:r,readOnly:n})},u=c?()=>c.add(r):void 0,d=c?()=>c.remove(r):void 0;return Y(`calcite-list-item`,{bind:this,description:i,key:`${t}-${r.uid}`,label:a,value:a,onCalciteListItemSelect:l,onmouseenter:u,onmouseleave:d},Y(`calcite-icon`,{icon:k(r),slot:`content-start`}),Y(`calcite-icon`,{flipRtl:!0,icon:`chevron-right`,scale:`s`,slot:`content-end`}))}_renderRelationshipInput(e){if(!this._relatedRecordsEnabled)return;let{relationshipId:t,activeCategory:n}=e,r=n?null:this._renderDescriptionOrEmpty(e.description);return Y(`calcite-label`,{class:this.classes(y.label,y.relatedRecordsLabel),key:`relationship-${t}-container`},Y(`div`,null,this._renderRelatedRecordsHeaderContainer(e),r,this._renderRelationshipInputContent(e)),this._renderAddRelatedRecordButton(e))}_renderRelationshipInputContent(e){if(e.featureCount>0)return this._renderRelatedRecordsList(e);if(e.activeCategory&&e.featureCount===0)return this._renderNoRelatedRecordsNotice();if(e.allCategories?.length)return this._renderCategoryList(e);if(e.loaded)return e.originHasValidKey?this._renderNoRelatedRecordsNotice():this._renderNoValidOriginKeyNotice(e)}_renderCategoryList(e){return Y(`calcite-list`,{displayMode:`flat`,label:this.messages.relatedRecordsList,loading:e.updating},e.categories?.map(t=>this._renderCategory(e,t)),this._renderShowAllCategoriesListItem(e))}_renderCategory(e,t){let{count:r,name:i,value:a}=t,o=n(r);return Y(`calcite-list-item`,{key:`${i}-${a}`,label:i,onCalciteListItemSelect:()=>this._selectCategory(e,t)},Y(`calcite-chip`,{label:o,scale:`s`,slot:`content-end`},o),Y(`calcite-icon`,{flipRtl:!0,icon:`chevron-right`,scale:`s`,slot:`content-end`}))}_selectCategory(e,t){this.relationshipId=e.relationshipId,e.activeCategory=t}_renderShowAllCategoriesListItem(e){if(!e.showAllCategoriesVisible)return;let n=this.messages;return Y(`calcite-list-item`,{description:t(n.totalCount,{count:e.allCategories?.length??0}),key:`show-all-categories`,label:n.showAll,value:!0,onCalciteListItemSelect:()=>e.showAllEnabled=!0},Y(`calcite-icon`,{icon:`list`,scale:`s`,slot:`content-end`}))}_renderRelatedRecordsHeaderContainer(e){let t=e.updating||!e.loaded;return Y(`div`,{class:y.relatedRecordsHeader,key:`relationship-${e.relationshipId}-header`},Y(`span`,null,e.label),t?Y(`calcite-loader`,{inline:!0,key:`loader`,label:this.messagesCommon?.loading,scale:`s`,type:`indeterminate`}):void 0)}_renderRelatedRecordsList(e){let{relationshipId:t,editable:n}=e,{disabled:r}=this,i=!n||r;return Y(`calcite-list`,{class:y.relatedRecordsList,label:this.messages?.relatedRecordsList},e.relatedFeatureInfos.map(e=>this._renderRelatedRecordListItem(e,t,i)),this._renderShowAllRelatedRecordsListItem(e),this._renderObserverNode())}_renderNoValidOriginKeyNotice(e){let{messages:n}=this,r=e.relatedLayerIsTable?n.noOriginKeyRecord:n.noOriginKeyFeature,i=e.relationship?.keyField,a=this.viewModel.findField(i),o=e.layer?.fieldsIndex.get(i),s=a?.label||o?.alias||i,c=t(r,{relatedLayerName:e.relatedLayer?.title,originKeyField:s});return Y(`calcite-notice`,{icon:`information`,kind:`brand`,open:!0,scale:`s`,width:`full`},Y(`div`,{slot:`message`},c))}_renderNoRelatedRecordsNotice(){return Y(`calcite-notice`,{icon:`information`,kind:`brand`,open:!0,scale:`s`,width:`full`},Y(`div`,{slot:`message`},this.messagesFeature.noRelatedFeatures))}_renderObserverNode(){if(this.viewModel.activeRelationshipInput?.showAllEnabled)return Y(`div`,{afterCreate:this._afterListObserverCreated,afterRemoved:this._afterListObserverRemoved,bind:this,class:y.listObserver,key:`feature-observer`})}_renderTextElementInput(e){return Y(`div`,{class:y.textElement,"data-testid":`text-element-${e.label}`,innerHTML:e.text,key:e.id})}getCommonInputProps(e){let{disabled:t}=this,{editable:n,hint:r,label:i,maxLength:a,minLength:o,name:s,range:{max:c,min:l},required:u,valid:d,value:f}=e,p=this._inputsWithChanges.has(s),m=!n||t;return{afterCreate:this._afterComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,"aria-invalid":d?`false`:`true`,class:this.classes(y.fieldInput,m?y.inputDisabled:null),status:p&&!d?`invalid`:`idle`,key:s,label:i,max:c??void 0,min:l??void 0,maxLength:a>-1?a:void 0,minLength:o>-1?o:void 0,placeholder:r??void 0,readOnly:m,required:u,value:f==null?``:`${f}`,onblur:this._onComponentBlur,onfocus:this._onComponentFocus,onkeydown:this._onComponentKeyDown,[Z]:s}}_getFieldInputFromHTMLElement(e){return this.viewModel.findField(e.getAttribute(Z))}_afterDateComponentCreate(e){let t=this._getFieldInputFromHTMLElement(e),n=e.dataset.datePart,r=this._dateComponentMap.get(t.name);if(`valueAsDate`in e&&e.value!=null&&t.value!=null){let n=new ResizeObserver(()=>{switch(e.value=void 0,t.field.type){case`date`:e.value=B(t.value,this.timeZone).date??``;break;case`timestamp-offset`:e.value=z(t.value,this.timeZone).date??``;break;default:e.value=`${t.value}`}n.unobserve(e)});n.observe(e)}if(r!=null)switch(n){case`date`:r.date=e;break;case`time`:r.time=e;break;case`timeZone`:r.timeZone=e}else this._dateComponentMap.set(t.name,{[n]:e});this._afterDateComponentCreateOrUpdate(e)}_afterDateComponentCreateOrUpdate(e){this._afterComponentCreateOrUpdate(e)}_afterComponentCreate(e){let t=this._getFieldInputFromHTMLElement(e);A(t)&&e.value!=null&&`setNumberValue`in e&&e.setNumberValue({committing:!1,value:e.value,origin:`direct`}),this._afterComponentCreateOrUpdate(e)}_afterRadioGroupCreateOrUpdate(e){let t=e.selectedItem,n=e.querySelector(`calcite-radio-button`),r=t||n;r&&this._afterComponentCreateOrUpdate(r)}_afterComponentCreateOrUpdate(e){let{viewModel:t}=this,n=this._getFieldInputFromHTMLElement(e),r=t.findField(this._focusedFieldName);this._attemptFocusOnNextRender&&r===n&&(this._attemptFocusOnNextRender=!1,E(n)&&(n.group.open=!0),X(e))}async _afterGroupCreate(e){let t=this.viewModel.findGroup(e.id),n=this.viewModel.findField(this._focusedFieldName);n&&t&&j(n,t)&&(!n.editable||this.disabled)&&(await e.componentOnReady(),this._attemptFocusOnNextRender=!0,this.scheduleRender())}_onComponentFocus(e){let t=e.target,n=this._getFieldInputFromHTMLElement(t);this._focusedFieldName=n.name}_onComponentBlur(e){let t=e.target;this._focusedFieldName=null,`readOnly`in t&&t.readOnly||this._saveValueFromComponent(t)}_saveValueFromDateComponent(e){let{timeZone:t}=this,n=this._getFieldInputFromHTMLElement(e),r=n.field.type,{name:i,range:a}=n,o=this._dateComponentMap.get(i);if(!o)return;let s=this.viewModel.getValue(i),c=null;r===`date-only`?c=Array.isArray(e.value)?e.value[0]:e.value:r===`time-only`?(s=V(s),c=V(e.value)):c=r===`timestamp-offset`?e.value==null?null:H({dateComponent:o.date,timeComponent:o.time,timeZoneComponent:o.timeZone,oldValue:s,defaultTimeZone:t}):e.value==null?null:U({oldValue:s,dateComponent:o.date,timeComponent:o.time,timeZone:t,max:a.max,min:a.min}),c===null||!e.value?this._updateFieldValue(i,null):s!==c&&this._updateFieldValue(i,c)}_saveValueFromComponent(e){let t=this._getFieldInputFromHTMLElement(e),n=this._parseValue(e),r=t.value;!t.isSubtypeField||!M(this.layer,r,n)?this._updateFieldValue(t.name,n):!this._pendingSubtypeChoice&&n!==r&&(this._pendingSubtypeChoice=this._handleSubtypeChoice(t,n))}async _handleSubtypeChoice(e,n){let{value:r,name:i}=e,{messages:a,viewModel:o,messagesCommon:s,_subtypes:c}=this;if(this._updateFieldValue(i,n),!c?.length)return;let l=c.find(e=>e.code===n),u=c.find(e=>e.code===r)?.name??`${r}`;if(!l)return;let d=Promise.withResolvers();o.pendingSubtypeChoice=d;let f=`update-fields`,p=[{label:a.subtypes.useDefaultValuesOption,value:`update-fields`},{label:a.subtypes.keepCurrentValuesOption,value:`keep-existing`}],m={context:`info`,title:a.subtypes.changeWarningTitle,message:t(a.subtypes.changeWarning,{originalType:u,newType:l.name}),radios:p,defaultRadioSelection:`update-fields`,onRadioSelection:e=>f=e,actions:{primary:{label:s.apply,action:()=>d.resolve(f),type:`positive`},secondary:{label:s.cancel,type:`neutral`,action:()=>d.resolve(`undo`)}},cancel:()=>d.reject()};try{switch(this.showPrompt(m),await d.promise){case`update-fields`:o.applySubtypeDefaults(l),this._validateContingenciesForNonNullFields();break;case`keep-existing`:this._validateContingenciesForNonNullFields();break;case`undo`:this._updateFieldValue(e.name,r)}}finally{o.pendingSubtypeChoice=null,this.clearPrompt(),this._pendingSubtypeChoice=null}}_onComponentKeyDown({key:e,target:t}){let n=this._getFieldInputFromHTMLElement(t);e===`Enter`&&E(n)&&!n.group.open&&(n.group.open=!0)}_updateFieldValue(e,t){let n=this.viewModel.getValue(e);this.viewModel.setValue(e,t),this._inputsWithChanges.add(e),n!==t&&this.viewModel.fieldsWithContingentValues.has(e)&&this._validateContingenciesForNonNullFields()}_validateContingenciesForNonNullFields(){let e=Object.fromEntries(Object.entries(this.getValues()).filter(([e,t])=>t!=null));this.viewModel.validateContingencyConstraints(e)}_parseValue(e){let t=this._getFieldInputFromHTMLElement(e),n=e.value;return D(t.element,`switch`)?e.checked?t.element.input.onValue:t.element.input.offValue:n==null||n===``?null:t.dataType===`number`?n===`-0`||n===`-0.`||n===`-0,`?n:parseFloat(n):t.field.type===`date`?parseFloat(n):n}_ignoreDeselectionOfNoValueOption(e){let{firstChild:t,selectedItems:n}=e;n.length===0&&t&&`selected`in t?t.selected=!0:a.getLogger(this).warnOnce(`Failed to override user attempt to deselect 'No value' option.`)}_onGroupToggle(e,t){e.expanded?(t.open=!0,this._focusedFieldName=this._getFocusableInput(`forward`,t)?.name||null,this._attemptFocusOnNextRender=!0,this.groupDisplay===`sequential`&&this.viewModel.allGroupInputs.forEach(e=>{e!==t&&(e.open=!1)})):t.open=!1,this.scheduleRender()}_onFormSubmit(e){e.preventDefault()}_onFormKeyDown(e){e.key===`Enter`&&this.viewModel.submit()}_afterListObserverCreated(e){this.viewModel.activeRelationshipInput&&(this._listObserverNode=e)}_afterListObserverRemoved(){this._listObserverNode=null}_onObserverChange(){this._listObserverNode&&this._listObserver.unobserve(this._listObserverNode);let e=this.viewModel.activeRelationshipInput;e&&this._listObserverNode&&e.showAllEnabled&&this._listObserver.observe(this._listObserverNode)}_incrementRelatedRecordPage(){this.viewModel.activeRelationshipInput?.incrementPage()}_syncGroupInputStates(){if(this.groupDisplay!==`sequential`)return;let e=this.viewModel.allGroupInputs;if(!e.length)return;let t=e.filter(e=>e.open);t.length===0?e[0].open=!0:t.length>1&&t.slice(1).forEach(e=>e.open=!1)}get test(){return{inputsWithChanges:this._inputsWithChanges,updateValue:this._saveValueFromComponent.bind(this)}}};e([u()],Q.prototype,`_listObserverNode`,void 0),e([u()],Q.prototype,`_relatedRecordsEnabled`,null),e([u()],Q.prototype,`_utilityNetworkAssociationsEnabled`,null),e([u()],Q.prototype,`_prompt`,void 0),e([u()],Q.prototype,`_subtypes`,null),e([u()],Q.prototype,`associationId`,null),e([u()],Q.prototype,`associatedLayer`,null),e([u()],Q.prototype,`disabled`,null),e([u()],Q.prototype,`feature`,null),e([u()],Q.prototype,`_featureFormUNAssociationList`,void 0),e([u()],Q.prototype,`formTemplate`,null),e([u()],Q.prototype,`groupDisplay`,void 0),e([u()],Q.prototype,`headingLevel`,void 0),e([u()],Q.prototype,`icon`,null),e([u()],Q.prototype,`label`,null),e([u()],Q.prototype,`layer`,null),e([u()],Q.prototype,`map`,null),e([u(),q(`esri/widgets/FeatureForm/t9n/FeatureForm`)],Q.prototype,`messages`,void 0),e([u(),q(`esri/t9n/common`)],Q.prototype,`messagesCommon`,void 0),e([u(),q(`esri/widgets/Feature/t9n/Feature`)],Q.prototype,`messagesFeature`,void 0),e([u(),q(`esri/widgets/FeatureTemplates/t9n/FeatureTemplates`)],Q.prototype,`messagesTemplates`,void 0),e([u()],Q.prototype,`callbacks`,null),e([u()],Q.prototype,`relationshipId`,null),e([u()],Q.prototype,`spatialReference`,null),e([u()],Q.prototype,`strict`,null),e([u()],Q.prototype,`timeZone`,null),e([u()],Q.prototype,`showPrompt`,null),e([u()],Q.prototype,`clearPrompt`,null),e([u({type:N}),J([`value-change`,`submit`])],Q.prototype,`viewModel`,void 0),e([u({type:P,nonNullable:!0})],Q.prototype,`visibleElements`,void 0),e([u()],Q.prototype,`test`,null),Q=e([d(`esri.widgets.FeatureForm`)],Q);const $=Q;export{$ as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import"../../core/has.js";import t from"../../core/Logger.js";import{on as n,sync as r}from"../../core/reactiveUtils.js";import{property as i,subclass as a}from"../../core/accessorSupport/decorators.js";import{getEffectiveFieldAlias as o}from"../../editing/fieldUtils.js";import{convertDateFormatToIntlOptions as s,defaultFormatterOptionsNoTime as c,convertDateTimeFieldFormatToIntlOptions as l,defaultFormatterOptions as u}from"../../intl/date.js";import{formatNumber as d,convertNumberFormatToIntlOptions as f,convertNumberFieldFormatToIntlOptions as p}from"../../intl/number.js";import{isEditableLayer as m}from"../../layers/support/editableLayers.js";import{computeDomainFromTypes as h}from"../../layers/support/featureLayerUtils.js";import g from"../../layers/support/Field.js";import{defaultFieldFormat as _}from"../../layers/support/fieldFormatUtils.js";import{validateFieldValue as v,isDateField as y,isTimeOnlyField as b,isIntegerField as x,isNumericField as S,isStringField as C,isDateOnlyField as w,isTimestampOffsetField as T}from"../../layers/support/fieldUtils.js";import{isAnyDateField as E}from"../../smartMapping/support/utils.js";import{system as D}from"../../time/constants.js";import{getTimeZoneFormattingOptions as O}from"../../time/timeZoneUtils.js";import k from"../FeatureForm/FieldInput.js";import A from"./Grid/EditorColumn.js";import{isIFeatureTableSupportedLayerWithFieldConfigurations as j,isEmptyStringOrWhitespace as M}from"./support/tableUtils.js";import{valueIsInRange as N,dateTimeIsInRange as P,getUnixFieldValueFromDateComponents as F,getISOFieldValueFromDateComponents as I,normalizeTimeOnlyString as L,getLabelForDateFieldValue as R,prepareISOFieldValueForDateComponents as z,prepareUnixFieldValueForDateComponents as B}from"../support/dateUtils.js";import{setFocus as V,selectText as H}from"../support/widgetUtils.js";const U={cancelEdit:`Escape`},W=Symbol(),G=`esri-column`,K={input:`${G}__cell-input`,inputContainer:`${G}__cell__input-container`};let q=class extends A{constructor(e){super(e),this._activeFieldInput=null,this.cellValueFormatFunction=({root:e,rowData:t,value:n})=>{let{formatFunction:r}=this;if(r&&t){let{index:i,item:{attachments:a,feature:o,relatedRecords:s}}=t;return r({attachments:a,column:this,feature:o,field:this.field,index:i,relatedRecords:s,value:this.sanitizeContent(n),virtualIndex:this.getVirtualRowIndex(e)})}if(n===null)return`&nbsp;`;let i=this._getDomainForFeature(t?.item?.feature),a=this._getComputedDomain(n,i)||n;return this._isAnyDateOrTimeField&&i?.type!==`coded-value`?this._formatDateValueForDisplay(this.field,a):this._isNumericField&&i?.type!==`coded-value`?d(parseFloat(a),this._numberFormatOptions):this.sanitizeContent(a)},this.cellValueValidatorFunction=({oldValue:e,value:n})=>{let{_effectiveRange:r,field:i}=this,{max:a,min:o}=r;if(this.effectiveRequired&&(n==null||n===``))return!1;if(this._isNumericField&&(v(i,n)||!N({max:a,min:o,value:n})))return t.getLogger(this).warn(`value-exceeds-valid-range`,`Field value exceeds valid range. Attempted edit was rejected.`),!1;if(this._isAnyDateOrTimeField){let e=i.type;if(!P({type:e,range:r,value:n}))return!1}return e!==n},this.field=null,this.formatFunction=null,this.inputRenderFunction=async({root:e,column:n,rowData:r})=>{if(this.editInfo||!this.effectiveEditable||!r)return;let i=r.item.feature,a=i.getObjectId();if(!i||a==null)return;if(this.tableHasInvalidPendingEdits&&!this.itemHasInvalidPendingEdits(a)){t.getLogger(this).warn(`editing-disabled:fix-invalid-pending-edits`,`Editing is disabled for this row. Table has existing invalid pending edits that must be addressed.`);return}let o=this.getCellValue(r),{field:s}=this;if(s.type===`big-integer`&&v(s,o)){t.getLogger(this).warn(`value-exceeds-valid-range`,`Field value is beyond supported limit. Editing is disabled for this field value.`);return}this._activeFieldInput=this._setUpFieldInput(i,o);let c=document.createElement(`div`);c.classList.add(K.inputContainer);let l=[],u=this._effectiveDomain?.type===`coded-value`;if(this._isAnyDateOrTimeField&&!u){let e=document.createElement(`div`),t=this._setUpDateComponents(o),n=this._setUpDateActionBar();t.forEach(t=>e.appendChild(t)),c.appendChild(e),c.appendChild(n),l.push(...t)}else{let e=this.createInputElement({rowData:r,value:o});c.appendChild(e),l.push(e)}this._set(`editInfo`,{column:n,inputs:l,root:e,rowData:r,oldValue:o}),this.removeCellContent(e),e.appendChild(c),this._syncRowEditingState(e,!0),this.grid?.generateCellPartNames();let d=l[0];await V(d),await H(d)},this.layer=null,this.parseInputValueFunction=({inputs:e})=>{let{editInfo:t,field:n,includeTime:r}=this;if(!t||!e.length)return null;let i=e[0];if(this._isAnyDateOrTimeField){if(this._effectiveDomain?.type===`coded-value`){if(i.value==null||i.value===``)return null;let e=String(i.value);return y(n)?parseFloat(e):e}let{timeZone:a}=this.effectiveTimeZoneOptions,o=t.oldValue??void 0;switch(n.type){case`date-only`:{let e=i.value;return e===``?null:e}case`time-only`:{let e=L(i.value);return e===``?null:e}case`timestamp-offset`:{let t=r?e[1]:void 0,n=e.at(-1);return I({oldValue:o,dateComponent:i,timeComponent:t,timeZoneComponent:n,defaultTimeZone:a})}case`date`:{let{max:t,min:n}=this._effectiveRange;return F({oldValue:o,dateComponent:i,timeComponent:e[1],timeZone:a,max:t,min:n})}}return null}let a=i.value,{effectiveRequired:o}=this;return!o&&(a==null||a===``)?null:this._isNumericField?parseFloat(a):this._isStringField?a.trim():a},this.sortable=!0,this.store=null,this.template=null,this.view=null}get _effectiveDomain(){let e=this._activeFieldInput?.feature;return e?this._getDomainForFeature(e):null}get _effectiveRange(){return this._activeFieldInput?.range??{max:null,min:null}}get _isAnyDateOrTimeField(){let{field:e}=this;return E(e)||b(e)}get _isIntegerField(){return x(this.field)}get _isNumericField(){return S(this.field)}get _isStringField(){return C(this.field)}get _isSubtypeField(){let{layer:e}=this;if(e?.subtypeField){let{subtypeField:t,fieldsIndex:n}=e;return(n.get(t)?.name??t)===this.fieldName}return!1}get _layerWithFieldConfigurations(){let{layer:e}=this;return j(e)?e:null}get _dateTimeFormatOptions(){let{layerFieldConfigurationFormat:e,template:t}=this;if(t?.format?.dateFormat)return s(t.format.dateFormat);if(t?.input&&`includeTime`in t.input&&t.input.includeTime===!1)return c;if(e?.type===`date-time`)return l(e);if(this._isAnyDateOrTimeField)return u}get _numberFormatOptions(){let{layerFieldConfigurationFormat:e,template:t}=this;if(t?.format)return f(t.format);if(e?.type===`number`)return p(e);if(this._isNumericField)return{useGrouping:!0,maximumFractionDigits:20}}get alias(){return o(this.field,this._layerWithFieldConfigurations)}get defaultValue(){return this.field?.defaultValue}get effectiveDescription(){let{description:e,field:t}=this,n=t.description,r=M(e)?M(n)?null:n:e;return r==null?null:this.sanitizeLabel(r)}get effectiveEditable(){let{editable:e,field:t,layer:n,tableEditingEnabled:r}=this;if(!t||!n)return!1;let i=m(n),a=(n.effectiveCapabilities??n.capabilities)?.operations?.supportsUpdate;return!t.editable||!i||!a||t.type===`oid`||!r?!1:e}get effectiveLabel(){return this.sanitizeLabel(this.label||this.alias||this.fieldName)}get effectiveRequired(){return!this.nullable||this._isSubtypeField||this._activeFieldInput?.required||this.required}get effectiveSortable(){return!!(this.layer?.capabilities?.query?.supportsOrderBy&&this.sortable)}get effectiveTimeZoneOptions(){let{layer:e,field:t}=this;if(!e||t?.type!==`date`&&t?.type!==`timestamp-offset`)return{timeZone:void 0,timeZoneName:void 0};let{tableTimeZone:n,timeZone:r,view:i}=this;return O(e.preferredTimeZone||null,!!e.datesInUnknownTimezone,r??n??i?.timeZone??D,this._dateTimeFormatOptions??u,t.type)}get includeTime(){let{field:e,template:t}=this;return e.type===`time-only`?!0:e.type===`date-only`?!1:!t?.input||`includeTime`in t.input&&t.input.includeTime!==!1}get hasContingentValues(){return!!this.store.fieldsWithContingentValues.has(this.fieldName)}get layerFieldConfigurationFormat(){let{_layerWithFieldConfigurations:e}=this;if(e)return e.getFieldConfiguration(this.fieldName)?.fieldFormat??_(this.field)}get maxLength(){let{field:e,template:t}=this,n=e?.length??-1,r=t?.input&&`maxLength`in t.input?t.input.maxLength:null;return r!=null&&!isNaN(r)&&r>=-1&&(n===-1||r<=n)?r:n}get minLength(){let{template:e,maxLength:t}=this,n=e?.input&&`minLength`in e.input?e.input.minLength:null;return t&&n<=t?n:null}get name(){return this.field?.name}get nullable(){return this.field.nullable!==!1}get shouldShowPrompt(){return this._isSubtypeField}createInputElement({rowData:e,value:t}){let{_effectiveDomain:i,maxLength:a,minLength:o,effectiveRequired:s}=this,c;if(i?.type===`coded-value`){let i=e.item.feature,a=this.getFieldValueOptions(i,this.fieldName);this.hasContingentValues?(c=this._setUpComboboxComponent(a,t),this.addHandles([n(()=>c,`calciteComboboxChange`,()=>this.onInputBlur(),r),n(()=>c,`pointerdown`,e=>e.preventDefault(),r)],W)):(c=this.createCalciteSelect(t,a.recommended),this.addHandles(n(()=>c,`calciteSelectChange`,()=>this.onInputBlur(),r),W))}else{if(this._isNumericField){let{_effectiveRange:{max:e,min:n}}=this;c=document.createElement(`calcite-input`),c.type=`number`,this._isIntegerField&&(c.step=1),e!=null&&(c.max=e),n!=null&&(c.min=n),c.status=N({max:e,min:n,value:t})?`idle`:`invalid`}else c=document.createElement(`calcite-input`),this.addHandles(n(()=>c,`calciteInputChange`,()=>this.onInputBlur(),r),W),a>-1&&(c.maxLength=a),o>0&&(c.minLength=o);c.value=t==null?``:t.toString()}return c.classList.add(K.input),c.required=s,this.addHandles([n(()=>c,`keydown`,e=>{e.key===U.cancelEdit&&this.onInputBlur(!0)},r),n(()=>c,`blur`,()=>this.onInputBlur(),r)],W),c}onInputBlur(e=!1){this.removeHandles(W),super.onInputBlur(e)}onEditComplete(){let e=this.editInfo?.root;e&&this._syncRowEditingState(e,!1),this._activeFieldInput=null,super.onEditComplete()}get test(){}_clearActiveEditValues(){this.editInfo?.inputs?.forEach(e=>e.value=``)}_setUpDateActionBar(){let{messagesCommon:e}=this,t=e?.cancel??``,n=e?.clear??``,r=e?.save??``,i=document.createElement(`calcite-action-bar`);return i.expandDisabled=!0,i.layout=`horizontal`,i.appendChild(this.createCalciteAction({text:r,icon:`save`,onclick:()=>this.submit()})),this.effectiveRequired||i.appendChild(this.createCalciteAction({text:n,icon:`trash`,onclick:()=>{this._clearActiveEditValues(),this.submit()}})),i.appendChild(this.createCalciteAction({text:t,icon:`x`,onclick:()=>this.cancel()})),i}_formatDateValueForDisplay(e,t){let{timeZone:n,timeZoneName:r}=this.effectiveTimeZoneOptions;return t==null?null:R(e,t,{...this._dateTimeFormatOptions,timeZone:n,timeZoneName:r})}_fieldValueOptionToComboboxItem({disabled:e,name:t,value:n},r){let i=r===n||r==null&&n===``;return this.createCalciteComboboxItem({disabled:e,heading:t,selected:i,value:n})}_setUpComboboxComponent(e,t){let{recommended:n,other:r,unsupported:i}=e,a=this.effectiveRequired,o=this.messages,s=this.createCalciteCombobox({label:this.effectiveLabel,required:a}),c=n.map(e=>this._fieldValueOptionToComboboxItem(e,t));if(!a||t==null||t===``){let e=this._fieldValueOptionToComboboxItem({disabled:a,name:o?.noValue,value:``},t);s.appendChild(e)}if(r.length===0&&i.length===0)return c.forEach(e=>s.appendChild(e)),s;let l=this.createCalciteComboboxItemGroup({label:o.contingentValues.recommended});if(c.forEach(e=>l.appendChild(e)),s.appendChild(l),r.length){let e=this.createCalciteComboboxItemGroup({label:o.contingentValues.other});r.forEach(n=>e.appendChild(this._fieldValueOptionToComboboxItem(n,t))),s.appendChild(e)}if(i.length){let e=this.createCalciteComboboxItemGroup({label:o.subtypes.unsupportedDomainGroupTitle});i.forEach(n=>e.appendChild(this._fieldValueOptionToComboboxItem(n,t))),s.appendChild(e)}return s}_setUpDateComponents(e){let{_effectiveRange:{max:t,min:r,rawMax:i,rawMin:a},field:o,effectiveRequired:s}=this,c=this._getDateFieldValuesForComponents(o,e),l=[];if(E(o)){let e=this.createDateComponent(),u=w(o)||T(o)?i:t,d=w(o)||T(o)?a:r,f=this._getDateFieldValuesForComponents(o,u??null),p=this._getDateFieldValuesForComponents(o,d??null);e.value=c.date??``,e.max=f.date??``,e.min=p.date??``,e.required=s,this.addHandles([n(()=>e,`calciteInputDatePickerOpen`,()=>this._onDateComponentOpen(e))],W),l.push(e)}if(this.includeTime){let e=this.createTimeComponent();e.value=c.time??``,e.required=s,this.addHandles([n(()=>e,`calciteInputTimePickerOpen`,()=>this._onDateComponentOpen(e))],W),l.push(e)}if(o.type===`timestamp-offset`){let e=this.createTimeZoneComponent();e.value=c.timeZoneOffset??`0`,this.addHandles([n(()=>e,`calciteInputTimeZoneOpen`,()=>this._onDateComponentOpen(e))],W),l.push(e)}return l}_onDateComponentOpen(e){this.editInfo?.inputs.forEach(t=>{t!==e&&`open`in t&&(t.open=!1)})}_syncRowEditingState(e,t=!1){let n=this.grid?.getRowContainingNode(e);n&&(t?n.setAttribute(`editing`,`true`):n.removeAttribute(`editing`))}_getDateFieldValuesForComponents(e,t){switch(e.type){case`date`:return B(t,this.effectiveTimeZoneOptions.timeZone);case`date-only`:return{date:t};case`time-only`:return{time:t};case`timestamp-offset`:return z(t);default:return{}}}_setUpFieldInput(e,t){let{field:n,layer:r,effectiveTimeZoneOptions:{timeZone:i}}=this,a=new k({feature:e,field:n,initialFeature:e.clone(),layer:r,timeZone:i});return a.set(`value`,t),a}_isDomainCompatible(e){if(!e)return!1;let{_isNumericField:t,_isStringField:n}=this,{type:r}=e;if(r===`coded-value`){let r=typeof e.codedValues[0].code;if(r===`string`&&n||r===`number`&&t)return!0}return!!(r===`range`&&t)}_getDomainForFeature(e){let{fieldName:t,layer:n,template:r}=this;if(!e||!n?.getFieldDomain||n.type===`wfs`||n.type===`geojson`||n.type===`csv`)return null;if(r?.domain&&this._isDomainCompatible(r.domain))return r.domain;if(n.type!==`feature`&&n.type!==`subtype-group`&&n.getField(t)?.domain==null){let e=h(n,t);if(e)return e}return n.getFieldDomain(t,{feature:e})}_getComputedDomain(e,t){if(!t)return null;if(t.type===`range`)return e;if(t.type===`coded-value`){let n=t.codedValues.filter(t=>t.hasOwnProperty(`code`)&&t.code===e);return n&&n.length?n[0].name:e}return null}getFieldValueOptions(e,t){return this.store.getFieldValueOptions({feature:e,fieldName:t,layer:this.layer,emptyString:this.messages?.noValue})}};e([i()],q.prototype,`_effectiveDomain`,null),e([i()],q.prototype,`_activeFieldInput`,void 0),e([i()],q.prototype,`_effectiveRange`,null),e([i()],q.prototype,`_isAnyDateOrTimeField`,null),e([i()],q.prototype,`_isIntegerField`,null),e([i()],q.prototype,`_isNumericField`,null),e([i()],q.prototype,`_isStringField`,null),e([i()],q.prototype,`_isSubtypeField`,null),e([i()],q.prototype,`_layerWithFieldConfigurations`,null),e([i()],q.prototype,`_dateTimeFormatOptions`,null),e([i()],q.prototype,`_numberFormatOptions`,null),e([i({readOnly:!0})],q.prototype,`alias`,null),e([i()],q.prototype,`cellValueFormatFunction`,void 0),e([i()],q.prototype,`cellValueValidatorFunction`,void 0),e([i({readOnly:!0})],q.prototype,`defaultValue`,null),e([i()],q.prototype,`effectiveDescription`,null),e([i()],q.prototype,`effectiveEditable`,null),e([i()],q.prototype,`effectiveLabel`,null),e([i()],q.prototype,`effectiveRequired`,null),e([i()],q.prototype,`effectiveSortable`,null),e([i()],q.prototype,`effectiveTimeZoneOptions`,null),e([i({type:g})],q.prototype,`field`,void 0),e([i()],q.prototype,`formatFunction`,void 0),e([i()],q.prototype,`includeTime`,null),e([i()],q.prototype,`inputRenderFunction`,void 0),e([i()],q.prototype,`hasContingentValues`,null),e([i()],q.prototype,`layer`,void 0),e([i()],q.prototype,`layerFieldConfigurationFormat`,null),e([i()],q.prototype,`maxLength`,null),e([i()],q.prototype,`minLength`,null),e([i({readOnly:!0})],q.prototype,`name`,null),e([i({readOnly:!0})],q.prototype,`nullable`,null),e([i()],q.prototype,`parseInputValueFunction`,void 0),e([i()],q.prototype,`shouldShowPrompt`,null),e([i()],q.prototype,`sortable`,void 0),e([i()],q.prototype,`store`,void 0),e([i()],q.prototype,`template`,void 0),e([i()],q.prototype,`view`,void 0),q=e([a(`esri.widgets.FeatureTable.FieldColumn`)],q);const J=q;export{J as default};
2
+ import{__decorate as e}from"tslib";import"../../core/has.js";import t from"../../core/Logger.js";import{on as n,sync as r}from"../../core/reactiveUtils.js";import{property as i,subclass as a}from"../../core/accessorSupport/decorators.js";import{getEffectiveFieldAlias as o}from"../../editing/fieldUtils.js";import{convertDateFormatToIntlOptions as s,defaultFormatterOptionsNoTime as c,convertDateTimeFieldFormatToIntlOptions as l,defaultFormatterOptions as u}from"../../intl/date.js";import{formatNumber as d,convertNumberFormatToIntlOptions as f,convertNumberFieldFormatToIntlOptions as p}from"../../intl/number.js";import{isEditableLayer as m}from"../../layers/support/editableLayers.js";import{computeDomainFromTypes as h}from"../../layers/support/featureLayerUtils.js";import g from"../../layers/support/Field.js";import{defaultFieldFormat as _}from"../../layers/support/fieldFormatUtils.js";import{validateFieldValue as v,isDateField as y,isTimeOnlyField as b,isIntegerField as x,isNumericField as S,isStringField as C,isDateOnlyField as w,isTimestampOffsetField as T}from"../../layers/support/fieldUtils.js";import{isAnyDateField as E}from"../../smartMapping/support/utils.js";import{system as D}from"../../time/constants.js";import{getTimeZoneFormattingOptions as O}from"../../time/timeZoneUtils.js";import k from"../FeatureForm/FieldInput.js";import A from"./Grid/EditorColumn.js";import{isIFeatureTableSupportedLayerWithFieldConfigurations as j,isEmptyStringOrWhitespace as M}from"./support/tableUtils.js";import{valueIsInRange as N,dateTimeIsInRange as P,getUnixFieldValueFromDateComponents as F,getISOFieldValueFromDateComponents as I,normalizeTimeOnlyString as L,getLabelForDateFieldValue as R,prepareISOFieldValueForDateComponents as z,prepareUnixFieldValueForDateComponents as B}from"../support/dateUtils.js";import{setFocus as V,selectText as H}from"../support/widgetUtils.js";const U={cancelEdit:`Escape`},W=Symbol(),G=`esri-column`,K={input:`${G}__cell-input`,inputContainer:`${G}__cell__input-container`};let q=class extends A{constructor(e){super(e),this._activeFieldInput=null,this.cellValueFormatFunction=({root:e,rowData:t,value:n})=>{let{formatFunction:r}=this;if(r&&t){let{index:i,item:{attachments:a,feature:o,relatedRecords:s}}=t;return r({attachments:a,column:this,feature:o,field:this.field,index:i,relatedRecords:s,value:this.sanitizeContent(n),virtualIndex:this.getVirtualRowIndex(e)})}if(n===null)return`&nbsp;`;let i=this._getDomainForFeature(t?.item?.feature),a=this._getComputedDomain(n,i)||n;return this._isAnyDateOrTimeField&&i?.type!==`coded-value`?this._formatDateValueForDisplay(this.field,a):this._isNumericField&&i?.type!==`coded-value`?d(parseFloat(a),this._numberFormatOptions):this.sanitizeContent(a)},this.cellValueValidatorFunction=({oldValue:e,value:n})=>{let{_effectiveRange:r,field:i}=this,{max:a,min:o}=r;if(this.effectiveRequired&&(n==null||n===``))return!1;if(this._isNumericField&&(v(i,n)||!N({max:a,min:o,value:n})))return t.getLogger(this).warn(`value-exceeds-valid-range`,`Field value exceeds valid range. Attempted edit was rejected.`),!1;if(this._isAnyDateOrTimeField){let e=i.type;if(!P({type:e,range:r,value:n}))return!1}return e!==n},this.field=null,this.formatFunction=null,this.inputRenderFunction=async({root:e,column:n,rowData:r})=>{if(this.editInfo||!this.effectiveEditable||!r)return;let i=r.item.feature,a=i.getObjectId();if(!i||a==null)return;if(this.tableHasInvalidPendingEdits&&!this.itemHasInvalidPendingEdits(a)){t.getLogger(this).warn(`editing-disabled:fix-invalid-pending-edits`,`Editing is disabled for this row. Table has existing invalid pending edits that must be addressed.`);return}let o=this.getCellValue(r),{field:s}=this;if(s.type===`big-integer`&&v(s,o)){t.getLogger(this).warn(`value-exceeds-valid-range`,`Field value is beyond supported limit. Editing is disabled for this field value.`);return}this._activeFieldInput=this._setUpFieldInput(i,o);let c=document.createElement(`div`);c.classList.add(K.inputContainer);let l=[],u=this._effectiveDomain?.type===`coded-value`;if(this._isAnyDateOrTimeField&&!u){let e=document.createElement(`div`),t=this._setUpDateComponents(o),n=this._setUpDateActionBar();t.forEach(t=>e.appendChild(t)),c.appendChild(e),c.appendChild(n),l.push(...t)}else{let e=this.createInputElement({rowData:r,value:o});c.appendChild(e),l.push(e)}this._set(`editInfo`,{column:n,inputs:l,root:e,rowData:r,oldValue:o}),this.removeCellContent(e),e.appendChild(c),this._syncRowEditingState(e,!0),this.grid?.generateCellPartNames();let d=l[0];await V(d),await H(d)},this.layer=null,this.parseInputValueFunction=({inputs:e})=>{let{editInfo:t,field:n,includeTime:r}=this;if(!t||!e.length)return null;let i=e[0];if(this._isAnyDateOrTimeField){if(this._effectiveDomain?.type===`coded-value`){if(i.value==null||i.value===``)return null;let e=String(i.value);return y(n)?parseFloat(e):e}let{timeZone:a}=this.effectiveTimeZoneOptions,o=t.oldValue??void 0;switch(n.type){case`date-only`:{let e=i.value;return e===``?null:e}case`time-only`:{let e=L(i.value);return e===``?null:e}case`timestamp-offset`:{let t=r?e[1]:void 0,n=e.at(-1);return I({oldValue:o,dateComponent:i,timeComponent:t,timeZoneComponent:n,defaultTimeZone:a})}case`date`:{let{max:t,min:n}=this._effectiveRange;return F({oldValue:o,dateComponent:i,timeComponent:e[1],timeZone:a,max:t,min:n})}}return null}let a=i.value,{effectiveRequired:o}=this;return!o&&(a==null||a===``)?null:this._isNumericField?parseFloat(a):this._isStringField?a.trim():a},this.sortable=!0,this.store=null,this.template=null,this.view=null}get _effectiveDomain(){let e=this._activeFieldInput?.feature;return e?this._getDomainForFeature(e):null}get _effectiveRange(){return this._activeFieldInput?.range??{max:null,min:null}}get _isAnyDateOrTimeField(){let{field:e}=this;return E(e)||b(e)}get _isIntegerField(){return x(this.field)}get _isNumericField(){return S(this.field)}get _isStringField(){return C(this.field)}get _isSubtypeField(){let{layer:e}=this;if(e?.subtypeField){let{subtypeField:t,fieldsIndex:n}=e;return(n.get(t)?.name??t)===this.fieldName}return!1}get _layerWithFieldConfigurations(){let{layer:e}=this;return j(e)?e:null}get _dateTimeFormatOptions(){let{layerFieldConfigurationFormat:e,template:t}=this;if(t?.format?.dateFormat)return s(t.format.dateFormat);if(t?.input&&`includeTime`in t.input&&t.input.includeTime===!1)return c;if(e?.type===`date-time`)return l(e);if(this._isAnyDateOrTimeField)return u}get _numberFormatOptions(){let{layerFieldConfigurationFormat:e,template:t}=this;if(t?.format)return f(t.format);if(e?.type===`number`)return p(e);if(this._isNumericField)return{useGrouping:!0,maximumFractionDigits:20}}get alias(){return o(this.field,this._layerWithFieldConfigurations)}get defaultValue(){return this.field?.defaultValue}get effectiveDescription(){let{description:e,field:t}=this,n=t.description,r=M(e)?M(n)?null:n:e;return r==null?null:this.sanitizeLabel(r)}get effectiveEditable(){let{editable:e,field:t,layer:n,tableEditingEnabled:r}=this;if(!t||!n)return!1;let i=m(n),a=(n.effectiveCapabilities??n.capabilities)?.operations?.supportsUpdate;return!t.editable||!i||!a||t.type===`oid`||!r?!1:e}get effectiveLabel(){return this.sanitizeLabel(this.label||this.alias||this.fieldName)}get effectiveRequired(){return!this.nullable||this._isSubtypeField||this._activeFieldInput?.required||this.required}get effectiveSortable(){return!!(this.layer?.capabilities?.query?.supportsOrderBy&&this.sortable)}get effectiveTimeZoneOptions(){let{layer:e,field:t}=this;if(!e||t?.type!==`date`&&t?.type!==`timestamp-offset`)return{timeZone:void 0,timeZoneName:void 0};let{tableTimeZone:n,timeZone:r,view:i}=this;return O(e.preferredTimeZone||null,!!e.datesInUnknownTimezone,r??n??i?.timeZone??D,this._dateTimeFormatOptions??u,t.type)}get includeTime(){let{field:e,template:t}=this;return e.type===`time-only`?!0:e.type===`date-only`?!1:!t?.input||`includeTime`in t.input&&t.input.includeTime!==!1}get hasContingentValues(){return!!this.store.fieldsWithContingentValues.has(this.fieldName)}get layerFieldConfigurationFormat(){let{_layerWithFieldConfigurations:e}=this;if(e)return e.getFieldConfiguration(this.fieldName)?.fieldFormat??_(this.field)}get maxLength(){let{field:e,template:t}=this,n=e?.length??-1,r=t?.input&&`maxLength`in t.input?t.input.maxLength:null;return r!=null&&!isNaN(r)&&r>=-1&&(n===-1||r<=n)?r:n}get minLength(){let{template:e,maxLength:t}=this,n=e?.input&&`minLength`in e.input?e.input.minLength:null;return t&&n<=t?n:null}get name(){return this.field?.name}get nullable(){return this.field.nullable!==!1}get shouldShowPrompt(){return this._isSubtypeField}createInputElement({rowData:e,value:t}){let{_effectiveDomain:i,maxLength:a,minLength:o,effectiveRequired:s}=this,c;if(i?.type===`coded-value`){let i=e.item.feature,a=this.getFieldValueOptions(i,this.fieldName);this.hasContingentValues?(c=this._setUpComboboxComponent(a,t),this.addHandles([n(()=>c,`calciteComboboxChange`,()=>this.onInputBlur(),r),n(()=>c,`pointerdown`,e=>e.preventDefault(),r)],W)):(c=this.createCalciteSelect(t,a.recommended),this.addHandles(n(()=>c,`calciteSelectChange`,()=>this.onInputBlur(),r),W))}else{if(this._isNumericField){let{_effectiveRange:{max:e,min:n}}=this;c=document.createElement(`calcite-input`),c.type=`number`,this._isIntegerField&&(c.step=1),e!=null&&(c.max=e),n!=null&&(c.min=n),c.status=N({max:e,min:n,value:t})?`idle`:`invalid`}else c=document.createElement(`calcite-input`),this.addHandles(n(()=>c,`calciteInputChange`,()=>this.onInputBlur(),r),W),a>-1&&(c.maxLength=a),o>0&&(c.minLength=o);c.value=t==null?``:t.toString()}return c.classList.add(K.input),c.required=s,this.addHandles([n(()=>c,`keydown`,e=>{e.key===U.cancelEdit&&this.onInputBlur(!0)},r),n(()=>c,`blur`,()=>this.onInputBlur(),r)],W),c}onInputBlur(e=!1){this.removeHandles(W),super.onInputBlur(e)}onEditComplete(){let e=this.editInfo?.root;e&&this._syncRowEditingState(e,!1),this._activeFieldInput=null,super.onEditComplete()}get test(){}_clearActiveEditValues(){this.editInfo?.inputs?.forEach(e=>e.value=``)}_setUpDateActionBar(){let{messagesCommon:e}=this,t=e?.cancel??``,n=e?.clear??``,r=e?.save??``,i=document.createElement(`calcite-action-bar`);return i.expandToggleDisabled=!0,i.layout=`horizontal`,i.appendChild(this.createCalciteAction({text:r,icon:`save`,onclick:()=>this.submit()})),this.effectiveRequired||i.appendChild(this.createCalciteAction({text:n,icon:`trash`,onclick:()=>{this._clearActiveEditValues(),this.submit()}})),i.appendChild(this.createCalciteAction({text:t,icon:`x`,onclick:()=>this.cancel()})),i}_formatDateValueForDisplay(e,t){let{timeZone:n,timeZoneName:r}=this.effectiveTimeZoneOptions;return t==null?null:R(e,t,{...this._dateTimeFormatOptions,timeZone:n,timeZoneName:r})}_fieldValueOptionToComboboxItem({disabled:e,name:t,value:n},r){let i=r===n||r==null&&n===``;return this.createCalciteComboboxItem({disabled:e,heading:t,selected:i,value:n})}_setUpComboboxComponent(e,t){let{recommended:n,other:r,unsupported:i}=e,a=this.effectiveRequired,o=this.messages,s=this.createCalciteCombobox({label:this.effectiveLabel,required:a}),c=n.map(e=>this._fieldValueOptionToComboboxItem(e,t));if(!a||t==null||t===``){let e=this._fieldValueOptionToComboboxItem({disabled:a,name:o?.noValue,value:``},t);s.appendChild(e)}if(r.length===0&&i.length===0)return c.forEach(e=>s.appendChild(e)),s;let l=this.createCalciteComboboxItemGroup({label:o.contingentValues.recommended});if(c.forEach(e=>l.appendChild(e)),s.appendChild(l),r.length){let e=this.createCalciteComboboxItemGroup({label:o.contingentValues.other});r.forEach(n=>e.appendChild(this._fieldValueOptionToComboboxItem(n,t))),s.appendChild(e)}if(i.length){let e=this.createCalciteComboboxItemGroup({label:o.subtypes.unsupportedDomainGroupTitle});i.forEach(n=>e.appendChild(this._fieldValueOptionToComboboxItem(n,t))),s.appendChild(e)}return s}_setUpDateComponents(e){let{_effectiveRange:{max:t,min:r,rawMax:i,rawMin:a},field:o,effectiveRequired:s}=this,c=this._getDateFieldValuesForComponents(o,e),l=[];if(E(o)){let e=this.createDateComponent(),u=w(o)||T(o)?i:t,d=w(o)||T(o)?a:r,f=this._getDateFieldValuesForComponents(o,u??null),p=this._getDateFieldValuesForComponents(o,d??null);e.value=c.date??``,e.max=f.date??``,e.min=p.date??``,e.required=s,this.addHandles([n(()=>e,`calciteInputDatePickerOpen`,()=>this._onDateComponentOpen(e))],W),l.push(e)}if(this.includeTime){let e=this.createTimeComponent();e.value=c.time??``,e.required=s,this.addHandles([n(()=>e,`calciteInputTimePickerOpen`,()=>this._onDateComponentOpen(e))],W),l.push(e)}if(o.type===`timestamp-offset`){let e=this.createTimeZoneComponent();e.value=c.timeZoneOffset??`0`,this.addHandles([n(()=>e,`calciteInputTimeZoneOpen`,()=>this._onDateComponentOpen(e))],W),l.push(e)}return l}_onDateComponentOpen(e){this.editInfo?.inputs.forEach(t=>{t!==e&&`open`in t&&(t.open=!1)})}_syncRowEditingState(e,t=!1){let n=this.grid?.getRowContainingNode(e);n&&(t?n.setAttribute(`editing`,`true`):n.removeAttribute(`editing`))}_getDateFieldValuesForComponents(e,t){switch(e.type){case`date`:return B(t,this.effectiveTimeZoneOptions.timeZone);case`date-only`:return{date:t};case`time-only`:return{time:t};case`timestamp-offset`:return z(t);default:return{}}}_setUpFieldInput(e,t){let{field:n,layer:r,effectiveTimeZoneOptions:{timeZone:i}}=this,a=new k({feature:e,field:n,initialFeature:e.clone(),layer:r,timeZone:i});return a.set(`value`,t),a}_isDomainCompatible(e){if(!e)return!1;let{_isNumericField:t,_isStringField:n}=this,{type:r}=e;if(r===`coded-value`){let r=typeof e.codedValues[0].code;if(r===`string`&&n||r===`number`&&t)return!0}return!!(r===`range`&&t)}_getDomainForFeature(e){let{fieldName:t,layer:n,template:r}=this;if(!e||!n?.getFieldDomain||n.type===`wfs`||n.type===`geojson`||n.type===`csv`)return null;if(r?.domain&&this._isDomainCompatible(r.domain))return r.domain;if(n.type!==`feature`&&n.type!==`subtype-group`&&n.getField(t)?.domain==null){let e=h(n,t);if(e)return e}return n.getFieldDomain(t,{feature:e})}_getComputedDomain(e,t){if(!t)return null;if(t.type===`range`)return e;if(t.type===`coded-value`){let n=t.codedValues.filter(t=>t.hasOwnProperty(`code`)&&t.code===e);return n&&n.length?n[0].name:e}return null}getFieldValueOptions(e,t){return this.store.getFieldValueOptions({feature:e,fieldName:t,layer:this.layer,emptyString:this.messages?.noValue})}};e([i()],q.prototype,`_effectiveDomain`,null),e([i()],q.prototype,`_activeFieldInput`,void 0),e([i()],q.prototype,`_effectiveRange`,null),e([i()],q.prototype,`_isAnyDateOrTimeField`,null),e([i()],q.prototype,`_isIntegerField`,null),e([i()],q.prototype,`_isNumericField`,null),e([i()],q.prototype,`_isStringField`,null),e([i()],q.prototype,`_isSubtypeField`,null),e([i()],q.prototype,`_layerWithFieldConfigurations`,null),e([i()],q.prototype,`_dateTimeFormatOptions`,null),e([i()],q.prototype,`_numberFormatOptions`,null),e([i({readOnly:!0})],q.prototype,`alias`,null),e([i()],q.prototype,`cellValueFormatFunction`,void 0),e([i()],q.prototype,`cellValueValidatorFunction`,void 0),e([i({readOnly:!0})],q.prototype,`defaultValue`,null),e([i()],q.prototype,`effectiveDescription`,null),e([i()],q.prototype,`effectiveEditable`,null),e([i()],q.prototype,`effectiveLabel`,null),e([i()],q.prototype,`effectiveRequired`,null),e([i()],q.prototype,`effectiveSortable`,null),e([i()],q.prototype,`effectiveTimeZoneOptions`,null),e([i({type:g})],q.prototype,`field`,void 0),e([i()],q.prototype,`formatFunction`,void 0),e([i()],q.prototype,`includeTime`,null),e([i()],q.prototype,`inputRenderFunction`,void 0),e([i()],q.prototype,`hasContingentValues`,null),e([i()],q.prototype,`layer`,void 0),e([i()],q.prototype,`layerFieldConfigurationFormat`,null),e([i()],q.prototype,`maxLength`,null),e([i()],q.prototype,`minLength`,null),e([i({readOnly:!0})],q.prototype,`name`,null),e([i({readOnly:!0})],q.prototype,`nullable`,null),e([i()],q.prototype,`parseInputValueFunction`,void 0),e([i()],q.prototype,`shouldShowPrompt`,null),e([i()],q.prototype,`sortable`,void 0),e([i()],q.prototype,`store`,void 0),e([i()],q.prototype,`template`,void 0),e([i()],q.prototype,`view`,void 0),q=e([a(`esri.widgets.FeatureTable.FieldColumn`)],q);const J=q;export{J as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{substitute as t}from"../intl.js";import{isSome as n}from"../core/arrayUtils.js";import{deprecateWidget as r}from"../core/deprecate.js";import i from"../core/Logger.js";import{watch as a,sync as o,syncAndInitial as s,initial as c,on as l}from"../core/reactiveUtils.js";import{renderingSanitizer as u}from"../core/sanitizerUtils.js";import{formatFileSize as d}from"../core/unitFormatUtils.js";import{property as f,subclass as p}from"../core/accessorSupport/decorators.js";import{geometryTypes as m}from"../geometry/support/typeUtils.js";import{isLayerFromCatalog as h}from"../layers/catalog/catalogUtils.js";import{isKnowledgeGraphLayer as g,isMapImageLayer as _,isSubtypeGroupLayer as v}from"../layers/support/layerUtils.js";import y from"../tables/AttributeTableTemplate.js";import b from"../time/TimeExtent.js";import x from"./Widget.js";import{isSupportedImage as S,getCalciteIconForAttachment as C,getAttachmentTypeCategory as w}from"./Attachments/support/attachmentUtils.js";import{loadPromptComponents as T,Prompt as E}from"./Editor/components/Prompt.js";import D from"./FeatureTable/ColumnMenuVisibleElements.js";import O from"./FeatureTable/FeatureTableViewModel.js";import k from"./FeatureTable/VisibleElements.js";import{isGroupColumn as A,isFieldColumn as j}from"./FeatureTable/support/columnUtils.js";import M from"./FeatureTable/support/TableTemplate.js";import{loadFieldColumnComponents as N,isIFeatureTableSupportedLayer as P,isIFeatureTableSupportedLayerWithAttachments as F,getRelationshipIdsToShow as I}from"./FeatureTable/support/tableUtils.js";import{loadCalciteComponents as L}from"./support/componentsUtils.js";import{globalCss as R}from"./support/globalCss.js";import{getIconForLayer as z}from"./support/iconUtils.js";import{messageBundle as B,vmEvent as V,tsx as H,tsxFragment as U}from"./support/widget.js";import{storeNode as W,discardNode as G}from"./support/widgetUtils.js";var K;const q=`esri-feature-table`,J=`${q}__dialog`,Y=`${q}__table-navigation`,X=`${q}__attachments-view`,Z={base:q,content:`${q}__content`,menuPopover:`${q}__menu-popover`,layerDropdownMenu:`${q}__layer-switcher-menu`,tableContainer:`${q}__table-container`,tableContainerWithAttachments:`${q}__table-container--attachments`,tableNavigation:Y,attachmentsView:X,attachmentsViewContent:`${X}__content`,attachmentsViewDetails:`${X}__details`,attachmentsViewDropArea:`${X}__drop-area`,attachmentsViewDropAreaLabel:`${X}__drop-area__label`,attachmentsViewDropAreaMessage:`${X}__drop-area__message`,attachmentsViewIcon:`${X}__icon`,attachmentsViewInformation:`${X}__information`,attachmentsViewInformationData:`${X}__information__data`,attachmentsViewInformationLabel:`${X}__information__label`,attachmentsViewList:`${X}__list`,attachmentsViewListFileSize:`${X}__list__filesize`,attachmentsViewListThumbnail:`${X}__list__thumbnail`,expanded:`${q}__expanded`,collapsed:`${q}__collapsed`,dialog:`${J}`,dialogContent:`${J}__content`,dialogHeader:`${J}__header`,footerMessage:`${q}__footer__message`,footerIconDanger:`${q}__footer__icon--danger`,footerIconSuccess:`${q}__footer__icon--success`},Q={checkCircle:`check-circle`,chevronRight:`chevron-right`,clearSelection:`clear-selection`,downloadTo:`download-to`,exclamationMarkTriangle:`exclamation-mark-triangle`,expand:`expand`,exportToCSV:`file-csv`,folderOpen:`folder-open`,delete:`trash`,layers:`layers`,moveUp:`move-up`,plus:`plus`,refresh:`refresh`,reset:`reset`,save:`save`,showAll:`selection-x`,showColumn:`show-column`,showSelected:`selection-filter`,table:`table`,upload:`upload`,zoomToSelection:`zoom-to-object`};let $=K=class extends x{constructor(e,t){super(e,t),this._attachmentsDialogPreviewLoading=!1,this._attachmentsInput=null,this._columnVisibilityActions=new Map,this._columnVisibilityList=null,this.attachmentsList=null,this.closed=!1,this.collapsed=!1,this.columnVisibilityMenuConfig=null,this.description=null,this.disabled=!1,this.messagesEditor=null,this.navigationScale=`m`,this.title=null,this.viewModel=new O,this.visibleElements=new k,this.announceDeprecation=()=>{r(i.getLogger(this),`Feature Table`,`arcgis-feature-table`,{version:`5.0`})},this._showDeleteSelectionPrompt=this._showDeleteSelectionPrompt.bind(this),this._showDiscardEditsPrompt=this._showDiscardEditsPrompt.bind(this),this._resetNestedViews=this._resetNestedViews.bind(this)}initialize(){this.addHandles([a(()=>[this.isQueryingOrSyncing,this.editingEnabled],()=>this.scheduleRender()),a(()=>[this._effectiveVisibleElements,this._effectiveVisibleElements.columnDescriptions,this._effectiveVisibleElements.columnMenus,this._effectiveVisibleElements.columnMenuItems,this.columns.length],()=>{this.columns.forEach(e=>e.visibleElements=this._effectiveVisibleElements),this.refreshCellContent()},o),a(()=>[this.topLayerDisabled,this.columns],()=>this.columns.forEach(e=>e.topLayerDisabled=this.topLayerDisabled),s),a(()=>this._effectiveVisibleElements.selectionColumn,e=>{this.grid&&(this.grid.selectionColumnEnabled=e)},c),l(()=>this.viewModel,`show-related-table`,e=>this._onShowRelatedTable(e)),a(()=>this.editingEnabled,()=>{let{attachmentsViewOptions:e}=this;this.clearPrompt(),e&&(e.form?.reset(),e.candidates=null)}),l(()=>this.effectiveTable,`column-reorder`,()=>this.scheduleRender())])}loadDependencies(){return Promise.all([L({action:()=>import(`@esri/calcite-components/dist/components/calcite-action`),alert:()=>import(`@esri/calcite-components/dist/components/calcite-alert`),button:()=>import(`@esri/calcite-components/dist/components/calcite-button`),chip:()=>import(`@esri/calcite-components/dist/components/calcite-chip`),dialog:()=>import(`@esri/calcite-components/dist/components/calcite-dialog`),dropdown:()=>import(`@esri/calcite-components/dist/components/calcite-dropdown`),"dropdown-group":()=>import(`@esri/calcite-components/dist/components/calcite-dropdown-group`),"dropdown-item":()=>import(`@esri/calcite-components/dist/components/calcite-dropdown-item`),icon:()=>import(`@esri/calcite-components/dist/components/calcite-icon`),label:()=>import(`@esri/calcite-components/dist/components/calcite-label`),list:()=>import(`@esri/calcite-components/dist/components/calcite-list`),"list-item":()=>import(`@esri/calcite-components/dist/components/calcite-list-item`),notice:()=>import(`@esri/calcite-components/dist/components/calcite-notice`),pagination:()=>import(`@esri/calcite-components/dist/components/calcite-pagination`),panel:()=>import(`@esri/calcite-components/dist/components/calcite-panel`),popover:()=>import(`@esri/calcite-components/dist/components/calcite-popover`),progress:()=>import(`@esri/calcite-components/dist/components/calcite-progress`),switch:()=>import(`@esri/calcite-components/dist/components/calcite-switch`),tooltip:()=>import(`@esri/calcite-components/dist/components/calcite-tooltip`)}),T(),N()])}destroy(){this.drainRelatedTables(),this.clearPrompt()}get _attachmentsViewIsVisible(){return!!(this.attachmentsViewOptions.objectId!=null||this.relatedTables.some(e=>e.attachmentsViewOptions.objectId!=null))}get _columnVisibilityActionDisabled(){let e=this.effectiveTable;return e.menuConfig?.disabled??e.columns.length===0}get _dialogIsOpen(){return!!this.attachmentsViewOptions.dialogInfo}get _effectiveDescription(){let{description:e}=this;return e==null?void 0:u.sanitize(typeof e==`function`?e():e)}get _effectiveLayers(){let{layer:e,layers:t}=this,n=t?.length?t.filter(P):[],r=n.length?n:[...this._viewLayers];return e&&!r.includes(e)&&r.push(e),r}get _effectiveTitle(){let{layer:e,messages:n,state:r,highlightIds:i,title:a,size:o}=this;if(a)return u.sanitize(typeof a==`function`?a():a);if(!n)return``;if(!e)return n.noLayer;switch(r){case`disabled`:return n.errorLayer;case`ready`:case`loading`:return n.loading;case`error`:return n.errorData}return t(n.header,{title:u.sanitize(e.title),count:o,selected:i.length})}get _effectiveVisibleElements(){return this.visibleElementsOverride??this.visibleElements}get _filteredTables(){let e=this.relatedTables.toArray(),t=e.length===1;return this.allRelatedTablesVisible?e:t?[e[0]]:this._attachmentsViewIsVisible?e.slice(-1):e.slice(-2)}get _hasAttachmentsViewError(){return this.attachmentsViewOptions.error!=null}get _hasCustomMenuItems(){return!!this.menuConfig?.items?.length}get _hasDefaultMenuItems(){return!!(this._showClearSelectionAction||this._showDeleteSelectionAction||this._showExportSelectionToCSVAction||this._showRefreshDataAction||this._showZoomToSelectionAction||this._showSelectedRecordsShowSelectedAction||this._showSelectedRecordsShowAllAction||this._showColumnVisibilityAction)}get _shouldShowGrid(){return this.allRelatedTablesVisible||this.relatedTables.length===1&&!this._attachmentsViewIsVisible}get _shouldShowMenu(){let{header:e,menu:t}=this._effectiveVisibleElements;return!!(e&&t&&(this._hasDefaultMenuItems||this._hasCustomMenuItems))}get _showClearSelectionAction(){return!!(this.effectiveTable.highlightIds.length&&this._effectiveVisibleElements.menuItems?.clearSelection&&!this._attachmentsViewIsVisible)}get _showColumnVisibilityAction(){let{columnVisibilityMenu:e,header:t,menu:n,menuItems:r}=this._effectiveVisibleElements;return!(!t||!n||!e||r?.toggleColumns===!1||this.showRelatedTableCallback||this.allRelatedTablesVisible||this._attachmentsViewIsVisible)}get _showDeleteSelectionAction(){return!!(this.editingEnabled&&this.highlightIds.length&&this._effectiveVisibleElements.menuItems?.deleteSelection&&this.layer?.capabilities?.operations?.supportsDelete&&!this.relatedTables.length&&!this._attachmentsViewIsVisible)}get _showExportSelectionToCSVAction(){return!!(this._effectiveVisibleElements.menuItems.exportSelectionToCSV&&this.layer&&this.highlightIds.length&&!this.relatedTables.length)}get _showLayerDropdown(){return!!(this._effectiveLayers.length&&this._effectiveVisibleElements.layerDropdown)}get _shouldShowNavigationBar(){let e=!!this.relatedTable||this._attachmentsViewIsVisible;return!this.tableParent&&e}get _showRefreshDataAction(){return!!this._effectiveVisibleElements.menuItems?.refreshData}get _showSelectedRecordsShowSelectedAction(){let e=this.objectIds.length,t=this.highlightIds.length;return!(!t||!this._effectiveVisibleElements.menuItems?.selectedRecordsShowSelectedToggle||e&&t===e||this.relatedTables.length||this._attachmentsViewIsVisible)}get _showSelectedRecordsShowAllAction(){return!!(this._effectiveVisibleElements.menuItems?.selectedRecordsShowAllToggle&&this.objectIds.length&&!this.relatedTables.length)}get _showZoomToSelectionAction(){let e=this.effectiveTable;return!!(e.view&&e.highlightIds.length&&!e.layer?.isTable&&this._effectiveVisibleElements.menuItems?.zoomToSelection)}get _viewLayers(){let e=this.view?.map;if(!e)return[];let t=new Set,n=e=>{P(e)&&!v(e)&&!t.has(e)&&(e.type!==`sublayer`||e.capabilities?.operations?.supportsQuery)&&(e.load().catch(()=>{}),t.add(e))},r=e=>{h(e)||e.type===`catalog-footprint`||(g(e)?(e.load().catch(()=>{}),e.layers?.forEach(n),e.tables?.forEach(n)):_(e)?(e.loadAll().catch(()=>{}),e.allSublayers?.forEach(n),e.subtables?.forEach(n)):v(e)?(e.loadAll().catch(()=>{}),e.sublayers?.forEach(n)):n(e))};return e.allLayers.forEach(r),e.allTables.forEach(r),[...t.values()]}get direction(){return this.viewModel.direction}set direction(e){this.viewModel.direction=e}get grid(){return this.viewModel.grid}get actionColumn(){return this.viewModel.actionColumn}get actionColumnConfig(){return this.viewModel.actionColumnConfig}set actionColumnConfig(e){this.viewModel.actionColumnConfig=e}get activeFilters(){return this.viewModel.activeFilters}get activeSortOrders(){return this.viewModel.activeSortOrders}get allColumns(){return this.viewModel.allColumns}get allColumnsVisible(){return this.viewModel.allColumnsVisible}get allRelatedTablesVisible(){return this.viewModel.allRelatedTablesVisible}get allVisibleColumns(){return this.viewModel.allVisibleColumns}get attachmentsColumns(){return this.viewModel.attachmentsColumns}get attachmentsEnabled(){return this.viewModel.attachmentsEnabled}set attachmentsEnabled(e){this.viewModel.attachmentsEnabled=e}get attachmentsViewOptions(){return this.viewModel.attachmentsViewOptions}set attachmentsViewOptions(e){this.viewModel.attachmentsViewOptions=e}get attributeTableTemplate(){return this.viewModel.attributeTableTemplate}set attributeTableTemplate(e){this.viewModel.attributeTableTemplate=e}get autoRefreshEnabled(){return this.viewModel.autoRefreshEnabled}set autoRefreshEnabled(e){this.viewModel.autoRefreshEnabled=e}get autoSaveEnabled(){return this.viewModel.autoSaveEnabled}set autoSaveEnabled(e){this.viewModel.autoSaveEnabled=e}get canAddRelatedFeature(){return this.viewModel.canAddRelatedFeature}get clearPrompt(){return this.viewModel.clearPrompt}set clearPrompt(e){this.viewModel.clearPrompt=e}get columnPerformanceModeEnabled(){return this.viewModel.columnPerformanceModeEnabled}set columnPerformanceModeEnabled(e){this.viewModel.columnPerformanceModeEnabled=e}get columnReorderingEnabled(){return this.viewModel.columnReorderingEnabled}set columnReorderingEnabled(e){this.viewModel.columnReorderingEnabled=e}get columns(){return this.viewModel.columns}get defaultSelectionManager(){return this.viewModel.defaultSelectionManager}get definitionExpression(){return this.viewModel.definitionExpression}set definitionExpression(e){this.viewModel.definitionExpression=e}get container(){return super.container}set container(e){super.container=e}get editingEnabled(){return this.viewModel.editingEnabled}set editingEnabled(e){this.viewModel.editingEnabled=e}get effectiveSelectionManager(){return this.viewModel.effectiveSelectionManager}get effectiveSize(){return this.viewModel.effectiveSize}get effectiveTable(){return this.relatedTable||this}get effectiveTimeExtent(){return this.viewModel.effectiveTimeExtent}get fieldColumns(){return this.viewModel.fieldColumns}get filterGeometry(){return this.viewModel.filterGeometry}set filterGeometry(e){this.viewModel.filterGeometry=e}get filterBySelectionEnabled(){return this.viewModel.filterBySelectionEnabled}set filterBySelectionEnabled(e){this.viewModel.filterBySelectionEnabled=e}get filterByViewExtent(){return this.viewModel.filterByViewExtent}set filterByViewExtent(e){this.viewModel.filterByViewExtent=e}get filterByLayerScaleRange(){return this.viewModel.filterByLayerScaleRange}set filterByLayerScaleRange(e){this.viewModel.filterByLayerScaleRange=e}get groupColumns(){return this.viewModel.groupColumns}get hasContingentValues(){return this.viewModel.hasContingentValues}get hasInvalidPendingEdits(){return this.viewModel.hasInvalidPendingEdits}get hasPendingEdits(){return this.viewModel.hasPendingEdits}get hiddenFields(){return this.viewModel.hiddenFields}set hiddenFields(e){this.viewModel.hiddenFields=e}get highlightEnabled(){return this.viewModel.highlightEnabled}set highlightEnabled(e){this.viewModel.highlightEnabled=e}get highlightIds(){return this.viewModel.highlightIds}set highlightIds(e){this.viewModel.highlightIds=e}get icon(){return Q.table}set icon(e){this._overrideIfSome(`icon`,e)}get initialSize(){return this.viewModel.initialSize}set initialSize(e){this.viewModel.initialSize=e}get isQueryingOrSyncing(){return this.viewModel.isQueryingOrSyncing}get isSyncing(){return this.viewModel.isSyncing}get isSyncingAttachments(){return this.viewModel.isSyncingAttachments}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 layers(){return this.viewModel.layers}set layers(e){this.viewModel.layers=e}get layerView(){return this.viewModel.layerView}get maxSize(){return this.viewModel.maxSize}set maxSize(e){this.viewModel.maxSize=e}get messages(){return this.viewModel.messages}set messages(e){this.viewModel.messages=e}get messagesCommon(){return this.viewModel.messagesCommon}set messagesCommon(e){this.viewModel.messagesCommon=e}get messagesUnits(){return this.viewModel.messagesUnits}set messagesUnits(e){this.viewModel.messagesUnits=e}get messagesURIUtils(){return this.viewModel.messagesURIUtils}set messagesURIUtils(e){this.viewModel.messagesURIUtils=e}get menuConfig(){return this.viewModel.menuConfig}set menuConfig(e){this.viewModel.menuConfig=e}get multipleSelectionEnabled(){return this.viewModel.multipleSelectionEnabled}set multipleSelectionEnabled(e){this.viewModel.multipleSelectionEnabled=e}get multipleSelectionEnabledOverride(){return this.viewModel.multipleSelectionEnabledOverride}set multipleSelectionEnabledOverride(e){this.viewModel.multipleSelectionEnabledOverride=e}get multiSortEnabled(){return this.viewModel.multiSortEnabled}set multiSortEnabled(e){this.viewModel.multiSortEnabled=e}get multipleSortPriority(){return this.viewModel.multipleSortPriority}set multipleSortPriority(e){this.viewModel.multipleSortPriority=e}get noDataMessage(){return this.viewModel.noDataMessage}set noDataMessage(e){this.viewModel.noDataMessage=e}get objectIds(){return this.viewModel.objectIds}set objectIds(e){this.viewModel.objectIds=e}get outFields(){return this.viewModel.outFields}set outFields(e){this.viewModel.outFields=e}get pageCount(){return this.viewModel.pageCount}get pageIndex(){return this.viewModel.pageIndex}set pageIndex(e){this.viewModel.pageIndex=e}get pageSize(){return this.viewModel.pageSize}set pageSize(e){this.viewModel.pageSize=e}get paginationEnabled(){return this.viewModel.paginationEnabled}set paginationEnabled(e){this.viewModel.paginationEnabled=e}get pendingEditsCount(){return this.viewModel.pendingEditsCount}get prompt(){return this.viewModel.prompt}set prompt(e){this.viewModel.prompt=e}get relatedRecordsEnabled(){return this.viewModel.relatedRecordsEnabled}set relatedRecordsEnabled(e){this.viewModel.relatedRecordsEnabled=e}get relatedTable(){return this.viewModel.relatedTable}get relatedTableHasContingentValues(){return this.viewModel.relatedTableHasContingentValues}get relatedTableHasInvalidPendingEdits(){return this.viewModel.relatedTableHasInvalidPendingEdits}get relatedTableHasPendingEdits(){return this.viewModel.relatedTableHasPendingEdits}get relatedTables(){return this.viewModel.relatedTables}get relationship(){return this.viewModel.relationship}get relationshipColumnConfigs(){return this.viewModel.relationshipColumnConfigs}set relationshipColumnConfigs(e){this.viewModel.relationshipColumnConfigs=e}get relationshipColumns(){return this.viewModel.relationshipColumns}get relationshipConfig(){return this.viewModel.relationshipConfig}set relationshipConfig(e){this.viewModel.relationshipConfig=e}get relationshipInfos(){return this.viewModel.relationshipInfos}get returnGeometryEnabled(){return this.viewModel.returnGeometryEnabled}set returnGeometryEnabled(e){this.viewModel.returnGeometryEnabled=e}get returnMEnabled(){return this.viewModel.returnMEnabled}set returnMEnabled(e){this.viewModel.returnMEnabled=e}get returnZEnabled(){return this.viewModel.returnZEnabled}set returnZEnabled(e){this.viewModel.returnZEnabled=e}get rowHighlightIds(){return this.viewModel.rowHighlightIds}set rowHighlightIds(e){this.viewModel.rowHighlightIds=e}get selectionManager(){return this.viewModel.selectionManager}set selectionManager(e){this.viewModel.selectionManager=e}get selectionSource(){return this.viewModel.selectionSource}set selectionSource(e){this.viewModel.selectionSource=e}get showAllRelatedTables(){return this.viewModel.showAllRelatedTables}set showAllRelatedTables(e){this.viewModel.showAllRelatedTables=e}get showPrompt(){return this.viewModel.showPrompt}set showPrompt(e){this.viewModel.showPrompt=e}get showRelatedTableCallback(){return this.viewModel.showRelatedTableCallback}set showRelatedTableCallback(e){this.viewModel.showRelatedTableCallback=e}get size(){return this.viewModel.size}get state(){return this.viewModel.state}get supportsAddAttachments(){return this.viewModel.supportsAddAttachments}get supportsAttachments(){return this.viewModel.supportsAttachments}get supportsDeleteAttachments(){return this.viewModel.supportsDeleteAttachments}get supportsResizeAttachments(){return this.viewModel.supportsResizeAttachments}get supportsUpdateAttachments(){return this.viewModel.supportsUpdateAttachments}get syncTemplateOnChangesEnabled(){return this.viewModel.syncTemplateOnChangesEnabled}set syncTemplateOnChangesEnabled(e){this.viewModel.syncTemplateOnChangesEnabled=e}get syncViewSelection(){return this.viewModel.syncViewSelection}set syncViewSelection(e){this.viewModel.syncViewSelection=e}get syncWithViewSelectionManager(){return this.syncViewSelection}set syncWithViewSelectionManager(e){this.syncViewSelection=e}get tableController(){return this.viewModel.tableController}set tableController(e){this.viewModel.tableController=e}get tableParent(){return this.viewModel.tableParent}set tableParent(e){this.viewModel.tableParent=e}get tableTemplate(){return this.viewModel.tableTemplate}set tableTemplate(e){this.viewModel.tableTemplate=e}get tableTemplateOverride(){return this.viewModel.tableTemplateOverride}set tableTemplateOverride(e){this.viewModel.tableTemplateOverride=e}get timeExtent(){return this.viewModel.timeExtent}set timeExtent(e){this.viewModel.timeExtent=e}get timeZone(){return this.viewModel.timeZone}set timeZone(e){this.viewModel.timeZone=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}get viewTimeEnabled(){return this.viewModel.viewTimeEnabled}set viewTimeEnabled(e){this.viewModel.viewTimeEnabled=e}get visibleColumns(){return this.viewModel.visibleColumns}get visibleElementsOverride(){let{attachmentsViewOptions:e,relatedTable:t,tableController:n,visibleElements:r}=this,{columnDescriptions:i,columnMenus:a,tooltips:o}=r,s=e.objectId!=null;if(t)return new k({columnDescriptions:i,columnMenus:a,tooltips:o,close:r.close,header:r.header,layerDropdown:r.layerDropdown,layerDropdownIcons:r.layerDropdownIcons,menu:r.menu,menuItems:r.menuItems,progress:r.progress,selectionColumn:!1,columnMenuItems:new D({sortAscending:!1,sortDescending:!1})});if(n){let e=n.relatedTable===this,t=n.allRelatedTablesVisible,c=e&&r.selectionColumn&&!t&&!s,l=e&&!t&&!s;return new k({columnDescriptions:i,columnMenus:a,tooltips:o,selectionColumn:c,close:!1,header:!1,layerDropdown:!1,menu:!1,pendingEditsFooter:!1,progress:!1,columnMenuItems:new D({sortAscending:l,sortDescending:l})})}return s?new k({columnDescriptions:i,columnMenus:a,tooltips:o,close:r.close,header:r.header,layerDropdown:r.layerDropdown,layerDropdownIcons:r.layerDropdownIcons,menu:r.menu,menuItems:r.menuItems,progress:r.progress,selectionColumn:!1,columnMenuItems:new D({sortAscending:!1,sortDescending:!1})}):null}addPendingEdits(e){this.viewModel.addPendingEdits(e)}clearSelection(){this.effectiveTable.viewModel.clearSelection()}async deleteAttachments(e,t,n){e!=null&&t?.length&&(n?this._showDeleteAttachmentPrompt(e,t):await this.viewModel.deleteAttachments(e,t))}async deleteSelection(e){this.highlightIds.length&&(e?this._showDeleteSelectionPrompt():await this.viewModel.deleteSelection())}async discardPendingEdits(e,t){return t?this._showDiscardEditsPrompt(e):this.viewModel.discardPendingEdits(e)}async downloadAttachmentById(e,t){return this.viewModel.downloadAttachmentById(e,t)}drainRelatedTables(){this.viewModel.drainRelatedTables()}async exportSelectionToCSV(e){return this.viewModel.exportSelectionToCSV(e)}findColumn(e){return this.viewModel.findColumn(e)}getFeatureStoreItemByObjectId(e){return this.viewModel.getFeatureStoreItemByObjectId(e)}goToPage(e){this.viewModel.goToPage(e)}hideAllColumns(){this.viewModel.hideAllColumns()}hideColumn(e){this.grid?.hideColumn(e)}nextPage(){this.viewModel.nextPage()}previousPage(){this.viewModel.previousPage()}async refresh(){await this.viewModel.refresh()}refreshCellContent(){this.viewModel.refreshCellContent()}async saveAttachmentsViewForm(){await this.viewModel.saveAttachmentsViewForm()}async savePendingEdits(){await this.viewModel.savePendingEdits()}showAllColumns(){this.viewModel.showAllColumns()}showColumn(e){this.grid?.showColumn(e)}sortColumn(e,t){this.viewModel.sortColumn(e,t)}scrollLeft(){this.viewModel.scrollLeft()}scrollToBottom(){this.viewModel.scrollToBottom()}scrollToIndex(e){this.viewModel.scrollToIndex(e)}scrollToRow(e){this.viewModel.scrollToRow(e)}scrollToTop(){this.viewModel.scrollToTop()}toggleColumnVisibility(e){this.viewModel.toggleColumnVisibility(e)}get visibilityMenuColumns(){let e=this.effectiveTable.columns;return this.columnVisibilityMenuConfig?.frozenColumnsExcluded?e.filter(e=>!e.frozen&&!e.frozenToEnd).toArray():e.toArray()}async zoomToSelection(){return this.effectiveTable.viewModel.zoomToSelection()}render(){let{_effectiveVisibleElements:e,isQueryingOrSyncing:t,menuConfig:n,state:r}=this;return H(`div`,{bind:this,class:this.classes(Z.base,R.widget)},H(`calcite-panel`,{bind:this,class:Z.content,closable:e.close,closed:this.closed,collapsed:this.collapsed,collapsible:e.collapse,description:this._effectiveDescription,dir:this.direction,disabled:this.disabled||r===`disabled`&&!this._effectiveLayers?.length,heading:e.header?this._effectiveTitle:void 0,key:`table-content`,loading:r===`loading`,menuOpen:!!n?.open,overlayPositioning:`fixed`,onCalcitePanelClose:()=>{this.closed=!0,this.emit(`close`)},onCalcitePanelToggle:e=>{this.collapsed=e.target.collapsed,this.emit(`toggle`)}},e.progress?H(`calcite-progress`,{type:t?`indeterminate`:`determinate`}):null,this._showLayerDropdown?this._renderLayerDropdown():null,this._renderColumnVisibilityAction(),this._renderHeaderMenuActions(),this._renderNavigationBar(),this._renderTables(),this._renderError(),this._renderFooterContent()),this._renderColumnVisibilityPopover(),this._renderPrompt(),this._renderDialog())}_renderTables(){let{grid:e,relatedTables:t}=this,n=this.classes(Z.tableContainer);if(t.length){let r=this.classes(Z.base,this.allRelatedTablesVisible?Z.expanded:Z.collapsed,this._attachmentsViewIsVisible?Z.tableContainerWithAttachments:void 0);return H(`div`,{class:n},H(`calcite-panel`,{overlayPositioning:`fixed`},H(`div`,null,[this._shouldShowGrid?H(`div`,{class:r},e?.render(),this._renderPagination()):void 0,...this._filteredTables.map(e=>{let n=t.indexOf(e);return H(`div`,{class:r,key:`related-${n}`},e.render())}),,])))}return this.attachmentsViewOptions.objectId==null?[H(`div`,{class:n},e?.render()),this._renderPagination()]:H(`div`,{class:n},H(`calcite-panel`,{overlayPositioning:`fixed`},H(`div`,null,[H(`div`,{class:this.classes(Z.base,Z.collapsed)},e?.render(),this._renderPagination()),this._renderAttachmentsView()])))}_renderPagination(){if(this.paginationEnabled)return H(`calcite-pagination`,{pageSize:1,startItem:this.pageIndex+1,totalItems:this.pageCount,onCalcitePaginationChange:e=>{this._attachmentsDialogPreviewLoading=!1,this.goToPage(e.currentTarget.startItem-1)}})}_renderError(){let{messages:e}=this;return H(`calcite-alert`,{autoClose:!0,autoCloseDuration:`fast`,icon:Q.exclamationMarkTriangle,kind:`danger`,label:e.errorOccured,open:this._hasAttachmentsViewError,slot:`alerts`,topLayerDisabled:this.topLayerDisabled,onCalciteAlertClose:()=>{this.attachmentsViewOptions.error=null}},H(`span`,{slot:`message`},e.errorOccured))}_renderFooterContent(){if(!this.hasPendingEdits||!this._effectiveVisibleElements.pendingEditsFooter)return;let{hasInvalidPendingEdits:e,isQueryingOrSyncing:t,messages:n,messagesCommon:r}=this,i=e||t,a=this.hasContingentValues,o=[H(`calcite-button`,{appearance:`outline`,disabled:t,iconStart:Q.reset,key:`footer-reset-button`,slot:`footer-end`,width:`auto`,onclick:()=>void this.discardPendingEdits()},r.reset),H(`calcite-button`,{disabled:i,iconStart:Q.save,key:`footer-save-button`,loading:this.isSyncing,slot:`footer-end`,width:`auto`,onclick:()=>{this.savePendingEdits()}},r.save)];if(a){let t=e?n.contingentValues.hasInvalidValues:n.contingentValues.hasValidValues,r=e?Q.exclamationMarkTriangle:Q.checkCircle,i=e?Z.footerIconDanger:Z.footerIconSuccess;o.push(H(`div`,{class:Z.footerMessage,key:`footer-message`,slot:`footer-start`},H(`calcite-icon`,{class:i,icon:r,scale:`s`,slot:`footer-start`}),t))}return o}_renderPrompt(){return this.prompt?H(E,{...this.prompt,headingLevel:2}):void 0}_showDeleteSelectionPrompt(){let{messages:e,messagesCommon:n}=this,r=t(e.deleteSelectionCount,{count:this.highlightIds.length});this.showPrompt({title:r,message:e.deleteRecordsRemoved,context:`danger`,actions:{primary:{label:n.delete,action:async()=>{try{await this.viewModel.deleteSelection()}finally{this.clearPrompt()}}},secondary:{label:e.keepRecords,action:()=>this.clearPrompt()}}})}_showDeleteAttachmentPrompt(e,n){let{messages:r,messagesCommon:i}=this,a=t(r.deleteAttachmentCount,{count:n.length});this.showPrompt({title:a,message:r.deleteAttachmentConfirmation,context:`danger`,actions:{primary:{label:i.delete,action:async()=>{try{await this.deleteAttachments(e,n,!1)}finally{this.clearPrompt()}}},secondary:{label:i.cancel,action:()=>this.clearPrompt()}}})}async _showDiscardEditsPrompt(e){let t=Promise.withResolvers(),{messagesEditor:n}=this;return this.showPrompt({title:n.cancelEditTitle,message:n.cancelEditWarningMessage,context:`danger`,actions:{primary:{label:n.discardEdits,action:async()=>{try{await this.discardPendingEdits(e)}finally{t.resolve(!0)}}},secondary:{label:n.continueEditing,action:()=>t.resolve(!1)}}}),t.promise.finally(()=>this.clearPrompt())}_onTableViewChange(e){this.hasPendingEdits?this._showDiscardEditsPrompt().then(t=>t&&e()):e()}_resetNestedViews(){this.relatedTable&&this.drainRelatedTables(),this.effectiveTable.attachmentsViewOptions.objectId=null}_renderDialog(){let{attachmentsViewOptions:e,messages:t}=this,{objectId:n}=e;return H(`calcite-dialog`,{class:Z.dialog,description:this.viewModel.getFeatureTitleSync(n),heading:t.attachments,modal:!0,open:this._dialogIsOpen,placement:`cover`,width:`l`,onCalciteDialogClose:()=>this._onDialogClose()},this._renderDialogContent())}_renderDialogContent(){let e=this.attachmentsViewOptions.dialogInfo;if(e)return this._renderAttachmentsDialogContent(e)}_renderAttachmentsDialogContent(e){let{attachmentsViewOptions:t,messages:n}=this,{attachmentInfos:r}=t,i=r.indexOf(e);return H(U,null,H(`div`,{class:Z.dialogHeader,key:`header`,slot:`content-top`},H(`span`,null,e.name),H(`calcite-button`,{appearance:`outline`,onclick:()=>{t.attachmentId=e.id,t.dialogId=null}},n.viewDetails)),H(`calcite-progress`,{type:this._attachmentsDialogPreviewLoading?`indeterminate`:`determinate`}),H(`div`,{class:Z.dialogContent,key:`content`},this._renderAttachmentsViewDetailsImage(e)),H(`calcite-pagination`,{pageSize:1,slot:`footer`,startItem:i+1,totalItems:r.length,onCalcitePaginationChange:e=>{let n=e.currentTarget.startItem-1,i=r[n]?.id;t.dialogId=i}}))}_onDialogClose(){let e=this.attachmentsViewOptions;e.dialogId!=null&&(e.dialogId=null),this._attachmentsDialogPreviewLoading=!1}_renderHeaderMenuAction(e){let{disabled:t,hidden:n,icon:r,text:i,clickFunction:a}=e;if(!n)return H(`calcite-action`,{disabled:t??this.menuConfig?.disabled,icon:r??void 0,key:i,slot:`header-menu-actions`,text:i,textEnabled:!0,title:i,onclick:()=>a()})}_renderHeaderMenuActions(){return this._shouldShowMenu?[this._renderDefaultHeaderMenuActions(),this._renderCustomHeaderMenuActions()]:[]}_renderDefaultHeaderMenuActions(){if(!this._hasDefaultMenuItems)return[];let{messages:e}=this;return[this._showRefreshDataAction&&{icon:Q.refresh,text:e.refreshData,clickFunction:()=>this.refresh()},this._showDeleteSelectionAction&&{icon:Q.delete,text:e.deleteSelection,clickFunction:()=>this.deleteSelection(!0)},this._showClearSelectionAction&&{icon:Q.clearSelection,text:e.clearSelection,clickFunction:()=>this.clearSelection()},this._showZoomToSelectionAction&&{icon:Q.zoomToSelection,text:e.zoomToSelection,clickFunction:()=>this.zoomToSelection()},this._showSelectedRecordsShowSelectedAction&&{icon:Q.showSelected,text:e.showSelected,clickFunction:()=>{let{objectIds:e}=this;e.removeAll(),e.addMany(this.highlightIds.toArray())}},this._showSelectedRecordsShowAllAction&&{icon:Q.showAll,text:e.showAllRecords,clickFunction:()=>this.objectIds.removeAll()},this._showExportSelectionToCSVAction&&{icon:Q.exportToCSV,text:e.exportSelectionCSV,clickFunction:()=>this.exportSelectionToCSV()}].filter(n).map(e=>e&&this._renderHeaderMenuAction(e))}_renderCustomHeaderMenuActions(){return this.menuConfig?.items?.map(({disabled:e,hidden:t,icon:n,label:r,clickFunction:i})=>this._renderHeaderMenuAction({hidden:typeof t==`function`?t():t,icon:n,text:r,disabled:typeof e==`function`?e():e,clickFunction:e=>i(e)}))??[]}_renderColumnVisibilityAction(){if(!this._showColumnVisibilityAction)return[];let{_columnVisibilityActions:e,id:t}=this,n=this.messages.menuText.columnVisibility;return H(`calcite-action`,{afterCreate:n=>e.set(t,n),afterRemoved:()=>e.delete(t),bind:this,disabled:this._columnVisibilityActionDisabled,icon:Q.showColumn,id:`${t}__toggle-columns-action`,slot:`header-actions-end`,text:n},this._effectiveVisibleElements.tooltips?H(`calcite-tooltip`,{closeOnClick:!0,overlayPositioning:`fixed`,placement:`bottom-end`,referenceElement:e.get(t),topLayerDisabled:this.topLayerDisabled},n):null)}_renderColumnVisibilityPopover(){if(!this._showColumnVisibilityAction||this._columnVisibilityActionDisabled)return;let e=this.visibleElements.columnVisibilityMenuItems.header,t=this.messages.menuText.columnVisibility;return H(`calcite-popover`,{autoClose:!0,class:Z.menuPopover,closable:e,heading:e?t:void 0,label:t,overlayPositioning:`fixed`,placement:this.columnVisibilityMenuConfig?.placement,referenceElement:this._columnVisibilityActions.get(this.id),topLayerDisabled:this.topLayerDisabled},this._renderColumnVisibilityList())}_renderColumnVisibilityList(){let{visibilityMenuColumns:e,messages:{menuText:t}}=this;if(e.length!==0)return H(`calcite-list`,{afterCreate:W,afterRemoved:G.bind(this),afterUpdate:W,bind:this,"data-node-ref":`_columnVisibilityList`,dir:this.direction,displayMode:`nested`,filterEnabled:this.visibleElements.columnVisibilityMenuItems.filter,filterPlaceholder:t.searchFields,label:t.fieldVisibility,selectionMode:`multiple`,onCalciteListChange:()=>this._syncColumnVisibility(),onCalciteListFilter:()=>this.scheduleRender()},this._renderColumnToggleAll(),e.map(e=>{let t=A(e)?e.columns?.map(e=>this._renderColumnListItem({column:e})):void 0;return this._renderColumnListItem({column:e,items:t})}),H(`calcite-notice`,{appearance:`transparent`,kind:`neutral`,open:!0,slot:`filter-no-results`},H(`div`,{slot:`message`},t.noMatchesFound)))}_syncColumnVisibility(){let{effectiveTable:e,_columnVisibilityList:t}=this;if(!t)return;let n=new Set(t.selectedItems.map(e=>e.value)),r=!!this.columnVisibilityMenuConfig?.frozenColumnsExcluded;e.allColumns.forEach(t=>{r&&(t.frozen||t.frozenToEnd)||(n.has(t.fieldName)?e.showColumn(t.fieldName):e.hideColumn(t.fieldName))})}_renderColumnToggleAll(){if(!this.visibleElements.columnVisibilityMenuItems.toggleAll)return;let{_columnVisibilityList:e}=this;if(e&&e.filteredItems?.length)return H(`calcite-button`,{appearance:`transparent`,width:`full`,onclick:()=>this._toggleAllColumns()},this._getColumnToggleAllText())}_getColumnToggleAllText(){let{_columnVisibilityList:e,effectiveTable:t,messages:{menuText:n}}=this;return e?e.filterText===``?t.allColumnsVisible?n.deselectAll:n.selectAll:this._allColumnsAreVisible(e.filteredItems.map(e=>e.value))?n.deselectAll:n.selectAll:``}_renderColumnListItem(e){let{column:t,items:n}=e,{effectiveLabel:r,fieldName:i,hidden:a}=t,o=!(!n?.length||a)||void 0;return H(`calcite-list-item`,{expanded:o,key:`toggle-columns__item-${i}`,label:r,metadata:{description:t.effectiveDescription,type:j(t)?t.field.type:void 0},selected:!a,value:i},n)}_renderLayerDropdown(){let e=this.messages.selectALayer;return H(`div`,{class:Z.layerDropdownMenu,key:`${this.id}-layerDropdown`,slot:`header-actions-start`},H(`calcite-dropdown`,{bind:this,maxItems:5,overlayPositioning:`fixed`,placement:`bottom-start`,topLayerDisabled:this.topLayerDisabled},H(`calcite-action`,{icon:Q.layers,slot:`trigger`,text:e,title:e}),H(`calcite-dropdown-group`,{selectionMode:`single`},this._effectiveLayers.map((e,t)=>this._renderLayerDropdownItem(e,t))??null)))}_renderLayerDropdownItem(e,t){let n=this.visibleElements.layerDropdownIcons;return H(`calcite-dropdown-item`,{iconStart:n?z(e):void 0,key:`dropdown-item-${t}`,label:e.title??``,selected:e===this.layer,value:e.id,onCalciteDropdownItemSelect:()=>this._onTableViewChange(()=>this.layer=e)},e.title)}_onRelatedNavigationItemClick(e){this.viewModel.drainRelatedTablesAboveIndex(e)}_collapseRelatedTable(e){this.viewModel.collapseRelatedTable(this.effectiveTable,e)}_onShowRelatedTable(e){this.showRelatedTableCallback||this.hasPendingEdits||(this._collapseRelatedTable(e),this._createRelatedTable(e))}async _createRelatedTable(e){let{autoRefreshEnabled:t,autoSaveEnabled:n,direction:r,editingEnabled:i,effectiveTable:a,multipleSelectionEnabled:o,paginationEnabled:s,pageSize:c,view:l,viewModel:u}=this,{layer:d,objectId:f,relatedLayer:p,relationshipId:m}=e;await d.load();let h=this.attachmentsEnabled&&F(d),g=new K({layer:d,autoRefreshEnabled:t,autoSaveEnabled:n,attachmentsEnabled:h,direction:r,editingEnabled:i,multipleSelectionEnabled:o,paginationEnabled:s,pageSize:c,relatedRecordsEnabled:!0,relationshipConfig:{objectId:f,relatedLayer:p,relationshipId:m},relationshipColumnConfigs:I(d,m),tableController:this,tableParent:a,view:l,showRelatedTableCallback:e=>u.emit(`show-related-table`,e)});this.relatedTables.add(g),this.scheduleRender()}_renderAttachmentsView(){switch(this.attachmentsViewOptions.effectiveMode){case`list`:return this._renderAttachmentsViewList();case`details`:return this._renderAttachmentsViewDetails();case`file`:return this._renderAttachmentsViewFile()}}_renderAttachmentsViewFile(){let e=this.attachmentsViewOptions,{objectId:t}=e;if(t!=null)return[H(`div`,{class:Z.attachmentsView,key:`attachments-view`},this._renderAttachmentsViewInformation(),H(`div`,{class:Z.attachmentsViewContent,key:`attachments-view-content`},H(`div`,{bind:this,class:Z.attachmentsViewDropArea,ondragover:e=>e.preventDefault(),ondrop:this._onAttachmentsViewDrop},H(`calcite-icon`,{class:Z.attachmentsViewIcon,icon:Q.upload,scale:`l`}),this._renderAttachmentsViewFileLabelNode(),this._renderAttachmentsViewFileMessageNode(),H(`form`,{afterCreate:t=>e.form=t,afterRemoved:()=>e.form=null,bind:this,key:`attachments-form`},H(`fieldset`,null,this._renderAttachmentsViewFileNameNode(),H(`input`,{afterCreate:W,afterRemoved:G,afterUpdate:W,bind:this,"data-node-ref":`_attachmentsInput`,files:e.candidates,hidden:!0,name:`attachment`,type:`file`,onchange:e=>this._onAttachmentsViewCandidateChange(e)}),this._renderAttachmentsViewFileSelectNode(),this._renderAttachmentsViewFileSaveNode(),this._renderAttachmentsViewFileCancelNode())))))]}_renderAttachmentsViewFileLabelNode(){if(this.attachmentsViewOptions.fileMode===`replace`)return H(`span`,{class:Z.attachmentsViewDropAreaLabel,key:`replace-file-node`},this.messages.replaceFile)}_renderAttachmentsViewFileMessageNode(){let e=this.attachmentsViewOptions;if(e.hasCandidates)return;let{messages:t}=this,n=this.supportsAddAttachments?e.objectId==null?t.noFeature:t.dragAndDropToUpload:t.editingRestricted;return H(`span`,{class:Z.attachmentsViewDropAreaMessage,key:`message-node`},n)}_renderAttachmentsViewFileNameNode(){let e=this.attachmentsViewOptions.candidates,t=Array.from(e??[]).at(-1);if(t)return H(`span`,{class:Z.attachmentsViewDropAreaMessage,key:`filename-node`},t.name)}_renderAttachmentsViewFileSelectNode(){if(this.supportsAddAttachments)return H(`calcite-button`,{appearance:`outline-fill`,disabled:this.isSyncingAttachments,iconStart:Q.folderOpen,key:`select-node`,onclick:()=>{this._resetAttachmentsInput(),this._attachmentsInput?.click()}},this.messages.selectFile)}_renderAttachmentsViewFileSaveNode(){let{isSyncingAttachments:e,messages:t}=this,{attachmentInfo:n,hasCandidates:r}=this.attachmentsViewOptions;if(this.supportsAddAttachments&&r)return H(`calcite-button`,{appearance:`solid`,disabled:e,iconStart:Q.save,key:`save-node`,loading:e,onclick:()=>{this.saveAttachmentsViewForm()}},n?t.updateAttachment:t.addAttachment)}_renderAttachmentsViewFileCancelNode(){let{hasAttachments:e,hasCandidates:t}=this.attachmentsViewOptions;if(e||t)return H(`calcite-button`,{appearance:`transparent`,bind:this,disabled:this.isSyncingAttachments,key:`cancel-node`,onclick:()=>{this._resetAttachmentsInput(),this.attachmentsViewOptions.cancel()}},this.messagesCommon.cancel)}_renderAttachmentsViewDetails(){let{attachmentInfo:e}=this.attachmentsViewOptions;if(e)return[H(`div`,{class:Z.attachmentsView,key:`attachments-view`},this._renderAttachmentsViewInformation(),H(`div`,{class:Z.attachmentsViewContent,key:`attachments-view-content`},H(`div`,{class:Z.attachmentsViewDetails},this._renderAttachmentsViewDetailsPreview(e))))]}_renderAttachmentsViewDetailsPreview(e){let t=[this._renderAttachmentsViewDetailsImage(e)];if(S(e.contentType)){let n=this.messages.maximize;t.push(H(`calcite-action`,{icon:Q.expand,label:n,text:n,textEnabled:!0,title:n,onclick:t=>{t.preventDefault(),this.attachmentsViewOptions.dialogId=e.id}}))}return t}_renderAttachmentsViewDetailsImage(e){let{contentType:t,name:n,size:r,url:i}=e,{messages:a}=this;return S(t)?H(`img`,{afterCreate:()=>this._attachmentsDialogPreviewLoading=!0,alt:n,key:`thumbnail-image-${n}`,src:`${i}${i?.includes(`?`)?`&`:`?`}s=${r}`,title:n,onerror:()=>this._attachmentsDialogPreviewLoading=!1,onload:()=>this._attachmentsDialogPreviewLoading=!1}):[H(`calcite-icon`,{icon:C(t),key:`thumbnail-icon-${n}`,scale:`l`,textLabel:n,title:n}),a.noPreviewAvailable]}_renderAttachmentsViewInformation(){let{attachmentsViewOptions:e,messages:t,messagesUnits:n}=this,{attachmentInfo:r,objectId:i}=e;if(r&&i!=null)return H(`div`,{class:Z.attachmentsViewInformation,key:`information`},this._renderAttachmentViewInformationButtons(r,i),H(`span`,{class:Z.attachmentsViewInformationLabel,key:`file-label`},t.fileName),H(`span`,{class:Z.attachmentsViewInformationData,key:`file-value`},r.name),H(`span`,{class:Z.attachmentsViewInformationLabel,key:`type-label`},t.attachmentType),H(`span`,{class:Z.attachmentsViewInformationData,key:`type-value`},this._getLabelForAttachmentType(r)),this._renderAttachmentKeywordDetails(r),H(`span`,{class:Z.attachmentsViewInformationLabel,key:`size-label`},t.size),H(`span`,{class:Z.attachmentsViewInformationData,key:`size-span`},d(n,r.size??0)))}_renderAttachmentViewInformationButtons(e,t){let{attachmentsViewOptions:n,messages:r,messagesCommon:i}=this,a=n.effectiveMode!==`details`,o=e.id,s=[H(`calcite-button`,{appearance:`outline`,disabled:a,key:`download-button`,width:`full`,onclick:e=>{e.preventDefault(),this.downloadAttachmentById(t,o)}},r.download)];return this.supportsUpdateAttachments&&s.push(H(`calcite-button`,{appearance:`outline`,disabled:a,key:`replace-button`,width:`full`,onclick:()=>{n.mode=`file`,n.attachmentId=o}},r.replace)),this.supportsDeleteAttachments&&s.push(H(`calcite-button`,{appearance:`outline`,disabled:a,key:`delete-button`,width:`full`,onclick:()=>{this.deleteAttachments(t,[o],!0)}},i.delete)),s}_renderAttachmentKeywordDetails({keywords:e}){if(e&&e!==``)return[H(`span`,{class:Z.attachmentsViewInformationLabel,key:`keyword-label`},this.messages.keyword),H(`span`,{class:Z.attachmentsViewInformationData,key:`keyword-value`},e)]}_renderAttachmentsViewList(){let{attachmentsViewOptions:e,isSyncingAttachments:t,messages:n,messagesUnits:r}=this,{attachmentInfos:i,objectId:a}=e;return H(`calcite-list`,{afterCreate:W,afterRemoved:G,afterUpdate:W,bind:this,class:Z.attachmentsViewList,"data-node-ref":`attachmentsList`,key:`attachments-list-${a}`,label:n?.attachments,loading:t,selectionMode:this.supportsDeleteAttachments?`multiple`:`none`,onCalciteListChange:()=>this.scheduleRender(),ondragover:e=>e.preventDefault(),ondrop:this._onAttachmentsViewDrop},...i?.map(t=>{let{id:i,name:o,size:s}=t,c=d(r,s??0);return H(`calcite-list-item`,{afterRemoved:()=>this.scheduleRender(),key:`attachment-${i}`,label:o,value:i},this._renderAttachmentsViewListPreview(t),H(`span`,{class:Z.attachmentsViewListFileSize,slot:`actions-end`,title:c},c),H(`calcite-action`,{icon:Q.downloadTo,key:`download`,label:o,slot:`actions-end`,text:n.downloadAttachment,title:n.downloadAttachment,onclick:e=>{e.preventDefault(),this.downloadAttachmentById(a??-1,i)}}),H(`calcite-action`,{icon:Q.chevronRight,iconFlipRtl:!0,key:`details`,label:o,slot:`actions-end`,text:n.viewAttachment,title:n.viewAttachment,onclick:()=>{e.mode=`details`,e.attachmentId=i}}))}))}_renderAttachmentsViewListPreview(e){return H(`div`,{class:Z.attachmentsViewListThumbnail,slot:`content-start`},H(`span`,null,this._renderAttachmentsViewListImage(e)))}_renderAttachmentsViewListImage(e,t=64){let{contentType:n,name:r,size:i,url:a}=e,o=`${a}${a?.includes(`?`)?`&`:`?`}w=${t}&s=${i}`;return this.supportsResizeAttachments&&S(n)?H(`img`,{alt:r,key:`thumbnail-image-${r}`,src:o,title:r}):H(`calcite-icon`,{icon:C(n),key:`thumbnail-icon-${r}`,scale:`l`,textLabel:r,title:r})}_onAttachmentsViewCandidateChange({target:e}){this.attachmentsViewOptions.candidates=e?.files}_onAttachmentsViewDrop(e){e.preventDefault(),(this.supportsAddAttachments||this.supportsUpdateAttachments)&&(this.attachmentsViewOptions.mode=`file`,this.attachmentsViewOptions.candidates=e.dataTransfer?.files)}_resetAttachmentsInput(){this._attachmentsInput&&(this._attachmentsInput.value=``)}_getLabelForAttachmentType({contentType:e}){let t=this.messages,n=w(e);return t.attachmentTypes[n]}_renderNavigationBar(){let{effectiveTable:e,messages:n,messagesCommon:r,navigationScale:i,relatedTable:a,relatedTables:o}=this;if(!this._shouldShowNavigationBar)return;let{attachmentsList:s,attachmentsViewOptions:c,layer:l,supportsAddAttachments:u,supportsDeleteAttachments:d}=e;if(!l)return;let{attachmentInfos:f,objectId:p}=c,m=p!=null,h=f.length,g=s?.selectedItems?.length??0,_=`${l.objectIdField}: ${p}`,v=t(n.selectedCount,{count:g}),y=t(n.attachmentsCount,{count:h}),b=m?H(`calcite-action`,{bind:this,icon:Q.chevronRight,iconFlipRtl:!0,key:`navigation-feature`,scale:i,text:_,textEnabled:!0,title:_,onclick:()=>e.scrollToRow(p)}):void 0,x=m?H(`calcite-action`,{icon:Q.chevronRight,iconFlipRtl:!0,key:`navigation-attachments-label`,label:y,scale:i,text:y,textEnabled:!0,title:y,onclick:()=>{h>0&&(c.mode=`list`)}}):void 0,S=m?H(`calcite-chip`,{closable:!0,closed:g===0,key:`navigation-chip`,kind:`inverse`,label:v,scale:`s`,selected:!0,title:v,value:`selected`,onCalciteChipClose:()=>s?.selectedItems?.forEach(e=>e.selected=!1)},v):void 0,C=a?H(`calcite-label`,{layout:`inline`,scale:i},n.showAllTables,H(`calcite-switch`,{checked:this.allRelatedTablesVisible,scale:i,onCalciteSwitchChange:e=>this.showAllRelatedTables=!!e.currentTarget.checked})):void 0,w=m&&c.effectiveMode===`list`&&p!=null&&g&&d?H(`calcite-action`,{icon:Q.delete,iconFlipRtl:!0,key:`attachments-trash-all`,scale:i,text:r.delete,textEnabled:!0,title:t(n.deleteAttachmentCount,{count:g}),onclick:()=>{e.deleteAttachments(p,s?.selectedItems?.map(e=>e.value)??[],!0)}}):void 0,T=m&&c.effectiveMode===`list`&&u?H(`calcite-action`,{bind:this,icon:Q.plus,iconFlipRtl:!0,key:`attachments-add`,scale:i,text:n.addAttachment,textEnabled:!0,title:n.addAttachment,onclick:()=>{c.objectId=p,c.attachmentId=null,c.mode=`file`}}):void 0;return H(`div`,{class:Z.tableNavigation,key:`table-nav`},H(`calcite-action`,{icon:Q.moveUp,iconFlipRtl:!0,key:`go-back`,scale:i,text:this.layer?.title??``,textEnabled:!1,title:a?n.exitRelatedRecords:n.exitAttachments,onclick:()=>this._onTableViewChange(this._resetNestedViews)}),o.toArray().map((e,t)=>this._renderRelatedTableNavigationAction(e,t)),b,x,H(`div`,null,S,C,w,T))}_renderRelatedTableNavigationAction(e,t){let n=this._getLabelForRelatedTableNavigationAction(e);return H(`calcite-action`,{icon:Q.chevronRight,iconFlipRtl:!0,key:t,scale:this.navigationScale,text:n,textEnabled:!0,title:e.layer?.title||``,onclick:()=>{(t!==this.relatedTables.length-1||this._attachmentsViewIsVisible)&&this._onTableViewChange(()=>this._onRelatedNavigationItemClick(t))}})}_getLabelForRelatedTableNavigationAction(e){let t=e.layer?.title;if(!t)return``;let{relatedTables:n}=this;return n.length<=1?t:n.indexOf(e)!==n.length-1&&t.length>20?`${t.slice(0,20)}...`:t}_allColumnsAreVisible(e){let t=this.columnVisibilityMenuConfig;return e.every(e=>{let n=this.findColumn(e);return n?t?.frozenColumnsExcluded&&(n.frozen||n.frozenToEnd)?!0:n.effectiveVisible:!1})}_toggleAllColumns(){let{_columnVisibilityList:e,effectiveTable:t}=this,n=e?.filteredItems.map(e=>e.value);e?.filterText!==``&&n?.length?this._allColumnsAreVisible(n)?n.forEach(e=>this.hideColumn(e)):n.forEach(e=>this.showColumn(e)):t.allColumnsVisible?t.visibilityMenuColumns.forEach(e=>t.hideColumn(e.fieldName)):t.visibilityMenuColumns.forEach(e=>t.showColumn(e.fieldName))}};e([f()],$.prototype,`_attachmentsDialogPreviewLoading`,void 0),e([f()],$.prototype,`_attachmentsInput`,void 0),e([f()],$.prototype,`_attachmentsViewIsVisible`,null),e([f()],$.prototype,`_columnVisibilityActions`,void 0),e([f()],$.prototype,`_columnVisibilityActionDisabled`,null),e([f()],$.prototype,`_columnVisibilityList`,void 0),e([f()],$.prototype,`_dialogIsOpen`,null),e([f()],$.prototype,`_effectiveDescription`,null),e([f()],$.prototype,`_effectiveLayers`,null),e([f()],$.prototype,`_effectiveTitle`,null),e([f()],$.prototype,`_effectiveVisibleElements`,null),e([f()],$.prototype,`_filteredTables`,null),e([f()],$.prototype,`_hasAttachmentsViewError`,null),e([f()],$.prototype,`_hasCustomMenuItems`,null),e([f()],$.prototype,`_hasDefaultMenuItems`,null),e([f()],$.prototype,`_shouldShowGrid`,null),e([f()],$.prototype,`_shouldShowMenu`,null),e([f()],$.prototype,`_showClearSelectionAction`,null),e([f()],$.prototype,`_showColumnVisibilityAction`,null),e([f()],$.prototype,`_showDeleteSelectionAction`,null),e([f()],$.prototype,`_showExportSelectionToCSVAction`,null),e([f()],$.prototype,`_showLayerDropdown`,null),e([f()],$.prototype,`_shouldShowNavigationBar`,null),e([f()],$.prototype,`_showRefreshDataAction`,null),e([f()],$.prototype,`_showSelectedRecordsShowSelectedAction`,null),e([f()],$.prototype,`_showSelectedRecordsShowAllAction`,null),e([f()],$.prototype,`_showZoomToSelectionAction`,null),e([f()],$.prototype,`_viewLayers`,null),e([f()],$.prototype,`attachmentsList`,void 0),e([f()],$.prototype,`direction`,null),e([f({readOnly:!0})],$.prototype,`grid`,null),e([f()],$.prototype,`actionColumn`,null),e([f()],$.prototype,`actionColumnConfig`,null),e([f({readOnly:!0})],$.prototype,`activeFilters`,null),e([f({readOnly:!0})],$.prototype,`activeSortOrders`,null),e([f()],$.prototype,`allColumns`,null),e([f()],$.prototype,`allColumnsVisible`,null),e([f({readOnly:!0})],$.prototype,`allRelatedTablesVisible`,null),e([f()],$.prototype,`allVisibleColumns`,null),e([f()],$.prototype,`attachmentsColumns`,null),e([f()],$.prototype,`attachmentsEnabled`,null),e([f()],$.prototype,`attachmentsViewOptions`,null),e([f({type:y})],$.prototype,`attributeTableTemplate`,null),e([f()],$.prototype,`autoRefreshEnabled`,null),e([f()],$.prototype,`autoSaveEnabled`,null),e([f()],$.prototype,`canAddRelatedFeature`,null),e([f()],$.prototype,`clearPrompt`,null),e([f()],$.prototype,`closed`,void 0),e([f()],$.prototype,`collapsed`,void 0),e([f()],$.prototype,`columnPerformanceModeEnabled`,null),e([f()],$.prototype,`columnReorderingEnabled`,null),e([f({readOnly:!0})],$.prototype,`columns`,null),e([f()],$.prototype,`columnVisibilityMenuConfig`,void 0),e([f()],$.prototype,`defaultSelectionManager`,null),e([f()],$.prototype,`definitionExpression`,null),e([f()],$.prototype,`description`,void 0),e([f()],$.prototype,`disabled`,void 0),e([f()],$.prototype,`editingEnabled`,null),e([f()],$.prototype,`effectiveSelectionManager`,null),e([f()],$.prototype,`effectiveSize`,null),e([f()],$.prototype,`effectiveTable`,null),e([f()],$.prototype,`effectiveTimeExtent`,null),e([f()],$.prototype,`fieldColumns`,null),e([f({types:m})],$.prototype,`filterGeometry`,null),e([f()],$.prototype,`filterBySelectionEnabled`,null),e([f()],$.prototype,`filterByViewExtent`,null),e([f()],$.prototype,`filterByLayerScaleRange`,null),e([f()],$.prototype,`groupColumns`,null),e([f()],$.prototype,`hasContingentValues`,null),e([f()],$.prototype,`hasInvalidPendingEdits`,null),e([f()],$.prototype,`hasPendingEdits`,null),e([f()],$.prototype,`hiddenFields`,null),e([f()],$.prototype,`highlightEnabled`,null),e([f()],$.prototype,`highlightIds`,null),e([f()],$.prototype,`icon`,null),e([f()],$.prototype,`initialSize`,null),e([f()],$.prototype,`isQueryingOrSyncing`,null),e([f()],$.prototype,`isSyncing`,null),e([f()],$.prototype,`isSyncingAttachments`,null),e([f()],$.prototype,`label`,null),e([f()],$.prototype,`layer`,null),e([f()],$.prototype,`layers`,null),e([f()],$.prototype,`layerView`,null),e([f()],$.prototype,`maxSize`,null),e([f(),B(`esri/widgets/FeatureTable/t9n/FeatureTable`)],$.prototype,`messages`,null),e([f(),B(`esri/t9n/common`)],$.prototype,`messagesCommon`,null),e([f(),B(`esri/widgets/Editor/t9n/Editor`)],$.prototype,`messagesEditor`,void 0),e([f(),B(`esri/core/t9n/Units`)],$.prototype,`messagesUnits`,null),e([f(),B(`esri/widgets/support/t9n/uriUtils`)],$.prototype,`messagesURIUtils`,null),e([f()],$.prototype,`menuConfig`,null),e([f()],$.prototype,`multipleSelectionEnabled`,null),e([f()],$.prototype,`multipleSelectionEnabledOverride`,null),e([f()],$.prototype,`multiSortEnabled`,null),e([f()],$.prototype,`multipleSortPriority`,null),e([f()],$.prototype,`navigationScale`,void 0),e([f()],$.prototype,`noDataMessage`,null),e([f()],$.prototype,`objectIds`,null),e([f()],$.prototype,`outFields`,null),e([f()],$.prototype,`pageCount`,null),e([f()],$.prototype,`pageIndex`,null),e([f()],$.prototype,`pageSize`,null),e([f()],$.prototype,`paginationEnabled`,null),e([f()],$.prototype,`pendingEditsCount`,null),e([f()],$.prototype,`prompt`,null),e([f()],$.prototype,`relatedRecordsEnabled`,null),e([f()],$.prototype,`relatedTable`,null),e([f()],$.prototype,`relatedTableHasContingentValues`,null),e([f()],$.prototype,`relatedTableHasInvalidPendingEdits`,null),e([f()],$.prototype,`relatedTableHasPendingEdits`,null),e([f()],$.prototype,`relatedTables`,null),e([f()],$.prototype,`relationship`,null),e([f()],$.prototype,`relationshipColumnConfigs`,null),e([f()],$.prototype,`relationshipColumns`,null),e([f()],$.prototype,`relationshipConfig`,null),e([f()],$.prototype,`relationshipInfos`,null),e([f()],$.prototype,`returnGeometryEnabled`,null),e([f()],$.prototype,`returnMEnabled`,null),e([f()],$.prototype,`returnZEnabled`,null),e([f()],$.prototype,`rowHighlightIds`,null),e([f()],$.prototype,`selectionManager`,null),e([f()],$.prototype,`selectionSource`,null),e([f()],$.prototype,`showAllRelatedTables`,null),e([f()],$.prototype,`showPrompt`,null),e([f()],$.prototype,`showRelatedTableCallback`,null),e([f()],$.prototype,`size`,null),e([f({readOnly:!0})],$.prototype,`state`,null),e([f()],$.prototype,`supportsAddAttachments`,null),e([f()],$.prototype,`supportsAttachments`,null),e([f()],$.prototype,`supportsDeleteAttachments`,null),e([f()],$.prototype,`supportsResizeAttachments`,null),e([f()],$.prototype,`supportsUpdateAttachments`,null),e([f()],$.prototype,`syncTemplateOnChangesEnabled`,null),e([f()],$.prototype,`syncViewSelection`,null),e([f()],$.prototype,`syncWithViewSelectionManager`,null),e([f({constructOnly:!0})],$.prototype,`tableController`,null),e([f({constructOnly:!0})],$.prototype,`tableParent`,null),e([f({type:M})],$.prototype,`tableTemplate`,null),e([f()],$.prototype,`tableTemplateOverride`,null),e([f()],$.prototype,`title`,void 0),e([f({type:b})],$.prototype,`timeExtent`,null),e([f()],$.prototype,`timeZone`,null),e([f()],$.prototype,`view`,null),e([f({type:O}),V([`cell-click`,`cell-dblclick`,`cell-pointerover`,`cell-pointerout`,`cell-keydown`,`column-reorder`,`show-related-table`])],$.prototype,`viewModel`,void 0),e([f()],$.prototype,`viewTimeEnabled`,null),e([f()],$.prototype,`visibleColumns`,null),e([f({type:k,nonNullable:!0})],$.prototype,`visibleElements`,void 0),e([f({type:k})],$.prototype,`visibleElementsOverride`,null),e([f()],$.prototype,`visibilityMenuColumns`,null),$=K=e([p(`esri.widgets.FeatureTable`)],$);const ee=$;export{ee as default};
2
+ import{__decorate as e}from"tslib";import{substitute as t}from"../intl.js";import{isSome as n}from"../core/arrayUtils.js";import{deprecateWidget as r}from"../core/deprecate.js";import i from"../core/Logger.js";import{watch as a,sync as o,syncAndInitial as s,initial as c,on as l}from"../core/reactiveUtils.js";import{renderingSanitizer as u}from"../core/sanitizerUtils.js";import{formatFileSize as d}from"../core/unitFormatUtils.js";import{property as f,subclass as p}from"../core/accessorSupport/decorators.js";import{geometryTypes as m}from"../geometry/support/typeUtils.js";import{isLayerFromCatalog as h}from"../layers/catalog/catalogUtils.js";import{isKnowledgeGraphLayer as g,isMapImageLayer as _,isSubtypeGroupLayer as v}from"../layers/support/layerUtils.js";import y from"../tables/AttributeTableTemplate.js";import b from"../time/TimeExtent.js";import x from"./Widget.js";import{isSupportedImage as S,getCalciteIconForAttachment as C,getAttachmentTypeCategory as w}from"./Attachments/support/attachmentUtils.js";import{loadPromptComponents as T,Prompt as ee}from"./Editor/components/Prompt.js";import E from"./FeatureTable/ColumnMenuVisibleElements.js";import D from"./FeatureTable/FeatureTableViewModel.js";import O from"./FeatureTable/VisibleElements.js";import{isGroupColumn as k,isFieldColumn as A}from"./FeatureTable/support/columnUtils.js";import j from"./FeatureTable/support/TableTemplate.js";import{loadFieldColumnComponents as M,isIFeatureTableSupportedLayer as N,isIFeatureTableSupportedLayerWithAttachments as P,getRelationshipIdsToShow as F}from"./FeatureTable/support/tableUtils.js";import{createDropdownReference as I,loadCalciteComponents as L}from"./support/componentsUtils.js";import{globalCss as R}from"./support/globalCss.js";import{getIconForLayer as z}from"./support/iconUtils.js";import{messageBundle as B,vmEvent as V,tsx as H,tsxFragment as U}from"./support/widget.js";import{storeNode as W,discardNode as G}from"./support/widgetUtils.js";var K;const q=`esri-feature-table`,J=`${q}__dialog`,Y=`${q}__table-navigation`,X=`${q}__attachments-view`,Z={base:q,content:`${q}__content`,menuPopover:`${q}__menu-popover`,layerDropdownMenu:`${q}__layer-switcher-menu`,tableContainer:`${q}__table-container`,tableContainerWithAttachments:`${q}__table-container--attachments`,tableNavigation:Y,attachmentsView:X,attachmentsViewContent:`${X}__content`,attachmentsViewDetails:`${X}__details`,attachmentsViewDropArea:`${X}__drop-area`,attachmentsViewDropAreaLabel:`${X}__drop-area__label`,attachmentsViewDropAreaMessage:`${X}__drop-area__message`,attachmentsViewIcon:`${X}__icon`,attachmentsViewInformation:`${X}__information`,attachmentsViewInformationData:`${X}__information__data`,attachmentsViewInformationLabel:`${X}__information__label`,attachmentsViewList:`${X}__list`,attachmentsViewListFileSize:`${X}__list__filesize`,attachmentsViewListThumbnail:`${X}__list__thumbnail`,expanded:`${q}__expanded`,collapsed:`${q}__collapsed`,dialog:`${J}`,dialogContent:`${J}__content`,dialogHeader:`${J}__header`,footerMessage:`${q}__footer__message`,footerIconDanger:`${q}__footer__icon--danger`,footerIconSuccess:`${q}__footer__icon--success`},Q={checkCircle:`check-circle`,chevronRight:`chevron-right`,clearSelection:`clear-selection`,downloadTo:`download-to`,exclamationMarkTriangle:`exclamation-mark-triangle`,expand:`expand`,exportToCSV:`file-csv`,folderOpen:`folder-open`,delete:`trash`,layers:`layers`,moveUp:`move-up`,plus:`plus`,refresh:`refresh`,reset:`reset`,save:`save`,showAll:`selection-x`,showColumn:`show-column`,showSelected:`selection-filter`,table:`table`,upload:`upload`,zoomToSelection:`zoom-to-object`};let $=K=class extends x{constructor(e,t){super(e,t),this._layerDropdownReference=I(),this._attachmentsDialogPreviewLoading=!1,this._attachmentsInput=null,this._columnVisibilityActions=new Map,this._columnVisibilityList=null,this.attachmentsList=null,this.closed=!1,this.collapsed=!1,this.columnVisibilityMenuConfig=null,this.description=null,this.disabled=!1,this.messagesEditor=null,this.navigationScale=`m`,this.title=null,this.viewModel=new D,this.visibleElements=new O,this.announceDeprecation=()=>{r(i.getLogger(this),`Feature Table`,`arcgis-feature-table`,{version:`5.0`})},this._showDeleteSelectionPrompt=this._showDeleteSelectionPrompt.bind(this),this._showDiscardEditsPrompt=this._showDiscardEditsPrompt.bind(this),this._resetNestedViews=this._resetNestedViews.bind(this)}initialize(){this.addHandles([a(()=>[this.isQueryingOrSyncing,this.editingEnabled],()=>this.scheduleRender()),a(()=>[this._effectiveVisibleElements,this._effectiveVisibleElements.columnDescriptions,this._effectiveVisibleElements.columnMenus,this._effectiveVisibleElements.columnMenuItems,this.columns.length],()=>{this.columns.forEach(e=>e.visibleElements=this._effectiveVisibleElements),this.refreshCellContent()},o),a(()=>[this.topLayerDisabled,this.columns],()=>this.columns.forEach(e=>e.topLayerDisabled=this.topLayerDisabled),s),a(()=>this._effectiveVisibleElements.selectionColumn,e=>{this.grid&&(this.grid.selectionColumnEnabled=e)},c),l(()=>this.viewModel,`show-related-table`,e=>this._onShowRelatedTable(e)),a(()=>this.editingEnabled,()=>{let{attachmentsViewOptions:e}=this;this.clearPrompt(),e&&(e.form?.reset(),e.candidates=null)}),l(()=>this.effectiveTable,`column-reorder`,()=>this.scheduleRender())])}loadDependencies(){return Promise.all([L({action:()=>import(`@esri/calcite-components/dist/components/calcite-action`),alert:()=>import(`@esri/calcite-components/dist/components/calcite-alert`),button:()=>import(`@esri/calcite-components/dist/components/calcite-button`),chip:()=>import(`@esri/calcite-components/dist/components/calcite-chip`),dialog:()=>import(`@esri/calcite-components/dist/components/calcite-dialog`),dropdown:()=>import(`@esri/calcite-components/dist/components/calcite-dropdown`),"dropdown-group":()=>import(`@esri/calcite-components/dist/components/calcite-dropdown-group`),"dropdown-item":()=>import(`@esri/calcite-components/dist/components/calcite-dropdown-item`),icon:()=>import(`@esri/calcite-components/dist/components/calcite-icon`),label:()=>import(`@esri/calcite-components/dist/components/calcite-label`),list:()=>import(`@esri/calcite-components/dist/components/calcite-list`),"list-item":()=>import(`@esri/calcite-components/dist/components/calcite-list-item`),notice:()=>import(`@esri/calcite-components/dist/components/calcite-notice`),pagination:()=>import(`@esri/calcite-components/dist/components/calcite-pagination`),panel:()=>import(`@esri/calcite-components/dist/components/calcite-panel`),popover:()=>import(`@esri/calcite-components/dist/components/calcite-popover`),progress:()=>import(`@esri/calcite-components/dist/components/calcite-progress`),switch:()=>import(`@esri/calcite-components/dist/components/calcite-switch`),tooltip:()=>import(`@esri/calcite-components/dist/components/calcite-tooltip`)}),T(),M()])}destroy(){this._layerDropdownReference.destroy(),this.drainRelatedTables(),this.clearPrompt()}get _attachmentsViewIsVisible(){return!!(this.attachmentsViewOptions.objectId!=null||this.relatedTables.some(e=>e.attachmentsViewOptions.objectId!=null))}get _columnVisibilityActionDisabled(){let e=this.effectiveTable;return e.menuConfig?.disabled??e.columns.length===0}get _dialogIsOpen(){return!!this.attachmentsViewOptions.dialogInfo}get _effectiveDescription(){let{description:e}=this;return e==null?void 0:u.sanitize(typeof e==`function`?e():e)}get _effectiveLayers(){let{layer:e,layers:t}=this,n=t?.length?t.filter(N):[],r=n.length?n:[...this._viewLayers];return e&&!r.includes(e)&&r.push(e),r}get _effectiveTitle(){let{layer:e,messages:n,state:r,highlightIds:i,title:a,size:o}=this;if(a)return u.sanitize(typeof a==`function`?a():a);if(!n)return``;if(!e)return n.noLayer;switch(r){case`disabled`:return n.errorLayer;case`ready`:case`loading`:return n.loading;case`error`:return n.errorData}return t(n.header,{title:u.sanitize(e.title),count:o,selected:i.length})}get _effectiveVisibleElements(){return this.visibleElementsOverride??this.visibleElements}get _filteredTables(){let e=this.relatedTables.toArray(),t=e.length===1;return this.allRelatedTablesVisible?e:t?[e[0]]:this._attachmentsViewIsVisible?e.slice(-1):e.slice(-2)}get _hasAttachmentsViewError(){return this.attachmentsViewOptions.error!=null}get _hasCustomMenuItems(){return!!this.menuConfig?.items?.length}get _hasDefaultMenuItems(){return!!(this._showClearSelectionAction||this._showDeleteSelectionAction||this._showExportSelectionToCSVAction||this._showRefreshDataAction||this._showZoomToSelectionAction||this._showSelectedRecordsShowSelectedAction||this._showSelectedRecordsShowAllAction||this._showColumnVisibilityAction)}get _shouldShowGrid(){return this.allRelatedTablesVisible||this.relatedTables.length===1&&!this._attachmentsViewIsVisible}get _shouldShowMenu(){let{header:e,menu:t}=this._effectiveVisibleElements;return!!(e&&t&&(this._hasDefaultMenuItems||this._hasCustomMenuItems))}get _showClearSelectionAction(){return!!(this.effectiveTable.highlightIds.length&&this._effectiveVisibleElements.menuItems?.clearSelection&&!this._attachmentsViewIsVisible)}get _showColumnVisibilityAction(){let{columnVisibilityMenu:e,header:t,menu:n,menuItems:r}=this._effectiveVisibleElements;return!(!t||!n||!e||r?.toggleColumns===!1||this.showRelatedTableCallback||this.allRelatedTablesVisible||this._attachmentsViewIsVisible)}get _showDeleteSelectionAction(){return!!(this.editingEnabled&&this.highlightIds.length&&this._effectiveVisibleElements.menuItems?.deleteSelection&&this.layer?.capabilities?.operations?.supportsDelete&&!this.relatedTables.length&&!this._attachmentsViewIsVisible)}get _showExportSelectionToCSVAction(){return!!(this._effectiveVisibleElements.menuItems.exportSelectionToCSV&&this.layer&&this.highlightIds.length&&!this.relatedTables.length)}get _showLayerDropdown(){return!!(this._effectiveLayers.length&&this._effectiveVisibleElements.layerDropdown)}get _shouldShowNavigationBar(){let e=!!this.relatedTable||this._attachmentsViewIsVisible;return!this.tableParent&&e}get _showRefreshDataAction(){return!!this._effectiveVisibleElements.menuItems?.refreshData}get _showSelectedRecordsShowSelectedAction(){let e=this.objectIds.length,t=this.highlightIds.length;return!(!t||!this._effectiveVisibleElements.menuItems?.selectedRecordsShowSelectedToggle||e&&t===e||this.relatedTables.length||this._attachmentsViewIsVisible)}get _showSelectedRecordsShowAllAction(){return!!(this._effectiveVisibleElements.menuItems?.selectedRecordsShowAllToggle&&this.objectIds.length&&!this.relatedTables.length)}get _showZoomToSelectionAction(){let e=this.effectiveTable;return!!(e.view&&e.highlightIds.length&&!e.layer?.isTable&&this._effectiveVisibleElements.menuItems?.zoomToSelection)}get _viewLayers(){let e=this.view?.map;if(!e)return[];let t=new Set,n=e=>{N(e)&&!v(e)&&!t.has(e)&&(e.type!==`sublayer`||e.capabilities?.operations?.supportsQuery)&&(e.load().catch(()=>{}),t.add(e))},r=e=>{h(e)||e.type===`catalog-footprint`||(g(e)?(e.load().catch(()=>{}),e.layers?.forEach(n),e.tables?.forEach(n)):_(e)?(e.loadAll().catch(()=>{}),e.allSublayers?.forEach(n),e.subtables?.forEach(n)):v(e)?(e.loadAll().catch(()=>{}),e.sublayers?.forEach(n)):n(e))};return e.allLayers.forEach(r),e.allTables.forEach(r),[...t.values()]}get direction(){return this.viewModel.direction}set direction(e){this.viewModel.direction=e}get grid(){return this.viewModel.grid}get actionColumn(){return this.viewModel.actionColumn}get actionColumnConfig(){return this.viewModel.actionColumnConfig}set actionColumnConfig(e){this.viewModel.actionColumnConfig=e}get activeFilters(){return this.viewModel.activeFilters}get activeSortOrders(){return this.viewModel.activeSortOrders}get allColumns(){return this.viewModel.allColumns}get allColumnsVisible(){return this.viewModel.allColumnsVisible}get allRelatedTablesVisible(){return this.viewModel.allRelatedTablesVisible}get allVisibleColumns(){return this.viewModel.allVisibleColumns}get attachmentsColumns(){return this.viewModel.attachmentsColumns}get attachmentsEnabled(){return this.viewModel.attachmentsEnabled}set attachmentsEnabled(e){this.viewModel.attachmentsEnabled=e}get attachmentsViewOptions(){return this.viewModel.attachmentsViewOptions}set attachmentsViewOptions(e){this.viewModel.attachmentsViewOptions=e}get attributeTableTemplate(){return this.viewModel.attributeTableTemplate}set attributeTableTemplate(e){this.viewModel.attributeTableTemplate=e}get autoRefreshEnabled(){return this.viewModel.autoRefreshEnabled}set autoRefreshEnabled(e){this.viewModel.autoRefreshEnabled=e}get autoSaveEnabled(){return this.viewModel.autoSaveEnabled}set autoSaveEnabled(e){this.viewModel.autoSaveEnabled=e}get canAddRelatedFeature(){return this.viewModel.canAddRelatedFeature}get clearPrompt(){return this.viewModel.clearPrompt}set clearPrompt(e){this.viewModel.clearPrompt=e}get columnPerformanceModeEnabled(){return this.viewModel.columnPerformanceModeEnabled}set columnPerformanceModeEnabled(e){this.viewModel.columnPerformanceModeEnabled=e}get columnReorderingEnabled(){return this.viewModel.columnReorderingEnabled}set columnReorderingEnabled(e){this.viewModel.columnReorderingEnabled=e}get columns(){return this.viewModel.columns}get defaultSelectionManager(){return this.viewModel.defaultSelectionManager}get definitionExpression(){return this.viewModel.definitionExpression}set definitionExpression(e){this.viewModel.definitionExpression=e}get container(){return super.container}set container(e){super.container=e}get editingEnabled(){return this.viewModel.editingEnabled}set editingEnabled(e){this.viewModel.editingEnabled=e}get effectiveSelectionManager(){return this.viewModel.effectiveSelectionManager}get effectiveSize(){return this.viewModel.effectiveSize}get effectiveTable(){return this.relatedTable||this}get effectiveTimeExtent(){return this.viewModel.effectiveTimeExtent}get fieldColumns(){return this.viewModel.fieldColumns}get filterGeometry(){return this.viewModel.filterGeometry}set filterGeometry(e){this.viewModel.filterGeometry=e}get filterBySelectionEnabled(){return this.viewModel.filterBySelectionEnabled}set filterBySelectionEnabled(e){this.viewModel.filterBySelectionEnabled=e}get filterByViewExtent(){return this.viewModel.filterByViewExtent}set filterByViewExtent(e){this.viewModel.filterByViewExtent=e}get filterByLayerScaleRange(){return this.viewModel.filterByLayerScaleRange}set filterByLayerScaleRange(e){this.viewModel.filterByLayerScaleRange=e}get groupColumns(){return this.viewModel.groupColumns}get hasContingentValues(){return this.viewModel.hasContingentValues}get hasInvalidPendingEdits(){return this.viewModel.hasInvalidPendingEdits}get hasPendingEdits(){return this.viewModel.hasPendingEdits}get hiddenFields(){return this.viewModel.hiddenFields}set hiddenFields(e){this.viewModel.hiddenFields=e}get highlightEnabled(){return this.viewModel.highlightEnabled}set highlightEnabled(e){this.viewModel.highlightEnabled=e}get highlightIds(){return this.viewModel.highlightIds}set highlightIds(e){this.viewModel.highlightIds=e}get icon(){return Q.table}set icon(e){this._overrideIfSome(`icon`,e)}get initialSize(){return this.viewModel.initialSize}set initialSize(e){this.viewModel.initialSize=e}get isQueryingOrSyncing(){return this.viewModel.isQueryingOrSyncing}get isSyncing(){return this.viewModel.isSyncing}get isSyncingAttachments(){return this.viewModel.isSyncingAttachments}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 layers(){return this.viewModel.layers}set layers(e){this.viewModel.layers=e}get layerView(){return this.viewModel.layerView}get maxSize(){return this.viewModel.maxSize}set maxSize(e){this.viewModel.maxSize=e}get messages(){return this.viewModel.messages}set messages(e){this.viewModel.messages=e}get messagesCommon(){return this.viewModel.messagesCommon}set messagesCommon(e){this.viewModel.messagesCommon=e}get messagesUnits(){return this.viewModel.messagesUnits}set messagesUnits(e){this.viewModel.messagesUnits=e}get messagesURIUtils(){return this.viewModel.messagesURIUtils}set messagesURIUtils(e){this.viewModel.messagesURIUtils=e}get menuConfig(){return this.viewModel.menuConfig}set menuConfig(e){this.viewModel.menuConfig=e}get multipleSelectionEnabled(){return this.viewModel.multipleSelectionEnabled}set multipleSelectionEnabled(e){this.viewModel.multipleSelectionEnabled=e}get multipleSelectionEnabledOverride(){return this.viewModel.multipleSelectionEnabledOverride}set multipleSelectionEnabledOverride(e){this.viewModel.multipleSelectionEnabledOverride=e}get multiSortEnabled(){return this.viewModel.multiSortEnabled}set multiSortEnabled(e){this.viewModel.multiSortEnabled=e}get multipleSortPriority(){return this.viewModel.multipleSortPriority}set multipleSortPriority(e){this.viewModel.multipleSortPriority=e}get noDataMessage(){return this.viewModel.noDataMessage}set noDataMessage(e){this.viewModel.noDataMessage=e}get objectIds(){return this.viewModel.objectIds}set objectIds(e){this.viewModel.objectIds=e}get outFields(){return this.viewModel.outFields}set outFields(e){this.viewModel.outFields=e}get pageCount(){return this.viewModel.pageCount}get pageIndex(){return this.viewModel.pageIndex}set pageIndex(e){this.viewModel.pageIndex=e}get pageSize(){return this.viewModel.pageSize}set pageSize(e){this.viewModel.pageSize=e}get paginationEnabled(){return this.viewModel.paginationEnabled}set paginationEnabled(e){this.viewModel.paginationEnabled=e}get pendingEditsCount(){return this.viewModel.pendingEditsCount}get prompt(){return this.viewModel.prompt}set prompt(e){this.viewModel.prompt=e}get relatedRecordsEnabled(){return this.viewModel.relatedRecordsEnabled}set relatedRecordsEnabled(e){this.viewModel.relatedRecordsEnabled=e}get relatedTable(){return this.viewModel.relatedTable}get relatedTableHasContingentValues(){return this.viewModel.relatedTableHasContingentValues}get relatedTableHasInvalidPendingEdits(){return this.viewModel.relatedTableHasInvalidPendingEdits}get relatedTableHasPendingEdits(){return this.viewModel.relatedTableHasPendingEdits}get relatedTables(){return this.viewModel.relatedTables}get relationship(){return this.viewModel.relationship}get relationshipColumnConfigs(){return this.viewModel.relationshipColumnConfigs}set relationshipColumnConfigs(e){this.viewModel.relationshipColumnConfigs=e}get relationshipColumns(){return this.viewModel.relationshipColumns}get relationshipConfig(){return this.viewModel.relationshipConfig}set relationshipConfig(e){this.viewModel.relationshipConfig=e}get relationshipInfos(){return this.viewModel.relationshipInfos}get returnGeometryEnabled(){return this.viewModel.returnGeometryEnabled}set returnGeometryEnabled(e){this.viewModel.returnGeometryEnabled=e}get returnMEnabled(){return this.viewModel.returnMEnabled}set returnMEnabled(e){this.viewModel.returnMEnabled=e}get returnZEnabled(){return this.viewModel.returnZEnabled}set returnZEnabled(e){this.viewModel.returnZEnabled=e}get rowHighlightIds(){return this.viewModel.rowHighlightIds}set rowHighlightIds(e){this.viewModel.rowHighlightIds=e}get selectionManager(){return this.viewModel.selectionManager}set selectionManager(e){this.viewModel.selectionManager=e}get selectionSource(){return this.viewModel.selectionSource}set selectionSource(e){this.viewModel.selectionSource=e}get showAllRelatedTables(){return this.viewModel.showAllRelatedTables}set showAllRelatedTables(e){this.viewModel.showAllRelatedTables=e}get showPrompt(){return this.viewModel.showPrompt}set showPrompt(e){this.viewModel.showPrompt=e}get showRelatedTableCallback(){return this.viewModel.showRelatedTableCallback}set showRelatedTableCallback(e){this.viewModel.showRelatedTableCallback=e}get size(){return this.viewModel.size}get state(){return this.viewModel.state}get supportsAddAttachments(){return this.viewModel.supportsAddAttachments}get supportsAttachments(){return this.viewModel.supportsAttachments}get supportsDeleteAttachments(){return this.viewModel.supportsDeleteAttachments}get supportsResizeAttachments(){return this.viewModel.supportsResizeAttachments}get supportsUpdateAttachments(){return this.viewModel.supportsUpdateAttachments}get syncTemplateOnChangesEnabled(){return this.viewModel.syncTemplateOnChangesEnabled}set syncTemplateOnChangesEnabled(e){this.viewModel.syncTemplateOnChangesEnabled=e}get syncViewSelection(){return this.viewModel.syncViewSelection}set syncViewSelection(e){this.viewModel.syncViewSelection=e}get syncWithViewSelectionManager(){return this.syncViewSelection}set syncWithViewSelectionManager(e){this.syncViewSelection=e}get tableController(){return this.viewModel.tableController}set tableController(e){this.viewModel.tableController=e}get tableParent(){return this.viewModel.tableParent}set tableParent(e){this.viewModel.tableParent=e}get tableTemplate(){return this.viewModel.tableTemplate}set tableTemplate(e){this.viewModel.tableTemplate=e}get tableTemplateOverride(){return this.viewModel.tableTemplateOverride}set tableTemplateOverride(e){this.viewModel.tableTemplateOverride=e}get timeExtent(){return this.viewModel.timeExtent}set timeExtent(e){this.viewModel.timeExtent=e}get timeZone(){return this.viewModel.timeZone}set timeZone(e){this.viewModel.timeZone=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}get viewTimeEnabled(){return this.viewModel.viewTimeEnabled}set viewTimeEnabled(e){this.viewModel.viewTimeEnabled=e}get visibleColumns(){return this.viewModel.visibleColumns}get visibleElementsOverride(){let{attachmentsViewOptions:e,relatedTable:t,tableController:n,visibleElements:r}=this,{columnDescriptions:i,columnMenus:a,tooltips:o}=r,s=e.objectId!=null;if(t)return new O({columnDescriptions:i,columnMenus:a,tooltips:o,close:r.close,header:r.header,layerDropdown:r.layerDropdown,layerDropdownIcons:r.layerDropdownIcons,menu:r.menu,menuItems:r.menuItems,progress:r.progress,selectionColumn:!1,columnMenuItems:new E({sortAscending:!1,sortDescending:!1})});if(n){let e=n.relatedTable===this,t=n.allRelatedTablesVisible,c=e&&r.selectionColumn&&!t&&!s,l=e&&!t&&!s;return new O({columnDescriptions:i,columnMenus:a,tooltips:o,selectionColumn:c,close:!1,header:!1,layerDropdown:!1,menu:!1,pendingEditsFooter:!1,progress:!1,columnMenuItems:new E({sortAscending:l,sortDescending:l})})}return s?new O({columnDescriptions:i,columnMenus:a,tooltips:o,close:r.close,header:r.header,layerDropdown:r.layerDropdown,layerDropdownIcons:r.layerDropdownIcons,menu:r.menu,menuItems:r.menuItems,progress:r.progress,selectionColumn:!1,columnMenuItems:new E({sortAscending:!1,sortDescending:!1})}):null}addPendingEdits(e){this.viewModel.addPendingEdits(e)}clearSelection(){this.effectiveTable.viewModel.clearSelection()}async deleteAttachments(e,t,n){e!=null&&t?.length&&(n?this._showDeleteAttachmentPrompt(e,t):await this.viewModel.deleteAttachments(e,t))}async deleteSelection(e){this.highlightIds.length&&(e?this._showDeleteSelectionPrompt():await this.viewModel.deleteSelection())}async discardPendingEdits(e,t){return t?this._showDiscardEditsPrompt(e):this.viewModel.discardPendingEdits(e)}async downloadAttachmentById(e,t){return this.viewModel.downloadAttachmentById(e,t)}drainRelatedTables(){this.viewModel.drainRelatedTables()}async exportSelectionToCSV(e){return this.viewModel.exportSelectionToCSV(e)}findColumn(e){return this.viewModel.findColumn(e)}getFeatureStoreItemByObjectId(e){return this.viewModel.getFeatureStoreItemByObjectId(e)}goToPage(e){this.viewModel.goToPage(e)}hideAllColumns(){this.viewModel.hideAllColumns()}hideColumn(e){this.grid?.hideColumn(e)}nextPage(){this.viewModel.nextPage()}previousPage(){this.viewModel.previousPage()}async refresh(){await this.viewModel.refresh()}refreshCellContent(){this.viewModel.refreshCellContent()}async saveAttachmentsViewForm(){await this.viewModel.saveAttachmentsViewForm()}async savePendingEdits(){await this.viewModel.savePendingEdits()}showAllColumns(){this.viewModel.showAllColumns()}showColumn(e){this.grid?.showColumn(e)}sortColumn(e,t){this.viewModel.sortColumn(e,t)}scrollLeft(){this.viewModel.scrollLeft()}scrollToBottom(){this.viewModel.scrollToBottom()}scrollToIndex(e){this.viewModel.scrollToIndex(e)}scrollToRow(e){this.viewModel.scrollToRow(e)}scrollToTop(){this.viewModel.scrollToTop()}toggleColumnVisibility(e){this.viewModel.toggleColumnVisibility(e)}get visibilityMenuColumns(){let e=this.effectiveTable.columns;return this.columnVisibilityMenuConfig?.frozenColumnsExcluded?e.filter(e=>!e.frozen&&!e.frozenToEnd).toArray():e.toArray()}async zoomToSelection(){return this.effectiveTable.viewModel.zoomToSelection()}render(){let{_effectiveVisibleElements:e,isQueryingOrSyncing:t,menuConfig:n,state:r}=this;return H(`div`,{bind:this,class:this.classes(Z.base,R.widget)},H(`calcite-panel`,{bind:this,class:Z.content,closable:e.close,closed:this.closed,collapsed:this.collapsed,collapsible:e.collapse,description:this._effectiveDescription,dir:this.direction,disabled:this.disabled||r===`disabled`&&!this._effectiveLayers?.length,heading:e.header?this._effectiveTitle:void 0,key:`table-content`,loading:r===`loading`,menuOpen:!!n?.open,overlayPositioning:`fixed`,onCalcitePanelClose:()=>{this.closed=!0,this.emit(`close`)},onCalcitePanelToggle:e=>{this.collapsed=e.target.collapsed,this.emit(`toggle`)}},e.progress?H(`calcite-progress`,{type:t?`indeterminate`:`determinate`}):null,this._showLayerDropdown?this._renderLayerDropdown():null,this._renderColumnVisibilityAction(),this._renderHeaderMenuActions(),this._renderNavigationBar(),this._renderTables(),this._renderError(),this._renderFooterContent()),this._renderColumnVisibilityPopover(),this._renderPrompt(),this._renderDialog())}_renderTables(){let{grid:e,relatedTables:t}=this,n=this.classes(Z.tableContainer);if(t.length){let r=this.classes(Z.base,this.allRelatedTablesVisible?Z.expanded:Z.collapsed,this._attachmentsViewIsVisible?Z.tableContainerWithAttachments:void 0);return H(`div`,{class:n},H(`calcite-panel`,{overlayPositioning:`fixed`},H(`div`,null,[this._shouldShowGrid?H(`div`,{class:r},e?.render(),this._renderPagination()):void 0,...this._filteredTables.map(e=>{let n=t.indexOf(e);return H(`div`,{class:r,key:`related-${n}`},e.render())}),,])))}return this.attachmentsViewOptions.objectId==null?[H(`div`,{class:n},e?.render()),this._renderPagination()]:H(`div`,{class:n},H(`calcite-panel`,{overlayPositioning:`fixed`},H(`div`,null,[H(`div`,{class:this.classes(Z.base,Z.collapsed)},e?.render(),this._renderPagination()),this._renderAttachmentsView()])))}_renderPagination(){if(this.paginationEnabled)return H(`calcite-pagination`,{pageSize:1,startItem:this.pageIndex+1,totalItems:this.pageCount,onCalcitePaginationChange:e=>{this._attachmentsDialogPreviewLoading=!1,this.goToPage(e.currentTarget.startItem-1)}})}_renderError(){let{messages:e}=this;return H(`calcite-alert`,{autoClose:!0,autoCloseDuration:`fast`,icon:Q.exclamationMarkTriangle,kind:`danger`,label:e.errorOccured,open:this._hasAttachmentsViewError,slot:`alerts`,topLayerDisabled:this.topLayerDisabled,onCalciteAlertClose:()=>{this.attachmentsViewOptions.error=null}},H(`span`,{slot:`message`},e.errorOccured))}_renderFooterContent(){if(!this.hasPendingEdits||!this._effectiveVisibleElements.pendingEditsFooter)return;let{hasInvalidPendingEdits:e,isQueryingOrSyncing:t,messages:n,messagesCommon:r}=this,i=e||t,a=this.hasContingentValues,o=[H(`calcite-button`,{appearance:`outline`,disabled:t,iconStart:Q.reset,key:`footer-reset-button`,slot:`footer-end`,width:`auto`,onclick:()=>void this.discardPendingEdits()},r.reset),H(`calcite-button`,{disabled:i,iconStart:Q.save,key:`footer-save-button`,loading:this.isSyncing,slot:`footer-end`,width:`auto`,onclick:()=>{this.savePendingEdits()}},r.save)];if(a){let t=e?n.contingentValues.hasInvalidValues:n.contingentValues.hasValidValues,r=e?Q.exclamationMarkTriangle:Q.checkCircle,i=e?Z.footerIconDanger:Z.footerIconSuccess;o.push(H(`div`,{class:Z.footerMessage,key:`footer-message`,slot:`footer-start`},H(`calcite-icon`,{class:i,icon:r,scale:`s`,slot:`footer-start`}),t))}return o}_renderPrompt(){return this.prompt?H(ee,{...this.prompt,headingLevel:2}):void 0}_showDeleteSelectionPrompt(){let{messages:e,messagesCommon:n}=this,r=t(e.deleteSelectionCount,{count:this.highlightIds.length});this.showPrompt({title:r,message:e.deleteRecordsRemoved,context:`danger`,actions:{primary:{label:n.delete,action:async()=>{try{await this.viewModel.deleteSelection()}finally{this.clearPrompt()}}},secondary:{label:e.keepRecords,action:()=>this.clearPrompt()}}})}_showDeleteAttachmentPrompt(e,n){let{messages:r,messagesCommon:i}=this,a=t(r.deleteAttachmentCount,{count:n.length});this.showPrompt({title:a,message:r.deleteAttachmentConfirmation,context:`danger`,actions:{primary:{label:i.delete,action:async()=>{try{await this.deleteAttachments(e,n,!1)}finally{this.clearPrompt()}}},secondary:{label:i.cancel,action:()=>this.clearPrompt()}}})}async _showDiscardEditsPrompt(e){let t=Promise.withResolvers(),{messagesEditor:n}=this;return this.showPrompt({title:n.cancelEditTitle,message:n.cancelEditWarningMessage,context:`danger`,actions:{primary:{label:n.discardEdits,action:async()=>{try{await this.discardPendingEdits(e)}finally{t.resolve(!0)}}},secondary:{label:n.continueEditing,action:()=>t.resolve(!1)}}}),t.promise.finally(()=>this.clearPrompt())}_onTableViewChange(e){this.hasPendingEdits?this._showDiscardEditsPrompt().then(t=>t&&e()):e()}_resetNestedViews(){this.relatedTable&&this.drainRelatedTables(),this.effectiveTable.attachmentsViewOptions.objectId=null}_renderDialog(){let{attachmentsViewOptions:e,messages:t}=this,{objectId:n}=e;return H(`calcite-dialog`,{class:Z.dialog,description:this.viewModel.getFeatureTitleSync(n),heading:t.attachments,modal:!0,open:this._dialogIsOpen,placement:`cover`,width:`l`,onCalciteDialogClose:()=>this._onDialogClose()},this._renderDialogContent())}_renderDialogContent(){let e=this.attachmentsViewOptions.dialogInfo;if(e)return this._renderAttachmentsDialogContent(e)}_renderAttachmentsDialogContent(e){let{attachmentsViewOptions:t,messages:n}=this,{attachmentInfos:r}=t,i=r.indexOf(e);return H(U,null,H(`div`,{class:Z.dialogHeader,key:`header`,slot:`content-top`},H(`span`,null,e.name),H(`calcite-button`,{appearance:`outline`,onclick:()=>{t.attachmentId=e.id,t.dialogId=null}},n.viewDetails)),H(`calcite-progress`,{type:this._attachmentsDialogPreviewLoading?`indeterminate`:`determinate`}),H(`div`,{class:Z.dialogContent,key:`content`},this._renderAttachmentsViewDetailsImage(e)),H(`calcite-pagination`,{pageSize:1,slot:`footer`,startItem:i+1,totalItems:r.length,onCalcitePaginationChange:e=>{let n=e.currentTarget.startItem-1,i=r[n]?.id;t.dialogId=i}}))}_onDialogClose(){let e=this.attachmentsViewOptions;e.dialogId!=null&&(e.dialogId=null),this._attachmentsDialogPreviewLoading=!1}_renderHeaderMenuAction(e){let{disabled:t,hidden:n,icon:r,text:i,clickFunction:a}=e;if(!n)return H(`calcite-action`,{disabled:t??this.menuConfig?.disabled,icon:r??void 0,key:i,slot:`header-menu-actions`,text:i,textEnabled:!0,title:i,onclick:()=>a()})}_renderHeaderMenuActions(){return this._shouldShowMenu?[this._renderDefaultHeaderMenuActions(),this._renderCustomHeaderMenuActions()]:[]}_renderDefaultHeaderMenuActions(){if(!this._hasDefaultMenuItems)return[];let{messages:e}=this;return[this._showRefreshDataAction&&{icon:Q.refresh,text:e.refreshData,clickFunction:()=>this.refresh()},this._showDeleteSelectionAction&&{icon:Q.delete,text:e.deleteSelection,clickFunction:()=>this.deleteSelection(!0)},this._showClearSelectionAction&&{icon:Q.clearSelection,text:e.clearSelection,clickFunction:()=>this.clearSelection()},this._showZoomToSelectionAction&&{icon:Q.zoomToSelection,text:e.zoomToSelection,clickFunction:()=>this.zoomToSelection()},this._showSelectedRecordsShowSelectedAction&&{icon:Q.showSelected,text:e.showSelected,clickFunction:()=>{let{objectIds:e}=this;e.removeAll(),e.addMany(this.highlightIds.toArray())}},this._showSelectedRecordsShowAllAction&&{icon:Q.showAll,text:e.showAllRecords,clickFunction:()=>this.objectIds.removeAll()},this._showExportSelectionToCSVAction&&{icon:Q.exportToCSV,text:e.exportSelectionCSV,clickFunction:()=>this.exportSelectionToCSV()}].filter(n).map(e=>e&&this._renderHeaderMenuAction(e))}_renderCustomHeaderMenuActions(){return this.menuConfig?.items?.map(({disabled:e,hidden:t,icon:n,label:r,clickFunction:i})=>this._renderHeaderMenuAction({hidden:typeof t==`function`?t():t,icon:n,text:r,disabled:typeof e==`function`?e():e,clickFunction:e=>i(e)}))??[]}_renderColumnVisibilityAction(){if(!this._showColumnVisibilityAction)return[];let{_columnVisibilityActions:e,id:t}=this,n=this.messages.menuText.columnVisibility;return H(`calcite-action`,{afterCreate:n=>e.set(t,n),afterRemoved:()=>e.delete(t),bind:this,disabled:this._columnVisibilityActionDisabled,icon:Q.showColumn,id:`${t}__toggle-columns-action`,slot:`header-actions-end`,text:n},this._effectiveVisibleElements.tooltips?H(`calcite-tooltip`,{closeOnClick:!0,overlayPositioning:`fixed`,placement:`bottom-end`,referenceElement:e.get(t),topLayerDisabled:this.topLayerDisabled},n):null)}_renderColumnVisibilityPopover(){if(!this._showColumnVisibilityAction||this._columnVisibilityActionDisabled)return;let e=this.visibleElements.columnVisibilityMenuItems.header,t=this.messages.menuText.columnVisibility;return H(`calcite-popover`,{autoClose:!0,class:Z.menuPopover,closable:e,heading:e?t:void 0,label:t,overlayPositioning:`fixed`,placement:this.columnVisibilityMenuConfig?.placement,referenceElement:this._columnVisibilityActions.get(this.id),topLayerDisabled:this.topLayerDisabled},this._renderColumnVisibilityList())}_renderColumnVisibilityList(){let{visibilityMenuColumns:e,messages:{menuText:t}}=this;if(e.length!==0)return H(`calcite-list`,{afterCreate:W,afterRemoved:G.bind(this),afterUpdate:W,bind:this,"data-node-ref":`_columnVisibilityList`,dir:this.direction,displayMode:`nested`,filterEnabled:this.visibleElements.columnVisibilityMenuItems.filter,filterPlaceholder:t.searchFields,label:t.fieldVisibility,selectionMode:`multiple`,onCalciteListChange:()=>this._syncColumnVisibility(),onCalciteListFilter:()=>this.scheduleRender()},this._renderColumnToggleAll(),e.map(e=>{let t=k(e)?e.columns?.map(e=>this._renderColumnListItem({column:e})):void 0;return this._renderColumnListItem({column:e,items:t})}),H(`calcite-notice`,{appearance:`transparent`,kind:`neutral`,open:!0,slot:`filter-no-results`},H(`div`,{slot:`message`},t.noMatchesFound)))}_syncColumnVisibility(){let{effectiveTable:e,_columnVisibilityList:t}=this;if(!t)return;let n=new Set(t.selectedItems.map(e=>e.value)),r=!!this.columnVisibilityMenuConfig?.frozenColumnsExcluded;e.allColumns.forEach(t=>{r&&(t.frozen||t.frozenToEnd)||(n.has(t.fieldName)?e.showColumn(t.fieldName):e.hideColumn(t.fieldName))})}_renderColumnToggleAll(){if(!this.visibleElements.columnVisibilityMenuItems.toggleAll)return;let{_columnVisibilityList:e}=this;if(e&&e.filteredItems?.length)return H(`calcite-button`,{appearance:`transparent`,width:`full`,onclick:()=>this._toggleAllColumns()},this._getColumnToggleAllText())}_getColumnToggleAllText(){let{_columnVisibilityList:e,effectiveTable:t,messages:{menuText:n}}=this;return e?e.filterText===``?t.allColumnsVisible?n.deselectAll:n.selectAll:this._allColumnsAreVisible(e.filteredItems.map(e=>e.value))?n.deselectAll:n.selectAll:``}_renderColumnListItem(e){let{column:t,items:n}=e,{effectiveLabel:r,fieldName:i,hidden:a}=t,o=!(!n?.length||a)||void 0;return H(`calcite-list-item`,{expanded:o,key:`toggle-columns__item-${i}`,label:r,metadata:{description:t.effectiveDescription,type:A(t)?t.field.type:void 0},selected:!a,value:i},n)}_renderLayerDropdown(){let e=this.messages.selectALayer,{storeTrigger:t,destroy:n,referenceTrigger:r}=this._layerDropdownReference;return H(`div`,{class:Z.layerDropdownMenu,key:`${this.id}-layerDropdown`,slot:`header-actions-start`},H(`calcite-action`,{afterCreate:t,afterRemoved:n,afterUpdate:t,icon:Q.layers,text:e,title:e}),H(`calcite-dropdown`,{afterCreate:r,afterUpdate:r,bind:this,maxItems:5,overlayPositioning:`fixed`,placement:`bottom-start`,topLayerDisabled:this.topLayerDisabled},H(`calcite-dropdown-group`,{selectionMode:`single`},this._effectiveLayers.map((e,t)=>this._renderLayerDropdownItem(e,t))??null)))}_renderLayerDropdownItem(e,t){let n=this.visibleElements.layerDropdownIcons;return H(`calcite-dropdown-item`,{iconStart:n?z(e):void 0,key:`dropdown-item-${t}`,label:e.title??``,selected:e===this.layer,value:e.id,onCalciteDropdownItemSelect:()=>this._onTableViewChange(()=>this.layer=e)},e.title)}_onRelatedNavigationItemClick(e){this.viewModel.drainRelatedTablesAboveIndex(e)}_collapseRelatedTable(e){this.viewModel.collapseRelatedTable(this.effectiveTable,e)}_onShowRelatedTable(e){this.showRelatedTableCallback||this.hasPendingEdits||(this._collapseRelatedTable(e),this._createRelatedTable(e))}async _createRelatedTable(e){let{autoRefreshEnabled:t,autoSaveEnabled:n,direction:r,editingEnabled:i,effectiveTable:a,multipleSelectionEnabled:o,paginationEnabled:s,pageSize:c,view:l,viewModel:u}=this,{layer:d,objectId:f,relatedLayer:p,relationshipId:m}=e;await d.load();let h=this.attachmentsEnabled&&P(d),g=new K({layer:d,autoRefreshEnabled:t,autoSaveEnabled:n,attachmentsEnabled:h,direction:r,editingEnabled:i,multipleSelectionEnabled:o,paginationEnabled:s,pageSize:c,relatedRecordsEnabled:!0,relationshipConfig:{objectId:f,relatedLayer:p,relationshipId:m},relationshipColumnConfigs:F(d,m),tableController:this,tableParent:a,view:l,showRelatedTableCallback:e=>u.emit(`show-related-table`,e)});this.relatedTables.add(g),this.scheduleRender()}_renderAttachmentsView(){switch(this.attachmentsViewOptions.effectiveMode){case`list`:return this._renderAttachmentsViewList();case`details`:return this._renderAttachmentsViewDetails();case`file`:return this._renderAttachmentsViewFile()}}_renderAttachmentsViewFile(){let e=this.attachmentsViewOptions,{objectId:t}=e;if(t!=null)return[H(`div`,{class:Z.attachmentsView,key:`attachments-view`},this._renderAttachmentsViewInformation(),H(`div`,{class:Z.attachmentsViewContent,key:`attachments-view-content`},H(`div`,{bind:this,class:Z.attachmentsViewDropArea,ondragover:e=>e.preventDefault(),ondrop:this._onAttachmentsViewDrop},H(`calcite-icon`,{class:Z.attachmentsViewIcon,icon:Q.upload,scale:`l`}),this._renderAttachmentsViewFileLabelNode(),this._renderAttachmentsViewFileMessageNode(),H(`form`,{afterCreate:t=>e.form=t,afterRemoved:()=>e.form=null,bind:this,key:`attachments-form`},H(`fieldset`,null,this._renderAttachmentsViewFileNameNode(),H(`input`,{afterCreate:W,afterRemoved:G,afterUpdate:W,bind:this,"data-node-ref":`_attachmentsInput`,files:e.candidates,hidden:!0,name:`attachment`,type:`file`,onchange:e=>this._onAttachmentsViewCandidateChange(e)}),this._renderAttachmentsViewFileSelectNode(),this._renderAttachmentsViewFileSaveNode(),this._renderAttachmentsViewFileCancelNode())))))]}_renderAttachmentsViewFileLabelNode(){if(this.attachmentsViewOptions.fileMode===`replace`)return H(`span`,{class:Z.attachmentsViewDropAreaLabel,key:`replace-file-node`},this.messages.replaceFile)}_renderAttachmentsViewFileMessageNode(){let e=this.attachmentsViewOptions;if(e.hasCandidates)return;let{messages:t}=this,n=this.supportsAddAttachments?e.objectId==null?t.noFeature:t.dragAndDropToUpload:t.editingRestricted;return H(`span`,{class:Z.attachmentsViewDropAreaMessage,key:`message-node`},n)}_renderAttachmentsViewFileNameNode(){let e=this.attachmentsViewOptions.candidates,t=Array.from(e??[]).at(-1);if(t)return H(`span`,{class:Z.attachmentsViewDropAreaMessage,key:`filename-node`},t.name)}_renderAttachmentsViewFileSelectNode(){if(this.supportsAddAttachments)return H(`calcite-button`,{appearance:`outline-fill`,disabled:this.isSyncingAttachments,iconStart:Q.folderOpen,key:`select-node`,onclick:()=>{this._resetAttachmentsInput(),this._attachmentsInput?.click()}},this.messages.selectFile)}_renderAttachmentsViewFileSaveNode(){let{isSyncingAttachments:e,messages:t}=this,{attachmentInfo:n,hasCandidates:r}=this.attachmentsViewOptions;if(this.supportsAddAttachments&&r)return H(`calcite-button`,{appearance:`solid`,disabled:e,iconStart:Q.save,key:`save-node`,loading:e,onclick:()=>{this.saveAttachmentsViewForm()}},n?t.updateAttachment:t.addAttachment)}_renderAttachmentsViewFileCancelNode(){let{hasAttachments:e,hasCandidates:t}=this.attachmentsViewOptions;if(e||t)return H(`calcite-button`,{appearance:`transparent`,bind:this,disabled:this.isSyncingAttachments,key:`cancel-node`,onclick:()=>{this._resetAttachmentsInput(),this.attachmentsViewOptions.cancel()}},this.messagesCommon.cancel)}_renderAttachmentsViewDetails(){let{attachmentInfo:e}=this.attachmentsViewOptions;if(e)return[H(`div`,{class:Z.attachmentsView,key:`attachments-view`},this._renderAttachmentsViewInformation(),H(`div`,{class:Z.attachmentsViewContent,key:`attachments-view-content`},H(`div`,{class:Z.attachmentsViewDetails},this._renderAttachmentsViewDetailsPreview(e))))]}_renderAttachmentsViewDetailsPreview(e){let t=[this._renderAttachmentsViewDetailsImage(e)];if(S(e.contentType)){let n=this.messages.maximize;t.push(H(`calcite-action`,{icon:Q.expand,label:n,text:n,textEnabled:!0,title:n,onclick:t=>{t.preventDefault(),this.attachmentsViewOptions.dialogId=e.id}}))}return t}_renderAttachmentsViewDetailsImage(e){let{contentType:t,name:n,size:r,url:i}=e,{messages:a}=this;return S(t)?H(`img`,{afterCreate:()=>this._attachmentsDialogPreviewLoading=!0,alt:n,key:`thumbnail-image-${n}`,src:`${i}${i?.includes(`?`)?`&`:`?`}s=${r}`,title:n,onerror:()=>this._attachmentsDialogPreviewLoading=!1,onload:()=>this._attachmentsDialogPreviewLoading=!1}):[H(`calcite-icon`,{icon:C(t),key:`thumbnail-icon-${n}`,scale:`l`,textLabel:n,title:n}),a.noPreviewAvailable]}_renderAttachmentsViewInformation(){let{attachmentsViewOptions:e,messages:t,messagesUnits:n}=this,{attachmentInfo:r,objectId:i}=e;if(r&&i!=null)return H(`div`,{class:Z.attachmentsViewInformation,key:`information`},this._renderAttachmentViewInformationButtons(r,i),H(`span`,{class:Z.attachmentsViewInformationLabel,key:`file-label`},t.fileName),H(`span`,{class:Z.attachmentsViewInformationData,key:`file-value`},r.name),H(`span`,{class:Z.attachmentsViewInformationLabel,key:`type-label`},t.attachmentType),H(`span`,{class:Z.attachmentsViewInformationData,key:`type-value`},this._getLabelForAttachmentType(r)),this._renderAttachmentKeywordDetails(r),H(`span`,{class:Z.attachmentsViewInformationLabel,key:`size-label`},t.size),H(`span`,{class:Z.attachmentsViewInformationData,key:`size-span`},d(n,r.size??0)))}_renderAttachmentViewInformationButtons(e,t){let{attachmentsViewOptions:n,messages:r,messagesCommon:i}=this,a=n.effectiveMode!==`details`,o=e.id,s=[H(`calcite-button`,{appearance:`outline`,disabled:a,key:`download-button`,width:`full`,onclick:e=>{e.preventDefault(),this.downloadAttachmentById(t,o)}},r.download)];return this.supportsUpdateAttachments&&s.push(H(`calcite-button`,{appearance:`outline`,disabled:a,key:`replace-button`,width:`full`,onclick:()=>{n.mode=`file`,n.attachmentId=o}},r.replace)),this.supportsDeleteAttachments&&s.push(H(`calcite-button`,{appearance:`outline`,disabled:a,key:`delete-button`,width:`full`,onclick:()=>{this.deleteAttachments(t,[o],!0)}},i.delete)),s}_renderAttachmentKeywordDetails({keywords:e}){if(e&&e!==``)return[H(`span`,{class:Z.attachmentsViewInformationLabel,key:`keyword-label`},this.messages.keyword),H(`span`,{class:Z.attachmentsViewInformationData,key:`keyword-value`},e)]}_renderAttachmentsViewList(){let{attachmentsViewOptions:e,isSyncingAttachments:t,messages:n,messagesUnits:r}=this,{attachmentInfos:i,objectId:a}=e;return H(`calcite-list`,{afterCreate:W,afterRemoved:G,afterUpdate:W,bind:this,class:Z.attachmentsViewList,"data-node-ref":`attachmentsList`,key:`attachments-list-${a}`,label:n?.attachments,loading:t,selectionMode:this.supportsDeleteAttachments?`multiple`:`none`,onCalciteListChange:()=>this.scheduleRender(),ondragover:e=>e.preventDefault(),ondrop:this._onAttachmentsViewDrop},...i?.map(t=>{let{id:i,name:o,size:s}=t,c=d(r,s??0);return H(`calcite-list-item`,{afterRemoved:()=>this.scheduleRender(),key:`attachment-${i}`,label:o,value:i},this._renderAttachmentsViewListPreview(t),H(`span`,{class:Z.attachmentsViewListFileSize,slot:`actions-end`,title:c},c),H(`calcite-action`,{icon:Q.downloadTo,key:`download`,label:o,slot:`actions-end`,text:n.downloadAttachment,title:n.downloadAttachment,onclick:e=>{e.preventDefault(),this.downloadAttachmentById(a??-1,i)}}),H(`calcite-action`,{icon:Q.chevronRight,iconFlipRtl:!0,key:`details`,label:o,slot:`actions-end`,text:n.viewAttachment,title:n.viewAttachment,onclick:()=>{e.mode=`details`,e.attachmentId=i}}))}))}_renderAttachmentsViewListPreview(e){return H(`div`,{class:Z.attachmentsViewListThumbnail,slot:`content-start`},H(`span`,null,this._renderAttachmentsViewListImage(e)))}_renderAttachmentsViewListImage(e,t=64){let{contentType:n,name:r,size:i,url:a}=e,o=`${a}${a?.includes(`?`)?`&`:`?`}w=${t}&s=${i}`;return this.supportsResizeAttachments&&S(n)?H(`img`,{alt:r,key:`thumbnail-image-${r}`,src:o,title:r}):H(`calcite-icon`,{icon:C(n),key:`thumbnail-icon-${r}`,scale:`l`,textLabel:r,title:r})}_onAttachmentsViewCandidateChange({target:e}){this.attachmentsViewOptions.candidates=e?.files}_onAttachmentsViewDrop(e){e.preventDefault(),(this.supportsAddAttachments||this.supportsUpdateAttachments)&&(this.attachmentsViewOptions.mode=`file`,this.attachmentsViewOptions.candidates=e.dataTransfer?.files)}_resetAttachmentsInput(){this._attachmentsInput&&(this._attachmentsInput.value=``)}_getLabelForAttachmentType({contentType:e}){let t=this.messages,n=w(e);return t.attachmentTypes[n]}_renderNavigationBar(){let{effectiveTable:e,messages:n,messagesCommon:r,navigationScale:i,relatedTable:a,relatedTables:o}=this;if(!this._shouldShowNavigationBar)return;let{attachmentsList:s,attachmentsViewOptions:c,layer:l,supportsAddAttachments:u,supportsDeleteAttachments:d}=e;if(!l)return;let{attachmentInfos:f,objectId:p}=c,m=p!=null,h=f.length,g=s?.selectedItems?.length??0,_=`${l.objectIdField}: ${p}`,v=t(n.selectedCount,{count:g}),y=t(n.attachmentsCount,{count:h}),b=m?H(`calcite-action`,{bind:this,icon:Q.chevronRight,iconFlipRtl:!0,key:`navigation-feature`,scale:i,text:_,textEnabled:!0,title:_,onclick:()=>e.scrollToRow(p)}):void 0,x=m?H(`calcite-action`,{icon:Q.chevronRight,iconFlipRtl:!0,key:`navigation-attachments-label`,label:y,scale:i,text:y,textEnabled:!0,title:y,onclick:()=>{h>0&&(c.mode=`list`)}}):void 0,S=m?H(`calcite-chip`,{closable:!0,closed:g===0,key:`navigation-chip`,kind:`inverse`,label:v,scale:`s`,selected:!0,title:v,value:`selected`,onCalciteChipClose:()=>s?.selectedItems?.forEach(e=>e.selected=!1)},v):void 0,C=a?H(`calcite-label`,{layout:`inline`,scale:i},n.showAllTables,H(`calcite-switch`,{checked:this.allRelatedTablesVisible,scale:i,onCalciteSwitchChange:e=>this.showAllRelatedTables=!!e.currentTarget.checked})):void 0,w=m&&c.effectiveMode===`list`&&p!=null&&g&&d?H(`calcite-action`,{icon:Q.delete,iconFlipRtl:!0,key:`attachments-trash-all`,scale:i,text:r.delete,textEnabled:!0,title:t(n.deleteAttachmentCount,{count:g}),onclick:()=>{e.deleteAttachments(p,s?.selectedItems?.map(e=>e.value)??[],!0)}}):void 0,T=m&&c.effectiveMode===`list`&&u?H(`calcite-action`,{bind:this,icon:Q.plus,iconFlipRtl:!0,key:`attachments-add`,scale:i,text:n.addAttachment,textEnabled:!0,title:n.addAttachment,onclick:()=>{c.objectId=p,c.attachmentId=null,c.mode=`file`}}):void 0;return H(`div`,{class:Z.tableNavigation,key:`table-nav`},H(`calcite-action`,{icon:Q.moveUp,iconFlipRtl:!0,key:`go-back`,scale:i,text:this.layer?.title??``,textEnabled:!1,title:a?n.exitRelatedRecords:n.exitAttachments,onclick:()=>this._onTableViewChange(this._resetNestedViews)}),o.toArray().map((e,t)=>this._renderRelatedTableNavigationAction(e,t)),b,x,H(`div`,null,S,C,w,T))}_renderRelatedTableNavigationAction(e,t){let n=this._getLabelForRelatedTableNavigationAction(e);return H(`calcite-action`,{icon:Q.chevronRight,iconFlipRtl:!0,key:t,scale:this.navigationScale,text:n,textEnabled:!0,title:e.layer?.title||``,onclick:()=>{(t!==this.relatedTables.length-1||this._attachmentsViewIsVisible)&&this._onTableViewChange(()=>this._onRelatedNavigationItemClick(t))}})}_getLabelForRelatedTableNavigationAction(e){let t=e.layer?.title;if(!t)return``;let{relatedTables:n}=this;return n.length<=1?t:n.indexOf(e)!==n.length-1&&t.length>20?`${t.slice(0,20)}...`:t}_allColumnsAreVisible(e){let t=this.columnVisibilityMenuConfig;return e.every(e=>{let n=this.findColumn(e);return n?t?.frozenColumnsExcluded&&(n.frozen||n.frozenToEnd)?!0:n.effectiveVisible:!1})}_toggleAllColumns(){let{_columnVisibilityList:e,effectiveTable:t}=this,n=e?.filteredItems.map(e=>e.value);e?.filterText!==``&&n?.length?this._allColumnsAreVisible(n)?n.forEach(e=>this.hideColumn(e)):n.forEach(e=>this.showColumn(e)):t.allColumnsVisible?t.visibilityMenuColumns.forEach(e=>t.hideColumn(e.fieldName)):t.visibilityMenuColumns.forEach(e=>t.showColumn(e.fieldName))}};e([f()],$.prototype,`_attachmentsDialogPreviewLoading`,void 0),e([f()],$.prototype,`_attachmentsInput`,void 0),e([f()],$.prototype,`_attachmentsViewIsVisible`,null),e([f()],$.prototype,`_columnVisibilityActions`,void 0),e([f()],$.prototype,`_columnVisibilityActionDisabled`,null),e([f()],$.prototype,`_columnVisibilityList`,void 0),e([f()],$.prototype,`_dialogIsOpen`,null),e([f()],$.prototype,`_effectiveDescription`,null),e([f()],$.prototype,`_effectiveLayers`,null),e([f()],$.prototype,`_effectiveTitle`,null),e([f()],$.prototype,`_effectiveVisibleElements`,null),e([f()],$.prototype,`_filteredTables`,null),e([f()],$.prototype,`_hasAttachmentsViewError`,null),e([f()],$.prototype,`_hasCustomMenuItems`,null),e([f()],$.prototype,`_hasDefaultMenuItems`,null),e([f()],$.prototype,`_shouldShowGrid`,null),e([f()],$.prototype,`_shouldShowMenu`,null),e([f()],$.prototype,`_showClearSelectionAction`,null),e([f()],$.prototype,`_showColumnVisibilityAction`,null),e([f()],$.prototype,`_showDeleteSelectionAction`,null),e([f()],$.prototype,`_showExportSelectionToCSVAction`,null),e([f()],$.prototype,`_showLayerDropdown`,null),e([f()],$.prototype,`_shouldShowNavigationBar`,null),e([f()],$.prototype,`_showRefreshDataAction`,null),e([f()],$.prototype,`_showSelectedRecordsShowSelectedAction`,null),e([f()],$.prototype,`_showSelectedRecordsShowAllAction`,null),e([f()],$.prototype,`_showZoomToSelectionAction`,null),e([f()],$.prototype,`_viewLayers`,null),e([f()],$.prototype,`attachmentsList`,void 0),e([f()],$.prototype,`direction`,null),e([f({readOnly:!0})],$.prototype,`grid`,null),e([f()],$.prototype,`actionColumn`,null),e([f()],$.prototype,`actionColumnConfig`,null),e([f({readOnly:!0})],$.prototype,`activeFilters`,null),e([f({readOnly:!0})],$.prototype,`activeSortOrders`,null),e([f()],$.prototype,`allColumns`,null),e([f()],$.prototype,`allColumnsVisible`,null),e([f({readOnly:!0})],$.prototype,`allRelatedTablesVisible`,null),e([f()],$.prototype,`allVisibleColumns`,null),e([f()],$.prototype,`attachmentsColumns`,null),e([f()],$.prototype,`attachmentsEnabled`,null),e([f()],$.prototype,`attachmentsViewOptions`,null),e([f({type:y})],$.prototype,`attributeTableTemplate`,null),e([f()],$.prototype,`autoRefreshEnabled`,null),e([f()],$.prototype,`autoSaveEnabled`,null),e([f()],$.prototype,`canAddRelatedFeature`,null),e([f()],$.prototype,`clearPrompt`,null),e([f()],$.prototype,`closed`,void 0),e([f()],$.prototype,`collapsed`,void 0),e([f()],$.prototype,`columnPerformanceModeEnabled`,null),e([f()],$.prototype,`columnReorderingEnabled`,null),e([f({readOnly:!0})],$.prototype,`columns`,null),e([f()],$.prototype,`columnVisibilityMenuConfig`,void 0),e([f()],$.prototype,`defaultSelectionManager`,null),e([f()],$.prototype,`definitionExpression`,null),e([f()],$.prototype,`description`,void 0),e([f()],$.prototype,`disabled`,void 0),e([f()],$.prototype,`editingEnabled`,null),e([f()],$.prototype,`effectiveSelectionManager`,null),e([f()],$.prototype,`effectiveSize`,null),e([f()],$.prototype,`effectiveTable`,null),e([f()],$.prototype,`effectiveTimeExtent`,null),e([f()],$.prototype,`fieldColumns`,null),e([f({types:m})],$.prototype,`filterGeometry`,null),e([f()],$.prototype,`filterBySelectionEnabled`,null),e([f()],$.prototype,`filterByViewExtent`,null),e([f()],$.prototype,`filterByLayerScaleRange`,null),e([f()],$.prototype,`groupColumns`,null),e([f()],$.prototype,`hasContingentValues`,null),e([f()],$.prototype,`hasInvalidPendingEdits`,null),e([f()],$.prototype,`hasPendingEdits`,null),e([f()],$.prototype,`hiddenFields`,null),e([f()],$.prototype,`highlightEnabled`,null),e([f()],$.prototype,`highlightIds`,null),e([f()],$.prototype,`icon`,null),e([f()],$.prototype,`initialSize`,null),e([f()],$.prototype,`isQueryingOrSyncing`,null),e([f()],$.prototype,`isSyncing`,null),e([f()],$.prototype,`isSyncingAttachments`,null),e([f()],$.prototype,`label`,null),e([f()],$.prototype,`layer`,null),e([f()],$.prototype,`layers`,null),e([f()],$.prototype,`layerView`,null),e([f()],$.prototype,`maxSize`,null),e([f(),B(`esri/widgets/FeatureTable/t9n/FeatureTable`)],$.prototype,`messages`,null),e([f(),B(`esri/t9n/common`)],$.prototype,`messagesCommon`,null),e([f(),B(`esri/widgets/Editor/t9n/Editor`)],$.prototype,`messagesEditor`,void 0),e([f(),B(`esri/core/t9n/Units`)],$.prototype,`messagesUnits`,null),e([f(),B(`esri/widgets/support/t9n/uriUtils`)],$.prototype,`messagesURIUtils`,null),e([f()],$.prototype,`menuConfig`,null),e([f()],$.prototype,`multipleSelectionEnabled`,null),e([f()],$.prototype,`multipleSelectionEnabledOverride`,null),e([f()],$.prototype,`multiSortEnabled`,null),e([f()],$.prototype,`multipleSortPriority`,null),e([f()],$.prototype,`navigationScale`,void 0),e([f()],$.prototype,`noDataMessage`,null),e([f()],$.prototype,`objectIds`,null),e([f()],$.prototype,`outFields`,null),e([f()],$.prototype,`pageCount`,null),e([f()],$.prototype,`pageIndex`,null),e([f()],$.prototype,`pageSize`,null),e([f()],$.prototype,`paginationEnabled`,null),e([f()],$.prototype,`pendingEditsCount`,null),e([f()],$.prototype,`prompt`,null),e([f()],$.prototype,`relatedRecordsEnabled`,null),e([f()],$.prototype,`relatedTable`,null),e([f()],$.prototype,`relatedTableHasContingentValues`,null),e([f()],$.prototype,`relatedTableHasInvalidPendingEdits`,null),e([f()],$.prototype,`relatedTableHasPendingEdits`,null),e([f()],$.prototype,`relatedTables`,null),e([f()],$.prototype,`relationship`,null),e([f()],$.prototype,`relationshipColumnConfigs`,null),e([f()],$.prototype,`relationshipColumns`,null),e([f()],$.prototype,`relationshipConfig`,null),e([f()],$.prototype,`relationshipInfos`,null),e([f()],$.prototype,`returnGeometryEnabled`,null),e([f()],$.prototype,`returnMEnabled`,null),e([f()],$.prototype,`returnZEnabled`,null),e([f()],$.prototype,`rowHighlightIds`,null),e([f()],$.prototype,`selectionManager`,null),e([f()],$.prototype,`selectionSource`,null),e([f()],$.prototype,`showAllRelatedTables`,null),e([f()],$.prototype,`showPrompt`,null),e([f()],$.prototype,`showRelatedTableCallback`,null),e([f()],$.prototype,`size`,null),e([f({readOnly:!0})],$.prototype,`state`,null),e([f()],$.prototype,`supportsAddAttachments`,null),e([f()],$.prototype,`supportsAttachments`,null),e([f()],$.prototype,`supportsDeleteAttachments`,null),e([f()],$.prototype,`supportsResizeAttachments`,null),e([f()],$.prototype,`supportsUpdateAttachments`,null),e([f()],$.prototype,`syncTemplateOnChangesEnabled`,null),e([f()],$.prototype,`syncViewSelection`,null),e([f()],$.prototype,`syncWithViewSelectionManager`,null),e([f({constructOnly:!0})],$.prototype,`tableController`,null),e([f({constructOnly:!0})],$.prototype,`tableParent`,null),e([f({type:j})],$.prototype,`tableTemplate`,null),e([f()],$.prototype,`tableTemplateOverride`,null),e([f()],$.prototype,`title`,void 0),e([f({type:b})],$.prototype,`timeExtent`,null),e([f()],$.prototype,`timeZone`,null),e([f()],$.prototype,`view`,null),e([f({type:D}),V([`cell-click`,`cell-dblclick`,`cell-pointerover`,`cell-pointerout`,`cell-keydown`,`column-reorder`,`show-related-table`])],$.prototype,`viewModel`,void 0),e([f()],$.prototype,`viewTimeEnabled`,null),e([f()],$.prototype,`visibleColumns`,null),e([f({type:O,nonNullable:!0})],$.prototype,`visibleElements`,void 0),e([f({type:O})],$.prototype,`visibleElementsOverride`,null),e([f()],$.prototype,`visibilityMenuColumns`,null),$=K=e([p(`esri.widgets.FeatureTable`)],$);const te=$;export{te as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{substitute as t}from"../../intl.js";import{stripHTML as n}from"../../core/string.js";import{property as r,subclass as i}from"../../core/accessorSupport/decorators.js";import{loadActionUtilsComponents as a,renderAction as o}from"../../support/actions/actionUtils.js";import s from"../Widget.js";import{css as c}from"./css.js";import{zoomToFeature as l}from"../Popup/actions.js";import{loadCalciteComponents as u}from"../support/componentsUtils.js";import{tsx as d,tsxFragment as f,messageBundle as p}from"../support/widget.js";const m=l.clone();let h=class extends s{constructor(e,t){super(e,t),this.flowItems=null,this.messages=null,this.closed=!1,this.closable=!0,this.selectLastFlowItem=!0,this._handleOpenFeature=e=>{this.emit(`open-feature`,{feature:e})},this._handleZoomToFeature=e=>{this.emit(`zoom-to-feature`,{featureWidget:e})}}loadDependencies(){return Promise.all([a(),u({action:()=>import(`@esri/calcite-components/dist/components/calcite-action`),"action-bar":()=>import(`@esri/calcite-components/dist/components/calcite-action-bar`),"action-group":()=>import(`@esri/calcite-components/dist/components/calcite-action-group`),"flow-item":()=>import(`@esri/calcite-components/dist/components/calcite-flow-item`)})])}render(){let{flowItems:e}=this,t=e?.toArray();return d(f,null,t?.map((e,n)=>this._renderFlowItem(e,this.selectLastFlowItem&&n===t.length-1)))}_handleCloseClick(){this.emit(`close`)}_handleExitClick(){this.emit(`exit`)}_handleDrillInBackClick(){let{flowItems:e}=this,t=e?.pop();t&&(`activeCategory`in t.viewModel?(t.viewModel.activeCategory=null,e?.length||(t.viewModel.showAllEnabled=!1)):`showAllEnabled`in t.viewModel&&(t.viewModel.showAllEnabled=!1),t&&(t.viewModel=null,t.destroy()))}_getExitMessage(e){switch(e.flowType){case`feature`:case`feature-association`:return``;case`feature-relationship`:return this.messages.exitRelatedRecords;case`feature-utility-network-associations`:case`feature-utility-network-association-type`:return this.messages.exitAssociations}}_renderFlowItem(e,t){let{messages:r,closable:i,closed:a}=this,s=`graphic`in e&&!e.isTable,l=e.flowType===`feature-association`,u=this._getExitMessage(e),f=r.selectFeature;return d(`calcite-flow-item`,{bind:this,closable:i,closed:a,description:n(this._getDrillInFlowItemDescription(e)??``),heading:n(e.title??``),key:`flow-item-${e.viewModel.uid}`,selected:t,onCalciteFlowItemBack:e=>{e.preventDefault(),this._handleDrillInBackClick()},onCalciteFlowItemClose:this._handleCloseClick},d(`calcite-action`,{bind:this,class:c.actionExit,icon:`move-up`,key:`exit-action`,slot:`header-actions-start`,text:u,title:u,onclick:this._handleExitClick}),s?d(`calcite-action`,{bind:this,icon:`zoom-to-object`,key:`open-feature-action`,slot:`header-actions-end`,text:f,title:f,onclick:()=>this._handleOpenFeature(e)}):null,l?d(`calcite-action-bar`,{expandDisabled:!0,expanded:!0,key:`header-action-bar`,scale:`s`,slot:`action-bar`},d(`calcite-action-group`,{overlayPositioning:`fixed`,scale:`s`},o(m,{key:`action-${m.uid}`,title:this._getActionTitle(m),text:this._getActionTitle(m),textEnabled:!0,onclick:()=>this._handleZoomToFeature(e),bind:this}))):null,d(`div`,{class:c.container},e.render()))}_getActionTitle(e){let{messages:n}=this,r=e.title??``;return e.id===`zoom-to-feature`?t(r,{messages:n}):r}_getDrillInFlowItemDescription(e){switch(e.flowType){case`feature`:case`feature-association`:case`feature-utility-network-associations`:return e.viewModel.description??``;case`feature-relationship`:return e.allItemsDescription;case`feature-utility-network-association-type`:return e.description??``}}};e([r()],h.prototype,`flowItems`,void 0),e([r(),p(`esri/widgets/Features/t9n/Features`)],h.prototype,`messages`,void 0),e([r()],h.prototype,`closed`,void 0),e([r()],h.prototype,`closable`,void 0),e([r()],h.prototype,`selectLastFlowItem`,void 0),h=e([i(`esri.widgets.Features.FeaturesDrillIn`)],h);export{h as default};
2
+ import{__decorate as e}from"tslib";import{substitute as t}from"../../intl.js";import{stripHTML as n}from"../../core/string.js";import{property as r,subclass as i}from"../../core/accessorSupport/decorators.js";import{loadActionUtilsComponents as a,renderAction as o}from"../../support/actions/actionUtils.js";import s from"../Widget.js";import{css as c}from"./css.js";import{zoomToFeature as l}from"../Popup/actions.js";import{loadCalciteComponents as u}from"../support/componentsUtils.js";import{tsx as d,tsxFragment as f,messageBundle as p}from"../support/widget.js";const m=l.clone();let h=class extends s{constructor(e,t){super(e,t),this.flowItems=null,this.messages=null,this.closed=!1,this.closable=!0,this.selectLastFlowItem=!0,this._handleOpenFeature=e=>{this.emit(`open-feature`,{feature:e})},this._handleZoomToFeature=e=>{this.emit(`zoom-to-feature`,{featureWidget:e})}}loadDependencies(){return Promise.all([a(),u({action:()=>import(`@esri/calcite-components/dist/components/calcite-action`),"action-bar":()=>import(`@esri/calcite-components/dist/components/calcite-action-bar`),"action-group":()=>import(`@esri/calcite-components/dist/components/calcite-action-group`),"flow-item":()=>import(`@esri/calcite-components/dist/components/calcite-flow-item`)})])}render(){let{flowItems:e}=this,t=e?.toArray();return d(f,null,t?.map((e,n)=>this._renderFlowItem(e,this.selectLastFlowItem&&n===t.length-1)))}_handleCloseClick(){this.emit(`close`)}_handleExitClick(){this.emit(`exit`)}_handleDrillInBackClick(){let{flowItems:e}=this,t=e?.pop();t&&(`activeCategory`in t.viewModel?(t.viewModel.activeCategory=null,e?.length||(t.viewModel.showAllEnabled=!1)):`showAllEnabled`in t.viewModel&&(t.viewModel.showAllEnabled=!1),t&&(t.viewModel=null,t.destroy()))}_getExitMessage(e){switch(e.flowType){case`feature`:case`feature-association`:return``;case`feature-relationship`:return this.messages.exitRelatedRecords;case`feature-utility-network-associations`:case`feature-utility-network-association-type`:return this.messages.exitAssociations}}_renderFlowItem(e,t){let{messages:r,closable:i,closed:a}=this,s=`graphic`in e&&!e.isTable,l=e.flowType===`feature-association`,u=this._getExitMessage(e),f=r.selectFeature;return d(`calcite-flow-item`,{bind:this,closable:i,closed:a,description:n(this._getDrillInFlowItemDescription(e)??``),heading:n(e.title??``),key:`flow-item-${e.viewModel.uid}`,selected:t,onCalciteFlowItemBack:e=>{e.preventDefault(),this._handleDrillInBackClick()},onCalciteFlowItemClose:this._handleCloseClick},d(`calcite-action`,{bind:this,class:c.actionExit,icon:`move-up`,key:`exit-action`,slot:`header-actions-start`,text:u,title:u,onclick:this._handleExitClick}),s?d(`calcite-action`,{bind:this,icon:`zoom-to-object`,key:`open-feature-action`,slot:`header-actions-end`,text:f,title:f,onclick:()=>this._handleOpenFeature(e)}):null,l?d(`calcite-action-bar`,{expanded:!0,expandToggleDisabled:!0,key:`header-action-bar`,scale:`s`,slot:`action-bar`},d(`calcite-action-group`,{overlayPositioning:`fixed`,scale:`s`},o(m,{key:`action-${m.uid}`,title:this._getActionTitle(m),text:this._getActionTitle(m),textEnabled:!0,onclick:()=>this._handleZoomToFeature(e),bind:this}))):null,d(`div`,{class:c.container},e.render()))}_getActionTitle(e){let{messages:n}=this,r=e.title??``;return e.id===`zoom-to-feature`?t(r,{messages:n}):r}_getDrillInFlowItemDescription(e){switch(e.flowType){case`feature`:case`feature-association`:case`feature-utility-network-associations`:return e.viewModel.description??``;case`feature-relationship`:return e.allItemsDescription;case`feature-utility-network-association-type`:return e.description??``}}};e([r()],h.prototype,`flowItems`,void 0),e([r(),p(`esri/widgets/Features/t9n/Features`)],h.prototype,`messages`,void 0),e([r()],h.prototype,`closed`,void 0),e([r()],h.prototype,`closable`,void 0),e([r()],h.prototype,`selectLastFlowItem`,void 0),h=e([i(`esri.widgets.Features.FeaturesDrillIn`)],h);export{h as default};