@arcgis/core 4.34.0-next.92 → 4.34.0-next.94

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 (348) hide show
  1. package/Color.js +1 -1
  2. package/Ground.js +1 -1
  3. package/WebScene.js +1 -1
  4. package/analysis/ElevationProfile/ElevationProfileDisplayUnits.d.ts +4 -0
  5. package/analysis/ElevationProfile/{ElevationProfileUnits.js → ElevationProfileDisplayUnits.js} +1 -1
  6. package/analysis/ElevationProfile/ElevationProfileUnits.d.ts +1 -1
  7. package/analysis/ElevationProfile/ElevationProfileViewOptions.js +1 -1
  8. package/analysis/ElevationProfileAnalysis.js +1 -1
  9. package/assets/esri/core/workers/RemoteClient.js +1 -1
  10. package/assets/esri/core/workers/chunks/004b13c1db79c9e668b1.js +1 -0
  11. package/assets/esri/core/workers/chunks/{700b5a536f97233bc4af.js → 03b455e9405a8b6fec68.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{a244afea77127e54dd3a.js → 08b0fc6bfe9640ee2525.js} +1 -1
  13. package/assets/esri/core/workers/chunks/0a981061df08da19372c.js +1 -0
  14. package/assets/esri/core/workers/chunks/{db5a985ccc6b7d0ad855.js → 176f56de787bf486be9f.js} +1 -1
  15. package/assets/esri/core/workers/chunks/1fc7df018c8f802565a6.js +1 -0
  16. package/assets/esri/core/workers/chunks/20003728a679479b14dc.js +1 -0
  17. package/assets/esri/core/workers/chunks/20f4c6d8b310ecab97be.js +1 -0
  18. package/assets/esri/core/workers/chunks/25639559336109ff3df1.js +1 -0
  19. package/assets/esri/core/workers/chunks/26081b6486c623735657.js +1 -0
  20. package/assets/esri/core/workers/chunks/2698f656405876f4bd20.js +1 -0
  21. package/assets/esri/core/workers/chunks/{4660798b3b45dcb5cecb.js → 2b9c9a35a6e1f56920b5.js} +2 -2
  22. package/assets/esri/core/workers/chunks/352511dbc67166face40.js +1 -0
  23. package/assets/esri/core/workers/chunks/3acd79a6a0572926a799.js +1 -0
  24. package/assets/esri/core/workers/chunks/3d7923d25734d03a4d27.js +1 -0
  25. package/assets/esri/core/workers/chunks/48133effac2eacc2196e.js +1 -0
  26. package/assets/esri/core/workers/chunks/4dfcd03082be83600f3a.js +1 -0
  27. package/assets/esri/core/workers/chunks/503c81dda242e6077317.js +1 -0
  28. package/assets/esri/core/workers/chunks/{06aed0a5464965be8d52.js → 56b3bb68b61b77138186.js} +1 -1
  29. package/assets/esri/core/workers/chunks/5746c4861af83c1d57a8.js +1 -0
  30. package/assets/esri/core/workers/chunks/5aacd1c6b171c99b41f5.js +1 -0
  31. package/assets/esri/core/workers/chunks/6810ecdeccf4b7eae5e2.js +1 -0
  32. package/assets/esri/core/workers/chunks/6b208f5d423da64c8559.js +1 -0
  33. package/assets/esri/core/workers/chunks/{7a240ab31d9ff2d2c5af.js → 73db6c070b049fe05147.js} +1 -1
  34. package/assets/esri/core/workers/chunks/801451fb572bc5f1f270.js +1 -0
  35. package/assets/esri/core/workers/chunks/82e0d22619dc26920ca9.js +1 -0
  36. package/assets/esri/core/workers/chunks/8f426cb210a4250517d5.js +1 -0
  37. package/assets/esri/core/workers/chunks/94ddf029698991d853b9.js +1 -0
  38. package/assets/esri/core/workers/chunks/97eb2cfc1f036feea9a9.js +1 -0
  39. package/assets/esri/core/workers/chunks/98381404f2d99a1f9341.js +1 -0
  40. package/assets/esri/core/workers/chunks/9adecee0ed2f1df3b0d2.js +1 -0
  41. package/assets/esri/core/workers/chunks/a0fab8cd791c33d3895d.js +1 -0
  42. package/assets/esri/core/workers/chunks/{a85acb948cc7d22be592.js → a410dcf80d17a2383337.js} +1 -1
  43. package/assets/esri/core/workers/chunks/{d9d86cf0500fa29d1d43.js → a98b284b147258629947.js} +1 -1
  44. package/assets/esri/core/workers/chunks/b1ccbc2fef7f7e5e04f7.js +1 -0
  45. package/assets/esri/core/workers/chunks/b5c829e904bc9cb5347d.js +1 -0
  46. package/assets/esri/core/workers/chunks/bec9ddd38c9ab9f2561b.js +1 -0
  47. package/assets/esri/core/workers/chunks/bf9031749d10e7d457b6.js +1 -0
  48. package/assets/esri/core/workers/chunks/bf9d09493fd849ea69fd.js +1 -0
  49. package/assets/esri/core/workers/chunks/c4641c2c130c7b8bcdee.js +1 -0
  50. package/assets/esri/core/workers/chunks/{58e2652810143f509fe1.js → c473b15d4d52f0a63d20.js} +1 -1
  51. package/assets/esri/core/workers/chunks/c8e4fe0e3b109eb80e8e.js +1 -0
  52. package/assets/esri/core/workers/chunks/c9159ebf930af3f336f3.js +1 -0
  53. package/assets/esri/core/workers/chunks/cd0c222a36caa7f80860.js +1 -0
  54. package/assets/esri/core/workers/chunks/ce2fcaa21d6efcdf4da5.js +1 -0
  55. package/assets/esri/core/workers/chunks/d2df6e685d6cffc5f486.js +1 -0
  56. package/assets/esri/core/workers/chunks/{c27783ce7ea51a5e49c5.js → e153b61560a7a869db63.js} +1 -1
  57. package/assets/esri/core/workers/chunks/e2c293331515f3bd0355.js +1 -0
  58. package/assets/esri/core/workers/chunks/{100a0041ee42b0b2fa32.js → e5d974593043d5e2b502.js} +1 -1
  59. package/assets/esri/core/workers/chunks/ec7b156425f25d231078.js +1 -0
  60. package/assets/esri/core/workers/chunks/{1194c2432c31def87db1.js → f71b76c9506178124fa3.js} +1 -1
  61. package/assets/esri/core/workers/chunks/fb456e7425e09df17d8c.js +1 -0
  62. package/assets/esri/core/workers/chunks/{f6806780ca2aa591475a.js → fe1dcf9f81da4adbb1fe.js} +1 -1
  63. package/assets/esri/libs/parquet/pkg/bundle_bg.wasm +0 -0
  64. package/assets/esri/themes/base/_core.scss +0 -2
  65. package/assets/esri/themes/base/widgets/_OrientedImageryViewerNavigationUI.scss +10 -7
  66. package/assets/esri/themes/dark/main.css +1 -1
  67. package/assets/esri/themes/light/main.css +1 -1
  68. package/assets/esri/themes/light/view.css +1 -1
  69. package/chunks/CutFillComposition.glsl.js +15 -3
  70. package/chunks/CutFillMask.glsl.js +1 -1
  71. package/chunks/WaterSurface.glsl.js +0 -1
  72. package/chunks/bundle.js +1 -1
  73. package/chunks/languageUtils.js +1 -1
  74. package/colorUtils.js +1 -1
  75. package/config.js +1 -1
  76. package/core/CollectionFlattener.js +1 -1
  77. package/editing/sharedTemplates/executor/support/createPresetServiceEdit.js +1 -1
  78. package/geometry/operators/json/graphicBufferOperator.js +1 -1
  79. package/geometry/support/aaBoundingRect.js +1 -1
  80. package/geometry/support/geometryUtils.js +1 -1
  81. package/geometry/support/meshUtils/elevationSampler.js +1 -1
  82. package/geometry/support/meshUtils.js +1 -1
  83. package/geometry/support/triangle.js +1 -1
  84. package/interfaces.d.ts +262 -339
  85. package/kernel.js +1 -1
  86. package/layers/BaseElevationLayer.js +1 -1
  87. package/layers/BaseTileLayer.js +1 -1
  88. package/layers/ElevationLayer.js +1 -1
  89. package/layers/FeatureLayer.js +1 -1
  90. package/layers/GaussianSplatLayer.js +1 -1
  91. package/layers/ImageryTileLayer.js +1 -1
  92. package/layers/ParquetLayer.js +1 -1
  93. package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
  94. package/layers/graphics/dehydratedFeatureComparison.js +1 -1
  95. package/layers/graphics/sources/ParquetSource.js +1 -1
  96. package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
  97. package/layers/orientedImagery/transformations/imageToWorld.js +1 -1
  98. package/layers/orientedImagery/transformations/updateElevationUtils.js +1 -1
  99. package/layers/support/ElevationQuery.js +1 -1
  100. package/layers/support/ElevationQueryContext.js +5 -0
  101. package/layers/support/ElevationSampler.js +1 -1
  102. package/layers/support/ElevationTile.js +1 -1
  103. package/layers/support/GeometryDescriptor.js +1 -1
  104. package/layers/support/ParquetEncodingLocation.js +1 -1
  105. package/layers/support/ParquetEncodingWkb.js +1 -1
  106. package/layers/support/RasterBandInfo.js +1 -1
  107. package/layers/support/TileElevationSampler.js +5 -0
  108. package/layers/support/TileInfo.js +1 -1
  109. package/layers/support/TileKey.js +1 -1
  110. package/layers/support/TilemapCache.js +1 -1
  111. package/layers/support/layerUtils.js +1 -1
  112. package/layers/support/parquetEncodingUtils.js +5 -0
  113. package/layers/support/parquetUtils.js +1 -1
  114. package/layers/support/rasterDatasets/InMemoryRaster.js +1 -1
  115. package/networks/UtilityNetwork.js +1 -1
  116. package/networks/support/NetworkSystemLayers.js +1 -1
  117. package/networks/support/typeUtils.js +1 -1
  118. package/package.json +3 -2
  119. package/popup/FieldInfo.js +1 -1
  120. package/popup/content/AttachmentsContent.js +1 -1
  121. package/portal/schemas/definitions.js +1 -1
  122. package/rest/knowledgeGraphService.js +1 -1
  123. package/rest/networks/support/Association.js +1 -1
  124. package/rest/print.js +1 -1
  125. package/support/revision.js +1 -1
  126. package/symbols/cim/CIMSymbolHelper.js +1 -1
  127. package/symbols/cim/cimAnalyzer.js +1 -1
  128. package/symbols/cim/effects/EffectOffset.js +1 -1
  129. package/views/2d/analysis/ElevationProfile/ElevationProfileInputVisualization2D.js +1 -1
  130. package/views/2d/analysis/ElevationProfile/ElevationProfileLineVisualization2D.js +1 -1
  131. package/views/2d/analysis/ElevationProfileAnalysisView2D.js +1 -1
  132. package/views/2d/engine/Stage.js +1 -1
  133. package/views/2d/engine/flow/BrushFlow.js +1 -1
  134. package/views/2d/engine/vectorTiles/VectorTileRendererHelper3D.js +1 -1
  135. package/views/2d/engine/webgl/Overlay.js +1 -1
  136. package/views/2d/engine/webgl/OverlayMultipoint.js +1 -1
  137. package/views/2d/engine/webgl/SpriteMosaic.js +1 -1
  138. package/views/2d/engine/webgl/TextureManager.js +1 -1
  139. package/views/2d/engine/webgl/animatedFormats/AnimatableTextureResource.js +1 -1
  140. package/views/2d/engine/webgl/animatedFormats/utils.js +1 -1
  141. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedMarkerMeshWriter.js +1 -1
  142. package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedTechnique.js +1 -1
  143. package/views/2d/engine/webgl/shaderGraph/techniques/fill/ComplexFillTechnique.js +1 -1
  144. package/views/2d/engine/webgl/shaderGraph/techniques/fill/ComplexOutlineFillTechnique.js +1 -1
  145. package/views/2d/engine/webgl/shaderGraph/techniques/fill/GradientFillTechnique.js +1 -1
  146. package/views/2d/engine/webgl/shaderGraph/techniques/fill/PatternFillTechnique.js +1 -1
  147. package/views/2d/engine/webgl/shaderGraph/techniques/fill/PatternOutlineFillTechnique.js +1 -1
  148. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelTechnique.js +1 -1
  149. package/views/2d/engine/webgl/shaderGraph/techniques/line/GradientStrokeTechnique.js +1 -1
  150. package/views/2d/engine/webgl/shaderGraph/techniques/line/TexturedLineTechnique.js +1 -1
  151. package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerTechnique.js +1 -1
  152. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextTechnique.js +1 -1
  153. package/views/2d/engine/webgl/shaderGraph/utils.js +1 -1
  154. package/views/2d/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiles2D.js +1 -1
  155. package/views/2d/layers/VideoLayerView2D.js +1 -1
  156. package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
  157. package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
  158. package/views/2d/navigation/actions/Pan.js +1 -1
  159. package/views/3d/analysis/ElevationProfile/ElevationProfileInputVisualization3D.js +1 -1
  160. package/views/3d/analysis/ElevationProfile/ElevationProfileLineSceneComputation.js +1 -1
  161. package/views/3d/analysis/ElevationProfile/ElevationProfileLineVisualization3D.js +1 -1
  162. package/views/3d/analysis/ElevationProfile/ElevationProfileVisualization3D.js +1 -1
  163. package/views/3d/analysis/ElevationProfileAnalysisView3D.js +1 -1
  164. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillVisualization.js +1 -1
  165. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementTool.js +1 -1
  166. package/views/3d/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiles3D.js +1 -1
  167. package/views/3d/layers/FlowSubView3D.js +1 -1
  168. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  169. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  170. package/views/3d/support/GaussianSplatSortWorker.js +1 -1
  171. package/views/3d/support/flow/FlowSubViewTiles3D.js +1 -1
  172. package/views/3d/support/gaussianSplatting/GaussianSplatDataStore.js +1 -1
  173. package/views/3d/support/hitTest.js +1 -1
  174. package/views/3d/support/pointsOfInterest/StableSurfaceCenter.js +1 -1
  175. package/views/3d/support/popupHitTest.js +1 -1
  176. package/views/3d/terrain/ExtentHelper.js +1 -1
  177. package/views/3d/webgl-engine/core/shaderTechnique/ShaderTechnique.js +1 -1
  178. package/views/3d/webgl-engine/effects/blit/Blit.js +1 -1
  179. package/views/3d/webgl-engine/effects/transparency/OITBlendTechnique.js +1 -1
  180. package/views/3d/webgl-engine/lib/CompositingHelper.js +1 -1
  181. package/views/3d/webgl-engine/lib/CutFillColor.js +1 -1
  182. package/views/3d/webgl-engine/shaders/CutFillComposition.glsl.js +1 -1
  183. package/views/3d/webgl-engine/shaders/GaussianSplatDepthCompositionTechnique.js +1 -1
  184. package/views/PopupView.js +1 -1
  185. package/views/SceneView.js +1 -1
  186. package/views/View.js +1 -1
  187. package/views/View2D.js +1 -1
  188. package/views/Viewport2DMixin.js +1 -1
  189. package/views/analysis/ElevationProfile/ElevationProfileChart.js +1 -1
  190. package/views/analysis/ElevationProfile/ElevationProfileController.js +1 -1
  191. package/views/analysis/ElevationProfile/ElevationProfileHoveredPointsVisualization.js +1 -1
  192. package/views/analysis/ElevationProfile/ElevationProfileLineComputation.js +1 -1
  193. package/views/analysis/ElevationProfile/ElevationProfileLineInputComputation.js +1 -1
  194. package/views/analysis/ElevationProfile/ElevationProfileLineQueryComputation.js +1 -1
  195. package/views/analysis/ElevationProfile/ElevationProfileResult.js +1 -1
  196. package/views/analysis/ElevationProfile/ElevationProfileTool.js +1 -1
  197. package/views/analysis/ElevationProfile/elevationProfileGeometryUtils.js +1 -1
  198. package/views/analysis/ElevationProfile/elevationProfileInputVisualizationUtils.js +1 -1
  199. package/views/analysis/ExclusiveOperationManager.js +5 -0
  200. package/views/interactive/snapping/LineSnapper.js +1 -1
  201. package/views/interactive/snapping/ParallelLineSnapper.js +1 -1
  202. package/views/interactive/snapping/RightAngleSnapper.js +1 -1
  203. package/views/interactive/snapping/RightAngleTriangleSnapper.js +1 -1
  204. package/views/interactive/snapping/featureSources/FeatureServiceSnappingSource.js +1 -1
  205. package/views/interactive/snapping/featureSources/WorkerTileTreeDebugger.js +1 -1
  206. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceSnappingSourceWorker.js +1 -1
  207. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceSnappingSourceWorkerHandle.js +1 -1
  208. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTileStore.js +1 -1
  209. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiledFetcher.js +1 -1
  210. package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTilesSimple.js +1 -1
  211. package/views/interactive/snapping/featureSources/featureServiceSource/PendingFeatureTile.js +1 -1
  212. package/views/interactive/snapping/featureSources/queryEngineUtils.js +1 -1
  213. package/views/interactive/snapping/snappingUtils.js +1 -1
  214. package/views/navigation/Navigation.js +1 -1
  215. package/views/popupAdapter.js +5 -0
  216. package/views/support/GroundViewElevationSampler.js +1 -1
  217. package/views/video/VideoOperationalDataView.js +1 -1
  218. package/views/webgl/ContextState.js +1 -1
  219. package/views/webgl/RenderingContext.js +1 -1
  220. package/views/webgl/enums.js +1 -1
  221. package/widgets/Attachments/AttachmentsViewModel.js +1 -1
  222. package/widgets/Attachments.js +1 -1
  223. package/widgets/BasemapGallery/support/basemapCompatibilityUtils.js +1 -1
  224. package/widgets/ElevationProfile/support/chartUtils.js +1 -1
  225. package/widgets/Feature/FeatureExpression.js +1 -1
  226. package/widgets/Feature/FeatureMedia/chartCommon.js +1 -1
  227. package/widgets/Feature/FeatureMedia/pieChart.js +1 -1
  228. package/widgets/Feature/FeatureMedia/xyChart.js +1 -1
  229. package/widgets/Feature/FeatureMedia.js +1 -1
  230. package/widgets/Feature/FeatureViewModel.js +1 -1
  231. package/widgets/Feature.js +1 -1
  232. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  233. package/widgets/FeatureTable/support/ColumnTemplateBase.js +1 -1
  234. package/widgets/FeatureTable/support/TableTemplate.js +1 -1
  235. package/widgets/FeatureTable.js +1 -1
  236. package/widgets/Features/FeaturesViewModel.js +1 -1
  237. package/widgets/Legend/LegendViewModel.js +1 -1
  238. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  239. package/widgets/Legend.js +1 -1
  240. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  241. package/widgets/OrientedImageryViewer/components/ImageViewer.js +1 -1
  242. package/widgets/OrientedImageryViewer/components/NavigationUI360.js +1 -1
  243. package/widgets/OrientedImageryViewer/components/NavigationUIPanoramicViewModel.js +1 -1
  244. package/widgets/OrientedImageryViewer/services/DepthImageService.js +5 -0
  245. package/widgets/PanoramicViewer.js +1 -1
  246. package/widgets/Search/SearchResultRenderer.js +1 -1
  247. package/widgets/Search/SearchViewModel.js +1 -1
  248. package/widgets/Search.js +1 -1
  249. package/widgets/Sketch/SketchViewModel.js +1 -1
  250. package/widgets/support/chartUtilsAm5.js +1 -1
  251. package/assets/esri/core/workers/chunks/08374e5805fcedc1cb57.js +0 -1
  252. package/assets/esri/core/workers/chunks/0b24a6c06d1becbb6815.js +0 -1
  253. package/assets/esri/core/workers/chunks/14114be3afd6d292f89c.js +0 -1
  254. package/assets/esri/core/workers/chunks/19f1bfe815896d4983af.js +0 -1
  255. package/assets/esri/core/workers/chunks/22c3a21bc9f32c429c48.js +0 -1
  256. package/assets/esri/core/workers/chunks/2605062e44f2d4e73f14.js +0 -1
  257. package/assets/esri/core/workers/chunks/282c4f3484c605ce7d5e.js +0 -1
  258. package/assets/esri/core/workers/chunks/2e1cc11462846febb3b2.js +0 -1
  259. package/assets/esri/core/workers/chunks/37b5007660535f1c91c6.js +0 -1
  260. package/assets/esri/core/workers/chunks/393274af1804e5b6046a.js +0 -1
  261. package/assets/esri/core/workers/chunks/3b2ef975831eb75b40fb.js +0 -1
  262. package/assets/esri/core/workers/chunks/3ff3e1507220d3869c76.js +0 -1
  263. package/assets/esri/core/workers/chunks/4133ab8720e7e4afa9a6.js +0 -1
  264. package/assets/esri/core/workers/chunks/4d807bfe75108438db83.js +0 -1
  265. package/assets/esri/core/workers/chunks/5ad1985a9e66fb2232ae.js +0 -1
  266. package/assets/esri/core/workers/chunks/5b7a2ee44883b1fb2a5f.js +0 -1
  267. package/assets/esri/core/workers/chunks/614a00a3179f8fe23f45.js +0 -1
  268. package/assets/esri/core/workers/chunks/6aa349e1adf844df4b5b.js +0 -1
  269. package/assets/esri/core/workers/chunks/83065bef261314f9b2c5.js +0 -1
  270. package/assets/esri/core/workers/chunks/8bdbd94a59269e216fba.js +0 -1
  271. package/assets/esri/core/workers/chunks/8cae725e631d922853c8.js +0 -1
  272. package/assets/esri/core/workers/chunks/8f4cfef97716c3502b0f.js +0 -1
  273. package/assets/esri/core/workers/chunks/8ff2daef892881ff2019.js +0 -1
  274. package/assets/esri/core/workers/chunks/9bb6984f24cd5461a754.js +0 -1
  275. package/assets/esri/core/workers/chunks/9f2a3f37fe9b19ef1209.js +0 -1
  276. package/assets/esri/core/workers/chunks/a1196637268b89281780.js +0 -1
  277. package/assets/esri/core/workers/chunks/a6a2d4602dfeb62e0ecc.js +0 -1
  278. package/assets/esri/core/workers/chunks/b240298b8b643a323d34.js +0 -1
  279. package/assets/esri/core/workers/chunks/b47f26d6aa9a2848a677.js +0 -1
  280. package/assets/esri/core/workers/chunks/b661ea374fe38c8e29ca.js +0 -1
  281. package/assets/esri/core/workers/chunks/b8997ae5893afa0298d1.js +0 -1
  282. package/assets/esri/core/workers/chunks/baa48614d9567d5f240d.js +0 -1
  283. package/assets/esri/core/workers/chunks/c20862fe15295a294bbd.js +0 -1
  284. package/assets/esri/core/workers/chunks/c3020747f9001ca6a6e7.js +0 -1
  285. package/assets/esri/core/workers/chunks/c7c76a8a1c47eb62bef1.js +0 -1
  286. package/assets/esri/core/workers/chunks/c95e6bef8c97cf647869.js +0 -1
  287. package/assets/esri/core/workers/chunks/d71836cf70b9604832f1.js +0 -1
  288. package/assets/esri/core/workers/chunks/e99fc64b67bb0c71dc34.js +0 -1
  289. package/assets/esri/core/workers/chunks/eea9d49d55c2d1355497.js +0 -1
  290. package/assets/esri/core/workers/chunks/fb6ebb780bb59e252887.js +0 -1
  291. package/assets/esri/core/workers/chunks/ff6d189ba78980d40bb5.js +0 -1
  292. package/assets/esri/themes/base/widgets/_ButtonMenu.scss +0 -87
  293. package/chunks/Button.js +0 -5
  294. package/chunks/ColorSet.js +0 -5
  295. package/chunks/DefaultTheme.js +0 -5
  296. package/chunks/LineSeries.js +0 -5
  297. package/chunks/ResponsiveTheme.js +0 -5
  298. package/chunks/Theme.js +0 -5
  299. package/chunks/Tick.js +0 -5
  300. package/chunks/Tooltip.js +0 -5
  301. package/chunks/ar.js +0 -5
  302. package/chunks/bg_BG.js +0 -5
  303. package/chunks/bs_BA.js +0 -5
  304. package/chunks/ca_ES.js +0 -5
  305. package/chunks/chartUtilsAm5.js +0 -5
  306. package/chunks/cs_CZ.js +0 -5
  307. package/chunks/da_DK.js +0 -5
  308. package/chunks/de_CH.js +0 -5
  309. package/chunks/de_DE.js +0 -5
  310. package/chunks/el_GR.js +0 -5
  311. package/chunks/en_CA.js +0 -5
  312. package/chunks/en_US.js +0 -5
  313. package/chunks/es_ES.js +0 -5
  314. package/chunks/et_EE.js +0 -5
  315. package/chunks/fi_FI.js +0 -5
  316. package/chunks/fr_FR.js +0 -5
  317. package/chunks/he_IL.js +0 -5
  318. package/chunks/hr_HR.js +0 -5
  319. package/chunks/hu_HU.js +0 -5
  320. package/chunks/id_ID.js +0 -5
  321. package/chunks/it_IT.js +0 -5
  322. package/chunks/ja_JP.js +0 -5
  323. package/chunks/ko_KR.js +0 -5
  324. package/chunks/lt_LT.js +0 -5
  325. package/chunks/lv_LV.js +0 -5
  326. package/chunks/nb_NO.js +0 -5
  327. package/chunks/nl_NL.js +0 -5
  328. package/chunks/pl_PL.js +0 -5
  329. package/chunks/pt_BR.js +0 -5
  330. package/chunks/pt_PT.js +0 -5
  331. package/chunks/ro_RO.js +0 -5
  332. package/chunks/ru_RU.js +0 -5
  333. package/chunks/sk_SK.js +0 -5
  334. package/chunks/sl_SL.js +0 -5
  335. package/chunks/sr_RS.js +0 -5
  336. package/chunks/sv_SE.js +0 -5
  337. package/chunks/th_TH.js +0 -5
  338. package/chunks/tr_TR.js +0 -5
  339. package/chunks/uk_UA.js +0 -5
  340. package/chunks/vi_VN.js +0 -5
  341. package/chunks/zh_Hans.js +0 -5
  342. package/chunks/zh_Hant.js +0 -5
  343. package/widgets/FeatureTable/Grid/support/ButtonMenu.d.ts +0 -4
  344. package/widgets/FeatureTable/Grid/support/ButtonMenu.js +0 -5
  345. package/widgets/FeatureTable/Grid/support/ButtonMenuItem.d.ts +0 -4
  346. package/widgets/FeatureTable/Grid/support/ButtonMenuItem.js +0 -5
  347. package/widgets/FeatureTable/Grid/support/ButtonMenuViewModel.d.ts +0 -4
  348. package/widgets/FeatureTable/Grid/support/ButtonMenuViewModel.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import"../../intl.js";import{isSome as t}from"../../core/arrayUtils.js";import i from"../../core/Collection.js";import{referenceSetter as s}from"../../core/collectionUtils.js";import{deprecatedFunction as l}from"../../core/deprecate.js";import o from"../../core/Error.js";import n from"../../core/Handles.js";import r from"../../core/Logger.js";import{abortMaybe as a}from"../../core/maybe.js";import{debounce as h,ignoreAbortErrors as d,after as m,throwIfAborted as c,createResolver as p}from"../../core/promiseUtils.js";import{watch as u,on as g,initial as b}from"../../core/reactiveUtils.js";import{throttle as f}from"../../core/throttle.js";import{property as y}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as T}from"../../core/accessorSupport/decorators/subclass.js";import{getLowerCaseDefaultHiddenFields as w}from"../../layers/support/fieldUtils.js";import{isSubtypeSublayer as _,getSubtypesFromLayer as C,isSubtypeGroupLayer as I}from"../../layers/support/layerUtils.js";import{createFieldInfos as v}from"../../support/popupUtils.js";import E from"../../tables/AttributeTableTemplate.js";import A from"../../tables/support/FieldOrder.js";import{defaultHighlightName as j,temporaryHighlightName as S}from"../../views/support/HighlightDefaults.js";import{highlightsSupported as F}from"../../views/support/layerViewUtils.js";import{isSelectableLayer as R}from"../../views/support/selectionUtils.js";import x from"./ActionColumn.js";import U from"./AttachmentsColumn.js";import O from"./FieldColumn.js";import V from"./RelationshipColumn.js";import z from"./Grid/Column.js";import W from"./Grid/Grid.js";import P from"./Grid/GridViewModel.js";import H from"./Grid/GroupColumn.js";import L from"./support/AttachmentsColumnTemplate.js";import B from"./support/AttachmentsViewOptions.js";import{isAttachmentsColumn as Z,isFieldColumn as G,isRelationshipColumn as k}from"./support/columnUtils.js";import{downloadAttachmentInfo as N,exportToCSV as D}from"./support/exportUtils.js";import M from"./support/FeatureStore.js";import $ from"./support/FieldColumnTemplate.js";import q from"./support/RelationshipColumnTemplate.js";import Q from"./support/TableTemplate.js";import{isIFeatureTableSupportedLayerWithRelationships as K,findRelatedLayerInSources as J,findRelationship as X,uniqueColumnNames as Y,hasColumnForField as ee,findField as te,isIFeatureTableSupportedLayerWithAttachments as ie,getTableHighlightKey as se,getRelationshipIdsToShow as le}from"./support/tableUtils.js";import{createAttributeTableElements as oe}from"./support/templateUtils.js";import{goTo as ne}from"../support/goToUtils.js";import"../support/widgetUtils.js";import{messageBundle as re}from"../support/decorators/messageBundle.js";import"@arcgis/toolkit/dom";import{onLocaleChange as ae}from"../../intl/locale.js";import{substitute as he}from"../../intl/substitute.js";import{fetchMessageBundle as de}from"../../intl/messages.js";const me="80px";let ce=class extends P{constructor(e){super(e),this._currentTemporaryHighlight=null,this._highlights=new n,this._refreshDebounced=h(()=>this._refresh()),this._syncTemplateThrottled=f(()=>this._syncAttributeTableTemplate()),this._temporaryHighlightAbortController=null,this.attachmentsViewOptions=new B,this.attributeTableTemplate=null,this.autoRefreshEnabled=!0,this.columns=new i,this.dataProvider=async(e,t)=>{const{layer:i,store:s}=this;if(!t)return;if(!i||!s)return void(t&&t([]));await i.load();const{objectIds:l}=this;if(this.filterBySelectionEnabled&&!this.highlightIds.length||1===l.length&&-1===l.items[0])return void t([]);"loaded"!==s.state&&"loading"!==s.state&&await s.load();const o=this.paginationEnabled?this.pageIndex:e.page,n=await s.fetchItems({...e,page:o});t&&t(n)},this.grid=null,this.highlightEnabled=!0,this.layers=null,this.messages=null,this.messagesCommon=null,this.messagesUnits=null,this.messagesURIUtils=null,this.prompt=null,this.relatedTables=new i,this.relationshipColumnConfigs=null,this.selectionSource="table",this.showRelatedTableCallback=null,this.store=null,this.syncTemplateOnChangesEnabled=!0,this.tableController=null,this.tableParent=null,this.tableTemplate=null,this.tableTemplateOverride=null,this._onLayerRefresh=this._onLayerRefresh.bind(this),this._onShowPromptCallback=this._onShowPromptCallback.bind(this),this._set("store",new M),this._set("grid",new W({viewModel:this}))}initialize(){const e=async()=>{this.messages=await de("esri/widgets/FeatureTable/t9n/FeatureTable"),this.messagesCommon=await de("esri/t9n/common"),this.messagesUnits=await de("esri/core/t9n/Units"),this.messagesURIUtils=await de("esri/widgets/support/t9n/uriUtils")};e(),this.addHandles([ae(()=>{e(),this._generateColumns()}),u(()=>[this.messages,this.messagesCommon,this.messagesURIUtils],()=>{const e=this.messages;this.grid&&(this.grid.messages=e),this.allColumns.forEach(t=>{t.messages=e,t.messagesCommon=this.messagesCommon,t.messagesURIUtils=this.messagesURIUtils}),this.refreshCellContent()},b),g(()=>this.highlightIds,"change",e=>this._onHighlightIdsChange(e),{onListenerAdd:()=>this._syncSelection(),onListenerRemove:()=>this._highlights.removeAll()}),u(()=>this.grid?.temporaryHighlightId,e=>{this._temporaryHighlightAbortController?.abort(),this._temporaryHighlightAbortController=new AbortController,d(this._syncTemporaryHighlight(e,this._temporaryHighlightAbortController.signal))}),u(()=>this.attachmentsEnabled,()=>this.layer?.loaded&&this._generateColumns()),u(()=>this._viewSelection,()=>{this._viewSelectionReady&&(this.highlightIds.items=this._viewSelection)}),u(()=>[this._tableHighlightsReady,this._viewSelectionReady],()=>this._syncSelection()),u(()=>this.layer,async(e,t)=>{const i=this.grid;i&&(i.clearSort(),e&&t&&await this.reset()),this.goToPage(0),this._drainColumns(),this.store.layer=e,e&&(e.loaded?this._onLayerLoad():e.load().catch(()=>{})),t&&null!=this.attachmentsViewOptions.objectId&&(this.attachmentsViewOptions.objectId=null)}),u(()=>this.layer?.loaded,e=>e&&this._onLayerLoad()),u(()=>this.store.state,e=>{"loaded"===e&&(this.scrollToTop(),this.refreshCellContent())}),u(()=>this._effectiveTableTemplate,()=>{this.scrollLeft(),this.layer?.loaded&&this._generateColumns()}),u(()=>this.editingEnabled,e=>{this.editableColumns.forEach(t=>t.tableEditingEnabled=e),this.refreshCellContent()}),u(()=>this.timeZone??this.view?.timeZone,()=>this.refreshCellContent()),u(()=>this.store.effectiveWhere,()=>"loaded"===this.store.state&&this.reset()),u(()=>this.layer?.timeExtent,(e,t)=>(e||t)&&!this.timeExtent&&"loaded"===this.store.state&&this.reset()),g(()=>this.layer,"refresh",e=>this._onLayerRefresh(e)),g(()=>this.grid,["cell-click","cell-dblclick","cell-pointerover","cell-pointerout","cell-keydown","column-reorder"],({index:e,item:t,native:i,path:s,type:l})=>{const o=t?.feature,n=o?.getObjectId(),r="cell-keydown"===l&&i&&i instanceof KeyboardEvent&&"Enter"===i.key;this.emit(l,{feature:o,index:e,native:i,type:l,fieldName:s??void 0,objectId:n}),(r||"cell-click"===l)&&this._onCellInteraction(n)}),u(()=>this.actionColumnConfig,e=>{const{actionColumn:t,columns:i}=this;t?e?t.set(e):i.remove(t):e&&i.length&&i.add(this._generateActionColumn(),!1!==e.frozenToEnd?void 0:this._getIndexOfFirstFrozenToEndColumn())}),u(()=>this.relatedRecordsEnabled,()=>this.layer?.loaded&&this._generateColumns()),g(()=>this.objectIds,"change",()=>this._onObjectIdsChange(),{onListenerAdd:()=>this._onObjectIdsChange()}),u(()=>[this.paginationEnabled,this.pageIndex],()=>this.refreshPageCache()),u(()=>this.activeSortOrders,e=>{this.store.sortOrders=e,this._syncTemplateThrottled()}),u(()=>this.allVisibleColumns,()=>this._syncTemplateThrottled()),u(()=>this.pageCount,()=>{this.pageIndex>=this.pageCount&&this.goToPage(0)}),u(()=>this.state,e=>{"disabled"===e&&this.relatedTables.length&&this.drainRelatedTables()}),g(()=>this.tableParent?.highlightIds,"change",({added:e})=>{const{relationshipConfig:t}=this,i=e[0];if(null==i||!t)return;const{relatedLayer:s,relationshipId:l}=t;this.relationshipConfig={objectId:i,relatedLayer:s,relationshipId:l}}),g(()=>this.tableParent,"cell-click",e=>{const{tableParent:t}=this,{objectId:i}=e;t&&null!=i&&t.highlightIds.add(i)}),u(()=>this.attachmentsViewOptions.objectId,(e,t)=>{null!=e?null==t&&this.showAttachmentsView({objectId:e}):this.hideAttachmentsView()})])}destroy(){this._drainColumns(),this._highlights.removeAll(),this._highlights.destroy(),this._currentTemporaryHighlight?.handle.remove(),this._temporaryHighlightAbortController=a(this._temporaryHighlightAbortController),this.grid?.destroy(),this.columns.destroyed||this.columns.destroy(),this.layer=null,this.view=null}get _defaultHiddenFields(){return w(this.layer)}get _effectiveTableTemplate(){return this.tableTemplateOverride||this.tableTemplate}get _effectiveAttributeTableTemplate(){return this.attributeTableTemplate||this.layer?.attributeTableTemplate}get _highlightableLayerView(){const e=this.layerView;return F(e)?e:null}get _selectionManager(){const{view:e}=this;return!e||e.destroyed?null:e.selectionManager?.sources?.length?e.selectionManager:null}get _selectableLayer(){const{layer:e}=this;if(R(e)||_(e)){const t=e;return this._selectionManager?.sources?.includes(t)?t:null}return null}get _subtypes(){return C(this.layer)}get _tableHighlightsReady(){return!("table"!==this.selectionSource||!this.highlightEnabled||!this._highlightableLayerView)}get _viewSelection(){const{_selectableLayer:e}=this;return e?this._selectionManager?.getSelection(e)??[]:[]}get _viewSelectionReady(){return!(!this.layer||"view"!==this.selectionSource||!this._selectionManager)}get actionColumn(){return super.actionColumn}get activeFilters(){const{filterGeometry:e,objectIds:t,filterBySelectionEnabled:s,highlightIds:l}=this,o=new i;return e&&o.push({type:"geometry",geometry:e}),s?o.push({type:"selection",objectIds:l.toArray()}):t.length&&o.push({type:"objectId",objectIds:t.toArray()}),o}get activeSortOrders(){return this.grid?.sortOrders?this.grid.sortOrders.map(({path:e,direction:t})=>({fieldName:e,direction:t})).filter(e=>e.fieldName&&e.direction):[]}get allColumns(){return super.allColumns}get allRelatedTablesVisible(){return!!(this.relatedRecordsEnabled&&this.relatedTables.length&&this.showAllRelatedTables)}get allVisibleColumns(){return super.allVisibleColumns}get attachmentsColumns(){return this.allColumns.filter(e=>Z(e))}get attachmentsEnabled(){return this.store.attachmentsEnabled}set attachmentsEnabled(e){this.store.attachmentsEnabled=e}get clearPrompt(){return()=>this.prompt=null}set clearPrompt(e){this._overrideIfSome("clearPrompt",e)}get definitionExpression(){return this.store.where}set definitionExpression(e){this.store.where=e}get effectiveSize(){return super.effectiveSize}get fieldColumns(){return this.allColumns.filter(e=>G(e))}get filterGeometry(){return this.store.filterGeometry}set filterGeometry(e){this.store.filterGeometry=e}get filterBySelectionEnabled(){return!!this._get("filterBySelectionEnabled")}set filterBySelectionEnabled(e){const{objectIds:t}=this,i=t.length;e?(i&&(t.removeAll(),this._logWarning("Selection filter has been applied with an objectID filter. Object ID filter has been removed.")),this.filterGeometry&&this._logWarning("Selection filter has been applied with a geometry filter. Results may appear inconsistent"),this._syncObjectIdsWithStore(this.highlightIds.toArray())):i||this._syncObjectIdsWithStore(null),this._set("filterBySelectionEnabled",e)}get groupColumns(){return super.groupColumns}get hiddenFields(){return this._get("hiddenFields")??new i}set hiddenFields(e){this._set("hiddenFields",s(e,this._get("hiddenFields"),i))}get highlightIds(){return super.highlightIds}set highlightIds(e){super.highlightIds=e}get initialSize(){return this.store.initialSize}set initialSize(e){this.store.initialSize=e}get isEditing(){return super.isEditing}get isQuerying(){return super.isQuerying}get isSyncing(){return super.isSyncing}get isQueryingOrSyncing(){return this.isQuerying||this.isSyncing||this.relatedTables.some(e=>!!e.isQueryingOrSyncing)}get isSyncingAttachments(){return this.store.isSyncingAttachmentEdits||this.relatedTables.some(e=>!!e.isSyncingAttachments)}get layer(){return this._get("layer")}set layer(e){this._highlights.removeAll(),this.drainRelatedTables(),this._set("layer",e)}get layerView(){return this.store.layerView}get objectIds(){return super.objectIds}set objectIds(e){super.objectIds=e}get outFields(){return this.store.outFields}set outFields(e){this.store.outFields=e}get pageCount(){return super.pageCount}get pageIndex(){return super.pageIndex}set pageIndex(e){super.pageIndex=e}get pageSize(){return super.pageSize}set pageSize(e){super.pageSize=e}get relatedRecordsEnabled(){return this.store.relatedRecordsEnabled}set relatedRecordsEnabled(e){this.store.relatedRecordsEnabled=e}get relatedTable(){return this.relatedTables.at(-1)}get relationship(){const e=this.relationshipConfig?.relationshipId;return null==e?null:this.relationships?.find(({id:t})=>t===e)}get relationshipColumns(){return this.allColumns.filter(e=>k(e))}get relationshipConfig(){return this.store.relationshipConfig}set relationshipConfig(e){this.highlightIds.removeAll(),this.objectIds.removeAll(),this.filterBySelectionEnabled=!1,this.store.relationshipConfig=e}get relationshipInfos(){const{layer:e,layers:t,relationships:i,tableController:s}=this,l=this.store.relationshipInfos;if(l.length||!K(e)||!i?.length)return l;const o=[],n=s?.layers||t||[];return i.forEach(t=>{const i=J(e,n,t);i&&(i.load(),o.push({layer:e,relatedLayer:i,relationshipId:t.id}))}),o}get relationships(){return this.store.relationships}get returnGeometryEnabled(){return this.store.returnGeometry}set returnGeometryEnabled(e){this.store.returnGeometry=e}get returnMEnabled(){return this.store.returnM}set returnMEnabled(e){this.store.returnM=e}get returnZEnabled(){return this.store.returnZ}set returnZEnabled(e){this.store.returnZ=e}get rowHighlightIds(){return super.rowHighlightIds}set rowHighlightIds(e){super.rowHighlightIds=e}get showAllRelatedTables(){return this._get("showAllRelatedTables")}set showAllRelatedTables(e){const{relatedTable:t}=this;this._set("showAllRelatedTables",e),t&&(e?this._showAllRelatedTables(t):this._hideAllRelatedTables(t))}get showPrompt(){return e=>{this.prompt?.cancel?.(),this.prompt=e}}set showPrompt(e){this._overrideIfSome("showPrompt",e)}get size(){return super.size}get state(){return super.state}get supportsAttachments(){return this.store.supportsAttachments}get supportsAddAttachments(){const{store:{supportsAddAttachments:e,supportsEditing:t}}=this;return this.editingEnabled&&t&&e}get supportsDeleteAttachments(){return this.supportsUpdateAttachments}get supportsResizeAttachments(){return this.store.supportsResizeAttachments}get supportsUpdateAttachments(){const{store:{supportsUpdateAttachments:e,supportsEditing:t}}=this;return this.editingEnabled&&t&&e}get timeExtent(){return this.store.timeExtent}set timeExtent(e){this.store.timeExtent=e}get timeZone(){return this._get("timeZone")}set timeZone(e){this.allColumns.forEach(t=>t.tableTimeZone=e),this._set("timeZone",e)}get view(){return this.store.view}set view(e){this.store.view=e,this.fieldColumns.forEach(t=>t.view=e),this.refreshCellContent()}get visibleColumns(){return super.visibleColumns}async addAttachment(e,t){const{attachmentsViewOptions:i,store:s}=this,l=i.objectId===e;await s.addAttachment(e,t).catch(e=>{l&&e&&"object"==typeof e&&"error"in e&&e.error instanceof o&&(this._logWarning(`Unable to add attachment. ${e.error.name} ${e.error.message}`),i.error=e.error)}),l&&!i.error&&(i.onEditComplete(),i.attachmentInfos=await s.getAttachmentsByObjectId(e,!0)),this.refreshCellContent()}async deleteAttachments(e,t){const{attachmentsViewOptions:i,store:s}=this,l=i.objectId===e;await s.deleteAttachments(e,t).catch(e=>{l&&e&&"object"==typeof e&&"error"in e&&e.error instanceof o&&(this._logWarning(`Unable to delete attachment(s). ${e.error.name} ${e.error.message}`),i.error=e.error)}),l&&!i.error&&(i.onEditComplete(),i.attachmentInfos=await s.getAttachmentsByObjectId(e,!0)),this.refreshCellContent()}collapseRelatedTable(e,t){const{relatedLayer:s,objectId:l,relationshipId:o}=t,{objectIdField:n}=s,r=X(s,o),a=s.displayField||r?.keyField||n;e.set({highlightIds:new i([l]),multipleSelectionEnabled:!1,tableTemplateOverride:this._getTableTemplateForRelatedTableView(e,a,o)});const h=e.hiddenFields;h.includes(Y.action)||h.add(Y.action),h.includes(Y.attachments)||h.add(Y.attachments),e.scrollLeft()}async deleteSelection(){const e=this.highlightIds.toArray();if(!e?.length)return;const{deleteFeatureResults:t}=await this.store.deleteRowsByObjectId(e),i=t.filter(e=>!e.error).map(e=>e.objectId);i.length&&(this.highlightIds.removeMany(i),await this.refresh())}async downloadAttachmentById(e,t){const i=(await this.store.getAttachmentsByObjectId(e,!0)).find(e=>e.id===t);await N(i)}drainRelatedTables(){this.relatedTables.drain(e=>e.destroy()),this.set({multipleSelectionEnabled:!0,relationshipColumnConfigs:null,showAllRelatedTables:!1,tableTemplateOverride:null}),this.hiddenFields.removeMany([Y.action,Y.attachments])}drainRelatedTablesAboveIndex(e){const{relatedTables:t}=this,i=t.slice(e+1);t.removeMany(i).forEach(e=>e.destroy());const s=t.at(-1);s&&(s.attachmentsViewOptions.objectId=null,this.allRelatedTablesVisible?this._showAllRelatedTables(s):this._hideAllRelatedTables(s))}async exportSelectionToCSV(e){const{highlightIds:t,layer:i,outFields:s}=this;i&&t.length?await D({layer:i,objectIds:t.toArray(),outFields:s,includeGeometry:e}):this._logWarning("Export failed.")}filterBySelection(){this.filterBySelectionEnabled?this._logWarning("Property 'filterBySelectionEnabled' is already 'true'. This method has no effect."):(l(r.getLogger(this),"`FeatureTable.filterBySelection` is deprecated in favor of 'filterBySelectionEnabled' and 'objectIds'",{replacement:"FeatureTable.filterBySelectionEnabled or FeatureTable.objectIds",version:"4.30",warnOnce:!0}),this.objectIds.addMany(this.highlightIds.toArray()))}getObjectIdIndex(e){return this.store.getItemIndexByObjectId(e)}getValue(e,t){const i=this.store.getItemByObjectId(e);return i?.feature?.attributes[t]}getVirtualPageIndex(){return this.grid?.getVirtualPageIndex()??0}goToPage(e){if(null==e||!Number.isInteger(e))return void this._logWarning("Invalid 'page' parameter provided to 'goToPage()'. Current page will remain the same.");const{pageCount:t}=this;(e>=t||-1===e)&&(e=t-1),e<-1&&(e=0),e!==this.pageIndex&&(this.pageIndex=e),this.paginationEnabled||this.scrollToIndex(e*this.pageSize)}hideAttachmentsView(){this.attachmentsViewOptions.objectId=null,this.set({relationshipColumnConfigs:null,multipleSelectionEnabled:!0,tableTemplateOverride:null}),this.hiddenFields.remove(Y.action)}nextPage(){const e=this.paginationEnabled?this.pageIndex:this.getVirtualPageIndex();this.goToPage(e+1)}previousPage(){const e=this.paginationEnabled?this.pageIndex:this.getVirtualPageIndex();this.goToPage(e-1)}async refresh(){await Promise.all([...this.relatedTables.map(e=>e.refresh()),d(this._refreshDebounced())])}refreshCellContent(){this.grid?.requestContentUpdate()}refreshPageCache(){this.grid?.refreshPageCache()}async reset(){this.goToPage(0),await(this.grid?.reset())}scrollLeft(){this.grid?.scrollLeft(0)}scrollToBottom(){this.grid?.scrollToBottom()}scrollToIndex(e){this.grid?.scrollToIndex(e)}scrollToRow(e){const t=this.store.getItemIndexByObjectId(e);t>-1?this.grid?.scrollToIndex(t):this._logWarning("Row not found. Associated data may not be loaded yet.")}scrollToTop(){this.grid?.scrollToTop()}async saveAttachmentsViewForm(){const{attachmentId:e,form:t,objectId:i}=this.attachmentsViewOptions;null!=i&&t&&(null!=e?await this.updateAttachment(i,e,t):await this.addAttachment(i,t))}async showAttachmentsView({objectId:e}){const{attachmentsViewOptions:t,hiddenFields:s,layer:l}=this;if(!this.attachmentsEnabled||!l)return void this._logWarning("The 'attachmentsEnabled' property is currently false.");await l.load();const o=this._getDefaultLayerDisplayField(l),n=await this.store.getAttachmentsByObjectId(e,!0),r=this.store.getItemIndexByObjectId(e);t.set({attachmentInfos:n,mode:n.length?"list":"file",objectId:e}),this.set({highlightIds:new i([e]),multipleSelectionEnabled:!1,relationshipColumnConfigs:[],tableTemplateOverride:this._getTableTemplateForAttachmentsView(o)}),s.includes(Y.action)||s.add(Y.action),null!=r&&this.scrollToIndex(r)}syncAttributeTableTemplate(){this._syncAttributeTableTemplate(!0)}clearSelectionFilter(){l(r.getLogger(this),"`FeatureTable.clearSelectionFilter` is deprecated in favor of 'filterBySelectionEnabled' and 'objectIds'",{replacement:"FeatureTable.filterBySelectionEnabled or FeatureTable.objectIds",version:"4.30",warnOnce:!0}),this.objectIds.removeAll()}async updateAttachment(e,t,i){const{attachmentsViewOptions:s,store:l}=this,n=s.objectId===e;await l.updateAttachment(e,t,i).catch(e=>{n&&e&&"object"==typeof e&&"error"in e&&e.error instanceof o&&(this._logWarning(`Unable to update attachment. ${e.error.name} ${e.error.message}`),s.error=e.error)}),n&&!s.error&&(s.onEditComplete(),s.attachmentInfos=await l.getAttachmentsByObjectId(e,!0)),this.refreshCellContent()}async zoomToSelection(){const{layer:e,view:t}=this,i=this.highlightIds.toArray();if(!e||!t||!i.length)return;const s=e.createQuery();s.objectIds=i,s.returnGeometry=!0;const l=await e.queryFeatures(s);try{await ne(t,l.features)}catch(o){"AbortError"!==o.name&&console.error(o)}}_syncAttributeTableTemplate(e=!1){const{_effectiveAttributeTableTemplate:t,layer:i,tableTemplateOverride:s,syncTemplateOnChangesEnabled:l}=this;if(!i||!t||!l&&!e||s||this.tableParent||this.relatedTable||null!==this.attachmentsViewOptions.objectId)return;const{activeSortOrders:o,allColumns:n,columns:r}=this,a=[],h=oe(r.toArray());o.forEach(({fieldName:e,direction:t})=>{e&&t&&a.push(new A({field:e,order:t}))}),n.forEach(({fieldName:e,direction:t})=>{t&&!a.some(t=>t.field===e)&&a.push(new A({field:e,order:t}))}),t.elements=h,t.orderByFields=a}async _refresh(){await this.store.refresh();const e=this.highlightIds.toArray();if(e.length){(await this.store.verifyFeaturesByObjectId(e)).forEach((t,i)=>{t||this.highlightIds.remove(e[i])})}this.refreshPageCache();const t=this.attachmentsViewOptions;null!=t?.objectId&&(t.attachmentInfos=await this.store.getAttachmentsByObjectId(t.objectId,!0))}async _onLayerLoad(){const{layer:e,pageSize:t}=this;if(!e)return;e.parent&&I(e.parent)&&await e.parent.loadAll();const i=e.capabilities.query?.maxRecordCount,s=i&&i<t,l=s?i:t;s&&(this._logWarning("The value for 'pageSize' has been adjusted due to the provided layer's max record count."),this.pageSize=l),this.grid?.set("pageSize",l),this.store.load(),this._generateColumns()}_onLayerRefresh(e){this.autoRefreshEnabled&&e.dataChanged&&this.refresh()}_generateColumns(){this._drainColumns();const{_effectiveTableTemplate:e,_effectiveAttributeTableTemplate:t}=this,i=e?.columnTemplates,s=this._generateColumnsFromColumnTemplates(i)??this._generateColumnsFromAttributeTableTemplate(t)??this._generateDefaultFieldColumns();s.length&&(this.attachmentsEnabled&&!s.some(e=>Z(e))&&s.push(this._generateDefaultAttachmentsColumn()),this.relatedRecordsEnabled&&this.relationshipInfos.length&&!s.some(e=>k(e))&&s.push(...this._generateDefaultRelationshipColumns()),this.actionColumnConfig&&s.push(this._generateActionColumn()),s.sort((e,t)=>e.frozen&&t.frozen||e.frozenToEnd&&t.frozenToEnd?0:e.frozen||t.frozenToEnd?-1:0),this.columns.addMany(s))}_generateColumnsFromAttributeTableTemplate(e){const{layer:i}=this;if(!e||!i)return null;const{elements:s,orderByFields:l}=e,o=v(i),n=[];n.push(...this._generateColumnsFromAttributeTableElements(s,l));const r=o.map(e=>{if(!e.fieldName||ee(e.fieldName,n))return null;const{fieldName:t}=e,s=te(i,t);return s?this._generateDefaultFieldColumn(s,{hidden:!0,orderByFields:l}):(this._logTemplateWarning("A valid 'field' could not be found for the provided template."),null)}).filter(t);return n.push(...r),this.attachmentsEnabled&&ie(i)&&!n.some(e=>Z(e))&&n.push(this._generateDefaultAttachmentsColumn({hidden:!0})),this.relatedRecordsEnabled&&K(i)&&i.relationships?.forEach(({id:e},t)=>{const i=this.relationshipInfos.find(t=>t.relationshipId===e);i&&!n.some(t=>k(t)&&t.relationshipId===e)&&n.push(this._generateDefaultRelationshipColumn({hidden:!0,info:i,index:t}))}),n.length?n:null}_generateColumnsFromAttributeTableElements(e,t){const{layer:i}=this;return i?e?.map((e,i)=>{switch(e.type){case"field":return this._createFieldColumnFromElement({element:e,orderByFields:t});case"group":return this._createGroupColumnFromElement({element:e,orderByFields:t});case"attachment":return this._createAttachmentColumnFromElement({element:e,index:i});case"relationship":return this._createRelationshipColumnFromElement({element:e,index:i})}}).filter(e=>!!e)??[]:[]}_createFieldColumnFromElement(e){const{layer:t}=this;if(!t)return null;const{element:i,orderByFields:s}=e,{fieldName:l}=i;if(null==l)return this._logTemplateWarning("A valid 'fieldName' must be provided."),null;const o=te(t,l);if(!o)return this._logTemplateWarning("A valid 'field' could not be found for the provided template."),null;const{description:n,label:r}=i,a=s?.findIndex(({field:e})=>e&&e===l)??-1,h=a>-1?s?.at(a)?.order:void 0,d=a>-1?a:void 0,{editingEnabled:m,grid:c,messages:p,messagesCommon:u,messagesURIUtils:g,store:b,timeZone:f,view:y}=this;return new O({description:n,direction:h,field:o,fieldName:l,grid:c,initialSortPriority:d,label:r,layer:t,messages:p,messagesCommon:u,messagesURIUtils:g,store:b,tableEditingEnabled:m,tableTimeZone:f,view:y,onShowPromptCallback:this._onShowPromptCallback})}_createGroupColumnFromElement(e){const{element:t,orderByFields:i}=e,{description:s,label:l}=t;if(!l)return this._logTemplateWarning("Group columns require a label."),null;if(!t.elements.length)return this._logTemplateWarning("Group columns require child columns."),null;const{grid:o,messages:n,messagesCommon:r,messagesURIUtils:a,store:h,timeZone:d}=this;return new H({columns:this._generateColumnsFromAttributeTableElements(t.elements,i),description:s,grid:o,label:l,messages:n,messagesCommon:r,messagesURIUtils:a,store:h,tableTimeZone:d})}_createAttachmentColumnFromElement(e){if(!this.attachmentsEnabled)return void this._logTemplateWarning("The 'attachmentsEnabled' property is currently false.");const{element:t,index:i}=e,{description:s,label:l}=t,{grid:o,layer:n,messages:r,messagesCommon:a,messagesURIUtils:h,store:d,timeZone:m}=this;return new U({description:s,fieldName:`${Y.attachments}-${i}`,grid:o,label:l,layer:n,messages:r,messagesCommon:a,messagesURIUtils:h,store:d,tableTimeZone:m,onShowAttachments:e=>this._onShowAttachments(e)})}_createRelationshipColumnFromElement(e){if(!this.relatedRecordsEnabled)return void this._logTemplateWarning("Relationship columns require related records to be enabled on the table.");const{element:t,index:i}=e,{description:s,label:l,relationshipId:o}=t,n=this.relationshipInfos.find(e=>e.relationshipId===o);if(!n)return this._logTemplateWarning("Unable to find valid related layer target based on the provided relationship id."),null;const{grid:r,messages:a,messagesCommon:h,messagesURIUtils:d,store:m,timeZone:c}=this;return new V({description:s,fieldName:`${Y.relationship}-${o}-${i}`,grid:r,label:l,messages:a,messagesCommon:h,messagesURIUtils:d,relationshipId:o,store:m,tableTimeZone:c,layer:n.relatedLayer,relatedLayer:n.layer,showRelatedTableCallback:e=>this._onShowRelatedTable(e)})}_generateColumnsFromColumnTemplates(e){const{editingEnabled:t,grid:i,layer:s,messages:l,messagesCommon:o,messagesURIUtils:n,store:r,timeZone:a,view:h}=this;if(!e?.length||!s)return null;const d=[];return e.forEach((e,m)=>{const{autoWidth:c,description:p,direction:u,flexGrow:g,fieldName:b,formatFunction:f,frozen:y,frozenToEnd:T,icon:w,iconText:_,initialSortPriority:C,invalid:I,label:v,labelTooltipText:E,menuConfig:A,resizable:j,sortable:S,textAlign:F,textWrap:R,timeZone:x,type:U,width:V}=e;if(!U)return void this._logTemplateWarning("Property 'type' is missing from the provided template.");if(y&&T)return void this._logTemplateWarning("Properties 'frozen' and 'frozenToEnd' cannot both be true for the same column.");const W=!1===e.visible;if("group"===U){if(!e.columnTemplates?.length)return void this._logTemplateWarning("Group columns must contain column templates.");if(!e.label)return void this._logTemplateWarning("Group columns require a label.");const t=this._generateColumnsFromColumnTemplates(e.columnTemplates),s=W||this._isFieldHidden(e.label);d.push(new H({autoWidth:c,columns:t,description:p,flexGrow:g,frozen:y,frozenToEnd:T,grid:i,hidden:s,icon:w,iconText:_,invalid:I,label:v,labelTooltipText:E,menuConfig:A,messages:l,messagesCommon:o,messagesURIUtils:n,resizable:j,tableTimeZone:a,textAlign:F,textWrap:R,timeZone:x,width:V}))}else if("attachment"===U){if(!this.attachmentsEnabled)return void this._logTemplateWarning("Attachment columns require attachments to be enabled on the table.");d.push(this._generateAttachmentsColumnFromTemplate(e,m))}else if("relationship"===U){if(!this.relatedRecordsEnabled)return void this._logTemplateWarning("Relationship columns require related records to be enabled on the table.");const{relationshipId:t}=e;if(null==t)return void this._logTemplateWarning("Property 'relationshipId' is missing from the provided template.");const i=this.relationshipInfos.find(e=>e.relationshipId===t);if(!i)return void this._logTemplateWarning("Unable to find valid related layer target based on the provided relationship id.");d.push(this._generateRelationshipColumnFromTemplate(i,e,m))}else if(!b)return void this._logTemplateWarning("Value for 'fieldName' property was missing from the provided template.");const P=W||this._isFieldHidden(b);if("column"===U)d.push(new z({autoWidth:c,description:p,direction:u,fieldName:b,flexGrow:g,formatFunction:f,frozen:y,frozenToEnd:T,grid:i,hidden:P,icon:w,iconText:_,initialSortPriority:C,invalid:I,label:v,labelTooltipText:E,menuConfig:A,messages:l,messagesCommon:o,messagesURIUtils:n,resizable:j,sortable:S,tableTimeZone:a,textAlign:F,textWrap:R,timeZone:x,width:V}));else if("field"===U){const m=te(s,e.fieldName);if(!m)return void this._logTemplateWarning("A valid 'field' could not be found for the provided template.");const{editable:b,required:U}=e;d.push(new O({autoWidth:c,description:p,direction:u,editable:b,field:m,fieldName:m.name,flexGrow:g,formatFunction:f,frozen:y,frozenToEnd:T,grid:i,hidden:P,icon:w,iconText:_,initialSortPriority:C,invalid:I,label:v,labelTooltipText:E,layer:s,messages:l,messagesCommon:o,messagesURIUtils:n,menuConfig:A,required:U,resizable:j,sortable:S,store:r,tableEditingEnabled:t,tableTimeZone:a,template:e,textAlign:F,textWrap:R,timeZone:x,width:V,view:h,onShowPromptCallback:this._onShowPromptCallback}))}}),d.length?d:null}_generateDefaultFieldColumns(){return this.layer?.fields?.map(e=>this._generateDefaultFieldColumn(e)).filter(t)??[]}_generateDefaultFieldColumn(e,t){const{editingEnabled:i,grid:s,layer:l,messages:o,messagesCommon:n,messagesURIUtils:r,store:a,timeZone:h,view:d}=this,m=t?.orderByFields;if(!e.visible||"geometry"===e.type)return null;const c=e.name,p=m?.findIndex(({field:e})=>e&&e===c)??-1,u=p>-1?m?.at(p)?.order:void 0,g=p>-1?p:void 0;return new O({direction:u,field:e,fieldName:c,grid:s,hidden:t?.hidden||this._isFieldHidden(c),initialSortPriority:g,layer:l,messages:o,messagesCommon:n,messagesURIUtils:r,store:a,tableEditingEnabled:i,tableTimeZone:h,view:d,onShowPromptCallback:this._onShowPromptCallback})}_generateAttachmentsColumnFromTemplate(e,t){const{grid:i,layer:s,messages:l,messagesCommon:o,messagesURIUtils:n,store:r,timeZone:a}=this,{attachmentsViewEnabled:h,autoWidth:d,description:m,flexGrow:c,fieldName:p,formatFunction:u,frozen:g,frozenToEnd:b,icon:f,iconText:y,invalid:T,label:w,labelTooltipText:_,menuConfig:C,resizable:I,textAlign:v,textWrap:E,thumbnailAppearance:A,thumbnailCount:j,thumbnailIconScale:S,thumbnailsEnabled:F,timeZone:R,width:x}=e;return new U({attachmentsViewEnabled:h,autoWidth:d,description:m,fieldName:`${Y.attachments}-${t}`,flexGrow:c,formatFunction:u,frozen:g,frozenToEnd:b,grid:i,hidden:!1===e.visible||this._isFieldHidden(w)||this._isFieldHidden(p),icon:f,iconText:y,invalid:T,label:w,labelTooltipText:_,layer:s,menuConfig:C,messages:l,messagesCommon:o,messagesURIUtils:n,resizable:I,store:r,tableTimeZone:a,textAlign:v,textWrap:E,thumbnailAppearance:A,thumbnailCount:j,thumbnailIconScale:S,thumbnailsEnabled:F,timeZone:R,width:x,onShowAttachments:e=>this._onShowAttachments(e)})}_generateDefaultAttachmentsColumn(e){const{grid:t,layer:i,messages:s,messagesCommon:l,messagesURIUtils:o,store:n,timeZone:r}=this,a=Y.attachments;return new U({fieldName:a,grid:t,hidden:e?.hidden||this._isFieldHidden(a),layer:i,messages:s,messagesCommon:l,messagesURIUtils:o,store:n,tableTimeZone:r,onShowAttachments:e=>this._onShowAttachments(e)})}_generateRelationshipColumnFromTemplate(e,t,i){const{grid:s,messages:l,messagesCommon:o,messagesURIUtils:n,store:r,timeZone:a}=this,{autoWidth:h,collapsed:d,description:m,flexGrow:c,fieldName:p,formatFunction:u,frozen:g,frozenToEnd:b,icon:f,iconText:y,invalid:T,label:w,labelTooltipText:_,menuConfig:C,relationshipId:I,resizable:v,textAlign:E,textWrap:A,timeZone:j,width:S}=t;return new V({autoWidth:h,collapsed:d,description:m,fieldName:`${Y.relationship}-${I}-${i}`,flexGrow:c,formatFunction:u,frozen:g,frozenToEnd:b,grid:s,hidden:!1===t.visible||this._isFieldHidden(w)||this._isFieldHidden(p),icon:f,iconText:y,invalid:T,label:w,labelTooltipText:_,menuConfig:C,messages:l,messagesCommon:o,messagesURIUtils:n,relationshipId:I,resizable:v,store:r,tableTimeZone:a,textAlign:E,textWrap:A,timeZone:j,width:S,layer:e.relatedLayer,relatedLayer:e.layer,showRelatedTableCallback:e=>this._onShowRelatedTable(e)})}_generateDefaultRelationshipColumns(){const{relationshipInfos:e,relationshipColumnConfigs:t}=this,i=[];return e?.length?(t?t.forEach((t,s)=>{const{relationshipId:l}=t,o=e.find(e=>e.relationshipId===l);o&&i.push(this._generateDefaultRelationshipColumn({config:t,index:s,info:o}))}):e.forEach((e,t)=>i.push(this._generateDefaultRelationshipColumn({index:t,info:e}))),i):i}_generateDefaultRelationshipColumn(e){const{config:t,hidden:i,index:s,info:l}=e,{grid:o,messages:n,messagesCommon:r,messagesURIUtils:a}=this,{relationshipId:h}=l;return new V({...t,fieldName:`${Y.relationship}-${h}-${s}`,grid:o,hidden:i,messages:n,messagesCommon:r,messagesURIUtils:a,layer:l.relatedLayer,relatedLayer:l.layer,relationshipId:h,showRelatedTableCallback:e=>this._onShowRelatedTable(e)})}_generateActionColumn(){return new x({hidden:this._isFieldHidden(Y.action),...this.actionColumnConfig})}_isFieldHidden(e){const t=e?.toLowerCase();return(this.hiddenFields??this._defaultHiddenFields).some(e=>e.toLowerCase()===t)}_addTableHighlight(e){if(!this.highlightEnabled)return;const{_highlightableLayerView:t,layer:i}=this;if(t&&i){const s=this.store.getItemByObjectId(e),l=s?.feature??e;this._highlights.add(t.highlight(l,{name:j}),se(i,e))}}_removeTableHighlight(e){const{layer:t}=this;t&&this._highlights.remove(se(t,e))}async _syncTemporaryHighlight(e,t){if(!this.highlightEnabled)return this._currentTemporaryHighlight?.handle.remove(),void(this._currentTemporaryHighlight=null);if(await m(25),c(t),!this._currentTemporaryHighlight&&!e)return;const{id:i}=this._currentTemporaryHighlight??{};if(i===e)return;this._currentTemporaryHighlight?.handle?.remove(),this._currentTemporaryHighlight=null;const{_highlightableLayerView:s,layer:l,highlightEnabled:o}=this;e&&s&&l&&o&&(this._currentTemporaryHighlight={id:e,handle:s.highlight(e,{name:S})})}_syncSelection(){this._highlights.removeAll(),this._tableHighlightsReady?this.highlightIds.forEach(e=>this._addTableHighlight(e)):this._viewSelectionReady&&(this.highlightIds.items=this._viewSelection)}_appendToViewSelection(e){const{_selectableLayer:t}=this;t&&this._selectionManager?.appendToSelection(t,e)}_removeFromViewSelection(e){const{_selectableLayer:t}=this;t&&this._selectionManager?.removeFromSelection(t,e)}async _onHighlightIdsChange(e){const{added:t,removed:i}=e,{attachmentsViewOptions:s}=this;if(this._tableHighlightsReady?(i.forEach(e=>this._removeTableHighlight(e)),t.forEach(e=>this._addTableHighlight(e))):this._viewSelectionReady&&(this._removeFromViewSelection(i),this._appendToViewSelection(t)),this.filterBySelectionEnabled&&this._syncObjectIdsWithStore(this.highlightIds.toArray()),null!=s.objectId){const e=this.highlightIds.at(0);if(null!=e){const t=await this.store.getAttachmentsByObjectId(e,!0);s.set({attachmentInfos:t,objectId:e,mode:t.length?"list":"file"})}}}_onShowRelatedTable(e){const{highlightIds:t}=this,{objectId:i}=e;t.removeAll(),t.add(i),this.showRelatedTableCallback?this.showRelatedTableCallback(e):this.emit("show-related-table",e)}_onObjectIdsChange(){const e=this.objectIds.toArray();e.length&&this.filterBySelectionEnabled&&(this.filterBySelectionEnabled=!1,this._logWarning("Object ID filter was applied while a selection filter was applied. Selection filter has been removed.")),this._syncObjectIdsWithStore(e)}_syncObjectIdsWithStore(e){this.store.objectIds=e,this.refreshPageCache()}_drainColumns(){this.columns.drain(e=>!e.destroyed&&e.destroy())}_showAllRelatedTables(e){const t=e.layer;if(!t)return;const i=this._getDefaultLayerDisplayField(t);e.set({relationshipColumnConfigs:[],tableTemplateOverride:this._getTableTemplateForShowAllTablesView(e,i)});const s=e.hiddenFields;s.includes(Y.action)||s.add(Y.action),s.includes(Y.attachments)||s.add(Y.attachments)}_hideAllRelatedTables(e){const{layer:t,relationship:i}=e;if(t&&null!=i?.id)if(null!=e.attachmentsViewOptions.objectId){const i=this._getDefaultLayerDisplayField(t);e.set({multipleSelectionEnabled:!1,relationshipColumnConfigs:[],showAllRelatedTables:!1,tableTemplateOverride:this._getTableTemplateForAttachmentsView(i)})}else e.set({multipleSelectionEnabled:!0,relationshipColumnConfigs:le(t,i.id),showAllRelatedTables:!1,tableTemplateOverride:null}),e.hiddenFields.removeMany([Y.action,Y.attachments])}_getTableTemplateForRelatedTableView(e,t,i){return new Q({columnTemplates:[new $({fieldName:t,editable:!1,menuConfig:{selectionMode:"single",icon:"chevron-down",items:this._extractFieldColumnInfosFromTableTemplate(e.viewModel).map(([s,l])=>({selected:s===t,label:l||s,clickFunction:()=>{e.tableTemplateOverride=this._getTableTemplateForRelatedTableView(e,s,i)}}))},resizable:!1}),new q({autoWidth:!1,collapsed:!0,flexGrow:0,label:"",resizable:!1,relationshipId:i,width:me})]})}_getTableTemplateForShowAllTablesView(e,t){const i=[new $({fieldName:t,editable:!1,menuConfig:{selectionMode:"single",icon:"chevron-down",items:this._extractFieldColumnInfosFromTableTemplate(e.viewModel).map(([i,s])=>({selected:i===t,label:s||i,clickFunction:()=>{e.tableTemplateOverride=this._getTableTemplateForShowAllTablesView(e,i)}}))},resizable:!1})];return null!=e.attachmentsViewOptions.objectId&&i.push(new L({attachmentsViewEnabled:!1,autoWidth:!1,flexGrow:0,label:"",resizable:!1,thumbnailsEnabled:!1,width:me})),new Q({columnTemplates:i})}async _onShowPromptCallback(e){const{column:t,objectId:i,oldValue:s,value:l}=e,{_subtypes:o,layer:n}=this;if(!n||!o.length)return void t.cancel();const r=o.find(e=>e.code===l);if(!r)return void t.cancel();const a=p(),h=this._createSubtypeEditPrompt(s,r,a),d=!!n.parent;try{this.showPrompt(h);const e=await a.promise,s=[{fieldName:t.fieldName,value:l}];switch(e){case"update-fields":for(const[e,t]of Object.entries(r.defaultValues))null!=t&&s.push({fieldName:e,value:t});await t.updateItems({objectId:i,updates:s}),d&&this.refresh();break;case"keep-existing":await t.updateItems({objectId:i,updates:s}),d&&this.refresh();break;case"undo":t.cancel()}}finally{this.clearPrompt()}}_createSubtypeEditPrompt(e,t,i){const{_subtypes:s,messages:l,messagesCommon:o}=this,n=s.find(t=>t.code===e)?.name??`${e}`;let r="update-fields";const a=[{label:l.subtypes.useDefaultValuesOption,value:"update-fields"},{label:l.subtypes.keepCurrentValuesOption,value:"keep-existing"}];return{context:"info",title:l.subtypes.changeWarningTitle,message:he(l.subtypes.changeWarning,{originalType:n,newType:t.name}),radios:a,defaultRadioSelection:"update-fields",onRadioSelection:e=>{r=e},actions:{primary:{label:o.apply,action:()=>i.resolve(r),type:"positive"},secondary:{label:o.cancel,type:"neutral",action:()=>i.resolve("undo")}},cancel:()=>i.reject()}}_onShowAttachments({objectId:e}){this.attachmentsViewOptions.objectId=e}_getTableTemplateForAttachmentsView(e){return new Q({columnTemplates:[new $({fieldName:e,editable:!1,menuConfig:{selectionMode:"single",icon:"chevron-down",items:this._extractFieldColumnInfosFromTableTemplate(this).map(([t,i])=>({selected:t===e,label:i||t,clickFunction:()=>{this.tableTemplateOverride=this._getTableTemplateForAttachmentsView(t)}}))},resizable:!1}),new L({attachmentsViewEnabled:!1,autoWidth:!1,flexGrow:0,label:"",resizable:!1,thumbnailsEnabled:!1,width:me})]})}_extractFieldColumnInfosFromTableTemplate(e){const t=e??this,{layer:i,tableTemplate:s}=t;return s?s.columnTemplates.filter(({type:e})=>"field"===e||"column"===e).map(({fieldName:e,label:t})=>[e,t]):i?.fields.map(e=>[e.name,e.alias])??[]}_getDefaultLayerDisplayField(e){const{displayField:t,objectIdField:i}=e;return t&&""!==t.trim()?t:i||(e.fields.length?e.fields[0].name:"")}_getIndexOfFirstFrozenToEndColumn(){const e=this.columns.findIndex(e=>e.frozenToEnd);return e>-1?e:void 0}_logWarning(e,t){t?r.getLogger(this).warnOnce(e):r.getLogger(this).warn(e)}_logTemplateWarning(e){this._logWarning(`${e} Skipped generating a column using the provided template.`,!0)}_onCellInteraction(e){null!=e&&null!=this.attachmentsViewOptions.objectId&&this.highlightIds.add(e)}};e([y()],ce.prototype,"_defaultHiddenFields",null),e([y()],ce.prototype,"_effectiveTableTemplate",null),e([y()],ce.prototype,"_effectiveAttributeTableTemplate",null),e([y()],ce.prototype,"_highlights",void 0),e([y()],ce.prototype,"_highlightableLayerView",null),e([y()],ce.prototype,"_selectionManager",null),e([y()],ce.prototype,"_selectableLayer",null),e([y()],ce.prototype,"_subtypes",null),e([y()],ce.prototype,"_tableHighlightsReady",null),e([y()],ce.prototype,"_viewSelection",null),e([y()],ce.prototype,"_viewSelectionReady",null),e([y()],ce.prototype,"activeFilters",null),e([y({readOnly:!0})],ce.prototype,"activeSortOrders",null),e([y()],ce.prototype,"allRelatedTablesVisible",null),e([y()],ce.prototype,"attachmentsColumns",null),e([y()],ce.prototype,"attachmentsEnabled",null),e([y()],ce.prototype,"attachmentsViewOptions",void 0),e([y({type:E})],ce.prototype,"attributeTableTemplate",void 0),e([y()],ce.prototype,"autoRefreshEnabled",void 0),e([y()],ce.prototype,"clearPrompt",null),e([y({readOnly:!0})],ce.prototype,"columns",void 0),e([y()],ce.prototype,"dataProvider",void 0),e([y()],ce.prototype,"definitionExpression",null),e([y()],ce.prototype,"fieldColumns",null),e([y()],ce.prototype,"filterGeometry",null),e([y()],ce.prototype,"filterBySelectionEnabled",null),e([y({readOnly:!0})],ce.prototype,"grid",void 0),e([y()],ce.prototype,"hiddenFields",null),e([y()],ce.prototype,"highlightEnabled",void 0),e([y()],ce.prototype,"initialSize",null),e([y()],ce.prototype,"isQueryingOrSyncing",null),e([y()],ce.prototype,"isSyncingAttachments",null),e([y()],ce.prototype,"layer",null),e([y()],ce.prototype,"layers",void 0),e([y()],ce.prototype,"layerView",null),e([y()],ce.prototype,"messages",void 0),e([y(),re("esri/t9n/common")],ce.prototype,"messagesCommon",void 0),e([y(),re("esri/core/t9n/Units")],ce.prototype,"messagesUnits",void 0),e([y(),re("esri/widgets/support/t9n/uriUtils")],ce.prototype,"messagesURIUtils",void 0),e([y()],ce.prototype,"outFields",null),e([y()],ce.prototype,"prompt",void 0),e([y()],ce.prototype,"relatedRecordsEnabled",null),e([y()],ce.prototype,"relatedTable",null),e([y()],ce.prototype,"relatedTables",void 0),e([y()],ce.prototype,"relationship",null),e([y()],ce.prototype,"relationshipColumnConfigs",void 0),e([y()],ce.prototype,"relationshipColumns",null),e([y()],ce.prototype,"relationshipConfig",null),e([y()],ce.prototype,"relationshipInfos",null),e([y()],ce.prototype,"relationships",null),e([y()],ce.prototype,"returnGeometryEnabled",null),e([y()],ce.prototype,"returnMEnabled",null),e([y()],ce.prototype,"returnZEnabled",null),e([y()],ce.prototype,"selectionSource",void 0),e([y()],ce.prototype,"showAllRelatedTables",null),e([y()],ce.prototype,"showPrompt",null),e([y()],ce.prototype,"showRelatedTableCallback",void 0),e([y({readOnly:!0,type:M})],ce.prototype,"store",void 0),e([y()],ce.prototype,"supportsAttachments",null),e([y()],ce.prototype,"supportsAddAttachments",null),e([y()],ce.prototype,"supportsDeleteAttachments",null),e([y()],ce.prototype,"supportsResizeAttachments",null),e([y()],ce.prototype,"supportsUpdateAttachments",null),e([y()],ce.prototype,"syncTemplateOnChangesEnabled",void 0),e([y()],ce.prototype,"tableController",void 0),e([y()],ce.prototype,"tableParent",void 0),e([y({type:Q})],ce.prototype,"tableTemplate",void 0),e([y()],ce.prototype,"tableTemplateOverride",void 0),e([y()],ce.prototype,"timeExtent",null),e([y()],ce.prototype,"timeZone",null),e([y()],ce.prototype,"view",null),ce=e([T("esri.widgets.FeatureTable.FeatureTableViewModel")],ce);const pe=ce;export{pe as default};
5
+ import{__decorate as e}from"tslib";import"../../intl.js";import{isSome as t}from"../../core/arrayUtils.js";import i from"../../core/Collection.js";import{referenceSetter as s}from"../../core/collectionUtils.js";import{deprecatedFunction as l}from"../../core/deprecate.js";import o from"../../core/Error.js";import n from"../../core/Handles.js";import r from"../../core/Logger.js";import{abortMaybe as a}from"../../core/maybe.js";import{debounce as h,ignoreAbortErrors as d,after as m,throwIfAborted as c,createResolver as p}from"../../core/promiseUtils.js";import{watch as u,on as g,initial as b}from"../../core/reactiveUtils.js";import{throttle as f}from"../../core/throttle.js";import{property as y}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as T}from"../../core/accessorSupport/decorators/subclass.js";import{getLowerCaseDefaultHiddenFields as w}from"../../layers/support/fieldUtils.js";import{isSubtypeSublayer as _,getSubtypesFromLayer as C,isSubtypeGroupLayer as I}from"../../layers/support/layerUtils.js";import{createFieldInfos as v}from"../../support/popupUtils.js";import E from"../../tables/AttributeTableTemplate.js";import A from"../../tables/support/FieldOrder.js";import{defaultHighlightName as j,temporaryHighlightName as S}from"../../views/support/HighlightDefaults.js";import{highlightsSupported as F}from"../../views/support/layerViewUtils.js";import{isSelectableLayer as R}from"../../views/support/selectionUtils.js";import x from"./ActionColumn.js";import U from"./AttachmentsColumn.js";import O from"./FieldColumn.js";import V from"./RelationshipColumn.js";import z from"./Grid/Column.js";import W from"./Grid/Grid.js";import P from"./Grid/GridViewModel.js";import H from"./Grid/GroupColumn.js";import L from"./support/AttachmentsColumnTemplate.js";import B from"./support/AttachmentsViewOptions.js";import{isAttachmentsColumn as Z,isFieldColumn as G,isRelationshipColumn as k}from"./support/columnUtils.js";import{downloadAttachmentInfo as N,exportToCSV as D}from"./support/exportUtils.js";import M from"./support/FeatureStore.js";import $ from"./support/FieldColumnTemplate.js";import q from"./support/RelationshipColumnTemplate.js";import Q from"./support/TableTemplate.js";import{isIFeatureTableSupportedLayerWithRelationships as K,findRelatedLayerInSources as J,findRelationship as X,uniqueColumnNames as Y,hasColumnForField as ee,findField as te,isIFeatureTableSupportedLayerWithAttachments as ie,getTableHighlightKey as se,getRelationshipIdsToShow as le}from"./support/tableUtils.js";import{createAttributeTableElements as oe}from"./support/templateUtils.js";import{goTo as ne}from"../support/goToUtils.js";import"../support/widgetUtils.js";import{messageBundle as re}from"../support/decorators/messageBundle.js";import"@arcgis/toolkit/dom";import{onLocaleChange as ae}from"../../intl/locale.js";import{substitute as he}from"../../intl/substitute.js";import{fetchMessageBundle as de}from"../../intl/messages.js";const me="80px";let ce=class extends P{constructor(e){super(e),this._currentTemporaryHighlight=null,this._highlights=new n,this._refreshDebounced=h(()=>this._refresh()),this._syncTemplateThrottled=f(()=>this._syncAttributeTableTemplate()),this._temporaryHighlightAbortController=null,this.attachmentsViewOptions=new B,this.attributeTableTemplate=null,this.autoRefreshEnabled=!0,this.columns=new i,this.dataProvider=async(e,t)=>{const{layer:i,store:s}=this;if(!t)return;if(!i||!s)return void(t&&t([]));await i.load();const{objectIds:l}=this;if(this.filterBySelectionEnabled&&!this.highlightIds.length||1===l.length&&-1===l.items[0])return void t([]);"loaded"!==s.state&&"loading"!==s.state&&await s.load();const o=this.paginationEnabled?this.pageIndex:e.page,n=await s.fetchItems({...e,page:o});t&&t(n)},this.grid=null,this.highlightEnabled=!0,this.layers=null,this.menuConfig=null,this.messages=null,this.messagesCommon=null,this.messagesUnits=null,this.messagesURIUtils=null,this.prompt=null,this.relatedTables=new i,this.relationshipColumnConfigs=null,this.selectionSource="table",this.showRelatedTableCallback=null,this.store=null,this.syncTemplateOnChangesEnabled=!0,this.tableController=null,this.tableParent=null,this.tableTemplate=null,this.tableTemplateOverride=null,this._onLayerRefresh=this._onLayerRefresh.bind(this),this._onShowPromptCallback=this._onShowPromptCallback.bind(this),this._set("store",new M),this._set("grid",new W({viewModel:this}))}initialize(){const e=async()=>{this.messages=await de("esri/widgets/FeatureTable/t9n/FeatureTable"),this.messagesCommon=await de("esri/t9n/common"),this.messagesUnits=await de("esri/core/t9n/Units"),this.messagesURIUtils=await de("esri/widgets/support/t9n/uriUtils")};e(),this.addHandles([ae(()=>{e(),this._generateColumns()}),u(()=>[this.messages,this.messagesCommon,this.messagesURIUtils],()=>{const e=this.messages;this.grid&&(this.grid.messages=e),this.allColumns.forEach(t=>{t.messages=e,t.messagesCommon=this.messagesCommon,t.messagesURIUtils=this.messagesURIUtils}),this.refreshCellContent()},b),g(()=>this.highlightIds,"change",e=>this._onHighlightIdsChange(e),{onListenerAdd:()=>this._syncSelection(),onListenerRemove:()=>this._highlights.removeAll()}),u(()=>this.grid?.temporaryHighlightId,e=>{this._temporaryHighlightAbortController?.abort(),this._temporaryHighlightAbortController=new AbortController,d(this._syncTemporaryHighlight(e,this._temporaryHighlightAbortController.signal))}),u(()=>this.attachmentsEnabled,()=>this.layer?.loaded&&this._generateColumns()),u(()=>this._viewSelection,()=>{this._viewSelectionReady&&(this.highlightIds.items=this._viewSelection)}),u(()=>[this._tableHighlightsReady,this._viewSelectionReady],()=>this._syncSelection()),u(()=>this.layer,async(e,t)=>{const i=this.grid;i&&(i.clearSort(),e&&t&&await this.reset()),this.goToPage(0),this._drainColumns(),this.store.layer=e,e&&(e.loaded?this._onLayerLoad():e.load().catch(()=>{})),t&&null!=this.attachmentsViewOptions.objectId&&(this.attachmentsViewOptions.objectId=null)}),u(()=>this.layer?.loaded,e=>e&&this._onLayerLoad()),u(()=>this.store.state,e=>{"loaded"===e&&(this.scrollToTop(),this.refreshCellContent())}),u(()=>this._effectiveTableTemplate,()=>{this.scrollLeft(),this.layer?.loaded&&this._generateColumns()}),u(()=>this.editingEnabled,e=>{this.editableColumns.forEach(t=>t.tableEditingEnabled=e),this.refreshCellContent()}),u(()=>this.timeZone??this.view?.timeZone,()=>this.refreshCellContent()),u(()=>this.store.effectiveWhere,()=>"loaded"===this.store.state&&this.reset()),u(()=>this.layer?.timeExtent,(e,t)=>(e||t)&&!this.timeExtent&&"loaded"===this.store.state&&this.reset()),g(()=>this.layer,"refresh",e=>this._onLayerRefresh(e)),g(()=>this.grid,["cell-click","cell-dblclick","cell-pointerover","cell-pointerout","cell-keydown","column-reorder"],({index:e,item:t,native:i,path:s,type:l})=>{const o=t?.feature,n=o?.getObjectId(),r="cell-keydown"===l&&i&&i instanceof KeyboardEvent&&"Enter"===i.key;this.emit(l,{feature:o,index:e,native:i,type:l,fieldName:s??void 0,objectId:n}),(r||"cell-click"===l)&&this._onCellInteraction(n)}),u(()=>this.actionColumnConfig,e=>{const{actionColumn:t,columns:i}=this;t?e?t.set(e):i.remove(t):e&&i.length&&i.add(this._generateActionColumn(),!1!==e.frozenToEnd?void 0:this._getIndexOfFirstFrozenToEndColumn())}),u(()=>this.relatedRecordsEnabled,()=>this.layer?.loaded&&this._generateColumns()),g(()=>this.objectIds,"change",()=>this._onObjectIdsChange(),{onListenerAdd:()=>this._onObjectIdsChange()}),u(()=>[this.paginationEnabled,this.pageIndex],()=>this.refreshPageCache()),u(()=>this.activeSortOrders,e=>{this.store.sortOrders=e,this._syncTemplateThrottled()}),u(()=>this.allVisibleColumns,()=>this._syncTemplateThrottled()),u(()=>this.pageCount,()=>{this.pageIndex>=this.pageCount&&this.goToPage(0)}),u(()=>this.state,e=>{"disabled"===e&&this.relatedTables.length&&this.drainRelatedTables()}),g(()=>this.tableParent?.highlightIds,"change",({added:e})=>{const{relationshipConfig:t}=this,i=e[0];if(null==i||!t)return;const{relatedLayer:s,relationshipId:l}=t;this.relationshipConfig={objectId:i,relatedLayer:s,relationshipId:l}}),g(()=>this.tableParent,"cell-click",e=>{const{tableParent:t}=this,{objectId:i}=e;t&&null!=i&&t.highlightIds.add(i)}),u(()=>this.attachmentsViewOptions.objectId,(e,t)=>{null!=e?null==t&&this.showAttachmentsView({objectId:e}):this.hideAttachmentsView()})])}destroy(){this._drainColumns(),this._highlights.removeAll(),this._highlights.destroy(),this._currentTemporaryHighlight?.handle.remove(),this._temporaryHighlightAbortController=a(this._temporaryHighlightAbortController),this.grid?.destroy(),this.columns.destroyed||this.columns.destroy(),this.layer=null,this.view=null}get _defaultHiddenFields(){return w(this.layer)}get _effectiveTableTemplate(){return this.tableTemplateOverride||this.tableTemplate}get _effectiveAttributeTableTemplate(){return this.attributeTableTemplate||this.layer?.attributeTableTemplate}get _highlightableLayerView(){const e=this.layerView;return F(e)?e:null}get _selectionManager(){const{view:e}=this;return!e||e.destroyed?null:e.selectionManager?.sources?.length?e.selectionManager:null}get _selectableLayer(){const{layer:e}=this;if(R(e)||_(e)){const t=e;return this._selectionManager?.sources?.includes(t)?t:null}return null}get _subtypes(){return C(this.layer)}get _tableHighlightsReady(){return!("table"!==this.selectionSource||!this.highlightEnabled||!this._highlightableLayerView)}get _viewSelection(){const{_selectableLayer:e}=this;return e?this._selectionManager?.getSelection(e)??[]:[]}get _viewSelectionReady(){return!(!this.layer||"view"!==this.selectionSource||!this._selectionManager)}get actionColumn(){return super.actionColumn}get activeFilters(){const{filterGeometry:e,objectIds:t,filterBySelectionEnabled:s,highlightIds:l}=this,o=new i;return e&&o.push({type:"geometry",geometry:e}),s?o.push({type:"selection",objectIds:l.toArray()}):t.length&&o.push({type:"objectId",objectIds:t.toArray()}),o}get activeSortOrders(){return this.grid?.sortOrders?this.grid.sortOrders.map(({path:e,direction:t})=>({fieldName:e,direction:t})).filter(e=>e.fieldName&&e.direction):[]}get allColumns(){return super.allColumns}get allRelatedTablesVisible(){return!!(this.relatedRecordsEnabled&&this.relatedTables.length&&this.showAllRelatedTables)}get allVisibleColumns(){return super.allVisibleColumns}get attachmentsColumns(){return this.allColumns.filter(e=>Z(e))}get attachmentsEnabled(){return this.store.attachmentsEnabled}set attachmentsEnabled(e){this.store.attachmentsEnabled=e}get clearPrompt(){return()=>this.prompt=null}set clearPrompt(e){this._overrideIfSome("clearPrompt",e)}get definitionExpression(){return this.store.where}set definitionExpression(e){this.store.where=e}get effectiveSize(){return super.effectiveSize}get fieldColumns(){return this.allColumns.filter(e=>G(e))}get filterGeometry(){return this.store.filterGeometry}set filterGeometry(e){this.store.filterGeometry=e}get filterBySelectionEnabled(){return!!this._get("filterBySelectionEnabled")}set filterBySelectionEnabled(e){const{objectIds:t}=this,i=t.length;e?(i&&(t.removeAll(),this._logWarning("Selection filter has been applied with an objectID filter. Object ID filter has been removed.")),this.filterGeometry&&this._logWarning("Selection filter has been applied with a geometry filter. Results may appear inconsistent"),this._syncObjectIdsWithStore(this.highlightIds.toArray())):i||this._syncObjectIdsWithStore(null),this._set("filterBySelectionEnabled",e)}get groupColumns(){return super.groupColumns}get hiddenFields(){return this._get("hiddenFields")??new i}set hiddenFields(e){this._set("hiddenFields",s(e,this._get("hiddenFields"),i))}get highlightIds(){return super.highlightIds}set highlightIds(e){super.highlightIds=e}get initialSize(){return this.store.initialSize}set initialSize(e){this.store.initialSize=e}get isEditing(){return super.isEditing}get isQuerying(){return super.isQuerying}get isSyncing(){return super.isSyncing}get isQueryingOrSyncing(){return this.isQuerying||this.isSyncing||this.relatedTables.some(e=>!!e.isQueryingOrSyncing)}get isSyncingAttachments(){return this.store.isSyncingAttachmentEdits||this.relatedTables.some(e=>!!e.isSyncingAttachments)}get layer(){return this._get("layer")}set layer(e){this._highlights.removeAll(),this.drainRelatedTables(),this._set("layer",e)}get layerView(){return this.store.layerView}get objectIds(){return super.objectIds}set objectIds(e){super.objectIds=e}get outFields(){return this.store.outFields}set outFields(e){this.store.outFields=e}get pageCount(){return super.pageCount}get pageIndex(){return super.pageIndex}set pageIndex(e){super.pageIndex=e}get pageSize(){return super.pageSize}set pageSize(e){super.pageSize=e}get relatedRecordsEnabled(){return this.store.relatedRecordsEnabled}set relatedRecordsEnabled(e){this.store.relatedRecordsEnabled=e}get relatedTable(){return this.relatedTables.at(-1)}get relationship(){const e=this.relationshipConfig?.relationshipId;return null==e?null:this.relationships?.find(({id:t})=>t===e)}get relationshipColumns(){return this.allColumns.filter(e=>k(e))}get relationshipConfig(){return this.store.relationshipConfig}set relationshipConfig(e){this.highlightIds.removeAll(),this.objectIds.removeAll(),this.filterBySelectionEnabled=!1,this.store.relationshipConfig=e}get relationshipInfos(){const{layer:e,layers:t,relationships:i,tableController:s}=this,l=this.store.relationshipInfos;if(l.length||!K(e)||!i?.length)return l;const o=[],n=s?.layers||t||[];return i.forEach(t=>{const i=J(e,n,t);i&&(i.load(),o.push({layer:e,relatedLayer:i,relationshipId:t.id}))}),o}get relationships(){return this.store.relationships}get returnGeometryEnabled(){return this.store.returnGeometry}set returnGeometryEnabled(e){this.store.returnGeometry=e}get returnMEnabled(){return this.store.returnM}set returnMEnabled(e){this.store.returnM=e}get returnZEnabled(){return this.store.returnZ}set returnZEnabled(e){this.store.returnZ=e}get rowHighlightIds(){return super.rowHighlightIds}set rowHighlightIds(e){super.rowHighlightIds=e}get showAllRelatedTables(){return this._get("showAllRelatedTables")}set showAllRelatedTables(e){const{relatedTable:t}=this;this._set("showAllRelatedTables",e),t&&(e?this._showAllRelatedTables(t):this._hideAllRelatedTables(t))}get showPrompt(){return e=>{this.prompt?.cancel?.(),this.prompt=e}}set showPrompt(e){this._overrideIfSome("showPrompt",e)}get size(){return super.size}get state(){return super.state}get supportsAttachments(){return this.store.supportsAttachments}get supportsAddAttachments(){const{store:{supportsAddAttachments:e,supportsEditing:t}}=this;return this.editingEnabled&&t&&e}get supportsDeleteAttachments(){return this.supportsUpdateAttachments}get supportsResizeAttachments(){return this.store.supportsResizeAttachments}get supportsUpdateAttachments(){const{store:{supportsUpdateAttachments:e,supportsEditing:t}}=this;return this.editingEnabled&&t&&e}get timeExtent(){return this.store.timeExtent}set timeExtent(e){this.store.timeExtent=e}get timeZone(){return this._get("timeZone")}set timeZone(e){this.allColumns.forEach(t=>t.tableTimeZone=e),this._set("timeZone",e)}get view(){return this.store.view}set view(e){this.store.view=e,this.fieldColumns.forEach(t=>t.view=e),this.refreshCellContent()}get visibleColumns(){return super.visibleColumns}async addAttachment(e,t){const{attachmentsViewOptions:i,store:s}=this,l=i.objectId===e;await s.addAttachment(e,t).catch(e=>{l&&e&&"object"==typeof e&&"error"in e&&e.error instanceof o&&(this._logWarning(`Unable to add attachment. ${e.error.name} ${e.error.message}`),i.error=e.error)}),l&&!i.error&&(i.onEditComplete(),i.attachmentInfos=await s.getAttachmentsByObjectId(e,!0)),this.refreshCellContent()}async deleteAttachments(e,t){const{attachmentsViewOptions:i,store:s}=this,l=i.objectId===e;await s.deleteAttachments(e,t).catch(e=>{l&&e&&"object"==typeof e&&"error"in e&&e.error instanceof o&&(this._logWarning(`Unable to delete attachment(s). ${e.error.name} ${e.error.message}`),i.error=e.error)}),l&&!i.error&&(i.onEditComplete(),i.attachmentInfos=await s.getAttachmentsByObjectId(e,!0)),this.refreshCellContent()}collapseRelatedTable(e,t){const{relatedLayer:s,objectId:l,relationshipId:o}=t,{objectIdField:n}=s,r=X(s,o),a=s.displayField||r?.keyField||n;e.set({highlightIds:new i([l]),multipleSelectionEnabled:!1,tableTemplateOverride:this._getTableTemplateForRelatedTableView(e,a,o)});const h=e.hiddenFields;h.includes(Y.action)||h.add(Y.action),h.includes(Y.attachments)||h.add(Y.attachments),e.scrollLeft()}async deleteSelection(){const e=this.highlightIds.toArray();if(!e?.length)return;const{deleteFeatureResults:t}=await this.store.deleteRowsByObjectId(e),i=t.filter(e=>!e.error).map(e=>e.objectId);i.length&&(this.highlightIds.removeMany(i),await this.refresh())}async downloadAttachmentById(e,t){const i=(await this.store.getAttachmentsByObjectId(e,!0)).find(e=>e.id===t);await N(i)}drainRelatedTables(){this.relatedTables.drain(e=>e.destroy()),this.set({multipleSelectionEnabled:!0,relationshipColumnConfigs:null,showAllRelatedTables:!1,tableTemplateOverride:null}),this.hiddenFields.removeMany([Y.action,Y.attachments])}drainRelatedTablesAboveIndex(e){const{relatedTables:t}=this,i=t.slice(e+1);t.removeMany(i).forEach(e=>e.destroy());const s=t.at(-1);s&&(s.attachmentsViewOptions.objectId=null,this.allRelatedTablesVisible?this._showAllRelatedTables(s):this._hideAllRelatedTables(s))}async exportSelectionToCSV(e){const{highlightIds:t,layer:i,outFields:s}=this;i&&t.length?await D({layer:i,objectIds:t.toArray(),outFields:s,includeGeometry:e}):this._logWarning("Export failed.")}filterBySelection(){this.filterBySelectionEnabled?this._logWarning("Property 'filterBySelectionEnabled' is already 'true'. This method has no effect."):(l(r.getLogger(this),"`FeatureTable.filterBySelection` is deprecated in favor of 'filterBySelectionEnabled' and 'objectIds'",{replacement:"FeatureTable.filterBySelectionEnabled or FeatureTable.objectIds",version:"4.30",warnOnce:!0}),this.objectIds.addMany(this.highlightIds.toArray()))}getObjectIdIndex(e){return this.store.getItemIndexByObjectId(e)}getValue(e,t){const i=this.store.getItemByObjectId(e);return i?.feature?.attributes[t]}getVirtualPageIndex(){return this.grid?.getVirtualPageIndex()??0}goToPage(e){if(null==e||!Number.isInteger(e))return void this._logWarning("Invalid 'page' parameter provided to 'goToPage()'. Current page will remain the same.");const{pageCount:t}=this;(e>=t||-1===e)&&(e=t-1),e<-1&&(e=0),e!==this.pageIndex&&(this.pageIndex=e),this.paginationEnabled||this.scrollToIndex(e*this.pageSize)}hideAttachmentsView(){this.attachmentsViewOptions.objectId=null,this.set({relationshipColumnConfigs:null,multipleSelectionEnabled:!0,tableTemplateOverride:null}),this.hiddenFields.remove(Y.action)}nextPage(){const e=this.paginationEnabled?this.pageIndex:this.getVirtualPageIndex();this.goToPage(e+1)}previousPage(){const e=this.paginationEnabled?this.pageIndex:this.getVirtualPageIndex();this.goToPage(e-1)}async refresh(){await Promise.all([...this.relatedTables.map(e=>e.refresh()),d(this._refreshDebounced())])}refreshCellContent(){this.grid?.requestContentUpdate()}refreshPageCache(){this.grid?.refreshPageCache()}async reset(){this.goToPage(0),await(this.grid?.reset())}scrollLeft(){this.grid?.scrollLeft(0)}scrollToBottom(){this.grid?.scrollToBottom()}scrollToIndex(e){this.grid?.scrollToIndex(e)}scrollToRow(e){const t=this.store.getItemIndexByObjectId(e);t>-1?this.grid?.scrollToIndex(t):this._logWarning("Row not found. Associated data may not be loaded yet.")}scrollToTop(){this.grid?.scrollToTop()}async saveAttachmentsViewForm(){const{attachmentId:e,form:t,objectId:i}=this.attachmentsViewOptions;null!=i&&t&&(null!=e?await this.updateAttachment(i,e,t):await this.addAttachment(i,t))}async showAttachmentsView({objectId:e}){const{attachmentsViewOptions:t,hiddenFields:s,layer:l}=this;if(!this.attachmentsEnabled||!l)return void this._logWarning("The 'attachmentsEnabled' property is currently false.");await l.load();const o=this._getDefaultLayerDisplayField(l),n=await this.store.getAttachmentsByObjectId(e,!0),r=this.store.getItemIndexByObjectId(e);t.set({attachmentInfos:n,mode:n.length?"list":"file",objectId:e}),this.set({highlightIds:new i([e]),multipleSelectionEnabled:!1,relationshipColumnConfigs:[],tableTemplateOverride:this._getTableTemplateForAttachmentsView(o)}),s.includes(Y.action)||s.add(Y.action),null!=r&&this.scrollToIndex(r)}syncAttributeTableTemplate(){this._syncAttributeTableTemplate(!0)}clearSelectionFilter(){l(r.getLogger(this),"`FeatureTable.clearSelectionFilter` is deprecated in favor of 'filterBySelectionEnabled' and 'objectIds'",{replacement:"FeatureTable.filterBySelectionEnabled or FeatureTable.objectIds",version:"4.30",warnOnce:!0}),this.objectIds.removeAll()}async updateAttachment(e,t,i){const{attachmentsViewOptions:s,store:l}=this,n=s.objectId===e;await l.updateAttachment(e,t,i).catch(e=>{n&&e&&"object"==typeof e&&"error"in e&&e.error instanceof o&&(this._logWarning(`Unable to update attachment. ${e.error.name} ${e.error.message}`),s.error=e.error)}),n&&!s.error&&(s.onEditComplete(),s.attachmentInfos=await l.getAttachmentsByObjectId(e,!0)),this.refreshCellContent()}async zoomToSelection(){const{layer:e,view:t}=this,i=this.highlightIds.toArray();if(!e||!t||!i.length)return;const s=e.createQuery();s.objectIds=i,s.returnGeometry=!0;const l=await e.queryFeatures(s);try{await ne(t,l.features)}catch(o){"AbortError"!==o.name&&console.error(o)}}_syncAttributeTableTemplate(e=!1){const{_effectiveAttributeTableTemplate:t,layer:i,tableTemplateOverride:s,syncTemplateOnChangesEnabled:l}=this;if(!i||!t||!l&&!e||s||this.tableParent||this.relatedTable||null!==this.attachmentsViewOptions.objectId)return;const{activeSortOrders:o,allColumns:n,columns:r}=this,a=[],h=oe(r.toArray());o.forEach(({fieldName:e,direction:t})=>{e&&t&&a.push(new A({field:e,order:t}))}),n.forEach(({fieldName:e,direction:t})=>{t&&!a.some(t=>t.field===e)&&a.push(new A({field:e,order:t}))}),t.elements=h,t.orderByFields=a}async _refresh(){await this.store.refresh();const e=this.highlightIds.toArray();if(e.length){(await this.store.verifyFeaturesByObjectId(e)).forEach((t,i)=>{t||this.highlightIds.remove(e[i])})}this.refreshPageCache();const t=this.attachmentsViewOptions;null!=t?.objectId&&(t.attachmentInfos=await this.store.getAttachmentsByObjectId(t.objectId,!0))}async _onLayerLoad(){const{layer:e,pageSize:t}=this;if(!e)return;e.parent&&I(e.parent)&&await e.parent.loadAll();const i=e.capabilities.query?.maxRecordCount,s=i&&i<t,l=s?i:t;s&&(this._logWarning("The value for 'pageSize' has been adjusted due to the provided layer's max record count."),this.pageSize=l),this.grid?.set("pageSize",l),this.store.load(),this._generateColumns()}_onLayerRefresh(e){this.autoRefreshEnabled&&e.dataChanged&&this.refresh()}_generateColumns(){this._drainColumns();const{_effectiveTableTemplate:e,_effectiveAttributeTableTemplate:t}=this,i=e?.columnTemplates,s=this._generateColumnsFromColumnTemplates(i)??this._generateColumnsFromAttributeTableTemplate(t)??this._generateDefaultFieldColumns();s.length&&(this.attachmentsEnabled&&!s.some(e=>Z(e))&&s.push(this._generateDefaultAttachmentsColumn()),this.relatedRecordsEnabled&&this.relationshipInfos.length&&!s.some(e=>k(e))&&s.push(...this._generateDefaultRelationshipColumns()),this.actionColumnConfig&&s.push(this._generateActionColumn()),s.sort((e,t)=>e.frozen&&t.frozen||e.frozenToEnd&&t.frozenToEnd?0:e.frozen||t.frozenToEnd?-1:0),this.columns.addMany(s))}_generateColumnsFromAttributeTableTemplate(e){const{layer:i}=this;if(!e||!i)return null;const{elements:s,orderByFields:l}=e,o=v(i),n=[];n.push(...this._generateColumnsFromAttributeTableElements(s,l));const r=o.map(e=>{if(!e.fieldName||ee(e.fieldName,n))return null;const{fieldName:t}=e,s=te(i,t);return s?this._generateDefaultFieldColumn(s,{hidden:!0,orderByFields:l}):(this._logTemplateWarning("A valid 'field' could not be found for the provided template."),null)}).filter(t);return n.push(...r),this.attachmentsEnabled&&ie(i)&&!n.some(e=>Z(e))&&n.push(this._generateDefaultAttachmentsColumn({hidden:!0})),this.relatedRecordsEnabled&&K(i)&&i.relationships?.forEach(({id:e},t)=>{const i=this.relationshipInfos.find(t=>t.relationshipId===e);i&&!n.some(t=>k(t)&&t.relationshipId===e)&&n.push(this._generateDefaultRelationshipColumn({hidden:!0,info:i,index:t}))}),n.length?n:null}_generateColumnsFromAttributeTableElements(e,t){const{layer:i}=this;return i?e?.map((e,i)=>{switch(e.type){case"field":return this._createFieldColumnFromElement({element:e,orderByFields:t});case"group":return this._createGroupColumnFromElement({element:e,orderByFields:t});case"attachment":return this._createAttachmentColumnFromElement({element:e,index:i});case"relationship":return this._createRelationshipColumnFromElement({element:e,index:i})}}).filter(e=>!!e)??[]:[]}_createFieldColumnFromElement(e){const{layer:t}=this;if(!t)return null;const{element:i,orderByFields:s}=e,{fieldName:l}=i;if(null==l)return this._logTemplateWarning("A valid 'fieldName' must be provided."),null;const o=te(t,l);if(!o)return this._logTemplateWarning("A valid 'field' could not be found for the provided template."),null;const{description:n,label:r}=i,a=s?.findIndex(({field:e})=>e&&e===l)??-1,h=a>-1?s?.at(a)?.order:void 0,d=a>-1?a:void 0,{editingEnabled:m,grid:c,messages:p,messagesCommon:u,messagesURIUtils:g,store:b,timeZone:f,view:y}=this;return new O({description:n,direction:h,field:o,fieldName:l,grid:c,initialSortPriority:d,label:r,layer:t,messages:p,messagesCommon:u,messagesURIUtils:g,store:b,tableEditingEnabled:m,tableTimeZone:f,view:y,onShowPromptCallback:this._onShowPromptCallback})}_createGroupColumnFromElement(e){const{element:t,orderByFields:i}=e,{description:s,label:l}=t;if(!l)return this._logTemplateWarning("Group columns require a label."),null;if(!t.elements.length)return this._logTemplateWarning("Group columns require child columns."),null;const{grid:o,messages:n,messagesCommon:r,messagesURIUtils:a,store:h,timeZone:d}=this;return new H({columns:this._generateColumnsFromAttributeTableElements(t.elements,i),description:s,grid:o,label:l,messages:n,messagesCommon:r,messagesURIUtils:a,store:h,tableTimeZone:d})}_createAttachmentColumnFromElement(e){if(!this.attachmentsEnabled)return void this._logTemplateWarning("The 'attachmentsEnabled' property is currently false.");const{element:t,index:i}=e,{description:s,label:l}=t,{grid:o,layer:n,messages:r,messagesCommon:a,messagesURIUtils:h,store:d,timeZone:m}=this;return new U({description:s,fieldName:`${Y.attachments}-${i}`,grid:o,label:l,layer:n,messages:r,messagesCommon:a,messagesURIUtils:h,store:d,tableTimeZone:m,onShowAttachments:e=>this._onShowAttachments(e)})}_createRelationshipColumnFromElement(e){if(!this.relatedRecordsEnabled)return void this._logTemplateWarning("Relationship columns require related records to be enabled on the table.");const{element:t,index:i}=e,{description:s,label:l,relationshipId:o}=t,n=this.relationshipInfos.find(e=>e.relationshipId===o);if(!n)return this._logTemplateWarning("Unable to find valid related layer target based on the provided relationship id."),null;const{grid:r,messages:a,messagesCommon:h,messagesURIUtils:d,store:m,timeZone:c}=this;return new V({description:s,fieldName:`${Y.relationship}-${o}-${i}`,grid:r,label:l,messages:a,messagesCommon:h,messagesURIUtils:d,relationshipId:o,store:m,tableTimeZone:c,layer:n.relatedLayer,relatedLayer:n.layer,showRelatedTableCallback:e=>this._onShowRelatedTable(e)})}_generateColumnsFromColumnTemplates(e){const{editingEnabled:t,grid:i,layer:s,messages:l,messagesCommon:o,messagesURIUtils:n,store:r,timeZone:a,view:h}=this;if(!e?.length||!s)return null;const d=[];return e.forEach((e,m)=>{const{autoWidth:c,description:p,direction:u,flexGrow:g,fieldName:b,formatFunction:f,frozen:y,frozenToEnd:T,icon:w,iconText:_,initialSortPriority:C,invalid:I,label:v,labelTooltipText:E,menuConfig:A,resizable:j,sortable:S,textAlign:F,textWrap:R,timeZone:x,type:U,width:V}=e;if(!U)return void this._logTemplateWarning("Property 'type' is missing from the provided template.");if(y&&T)return void this._logTemplateWarning("Properties 'frozen' and 'frozenToEnd' cannot both be true for the same column.");const W=!1===e.visible;if("group"===U){if(!e.columnTemplates?.length)return void this._logTemplateWarning("Group columns must contain column templates.");if(!e.label)return void this._logTemplateWarning("Group columns require a label.");const t=this._generateColumnsFromColumnTemplates(e.columnTemplates),s=W||this._isFieldHidden(e.label);d.push(new H({autoWidth:c,columns:t,description:p,flexGrow:g,frozen:y,frozenToEnd:T,grid:i,hidden:s,icon:w,iconText:_,invalid:I,label:v,labelTooltipText:E,menuConfig:A,messages:l,messagesCommon:o,messagesURIUtils:n,resizable:j,tableTimeZone:a,textAlign:F,textWrap:R,timeZone:x,width:V}))}else if("attachment"===U){if(!this.attachmentsEnabled)return void this._logTemplateWarning("Attachment columns require attachments to be enabled on the table.");d.push(this._generateAttachmentsColumnFromTemplate(e,m))}else if("relationship"===U){if(!this.relatedRecordsEnabled)return void this._logTemplateWarning("Relationship columns require related records to be enabled on the table.");const{relationshipId:t}=e;if(null==t)return void this._logTemplateWarning("Property 'relationshipId' is missing from the provided template.");const i=this.relationshipInfos.find(e=>e.relationshipId===t);if(!i)return void this._logTemplateWarning("Unable to find valid related layer target based on the provided relationship id.");d.push(this._generateRelationshipColumnFromTemplate(i,e,m))}else if(!b)return void this._logTemplateWarning("Value for 'fieldName' property was missing from the provided template.");const P=W||this._isFieldHidden(b);if("column"===U)d.push(new z({autoWidth:c,description:p,direction:u,fieldName:b,flexGrow:g,formatFunction:f,frozen:y,frozenToEnd:T,grid:i,hidden:P,icon:w,iconText:_,initialSortPriority:C,invalid:I,label:v,labelTooltipText:E,menuConfig:A,messages:l,messagesCommon:o,messagesURIUtils:n,resizable:j,sortable:S,tableTimeZone:a,textAlign:F,textWrap:R,timeZone:x,width:V}));else if("field"===U){const m=te(s,e.fieldName);if(!m)return void this._logTemplateWarning("A valid 'field' could not be found for the provided template.");const{editable:b,required:U}=e;d.push(new O({autoWidth:c,description:p,direction:u,editable:b,field:m,fieldName:m.name,flexGrow:g,formatFunction:f,frozen:y,frozenToEnd:T,grid:i,hidden:P,icon:w,iconText:_,initialSortPriority:C,invalid:I,label:v,labelTooltipText:E,layer:s,messages:l,messagesCommon:o,messagesURIUtils:n,menuConfig:A,required:U,resizable:j,sortable:S,store:r,tableEditingEnabled:t,tableTimeZone:a,template:e,textAlign:F,textWrap:R,timeZone:x,width:V,view:h,onShowPromptCallback:this._onShowPromptCallback}))}}),d.length?d:null}_generateDefaultFieldColumns(){return this.layer?.fields?.map(e=>this._generateDefaultFieldColumn(e)).filter(t)??[]}_generateDefaultFieldColumn(e,t){const{editingEnabled:i,grid:s,layer:l,messages:o,messagesCommon:n,messagesURIUtils:r,store:a,timeZone:h,view:d}=this,m=t?.orderByFields;if(!e.visible||"geometry"===e.type)return null;const c=e.name,p=m?.findIndex(({field:e})=>e&&e===c)??-1,u=p>-1?m?.at(p)?.order:void 0,g=p>-1?p:void 0;return new O({direction:u,field:e,fieldName:c,grid:s,hidden:t?.hidden||this._isFieldHidden(c),initialSortPriority:g,layer:l,messages:o,messagesCommon:n,messagesURIUtils:r,store:a,tableEditingEnabled:i,tableTimeZone:h,view:d,onShowPromptCallback:this._onShowPromptCallback})}_generateAttachmentsColumnFromTemplate(e,t){const{grid:i,layer:s,messages:l,messagesCommon:o,messagesURIUtils:n,store:r,timeZone:a}=this,{attachmentsViewEnabled:h,autoWidth:d,description:m,flexGrow:c,fieldName:p,formatFunction:u,frozen:g,frozenToEnd:b,icon:f,iconText:y,invalid:T,label:w,labelTooltipText:_,menuConfig:C,resizable:I,textAlign:v,textWrap:E,thumbnailAppearance:A,thumbnailCount:j,thumbnailIconScale:S,thumbnailsEnabled:F,timeZone:R,width:x}=e;return new U({attachmentsViewEnabled:h,autoWidth:d,description:m,fieldName:`${Y.attachments}-${t}`,flexGrow:c,formatFunction:u,frozen:g,frozenToEnd:b,grid:i,hidden:!1===e.visible||this._isFieldHidden(w)||this._isFieldHidden(p),icon:f,iconText:y,invalid:T,label:w,labelTooltipText:_,layer:s,menuConfig:C,messages:l,messagesCommon:o,messagesURIUtils:n,resizable:I,store:r,tableTimeZone:a,textAlign:v,textWrap:E,thumbnailAppearance:A,thumbnailCount:j,thumbnailIconScale:S,thumbnailsEnabled:F,timeZone:R,width:x,onShowAttachments:e=>this._onShowAttachments(e)})}_generateDefaultAttachmentsColumn(e){const{grid:t,layer:i,messages:s,messagesCommon:l,messagesURIUtils:o,store:n,timeZone:r}=this,a=Y.attachments;return new U({fieldName:a,grid:t,hidden:e?.hidden||this._isFieldHidden(a),layer:i,messages:s,messagesCommon:l,messagesURIUtils:o,store:n,tableTimeZone:r,onShowAttachments:e=>this._onShowAttachments(e)})}_generateRelationshipColumnFromTemplate(e,t,i){const{grid:s,messages:l,messagesCommon:o,messagesURIUtils:n,store:r,timeZone:a}=this,{autoWidth:h,collapsed:d,description:m,flexGrow:c,fieldName:p,formatFunction:u,frozen:g,frozenToEnd:b,icon:f,iconText:y,invalid:T,label:w,labelTooltipText:_,menuConfig:C,relationshipId:I,resizable:v,textAlign:E,textWrap:A,timeZone:j,width:S}=t;return new V({autoWidth:h,collapsed:d,description:m,fieldName:`${Y.relationship}-${I}-${i}`,flexGrow:c,formatFunction:u,frozen:g,frozenToEnd:b,grid:s,hidden:!1===t.visible||this._isFieldHidden(w)||this._isFieldHidden(p),icon:f,iconText:y,invalid:T,label:w,labelTooltipText:_,menuConfig:C,messages:l,messagesCommon:o,messagesURIUtils:n,relationshipId:I,resizable:v,store:r,tableTimeZone:a,textAlign:E,textWrap:A,timeZone:j,width:S,layer:e.relatedLayer,relatedLayer:e.layer,showRelatedTableCallback:e=>this._onShowRelatedTable(e)})}_generateDefaultRelationshipColumns(){const{relationshipInfos:e,relationshipColumnConfigs:t}=this,i=[];return e?.length?(t?t.forEach((t,s)=>{const{relationshipId:l}=t,o=e.find(e=>e.relationshipId===l);o&&i.push(this._generateDefaultRelationshipColumn({config:t,index:s,info:o}))}):e.forEach((e,t)=>i.push(this._generateDefaultRelationshipColumn({index:t,info:e}))),i):i}_generateDefaultRelationshipColumn(e){const{config:t,hidden:i,index:s,info:l}=e,{grid:o,messages:n,messagesCommon:r,messagesURIUtils:a}=this,{relationshipId:h}=l;return new V({...t,fieldName:`${Y.relationship}-${h}-${s}`,grid:o,hidden:i,messages:n,messagesCommon:r,messagesURIUtils:a,layer:l.relatedLayer,relatedLayer:l.layer,relationshipId:h,showRelatedTableCallback:e=>this._onShowRelatedTable(e)})}_generateActionColumn(){return new x({hidden:this._isFieldHidden(Y.action),...this.actionColumnConfig})}_isFieldHidden(e){const t=e?.toLowerCase();return(this.hiddenFields??this._defaultHiddenFields).some(e=>e.toLowerCase()===t)}_addTableHighlight(e){if(!this.highlightEnabled)return;const{_highlightableLayerView:t,layer:i}=this;if(t&&i){const s=this.store.getItemByObjectId(e),l=s?.feature??e;this._highlights.add(t.highlight(l,{name:j}),se(i,e))}}_removeTableHighlight(e){const{layer:t}=this;t&&this._highlights.remove(se(t,e))}async _syncTemporaryHighlight(e,t){if(!this.highlightEnabled)return this._currentTemporaryHighlight?.handle.remove(),void(this._currentTemporaryHighlight=null);if(await m(25),c(t),!this._currentTemporaryHighlight&&!e)return;const{id:i}=this._currentTemporaryHighlight??{};if(i===e)return;this._currentTemporaryHighlight?.handle?.remove(),this._currentTemporaryHighlight=null;const{_highlightableLayerView:s,layer:l,highlightEnabled:o}=this;e&&s&&l&&o&&(this._currentTemporaryHighlight={id:e,handle:s.highlight(e,{name:S})})}_syncSelection(){this._highlights.removeAll(),this._tableHighlightsReady?this.highlightIds.forEach(e=>this._addTableHighlight(e)):this._viewSelectionReady&&(this.highlightIds.items=this._viewSelection)}_appendToViewSelection(e){const{_selectableLayer:t}=this;t&&this._selectionManager?.appendToSelection(t,e)}_removeFromViewSelection(e){const{_selectableLayer:t}=this;t&&this._selectionManager?.removeFromSelection(t,e)}async _onHighlightIdsChange(e){const{added:t,removed:i}=e,{attachmentsViewOptions:s}=this;if(this._tableHighlightsReady?(i.forEach(e=>this._removeTableHighlight(e)),t.forEach(e=>this._addTableHighlight(e))):this._viewSelectionReady&&(this._removeFromViewSelection(i),this._appendToViewSelection(t)),this.filterBySelectionEnabled&&this._syncObjectIdsWithStore(this.highlightIds.toArray()),null!=s.objectId){const e=this.highlightIds.at(0);if(null!=e){const t=await this.store.getAttachmentsByObjectId(e,!0);s.set({attachmentInfos:t,objectId:e,mode:t.length?"list":"file"})}}}_onShowRelatedTable(e){const{highlightIds:t}=this,{objectId:i}=e;t.removeAll(),t.add(i),this.showRelatedTableCallback?this.showRelatedTableCallback(e):this.emit("show-related-table",e)}_onObjectIdsChange(){const e=this.objectIds.toArray();e.length&&this.filterBySelectionEnabled&&(this.filterBySelectionEnabled=!1,this._logWarning("Object ID filter was applied while a selection filter was applied. Selection filter has been removed.")),this._syncObjectIdsWithStore(e)}_syncObjectIdsWithStore(e){this.store.objectIds=e,this.refreshPageCache()}_drainColumns(){this.columns.drain(e=>!e.destroyed&&e.destroy())}_showAllRelatedTables(e){const t=e.layer;if(!t)return;const i=this._getDefaultLayerDisplayField(t);e.set({relationshipColumnConfigs:[],tableTemplateOverride:this._getTableTemplateForShowAllTablesView(e,i)});const s=e.hiddenFields;s.includes(Y.action)||s.add(Y.action),s.includes(Y.attachments)||s.add(Y.attachments)}_hideAllRelatedTables(e){const{layer:t,relationship:i}=e;if(t&&null!=i?.id)if(null!=e.attachmentsViewOptions.objectId){const i=this._getDefaultLayerDisplayField(t);e.set({multipleSelectionEnabled:!1,relationshipColumnConfigs:[],showAllRelatedTables:!1,tableTemplateOverride:this._getTableTemplateForAttachmentsView(i)})}else e.set({multipleSelectionEnabled:!0,relationshipColumnConfigs:le(t,i.id),showAllRelatedTables:!1,tableTemplateOverride:null}),e.hiddenFields.removeMany([Y.action,Y.attachments])}_getTableTemplateForRelatedTableView(e,t,i){return new Q({columnTemplates:[new $({fieldName:t,editable:!1,menuConfig:{selectionMode:"single",icon:"chevron-down",items:this._extractFieldColumnInfosFromTableTemplate(e.viewModel).map(([s,l])=>({selected:s===t,label:l||s,clickFunction:()=>{e.tableTemplateOverride=this._getTableTemplateForRelatedTableView(e,s,i)}}))},resizable:!1}),new q({autoWidth:!1,collapsed:!0,flexGrow:0,label:"",resizable:!1,relationshipId:i,width:me})]})}_getTableTemplateForShowAllTablesView(e,t){const i=[new $({fieldName:t,editable:!1,menuConfig:{selectionMode:"single",icon:"chevron-down",items:this._extractFieldColumnInfosFromTableTemplate(e.viewModel).map(([i,s])=>({selected:i===t,label:s||i,clickFunction:()=>{e.tableTemplateOverride=this._getTableTemplateForShowAllTablesView(e,i)}}))},resizable:!1})];return null!=e.attachmentsViewOptions.objectId&&i.push(new L({attachmentsViewEnabled:!1,autoWidth:!1,flexGrow:0,label:"",resizable:!1,thumbnailsEnabled:!1,width:me})),new Q({columnTemplates:i})}async _onShowPromptCallback(e){const{column:t,objectId:i,oldValue:s,value:l}=e,{_subtypes:o,layer:n}=this;if(!n||!o.length)return void t.cancel();const r=o.find(e=>e.code===l);if(!r)return void t.cancel();const a=p(),h=this._createSubtypeEditPrompt(s,r,a),d=!!n.parent;try{this.showPrompt(h);const e=await a.promise,s=[{fieldName:t.fieldName,value:l}];switch(e){case"update-fields":for(const[e,t]of Object.entries(r.defaultValues))null!=t&&s.push({fieldName:e,value:t});await t.updateItems({objectId:i,updates:s}),d&&this.refresh();break;case"keep-existing":await t.updateItems({objectId:i,updates:s}),d&&this.refresh();break;case"undo":t.cancel()}}finally{this.clearPrompt()}}_createSubtypeEditPrompt(e,t,i){const{_subtypes:s,messages:l,messagesCommon:o}=this,n=s.find(t=>t.code===e)?.name??`${e}`;let r="update-fields";const a=[{label:l.subtypes.useDefaultValuesOption,value:"update-fields"},{label:l.subtypes.keepCurrentValuesOption,value:"keep-existing"}];return{context:"info",title:l.subtypes.changeWarningTitle,message:he(l.subtypes.changeWarning,{originalType:n,newType:t.name}),radios:a,defaultRadioSelection:"update-fields",onRadioSelection:e=>{r=e},actions:{primary:{label:o.apply,action:()=>i.resolve(r),type:"positive"},secondary:{label:o.cancel,type:"neutral",action:()=>i.resolve("undo")}},cancel:()=>i.reject()}}_onShowAttachments({objectId:e}){this.attachmentsViewOptions.objectId=e}_getTableTemplateForAttachmentsView(e){return new Q({columnTemplates:[new $({fieldName:e,editable:!1,menuConfig:{selectionMode:"single",icon:"chevron-down",items:this._extractFieldColumnInfosFromTableTemplate(this).map(([t,i])=>({selected:t===e,label:i||t,clickFunction:()=>{this.tableTemplateOverride=this._getTableTemplateForAttachmentsView(t)}}))},resizable:!1}),new L({attachmentsViewEnabled:!1,autoWidth:!1,flexGrow:0,label:"",resizable:!1,thumbnailsEnabled:!1,width:me})]})}_extractFieldColumnInfosFromTableTemplate(e){const t=e??this,{layer:i,tableTemplate:s}=t;return s?s.columnTemplates.filter(({type:e})=>"field"===e||"column"===e).map(({fieldName:e,label:t})=>[e,t]):i?.fields.map(e=>[e.name,e.alias])??[]}_getDefaultLayerDisplayField(e){const{displayField:t,objectIdField:i}=e;return t&&""!==t.trim()?t:i||(e.fields.length?e.fields[0].name:"")}_getIndexOfFirstFrozenToEndColumn(){const e=this.columns.findIndex(e=>e.frozenToEnd);return e>-1?e:void 0}_logWarning(e,t){t?r.getLogger(this).warnOnce(e):r.getLogger(this).warn(e)}_logTemplateWarning(e){this._logWarning(`${e} Skipped generating a column using the provided template.`,!0)}_onCellInteraction(e){null!=e&&null!=this.attachmentsViewOptions.objectId&&this.highlightIds.add(e)}};e([y()],ce.prototype,"_defaultHiddenFields",null),e([y()],ce.prototype,"_effectiveTableTemplate",null),e([y()],ce.prototype,"_effectiveAttributeTableTemplate",null),e([y()],ce.prototype,"_highlights",void 0),e([y()],ce.prototype,"_highlightableLayerView",null),e([y()],ce.prototype,"_selectionManager",null),e([y()],ce.prototype,"_selectableLayer",null),e([y()],ce.prototype,"_subtypes",null),e([y()],ce.prototype,"_tableHighlightsReady",null),e([y()],ce.prototype,"_viewSelection",null),e([y()],ce.prototype,"_viewSelectionReady",null),e([y()],ce.prototype,"activeFilters",null),e([y({readOnly:!0})],ce.prototype,"activeSortOrders",null),e([y()],ce.prototype,"allRelatedTablesVisible",null),e([y()],ce.prototype,"attachmentsColumns",null),e([y()],ce.prototype,"attachmentsEnabled",null),e([y()],ce.prototype,"attachmentsViewOptions",void 0),e([y({type:E})],ce.prototype,"attributeTableTemplate",void 0),e([y()],ce.prototype,"autoRefreshEnabled",void 0),e([y()],ce.prototype,"clearPrompt",null),e([y({readOnly:!0})],ce.prototype,"columns",void 0),e([y()],ce.prototype,"dataProvider",void 0),e([y()],ce.prototype,"definitionExpression",null),e([y()],ce.prototype,"fieldColumns",null),e([y()],ce.prototype,"filterGeometry",null),e([y()],ce.prototype,"filterBySelectionEnabled",null),e([y({readOnly:!0})],ce.prototype,"grid",void 0),e([y()],ce.prototype,"hiddenFields",null),e([y()],ce.prototype,"highlightEnabled",void 0),e([y()],ce.prototype,"initialSize",null),e([y()],ce.prototype,"isQueryingOrSyncing",null),e([y()],ce.prototype,"isSyncingAttachments",null),e([y()],ce.prototype,"layer",null),e([y()],ce.prototype,"layers",void 0),e([y()],ce.prototype,"layerView",null),e([y()],ce.prototype,"menuConfig",void 0),e([y()],ce.prototype,"messages",void 0),e([y(),re("esri/t9n/common")],ce.prototype,"messagesCommon",void 0),e([y(),re("esri/core/t9n/Units")],ce.prototype,"messagesUnits",void 0),e([y(),re("esri/widgets/support/t9n/uriUtils")],ce.prototype,"messagesURIUtils",void 0),e([y()],ce.prototype,"outFields",null),e([y()],ce.prototype,"prompt",void 0),e([y()],ce.prototype,"relatedRecordsEnabled",null),e([y()],ce.prototype,"relatedTable",null),e([y()],ce.prototype,"relatedTables",void 0),e([y()],ce.prototype,"relationship",null),e([y()],ce.prototype,"relationshipColumnConfigs",void 0),e([y()],ce.prototype,"relationshipColumns",null),e([y()],ce.prototype,"relationshipConfig",null),e([y()],ce.prototype,"relationshipInfos",null),e([y()],ce.prototype,"relationships",null),e([y()],ce.prototype,"returnGeometryEnabled",null),e([y()],ce.prototype,"returnMEnabled",null),e([y()],ce.prototype,"returnZEnabled",null),e([y()],ce.prototype,"selectionSource",void 0),e([y()],ce.prototype,"showAllRelatedTables",null),e([y()],ce.prototype,"showPrompt",null),e([y()],ce.prototype,"showRelatedTableCallback",void 0),e([y({readOnly:!0,type:M})],ce.prototype,"store",void 0),e([y()],ce.prototype,"supportsAttachments",null),e([y()],ce.prototype,"supportsAddAttachments",null),e([y()],ce.prototype,"supportsDeleteAttachments",null),e([y()],ce.prototype,"supportsResizeAttachments",null),e([y()],ce.prototype,"supportsUpdateAttachments",null),e([y()],ce.prototype,"syncTemplateOnChangesEnabled",void 0),e([y()],ce.prototype,"tableController",void 0),e([y()],ce.prototype,"tableParent",void 0),e([y({type:Q})],ce.prototype,"tableTemplate",void 0),e([y()],ce.prototype,"tableTemplateOverride",void 0),e([y()],ce.prototype,"timeExtent",null),e([y()],ce.prototype,"timeZone",null),e([y()],ce.prototype,"view",null),ce=e([T("esri.widgets.FeatureTable.FeatureTableViewModel")],ce);const pe=ce;export{pe as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as o}from"tslib";import{JSONSupport as t}from"../../../core/JSONSupport.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as e}from"../../../core/accessorSupport/decorators/subclass.js";let r=class extends t{constructor(o){super(o),this.autoWidth=!1,this.description=null,this.direction=null,this.flexGrow=1,this.fieldName=null,this.formatFunction=null,this.frozen=!1,this.frozenToEnd=!1,this.icon=null,this.iconText=null,this.initialSortPriority=null,this.invalid=!1,this.label=null,this.labelTooltipText=null,this.menuConfig=null,this.resizable=!0,this.sortable=!1,this.textAlign="start",this.textWrap=!1,this.timeZone=null,this.type=null,this.visible=!0,this.width=200}};o([i()],r.prototype,"autoWidth",void 0),o([i()],r.prototype,"description",void 0),o([i()],r.prototype,"direction",void 0),o([i()],r.prototype,"flexGrow",void 0),o([i({type:String})],r.prototype,"fieldName",void 0),o([i()],r.prototype,"formatFunction",void 0),o([i()],r.prototype,"frozen",void 0),o([i()],r.prototype,"frozenToEnd",void 0),o([i()],r.prototype,"icon",void 0),o([i()],r.prototype,"iconText",void 0),o([i()],r.prototype,"initialSortPriority",void 0),o([i()],r.prototype,"invalid",void 0),o([i()],r.prototype,"label",void 0),o([i()],r.prototype,"labelTooltipText",void 0),o([i()],r.prototype,"menuConfig",void 0),o([i()],r.prototype,"resizable",void 0),o([i()],r.prototype,"sortable",void 0),o([i()],r.prototype,"textAlign",void 0),o([i()],r.prototype,"textWrap",void 0),o([i()],r.prototype,"timeZone",void 0),o([i({type:String,json:{read:!1,write:!0}})],r.prototype,"type",void 0),o([i()],r.prototype,"visible",void 0),o([i()],r.prototype,"width",void 0),r=o([e("esri.widgets.FeatureTable.support.ColumnTemplateBase")],r);const p=r;export{p as default};
5
+ import{__decorate as o}from"tslib";import{ClonableMixin as t}from"../../../core/Clonable.js";import{JSONSupport as i}from"../../../core/JSONSupport.js";import{property as e}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as r}from"../../../core/accessorSupport/decorators/subclass.js";let p=class extends(t(i)){constructor(o){super(o),this.autoWidth=!1,this.description=null,this.direction=null,this.flexGrow=1,this.fieldName=null,this.formatFunction=null,this.frozen=!1,this.frozenToEnd=!1,this.icon=null,this.iconText=null,this.initialSortPriority=null,this.invalid=!1,this.label=null,this.labelTooltipText=null,this.menuConfig=null,this.resizable=!0,this.sortable=!1,this.textAlign="start",this.textWrap=!1,this.timeZone=null,this.type=null,this.visible=!0,this.width=200}};o([e()],p.prototype,"autoWidth",void 0),o([e()],p.prototype,"description",void 0),o([e()],p.prototype,"direction",void 0),o([e()],p.prototype,"flexGrow",void 0),o([e({type:String})],p.prototype,"fieldName",void 0),o([e()],p.prototype,"formatFunction",void 0),o([e()],p.prototype,"frozen",void 0),o([e()],p.prototype,"frozenToEnd",void 0),o([e()],p.prototype,"icon",void 0),o([e()],p.prototype,"iconText",void 0),o([e()],p.prototype,"initialSortPriority",void 0),o([e()],p.prototype,"invalid",void 0),o([e()],p.prototype,"label",void 0),o([e()],p.prototype,"labelTooltipText",void 0),o([e()],p.prototype,"menuConfig",void 0),o([e()],p.prototype,"resizable",void 0),o([e()],p.prototype,"sortable",void 0),o([e()],p.prototype,"textAlign",void 0),o([e()],p.prototype,"textWrap",void 0),o([e()],p.prototype,"timeZone",void 0),o([e({type:String,json:{read:!1,write:!0}})],p.prototype,"type",void 0),o([e()],p.prototype,"visible",void 0),o([e()],p.prototype,"width",void 0),p=o([r("esri.widgets.FeatureTable.support.ColumnTemplateBase")],p);const s=p;export{s as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{JSONSupport as o}from"../../../core/JSONSupport.js";import{clone as t}from"../../../core/lang.js";import r from"../../../core/Logger.js";import{property as s}from"../../../core/accessorSupport/decorators/property.js";import{cast as m}from"../../../core/accessorSupport/decorators/cast.js";import{subclass as p}from"../../../core/accessorSupport/decorators/subclass.js";import l from"./AttachmentsColumnTemplate.js";import a from"./ColumnTemplate.js";import{isTemplateObjectWithType as n}from"./columnUtils.js";import c from"./FieldColumnTemplate.js";import i from"./GroupColumnTemplate.js";import u from"./RelationshipColumnTemplate.js";var f;let T=f=class extends o{constructor(e){super(e),this.columnTemplates=[]}castColumnTemplates(e){if(!e||!Array.isArray(e))return[];const o=[];return e.forEach(e=>{if(e instanceof c||e instanceof i||e instanceof a||e instanceof l||e instanceof u)o.push(e);else if(n(e)){const t=e.type;"field"===t?o.push(new c(e)):"group"===t?o.push(new i(e)):"column"===t?o.push(new a(e)):"attachment"===t?o.push(new l(e)):"relationship"===t&&o.push(new u(e))}else r.getLogger(this).warn("Property 'type' is missing from the provided template. Template removed from 'tableTemplate.columnTemplates'.")}),o}clone(){return new f({columnTemplates:t(this.columnTemplates)})}};e([s()],T.prototype,"columnTemplates",void 0),e([m("columnTemplates")],T.prototype,"castColumnTemplates",null),T=f=e([p("esri.widgets.FeatureTable.support.TableTemplate")],T);const h=T;export{h as default};
5
+ import{__decorate as o}from"tslib";import{ClonableMixin as e}from"../../../core/Clonable.js";import{JSONSupport as t}from"../../../core/JSONSupport.js";import r from"../../../core/Logger.js";import{property as s}from"../../../core/accessorSupport/decorators/property.js";import{cast as m}from"../../../core/accessorSupport/decorators/cast.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as p}from"../../../core/accessorSupport/decorators/subclass.js";import a from"./AttachmentsColumnTemplate.js";import l from"./ColumnTemplate.js";import{isTemplateObjectWithType as n}from"./columnUtils.js";import c from"./FieldColumnTemplate.js";import i from"./GroupColumnTemplate.js";import u from"./RelationshipColumnTemplate.js";let f=class extends(e(t)){constructor(o){super(o),this.columnTemplates=[]}castColumnTemplates(o){if(!o||!Array.isArray(o))return[];const e=[];return o.forEach(o=>{if(o instanceof c||o instanceof i||o instanceof l||o instanceof a||o instanceof u)e.push(o);else if(n(o)){const t=o.type;"field"===t?e.push(new c(o)):"group"===t?e.push(new i(o)):"column"===t?e.push(new l(o)):"attachment"===t?e.push(new a(o)):"relationship"===t&&e.push(new u(o))}else r.getLogger(this).warn("Property 'type' is missing from the provided template. Template removed from 'tableTemplate.columnTemplates'.")}),e}};o([s()],f.prototype,"columnTemplates",void 0),o([m("columnTemplates")],f.prototype,"castColumnTemplates",null),f=o([p("esri.widgets.FeatureTable.support.TableTemplate")],f);const T=f;export{T as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import"../intl.js";import{isSome as t}from"../core/arrayUtils.js";import{watch as i,on as l,sync as o,initial as n}from"../core/reactiveUtils.js";import{renderingSanitizer as s}from"../core/sanitizerUtils.js";import{formatFileSize as a}from"../core/unitFormatUtils.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import{subclass as c}from"../core/accessorSupport/decorators/subclass.js";import{isLayerFromCatalog as d}from"../layers/catalog/catalogUtils.js";import{isKnowledgeGraphLayer as h,isMapImageLayer as p,isSubtypeGroupLayer as m}from"../layers/support/layerUtils.js";import u from"../tables/AttributeTableTemplate.js";import g from"./Widget.js";import{isSupportedImage as w,getCalciteIconForAttachment as b}from"./Attachments/support/attachmentUtils.js";import{loadPromptComponents as v,Prompt as y}from"./Editor/components/Prompt.js";import f from"./FeatureTable/ColumnMenuVisibleElements.js";import _ from"./FeatureTable/FeatureTableViewModel.js";import M from"./FeatureTable/VisibleElements.js";import{isGroupColumn as C}from"./FeatureTable/support/columnUtils.js";import{loadFieldColumnComponents as A,isIFeatureTableSupportedLayer as S,isIFeatureTableSupportedLayerWithAttachments as T,getRelationshipIdsToShow as E}from"./FeatureTable/support/tableUtils.js";import{loadCalciteComponents as V}from"./support/componentsUtils.js";import{globalCss as I}from"./support/globalCss.js";import{getIconForLayer as R}from"./support/iconUtils.js";import{storeNode as k,discardNode as x}from"./support/widgetUtils.js";import{messageBundle as D}from"./support/decorators/messageBundle.js";import{vmEvent as P}from"./support/decorators/vmEvent.js";import{tsx as O}from"./support/jsxFactory.js";import"@arcgis/toolkit/dom";import{substitute as F}from"../intl/substitute.js";var j;const z="esri-feature-table",L=`${z}__attachments-view`,U={base:z,content:`${z}__content`,menuPopover:`${z}__menu-popover`,layerDropdownMenu:`${z}__layer-switcher-menu`,tableContainer:`${z}__table-container`,tableContainerWithAttachments:`${z}__table-container--attachments`,tableNavigation:`${z}__table-navigation`,attachmentsView:L,attachmentsViewContent:`${L}__content`,attachmentsViewDropArea:`${L}__drop-area`,attachmentsViewIcon:`${L}__icon`,attachmentsViewInformation:`${L}__information`,attachmentsViewList:`${L}__list`,attachmentsViewListFileSize:`${L}__list__filesize`,attachmentsViewListItemDelete:`${L}__list-item--delete`,attachmentsViewListThumbnail:`${L}__list__thumbnail`,expanded:`${z}__expanded`,collapsed:`${z}__collapsed`},$={chevronRight:"chevron-right",clearSelection:"clear-selection",downloadTo:"download-to",exclamationMarkTriangle:"exclamation-mark-triangle",exportToCSV:"file-csv",folderOpen:"folder-open",delete:"trash",launch:"launch",layers:"layers",moveUp:"move-up",plus:"plus",refresh:"refresh",replaceImage:"replace-image",save:"save",showAll:"selection-x",showColumn:"show-column",showSelected:"selection-filter",upload:"upload",zoomToSelection:"zoom-to-object"};let B=j=class extends g{constructor(e,t){super(e,t),this._attachmentsInput=null,this._columnVisibilityActions=new Map,this.attachmentsList=null,this.description=null,this.disabled=!1,this.menuConfig=null,this.navigationScale="m",this.title=null,this.viewModel=new _,this.visibleElements=new M,this._showDeletePrompt=this._showDeletePrompt.bind(this),this._onDeleteSelectionClick=this._onDeleteSelectionClick.bind(this)}initialize(){this.addHandles([i(()=>[this.isQueryingOrSyncing,this.editingEnabled],()=>this.scheduleRender()),i(()=>[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),i(()=>this._effectiveVisibleElements.selectionColumn,e=>{this.grid&&(this.grid.selectionColumnEnabled=e)},n),l(()=>this.viewModel,"show-related-table",e=>this._onShowRelatedTable(e)),i(()=>this.editingEnabled,()=>{const{attachmentsViewOptions:e}=this;this.clearPrompt(),e&&(e.form?.reset(),e.candidates=null)})])}loadDependencies(){return Promise.all([V({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"),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"),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")}),v(),A()])}destroy(){this.drainRelatedTables(),this.clearPrompt()}get _effectiveDescription(){const{description:e}=this;return null!=e?s.sanitize("function"==typeof e?e():e):void 0}get _effectiveLayers(){const{layer:e,layers:t}=this,i=t?.length?t.filter(S):[],l=i.length?i:[...this._viewLayers];return e&&!l.includes(e)&&l.push(e),l}get _effectiveTitle(){const{layer:e,messages:t,state:i,highlightIds:l,title:o,size:n}=this;if(o)return s.sanitize("function"==typeof o?o():o);if(!e)return t.noLayer;switch(i){case"disabled":return t.errorLayer;case"ready":case"loading":return t.loading;case"error":return t.errorData}return F(t.header,{title:s.sanitize(e.title),count:n,selected:l.length})}get _effectiveVisibleElements(){return this.visibleElementsOverride??this.visibleElements}get _filteredTables(){const e=this.relatedTables.toArray(),t=1===e.length;return this.allRelatedTablesVisible?e:t?[e[0]]:this._shouldShowAttachmentsView?e.slice(-1):e.slice(-2)}get _hasAttachmentsViewError(){return null!=this.attachmentsViewOptions.error}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._showColumnsVisibilityAction)}get _shouldShowGrid(){return this.allRelatedTablesVisible||1===this.relatedTables.length&&!this._shouldShowAttachmentsView}get _shouldShowMenu(){const{header:e,menu:t}=this._effectiveVisibleElements;return!(!e||!t||!this._hasDefaultMenuItems&&!this._hasCustomMenuItems)}get _shouldShowAttachmentsView(){return!(null==this.attachmentsViewOptions.objectId&&!this.relatedTables.some(e=>null!=e.attachmentsViewOptions.objectId))}get _showClearSelectionAction(){return!(!this.highlightIds.length||!this._effectiveVisibleElements.menuItems?.clearSelection||this.relatedTables.length||this._shouldShowAttachmentsView)}get _showColumnsVisibilityAction(){const{header:e,menu:t,menuItems:i}=this._effectiveVisibleElements;return!(!(e&&t&&i?.toggleColumns)||this.showRelatedTableCallback||this.allRelatedTablesVisible||this._shouldShowAttachmentsView)}get _showDeleteSelectionAction(){return!(!(this.editingEnabled&&this.highlightIds.length&&this._effectiveVisibleElements.menuItems?.deleteSelection&&this.layer?.capabilities?.operations?.supportsDelete)||this.relatedTables.length||this._shouldShowAttachmentsView)}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(){const e=!!this.relatedTable||this._shouldShowAttachmentsView;return!this.tableParent&&e}get _showRefreshDataAction(){return!!this._effectiveVisibleElements.menuItems?.refreshData}get _showSelectedRecordsShowSelectedAction(){const e=this.objectIds.length,t=this.highlightIds.length;return!(!t||!this._effectiveVisibleElements.menuItems?.selectedRecordsShowSelectedToggle||e&&t===e||this.relatedTables.length||this._shouldShowAttachmentsView)}get _showSelectedRecordsShowAllAction(){return!(!this._effectiveVisibleElements.menuItems?.selectedRecordsShowAllToggle||!this.objectIds.length||this.relatedTables.length)}get _showZoomToSelectionAction(){return!(!this.view||!this.highlightIds.length||this.effectiveTable.layer?.isTable||!this._effectiveVisibleElements.menuItems?.zoomToSelection)}get _viewLayers(){const e=this.view?.map;if(!e)return[];const t=new Set,i=e=>{!S(e)||m(e)||t.has(e)||"sublayer"===e.type&&!e.capabilities?.operations?.supportsQuery||(e.load(),t.add(e))},l=e=>{d(e)||"catalog-footprint"===e.type||(h(e)?(e.load(),e.layers?.forEach(i),e.tables?.forEach(i)):p(e)?(e.loadAll(),e.allSublayers?.forEach(i),e.subtables?.forEach(i)):m(e)?(e.loadAll(),e.sublayers?.forEach(i)):i(e))};return e.allLayers.forEach(l),e.allTables.forEach(l),[...t.values()]}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 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 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 definitionExpression(){return this.viewModel.definitionExpression}set definitionExpression(e){this.viewModel.definitionExpression=e}set container(e){super.container=e}get editingEnabled(){return this.viewModel.editingEnabled}set editingEnabled(e){this.viewModel.editingEnabled=e}get effectiveSize(){return this.viewModel.effectiveSize}get effectiveTable(){return this.relatedTable||this}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 groupColumns(){return this.viewModel.groupColumns}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"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 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 multipleSelectionEnabled(){return this.viewModel.multipleSelectionEnabled}set multipleSelectionEnabled(e){this.viewModel.multipleSelectionEnabled=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 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 relatedTables(){return this.viewModel.relatedTables}set relatedTables(e){this.viewModel.relatedTables=e}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 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 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 visibleColumns(){return this.viewModel.visibleColumns}get visibleElementsOverride(){const{attachmentsViewOptions:e,relatedTable:t,tableController:i,visibleElements:l}=this,{columnDescriptions:o,columnMenus:n,tooltips:s}=l,a=null!=e.objectId;if(t)return new M({columnDescriptions:o,columnMenus:n,tooltips:s,close:l.close,header:l.header,layerDropdown:l.layerDropdown,layerDropdownIcons:l.layerDropdownIcons,menu:l.menu,menuItems:l.menuItems,progress:l.progress,selectionColumn:!1,columnMenuItems:new f({sortAscending:!1,sortDescending:!1})});if(i){const e=i.relatedTable===this,t=i.allRelatedTablesVisible,r=e&&l.selectionColumn&&!t&&!a,c=e&&!t&&!a;return new M({columnDescriptions:o,columnMenus:n,tooltips:s,selectionColumn:r,close:!1,header:!1,layerDropdown:!1,menu:!1,progress:!1,columnMenuItems:new f({sortAscending:c,sortDescending:c})})}return a?new M({columnDescriptions:o,columnMenus:n,tooltips:s,close:l.close,header:l.header,layerDropdown:l.layerDropdown,layerDropdownIcons:l.layerDropdownIcons,menu:l.menu,menuItems:l.menuItems,progress:l.progress,selectionColumn:!1,columnMenuItems:new f({sortAscending:!1,sortDescending:!1})}):null}clearSelectionFilter(){this.viewModel.clearSelectionFilter()}async deleteAttachments(e,t,i){null!=e&&t?.length&&(i?this._showDeleteAttachmentPrompt(e,t):await this.viewModel.deleteAttachments(e,t))}deleteSelection(e){return this.highlightIds.length?e?(this._showDeletePrompt(),this.scheduleRender(),Promise.resolve()):this.viewModel.deleteSelection():Promise.resolve()}async downloadAttachmentById(e,t){return this.viewModel.downloadAttachmentById(e,t)}drainRelatedTables(){this.viewModel.drainRelatedTables()}exportSelectionToCSV(e){return this.viewModel.exportSelectionToCSV(e)}filterBySelection(){this.viewModel.filterBySelection()}findColumn(e){return this.viewModel.findColumn(e)}goToPage(e){this.viewModel.goToPage(e)}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()}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)}zoomToSelection(){this.effectiveTable.viewModel.zoomToSelection()}render(){const{_effectiveVisibleElements:e,isQueryingOrSyncing:t,menuConfig:i,state:l}=this;return O("div",{bind:this,class:this.classes(U.base,I.widget)},O("calcite-panel",{bind:this,class:U.content,closable:e.close,description:this._effectiveDescription,disabled:this.disabled||"disabled"===l&&!this._effectiveLayers?.length,heading:e.header?this._effectiveTitle:void 0,key:"table-content",loading:"loading"===l,menuOpen:!!i?.open,overlayPositioning:"fixed",onCalcitePanelClose:e=>{e.currentTarget.closed=!1,this.emit("close")}},e.progress?O("calcite-progress",{type:t?"indeterminate":"determinate"}):null,this._showLayerDropdown?this._renderLayerDropdown():null,this._renderColumnVisibilityAction(),this._renderHeaderMenuActions(),this._renderNavigationBar(),this._renderTables(),this._renderError()),this._renderColumnVisibilityPopover(),this._renderPrompt())}_renderTables(){const{grid:e,relatedTables:t}=this,i=this.classes(U.tableContainer);if(t.length){const l=this.classes(U.base,this.allRelatedTablesVisible?U.expanded:U.collapsed,this._shouldShowAttachmentsView?U.tableContainerWithAttachments:void 0);return O("div",{class:i},O("calcite-panel",{overlayPositioning:"fixed"},O("div",null,[this._shouldShowGrid?O("div",{class:l},e?.render(),this._renderPagination()):void 0,...this._filteredTables.map(e=>{const i=t.indexOf(e);return O("div",{class:l,key:`related-${i}`},e.render())}),,])))}return null!=this.attachmentsViewOptions.objectId?O("div",{class:i},O("calcite-panel",{overlayPositioning:"fixed"},O("div",null,[O("div",{class:this.classes(U.base,U.collapsed)},e?.render(),this._renderPagination()),this._renderAttachmentsView()]))):[O("div",{class:i},e?.render()),this._renderPagination()]}_renderPagination(){if(this.paginationEnabled)return O("calcite-pagination",{pageSize:1,startItem:this.pageIndex+1,totalItems:this.pageCount,onCalcitePaginationChange:e=>this.goToPage(e.currentTarget.startItem-1)})}_renderError(){const{messages:e}=this;return O("calcite-alert",{autoClose:!0,autoCloseDuration:"fast",icon:$.exclamationMarkTriangle,kind:"danger",label:e.errorOccured,open:this._hasAttachmentsViewError,slot:"alerts",onCalciteAlertClose:()=>{this.attachmentsViewOptions.error=null}},O("span",{slot:"message"},e.errorOccured))}_renderPrompt(){return this.prompt?O(y,{...this.prompt,headingLevel:2}):void 0}_showDeletePrompt(){const{messages:e,messagesCommon:t}=this,i=F(e.deleteSelectionCount,{count:this.highlightIds.length});this.showPrompt({title:i,message:e.deleteRecordsRemoved,context:"danger",actions:{primary:{label:t.delete,action:this._onDeleteSelectionClick},secondary:{label:e.keepRecords,action:()=>this.clearPrompt()}}})}_showDeleteAttachmentPrompt(e,t){const{messages:i,messagesCommon:l}=this,o=F(i.deleteAttachmentCount,{count:t.length});this.showPrompt({title:o,message:i.deleteAttachmentConfirmation,context:"danger",actions:{primary:{label:l.delete,action:async()=>{try{await this.deleteAttachments(e,t,!1)}finally{this.clearPrompt()}}},secondary:{label:l.cancel,action:()=>this.clearPrompt()}}})}async _onDeleteSelectionClick(){try{await this.viewModel.deleteSelection()}finally{this.clearPrompt()}}_renderHeaderMenuAction(e){const{disabled:t,hidden:i,icon:l,text:o,clickFunction:n}=e;if(!i)return O("calcite-action",{disabled:t??this.menuConfig?.disabled,icon:l??void 0,key:o,onclick:()=>n(),slot:"header-menu-actions",text:o,textEnabled:!0,title:o})}_renderHeaderMenuActions(){return this._shouldShowMenu?[this._renderDefaultHeaderMenuActions(),this._renderCustomHeaderMenuActions()]:[]}_renderDefaultHeaderMenuActions(){if(!this._hasDefaultMenuItems)return[];const{messages:e}=this;return[this._showRefreshDataAction&&{icon:$.refresh,text:e.refreshData,clickFunction:()=>this.refresh()},this._showDeleteSelectionAction&&{icon:$.delete,text:e.deleteSelection,clickFunction:()=>this.deleteSelection(!0)},this._showClearSelectionAction&&{icon:$.clearSelection,text:e.clearSelection,clickFunction:()=>this.highlightIds?.removeAll()},this._showZoomToSelectionAction&&{icon:$.zoomToSelection,text:e.zoomToSelection,clickFunction:()=>this.zoomToSelection()},this._showSelectedRecordsShowSelectedAction&&{icon:$.showSelected,text:e.showSelected,clickFunction:()=>{const{objectIds:e}=this;e.removeAll(),e.addMany(this.highlightIds.toArray())}},this._showSelectedRecordsShowAllAction&&{icon:$.showAll,text:e.showAllRecords,clickFunction:()=>this.objectIds.removeAll()},this._showExportSelectionToCSVAction&&{icon:$.exportToCSV,text:e.exportSelectionCSV,clickFunction:()=>this.exportSelectionToCSV()}].filter(t).map(e=>e&&this._renderHeaderMenuAction(e))}_renderCustomHeaderMenuActions(){return this.menuConfig?.items?.map(({disabled:e,hidden:t,icon:i,label:l,clickFunction:o})=>this._renderHeaderMenuAction({hidden:"function"==typeof t?t():t,icon:i,text:l,disabled:e,clickFunction:e=>o(e)}))??[]}_renderColumnVisibilityAction(){if(!this._showColumnsVisibilityAction)return[];const{_columnVisibilityActions:e,effectiveTable:t,id:i}=this,l=this.messages.toggleColumns;return O("calcite-action",{afterCreate:t=>e.set(i,t),afterRemoved:()=>e.delete(i),appearance:"transparent",bind:this,disabled:t.menuConfig?.disabled,icon:$.showColumn,id:`${i}__toggle-columns-action`,slot:"header-actions-end",text:l},this._effectiveVisibleElements.tooltips?O("calcite-tooltip",{closeOnClick:!0,overlayPositioning:"fixed",placement:"bottom-end",slot:"tooltip"},l):null)}_renderColumnVisibilityPopover(){if(!this._showColumnsVisibilityAction||this.effectiveTable.menuConfig?.disabled)return;const{effectiveTable:e}=this,t=this.messages.toggleColumns;return O("calcite-popover",{autoClose:!0,class:U.menuPopover,label:t,overlayPositioning:"fixed",placement:"top-end",pointerDisabled:!0,referenceElement:this._columnVisibilityActions.get(this.id)},O("calcite-list",{displayMode:"nested",filterEnabled:!0,filterPlaceholder:t,label:t,selectionMode:"multiple"},e.columns.toArray().map(t=>{const i=C(t)?t.columns?.map(t=>this._renderColumnListItem({column:t,table:e,ignoreSelect:!0})):void 0;return this._renderColumnListItem({column:t,table:e,items:i})})))}_renderColumnListItem(e){const{column:t,table:i,items:l,ignoreSelect:o}=e,{effectiveLabel:n,fieldName:s,hidden:a}=t;return O("calcite-list-item",{expanded:!(!l?.length||a)||void 0,key:`toggle-columns__item-${s}`,label:n,selected:!a,value:s,onCalciteListItemSelect:e=>{o&&e.stopPropagation(),i.toggleColumnVisibility(e.currentTarget.value)}},l)}_renderLayerDropdown(){const e=this.messages.selectALayer;return O("div",{class:U.layerDropdownMenu,key:`${this.id}-layerDropdown`,slot:"header-actions-start"},O("calcite-dropdown",{bind:this,maxItems:5,overlayPositioning:"fixed",placement:"bottom-start"},O("calcite-action",{icon:$.layers,slot:"trigger",text:e,title:e}),O("calcite-dropdown-group",{selectionMode:"single"},this._effectiveLayers.map((e,t)=>this._renderLayerDropdownItem(e,t))??null)))}_renderLayerDropdownItem(e,t){const i=this.visibleElements.layerDropdownIcons;return O("calcite-dropdown-item",{iconStart:i?R(e):void 0,key:`dropdown-item-${t}`,label:e.title??"",selected:e===this.layer,value:e.id,onCalciteDropdownItemSelect:()=>{this.layer=e}},e.title)}_onRelatedNavigationItemClick(e){this.viewModel.drainRelatedTablesAboveIndex(e)}_collapseRelatedTable(e){this.viewModel.collapseRelatedTable(this.effectiveTable,e)}_onShowRelatedTable(e){this.showRelatedTableCallback||(this._collapseRelatedTable(e),this._createRelatedTable(e))}async _createRelatedTable(e){const{editingEnabled:t,effectiveTable:i,paginationEnabled:l,pageSize:o,view:n,viewModel:s}=this,{layer:a,objectId:r,relatedLayer:c,relationshipId:d}=e;await a.load();const h=this.attachmentsEnabled&&T(a),p=new j({layer:a,attachmentsEnabled:h,editingEnabled:t,paginationEnabled:l,pageSize:o,relatedRecordsEnabled:!0,relationshipConfig:{objectId:r,relatedLayer:c,relationshipId:d},relationshipColumnConfigs:E(a,d),tableController:this,tableParent:i,view:n,showRelatedTableCallback:e=>s.emit("show-related-table",e)});this.relatedTables.add(p),this.scheduleRender()}_renderAttachmentsView(){const{attachmentInfos:e,mode:t,objectId:i}=this.attachmentsViewOptions;return"file"!==t&&e.length&&null!=i?this._renderAttachmentsViewList():this._renderAttachmentsViewFilePane()}_renderAttachmentsViewFilePane(){const{attachmentsViewOptions:e,isSyncingAttachments:t,supportsAddAttachments:i,messages:l,messagesUnits:o}=this,{attachmentId:n,attachmentInfos:s,candidates:r,objectId:c}=e,d=s.find(e=>e.id===n),h=s.length,p=r?.length,m=d?O("calcite-label",{alignment:"center",key:"replace-file-node",scale:"l"},l.replaceFile):void 0,u=p?void 0:O("calcite-label",{alignment:"center",key:"message-node",scale:"m"},i?null==c?l.noFeature:l.dragAndDropToUpload:l.editingRestricted),g=Array.from(r??[]).pop(),w=g?O("calcite-label",{key:"filename-node"},g.name):void 0,b=i&&null!=c,v=b&&p,y=O("input",{afterCreate:k,afterRemoved:x,afterUpdate:k,bind:this,"data-node-ref":"_attachmentsInput",files:r,hidden:!0,name:"attachment",onchange:e=>this._onAttachmentsViewCandidateChange(e),type:"file"}),f=b?O("calcite-button",{appearance:"outline-fill",bind:this,disabled:t,iconStart:$.folderOpen,key:"select-node",loading:!1,onclick:()=>{this._attachmentsInput&&(this._attachmentsInput.value="",this._attachmentsInput.click())},width:"full"},l.selectFile):void 0,_=v?O("calcite-button",{appearance:"outline-fill",bind:this,disabled:t,iconStart:$.save,key:"save-node",loading:t,onclick:()=>{this.saveAttachmentsViewForm()},width:"full"},d?l.updateAttachment:l.addAttachment):void 0,M=h||p?O("calcite-button",{appearance:"transparent",bind:this,disabled:t,key:"cancel-node",onclick:()=>{this._attachmentsInput&&(this._attachmentsInput.value=""),e.reset(),e.attachmentInfos?.length&&(e.mode="list")},width:"full"},this.messagesCommon.cancel):void 0;return[O("div",{class:U.attachmentsView,key:"attachments-view"},O("div",{class:U.attachmentsViewContent,key:"attachments-view-content"},O("div",{bind:this,class:U.attachmentsViewDropArea,ondragover:e=>e.preventDefault(),ondrop:this._onAttachmentsViewDrop},O("calcite-icon",{class:U.attachmentsViewIcon,icon:$.upload,scale:"l"}),m,u,O("form",{afterCreate:t=>e.form=t,afterRemoved:()=>e.form=null,bind:this,key:"attachments-form"},O("fieldset",null,w,y,f,_,M)))),null!=c&&null!=d?O("div",{class:U.attachmentsViewInformation,key:"information"},this._renderAttachmentsViewThumbnail(d,200),O("label",{key:"file-label"},l.fileName),O("span",{key:"file-span"},d.name),O("label",{key:"size-label"},l.size),O("span",{key:"size-span"},a(o,d.size??0))):void 0)]}_renderAttachmentsViewList(){const{attachmentsViewOptions:e,isSyncingAttachments:t,messages:i,messagesUnits:l,supportsDeleteAttachments:o,supportsUpdateAttachments:n}=this,{attachmentInfos:s,objectId:r}=e;return O("calcite-list",{afterCreate:k,afterRemoved:x,afterUpdate:k,bind:this,class:U.attachmentsViewList,"data-node-ref":"attachmentsList",key:`attachments-list-${r}`,label:i?.attachments,loading:t,ondragover:e=>e.preventDefault(),ondrop:this._onAttachmentsViewDrop,selectionMode:"multiple",onCalciteListChange:()=>this.scheduleRender()},...s?.map(t=>{const{id:s,name:c,size:d,url:h}=t,p=a(l,d??0);return O("calcite-list-item",{afterRemoved:()=>this.scheduleRender(),key:`attachment-${s}`,label:c,value:s},this._renderAttachmentsViewListThumbnail(t),O("span",{class:U.attachmentsViewListFileSize,slot:"actions-end",title:p},p),O("calcite-action",{appearance:"transparent",icon:$.downloadTo,key:`download-attachment-${s}`,label:`${c}`,onclick:e=>{e.preventDefault(),this.downloadAttachmentById(r??-1,s)},slot:"actions-end",text:i.downloadAttachment,title:i.downloadAttachment}),n&&null!=r?O("calcite-action",{appearance:"transparent",disabled:!n,icon:$.replaceImage,key:`replace-attachment-${s}`,label:`${c}`,onclick:()=>{e.mode="file",e.attachmentId=s},slot:"actions-end",text:i.updateAttachment,title:i.updateAttachment}):void 0,O("calcite-action",{appearance:"transparent",icon:$.launch,key:`launch-attachment-${s}`,label:`${c}`,onclick:()=>{h&&window.open(h,"_blank")},slot:"actions-end",text:i.viewAttachment,title:i.viewAttachment}),o&&null!=r?O("calcite-action",{appearance:"transparent",class:U.attachmentsViewListItemDelete,disabled:!o,icon:$.delete,key:`delete-attachment-${s}`,label:`${c}`,onclick:()=>{this.deleteAttachments(r,[s],!0)},slot:"actions-end",text:i.deleteAttachment,title:i.deleteAttachment}):void 0)}))}_renderAttachmentsViewListThumbnail(e){return O("div",{class:U.attachmentsViewListThumbnail,slot:"content-start"},O("a",{href:e.url??"",rel:"noreferrer",target:"_blank"},this._renderAttachmentsViewThumbnail(e)))}_renderAttachmentsViewThumbnail(e,t=64){const{contentType:i,name:l,size:o,url:n}=e,s=`${n}${n?.includes("?")?"&":"?"}w=${t}&s=${o}`;return this.supportsResizeAttachments&&w(i)?O("img",{alt:l,key:`thumbnail-image-${l}`,src:s,title:l}):O("calcite-icon",{icon:b(i),key:`thumbnail-icon-${l}`,scale:"l",textLabel:l,title:l})}_onAttachmentsViewCandidateChange({target:e}){this.attachmentsViewOptions.candidates=e?.files}_onAttachmentsViewDrop(e){e.preventDefault(),(this.supportsAddAttachments||this.supportsUpdateAttachments)&&this.attachmentsViewOptions.set({mode:"file",candidates:e.dataTransfer?.files})}_renderNavigationBar(){const{effectiveTable:e,messages:t,messagesCommon:i,navigationScale:l,relatedTable:o,relatedTables:n}=this;if(!this._shouldShowNavigationBar)return;const{attachmentsList:s,attachmentsViewOptions:a,layer:r,supportsAddAttachments:c,supportsDeleteAttachments:d}=e;if(!r)return;const{attachmentInfos:h,objectId:p}=a,m=null!=p,u=h.length,g=s?.selectedItems?.length??0,w=`${r.objectIdField}: ${p}`,b=F(t.selectedCount,{count:g}),v=F(t.attachmentsCount,{count:u}),y=m?O("calcite-action",{bind:this,icon:$.chevronRight,iconFlipRtl:!0,key:"navigation-feature",onclick:()=>e.scrollToRow(p),scale:l,text:w,textEnabled:!0,title:w}):void 0,f=m?O("calcite-action",{icon:$.chevronRight,iconFlipRtl:!0,key:"navigation-attachments-label",label:v,onclick:()=>{u>0&&(a.mode="list")},scale:l,text:v,textEnabled:!0,title:v}):void 0,_=m?O("calcite-chip",{closable:!0,closed:0===g,key:"navigation-chip",kind:"inverse",label:b,scale:l,selected:!0,title:b,value:"selected",onCalciteChipClose:()=>s?.selectedItems?.forEach(e=>e.selected=!1)},b):void 0,M=o?O("calcite-label",{layout:"inline",scale:l},t.showAllTables,O("calcite-switch",{checked:this.allRelatedTablesVisible,scale:l,onCalciteSwitchChange:e=>this.showAllRelatedTables=!!e.currentTarget.checked})):void 0,C=m&&"list"===a.mode&&null!=p&&g&&d?O("calcite-action",{icon:$.delete,iconFlipRtl:!0,key:"attachments-trash-all",onclick:()=>{e.deleteAttachments(p,s?.selectedItems?.map(e=>e.value)??[],!0)},scale:l,text:i.delete,textEnabled:!0,title:F(t.deleteAttachmentCount,{count:g})}):void 0,A=m&&"list"===a.mode&&c?O("calcite-action",{bind:this,icon:$.plus,iconFlipRtl:!0,key:"attachments-add",onclick:()=>{a.attachmentId=null,a.mode="file"},scale:l,text:t.addAttachment,textEnabled:!0,title:t.addAttachment}):void 0;return O("div",{class:U.tableNavigation,key:"table-nav"},O("calcite-action",{icon:$.moveUp,iconFlipRtl:!0,key:"go-back",onclick:()=>{o&&this.drainRelatedTables(),e.attachmentsViewOptions.objectId=null},scale:l,text:this.layer?.title??"",textEnabled:!1,title:o?t.exitRelatedRecords:t.exitAttachments}),n.toArray().map((e,t)=>this._renderRelatedTableNavigationAction(e,t)),y,f,O("div",null,_,M,C,A))}_renderRelatedTableNavigationAction(e,t){const i=this._getLabelForRelatedTableNavigationAction(e);return O("calcite-action",{icon:$.chevronRight,iconFlipRtl:!0,key:t,onclick:()=>this._onRelatedNavigationItemClick(t),scale:this.navigationScale,text:i,textEnabled:!0,title:e.layer?.title||""})}_getLabelForRelatedTableNavigationAction(e){const t=e.layer?.title;if(!t)return"";const{relatedTables:i}=this;if(i.length<=1)return t;return i.indexOf(e)!==i.length-1&&t.length>20?`${t.slice(0,20)}...`:t}};e([r()],B.prototype,"_attachmentsInput",void 0),e([r()],B.prototype,"_columnVisibilityActions",void 0),e([r()],B.prototype,"_effectiveDescription",null),e([r()],B.prototype,"_effectiveLayers",null),e([r()],B.prototype,"_effectiveTitle",null),e([r()],B.prototype,"_effectiveVisibleElements",null),e([r()],B.prototype,"_filteredTables",null),e([r()],B.prototype,"_hasAttachmentsViewError",null),e([r()],B.prototype,"_hasCustomMenuItems",null),e([r()],B.prototype,"_hasDefaultMenuItems",null),e([r()],B.prototype,"_shouldShowGrid",null),e([r()],B.prototype,"_shouldShowMenu",null),e([r()],B.prototype,"_shouldShowAttachmentsView",null),e([r()],B.prototype,"_showClearSelectionAction",null),e([r()],B.prototype,"_showColumnsVisibilityAction",null),e([r()],B.prototype,"_showDeleteSelectionAction",null),e([r()],B.prototype,"_showExportSelectionToCSVAction",null),e([r()],B.prototype,"_showLayerDropdown",null),e([r()],B.prototype,"_shouldShowNavigationBar",null),e([r()],B.prototype,"_showRefreshDataAction",null),e([r()],B.prototype,"_showSelectedRecordsShowSelectedAction",null),e([r()],B.prototype,"_showSelectedRecordsShowAllAction",null),e([r()],B.prototype,"_showZoomToSelectionAction",null),e([r()],B.prototype,"_viewLayers",null),e([r()],B.prototype,"attachmentsList",void 0),e([r({readOnly:!0})],B.prototype,"grid",null),e([r()],B.prototype,"actionColumn",null),e([r()],B.prototype,"actionColumnConfig",null),e([r({readOnly:!0})],B.prototype,"activeFilters",null),e([r({readOnly:!0})],B.prototype,"activeSortOrders",null),e([r()],B.prototype,"allColumns",null),e([r({readOnly:!0})],B.prototype,"allRelatedTablesVisible",null),e([r()],B.prototype,"allVisibleColumns",null),e([r()],B.prototype,"attachmentsColumns",null),e([r()],B.prototype,"attachmentsEnabled",null),e([r()],B.prototype,"attachmentsViewOptions",null),e([r({type:u})],B.prototype,"attributeTableTemplate",null),e([r()],B.prototype,"autoRefreshEnabled",null),e([r()],B.prototype,"clearPrompt",null),e([r()],B.prototype,"columnPerformanceModeEnabled",null),e([r()],B.prototype,"columnReorderingEnabled",null),e([r({readOnly:!0})],B.prototype,"columns",null),e([r()],B.prototype,"definitionExpression",null),e([r()],B.prototype,"description",void 0),e([r()],B.prototype,"disabled",void 0),e([r()],B.prototype,"editingEnabled",null),e([r()],B.prototype,"effectiveSize",null),e([r()],B.prototype,"effectiveTable",null),e([r()],B.prototype,"fieldColumns",null),e([r()],B.prototype,"filterGeometry",null),e([r()],B.prototype,"filterBySelectionEnabled",null),e([r()],B.prototype,"groupColumns",null),e([r()],B.prototype,"hiddenFields",null),e([r()],B.prototype,"highlightEnabled",null),e([r()],B.prototype,"highlightIds",null),e([r()],B.prototype,"icon",null),e([r()],B.prototype,"initialSize",null),e([r()],B.prototype,"isQueryingOrSyncing",null),e([r()],B.prototype,"isSyncingAttachments",null),e([r()],B.prototype,"label",null),e([r()],B.prototype,"layer",null),e([r()],B.prototype,"layers",null),e([r()],B.prototype,"layerView",null),e([r()],B.prototype,"maxSize",null),e([r(),D("esri/widgets/FeatureTable/t9n/FeatureTable")],B.prototype,"messages",null),e([r(),D("esri/t9n/common")],B.prototype,"messagesCommon",null),e([r(),D("esri/core/t9n/Units")],B.prototype,"messagesUnits",null),e([r(),D("esri/widgets/support/t9n/uriUtils")],B.prototype,"messagesURIUtils",null),e([r()],B.prototype,"menuConfig",void 0),e([r()],B.prototype,"multipleSelectionEnabled",null),e([r()],B.prototype,"multiSortEnabled",null),e([r()],B.prototype,"multipleSortPriority",null),e([r()],B.prototype,"navigationScale",void 0),e([r()],B.prototype,"noDataMessage",null),e([r()],B.prototype,"objectIds",null),e([r()],B.prototype,"outFields",null),e([r()],B.prototype,"pageCount",null),e([r()],B.prototype,"pageIndex",null),e([r()],B.prototype,"pageSize",null),e([r()],B.prototype,"paginationEnabled",null),e([r()],B.prototype,"prompt",null),e([r()],B.prototype,"relatedRecordsEnabled",null),e([r()],B.prototype,"relatedTable",null),e([r()],B.prototype,"relatedTables",null),e([r()],B.prototype,"relationship",null),e([r()],B.prototype,"relationshipColumnConfigs",null),e([r()],B.prototype,"relationshipColumns",null),e([r()],B.prototype,"relationshipConfig",null),e([r()],B.prototype,"relationshipInfos",null),e([r()],B.prototype,"returnGeometryEnabled",null),e([r()],B.prototype,"returnMEnabled",null),e([r()],B.prototype,"returnZEnabled",null),e([r()],B.prototype,"rowHighlightIds",null),e([r()],B.prototype,"selectionSource",null),e([r()],B.prototype,"showAllRelatedTables",null),e([r()],B.prototype,"showPrompt",null),e([r()],B.prototype,"showRelatedTableCallback",null),e([r()],B.prototype,"size",null),e([r({readOnly:!0})],B.prototype,"state",null),e([r()],B.prototype,"supportsAddAttachments",null),e([r()],B.prototype,"supportsAttachments",null),e([r()],B.prototype,"supportsDeleteAttachments",null),e([r()],B.prototype,"supportsResizeAttachments",null),e([r()],B.prototype,"supportsUpdateAttachments",null),e([r()],B.prototype,"syncTemplateOnChangesEnabled",null),e([r({constructOnly:!0})],B.prototype,"tableController",null),e([r({constructOnly:!0})],B.prototype,"tableParent",null),e([r()],B.prototype,"tableTemplate",null),e([r()],B.prototype,"tableTemplateOverride",null),e([r()],B.prototype,"title",void 0),e([r()],B.prototype,"timeExtent",null),e([r()],B.prototype,"timeZone",null),e([r()],B.prototype,"view",null),e([r({type:_}),P(["cell-click","cell-dblclick","cell-pointerover","cell-pointerout","cell-keydown","column-reorder","show-related-table"])],B.prototype,"viewModel",void 0),e([r()],B.prototype,"visibleColumns",null),e([r({type:M,nonNullable:!0})],B.prototype,"visibleElements",void 0),e([r({type:M})],B.prototype,"visibleElementsOverride",null),B=j=e([c("esri.widgets.FeatureTable")],B);const N=B;export{N as default};
5
+ import{__decorate as e}from"tslib";import"../intl.js";import{isSome as t}from"../core/arrayUtils.js";import{watch as i,on as l,sync as o,initial as n}from"../core/reactiveUtils.js";import{renderingSanitizer as s}from"../core/sanitizerUtils.js";import{formatFileSize as a}from"../core/unitFormatUtils.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import{subclass as c}from"../core/accessorSupport/decorators/subclass.js";import{isLayerFromCatalog as d}from"../layers/catalog/catalogUtils.js";import{isKnowledgeGraphLayer as h,isMapImageLayer as m,isSubtypeGroupLayer as p}from"../layers/support/layerUtils.js";import u from"../tables/AttributeTableTemplate.js";import g from"./Widget.js";import{isSupportedImage as w,getCalciteIconForAttachment as b}from"./Attachments/support/attachmentUtils.js";import{loadPromptComponents as v,Prompt as y}from"./Editor/components/Prompt.js";import f from"./FeatureTable/ColumnMenuVisibleElements.js";import _ from"./FeatureTable/FeatureTableViewModel.js";import M from"./FeatureTable/VisibleElements.js";import{isGroupColumn as C}from"./FeatureTable/support/columnUtils.js";import{loadFieldColumnComponents as A,isIFeatureTableSupportedLayer as S,isIFeatureTableSupportedLayerWithAttachments as T,getRelationshipIdsToShow as E}from"./FeatureTable/support/tableUtils.js";import{loadCalciteComponents as V}from"./support/componentsUtils.js";import{globalCss as I}from"./support/globalCss.js";import{getIconForLayer as R}from"./support/iconUtils.js";import{storeNode as k,discardNode as x}from"./support/widgetUtils.js";import{messageBundle as D}from"./support/decorators/messageBundle.js";import{vmEvent as P}from"./support/decorators/vmEvent.js";import{tsx as O}from"./support/jsxFactory.js";import"@arcgis/toolkit/dom";import{substitute as F}from"../intl/substitute.js";var j;const z="esri-feature-table",L=`${z}__attachments-view`,U={base:z,content:`${z}__content`,menuPopover:`${z}__menu-popover`,layerDropdownMenu:`${z}__layer-switcher-menu`,tableContainer:`${z}__table-container`,tableContainerWithAttachments:`${z}__table-container--attachments`,tableNavigation:`${z}__table-navigation`,attachmentsView:L,attachmentsViewContent:`${L}__content`,attachmentsViewDropArea:`${L}__drop-area`,attachmentsViewIcon:`${L}__icon`,attachmentsViewInformation:`${L}__information`,attachmentsViewList:`${L}__list`,attachmentsViewListFileSize:`${L}__list__filesize`,attachmentsViewListItemDelete:`${L}__list-item--delete`,attachmentsViewListThumbnail:`${L}__list__thumbnail`,expanded:`${z}__expanded`,collapsed:`${z}__collapsed`},$={chevronRight:"chevron-right",clearSelection:"clear-selection",downloadTo:"download-to",exclamationMarkTriangle:"exclamation-mark-triangle",exportToCSV:"file-csv",folderOpen:"folder-open",delete:"trash",launch:"launch",layers:"layers",moveUp:"move-up",plus:"plus",refresh:"refresh",replaceImage:"replace-image",save:"save",showAll:"selection-x",showColumn:"show-column",showSelected:"selection-filter",upload:"upload",zoomToSelection:"zoom-to-object"};let B=j=class extends g{constructor(e,t){super(e,t),this._attachmentsInput=null,this._columnVisibilityActions=new Map,this.attachmentsList=null,this.description=null,this.disabled=!1,this.navigationScale="m",this.title=null,this.viewModel=new _,this.visibleElements=new M,this._showDeletePrompt=this._showDeletePrompt.bind(this),this._onDeleteSelectionClick=this._onDeleteSelectionClick.bind(this)}initialize(){this.addHandles([i(()=>[this.isQueryingOrSyncing,this.editingEnabled],()=>this.scheduleRender()),i(()=>[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),i(()=>this._effectiveVisibleElements.selectionColumn,e=>{this.grid&&(this.grid.selectionColumnEnabled=e)},n),l(()=>this.viewModel,"show-related-table",e=>this._onShowRelatedTable(e)),i(()=>this.editingEnabled,()=>{const{attachmentsViewOptions:e}=this;this.clearPrompt(),e&&(e.form?.reset(),e.candidates=null)})])}loadDependencies(){return Promise.all([V({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"),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"),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")}),v(),A()])}destroy(){this.drainRelatedTables(),this.clearPrompt()}get _effectiveDescription(){const{description:e}=this;return null!=e?s.sanitize("function"==typeof e?e():e):void 0}get _effectiveLayers(){const{layer:e,layers:t}=this,i=t?.length?t.filter(S):[],l=i.length?i:[...this._viewLayers];return e&&!l.includes(e)&&l.push(e),l}get _effectiveTitle(){const{layer:e,messages:t,state:i,highlightIds:l,title:o,size:n}=this;if(o)return s.sanitize("function"==typeof o?o():o);if(!e)return t.noLayer;switch(i){case"disabled":return t.errorLayer;case"ready":case"loading":return t.loading;case"error":return t.errorData}return F(t.header,{title:s.sanitize(e.title),count:n,selected:l.length})}get _effectiveVisibleElements(){return this.visibleElementsOverride??this.visibleElements}get _filteredTables(){const e=this.relatedTables.toArray(),t=1===e.length;return this.allRelatedTablesVisible?e:t?[e[0]]:this._shouldShowAttachmentsView?e.slice(-1):e.slice(-2)}get _hasAttachmentsViewError(){return null!=this.attachmentsViewOptions.error}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._showColumnsVisibilityAction)}get _shouldShowGrid(){return this.allRelatedTablesVisible||1===this.relatedTables.length&&!this._shouldShowAttachmentsView}get _shouldShowMenu(){const{header:e,menu:t}=this._effectiveVisibleElements;return!(!e||!t||!this._hasDefaultMenuItems&&!this._hasCustomMenuItems)}get _shouldShowAttachmentsView(){return!(null==this.attachmentsViewOptions.objectId&&!this.relatedTables.some(e=>null!=e.attachmentsViewOptions.objectId))}get _showClearSelectionAction(){return!(!this.highlightIds.length||!this._effectiveVisibleElements.menuItems?.clearSelection||this.relatedTables.length||this._shouldShowAttachmentsView)}get _showColumnsVisibilityAction(){const{header:e,menu:t,menuItems:i}=this._effectiveVisibleElements;return!(!(e&&t&&i?.toggleColumns)||this.showRelatedTableCallback||this.allRelatedTablesVisible||this._shouldShowAttachmentsView)}get _showDeleteSelectionAction(){return!(!(this.editingEnabled&&this.highlightIds.length&&this._effectiveVisibleElements.menuItems?.deleteSelection&&this.layer?.capabilities?.operations?.supportsDelete)||this.relatedTables.length||this._shouldShowAttachmentsView)}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(){const e=!!this.relatedTable||this._shouldShowAttachmentsView;return!this.tableParent&&e}get _showRefreshDataAction(){return!!this._effectiveVisibleElements.menuItems?.refreshData}get _showSelectedRecordsShowSelectedAction(){const e=this.objectIds.length,t=this.highlightIds.length;return!(!t||!this._effectiveVisibleElements.menuItems?.selectedRecordsShowSelectedToggle||e&&t===e||this.relatedTables.length||this._shouldShowAttachmentsView)}get _showSelectedRecordsShowAllAction(){return!(!this._effectiveVisibleElements.menuItems?.selectedRecordsShowAllToggle||!this.objectIds.length||this.relatedTables.length)}get _showZoomToSelectionAction(){return!(!this.view||!this.highlightIds.length||this.effectiveTable.layer?.isTable||!this._effectiveVisibleElements.menuItems?.zoomToSelection)}get _viewLayers(){const e=this.view?.map;if(!e)return[];const t=new Set,i=e=>{!S(e)||p(e)||t.has(e)||"sublayer"===e.type&&!e.capabilities?.operations?.supportsQuery||(e.load(),t.add(e))},l=e=>{d(e)||"catalog-footprint"===e.type||(h(e)?(e.load(),e.layers?.forEach(i),e.tables?.forEach(i)):m(e)?(e.loadAll(),e.allSublayers?.forEach(i),e.subtables?.forEach(i)):p(e)?(e.loadAll(),e.sublayers?.forEach(i)):i(e))};return e.allLayers.forEach(l),e.allTables.forEach(l),[...t.values()]}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 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 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 definitionExpression(){return this.viewModel.definitionExpression}set definitionExpression(e){this.viewModel.definitionExpression=e}set container(e){super.container=e}get editingEnabled(){return this.viewModel.editingEnabled}set editingEnabled(e){this.viewModel.editingEnabled=e}get effectiveSize(){return this.viewModel.effectiveSize}get effectiveTable(){return this.relatedTable||this}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 groupColumns(){return this.viewModel.groupColumns}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"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 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 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 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 relatedTables(){return this.viewModel.relatedTables}set relatedTables(e){this.viewModel.relatedTables=e}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 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 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 visibleColumns(){return this.viewModel.visibleColumns}get visibleElementsOverride(){const{attachmentsViewOptions:e,relatedTable:t,tableController:i,visibleElements:l}=this,{columnDescriptions:o,columnMenus:n,tooltips:s}=l,a=null!=e.objectId;if(t)return new M({columnDescriptions:o,columnMenus:n,tooltips:s,close:l.close,header:l.header,layerDropdown:l.layerDropdown,layerDropdownIcons:l.layerDropdownIcons,menu:l.menu,menuItems:l.menuItems,progress:l.progress,selectionColumn:!1,columnMenuItems:new f({sortAscending:!1,sortDescending:!1})});if(i){const e=i.relatedTable===this,t=i.allRelatedTablesVisible,r=e&&l.selectionColumn&&!t&&!a,c=e&&!t&&!a;return new M({columnDescriptions:o,columnMenus:n,tooltips:s,selectionColumn:r,close:!1,header:!1,layerDropdown:!1,menu:!1,progress:!1,columnMenuItems:new f({sortAscending:c,sortDescending:c})})}return a?new M({columnDescriptions:o,columnMenus:n,tooltips:s,close:l.close,header:l.header,layerDropdown:l.layerDropdown,layerDropdownIcons:l.layerDropdownIcons,menu:l.menu,menuItems:l.menuItems,progress:l.progress,selectionColumn:!1,columnMenuItems:new f({sortAscending:!1,sortDescending:!1})}):null}clearSelectionFilter(){this.viewModel.clearSelectionFilter()}async deleteAttachments(e,t,i){null!=e&&t?.length&&(i?this._showDeleteAttachmentPrompt(e,t):await this.viewModel.deleteAttachments(e,t))}deleteSelection(e){return this.highlightIds.length?e?(this._showDeletePrompt(),this.scheduleRender(),Promise.resolve()):this.viewModel.deleteSelection():Promise.resolve()}async downloadAttachmentById(e,t){return this.viewModel.downloadAttachmentById(e,t)}drainRelatedTables(){this.viewModel.drainRelatedTables()}exportSelectionToCSV(e){return this.viewModel.exportSelectionToCSV(e)}filterBySelection(){this.viewModel.filterBySelection()}findColumn(e){return this.viewModel.findColumn(e)}goToPage(e){this.viewModel.goToPage(e)}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()}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)}zoomToSelection(){this.effectiveTable.viewModel.zoomToSelection()}render(){const{_effectiveVisibleElements:e,isQueryingOrSyncing:t,menuConfig:i,state:l}=this;return O("div",{bind:this,class:this.classes(U.base,I.widget)},O("calcite-panel",{bind:this,class:U.content,closable:e.close,description:this._effectiveDescription,disabled:this.disabled||"disabled"===l&&!this._effectiveLayers?.length,heading:e.header?this._effectiveTitle:void 0,key:"table-content",loading:"loading"===l,menuOpen:!!i?.open,overlayPositioning:"fixed",onCalcitePanelClose:e=>{e.currentTarget.closed=!1,this.emit("close")}},e.progress?O("calcite-progress",{type:t?"indeterminate":"determinate"}):null,this._showLayerDropdown?this._renderLayerDropdown():null,this._renderColumnVisibilityAction(),this._renderHeaderMenuActions(),this._renderNavigationBar(),this._renderTables(),this._renderError()),this._renderColumnVisibilityPopover(),this._renderPrompt())}_renderTables(){const{grid:e,relatedTables:t}=this,i=this.classes(U.tableContainer);if(t.length){const l=this.classes(U.base,this.allRelatedTablesVisible?U.expanded:U.collapsed,this._shouldShowAttachmentsView?U.tableContainerWithAttachments:void 0);return O("div",{class:i},O("calcite-panel",{overlayPositioning:"fixed"},O("div",null,[this._shouldShowGrid?O("div",{class:l},e?.render(),this._renderPagination()):void 0,...this._filteredTables.map(e=>{const i=t.indexOf(e);return O("div",{class:l,key:`related-${i}`},e.render())}),,])))}return null!=this.attachmentsViewOptions.objectId?O("div",{class:i},O("calcite-panel",{overlayPositioning:"fixed"},O("div",null,[O("div",{class:this.classes(U.base,U.collapsed)},e?.render(),this._renderPagination()),this._renderAttachmentsView()]))):[O("div",{class:i},e?.render()),this._renderPagination()]}_renderPagination(){if(this.paginationEnabled)return O("calcite-pagination",{pageSize:1,startItem:this.pageIndex+1,totalItems:this.pageCount,onCalcitePaginationChange:e=>this.goToPage(e.currentTarget.startItem-1)})}_renderError(){const{messages:e}=this;return O("calcite-alert",{autoClose:!0,autoCloseDuration:"fast",icon:$.exclamationMarkTriangle,kind:"danger",label:e.errorOccured,open:this._hasAttachmentsViewError,slot:"alerts",onCalciteAlertClose:()=>{this.attachmentsViewOptions.error=null}},O("span",{slot:"message"},e.errorOccured))}_renderPrompt(){return this.prompt?O(y,{...this.prompt,headingLevel:2}):void 0}_showDeletePrompt(){const{messages:e,messagesCommon:t}=this,i=F(e.deleteSelectionCount,{count:this.highlightIds.length});this.showPrompt({title:i,message:e.deleteRecordsRemoved,context:"danger",actions:{primary:{label:t.delete,action:this._onDeleteSelectionClick},secondary:{label:e.keepRecords,action:()=>this.clearPrompt()}}})}_showDeleteAttachmentPrompt(e,t){const{messages:i,messagesCommon:l}=this,o=F(i.deleteAttachmentCount,{count:t.length});this.showPrompt({title:o,message:i.deleteAttachmentConfirmation,context:"danger",actions:{primary:{label:l.delete,action:async()=>{try{await this.deleteAttachments(e,t,!1)}finally{this.clearPrompt()}}},secondary:{label:l.cancel,action:()=>this.clearPrompt()}}})}async _onDeleteSelectionClick(){try{await this.viewModel.deleteSelection()}finally{this.clearPrompt()}}_renderHeaderMenuAction(e){const{disabled:t,hidden:i,icon:l,text:o,clickFunction:n}=e;if(!i)return O("calcite-action",{disabled:t??this.menuConfig?.disabled,icon:l??void 0,key:o,onclick:()=>n(),slot:"header-menu-actions",text:o,textEnabled:!0,title:o})}_renderHeaderMenuActions(){return this._shouldShowMenu?[this._renderDefaultHeaderMenuActions(),this._renderCustomHeaderMenuActions()]:[]}_renderDefaultHeaderMenuActions(){if(!this._hasDefaultMenuItems)return[];const{messages:e}=this;return[this._showRefreshDataAction&&{icon:$.refresh,text:e.refreshData,clickFunction:()=>this.refresh()},this._showDeleteSelectionAction&&{icon:$.delete,text:e.deleteSelection,clickFunction:()=>this.deleteSelection(!0)},this._showClearSelectionAction&&{icon:$.clearSelection,text:e.clearSelection,clickFunction:()=>this.highlightIds?.removeAll()},this._showZoomToSelectionAction&&{icon:$.zoomToSelection,text:e.zoomToSelection,clickFunction:()=>this.zoomToSelection()},this._showSelectedRecordsShowSelectedAction&&{icon:$.showSelected,text:e.showSelected,clickFunction:()=>{const{objectIds:e}=this;e.removeAll(),e.addMany(this.highlightIds.toArray())}},this._showSelectedRecordsShowAllAction&&{icon:$.showAll,text:e.showAllRecords,clickFunction:()=>this.objectIds.removeAll()},this._showExportSelectionToCSVAction&&{icon:$.exportToCSV,text:e.exportSelectionCSV,clickFunction:()=>this.exportSelectionToCSV()}].filter(t).map(e=>e&&this._renderHeaderMenuAction(e))}_renderCustomHeaderMenuActions(){return this.menuConfig?.items?.map(({disabled:e,hidden:t,icon:i,label:l,clickFunction:o})=>this._renderHeaderMenuAction({hidden:"function"==typeof t?t():t,icon:i,text:l,disabled:e,clickFunction:e=>o(e)}))??[]}_renderColumnVisibilityAction(){if(!this._showColumnsVisibilityAction)return[];const{_columnVisibilityActions:e,effectiveTable:t,id:i}=this,l=this.messages.toggleColumns;return O("calcite-action",{afterCreate:t=>e.set(i,t),afterRemoved:()=>e.delete(i),appearance:"transparent",bind:this,disabled:t.menuConfig?.disabled,icon:$.showColumn,id:`${i}__toggle-columns-action`,slot:"header-actions-end",text:l},this._effectiveVisibleElements.tooltips?O("calcite-tooltip",{closeOnClick:!0,overlayPositioning:"fixed",placement:"bottom-end",slot:"tooltip"},l):null)}_renderColumnVisibilityPopover(){if(!this._showColumnsVisibilityAction||this.effectiveTable.menuConfig?.disabled)return;const{effectiveTable:e}=this,t=this.messages.toggleColumns;return O("calcite-popover",{autoClose:!0,class:U.menuPopover,label:t,overlayPositioning:"fixed",placement:"top-end",pointerDisabled:!0,referenceElement:this._columnVisibilityActions.get(this.id)},O("calcite-list",{displayMode:"nested",filterEnabled:!0,filterPlaceholder:t,label:t,selectionMode:"multiple"},e.columns.toArray().map(t=>{const i=C(t)?t.columns?.map(t=>this._renderColumnListItem({column:t,table:e,ignoreSelect:!0})):void 0;return this._renderColumnListItem({column:t,table:e,items:i})})))}_renderColumnListItem(e){const{column:t,table:i,items:l,ignoreSelect:o}=e,{effectiveLabel:n,fieldName:s,hidden:a}=t;return O("calcite-list-item",{expanded:!(!l?.length||a)||void 0,key:`toggle-columns__item-${s}`,label:n,selected:!a,value:s,onCalciteListItemSelect:e=>{o&&e.stopPropagation(),i.toggleColumnVisibility(e.currentTarget.value)}},l)}_renderLayerDropdown(){const e=this.messages.selectALayer;return O("div",{class:U.layerDropdownMenu,key:`${this.id}-layerDropdown`,slot:"header-actions-start"},O("calcite-dropdown",{bind:this,maxItems:5,overlayPositioning:"fixed",placement:"bottom-start"},O("calcite-action",{icon:$.layers,slot:"trigger",text:e,title:e}),O("calcite-dropdown-group",{selectionMode:"single"},this._effectiveLayers.map((e,t)=>this._renderLayerDropdownItem(e,t))??null)))}_renderLayerDropdownItem(e,t){const i=this.visibleElements.layerDropdownIcons;return O("calcite-dropdown-item",{iconStart:i?R(e):void 0,key:`dropdown-item-${t}`,label:e.title??"",selected:e===this.layer,value:e.id,onCalciteDropdownItemSelect:()=>{this.layer=e}},e.title)}_onRelatedNavigationItemClick(e){this.viewModel.drainRelatedTablesAboveIndex(e)}_collapseRelatedTable(e){this.viewModel.collapseRelatedTable(this.effectiveTable,e)}_onShowRelatedTable(e){this.showRelatedTableCallback||(this._collapseRelatedTable(e),this._createRelatedTable(e))}async _createRelatedTable(e){const{editingEnabled:t,effectiveTable:i,paginationEnabled:l,pageSize:o,view:n,viewModel:s}=this,{layer:a,objectId:r,relatedLayer:c,relationshipId:d}=e;await a.load();const h=this.attachmentsEnabled&&T(a),m=new j({layer:a,attachmentsEnabled:h,editingEnabled:t,paginationEnabled:l,pageSize:o,relatedRecordsEnabled:!0,relationshipConfig:{objectId:r,relatedLayer:c,relationshipId:d},relationshipColumnConfigs:E(a,d),tableController:this,tableParent:i,view:n,showRelatedTableCallback:e=>s.emit("show-related-table",e)});this.relatedTables.add(m),this.scheduleRender()}_renderAttachmentsView(){const{attachmentInfos:e,mode:t,objectId:i}=this.attachmentsViewOptions;return"file"!==t&&e.length&&null!=i?this._renderAttachmentsViewList():this._renderAttachmentsViewFilePane()}_renderAttachmentsViewFilePane(){const{attachmentsViewOptions:e,isSyncingAttachments:t,supportsAddAttachments:i,messages:l,messagesUnits:o}=this,{attachmentId:n,attachmentInfos:s,candidates:r,objectId:c}=e,d=s.find(e=>e.id===n),h=s.length,m=r?.length,p=d?O("calcite-label",{alignment:"center",key:"replace-file-node",scale:"l"},l.replaceFile):void 0,u=m?void 0:O("calcite-label",{alignment:"center",key:"message-node",scale:"m"},i?null==c?l.noFeature:l.dragAndDropToUpload:l.editingRestricted),g=Array.from(r??[]).pop(),w=g?O("calcite-label",{key:"filename-node"},g.name):void 0,b=i&&null!=c,v=b&&m,y=O("input",{afterCreate:k,afterRemoved:x,afterUpdate:k,bind:this,"data-node-ref":"_attachmentsInput",files:r,hidden:!0,name:"attachment",onchange:e=>this._onAttachmentsViewCandidateChange(e),type:"file"}),f=b?O("calcite-button",{appearance:"outline-fill",bind:this,disabled:t,iconStart:$.folderOpen,key:"select-node",loading:!1,onclick:()=>{this._attachmentsInput&&(this._attachmentsInput.value="",this._attachmentsInput.click())},width:"full"},l.selectFile):void 0,_=v?O("calcite-button",{appearance:"outline-fill",bind:this,disabled:t,iconStart:$.save,key:"save-node",loading:t,onclick:()=>{this.saveAttachmentsViewForm()},width:"full"},d?l.updateAttachment:l.addAttachment):void 0,M=h||m?O("calcite-button",{appearance:"transparent",bind:this,disabled:t,key:"cancel-node",onclick:()=>{this._attachmentsInput&&(this._attachmentsInput.value=""),e.reset(),e.attachmentInfos?.length&&(e.mode="list")},width:"full"},this.messagesCommon.cancel):void 0;return[O("div",{class:U.attachmentsView,key:"attachments-view"},O("div",{class:U.attachmentsViewContent,key:"attachments-view-content"},O("div",{bind:this,class:U.attachmentsViewDropArea,ondragover:e=>e.preventDefault(),ondrop:this._onAttachmentsViewDrop},O("calcite-icon",{class:U.attachmentsViewIcon,icon:$.upload,scale:"l"}),p,u,O("form",{afterCreate:t=>e.form=t,afterRemoved:()=>e.form=null,bind:this,key:"attachments-form"},O("fieldset",null,w,y,f,_,M)))),null!=c&&null!=d?O("div",{class:U.attachmentsViewInformation,key:"information"},this._renderAttachmentsViewThumbnail(d,200),O("label",{key:"file-label"},l.fileName),O("span",{key:"file-span"},d.name),O("label",{key:"size-label"},l.size),O("span",{key:"size-span"},a(o,d.size??0))):void 0)]}_renderAttachmentsViewList(){const{attachmentsViewOptions:e,isSyncingAttachments:t,messages:i,messagesUnits:l,supportsDeleteAttachments:o,supportsUpdateAttachments:n}=this,{attachmentInfos:s,objectId:r}=e;return O("calcite-list",{afterCreate:k,afterRemoved:x,afterUpdate:k,bind:this,class:U.attachmentsViewList,"data-node-ref":"attachmentsList",key:`attachments-list-${r}`,label:i?.attachments,loading:t,ondragover:e=>e.preventDefault(),ondrop:this._onAttachmentsViewDrop,selectionMode:"multiple",onCalciteListChange:()=>this.scheduleRender()},...s?.map(t=>{const{id:s,name:c,size:d,url:h}=t,m=a(l,d??0);return O("calcite-list-item",{afterRemoved:()=>this.scheduleRender(),key:`attachment-${s}`,label:c,value:s},this._renderAttachmentsViewListThumbnail(t),O("span",{class:U.attachmentsViewListFileSize,slot:"actions-end",title:m},m),O("calcite-action",{appearance:"transparent",icon:$.downloadTo,key:`download-attachment-${s}`,label:`${c}`,onclick:e=>{e.preventDefault(),this.downloadAttachmentById(r??-1,s)},slot:"actions-end",text:i.downloadAttachment,title:i.downloadAttachment}),n&&null!=r?O("calcite-action",{appearance:"transparent",disabled:!n,icon:$.replaceImage,key:`replace-attachment-${s}`,label:`${c}`,onclick:()=>{e.mode="file",e.attachmentId=s},slot:"actions-end",text:i.updateAttachment,title:i.updateAttachment}):void 0,O("calcite-action",{appearance:"transparent",icon:$.launch,key:`launch-attachment-${s}`,label:`${c}`,onclick:()=>{h&&window.open(h,"_blank")},slot:"actions-end",text:i.viewAttachment,title:i.viewAttachment}),o&&null!=r?O("calcite-action",{appearance:"transparent",class:U.attachmentsViewListItemDelete,disabled:!o,icon:$.delete,key:`delete-attachment-${s}`,label:`${c}`,onclick:()=>{this.deleteAttachments(r,[s],!0)},slot:"actions-end",text:i.deleteAttachment,title:i.deleteAttachment}):void 0)}))}_renderAttachmentsViewListThumbnail(e){return O("div",{class:U.attachmentsViewListThumbnail,slot:"content-start"},O("a",{href:e.url??"",rel:"noreferrer",target:"_blank"},this._renderAttachmentsViewThumbnail(e)))}_renderAttachmentsViewThumbnail(e,t=64){const{contentType:i,name:l,size:o,url:n}=e,s=`${n}${n?.includes("?")?"&":"?"}w=${t}&s=${o}`;return this.supportsResizeAttachments&&w(i)?O("img",{alt:l,key:`thumbnail-image-${l}`,src:s,title:l}):O("calcite-icon",{icon:b(i),key:`thumbnail-icon-${l}`,scale:"l",textLabel:l,title:l})}_onAttachmentsViewCandidateChange({target:e}){this.attachmentsViewOptions.candidates=e?.files}_onAttachmentsViewDrop(e){e.preventDefault(),(this.supportsAddAttachments||this.supportsUpdateAttachments)&&this.attachmentsViewOptions.set({mode:"file",candidates:e.dataTransfer?.files})}_renderNavigationBar(){const{effectiveTable:e,messages:t,messagesCommon:i,navigationScale:l,relatedTable:o,relatedTables:n}=this;if(!this._shouldShowNavigationBar)return;const{attachmentsList:s,attachmentsViewOptions:a,layer:r,supportsAddAttachments:c,supportsDeleteAttachments:d}=e;if(!r)return;const{attachmentInfos:h,objectId:m}=a,p=null!=m,u=h.length,g=s?.selectedItems?.length??0,w=`${r.objectIdField}: ${m}`,b=F(t.selectedCount,{count:g}),v=F(t.attachmentsCount,{count:u}),y=p?O("calcite-action",{bind:this,icon:$.chevronRight,iconFlipRtl:!0,key:"navigation-feature",onclick:()=>e.scrollToRow(m),scale:l,text:w,textEnabled:!0,title:w}):void 0,f=p?O("calcite-action",{icon:$.chevronRight,iconFlipRtl:!0,key:"navigation-attachments-label",label:v,onclick:()=>{u>0&&(a.mode="list")},scale:l,text:v,textEnabled:!0,title:v}):void 0,_=p?O("calcite-chip",{closable:!0,closed:0===g,key:"navigation-chip",kind:"inverse",label:b,scale:l,selected:!0,title:b,value:"selected",onCalciteChipClose:()=>s?.selectedItems?.forEach(e=>e.selected=!1)},b):void 0,M=o?O("calcite-label",{layout:"inline",scale:l},t.showAllTables,O("calcite-switch",{checked:this.allRelatedTablesVisible,scale:l,onCalciteSwitchChange:e=>this.showAllRelatedTables=!!e.currentTarget.checked})):void 0,C=p&&"list"===a.mode&&null!=m&&g&&d?O("calcite-action",{icon:$.delete,iconFlipRtl:!0,key:"attachments-trash-all",onclick:()=>{e.deleteAttachments(m,s?.selectedItems?.map(e=>e.value)??[],!0)},scale:l,text:i.delete,textEnabled:!0,title:F(t.deleteAttachmentCount,{count:g})}):void 0,A=p&&"list"===a.mode&&c?O("calcite-action",{bind:this,icon:$.plus,iconFlipRtl:!0,key:"attachments-add",onclick:()=>{a.attachmentId=null,a.mode="file"},scale:l,text:t.addAttachment,textEnabled:!0,title:t.addAttachment}):void 0;return O("div",{class:U.tableNavigation,key:"table-nav"},O("calcite-action",{icon:$.moveUp,iconFlipRtl:!0,key:"go-back",onclick:()=>{o&&this.drainRelatedTables(),e.attachmentsViewOptions.objectId=null},scale:l,text:this.layer?.title??"",textEnabled:!1,title:o?t.exitRelatedRecords:t.exitAttachments}),n.toArray().map((e,t)=>this._renderRelatedTableNavigationAction(e,t)),y,f,O("div",null,_,M,C,A))}_renderRelatedTableNavigationAction(e,t){const i=this._getLabelForRelatedTableNavigationAction(e);return O("calcite-action",{icon:$.chevronRight,iconFlipRtl:!0,key:t,onclick:()=>this._onRelatedNavigationItemClick(t),scale:this.navigationScale,text:i,textEnabled:!0,title:e.layer?.title||""})}_getLabelForRelatedTableNavigationAction(e){const t=e.layer?.title;if(!t)return"";const{relatedTables:i}=this;if(i.length<=1)return t;return i.indexOf(e)!==i.length-1&&t.length>20?`${t.slice(0,20)}...`:t}};e([r()],B.prototype,"_attachmentsInput",void 0),e([r()],B.prototype,"_columnVisibilityActions",void 0),e([r()],B.prototype,"_effectiveDescription",null),e([r()],B.prototype,"_effectiveLayers",null),e([r()],B.prototype,"_effectiveTitle",null),e([r()],B.prototype,"_effectiveVisibleElements",null),e([r()],B.prototype,"_filteredTables",null),e([r()],B.prototype,"_hasAttachmentsViewError",null),e([r()],B.prototype,"_hasCustomMenuItems",null),e([r()],B.prototype,"_hasDefaultMenuItems",null),e([r()],B.prototype,"_shouldShowGrid",null),e([r()],B.prototype,"_shouldShowMenu",null),e([r()],B.prototype,"_shouldShowAttachmentsView",null),e([r()],B.prototype,"_showClearSelectionAction",null),e([r()],B.prototype,"_showColumnsVisibilityAction",null),e([r()],B.prototype,"_showDeleteSelectionAction",null),e([r()],B.prototype,"_showExportSelectionToCSVAction",null),e([r()],B.prototype,"_showLayerDropdown",null),e([r()],B.prototype,"_shouldShowNavigationBar",null),e([r()],B.prototype,"_showRefreshDataAction",null),e([r()],B.prototype,"_showSelectedRecordsShowSelectedAction",null),e([r()],B.prototype,"_showSelectedRecordsShowAllAction",null),e([r()],B.prototype,"_showZoomToSelectionAction",null),e([r()],B.prototype,"_viewLayers",null),e([r()],B.prototype,"attachmentsList",void 0),e([r({readOnly:!0})],B.prototype,"grid",null),e([r()],B.prototype,"actionColumn",null),e([r()],B.prototype,"actionColumnConfig",null),e([r({readOnly:!0})],B.prototype,"activeFilters",null),e([r({readOnly:!0})],B.prototype,"activeSortOrders",null),e([r()],B.prototype,"allColumns",null),e([r({readOnly:!0})],B.prototype,"allRelatedTablesVisible",null),e([r()],B.prototype,"allVisibleColumns",null),e([r()],B.prototype,"attachmentsColumns",null),e([r()],B.prototype,"attachmentsEnabled",null),e([r()],B.prototype,"attachmentsViewOptions",null),e([r({type:u})],B.prototype,"attributeTableTemplate",null),e([r()],B.prototype,"autoRefreshEnabled",null),e([r()],B.prototype,"clearPrompt",null),e([r()],B.prototype,"columnPerformanceModeEnabled",null),e([r()],B.prototype,"columnReorderingEnabled",null),e([r({readOnly:!0})],B.prototype,"columns",null),e([r()],B.prototype,"definitionExpression",null),e([r()],B.prototype,"description",void 0),e([r()],B.prototype,"disabled",void 0),e([r()],B.prototype,"editingEnabled",null),e([r()],B.prototype,"effectiveSize",null),e([r()],B.prototype,"effectiveTable",null),e([r()],B.prototype,"fieldColumns",null),e([r()],B.prototype,"filterGeometry",null),e([r()],B.prototype,"filterBySelectionEnabled",null),e([r()],B.prototype,"groupColumns",null),e([r()],B.prototype,"hiddenFields",null),e([r()],B.prototype,"highlightEnabled",null),e([r()],B.prototype,"highlightIds",null),e([r()],B.prototype,"icon",null),e([r()],B.prototype,"initialSize",null),e([r()],B.prototype,"isQueryingOrSyncing",null),e([r()],B.prototype,"isSyncingAttachments",null),e([r()],B.prototype,"label",null),e([r()],B.prototype,"layer",null),e([r()],B.prototype,"layers",null),e([r()],B.prototype,"layerView",null),e([r()],B.prototype,"maxSize",null),e([r(),D("esri/widgets/FeatureTable/t9n/FeatureTable")],B.prototype,"messages",null),e([r(),D("esri/t9n/common")],B.prototype,"messagesCommon",null),e([r(),D("esri/core/t9n/Units")],B.prototype,"messagesUnits",null),e([r(),D("esri/widgets/support/t9n/uriUtils")],B.prototype,"messagesURIUtils",null),e([r()],B.prototype,"menuConfig",null),e([r()],B.prototype,"multipleSelectionEnabled",null),e([r()],B.prototype,"multiSortEnabled",null),e([r()],B.prototype,"multipleSortPriority",null),e([r()],B.prototype,"navigationScale",void 0),e([r()],B.prototype,"noDataMessage",null),e([r()],B.prototype,"objectIds",null),e([r()],B.prototype,"outFields",null),e([r()],B.prototype,"pageCount",null),e([r()],B.prototype,"pageIndex",null),e([r()],B.prototype,"pageSize",null),e([r()],B.prototype,"paginationEnabled",null),e([r()],B.prototype,"prompt",null),e([r()],B.prototype,"relatedRecordsEnabled",null),e([r()],B.prototype,"relatedTable",null),e([r()],B.prototype,"relatedTables",null),e([r()],B.prototype,"relationship",null),e([r()],B.prototype,"relationshipColumnConfigs",null),e([r()],B.prototype,"relationshipColumns",null),e([r()],B.prototype,"relationshipConfig",null),e([r()],B.prototype,"relationshipInfos",null),e([r()],B.prototype,"returnGeometryEnabled",null),e([r()],B.prototype,"returnMEnabled",null),e([r()],B.prototype,"returnZEnabled",null),e([r()],B.prototype,"rowHighlightIds",null),e([r()],B.prototype,"selectionSource",null),e([r()],B.prototype,"showAllRelatedTables",null),e([r()],B.prototype,"showPrompt",null),e([r()],B.prototype,"showRelatedTableCallback",null),e([r()],B.prototype,"size",null),e([r({readOnly:!0})],B.prototype,"state",null),e([r()],B.prototype,"supportsAddAttachments",null),e([r()],B.prototype,"supportsAttachments",null),e([r()],B.prototype,"supportsDeleteAttachments",null),e([r()],B.prototype,"supportsResizeAttachments",null),e([r()],B.prototype,"supportsUpdateAttachments",null),e([r()],B.prototype,"syncTemplateOnChangesEnabled",null),e([r({constructOnly:!0})],B.prototype,"tableController",null),e([r({constructOnly:!0})],B.prototype,"tableParent",null),e([r()],B.prototype,"tableTemplate",null),e([r()],B.prototype,"tableTemplateOverride",null),e([r()],B.prototype,"title",void 0),e([r()],B.prototype,"timeExtent",null),e([r()],B.prototype,"timeZone",null),e([r()],B.prototype,"view",null),e([r({type:_}),P(["cell-click","cell-dblclick","cell-pointerover","cell-pointerout","cell-keydown","column-reorder","show-related-table"])],B.prototype,"viewModel",void 0),e([r()],B.prototype,"visibleColumns",null),e([r({type:M,nonNullable:!0})],B.prototype,"visibleElements",void 0),e([r({type:M})],B.prototype,"visibleElementsOverride",null),B=j=e([c("esri.widgets.FeatureTable")],B);const N=B;export{N as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../Graphic.js";import{isSome as i}from"../../core/arrayUtils.js";import s from"../../core/Error.js";import r from"../../core/Logger.js";import{debounce as o,isAbortError as a}from"../../core/promiseUtils.js";import n from"../../core/ReactiveSet.js";import{watch as l,when as u,sync as h}from"../../core/reactiveUtils.js";import{property as c}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";import d from"../../geometry/Point.js";import{project as g,initializeProjection as f}from"../../geometry/projectionUtils.js";import m from"../../geometry/SpatialReference.js";import{getPointFromGeometry as y}from"../../geometry/support/geometryUtils.js";import{geographicToWebMercator as w}from"../../geometry/support/webMercatorUtils.js";import{fallbackObjectIDAttribute as F}from"../../layers/LayerConstants.js";import v from"../../symbols/SimpleFillSymbol.js";import{getDisplayedSymbol as _}from"../../symbols/support/symbolUtils.js";import{system as b}from"../../time/constants.js";import{highlightsSupported as C}from"../../views/support/layerViewUtils.js";import P from"../Feature/FeatureViewModel.js";import{ActionsCollection as M,zoomToClusteredFeatures as E,browseClusteredFeatures as L,zoomToFeature as V}from"../Popup/actions.js";import{triggerAction as j,isClusterFeature as A,getSelectedTarget as I,removeClusteredFeaturesForBrowsing as R,displayClusterExtent as x,browseAggregateFeatures as O}from"../Popup/actionUtils.js";import T from"../support/AnchorElementViewModel.js";import{GoTo as S}from"../support/GoTo.js";const B="location-scale-handle",H=()=>[V.clone()],U=()=>[E.clone(),L.clone()];let G=null;function Z(e,t){return"building-scene"===e||"map-image"===e||"tile"===e||"imagery"===e||"2d"===t&&"imagery-tile"===e}let z=class extends(S(T)){constructor(e){super(e),this._pendingPromises=new n,this._fetchFeaturesController=null,this._highlightPromises={"highlight-active-feature":null,"highlight-selected-feature":null},this._selectedClusterFeature=null,this.actions=new M,this.activeFeature=null,this.autoCloseEnabled=!1,this.browseClusterEnabled=!1,this.content=null,this.defaultPopupTemplateEnabled=!1,this.featurePage=null,this.featuresPerPage=20,this.featureMenuOpen=!1,this.featureMenuTitle=null,this.featureViewModelAbilities=null,this.featureViewModels=[],this.highlightEnabled=!0,this.includeDefaultActions=!0,this.initialDisplayMode="feature",this.selectedClusterBoundaryFeature=new t({symbol:new v({outline:{width:1.5,color:"cyan"},style:"none"})}),this.title=null,this.updateLocationEnabled=!1,this.view=null,this.visible=!1,this.zoomFactor=4,this.zoomToLocation=null,this._debouncedLocationUpdate=o(async e=>{const{spatialReference:t}=this,i=this.selectedFeature?.geometry?.type,s=this.location??e;if(i&&"mesh"!==i&&t&&s&&this.selectedFeature)if("point"!==i)try{const e=this.selectedFeature;let i=e.geometry;const r=this._getHighlightLayer(e),o=e.getObjectId();if(!r||!this.view)return;if(o){const e=this.view?.allLayerViews.find(e=>e.layer.uid===r.uid);if(!e||!("queryFeatures"in e))return;const s=e.createQuery();s.outSpatialReference=t,s.objectIds=[o],s.returnGeometry=!0;const{features:a}=await e.queryFeatures(s);i=a[0]?.geometry}if(!i||"mesh"===i.type)return;i=g(i,t),G||(G=await Promise.all([import("../../geometry/operators/intersectsOperator.js"),import("../../geometry/operators/proximityOperator.js")]));const[a,n]=G;if(!a.execute(i,s)){const t=n.getNearestCoordinate(i,s).coordinate??s;this.selectedFeature===e&&(this.location=t)}}catch(o){a(o)||r.getLogger(this).error(o)}else this.location=y(this.selectedFeature.geometry)??s})}initialize(){this.addHandles([this.on("view-change",()=>this._autoClose()),l(()=>[this.highlightEnabled,this.selectedFeature,this.visible,this.view],()=>this._highlightSelectedFeature()),l(()=>[this.highlightEnabled,this.activeFeature,this.visible,this.view],()=>this._highlightActiveFeature()),l(()=>this.view?.animation?.state,e=>this._animationStateChange(e)),l(()=>this.location,e=>this._locationChange(e)),l(()=>this.selectedFeature,e=>this._selectedFeatureChange(e)),l(()=>[this.selectedFeatureIndex,this.featureCount,this.featuresPerPage],()=>this._selectedFeatureIndexChange()),l(()=>[this.featurePage,this.selectedFeatureIndex,this.featureCount,this.featuresPerPage,this.featureViewModels],()=>this._setGraphicOnFeatureViewModels()),l(()=>this.featureViewModels,()=>this._featureViewModelsChange()),this.on("trigger-action",e=>j({event:e,viewModel:this,view:this.view})),u(()=>!this.waitingForResult,()=>this._waitingForResultChange(),h),l(()=>[this.features,this.map,this.spatialReference,this.timeZone],()=>this._updateFeatureVMs()),l(()=>this.view?.scale,()=>this._viewScaleChange()),u(()=>!this.visible,()=>this.browseClusterEnabled=!1),l(()=>this.browseClusterEnabled,e=>e?this.enableClusterBrowsing():this.disableClusterBrowsing())])}destroy(){this._cancelFetchingFeatures(),this._pendingPromises.clear(),this.browseClusterEnabled=!1,this.view=null,this.map=null,this.spatialReference=null,this.timeZone=null}get active(){return!(!this.visible||this.waitingForResult)}get allActions(){const e=this._get("allActions")||new M;e.removeAll();const{actions:t,defaultActions:i,defaultPopupTemplateEnabled:s,includeDefaultActions:r,selectedFeature:o}=this,a=r?i.concat(t):t,n=o&&("function"==typeof o.getEffectivePopupTemplate&&o.getEffectivePopupTemplate(s)||o.popupTemplate),l=n?.actions,u=n?.overwriteActions?l:l?.concat(a)??a;return u?.filter(Boolean).forEach(t=>e.add(t)),e}get defaultActions(){const e=this._get("defaultActions")||new M;return e.removeAll(),e.addMany(A(this.selectedFeature)?U():H()),e}get featureCount(){return this.features.length}set features(e){const t=e||[];this._set("features",t);const{pendingPromisesCount:i,promiseCount:s,selectedFeatureIndex:r}=this,o=s&&t.length;"list"!==this.initialDisplayMode?o&&i&&-1===r?this.selectedFeatureIndex=0:o&&-1!==r||(this.selectedFeatureIndex=t.length?0:-1):(!o||o&&i===s)&&(this.selectedFeatureIndex=-1)}set location(e){let t=e;const i=this.spatialReference?.isWebMercator,s=e?.spatialReference?.isWGS84;s&&i&&(t=w(e)),this._set("location",t)}get map(){return this.view?.map??null}set map(e){this._override("map",e)}get pendingPromisesCount(){return this._pendingPromises.size}get promiseCount(){return this.promises.length}get promises(){return this._get("promises")||[]}set promises(e){this._pendingPromises.clear(),this.features=[],Array.isArray(e)&&e.length?(this._set("promises",e),(e=e.slice()).forEach(e=>this._pendingPromises.add(e)),e.reduce((e,t)=>e.finally(()=>t.then(e=>{this._pendingPromises.has(t)&&this._updateFeatures(e)}).finally(()=>this._pendingPromises.delete(t)).catch(()=>{})),Promise.resolve())):this._set("promises",[])}get screenLocation(){return super.screenLocation}get selectedFeature(){const{features:e,selectedFeatureIndex:t}=this;if(-1===t)return null;return e[t]||null}get selectedFeatureIndex(){const e=this._get("selectedFeatureIndex");return"number"==typeof e?e:-1}set selectedFeatureIndex(e){const{featureCount:t}=this;(isNaN(e)||e<0||!t)&&(e=-1),this.activeFeature=null,this._set("selectedFeatureIndex",e)}get selectedFeatureViewModel(){return this.featureViewModels[this.selectedFeatureIndex]||null}get spatialReference(){return this.view?.spatialReference??null}set spatialReference(e){this._override("spatialReference",e)}get state(){const{view:e,map:t}=this;return e?e.ready?"ready":"disabled":t?"ready":"disabled"}get timeZone(){return this.view?.timeZone??b}set timeZone(e){this._overrideIfSome("timeZone",e)}get waitingForContents(){return this.featureViewModels.some(e=>e.waitingForContent)}get waitingForResult(){return!(!(!!this._fetchFeaturesController||this.pendingPromisesCount>0)||0!==this.featureCount)}centerAtLocation(){const{view:e}=this,t=I(this);return t&&e?this.callGoTo({target:{target:t,scale:e.scale}}):Promise.reject(new s("center-at-location:invalid-target-or-view","Cannot center at a location without a target and view.",{target:t,view:e}))}zoomTo(e){return this.callGoTo(e)}clear(){this.set({promises:[],features:[],content:null,title:null,location:null,activeFeature:null})}fetchFeatures(e,t){const{view:i}=this;if(!i||!e)throw new s("fetch-features:invalid-screenpoint-or-view","Cannot fetch features without a screenPoint and view.",{screenPoint:e,view:i});return i.fetchPopupFeatures(e,{pointerType:t?.event?.pointerType,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,signal:t?.signal})}open(e){const t={updateLocationEnabled:!1,promises:[],fetchFeatures:!1,...e,visible:!0},{fetchFeatures:i}=t;delete t.fetchFeatures,i&&this._setFetchFeaturesPromises(t.location);const s=["actionsMenuOpen","collapsed"];for(const r of s)delete t[r];this.set(t)}triggerAction(e){const t=this.allActions.at(e);t&&!t.disabled&&this.emit("trigger-action",{action:t})}next(){return this.selectedFeatureIndex=this._getRoundRobinIndex(this.selectedFeatureIndex+1,this.featureCount),this}previous(){return this.selectedFeatureIndex=this._getRoundRobinIndex(this.selectedFeatureIndex-1,this.featureCount),this}disableClusterBrowsing(){R(this),this._clearBrowsedClusterGraphics()}async enableClusterBrowsing(){const{view:e,selectedFeature:t}=this;"2d"===e?.type?A(t)?(await x(this),await O(this)):r.getLogger(this).warn("enableClusterBrowsing:invalid-selectedFeature: Selected feature must represent an aggregate/cluster graphic.",t):r.getLogger(this).warn("enableClusterBrowsing:invalid-view: View must be 2d MapView.",t)}handleViewClick(e){this._fetchFeaturesAndOpen(e)}_getRoundRobinIndex(e,t){return(e+t)%t}_animationStateChange(e){this.zoomToLocation||(V.disabled="waiting-for-target"===e)}_clearBrowsedClusterGraphics(){const e=[this.selectedClusterBoundaryFeature,this._selectedClusterFeature].filter(i);this.view?.graphics?.removeMany(e),this._selectedClusterFeature=null,this.selectedClusterBoundaryFeature.geometry=null}_viewScaleChange(){if(A(this.selectedFeature))return this.browseClusterEnabled=!1,this.visible=!1,void this.clear();this.browseClusterEnabled&&(this.features=this.selectedFeature?[this.selectedFeature]:[])}_locationChange(e){const{selectedFeature:t,updateLocationEnabled:i,view:s}=this;s&&i&&e&&(!t||t.geometry)&&this.centerAtLocation()}_selectedFeatureIndexChange(){this.featurePage=this.featureCount>0?Math.floor(this.selectedFeatureIndex/this.featuresPerPage)+1:null}_featureViewModelsChange(){this.featurePage=this.featureCount>0?1:null}_setGraphicOnFeatureViewModels(){const{features:e,featureCount:t,featurePage:i,featuresPerPage:s,featureViewModels:r}=this;if(null==i)return;const o=((i-1)*s+t)%t,a=o+s;r.slice(o,a).forEach((t,i)=>{t&&(t.graphic??=e[o+i])})}async _selectedFeatureChange(e){const{location:t,updateLocationEnabled:i,view:s}=this;if(!e||!s)return;if(this.browseClusterEnabled){if(this._selectedClusterFeature&&(s.graphics.remove(this._selectedClusterFeature),this._selectedClusterFeature=null),A(e))return;return e.symbol=await _(e),this._selectedClusterFeature=e,void s.graphics.add(this._selectedClusterFeature)}const r=e.sourceLayer?.type;if("map-image"!==r&&"imagery"!==r&&"imagery-tile"!==r||(e.symbol=await _(e)),!i&&t||!e.geometry){if(i&&!e.geometry){await this.centerAtLocation();const e=s.center?.clone();e&&(this.location=e)}}else this.location=y(e.geometry)}_waitingForResultChange(){!this.featureCount&&this.promises&&(this.visible=!1)}async _setFetchFeaturesPromises(e){const{pendingFeatures:t}=await this._fetchFeaturesWithController({mapPoint:e});this.promises=t}_destroyFeatureVMs(){this.featureViewModels.forEach(e=>e&&!e.destroyed&&e.destroy()),this._set("featureViewModels",[])}_updateFeatureVMs(){const{selectedFeature:e,features:t,featureViewModels:i,view:s,spatialReference:r,map:o,timeZone:a,location:n}=this;if(A(t[0])||(this.browseClusterEnabled=!1),this._destroyFeatureVMs(),!t?.length)return;const l=i.slice(),u=[];t.forEach((t,i)=>{if(!t)return;let h=null;if(l.some((e,i)=>(e&&e.graphic===t&&(h=e,l.splice(i,1)),!!h)),h)u[i]=h;else{const l=new P({abilities:this.featureViewModelAbilities,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,spatialReference:r,graphic:t===e?t:null,location:n,map:o,view:s,timeZone:a});u[i]=l}}),l.forEach(e=>e&&!e.destroyed&&e.destroy()),this._set("featureViewModels",u)}async _getScreenPoint(e,t){const{spatialReference:i,view:s}=this;if(!s)return null;await(s?.when());const r=e?.spatialReference;return r&&i?(await f(r,i,null,t),s.toScreen(e)):null}_cancelFetchingFeatures(){const e=this._fetchFeaturesController;e&&e.abort(),this._fetchFeaturesController=null}async _projectScreenPointAndFetchFeatures({mapPoint:e,screenPoint:t,event:i,signal:s}){return this.fetchFeatures(t??await this._getScreenPoint(e??this.location,{signal:s}),{signal:s,event:i})}_fetchFeaturesWithController({mapPoint:e,screenPoint:t,event:i}){this._cancelFetchingFeatures();const s=new AbortController,{signal:r}=s;this._fetchFeaturesController=s;const o=this._projectScreenPointAndFetchFeatures({mapPoint:e,screenPoint:t,signal:r,event:i});return o.catch(()=>{}).then(()=>{this._fetchFeaturesController=null}),o}async _fetchFeaturesAndOpen(e){const{mapPoint:t,screenPoint:i}=e,{view:s}=this;this.removeHandles(B),this.addHandles([l(()=>this.view?.scale,()=>this._debouncedLocationUpdate(t).catch(e=>{a(e)||r.getLogger(this).error(e)})),u(()=>!this.visible,()=>{this.removeHandles(B)},{once:!0})],B);const{pendingFeatures:o}=await this._fetchFeaturesWithController({mapPoint:t,screenPoint:i,event:e});s?.popup&&"open"in s.popup&&s.popup.open({location:t??void 0,promises:o})}_autoClose(){this.autoCloseEnabled&&(this.visible=!1)}async _getLayerView(e,t){return await e.when(),e.whenLayerView(t)}_getHighlightLayer(e){const{layer:t,sourceLayer:i}=e;return i&&"layer"in i&&i.layer?i.layer:"map-notes"===i?.type||"subtype-group"===i?.type?i:t??i}_getHighlightLayerView(e,t){return"subtype-sublayer"===t.type&&t.parent&&this._mapIncludesLayer(t.parent)?this._getLayerView(e,t.parent):t&&this._mapIncludesLayer(t)?this._getLayerView(e,t):null}_getHighlightTarget(e,t,i){if(Z(t.type,i))return e;const s=e.getObjectId();if(null!=s)return s;const r="imagery"===t.type?void 0:"objectIdField"in t?t.objectIdField||F:null,o=e.attributes;return o&&r&&o[r]||e}_mapIncludesLayer(e){return!!this.map?.allLayers?.includes(e)}async _highlightFeature(e,t){this.removeHandles(e);const i=this[t];if(!i)return;const{highlightEnabled:s,view:r,visible:o}=this;if(!r||!s||!o)return;const a=this._getHighlightLayer(i);if(!a)return;const n=this._getHighlightLayerView(r,a);if(!n)return;this._highlightPromises[e]=n;const l=await n;if(!(l&&C(l)&&this._highlightPromises[e]===n&&this[t]&&this.highlightEnabled))return;const u=l.highlight(this._getHighlightTarget(i,a,r.type));this.addHandles(u,e)}async _highlightActiveFeature(){return this._highlightFeature("highlight-active-feature","activeFeature")}async _highlightSelectedFeature(){return this._highlightFeature("highlight-selected-feature","selectedFeature")}_updateFeatures(e){const{features:t}=this,i=e.filter(e=>!t.includes(e));i?.length&&(this.features=t.concat(i))}};e([c()],z.prototype,"_fetchFeaturesController",void 0),e([c({type:M})],z.prototype,"actions",void 0),e([c({readOnly:!0})],z.prototype,"active",null),e([c()],z.prototype,"activeFeature",void 0),e([c({readOnly:!0})],z.prototype,"allActions",null),e([c()],z.prototype,"autoCloseEnabled",void 0),e([c()],z.prototype,"browseClusterEnabled",void 0),e([c()],z.prototype,"content",void 0),e([c({type:M,readOnly:!0})],z.prototype,"defaultActions",null),e([c({type:Boolean})],z.prototype,"defaultPopupTemplateEnabled",void 0),e([c({readOnly:!0})],z.prototype,"featureCount",null),e([c()],z.prototype,"featurePage",void 0),e([c({value:[]})],z.prototype,"features",null),e([c()],z.prototype,"featuresPerPage",void 0),e([c()],z.prototype,"featureMenuOpen",void 0),e([c()],z.prototype,"featureMenuTitle",void 0),e([c()],z.prototype,"featureViewModelAbilities",void 0),e([c({readOnly:!0})],z.prototype,"featureViewModels",void 0),e([c()],z.prototype,"highlightEnabled",void 0),e([c()],z.prototype,"includeDefaultActions",void 0),e([c()],z.prototype,"initialDisplayMode",void 0),e([c({type:d})],z.prototype,"location",null),e([c()],z.prototype,"map",null),e([c({readOnly:!0})],z.prototype,"pendingPromisesCount",null),e([c({readOnly:!0})],z.prototype,"promiseCount",null),e([c()],z.prototype,"promises",null),e([c({readOnly:!0})],z.prototype,"selectedClusterBoundaryFeature",void 0),e([c({value:null,readOnly:!0})],z.prototype,"selectedFeature",null),e([c({value:-1})],z.prototype,"selectedFeatureIndex",null),e([c({readOnly:!0})],z.prototype,"selectedFeatureViewModel",null),e([c({type:m})],z.prototype,"spatialReference",null),e([c({readOnly:!0})],z.prototype,"state",null),e([c()],z.prototype,"timeZone",null),e([c()],z.prototype,"title",void 0),e([c()],z.prototype,"updateLocationEnabled",void 0),e([c()],z.prototype,"view",void 0),e([c()],z.prototype,"visible",void 0),e([c({readOnly:!0})],z.prototype,"waitingForContents",null),e([c({readOnly:!0})],z.prototype,"waitingForResult",null),e([c()],z.prototype,"zoomFactor",void 0),e([c()],z.prototype,"zoomToLocation",void 0),e([c()],z.prototype,"centerAtLocation",null),z=e([p("esri.widgets.Features.FeaturesViewModel")],z);export{z as default};
5
+ import{__decorate as e}from"tslib";import t from"../../Graphic.js";import{isSome as i}from"../../core/arrayUtils.js";import s from"../../core/Error.js";import r from"../../core/Logger.js";import{debounce as o,isAbortError as a}from"../../core/promiseUtils.js";import n from"../../core/ReactiveSet.js";import{watch as l,when as u,sync as h}from"../../core/reactiveUtils.js";import{property as c}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as d}from"../../core/accessorSupport/decorators/subclass.js";import p from"../../geometry/Point.js";import{project as g,initializeProjection as f}from"../../geometry/projectionUtils.js";import m from"../../geometry/SpatialReference.js";import{getPointFromGeometry as y}from"../../geometry/support/geometryUtils.js";import{geographicToWebMercator as w}from"../../geometry/support/webMercatorUtils.js";import{fallbackObjectIDAttribute as F}from"../../layers/LayerConstants.js";import v from"../../symbols/SimpleFillSymbol.js";import{getDisplayedSymbol as _}from"../../symbols/support/symbolUtils.js";import{system as b}from"../../time/constants.js";import{highlightsSupported as C}from"../../views/support/layerViewUtils.js";import P from"../Feature/FeatureViewModel.js";import{ActionsCollection as M,zoomToClusteredFeatures as E,browseClusteredFeatures as L,zoomToFeature as V}from"../Popup/actions.js";import{triggerAction as j,isClusterFeature as A,getSelectedTarget as I,removeClusteredFeaturesForBrowsing as R,displayClusterExtent as x,browseAggregateFeatures as O}from"../Popup/actionUtils.js";import T from"../support/AnchorElementViewModel.js";import{GoTo as S}from"../support/GoTo.js";const B="location-scale-handle",H=()=>[V.clone()],U=()=>[E.clone(),L.clone()];let G=null;function Z(e,t){return"building-scene"===e||"map-image"===e||"tile"===e||"imagery"===e||"2d"===t&&"imagery-tile"===e}let z=class extends(S(T)){constructor(e){super(e),this._pendingPromises=new n,this._fetchFeaturesController=null,this._highlightPromises={"highlight-active-feature":null,"highlight-selected-feature":null},this._selectedClusterFeature=null,this.actions=new M,this.activeFeature=null,this.autoCloseEnabled=!1,this.browseClusterEnabled=!1,this.content=null,this.defaultPopupTemplateEnabled=!1,this.featurePage=null,this.featuresPerPage=20,this.featureMenuOpen=!1,this.featureMenuTitle=null,this.featureViewModelAbilities=null,this.featureViewModels=[],this.highlightEnabled=!0,this.includeDefaultActions=!0,this.initialDisplayMode="feature",this.selectedClusterBoundaryFeature=new t({symbol:new v({outline:{width:1.5,color:"cyan"},style:"none"})}),this.title=null,this.updateLocationEnabled=!1,this.view=null,this.visible=!1,this.zoomFactor=4,this.zoomToLocation=null,this._debouncedLocationUpdate=o(async e=>{const{spatialReference:t}=this,i=this.selectedFeature?.geometry?.type,s=this.location??e;if(i&&"mesh"!==i&&t&&s&&this.selectedFeature)if("point"!==i)try{const e=this.selectedFeature;let i=e.geometry;const r=this._getHighlightLayer(e),o=e.getObjectId();if(!r||!this.view)return;if(o){const e=this.view?.allLayerViews.find(e=>e.layer.uid===r.uid);if(!e||!("queryFeatures"in e))return;const s=e.createQuery();s.outSpatialReference=t,s.objectIds=[o],s.returnGeometry=!0;const{features:a}=await e.queryFeatures(s);i=a[0]?.geometry}if(!i||"mesh"===i.type)return;i=g(i,t),G||(G=await Promise.all([import("../../geometry/operators/intersectsOperator.js"),import("../../geometry/operators/proximityOperator.js")]));const[a,n]=G;if(!a.execute(i,s)){const t=n.getNearestCoordinate(i,s).coordinate??s;this.selectedFeature===e&&(this.location=t)}}catch(o){a(o)||r.getLogger(this).error(o)}else this.location=y(this.selectedFeature.geometry)??s})}initialize(){this.addHandles([this.on("view-change",()=>this._autoClose()),l(()=>[this.highlightEnabled,this.selectedFeature,this.visible,this.view],()=>this._highlightSelectedFeature()),l(()=>[this.highlightEnabled,this.activeFeature,this.visible,this.view],()=>this._highlightActiveFeature()),l(()=>this.view?.animation?.state,e=>this._animationStateChange(e)),l(()=>this.location,e=>this._locationChange(e)),l(()=>this.selectedFeature,e=>this._selectedFeatureChange(e)),l(()=>[this.selectedFeatureIndex,this.featureCount,this.featuresPerPage],()=>this._selectedFeatureIndexChange()),l(()=>[this.featurePage,this.selectedFeatureIndex,this.featureCount,this.featuresPerPage,this.featureViewModels],()=>this._setGraphicOnFeatureViewModels()),l(()=>this.featureViewModels,()=>this._featureViewModelsChange()),this.on("trigger-action",e=>j({event:e,viewModel:this,view:this.view})),u(()=>!this.waitingForResult,()=>this._waitingForResultChange(),h),l(()=>[this.features,this.map,this.spatialReference,this.timeZone],()=>this._updateFeatureVMs()),l(()=>this.view?.scale,()=>this._viewScaleChange()),u(()=>!this.visible,()=>this.browseClusterEnabled=!1),l(()=>this.browseClusterEnabled,e=>e?this.enableClusterBrowsing():this.disableClusterBrowsing())])}destroy(){this._cancelFetchingFeatures(),this._pendingPromises.clear(),this.browseClusterEnabled=!1,this.view=null,this.map=null,this.spatialReference=null,this.timeZone=null}get active(){return!(!this.visible||this.waitingForResult)}get allActions(){const e=this._get("allActions")||new M;e.removeAll();const{actions:t,defaultActions:i,defaultPopupTemplateEnabled:s,includeDefaultActions:r,selectedFeature:o}=this,a=r?i.concat(t):t,n=o&&("function"==typeof o.getEffectivePopupTemplate&&o.getEffectivePopupTemplate(s)||o.popupTemplate),l=n?.actions,u=n?.overwriteActions?l:l?.concat(a)??a;return u?.filter(Boolean).forEach(t=>e.add(t)),e}get defaultActions(){const e=this._get("defaultActions")||new M;return e.removeAll(),e.addMany(A(this.selectedFeature)?U():H()),e}get featureCount(){return this.features.length}set features(e){const t=e||[];this._set("features",t);const{pendingPromisesCount:i,promiseCount:s,selectedFeatureIndex:r}=this,o=s&&t.length;"list"!==this.initialDisplayMode?o&&i&&-1===r?this.selectedFeatureIndex=0:o&&-1!==r||(this.selectedFeatureIndex=t.length?0:-1):(!o||o&&i===s)&&(this.selectedFeatureIndex=-1)}set location(e){let t=e;const i=this.spatialReference?.isWebMercator,s=e?.spatialReference?.isWGS84;s&&i&&(t=w(e)),this._set("location",t)}get map(){return this.view?.map??null}set map(e){this._override("map",e)}get pendingPromisesCount(){return this._pendingPromises.size}get promiseCount(){return this.promises.length}get promises(){return this._get("promises")||[]}set promises(e){this._pendingPromises.clear(),this.features=[],Array.isArray(e)&&e.length?(this._set("promises",e),(e=e.slice()).forEach(e=>this._pendingPromises.add(e)),e.reduce((e,t)=>e.finally(()=>t.then(e=>{this._pendingPromises.has(t)&&this._updateFeatures(e)}).finally(()=>this._pendingPromises.delete(t)).catch(()=>{})),Promise.resolve())):this._set("promises",[])}get screenLocation(){return super.screenLocation}get selectedFeature(){const{features:e,selectedFeatureIndex:t}=this;if(-1===t)return null;return e[t]||null}get selectedFeatureIndex(){const e=this._get("selectedFeatureIndex");return"number"==typeof e?e:-1}set selectedFeatureIndex(e){const{featureCount:t}=this;(isNaN(e)||e<0||!t)&&(e=-1),this.activeFeature=null,this._set("selectedFeatureIndex",e)}get selectedFeatureViewModel(){return this.featureViewModels[this.selectedFeatureIndex]||null}get spatialReference(){return this.view?.spatialReference??null}set spatialReference(e){this._override("spatialReference",e)}get state(){const{view:e,map:t}=this;return e?e.ready?"ready":"disabled":t?"ready":"disabled"}get timeZone(){return this.view?.timeZone??b}set timeZone(e){this._overrideIfSome("timeZone",e)}get waitingForContents(){return this.featureViewModels.some(e=>e.waitingForContent)}get waitingForResult(){return!(!(!!this._fetchFeaturesController||this.pendingPromisesCount>0)||0!==this.featureCount)}centerAtLocation(){const{view:e}=this,t=I(this);return t&&e?this.callGoTo({target:{target:t,scale:e.scale}}):Promise.reject(new s("center-at-location:invalid-target-or-view","Cannot center at a location without a target and view.",{target:t,view:e}))}zoomTo(e){return this.callGoTo(e)}clear(){this.set({promises:[],features:[],content:null,title:null,location:null,activeFeature:null})}fetchFeatures(e,t){const{view:i}=this;if(!i||!e)throw new s("fetch-features:invalid-screenpoint-or-view","Cannot fetch features without a screenPoint and view.",{screenPoint:e,view:i});return i.fetchPopupFeatures(e,{pointerType:t?.event?.pointerType,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,signal:t?.signal})}open(e){const t={updateLocationEnabled:!1,promises:[],fetchFeatures:!1,...e,visible:!0},{fetchFeatures:i}=t;delete t.fetchFeatures,i&&this._setFetchFeaturesPromises(t.location);const s=["actionsMenuOpen","collapsed"];for(const r of s)delete t[r];this.set(t)}triggerAction(e){const t=this.allActions.at(e);t&&!t.disabled&&this.emit("trigger-action",{action:t})}next(){return this.selectedFeatureIndex=this._getRoundRobinIndex(this.selectedFeatureIndex+1,this.featureCount),this}previous(){return this.selectedFeatureIndex=this._getRoundRobinIndex(this.selectedFeatureIndex-1,this.featureCount),this}disableClusterBrowsing(){R(this),this._clearBrowsedClusterGraphics()}async enableClusterBrowsing(){const{view:e,selectedFeature:t}=this;"2d"===e?.type?A(t)?(await x(this),await O(this)):r.getLogger(this).warn("enableClusterBrowsing:invalid-selectedFeature: Selected feature must represent an aggregate/cluster graphic.",t):r.getLogger(this).warn("enableClusterBrowsing:invalid-view: View must be 2d MapView.",t)}async handleViewClick(e){return this._fetchFeaturesAndOpen(e)}_getRoundRobinIndex(e,t){return(e+t)%t}_animationStateChange(e){this.zoomToLocation||(V.disabled="waiting-for-target"===e)}_clearBrowsedClusterGraphics(){const e=[this.selectedClusterBoundaryFeature,this._selectedClusterFeature].filter(i);this.view?.graphics?.removeMany(e),this._selectedClusterFeature=null,this.selectedClusterBoundaryFeature.geometry=null}_viewScaleChange(){if(A(this.selectedFeature))return this.browseClusterEnabled=!1,this.visible=!1,void this.clear();this.browseClusterEnabled&&(this.features=this.selectedFeature?[this.selectedFeature]:[])}_locationChange(e){const{selectedFeature:t,updateLocationEnabled:i,view:s}=this;s&&i&&e&&(!t||t.geometry)&&this.centerAtLocation()}_selectedFeatureIndexChange(){this.featurePage=this.featureCount>0?Math.floor(this.selectedFeatureIndex/this.featuresPerPage)+1:null}_featureViewModelsChange(){this.featurePage=this.featureCount>0?1:null}_setGraphicOnFeatureViewModels(){const{features:e,featureCount:t,featurePage:i,featuresPerPage:s,featureViewModels:r}=this;if(null==i)return;const o=((i-1)*s+t)%t,a=o+s;r.slice(o,a).forEach((t,i)=>{t&&(t.graphic??=e[o+i])})}async _selectedFeatureChange(e){const{location:t,updateLocationEnabled:i,view:s}=this;if(!e||!s)return;if(this.browseClusterEnabled){if(this._selectedClusterFeature&&(s.graphics.remove(this._selectedClusterFeature),this._selectedClusterFeature=null),A(e))return;return e.symbol=await _(e),this._selectedClusterFeature=e,void s.graphics.add(this._selectedClusterFeature)}const r=e.sourceLayer?.type;if("map-image"!==r&&"imagery"!==r&&"imagery-tile"!==r||(e.symbol=await _(e)),!i&&t||!e.geometry){if(i&&!e.geometry){await this.centerAtLocation();const e=s.center?.clone();e&&(this.location=e)}}else this.location=y(e.geometry)}_waitingForResultChange(){!this.featureCount&&this.promises&&(this.visible=!1)}async _setFetchFeaturesPromises(e){const{pendingFeatures:t}=await this._fetchFeaturesWithController({mapPoint:e});this.promises=t}_destroyFeatureVMs(){this.featureViewModels.forEach(e=>e&&!e.destroyed&&e.destroy()),this._set("featureViewModels",[])}_updateFeatureVMs(){const{selectedFeature:e,features:t,featureViewModels:i,view:s,spatialReference:r,map:o,timeZone:a,location:n}=this;if(A(t[0])||(this.browseClusterEnabled=!1),this._destroyFeatureVMs(),!t?.length)return;const l=i.slice(),u=[];t.forEach((t,i)=>{if(!t)return;let h=null;if(l.some((e,i)=>(e&&e.graphic===t&&(h=e,l.splice(i,1)),!!h)),h)u[i]=h;else{const l=new P({abilities:this.featureViewModelAbilities,defaultPopupTemplateEnabled:this.defaultPopupTemplateEnabled,spatialReference:r,graphic:t===e?t:null,location:n,map:o,view:s,timeZone:a});u[i]=l}}),l.forEach(e=>e&&!e.destroyed&&e.destroy()),this._set("featureViewModels",u)}async _getScreenPoint(e,t){const{spatialReference:i,view:s}=this;if(!s)return null;await(s?.when());const r=e?.spatialReference;return r&&i?(await f(r,i,null,t),s.toScreen(e)):null}_cancelFetchingFeatures(){const e=this._fetchFeaturesController;e&&e.abort(),this._fetchFeaturesController=null}async _projectScreenPointAndFetchFeatures({mapPoint:e,screenPoint:t,event:i,signal:s}){return this.fetchFeatures(t??await this._getScreenPoint(e??this.location,{signal:s}),{signal:s,event:i})}_fetchFeaturesWithController({mapPoint:e,screenPoint:t,event:i}){this._cancelFetchingFeatures();const s=new AbortController,{signal:r}=s;this._fetchFeaturesController=s;const o=this._projectScreenPointAndFetchFeatures({mapPoint:e,screenPoint:t,signal:r,event:i});return o.catch(()=>{}).then(()=>{this._fetchFeaturesController=null}),o}async _fetchFeaturesAndOpen(e){const{mapPoint:t,screenPoint:i}=e;this.removeHandles(B),this.addHandles([l(()=>this.view?.scale,()=>this._debouncedLocationUpdate(t).catch(e=>{a(e)||r.getLogger(this).error(e)})),u(()=>!this.visible,()=>{this.removeHandles(B)},{once:!0})],B);const{pendingFeatures:s}=await this._fetchFeaturesWithController({mapPoint:t,screenPoint:i,event:e});return{location:t??void 0,promises:s}}_autoClose(){this.autoCloseEnabled&&(this.visible=!1)}async _getLayerView(e,t){return await e.when(),e.whenLayerView(t)}_getHighlightLayer(e){const{layer:t,sourceLayer:i}=e;return i&&"layer"in i&&i.layer?i.layer:"map-notes"===i?.type||"subtype-group"===i?.type?i:t??i}_getHighlightLayerView(e,t){return"subtype-sublayer"===t.type&&t.parent&&this._mapIncludesLayer(t.parent)?this._getLayerView(e,t.parent):t&&this._mapIncludesLayer(t)?this._getLayerView(e,t):null}_getHighlightTarget(e,t,i){if(Z(t.type,i))return e;const s=e.getObjectId();if(null!=s)return s;const r="imagery"===t.type?void 0:"objectIdField"in t?t.objectIdField||F:null,o=e.attributes;return o&&r&&o[r]||e}_mapIncludesLayer(e){return!!this.map?.allLayers?.includes(e)}async _highlightFeature(e,t){this.removeHandles(e);const i=this[t];if(!i)return;const{highlightEnabled:s,view:r,visible:o}=this;if(!r||!s||!o)return;const a=this._getHighlightLayer(i);if(!a)return;const n=this._getHighlightLayerView(r,a);if(!n)return;this._highlightPromises[e]=n;const l=await n;if(!(l&&C(l)&&this._highlightPromises[e]===n&&this[t]&&this.highlightEnabled))return;const u=l.highlight(this._getHighlightTarget(i,a,r.type));this.addHandles(u,e)}async _highlightActiveFeature(){return this._highlightFeature("highlight-active-feature","activeFeature")}async _highlightSelectedFeature(){return this._highlightFeature("highlight-selected-feature","selectedFeature")}_updateFeatures(e){const{features:t}=this,i=e.filter(e=>!t.includes(e));i?.length&&(this.features=t.concat(i))}};e([c()],z.prototype,"_fetchFeaturesController",void 0),e([c({type:M})],z.prototype,"actions",void 0),e([c({readOnly:!0})],z.prototype,"active",null),e([c()],z.prototype,"activeFeature",void 0),e([c({readOnly:!0})],z.prototype,"allActions",null),e([c()],z.prototype,"autoCloseEnabled",void 0),e([c()],z.prototype,"browseClusterEnabled",void 0),e([c()],z.prototype,"content",void 0),e([c({type:M,readOnly:!0})],z.prototype,"defaultActions",null),e([c({type:Boolean})],z.prototype,"defaultPopupTemplateEnabled",void 0),e([c({readOnly:!0})],z.prototype,"featureCount",null),e([c()],z.prototype,"featurePage",void 0),e([c({value:[]})],z.prototype,"features",null),e([c()],z.prototype,"featuresPerPage",void 0),e([c()],z.prototype,"featureMenuOpen",void 0),e([c()],z.prototype,"featureMenuTitle",void 0),e([c()],z.prototype,"featureViewModelAbilities",void 0),e([c({readOnly:!0})],z.prototype,"featureViewModels",void 0),e([c()],z.prototype,"highlightEnabled",void 0),e([c()],z.prototype,"includeDefaultActions",void 0),e([c()],z.prototype,"initialDisplayMode",void 0),e([c({type:p})],z.prototype,"location",null),e([c()],z.prototype,"map",null),e([c({readOnly:!0})],z.prototype,"pendingPromisesCount",null),e([c({readOnly:!0})],z.prototype,"promiseCount",null),e([c()],z.prototype,"promises",null),e([c({readOnly:!0})],z.prototype,"selectedClusterBoundaryFeature",void 0),e([c({value:null,readOnly:!0})],z.prototype,"selectedFeature",null),e([c({value:-1})],z.prototype,"selectedFeatureIndex",null),e([c({readOnly:!0})],z.prototype,"selectedFeatureViewModel",null),e([c({type:m})],z.prototype,"spatialReference",null),e([c({readOnly:!0})],z.prototype,"state",null),e([c()],z.prototype,"timeZone",null),e([c()],z.prototype,"title",void 0),e([c()],z.prototype,"updateLocationEnabled",void 0),e([c()],z.prototype,"view",void 0),e([c()],z.prototype,"visible",void 0),e([c({readOnly:!0})],z.prototype,"waitingForContents",null),e([c({readOnly:!0})],z.prototype,"waitingForResult",null),e([c()],z.prototype,"zoomFactor",void 0),e([c()],z.prototype,"zoomToLocation",void 0),e([c()],z.prototype,"centerAtLocation",null),z=e([d("esri.widgets.Features.FeaturesViewModel")],z);export{z as default};