@arcgis/core 5.1.0-next.84 → 5.1.0-next.86

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 (367) hide show
  1. package/assets/components/assets/icon/gpsReceiver16.json +1 -0
  2. package/assets/components/assets/icon/gpsReceiver24.json +1 -0
  3. package/assets/components/assets/icon/gpsReceiver32.json +1 -0
  4. package/assets/components/assets/icon/totalStation16.json +1 -0
  5. package/assets/components/assets/icon/totalStation24.json +1 -0
  6. package/assets/components/assets/icon/totalStation32.json +1 -0
  7. package/assets/esri/core/workers/RemoteClient.js +1 -1
  8. package/assets/esri/core/workers/chunks/{e89dc473f46a5584d2ef.js → 004af103a94d21cb4889.js} +3 -3
  9. package/assets/esri/core/workers/chunks/{67abbe81c16de26f61d8.js → 1bad4331a43169f3cc34.js} +1 -1
  10. package/assets/esri/core/workers/chunks/27f67a3828b78d4c1413.js +1 -0
  11. package/assets/esri/core/workers/chunks/2c916b93d8a6e6b9c0d7.js +1 -0
  12. package/assets/esri/core/workers/chunks/{db86a1119e4e58ecfbda.js → 2f8b173d1dac73ba0d9e.js} +1 -1
  13. package/assets/esri/core/workers/chunks/49e8144effc299dfcd66.js +1 -0
  14. package/assets/esri/core/workers/chunks/5166f204fd078dced5db.js +1 -0
  15. package/assets/esri/core/workers/chunks/{45c83eb7c2a06166e3b0.js → 56717ff315c6ec874142.js} +1 -1
  16. package/assets/esri/core/workers/chunks/577cbc131b21c351fae5.js +2 -0
  17. package/assets/esri/core/workers/chunks/{72691fe14024e35f85d0.js → 618106f5fbdf88ef2278.js} +1 -1
  18. package/assets/esri/core/workers/chunks/61fada8942b65fa0b5e1.js +1 -0
  19. package/assets/esri/core/workers/chunks/{05c5f68e117fc58ae801.js → 701b823763e941b71f4f.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{1e2c0c6d724f7639d4c1.js → 713ab619060bd5087479.js} +13 -13
  21. package/assets/esri/core/workers/chunks/{a9b5ce00323cd5574bf7.js → 7160e3e7340beb7fdb42.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{0219edb509e01270d42d.js → 99c6bd2125f4eb6796fe.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{ff713926985a284f5d81.js → a844547bf33a8527ee9f.js} +2 -2
  24. package/assets/esri/core/workers/chunks/aa6808146c76b2d49b64.js +1 -0
  25. package/assets/esri/core/workers/chunks/{9cac70164d8528c283af.js → add000f51c778114c028.js} +1 -1
  26. package/assets/esri/core/workers/chunks/b23e677c33db6f9bac8a.js +1 -0
  27. package/assets/esri/core/workers/chunks/{dfe1139124fda0d6c059.js → b575292013bceef9b015.js} +1 -1
  28. package/assets/esri/core/workers/chunks/bae8f2a5dfe0cfbc0688.js +1 -0
  29. package/assets/esri/core/workers/chunks/bb5f909a2f26fc6a21b0.js +2 -0
  30. package/assets/esri/core/workers/chunks/{28a45bd26eb5c9b3ec7c.js → ce66c551b7083913eee5.js} +1 -1
  31. package/assets/esri/core/workers/chunks/{22bdea4ca52970c29504.js → d0aee7c80c5c7e23d216.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{f4220b6eab0865318033.js → d8de7fe49dba9ed589df.js} +1 -1
  33. package/assets/esri/core/workers/chunks/ded2f19a1685db2137f4.js +2 -0
  34. package/assets/esri/core/workers/chunks/{f77d23ee60c876b01e4b.js → e9a42f0262fc44a79d4b.js} +1 -1
  35. package/assets/esri/core/workers/chunks/edbdee69440dbfc05644.js +1 -0
  36. package/assets/esri/core/workers/chunks/ee057c85cdf6beb5b012.js +2 -0
  37. package/assets/esri/core/workers/chunks/f9fe3c9867b0bdb2aec6.js +596 -0
  38. package/assets/esri/core/workers/chunks/ff57a071156d8a7e47be.js +1 -0
  39. package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
  40. package/assets/esri/libs/lyr3d/lyr3DWorker.wasm +0 -0
  41. package/assets/esri/themes/base/widgets/_BatchAttributeForm.scss +6 -0
  42. package/assets/esri/themes/dark/main.css +1 -1
  43. package/assets/esri/themes/light/main.css +1 -1
  44. package/assets/esri/themes/light/view.css +1 -1
  45. package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis.json +1 -1
  46. package/assets/esri/views/3d/analysis/ShadowCast/t9n/ShadowCastAnalysis_en.json +1 -1
  47. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ar.json +1 -1
  48. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_bg.json +1 -1
  49. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_bs.json +1 -1
  50. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ca.json +1 -1
  51. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_cs.json +1 -1
  52. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_da.json +1 -1
  53. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_de.json +1 -1
  54. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_el.json +1 -1
  55. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_es.json +1 -1
  56. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_et.json +1 -1
  57. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_fi.json +1 -1
  58. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_fr.json +1 -1
  59. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_he.json +1 -1
  60. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_hr.json +1 -1
  61. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_hu.json +1 -1
  62. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_id.json +1 -1
  63. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_it.json +1 -1
  64. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ja.json +1 -1
  65. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ko.json +1 -1
  66. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_lt.json +1 -1
  67. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_lv.json +1 -1
  68. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_nl.json +1 -1
  69. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_no.json +1 -1
  70. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_pl.json +1 -1
  71. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_pt-BR.json +1 -1
  72. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_pt-PT.json +1 -1
  73. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ro.json +1 -1
  74. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ru.json +1 -1
  75. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sk.json +1 -1
  76. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sl.json +1 -1
  77. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sr.json +1 -1
  78. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sv.json +1 -1
  79. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_th.json +1 -1
  80. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_tr.json +1 -1
  81. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_uk.json +1 -1
  82. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_vi.json +1 -1
  83. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_zh-CN.json +1 -1
  84. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_zh-HK.json +1 -1
  85. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_zh-TW.json +1 -1
  86. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ar.json +1 -1
  87. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_bg.json +1 -1
  88. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_bs.json +1 -1
  89. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ca.json +1 -1
  90. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_cs.json +1 -1
  91. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_da.json +1 -1
  92. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_de.json +1 -1
  93. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_el.json +1 -1
  94. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_es.json +1 -1
  95. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_et.json +1 -1
  96. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_fi.json +1 -1
  97. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_fr.json +1 -1
  98. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_he.json +1 -1
  99. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_hr.json +1 -1
  100. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_hu.json +1 -1
  101. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_id.json +1 -1
  102. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_it.json +1 -1
  103. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ja.json +1 -1
  104. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ko.json +1 -1
  105. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_lt.json +1 -1
  106. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_lv.json +1 -1
  107. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_nl.json +1 -1
  108. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_no.json +1 -1
  109. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pl.json +1 -1
  110. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pt-BR.json +1 -1
  111. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pt-PT.json +1 -1
  112. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ro.json +1 -1
  113. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ru.json +1 -1
  114. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sk.json +1 -1
  115. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sl.json +1 -1
  116. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sr.json +1 -1
  117. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sv.json +1 -1
  118. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_th.json +1 -1
  119. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_tr.json +1 -1
  120. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_uk.json +1 -1
  121. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_vi.json +1 -1
  122. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-CN.json +1 -1
  123. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-HK.json +1 -1
  124. package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-TW.json +1 -1
  125. package/chunks/EdgeShader.glsl.js +13 -9
  126. package/chunks/Fog.glsl.js +1 -1
  127. package/chunks/GlowBlur.glsl.js +9 -13
  128. package/chunks/GlowComposition.glsl.js +10 -10
  129. package/chunks/ShadowCastVisualize.glsl.js +10 -10
  130. package/config.js +1 -1
  131. package/core/arrayUtils.js +1 -1
  132. package/core/has.js +1 -1
  133. package/core/screenUtils.js +1 -1
  134. package/form/types.d.ts +1 -1
  135. package/geohash/GeohashCell.js +1 -1
  136. package/geohash/GeohashTree.js +1 -1
  137. package/interfaces.d.ts +14 -14
  138. package/kernel.js +1 -1
  139. package/layers/Lyr3DWasmPerSceneView.js +1 -1
  140. package/layers/ParquetLayer.d.ts +10 -10
  141. package/layers/ParquetLayer.js +1 -1
  142. package/layers/StreamLayer.js +1 -1
  143. package/layers/graphics/sources/connections/FabricKustoConnection.js +2 -0
  144. package/layers/graphics/sources/connections/GeoEventConnection.js +1 -1
  145. package/layers/graphics/sources/connections/WebSocketConnection.js +1 -1
  146. package/layers/graphics/sources/connections/createConnection.js +1 -1
  147. package/layers/graphics/sources/connections/websocketUils.js +2 -0
  148. package/layers/scene/ModelFileInfo.js +1 -1
  149. package/layers/scene/modelQuerySupport.js +1 -1
  150. package/layers/support/ClientSideConnection.js +1 -1
  151. package/layers/support/FabricKustoSource.js +2 -0
  152. package/layers/support/{ParquetGeometryEncodingLocation.d.ts → GeometryEncodingLocation.d.ts} +9 -9
  153. package/layers/support/{ParquetGeometryEncodingLocation.js → GeometryEncodingLocation.js} +1 -1
  154. package/layers/support/{ParquetGeometryEncodingWkb.d.ts → GeometryEncodingWkb.d.ts} +8 -9
  155. package/layers/support/GeometryEncodingWkb.js +2 -0
  156. package/layers/support/kustoUtils.js +2 -0
  157. package/layers/support/parquetEncodingUtils.js +1 -1
  158. package/layers/support/parquetUtils.js +1 -1
  159. package/layers/support/types.d.ts +3 -3
  160. package/package.json +2 -2
  161. package/popup/Features.d.ts +10 -0
  162. package/popup/Features.js +1 -1
  163. package/rest/knowledgeGraph/GraphQueryStreamingResult.d.ts +4 -1
  164. package/support/revision.js +1 -1
  165. package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
  166. package/views/2d/FrameTask.js +1 -1
  167. package/views/2d/LabelManager.js +1 -1
  168. package/views/2d/ViewState.js +1 -1
  169. package/views/2d/engine/DisplayObject.js +1 -1
  170. package/views/2d/engine/Stage.js +1 -1
  171. package/views/2d/engine/flow/FlowContainer.js +1 -1
  172. package/views/2d/engine/flow/FlowView2D.js +1 -1
  173. package/views/2d/engine/flow/styles/AFlowResources.js +1 -1
  174. package/views/2d/engine/flow/styles/Imagery.js +1 -1
  175. package/views/2d/engine/flow/styles/Particles.js +1 -1
  176. package/views/2d/engine/flow/styles/Stack.js +1 -1
  177. package/views/2d/engine/flow/styles/Streamlines.js +1 -1
  178. package/views/2d/engine/transitions/FadeTransition.js +1 -1
  179. package/views/2d/engine/vectorTiles/VTLPainter3D.js +1 -1
  180. package/views/2d/engine/vectorTiles/decluttering/SymbolDeclutterer.js +1 -1
  181. package/views/2d/engine/vectorTiles/decluttering/SymbolFader.js +1 -1
  182. package/views/2d/engine/vectorTiles/decluttering/SymbolRepository.js +1 -1
  183. package/views/2d/engine/webgl/AFeatureTile.js +1 -1
  184. package/views/2d/engine/webgl/AttributeStoreView.js +1 -1
  185. package/views/2d/engine/webgl/FeatureTile.js +1 -1
  186. package/views/2d/engine/webgl/ResizableUint32Array.js +2 -0
  187. package/views/2d/engine/webgl/TileCpuState.js +2 -0
  188. package/views/2d/engine/webgl/TileGpuState.js +2 -0
  189. package/views/2d/engine/webgl/cpuMapped/CpuBuffer.js +2 -0
  190. package/views/2d/engine/webgl/cpuMapped/CpuMeshData.js +2 -0
  191. package/views/2d/engine/webgl/cpuMapped/GpuMeshState.js +2 -0
  192. package/views/2d/engine/webgl/effects/HittestEffect.js +1 -1
  193. package/views/2d/engine/webgl/shaderGraph/techniques/TechniqueDebugContainer.js +1 -1
  194. package/views/2d/engine/webgl/shaderGraph/techniques/TestDisplayObject.js +1 -1
  195. package/views/2d/engine/webgl/shaderGraph/techniques/tile/TileDebugInfoTechnique.js +1 -1
  196. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  197. package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
  198. package/views/2d/layers/GeoRSSLayerView2D.js +1 -1
  199. package/views/2d/layers/GraphicsLayerView2D.js +1 -1
  200. package/views/2d/layers/ImageryLayerView2D.js +1 -1
  201. package/views/2d/layers/ImageryTileLayerView2D.js +1 -1
  202. package/views/2d/layers/KMLLayerView2D.js +1 -1
  203. package/views/2d/layers/LayerView2D.js +1 -1
  204. package/views/2d/layers/MapNotesLayerView2D.js +1 -1
  205. package/views/2d/layers/MediaLayerView2D.js +1 -1
  206. package/views/2d/layers/RouteLayerView2D.js +1 -1
  207. package/views/2d/layers/TileLayerView2D.js +1 -1
  208. package/views/2d/layers/features/FeatureContainer.js +1 -1
  209. package/views/2d/layers/features/FeaturePipelineWorker.js +1 -1
  210. package/views/2d/layers/features/FeatureTilePresentStrategy.js +2 -0
  211. package/views/2d/layers/features/Processor.js +1 -1
  212. package/views/2d/layers/features/RenderState.js +1 -1
  213. package/views/2d/layers/features/aggregation/AAggregateSpatialIndex.js +1 -1
  214. package/views/2d/layers/features/aggregation/GeohashSpatialIndex.js +1 -1
  215. package/views/2d/layers/features/aggregation/GridCell.js +1 -1
  216. package/views/2d/layers/features/aggregation/GridIndexCell.js +2 -0
  217. package/views/2d/layers/features/aggregation/GridSpatialIndex.js +1 -1
  218. package/views/2d/layers/features/layerAdapters/CatalogFootprintLayerAdapter.js +1 -1
  219. package/views/2d/layers/features/layerAdapters/FeatureLayerAdapter.js +1 -1
  220. package/views/2d/layers/features/layerAdapters/InMemoryLayerAdapter.js +1 -1
  221. package/views/2d/layers/features/layerAdapters/KnowledgeGraphSublayerAdapter.js +1 -1
  222. package/views/2d/layers/features/layerAdapters/OGCFeatureLayerAdapter.js +1 -1
  223. package/views/2d/layers/features/layerAdapters/OrientedImageryLayerAdapter.js +1 -1
  224. package/views/2d/layers/features/layerAdapters/ParquetLayerAdapter.js +1 -1
  225. package/views/2d/layers/features/layerAdapters/StreamLayerAdapter.js +1 -1
  226. package/views/2d/layers/features/layerAdapters/SubtypeGroupLayerAdapter.js +1 -1
  227. package/views/2d/layers/features/processor/AProcessorStrategy.js +1 -1
  228. package/views/2d/layers/features/processor/BinningStrategy.js +1 -1
  229. package/views/2d/layers/features/processor/ClusterStrategy.js +1 -1
  230. package/views/2d/layers/features/processor/FeatureUpdateStrategy.js +1 -1
  231. package/views/2d/layers/features/processor/TrackStrategy.js +1 -1
  232. package/views/2d/layers/features/sources/FeatureSourceMessage.js +1 -1
  233. package/views/2d/layers/features/sources/strategies/StreamLoadStrategy.js +1 -1
  234. package/views/2d/layers/features/sources/strategies/chunks/ASourceChunk.js +1 -1
  235. package/views/2d/layers/features/support/Hashed.js +2 -0
  236. package/views/2d/layers/graphics/AGraphicContainer.js +1 -1
  237. package/views/2d/layers/graphics/GraphicStore.js +1 -1
  238. package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
  239. package/views/2d/layers/imagery/ImageryView2D.js +1 -1
  240. package/views/2d/layers/support/vectorTileDebugUtils.js +1 -1
  241. package/views/2d/support/hitTestUtils.js +1 -1
  242. package/views/2d/tiling/FeatureTileSubscriptionManager.js +1 -1
  243. package/views/2d/tiling/TileCombinedCoverage.js +2 -0
  244. package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
  245. package/views/3d/analysis/LineOfSight/LineOfSightTool2.js +2 -0
  246. package/views/3d/analysis/LineOfSightAnalysisView3D.js +1 -1
  247. package/views/3d/analysis/ShadowCast/ShadowCastTooltip.js +1 -1
  248. package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
  249. package/views/3d/analysis/Viewshed/ViewshedEditTool.js +2 -0
  250. package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
  251. package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
  252. package/views/3d/analysis/Viewshed/ViewshedTool2.js +2 -0
  253. package/views/3d/analysis/Viewshed/viewshedSubToolUtils.js +2 -0
  254. package/views/3d/analysis/Viewshed/viewshedToolUtils.js +1 -1
  255. package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
  256. package/views/3d/environment/CloudyWeather.js +1 -1
  257. package/views/3d/environment/FoggyWeather.js +1 -1
  258. package/views/3d/environment/RainyWeather.js +1 -1
  259. package/views/3d/environment/SnowyWeather.js +1 -1
  260. package/views/3d/environment/SunnyWeather.js +1 -1
  261. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  262. package/views/3d/layers/graphics/StreamController.js +1 -1
  263. package/views/3d/layers/graphics/tessellationUtils.js +1 -1
  264. package/views/3d/layers/i3s/I3SIndex.js +1 -1
  265. package/views/3d/support/gaussianSplatting/GaussianSplatTextureAtlas.js +1 -1
  266. package/views/3d/webgl/ManagedColorAttachment.js +1 -1
  267. package/views/3d/webgl/ManagedDepthAttachment.js +1 -1
  268. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechnique.js +1 -1
  269. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  270. package/views/3d/webgl-engine/core/FBOCacheFormats.js +1 -1
  271. package/views/3d/webgl-engine/core/FBOCacheUsage.js +1 -1
  272. package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
  273. package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexPosition.glsl.js +11 -11
  274. package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
  275. package/views/3d/webgl-engine/effects/fog/Fog.glsl.js +1 -1
  276. package/views/3d/webgl-engine/effects/fog/Fog.js +1 -1
  277. package/views/3d/webgl-engine/effects/geometry/RenderOccludedRenderNode.js +1 -1
  278. package/views/3d/webgl-engine/effects/glow/Glow.js +2 -0
  279. package/views/3d/webgl-engine/effects/glow/GlowBlur.glsl.js +1 -1
  280. package/views/3d/webgl-engine/effects/glow/GlowComposition.glsl.js +1 -1
  281. package/views/3d/webgl-engine/effects/raymarching/{RayDistanceFalloff.glsl.js → DistanceFalloff.glsl.js} +2 -2
  282. package/views/3d/webgl-engine/lib/CutFillComputationRenderNode.js +1 -1
  283. package/views/3d/webgl-engine/lib/CutFillVisualizationRenderNode.js +1 -1
  284. package/views/3d/webgl-engine/lib/GPUPointOcclusionQuery.js +1 -1
  285. package/views/3d/webgl-engine/lib/MainFramebuffer.js +1 -1
  286. package/views/3d/webgl-engine/lib/ManagedTexture.js +1 -1
  287. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  288. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  289. package/views/3d/webgl-engine/lib/ShadowCastRenderer.js +1 -1
  290. package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
  291. package/views/3d/webgl-engine/lib/StencilUtils.js +1 -1
  292. package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
  293. package/views/3d/webgl-engine/lib/edgeRendering/EdgeShader.glsl.js +1 -1
  294. package/views/3d/webgl-engine/lib/verticalOffsetUtils.js +1 -1
  295. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  296. package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
  297. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  298. package/views/3d/webgl-engine/shaders/ColorMaterialTechnique.js +1 -1
  299. package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
  300. package/views/3d/webgl-engine/shaders/ImageMaterialTechnique.js +1 -1
  301. package/views/3d/webgl-engine/shaders/LineMarkerTechnique.js +1 -1
  302. package/views/3d/webgl-engine/shaders/MeasurementArrowTechnique.js +1 -1
  303. package/views/3d/webgl-engine/shaders/MeasurementArrowTechniqueConfiguration.js +1 -1
  304. package/views/3d/webgl-engine/shaders/NativeLineTechnique.js +1 -1
  305. package/views/3d/webgl-engine/shaders/PatternTechnique.js +1 -1
  306. package/views/3d/webgl-engine/shaders/PointRendererTechnique.js +1 -1
  307. package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
  308. package/views/3d/webgl-engine/shaders/ScreenSpacePassAtmosphere.glsl.js +1 -7
  309. package/views/3d/webgl-engine/shaders/ShadowCastVisualizeTechnique.js +1 -1
  310. package/views/3d/webgl-engine/shaders/ShadowCastVisualizeTechniqueConfiguration.js +1 -1
  311. package/views/VideoView.js +1 -1
  312. package/views/View2D.js +1 -1
  313. package/views/draw/support/GraphicMover.js +1 -1
  314. package/views/support/rasterHitTestUtils.js +1 -1
  315. package/views/support/waitForResources.js +1 -1
  316. package/views/video/VideoOperationalDataView.js +1 -1
  317. package/views/webgl/FramebufferObject.js +1 -1
  318. package/views/webgl/RenderingContext.js +1 -1
  319. package/views/webgl/Texture.js +1 -1
  320. package/views/webgl/textureUtils.js +1 -1
  321. package/widgets/BatchAttributeForm/css.js +1 -1
  322. package/widgets/BatchAttributeForm/inputs/UtilityNetworkAssociationsElementInput.d.ts +61 -0
  323. package/widgets/BatchAttributeForm/inputs/UtilityNetworkAssociationsElementInput.js +2 -0
  324. package/widgets/BatchAttributeForm/inputs/support/createBatchFormInputs.js +1 -1
  325. package/widgets/BatchAttributeForm/inputs/support/inputUtils.js +1 -1
  326. package/widgets/BatchAttributeForm/inputs/types.d.ts +9 -4
  327. package/widgets/BatchAttributeForm/templates/UtilityNetworkAssociationsElementTemplate.js +2 -0
  328. package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
  329. package/widgets/BatchAttributeForm/templates/support/hashElementTemplate.js +1 -1
  330. package/widgets/BatchAttributeForm/templates/support/templateUtils.js +1 -1
  331. package/widgets/BatchAttributeForm.js +1 -1
  332. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  333. package/widgets/FeatureTable/Grid/Column.d.ts +17 -2
  334. package/widgets/FeatureTable/Grid/Column.js +1 -1
  335. package/widgets/FeatureTable/Grid/Grid.js +1 -1
  336. package/widgets/FeatureTable/Grid/GridViewModel.js +1 -1
  337. package/widgets/FeatureTable/Grid/GroupColumn.d.ts +7 -1
  338. package/widgets/FeatureTable/Grid/GroupColumn.js +1 -1
  339. package/widgets/FeatureTable/support/ColumnTemplateBase.d.ts +9 -1
  340. package/widgets/FeatureTable/support/ColumnTemplateBase.js +1 -1
  341. package/widgets/FeatureTable/support/types.d.ts +8 -0
  342. package/widgets/FeatureTable.js +1 -1
  343. package/assets/esri/core/workers/chunks/2171aaa147aa4d9fc5b5.js +0 -1
  344. package/assets/esri/core/workers/chunks/38f1a86b8dd9ee684ee5.js +0 -596
  345. package/assets/esri/core/workers/chunks/54d07eadf113f0e4e506.js +0 -1
  346. package/assets/esri/core/workers/chunks/5818f1f526577068d6ca.js +0 -2
  347. package/assets/esri/core/workers/chunks/5ec66e39e53c11e75179.js +0 -2
  348. package/assets/esri/core/workers/chunks/5f6fd20a7f4e80eafa25.js +0 -1
  349. package/assets/esri/core/workers/chunks/6d2abdb48e17b2b56599.js +0 -1
  350. package/assets/esri/core/workers/chunks/7cdd0492b2191df95102.js +0 -2
  351. package/assets/esri/core/workers/chunks/7e530e635325dba07864.js +0 -1
  352. package/assets/esri/core/workers/chunks/8f4cd30ce23e41c1a42c.js +0 -1
  353. package/assets/esri/core/workers/chunks/936f2b1332ece14d7c28.js +0 -2
  354. package/assets/esri/core/workers/chunks/983f6c8727fd9484718e.js +0 -1
  355. package/assets/esri/core/workers/chunks/bd8cb64b6e08839398f3.js +0 -1
  356. package/assets/esri/core/workers/chunks/cbf1a03f54bd8d2a2b47.js +0 -1
  357. package/layers/support/ParquetGeometryEncodingWkb.js +0 -2
  358. package/views/2d/engine/webgl/PooledUint32Array.js +0 -2
  359. package/views/2d/engine/webgl/cpuMapped/Buffer.js +0 -2
  360. package/views/2d/engine/webgl/cpuMapped/MappedMesh.js +0 -2
  361. package/views/3d/webgl-engine/effects/glow/GlowRenderNode.js +0 -2
  362. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/DistanceFalloff.glsl.js +0 -4
  363. /package/assets/esri/core/workers/chunks/{5ec66e39e53c11e75179.js.LICENSE.txt → 577cbc131b21c351fae5.js.LICENSE.txt} +0 -0
  364. /package/assets/esri/core/workers/chunks/{ff713926985a284f5d81.js.LICENSE.txt → a844547bf33a8527ee9f.js.LICENSE.txt} +0 -0
  365. /package/assets/esri/core/workers/chunks/{5818f1f526577068d6ca.js.LICENSE.txt → bb5f909a2f26fc6a21b0.js.LICENSE.txt} +0 -0
  366. /package/assets/esri/core/workers/chunks/{7cdd0492b2191df95102.js.LICENSE.txt → ded2f19a1685db2137f4.js.LICENSE.txt} +0 -0
  367. /package/assets/esri/core/workers/chunks/{936f2b1332ece14d7c28.js.LICENSE.txt → ee057c85cdf6beb5b012.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{substitute as t}from"../intl.js";import{deprecateWidget as i}from"../core/deprecate.js";import n from"../core/Logger.js";import{getOrCreateMapValue as o}from"../core/MapUtils.js";import{watch as a,on as s}from"../core/reactiveUtils.js";import{property as r,subclass as l}from"../core/accessorSupport/decorators.js";import{isIntegerField as d}from"../layers/support/fieldUtils.js";import{isString as p}from"../support/guards.js";import u from"./Widget.js";import{getHiddenFieldsValidationErrorMessage as m,getVisibleFieldInputValidationErrorMessage as c,isElementTemplateWithInputType as h}from"./BatchAttributeForm/batchAttributeFormUtils.js";import v from"./BatchAttributeForm/BatchAttributeFormViewModel.js";import{css as b}from"./BatchAttributeForm/css.js";import f from"./BatchAttributeForm/VisibleElements.js";import{isGroupInput as C,isFieldInput as g,isTextElementInput as _,isRelationshipElementInput as y,differentValuesString as F}from"./BatchAttributeForm/inputs/support/inputUtils.js";import{loadCalciteComponents as I}from"./support/componentsUtils.js";import{getLabelForDateFieldValue as w,getIntlOptionsForField as x,prepareISOFieldValueForDateComponents as M,prepareUnixFieldValueForDateComponents as k,normalizeTimeOnlyString as O,getISOFieldValueFromDateComponents as D,getUnixFieldValueFromDateComponents as T}from"./support/dateUtils.js";import{globalCss as V}from"./support/globalCss.js";import{messageBundle as E,vmEvent as L,tsx as U}from"./support/widget.js";import{setFocus as R}from"./support/widgetUtils.js";import{isEmptyValue as S}from"./support/forms/formUtils.js";const B="data-element-id";let $=class extends u{constructor(e,t){super(e,t),this.headingLevel=2,this.messagesCommon=null,this.messages=null,this.featureFormMessages=null,this.viewModel=new v,this.visibleElements=new f,this.groupDisplay="all",this._attemptFocusOnNextRender=!1,this._dateComponentMap=new Map,this._touchedInputs=new Set,this._focusedFieldInput=null,this._batchSwitchInputInitialValues=new Map,this._saveInput=this._saveInput.bind(this),this._onFormSubmit=this._onFormSubmit.bind(this),this._onComponentFocus=this._onComponentFocus.bind(this),this._onComponentBlur=this._onComponentBlur.bind(this),this._afterComponentCreateOrUpdate=this._afterComponentCreateOrUpdate.bind(this),this._afterDateComponentCreate=this._afterDateComponentCreate.bind(this),this._afterRadioGroupCreateOrUpdate=this._afterRadioGroupCreateOrUpdate.bind(this),e?.suppressDeprecationWarning||(this.announceDeprecation=()=>{i(n.getLogger(this),"Editor","arcgis-editor",{version:"5.0"})})}normalizeCtorArgs(e={}){const{suppressDeprecationWarning:t,...i}=e;return i}initialize(){this.addHandles([a(()=>this.features,()=>{this._dateComponentMap.clear()}),a(()=>this.viewModel.activeForm,()=>{this._batchSwitchInputInitialValues.clear()}),s(()=>this.viewModel,"submit",()=>{this.valid||this.goToFirstError()})])}loadDependencies(){return I({input:()=>import("@esri/calcite-components/dist/components/calcite-input"),block:()=>import("@esri/calcite-components/dist/components/calcite-block"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item"),"combobox-item-group":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item-group"),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"),"input-date-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-date-picker"),"input-number":()=>import("@esri/calcite-components/dist/components/calcite-input-number"),"input-time-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-time-picker"),"input-time-zone":()=>import("@esri/calcite-components/dist/components/calcite-input-time-zone"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),"input-message":()=>import("@esri/calcite-components/dist/components/calcite-input-message"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch"),"text-area":()=>import("@esri/calcite-components/dist/components/calcite-text-area"),"radio-button":()=>import("@esri/calcite-components/dist/components/calcite-radio-button"),"radio-button-group":()=>import("@esri/calcite-components/dist/components/calcite-radio-button-group")})}get activeFeatureIndex(){return this.viewModel.activeFeatureIndex}set activeFeatureIndex(e){this.viewModel.activeFeatureIndex=e}get disabled(){return this.viewModel.disabled}set disabled(e){this.viewModel.disabled=e}get _effectiveDisabled(){return this.disabled||this.viewModel.updating}get features(){return this.viewModel.features}set features(e){this.viewModel.features=e}get map(){return this.viewModel.map}set map(e){this.viewModel.map=e}get maximumFeatureCount(){return this.viewModel.maximumFeatureCount}set maximumFeatureCount(e){this.viewModel.maximumFeatureCount=e}get maximumFeatureCountWithComplexForms(){return this.viewModel.maximumFeatureCountWithComplexForms}set maximumFeatureCountWithComplexForms(e){this.viewModel.maximumFeatureCountWithComplexForms=e}get spatialReference(){return this.viewModel.spatialReference}set spatialReference(e){this.viewModel.spatialReference=e}get layerInfos(){return this.viewModel.layerInfos}set layerInfos(e){this.viewModel.layerInfos=e}get timeZone(){return this.viewModel.timeZone}set timeZone(e){this.viewModel.timeZone=e}get icon(){return"edit-attributes"}set icon(e){this._overrideIfSome("icon",e)}get readOnly(){return this.viewModel.readOnly}set readOnly(e){this.viewModel.readOnly=e}get valid(){return this.viewModel.valid}goToFirstError(){const e=this.viewModel.getFirstVisibleInvalidFieldInput();if(!e)return;const{groupInput:t}=e;t&&(t.open||(t.open=!0)),this._focusedFieldInput=e.input,this._attemptFocusOnNextRender=!0,this.scheduleRender()}render(){const{status:e}=this.viewModel;return"failed"===e?this.viewModel.hasTooManyComplexFeatures?this._renderErrorNotice(t(this.messages.formFailedToLoadTooManyComplexFeatures,{num:this.viewModel.maximumFeatureCountWithComplexForms})):this.viewModel.hasTooManyFeatures?this._renderErrorNotice(t(this.messages.formFailedToLoadTooManyFeatures,{num:this.viewModel.maximumFeatureCount})):this._renderErrorNotice(this.messages.formFailedToLoad):this.viewModel.expressionEvaluationFailed?this._renderErrorNotice(this.messages.expressionEvaluationFailed):this.viewModel.hasLayersWithContingentValues?this._renderErrorNotice(this.messages.unsupportedContingentValues):U("div",{class:this.classes(b.base,V.widget,V.panel)},"loaded"===e?this._renderForm():"loading"===e&&this.visibleElements.loadingIndicator?U("calcite-loader",{key:"loader",label:this.messagesCommon?.loading}):null)}submit(){this.viewModel.submit()}_setDateTimeTimeZoneMap(e){const{datePart:t,elementId:i}=e.dataset,n=o(this._dateComponentMap,`${i}`,()=>({}));switch(t){case"date":n.date=e;break;case"time":n.time=e;break;case"timeZone":n.timeZone=e}}_renderErrorNotice(e){return U("div",{class:this.classes(b.base,V.widget,V.panel)},U("calcite-notice",{class:b.noticeError,icon:!0,kind:"warning",open:!0},U("div",{slot:"message"},e)))}_renderForm(){return U("form",{class:b.form,onsubmit:this._onFormSubmit},this._renderInvisibleFieldsError(),this._renderContent())}_renderInvisibleFieldsError(){const{viewModel:e}=this,{hasNonActiveInvalidFeatures:t,activeForm:i}=e;let n;if(!e.submitHasBeenAttempted)return null;if(i.invalidHiddenInputs.length>0)if(n=m(i,e.mode,this.messages),"batch"===this.viewModel.mode){const e=i.invalidHiddenInputs.filter(e=>"hidden:group-visibility-expression:all-features"===e.effectiveVisibilityCode||"hidden:visibility-expression:all-features"===e.visibilityCode);e.length>0?n+=` (${e.map(e=>e.label).join(", ")})`:n=null}else n+=` (${i.invalidHiddenInputs.map(e=>e.label).join(", ")})`;else if(t)return null;return n?U("calcite-notice",{class:b.noticeError,icon:!0,kind:"danger",open:!0},U("div",{slot:"message"},n)):null}_renderContent(){if(!this.viewModel.hasVisibleInputs)return[U("calcite-notice",{class:b.noticeError,icon:!0,kind:"warning",open:!0},U("div",{slot:"message"},this.messages.noVisibleFields[this.viewModel.noVisibleElementsReason]))];const{inputs:e}=this.viewModel.activeForm;return e.filter(e=>e.visible).map(e=>this._renderInput(e))}_renderInput(e){return C(e)?this._renderGroupInput(e):g(e)?this._renderLabeledField(e):_(e)?this._renderTextComponent(e):y(e)?this._renderRelationshipElementInput(e):void 0}_renderGroupInput(e){const{inputs:t,template:i,open:n}=e,o=t.filter(e=>e.visible),a=i.label??"";return U("calcite-block",{class:this.classes(b.group,"sequential"===this.groupDisplay?b.groupSequential:null,this.disabled?b.inputDisabled:null),collapsible:!0,description:i.description??void 0,disabled:this._effectiveDisabled,expanded:n,heading:a,headingLevel:this.headingLevel,key:`{${i.elementId}-key}`,label:a,onCalciteBlockClose:()=>{e.open=!1},onCalciteBlockOpen:()=>{e.open=!0}},o.map(e=>this._renderInput(e)))}_renderLabeledField(e){const{elementId:i}=e.template,{label:n,required:o,dataType:a}=e,s=o?t(this.messages.requiredFieldLabel,{name:n}):n;return U("calcite-label",{"aria-label":s,class:b.label,key:`field--${i}`},U("div",{class:b.labelTextContent,key:"labelTextContainer"},n,o?U("span",{"aria-hidden":"true",title:this.messagesCommon.required},"*"):void 0),"unsupported"!==a?this._renderFieldInput(e):this._renderReadOnlyComponent(e),this._renderAuxiliaryText(e))}_renderFieldInput(e){const t=this.getCommonInputProps(e),{dataType:i}=e;return"date"===i?this._renderDateComponents(e,t):"coded-value"===e.domain?.type?this._renderCodedInputs({input:e,props:t}):"number"===i?this._renderNumberComponent(e,t):this._renderStringComponent(e,t)}_renderAuxiliaryText(e){const{compositeError:t,description:i,submittable:n}=e,o=!n&&t&&(this.viewModel.submitHasBeenAttempted||this._touchedInputs.has(e.template.elementId))?c(e,t,this.messages):null;return o?U("calcite-input-message",{icon:!0,status:"invalid"},o):i?U("calcite-input-message",{class:b.description,icon:!1,status:"idle"},i):null}_renderCodedInputs({input:e,props:t}){const i=e.template.input?.type??null,n=e.codedValueOptions;switch(i){case"switch":return this._renderSwitchField({input:e,props:t});case"radio-buttons":return this._renderRadioButtonGroupComponent({input:e,options:n.flat(),props:t});default:return this._renderComboBoxComponent({options:n,props:t,input:e})}}_renderSwitchField({input:e,props:t}){if((this._batchSwitchInputInitialValues.get(e)===F||e.value===F)&&"batch"===this.viewModel.mode){const i={dropdown:{afterCreate:this._afterComponentCreateOrUpdate,afterUpdate:this._afterComponentCreateOrUpdate,disabled:t.readOnly,open:!1,[B]:t[B]},trigger:{appearance:"transparent",iconEnd:"chevron-down",kind:"neutral",slot:"trigger",label:t.label},group:{mode:"single"}};return this._renderDropdownComponent({buttonValue:e.value,dropdownProps:i,options:[{name:this.messages.differentValuesPlaceholder,value:F,disabled:!0},...e.codedValueDomainOptions]})}return this._renderSwitchComponent({input:e,props:t})}_renderSwitchComponent({input:e,props:t}){return U("calcite-switch",{...t,checked:!!h(e.template,"switch")&&e.value===e.template.input.onValue,class:b.inputSwitch,disabled:t.readOnly,onblur:()=>{this._focusedFieldInput=null},onCalciteSwitchChange:({currentTarget:e})=>this._saveInput(e)})}_renderDropdownComponent({buttonValue:e,options:t,dropdownProps:i}){const{trigger:n,dropdown:o,group:a}=i;return U("calcite-dropdown",{...o,onblur:()=>{this._focusedFieldInput=null},onfocus:this._onComponentFocus,topLayerDisabled:this.topLayerDisabled,onCalciteDropdownSelect:({currentTarget:e})=>this._saveInput(e)},U("calcite-button",{...n},e===F?this.messages.differentValuesPlaceholder:e),U("calcite-dropdown-group",{selectionMode:a.mode},t.map(t=>U("calcite-dropdown-item",{disabled:t.disabled,label:String(t.name),selected:e===t.value},t.name))))}_renderComboBoxComponent({input:e,options:t,props:i}){const n="INSERT"===this.viewModel.editType,o=this._touchedInputs.has(e?.template?.elementId),a=n&&e.showNoValueOptionEnabled&&!o?()=>{}:i.onblur,s={...i,onblur:a};return U("calcite-combobox",{...s,selectionMode:"single",topLayerDisabled:this.topLayerDisabled,value:i.placeholder===this.messages.differentValuesPlaceholder?F:String(i.value),onCalciteComboboxChange:({currentTarget:e})=>{e.value!==F&&this._saveInput(e)}},this.renderComboboxOptionsList({input:e,options:t,props:i}))}renderComboboxOptionsList({input:e,options:t,props:i}){const[n,o]=t.map(e=>e.map(({name:e,value:t})=>U("calcite-combobox-item",{heading:e,key:`#${t}`,selected:i.value===t,value:`${t}`}))),a=[...n];o.length>0&&a.push(U("calcite-combobox-item-group",{key:"unsupported",label:this.featureFormMessages.subtypes.unsupportedDomainGroupTitle},o));const s=i.placeholder===this.messages.differentValuesPlaceholder,r=!s&&S(i.value);return e.showNoValueOptionEnabled&&a.unshift(U("calcite-combobox-item",{heading:e.showNoValueLabel||this.messages.empty,key:"empty-option",selected:r,value:""})),s&&a.unshift(U("calcite-combobox-item",{heading:this.messages.differentValuesPlaceholder,key:F,selected:!0,value:F})),a}_renderRadioButtonGroupComponent({input:e,options:t,props:i}){const n=t.map(({name:t,value:n})=>this._renderRadioButtons({label:t,value:n,selected:n===e.value,props:i}));if(e.showNoValueOptionEnabled){const t="",o=e.showNoValueLabel||this.messages.empty,a=S(e.value);n.unshift(this._renderRadioButtons({label:o,value:t,selected:a,props:i}))}return U("calcite-radio-button-group",{afterCreate:this._afterRadioGroupCreateOrUpdate,afterUpdate:this._afterRadioGroupCreateOrUpdate,class:b.inputRadioGroup,disabled:i.readOnly,key:`${i.key}-radio-group`,layout:"vertical",name:i.name,required:i.required},n,i.placeholder===this.messages.differentValuesPlaceholder?U("calcite-label",{class:b.placeholderRadio,key:i.label,layout:"inline"},U("calcite-radio-button",{checked:!0,class:b.inputRadio,disabled:!0,name:i.placeholder,value:i.placeholder}),i.placeholder):null)}_renderRadioButtons({value:e,selected:t,label:i,props:n}){return U("calcite-label",{class:b.inputRadioLabel,key:n.label,layout:"inline"},U("calcite-radio-button",{...n,afterCreate:void 0,afterUpdate:void 0,checked:t,class:b.inputRadio,disabled:n.readOnly,name:n.label,onblur:()=>{this._focusedFieldInput=null},value:e,onCalciteRadioButtonChange:({currentTarget:e})=>{e.checked&&this._saveInput(e)}}),i)}_renderStringComponent(e,t){const{template:i}=e;return!i.field.editable||this.readOnly?this._renderReadOnlyComponent(e):"text-area"===i.input?.type?U("calcite-text-area",{...t,class:this.classes(b.individualElement),resize:"vertical",value:t.value?String(t.value):"",onCalciteTextAreaInput:({currentTarget:e})=>this._saveInput(e)}):U("calcite-input",{...t,class:this.classes(b.individualElement),type:"text",value:t.value?String(t.value):"",onCalciteInputInput:({currentTarget:e})=>this._saveInput(e)})}_renderNumberComponent(e,t){const i=d(e.field);return U("calcite-input-number",{...t,integer:i,type:"number",value:i&&""!==t.value?Math.round(parseFloat(String(t.value))).toString():String(t.value),onCalciteInputNumberInput:({currentTarget:e})=>this._saveInput(e)})}_renderReadOnlyComponent(e,t){const i=this.getCommonInputProps(e);return U("calcite-input",{...i,class:this.classes(b.fieldInput,b.inputDisabled,b.individualElement),readOnly:!0,type:"text",value:String(t??i.value??"")})}_renderDateComponents(e,t){const{field:i}=e;let n;switch(i.type){case"date":n=this._renderDateFieldComponents(e,t);break;case"date-only":n=this._renderDateOnlyFieldComponent(e,t);break;case"time-only":n=this._renderTimeOnlyFieldComponent(e,t);break;case"timestamp-offset":n=this._renderTimestampOffsetFieldComponents(e,t);break;default:n=this._renderReadOnlyComponent(e,w(i,t.value,{timeZone:e.effectiveTimeZone,...x(e.template.field)}))}return e.value===F?[n,U("calcite-input-message",{icon:"information",key:"diff-values-message",status:"idle"},this.messages.differentValues)]:n}_renderDateOnlyFieldComponent(e,t){const{class:i,key:n,readOnly:o}=t,{rawMax:a,rawMin:s}=e.range;return U("calcite-input-date-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,class:i,"data-date-part":"date","data-element-id":t[B],key:`${n}-date-input`,max:p(a)?a:void 0,min:p(s)?s:void 0,onblur:()=>{this._focusedFieldInput=null},onfocus:this._onComponentFocus,overlayPositioning:"fixed",readOnly:o,topLayerDisabled:this.topLayerDisabled,value:e.value===F?"":e.value?String(e.value):"",onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.currentTarget)})}_renderTimeOnlyFieldComponent(e,t){const{class:i,key:n,readOnly:o}=t;return U("calcite-input-time-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,class:i,"data-date-part":"time","data-element-id":t[B],key:`${n}-time-input`,onblur:()=>{this._focusedFieldInput=null},onfocus:this._onComponentFocus,overlayPositioning:"fixed",readOnly:o,value:e.value===F?"":e.value?String(e.value):"",onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.currentTarget)})}_renderTimestampOffsetFieldComponents(e,t){const{class:i,key:n,readOnly:o}=t,{rawMax:a,rawMin:s}=e.range,r=M(a),l=M(s),d=M(e.value===F?"":e.value),p=e.includeTimeOffset,u={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,overlayPositioning:"fixed",readOnly:o,[B]:t[B],onfocus:this._onComponentFocus};return U("div",{class:b.dateInputContainer,key:`${n}-date-time-container`},U("calcite-input-date-picker",{...u,class:i,"data-date-part":"date",key:`${n}-date-input`,max:r?.date??void 0,min:l?.date??void 0,onblur:()=>{this._focusedFieldInput=null},topLayerDisabled:this.topLayerDisabled,value:d.date??"",onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),U("calcite-input-time-picker",{...u,class:i,"data-date-part":"time",key:`${n}-time-input`,onblur:()=>{this._focusedFieldInput=null},value:d.time??"",onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),p?U("calcite-input-time-zone",{...u,class:i,clearable:e.value===F||null==e.value,"data-date-part":"timeZone",key:`${n}-timezone-input`,onblur:()=>{this._focusedFieldInput=null},value:d.timeZoneOffset||"",onCalciteInputTimeZoneChange:t=>this._saveValueFromDateComponent(e,t.target)}):null)}_renderDateFieldComponents(e,t){const{class:i,key:n,readOnly:o,min:a,max:s}=t,r=e.effectiveTimeZone,l=k(e.value===F?"":e.value,r),d=k(s,r),p=k(a,r),u=e.includeTime,m={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,overlayPositioning:"fixed",readOnly:o,[B]:t[B],onfocus:this._onComponentFocus};return U("div",{class:b.dateInputContainer,key:`${n}-date-time-container`},U("calcite-input-date-picker",{...m,class:i,"data-date-part":"date",key:`${n}-date-input`,max:d?.date??void 0,min:p?.date??void 0,onblur:()=>{this._focusedFieldInput=null},topLayerDisabled:this.topLayerDisabled,value:l.date??"",onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),u?U("calcite-input-time-picker",{...m,"data-date-part":"time",key:`${n}-time-input`,onblur:()=>{this._focusedFieldInput=null},step:1,value:l.time??"",onCalciteInputTimePickerChange:t=>{this._saveValueFromDateComponent(e,t.target)}}):null)}_renderRelationshipElementInput(e){const{elementId:t}=e.template;return U("div",{class:b.relationshipElementInput,"data-testid":`relationship-element-${t}`,key:`relationship-element-${t}`})}_renderTextComponent(e){const{elementId:t}=e.template;return U("div",{class:b.textElementInput,"data-testid":`text-element-${t}`,innerHTML:e.text,key:`text-element-${t}`})}getCommonInputProps(e){const{template:t,valid:i,value:n,minLength:o,maxLength:a,required:s,fieldName:r,editable:l,userHasChangedValue:d,range:{max:p,min:u}}=e,m=!l||this.readOnly,c=!m&&this._effectiveDisabled;let h=t.hint??void 0,v=!1;return n===F&&(h=this.messages.differentValuesPlaceholder,v=!0),{afterCreate:this._afterComponentCreateOrUpdate,afterUpdate:this._afterComponentCreateOrUpdate,"aria-invalid":i?"false":"true",class:this.classes(b.fieldInput,m?b.inputDisabled:null),status:!d&&!this.viewModel.submitHasBeenAttempted||i?"idle":"invalid",maxLength:a&&a>-1?a:void 0,minLength:o&&o>-1?o:void 0,key:t.elementId,label:r,name:r,max:null!=p?p:void 0,min:null!=u?u:void 0,disabled:c,readOnly:m,onblur:this._onComponentBlur,required:s,placeholder:h,value:v?"":n??"",[B]:t.elementId,onfocus:this._onComponentFocus}}_onFormSubmit(e){e.preventDefault()}_getFieldInputFromHTMLElement(e){return this.viewModel.findFieldInput(e.getAttribute(B))}_afterRadioGroupCreateOrUpdate(e){const t=e.selectedItem,i=e.querySelector("calcite-radio-button"),n=t||i;n&&this._afterComponentCreateOrUpdate(n)}_onComponentFocus(e){const t=e.target,i=this._getFieldInputFromHTMLElement(t);this._touchedInputs.add(i.template.elementId),this._focusedFieldInput=i}_afterComponentCreateOrUpdate(e){const t=this._getFieldInputFromHTMLElement(e),i=this._focusedFieldInput;this._attemptFocusOnNextRender&&i===t&&(this._attemptFocusOnNextRender=!1,R(e))}_onComponentBlur(){this._focusedFieldInput=null}_parseValue(e,t){if(h(t.template,"switch")){if("calcite-dropdown"===e.localName&&t.domain)for(const i of t.domain.codedValues)if(i.name===e.selectedItems[0].textContent)return i.code;return e.checked?t.template.input.onValue:t.template.input.offValue}const i=e.value;return null==i||""===i?null:"number"===t.dataType?"-0"===i||"-0."===i||"-0,"===i?i:parseFloat(i):"date"===t.field.type?parseFloat(i):i}_saveInput(e){const t=this._getFieldInputFromHTMLElement(e),{elementId:i}=t.template;if(!t)return;const n=t?.value;if(h(t.template,"switch")&&"single"!==this.viewModel.mode){const e=o(this._batchSwitchInputInitialValues,t,()=>t.value);this._batchSwitchInputInitialValues.set(t,null===e?n:e)}const a=this._parseValue(e,t);a!==n&&this.viewModel.setValue(i,a)}_afterDateComponentCreate(e){this._setDateTimeTimeZoneMap(e),this._afterComponentCreateOrUpdate(e)}_saveValueFromDateComponent(e,t){const{elementId:i}=e.template,n=e.field.type,o=this._dateComponentMap.get(`${i}`);if(!o)return;const a=e.effectiveTimeZone;let s=e.value===F?void 0:e.value,r=null;"date-only"===n?r=Array.isArray(t.value)?t.value[0]:t.value:"time-only"===n?(s=O(s),r=O(t.value)):r="timestamp-offset"===n?null!=t.value?D({dateComponent:o.date,timeComponent:o.time,oldValue:s,timeZoneComponent:o.timeZone,defaultTimeZone:a}):null:null!=t.value?T({oldValue:s,dateComponent:o.date,timeZone:a,timeComponent:o.time?.value===F?void 0:o.time}):null,s!==r&&(null!==r&&t.value?this.viewModel.setValue(`${i}`,r):this.viewModel.setValue(`${i}`,null))}};e([r()],$.prototype,"activeFeatureIndex",null),e([r()],$.prototype,"disabled",null),e([r()],$.prototype,"_effectiveDisabled",null),e([r()],$.prototype,"features",null),e([r()],$.prototype,"map",null),e([r()],$.prototype,"maximumFeatureCount",null),e([r()],$.prototype,"maximumFeatureCountWithComplexForms",null),e([r()],$.prototype,"spatialReference",null),e([r()],$.prototype,"layerInfos",null),e([r()],$.prototype,"timeZone",null),e([r()],$.prototype,"headingLevel",void 0),e([r()],$.prototype,"icon",null),e([r(),E("esri/t9n/common")],$.prototype,"messagesCommon",void 0),e([r(),E("esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm")],$.prototype,"messages",void 0),e([r(),E("esri/widgets/FeatureForm/t9n/FeatureForm")],$.prototype,"featureFormMessages",void 0),e([r()],$.prototype,"readOnly",null),e([r()],$.prototype,"valid",null),e([r({type:v}),L(["value-change","submit"])],$.prototype,"viewModel",void 0),e([r({type:f,nonNullable:!0})],$.prototype,"visibleElements",void 0),e([r()],$.prototype,"groupDisplay",void 0),$=e([l("esri.widgets.BatchAttributeForm")],$);const N=$;export{N as default};
2
+ import{__decorate as e}from"tslib";import{substitute as t}from"../intl.js";import{deprecateWidget as i}from"../core/deprecate.js";import n from"../core/Logger.js";import{getOrCreateMapValue as o}from"../core/MapUtils.js";import{watch as a,on as s}from"../core/reactiveUtils.js";import{property as r,subclass as l}from"../core/accessorSupport/decorators.js";import{isIntegerField as d}from"../layers/support/fieldUtils.js";import{isString as p}from"../support/guards.js";import u from"./Widget.js";import{getHiddenFieldsValidationErrorMessage as m,getVisibleFieldInputValidationErrorMessage as c,isElementTemplateWithInputType as h}from"./BatchAttributeForm/batchAttributeFormUtils.js";import v from"./BatchAttributeForm/BatchAttributeFormViewModel.js";import{css as b}from"./BatchAttributeForm/css.js";import f from"./BatchAttributeForm/VisibleElements.js";import{isGroupInput as C,isFieldInput as g,isTextElementInput as _,isRelationshipElementInput as y,isUtilityNetworkAssociationsElementInput as F,differentValuesString as I}from"./BatchAttributeForm/inputs/support/inputUtils.js";import{loadCalciteComponents as w}from"./support/componentsUtils.js";import{getLabelForDateFieldValue as x,getIntlOptionsForField as M,prepareISOFieldValueForDateComponents as k,prepareUnixFieldValueForDateComponents as O,normalizeTimeOnlyString as D,getISOFieldValueFromDateComponents as T,getUnixFieldValueFromDateComponents as V}from"./support/dateUtils.js";import{globalCss as E}from"./support/globalCss.js";import{messageBundle as L,vmEvent as U,tsx as R}from"./support/widget.js";import{setFocus as S}from"./support/widgetUtils.js";import{isEmptyValue as B}from"./support/forms/formUtils.js";const N="data-element-id";let A=class extends u{constructor(e,t){super(e,t),this.headingLevel=2,this.messagesCommon=null,this.messages=null,this.featureFormMessages=null,this.viewModel=new v,this.visibleElements=new f,this.groupDisplay="all",this._attemptFocusOnNextRender=!1,this._dateComponentMap=new Map,this._touchedInputs=new Set,this._focusedFieldInput=null,this._batchSwitchInputInitialValues=new Map,this._saveInput=this._saveInput.bind(this),this._onFormSubmit=this._onFormSubmit.bind(this),this._onComponentFocus=this._onComponentFocus.bind(this),this._onComponentBlur=this._onComponentBlur.bind(this),this._afterComponentCreateOrUpdate=this._afterComponentCreateOrUpdate.bind(this),this._afterDateComponentCreate=this._afterDateComponentCreate.bind(this),this._afterRadioGroupCreateOrUpdate=this._afterRadioGroupCreateOrUpdate.bind(this),e?.suppressDeprecationWarning||(this.announceDeprecation=()=>{i(n.getLogger(this),"Editor","arcgis-editor",{version:"5.0"})})}normalizeCtorArgs(e={}){const{suppressDeprecationWarning:t,...i}=e;return i}initialize(){this.addHandles([a(()=>this.features,()=>{this._dateComponentMap.clear()}),a(()=>this.viewModel.activeForm,()=>{this._batchSwitchInputInitialValues.clear()}),s(()=>this.viewModel,"submit",()=>{this.valid||this.goToFirstError()})])}loadDependencies(){return w({input:()=>import("@esri/calcite-components/dist/components/calcite-input"),block:()=>import("@esri/calcite-components/dist/components/calcite-block"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item"),"combobox-item-group":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item-group"),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"),"input-date-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-date-picker"),"input-number":()=>import("@esri/calcite-components/dist/components/calcite-input-number"),"input-time-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-time-picker"),"input-time-zone":()=>import("@esri/calcite-components/dist/components/calcite-input-time-zone"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),"input-message":()=>import("@esri/calcite-components/dist/components/calcite-input-message"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch"),"text-area":()=>import("@esri/calcite-components/dist/components/calcite-text-area"),"radio-button":()=>import("@esri/calcite-components/dist/components/calcite-radio-button"),"radio-button-group":()=>import("@esri/calcite-components/dist/components/calcite-radio-button-group")})}get activeFeatureIndex(){return this.viewModel.activeFeatureIndex}set activeFeatureIndex(e){this.viewModel.activeFeatureIndex=e}get disabled(){return this.viewModel.disabled}set disabled(e){this.viewModel.disabled=e}get _effectiveDisabled(){return this.disabled||this.viewModel.updating}get features(){return this.viewModel.features}set features(e){this.viewModel.features=e}get map(){return this.viewModel.map}set map(e){this.viewModel.map=e}get maximumFeatureCount(){return this.viewModel.maximumFeatureCount}set maximumFeatureCount(e){this.viewModel.maximumFeatureCount=e}get maximumFeatureCountWithComplexForms(){return this.viewModel.maximumFeatureCountWithComplexForms}set maximumFeatureCountWithComplexForms(e){this.viewModel.maximumFeatureCountWithComplexForms=e}get spatialReference(){return this.viewModel.spatialReference}set spatialReference(e){this.viewModel.spatialReference=e}get layerInfos(){return this.viewModel.layerInfos}set layerInfos(e){this.viewModel.layerInfos=e}get timeZone(){return this.viewModel.timeZone}set timeZone(e){this.viewModel.timeZone=e}get icon(){return"edit-attributes"}set icon(e){this._overrideIfSome("icon",e)}get readOnly(){return this.viewModel.readOnly}set readOnly(e){this.viewModel.readOnly=e}get valid(){return this.viewModel.valid}goToFirstError(){const e=this.viewModel.getFirstVisibleInvalidFieldInput();if(!e)return;const{groupInput:t}=e;t&&(t.open||(t.open=!0)),this._focusedFieldInput=e.input,this._attemptFocusOnNextRender=!0,this.scheduleRender()}render(){const{status:e}=this.viewModel;return"failed"===e?this.viewModel.hasTooManyComplexFeatures?this._renderErrorNotice(t(this.messages.formFailedToLoadTooManyComplexFeatures,{num:this.viewModel.maximumFeatureCountWithComplexForms})):this.viewModel.hasTooManyFeatures?this._renderErrorNotice(t(this.messages.formFailedToLoadTooManyFeatures,{num:this.viewModel.maximumFeatureCount})):this._renderErrorNotice(this.messages.formFailedToLoad):this.viewModel.expressionEvaluationFailed?this._renderErrorNotice(this.messages.expressionEvaluationFailed):this.viewModel.hasLayersWithContingentValues?this._renderErrorNotice(this.messages.unsupportedContingentValues):R("div",{class:this.classes(b.base,E.widget,E.panel)},"loaded"===e?this._renderForm():"loading"===e&&this.visibleElements.loadingIndicator?R("calcite-loader",{key:"loader",label:this.messagesCommon?.loading}):null)}submit(){this.viewModel.submit()}_setDateTimeTimeZoneMap(e){const{datePart:t,elementId:i}=e.dataset,n=o(this._dateComponentMap,`${i}`,()=>({}));switch(t){case"date":n.date=e;break;case"time":n.time=e;break;case"timeZone":n.timeZone=e}}_renderErrorNotice(e){return R("div",{class:this.classes(b.base,E.widget,E.panel)},R("calcite-notice",{class:b.noticeError,icon:!0,kind:"warning",open:!0},R("div",{slot:"message"},e)))}_renderForm(){return R("form",{class:b.form,onsubmit:this._onFormSubmit},this._renderInvisibleFieldsError(),this._renderContent())}_renderInvisibleFieldsError(){const{viewModel:e}=this,{hasNonActiveInvalidFeatures:t,activeForm:i}=e;let n;if(!e.submitHasBeenAttempted)return null;if(i.invalidHiddenInputs.length>0)if(n=m(i,e.mode,this.messages),"batch"===this.viewModel.mode){const e=i.invalidHiddenInputs.filter(e=>"hidden:group-visibility-expression:all-features"===e.effectiveVisibilityCode||"hidden:visibility-expression:all-features"===e.visibilityCode);e.length>0?n+=` (${e.map(e=>e.label).join(", ")})`:n=null}else n+=` (${i.invalidHiddenInputs.map(e=>e.label).join(", ")})`;else if(t)return null;return n?R("calcite-notice",{class:b.noticeError,icon:!0,kind:"danger",open:!0},R("div",{slot:"message"},n)):null}_renderContent(){if(!this.viewModel.hasVisibleInputs)return[R("calcite-notice",{class:b.noticeError,icon:!0,kind:"warning",open:!0},R("div",{slot:"message"},this.messages.noVisibleFields[this.viewModel.noVisibleElementsReason]))];const{inputs:e}=this.viewModel.activeForm;return e.filter(e=>e.visible).map(e=>this._renderInput(e))}_renderInput(e){return C(e)?this._renderGroupInput(e):g(e)?this._renderLabeledField(e):_(e)?this._renderTextComponent(e):y(e)?this._renderRelationshipElementInput(e):F(e)?this._renderUtilityNetworkAssociationsElementInput(e):void 0}_renderGroupInput(e){const{inputs:t,template:i,open:n}=e,o=t.filter(e=>e.visible),a=i.label??"";return R("calcite-block",{class:this.classes(b.group,"sequential"===this.groupDisplay?b.groupSequential:null,this.disabled?b.inputDisabled:null),collapsible:!0,description:i.description??void 0,disabled:this._effectiveDisabled,expanded:n,heading:a,headingLevel:this.headingLevel,key:`{${i.elementId}-key}`,label:a,onCalciteBlockClose:()=>{e.open=!1},onCalciteBlockOpen:()=>{e.open=!0}},o.map(e=>this._renderInput(e)))}_renderLabeledField(e){const{elementId:i}=e.template,{label:n,required:o,dataType:a}=e,s=o?t(this.messages.requiredFieldLabel,{name:n}):n;return R("calcite-label",{"aria-label":s,class:b.label,key:`field--${i}`},R("div",{class:b.labelTextContent,key:"labelTextContainer"},n,o?R("span",{"aria-hidden":"true",title:this.messagesCommon.required},"*"):void 0),"unsupported"!==a?this._renderFieldInput(e):this._renderReadOnlyComponent(e),this._renderAuxiliaryText(e))}_renderFieldInput(e){const t=this.getCommonInputProps(e),{dataType:i}=e;return"date"===i?this._renderDateComponents(e,t):"coded-value"===e.domain?.type?this._renderCodedInputs({input:e,props:t}):"number"===i?this._renderNumberComponent(e,t):this._renderStringComponent(e,t)}_renderAuxiliaryText(e){const{compositeError:t,description:i,submittable:n}=e,o=!n&&t&&(this.viewModel.submitHasBeenAttempted||this._touchedInputs.has(e.template.elementId))?c(e,t,this.messages):null;return o?R("calcite-input-message",{icon:!0,status:"invalid"},o):i?R("calcite-input-message",{class:b.description,icon:!1,status:"idle"},i):null}_renderCodedInputs({input:e,props:t}){const i=e.template.input?.type??null,n=e.codedValueOptions;switch(i){case"switch":return this._renderSwitchField({input:e,props:t});case"radio-buttons":return this._renderRadioButtonGroupComponent({input:e,options:n.flat(),props:t});default:return this._renderComboBoxComponent({options:n,props:t,input:e})}}_renderSwitchField({input:e,props:t}){if((this._batchSwitchInputInitialValues.get(e)===I||e.value===I)&&"batch"===this.viewModel.mode){const i={dropdown:{afterCreate:this._afterComponentCreateOrUpdate,afterUpdate:this._afterComponentCreateOrUpdate,disabled:t.readOnly,open:!1,[N]:t[N]},trigger:{appearance:"transparent",iconEnd:"chevron-down",kind:"neutral",slot:"trigger",label:t.label},group:{mode:"single"}};return this._renderDropdownComponent({buttonValue:e.value,dropdownProps:i,options:[{name:this.messages.differentValuesPlaceholder,value:I,disabled:!0},...e.codedValueDomainOptions]})}return this._renderSwitchComponent({input:e,props:t})}_renderSwitchComponent({input:e,props:t}){return R("calcite-switch",{...t,checked:!!h(e.template,"switch")&&e.value===e.template.input.onValue,class:b.inputSwitch,disabled:t.readOnly,onblur:()=>{this._focusedFieldInput=null},onCalciteSwitchChange:({currentTarget:e})=>this._saveInput(e)})}_renderDropdownComponent({buttonValue:e,options:t,dropdownProps:i}){const{trigger:n,dropdown:o,group:a}=i;return R("calcite-dropdown",{...o,onblur:()=>{this._focusedFieldInput=null},onfocus:this._onComponentFocus,topLayerDisabled:this.topLayerDisabled,onCalciteDropdownSelect:({currentTarget:e})=>this._saveInput(e)},R("calcite-button",{...n},e===I?this.messages.differentValuesPlaceholder:e),R("calcite-dropdown-group",{selectionMode:a.mode},t.map(t=>R("calcite-dropdown-item",{disabled:t.disabled,label:String(t.name),selected:e===t.value},t.name))))}_renderComboBoxComponent({input:e,options:t,props:i}){const n="INSERT"===this.viewModel.editType,o=this._touchedInputs.has(e?.template?.elementId),a=n&&e.showNoValueOptionEnabled&&!o?()=>{}:i.onblur,s={...i,onblur:a};return R("calcite-combobox",{...s,selectionMode:"single",topLayerDisabled:this.topLayerDisabled,value:i.placeholder===this.messages.differentValuesPlaceholder?I:String(i.value),onCalciteComboboxChange:({currentTarget:e})=>{e.value!==I&&this._saveInput(e)}},this.renderComboboxOptionsList({input:e,options:t,props:i}))}renderComboboxOptionsList({input:e,options:t,props:i}){const[n,o]=t.map(e=>e.map(({name:e,value:t})=>R("calcite-combobox-item",{heading:e,key:`#${t}`,selected:i.value===t,value:`${t}`}))),a=[...n];o.length>0&&a.push(R("calcite-combobox-item-group",{key:"unsupported",label:this.featureFormMessages.subtypes.unsupportedDomainGroupTitle},o));const s=i.placeholder===this.messages.differentValuesPlaceholder,r=!s&&B(i.value);return e.showNoValueOptionEnabled&&a.unshift(R("calcite-combobox-item",{heading:e.showNoValueLabel||this.messages.empty,key:"empty-option",selected:r,value:""})),s&&a.unshift(R("calcite-combobox-item",{heading:this.messages.differentValuesPlaceholder,key:I,selected:!0,value:I})),a}_renderRadioButtonGroupComponent({input:e,options:t,props:i}){const n=t.map(({name:t,value:n})=>this._renderRadioButtons({label:t,value:n,selected:n===e.value,props:i}));if(e.showNoValueOptionEnabled){const t="",o=e.showNoValueLabel||this.messages.empty,a=B(e.value);n.unshift(this._renderRadioButtons({label:o,value:t,selected:a,props:i}))}return R("calcite-radio-button-group",{afterCreate:this._afterRadioGroupCreateOrUpdate,afterUpdate:this._afterRadioGroupCreateOrUpdate,class:b.inputRadioGroup,disabled:i.readOnly,key:`${i.key}-radio-group`,layout:"vertical",name:i.name,required:i.required},n,i.placeholder===this.messages.differentValuesPlaceholder?R("calcite-label",{class:b.placeholderRadio,key:i.label,layout:"inline"},R("calcite-radio-button",{checked:!0,class:b.inputRadio,disabled:!0,name:i.placeholder,value:i.placeholder}),i.placeholder):null)}_renderRadioButtons({value:e,selected:t,label:i,props:n}){return R("calcite-label",{class:b.inputRadioLabel,key:n.label,layout:"inline"},R("calcite-radio-button",{...n,afterCreate:void 0,afterUpdate:void 0,checked:t,class:b.inputRadio,disabled:n.readOnly,name:n.label,onblur:()=>{this._focusedFieldInput=null},value:e,onCalciteRadioButtonChange:({currentTarget:e})=>{e.checked&&this._saveInput(e)}}),i)}_renderStringComponent(e,t){const{template:i}=e;return!i.field.editable||this.readOnly?this._renderReadOnlyComponent(e):"text-area"===i.input?.type?R("calcite-text-area",{...t,class:this.classes(b.individualElement),resize:"vertical",value:t.value?String(t.value):"",onCalciteTextAreaInput:({currentTarget:e})=>this._saveInput(e)}):R("calcite-input",{...t,class:this.classes(b.individualElement),type:"text",value:t.value?String(t.value):"",onCalciteInputInput:({currentTarget:e})=>this._saveInput(e)})}_renderNumberComponent(e,t){const i=d(e.field);return R("calcite-input-number",{...t,integer:i,type:"number",value:i&&""!==t.value?Math.round(parseFloat(String(t.value))).toString():String(t.value),onCalciteInputNumberInput:({currentTarget:e})=>this._saveInput(e)})}_renderReadOnlyComponent(e,t){const i=this.getCommonInputProps(e);return R("calcite-input",{...i,class:this.classes(b.fieldInput,b.inputDisabled,b.individualElement),readOnly:!0,type:"text",value:String(t??i.value??"")})}_renderDateComponents(e,t){const{field:i}=e;let n;switch(i.type){case"date":n=this._renderDateFieldComponents(e,t);break;case"date-only":n=this._renderDateOnlyFieldComponent(e,t);break;case"time-only":n=this._renderTimeOnlyFieldComponent(e,t);break;case"timestamp-offset":n=this._renderTimestampOffsetFieldComponents(e,t);break;default:n=this._renderReadOnlyComponent(e,x(i,t.value,{timeZone:e.effectiveTimeZone,...M(e.template.field)}))}return e.value===I?[n,R("calcite-input-message",{icon:"information",key:"diff-values-message",status:"idle"},this.messages.differentValues)]:n}_renderDateOnlyFieldComponent(e,t){const{class:i,key:n,readOnly:o}=t,{rawMax:a,rawMin:s}=e.range;return R("calcite-input-date-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,class:i,"data-date-part":"date","data-element-id":t[N],key:`${n}-date-input`,max:p(a)?a:void 0,min:p(s)?s:void 0,onblur:()=>{this._focusedFieldInput=null},onfocus:this._onComponentFocus,overlayPositioning:"fixed",readOnly:o,topLayerDisabled:this.topLayerDisabled,value:e.value===I?"":e.value?String(e.value):"",onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.currentTarget)})}_renderTimeOnlyFieldComponent(e,t){const{class:i,key:n,readOnly:o}=t;return R("calcite-input-time-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,class:i,"data-date-part":"time","data-element-id":t[N],key:`${n}-time-input`,onblur:()=>{this._focusedFieldInput=null},onfocus:this._onComponentFocus,overlayPositioning:"fixed",readOnly:o,value:e.value===I?"":e.value?String(e.value):"",onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.currentTarget)})}_renderTimestampOffsetFieldComponents(e,t){const{class:i,key:n,readOnly:o}=t,{rawMax:a,rawMin:s}=e.range,r=k(a),l=k(s),d=k(e.value===I?"":e.value),p=e.includeTimeOffset,u={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,overlayPositioning:"fixed",readOnly:o,[N]:t[N],onfocus:this._onComponentFocus};return R("div",{class:b.dateInputContainer,key:`${n}-date-time-container`},R("calcite-input-date-picker",{...u,class:i,"data-date-part":"date",key:`${n}-date-input`,max:r?.date??void 0,min:l?.date??void 0,onblur:()=>{this._focusedFieldInput=null},topLayerDisabled:this.topLayerDisabled,value:d.date??"",onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),R("calcite-input-time-picker",{...u,class:i,"data-date-part":"time",key:`${n}-time-input`,onblur:()=>{this._focusedFieldInput=null},value:d.time??"",onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),p?R("calcite-input-time-zone",{...u,class:i,clearable:e.value===I||null==e.value,"data-date-part":"timeZone",key:`${n}-timezone-input`,onblur:()=>{this._focusedFieldInput=null},value:d.timeZoneOffset||"",onCalciteInputTimeZoneChange:t=>this._saveValueFromDateComponent(e,t.target)}):null)}_renderDateFieldComponents(e,t){const{class:i,key:n,readOnly:o,min:a,max:s}=t,r=e.effectiveTimeZone,l=O(e.value===I?"":e.value,r),d=O(s,r),p=O(a,r),u=e.includeTime,m={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,overlayPositioning:"fixed",readOnly:o,[N]:t[N],onfocus:this._onComponentFocus};return R("div",{class:b.dateInputContainer,key:`${n}-date-time-container`},R("calcite-input-date-picker",{...m,class:i,"data-date-part":"date",key:`${n}-date-input`,max:d?.date??void 0,min:p?.date??void 0,onblur:()=>{this._focusedFieldInput=null},topLayerDisabled:this.topLayerDisabled,value:l.date??"",onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),u?R("calcite-input-time-picker",{...m,"data-date-part":"time",key:`${n}-time-input`,onblur:()=>{this._focusedFieldInput=null},step:1,value:l.time??"",onCalciteInputTimePickerChange:t=>{this._saveValueFromDateComponent(e,t.target)}}):null)}_renderRelationshipElementInput(e){const{elementId:t}=e.template;return R("div",{class:b.relationshipElementInput,"data-testid":`relationship-element-${t}`,key:`relationship-element-${t}`})}_renderTextComponent(e){const{elementId:t}=e.template;return R("div",{class:b.textElementInput,"data-testid":`text-element-${t}`,innerHTML:e.text,key:`text-element-${t}`})}_renderUtilityNetworkAssociationsElementInput(e){const{elementId:t}=e.template;return R("div",{class:b.utilityNetworkAssociationsElementInput,"data-testid":t,key:t})}getCommonInputProps(e){const{template:t,valid:i,value:n,minLength:o,maxLength:a,required:s,fieldName:r,editable:l,userHasChangedValue:d,range:{max:p,min:u}}=e,m=!l||this.readOnly,c=!m&&this._effectiveDisabled;let h=t.hint??void 0,v=!1;return n===I&&(h=this.messages.differentValuesPlaceholder,v=!0),{afterCreate:this._afterComponentCreateOrUpdate,afterUpdate:this._afterComponentCreateOrUpdate,"aria-invalid":i?"false":"true",class:this.classes(b.fieldInput,m?b.inputDisabled:null),status:!d&&!this.viewModel.submitHasBeenAttempted||i?"idle":"invalid",maxLength:a&&a>-1?a:void 0,minLength:o&&o>-1?o:void 0,key:t.elementId,label:r,name:r,max:null!=p?p:void 0,min:null!=u?u:void 0,disabled:c,readOnly:m,onblur:this._onComponentBlur,required:s,placeholder:h,value:v?"":n??"",[N]:t.elementId,onfocus:this._onComponentFocus}}_onFormSubmit(e){e.preventDefault()}_getFieldInputFromHTMLElement(e){return this.viewModel.findFieldInput(e.getAttribute(N))}_afterRadioGroupCreateOrUpdate(e){const t=e.selectedItem,i=e.querySelector("calcite-radio-button"),n=t||i;n&&this._afterComponentCreateOrUpdate(n)}_onComponentFocus(e){const t=e.target,i=this._getFieldInputFromHTMLElement(t);this._touchedInputs.add(i.template.elementId),this._focusedFieldInput=i}_afterComponentCreateOrUpdate(e){const t=this._getFieldInputFromHTMLElement(e),i=this._focusedFieldInput;this._attemptFocusOnNextRender&&i===t&&(this._attemptFocusOnNextRender=!1,S(e))}_onComponentBlur(){this._focusedFieldInput=null}_parseValue(e,t){if(h(t.template,"switch")){if("calcite-dropdown"===e.localName&&t.domain)for(const i of t.domain.codedValues)if(i.name===e.selectedItems[0].textContent)return i.code;return e.checked?t.template.input.onValue:t.template.input.offValue}const i=e.value;return null==i||""===i?null:"number"===t.dataType?"-0"===i||"-0."===i||"-0,"===i?i:parseFloat(i):"date"===t.field.type?parseFloat(i):i}_saveInput(e){const t=this._getFieldInputFromHTMLElement(e),{elementId:i}=t.template;if(!t)return;const n=t?.value;if(h(t.template,"switch")&&"single"!==this.viewModel.mode){const e=o(this._batchSwitchInputInitialValues,t,()=>t.value);this._batchSwitchInputInitialValues.set(t,null===e?n:e)}const a=this._parseValue(e,t);a!==n&&this.viewModel.setValue(i,a)}_afterDateComponentCreate(e){this._setDateTimeTimeZoneMap(e),this._afterComponentCreateOrUpdate(e)}_saveValueFromDateComponent(e,t){const{elementId:i}=e.template,n=e.field.type,o=this._dateComponentMap.get(`${i}`);if(!o)return;const a=e.effectiveTimeZone;let s=e.value===I?void 0:e.value,r=null;"date-only"===n?r=Array.isArray(t.value)?t.value[0]:t.value:"time-only"===n?(s=D(s),r=D(t.value)):r="timestamp-offset"===n?null!=t.value?T({dateComponent:o.date,timeComponent:o.time,oldValue:s,timeZoneComponent:o.timeZone,defaultTimeZone:a}):null:null!=t.value?V({oldValue:s,dateComponent:o.date,timeZone:a,timeComponent:o.time?.value===I?void 0:o.time}):null,s!==r&&(null!==r&&t.value?this.viewModel.setValue(`${i}`,r):this.viewModel.setValue(`${i}`,null))}};e([r()],A.prototype,"activeFeatureIndex",null),e([r()],A.prototype,"disabled",null),e([r()],A.prototype,"_effectiveDisabled",null),e([r()],A.prototype,"features",null),e([r()],A.prototype,"map",null),e([r()],A.prototype,"maximumFeatureCount",null),e([r()],A.prototype,"maximumFeatureCountWithComplexForms",null),e([r()],A.prototype,"spatialReference",null),e([r()],A.prototype,"layerInfos",null),e([r()],A.prototype,"timeZone",null),e([r()],A.prototype,"headingLevel",void 0),e([r()],A.prototype,"icon",null),e([r(),L("esri/t9n/common")],A.prototype,"messagesCommon",void 0),e([r(),L("esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm")],A.prototype,"messages",void 0),e([r(),L("esri/widgets/FeatureForm/t9n/FeatureForm")],A.prototype,"featureFormMessages",void 0),e([r()],A.prototype,"readOnly",null),e([r()],A.prototype,"valid",null),e([r({type:v}),U(["value-change","submit"])],A.prototype,"viewModel",void 0),e([r({type:f,nonNullable:!0})],A.prototype,"visibleElements",void 0),e([r()],A.prototype,"groupDisplay",void 0),A=e([l("esri.widgets.BatchAttributeForm")],A);const $=A;export{$ as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{onLocaleChange as t,substitute as i,fetchMessageBundle as s}from"../../intl.js";import{isSome as n}from"../../core/arrayUtils.js";import l from"../../core/Collection.js";import{referenceSetter as r}from"../../core/collectionUtils.js";import o from"../../core/Error.js";import a from"../../core/Logger.js";import{abortMaybe as d}from"../../core/maybe.js";import{debounce as h,ignoreAbortErrors as m,after as c,throwIfAborted as p}from"../../core/promiseUtils.js";import{watch as u,initial as g,on as b,sync as f,syncAndInitial as y}from"../../core/reactiveUtils.js";import{throttle as T}from"../../core/throttle.js";import{property as w,subclass as C}from"../../core/accessorSupport/decorators.js";import{getEffectiveFieldAlias as I}from"../../editing/fieldUtils.js";import{geometryTypes as v}from"../../geometry/support/typeUtils.js";import{getLowerCaseDefaultHiddenFields as _}from"../../layers/support/fieldUtils.js";import{getSubtypesFromLayer as E,isSubtypeGroupLayer as S}from"../../layers/support/layerUtils.js";import{createFieldInfos as A}from"../../support/popupUtils.js";import F from"../../tables/AttributeTableTemplate.js";import j from"../../tables/support/FieldOrder.js";import x from"../../time/TimeExtent.js";import R from"../../views/SelectionManager.js";import{temporaryHighlightName as O}from"../../views/support/HighlightDefaults.js";import{highlightsSupported as U}from"../../views/support/layerViewUtils.js";import{isSelectableLayerWithObjectIds as P,isSelectableLayer as V}from"../../views/support/selectionUtils.js";import z from"./ActionColumn.js";import W from"./AttachmentsColumn.js";import H from"./FieldColumn.js";import B from"./RelationshipColumn.js";import M from"./Grid/Column.js";import L from"./Grid/Grid.js";import G from"./Grid/GridViewModel.js";import k from"./Grid/GroupColumn.js";import N from"./support/AttachmentsColumnTemplate.js";import D from"./support/AttachmentsViewOptions.js";import{isAttachmentsColumn as $,isFieldColumn as Z,isRelationshipColumn as q}from"./support/columnUtils.js";import{downloadAttachmentInfo as Q,exportToCSV as K}from"./support/exportUtils.js";import J from"./support/FeatureStore.js";import X from"./support/FieldColumnTemplate.js";import Y from"./support/RelationshipColumnTemplate.js";import ee from"./support/TableTemplate.js";import{isIFeatureTableSupportedLayerWithFieldConfigurations as te,isIFeatureTableSupportedLayerWithRelationships as ie,findRelatedLayerInSources as se,findRelationship as ne,uniqueColumnNames as le,hasColumnForField as re,findField as oe,isIFeatureTableSupportedLayerWithAttachments as ae,getRelationshipIdsToShow as de}from"./support/tableUtils.js";import{createAttributeTableElements as he}from"./support/templateUtils.js";import{goTo as me}from"../support/goToUtils.js";import{messageBundle as ce}from"../support/widget.js";const pe="80px";let ue=class extends G{constructor(e){super(e),this._currentTemporaryHighlight=null,this._refreshDebounced=h(()=>this._refresh()),this._syncTemplateThrottled=T(()=>this._syncAttributeTableTemplate()),this._temporaryHighlightAbortController=null,this.attachmentsViewOptions=new D,this.attributeTableTemplate=null,this.autoRefreshEnabled=!0,this.columns=new l,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:n}=this;if(this.filterBySelectionEnabled&&!this.highlightIds.length||1===n.length&&-1===n.items[0])return void t([]);"loaded"!==s.state&&"loading"!==s.state&&await s.load();const l=this.paginationEnabled?this.pageIndex:e.page,r=await s.fetchItems({...e,page:l});t&&t(r)},this.defaultSelectionManager=new R,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 l,this.relationshipColumnConfigs=null,this.selectionManager=null,this.showRelatedTableCallback=null,this.store=null,this.syncTemplateOnChangesEnabled=!0,this.syncViewSelection=!1,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 J),this._set("grid",new L({viewModel:this}))}initialize(){const e=async()=>{this.messages=await s("esri/widgets/FeatureTable/t9n/FeatureTable"),this.messagesCommon=await s("esri/t9n/common"),this.messagesUnits=await s("esri/core/t9n/Units"),this.messagesURIUtils=await s("esri/widgets/support/t9n/uriUtils")};e(),this.addHandles([t(()=>{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()},g),u(()=>this.attachmentsEnabled,()=>this.layer?.loaded&&this._generateColumns()),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(()=>{})),this.syncViewSelection&&this._syncSelection(),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,()=>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()),b(()=>this.layer,"refresh",e=>this._onLayerRefresh(e)),b(()=>this.grid,["cell-click","cell-dblclick","cell-pointerover","cell-pointerout","cell-keydown","column-reorder"],({index:e,item:t,native:i,path:s,type:n})=>{const l=t?.feature,r=l?.getObjectId(),o="cell-keydown"===n&&i&&i instanceof KeyboardEvent&&"Enter"===i.key;this.emit(n,{feature:l,index:e,native:i,type:n,fieldName:s??void 0,objectId:r}),(o||"cell-click"===n)&&this._onCellInteraction(r)}),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()),b(()=>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()}),b(()=>this.tableParent?.highlightIds,"change",({added:e})=>{const{relationshipConfig:t}=this,i=e[0];if(null==i||!t)return;const{relatedLayer:s,relationshipId:n}=t;this.relationshipConfig={objectId:i,relatedLayer:s,relationshipId:n}}),b(()=>this.tableParent,"cell-click",async e=>{const{objectId:t}=e;this.tableController&&this.hasPendingEdits?await this.tableController.discardPendingEdits(void 0,!0).then(e=>e&&this._syncTableParentSelection(t)):this._syncTableParentSelection(t)}),u(()=>this.attachmentsViewOptions.objectId,(e,t)=>{null!=e?null==t&&this.showAttachmentsView({objectId:e}):this.hideAttachmentsView()}),u(()=>[this.layerFieldConfigurations,this.pendingEditsCount],()=>this.refreshCellContent()),b(()=>this.highlightIds,"change",e=>this._onHighlightIdsChange(e),{onListenerAdd:()=>this._syncSelection(),onListenerRemove:()=>this.defaultSelectionManager.clear()}),u(()=>this.grid?.temporaryHighlightId,e=>{this._temporaryHighlightAbortController?.abort(),this._temporaryHighlightAbortController=new AbortController;const t=this._syncTemporaryHighlight(e,this._temporaryHighlightAbortController.signal);m(this.view?.addUpdatingPromise(t)??t)},f),u(()=>this.effectiveSelectionManager,()=>this._syncSelection(),y),b(()=>this.effectiveSelectionManager,"selection-change",()=>this._syncSelection(),y),u(()=>[this.layer,this.view],()=>this.syncSelectionSources(),y),u(()=>this.highlightEnabled,e=>this.defaultSelectionManager.highlightEnabled=e,g)])}destroy(){this._drainColumns(),this._currentTemporaryHighlight?.handle.remove(),this._temporaryHighlightAbortController=d(this._temporaryHighlightAbortController),this.defaultSelectionManager.destroy(),this.grid?.destroy(),this.columns.destroyed||this.columns.destroy(),this.layer=null,this.view=null}get _defaultHiddenFields(){return _(this.layer)}get _effectiveTableTemplate(){return this.tableTemplateOverride||this.tableTemplate}get _effectiveAttributeTableTemplate(){return this.attributeTableTemplate||this.layer?.attributeTableTemplate}get _highlightableLayerView(){const e=this.layerView;return U(e)?e:null}get _subtypes(){return E(this.layer)}get actionColumn(){return super.actionColumn}get activeFilters(){const{filterGeometry:e,objectIds:t,filterBySelectionEnabled:i,highlightIds:s}=this,n=new l;return e&&n.push({type:"geometry",geometry:e}),i?n.push({type:"selection",objectIds:s.toArray()}):t.length&&n.push({type:"objectId",objectIds:t.toArray()}),n}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=>$(e))}get attachmentsEnabled(){return this.store.attachmentsEnabled}set attachmentsEnabled(e){this.store.attachmentsEnabled=e}get autoSaveEnabled(){return this.store.autoSaveEnabled}set autoSaveEnabled(e){this.store.autoSaveEnabled=e}get canAddRelatedFeature(){return this.store.canAddRelatedFeature}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 editingEnabled(){return super.editingEnabled}set editingEnabled(e){super.editingEnabled=e}get effectiveSelectionManager(){const{layer:e,view:t}=this;return e&&this.syncViewSelection&&P(e)&&t?.selectionManager?.sources.includes(e)?t.selectionManager:this.selectionManager??this.defaultSelectionManager}get effectiveMultipleSelectionEnabled(){return super.effectiveMultipleSelectionEnabled}get effectiveSize(){return super.effectiveSize}get fieldColumns(){return this.allColumns.filter(e=>Z(e))}get filterByViewExtent(){return this.store.filterByViewExtent}set filterByViewExtent(e){this.store.filterByViewExtent=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 hasContingentValues(){return this.relatedTableHasContingentValues||this.store.hasContingentValues}get hasInvalidPendingEdits(){return this.relatedTableHasInvalidPendingEdits||this.store.hasInvalidPendingEdits}get hasPendingEdits(){return this.relatedTableHasPendingEdits||this.store.hasPendingEdits}get hiddenFields(){return this._get("hiddenFields")??new l}set hiddenFields(e){this._set("hiddenFields",r(e,this._get("hiddenFields"),l))}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.drainRelatedTables(),this._set("layer",e)}get layerFieldConfigurations(){const e=this.layer;return te(e)?e.fieldConfigurations:void 0}get layerView(){return this.store.layerView}get maxSize(){return super.maxSize}set maxSize(e){super.maxSize=e}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 paginationEnabled(){return super.paginationEnabled}set paginationEnabled(e){super.paginationEnabled=e}get pendingEditsCount(){return this.store.pendingEditsCount}get relatedRecordsEnabled(){return this.store.relatedRecordsEnabled}set relatedRecordsEnabled(e){this.store.relatedRecordsEnabled=e}get relatedTable(){return this.relatedTables.at(-1)}get relatedTableHasContingentValues(){return!!this.relatedTable?.hasContingentValues}get relatedTableHasInvalidPendingEdits(){return!!this.relatedTable?.hasInvalidPendingEdits}get relatedTableHasPendingEdits(){return!!this.relatedTable?.hasPendingEdits}get relationship(){return this.store.relationship}get relationshipColumns(){return this.allColumns.filter(e=>q(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,n=this.store.relationshipInfos;if(n.length||!ie(e)||!i?.length)return n;const l=[],r=s?.layers||t||[];return i.forEach(t=>{const i=se(e,r,t);i&&(i.load(),l.push({layer:e,relatedLayer:i,relationshipId:t.id}))}),l}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 selectionSource(){return"table"}set selectionSource(e){this.syncViewSelection="view"===e,this._overrideIfSome("selectionSource",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.store.timeZone}set timeZone(e){this.store.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,n=i.objectId===e;await s.addAttachment(e,t).catch(e=>{n&&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)}),n&&!i.error&&(i.onEditComplete(),i.attachmentInfos=await s.getAttachmentsByObjectId(e,!0)),this.refreshCellContent()}addPendingEdits(e){this.store.addPendingEdits(e)}collapseRelatedTable(e,t){const{relatedLayer:i,objectId:s,relationshipId:n}=t,{objectIdField:r}=i,o=ne(i,n),a=i.displayField||o?.keyField||r;e.set({highlightIds:new l([s]),multipleSelectionEnabledOverride:!1,tableTemplateOverride:this._getTableTemplateForRelatedTableView(e,a,n)});const d=e.hiddenFields;d.includes(le.action)||d.add(le.action),d.includes(le.attachments)||d.add(le.attachments),e.scrollLeft()}async deleteAttachments(e,t){const{attachmentsViewOptions:i,store:s}=this,n=i.objectId===e;await s.deleteAttachments(e,t).catch(e=>{n&&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)}),n&&!i.error&&(i.onEditComplete(),i.attachmentInfos=await s.getAttachmentsByObjectId(e,!0)),this.refreshCellContent()}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 discardPendingEdits(e){return this.relatedTable&&this.relatedTableHasPendingEdits?this.relatedTable.discardPendingEdits(e):(this.store.discardPendingEdits(e),!0)}async downloadAttachmentById(e,t){const i=(await this.store.getAttachmentsByObjectId(e,!0)).find(e=>e.id===t);await Q(i)}drainRelatedTables(){this.relatedTables.drain(e=>e.destroy()),this.set({multipleSelectionEnabledOverride:null,relationshipColumnConfigs:null,showAllRelatedTables:!1,tableTemplateOverride:null}),this.hiddenFields.removeMany([le.action,le.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 K({layer:i,objectIds:t.toArray(),outFields:s,includeGeometry:e}):this._logWarning("Export failed.")}getFeatureStoreItemByObjectId(e){return this.store.getItemByObjectId(e)}async getFeatureTitle(e,t){return this.store.getFeatureTitle(e,t)}getFeatureTitleSync(e){const t=this.layer;if(!t)return`${e}`;const i=`${t.objectIdField}: ${e}`;return null==e?i:this.store.featureTitleMap.get(e)??i}getObjectIdIndex(e){return this.store.getItemIndexByObjectId(e)}getValue(e,t){const i=this.getFeatureStoreItemByObjectId(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,multipleSelectionEnabledOverride:null,tableTemplateOverride:null}),this.hiddenFields.remove(le.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()),m(this._refreshDebounced())])}refreshCellContent(){this.grid?.requestContentUpdate()}refreshPageCache(){this.grid?.refreshPageCache()}async reset(){this.goToPage(0),await(this.grid?.reset())}async savePendingEdits(){!this.relatedTableHasPendingEdits||this.relatedTableHasInvalidPendingEdits?this.hasPendingEdits&&!this.relatedTable&&(await this.store.savePendingEdits(),await this.refresh()):await(this.relatedTable?.savePendingEdits())}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:i,layer:s}=this;if(!this.attachmentsEnabled||!s)return void this._logWarning("The 'attachmentsEnabled' property is currently false.");await s.load();const n=this._getDefaultLayerDisplayField(s),r=await this.store.getAttachmentsByObjectId(e,!0),o=this.store.getItemIndexByObjectId(e);t.set({attachmentInfos:r,mode:r.length?"list":"file",objectId:e}),this.set({highlightIds:new l([e]),multipleSelectionEnabledOverride:!1,relationshipColumnConfigs:[],tableTemplateOverride:this._getTableTemplateForAttachmentsView(n)}),i.includes(le.action)||i.add(le.action),null!=o&&this.scrollToIndex(o)}syncAttributeTableTemplate(){this._syncAttributeTableTemplate(!0)}syncSelectionSources(){const{defaultSelectionManager:e,layer:t,view:i}=this;e.view=i,e.sources.removeAll(),t&&V(t)&&(e.sources.items=[t])}async updateAttachment(e,t,i){const{attachmentsViewOptions:s,store:n}=this,l=s.objectId===e;await n.updateAttachment(e,t,i).catch(e=>{l&&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)}),l&&!s.error&&(s.onEditComplete(),s.attachmentInfos=await n.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 n=await e.queryFeatures(s);try{await me(t,n.features)}catch(l){"AbortError"!==l.name&&console.error(l)}}_syncAttributeTableTemplate(e=!1){const{_effectiveAttributeTableTemplate:t,layer:i,tableTemplateOverride:s,syncTemplateOnChangesEnabled:n}=this;if(!i||!t||!n&&!e||s||this.tableParent||this.relatedTable||null!==this.attachmentsViewOptions.objectId)return;const{activeSortOrders:l,allColumns:r,columns:o}=this,a=[],d=he(o.toArray());l.forEach(({fieldName:e,direction:t})=>{e&&t&&a.push(new j({field:e,order:t}))}),r.forEach(({fieldName:e,direction:t})=>{t&&!a.some(t=>t.field===e)&&a.push(new j({field:e,order:t}))}),t.elements=d,t.orderByFields=a}async _refresh(){await super.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&&S(e.parent)&&await e.parent.loadAll();const i=e.capabilities.query?.maxRecordCount,s=i&&i<t,n=s?i:t;s&&(this._logWarning("The value for 'pageSize' has been adjusted due to the provided layer's max record count."),this.pageSize=n),this.grid?.set("pageSize",n),this.store.load(),this._generateColumns()}_onLayerRefresh(e){this.autoRefreshEnabled&&e.dataChanged&&this.refresh()}_generateColumns(){this._drainColumns();const{_effectiveTableTemplate:e,_effectiveAttributeTableTemplate:t,layer:i}=this,s=e?.columnTemplates;if(!i)return;const n=this._generateColumnsFromColumnTemplates(i,s)??this._generateColumnsFromAttributeTableTemplate(i,t)??this._generateDefaultFieldColumns(i);n.length&&(this.attachmentsEnabled&&!n.some(e=>$(e))&&n.push(this._generateDefaultAttachmentsColumn(i)),this.relatedRecordsEnabled&&this.relationshipInfos.length&&!n.some(e=>q(e))&&n.push(...this._generateDefaultRelationshipColumns()),this.actionColumnConfig&&n.push(this._generateActionColumn()),n.sort((e,t)=>e.frozen&&t.frozen||e.frozenToEnd&&t.frozenToEnd?0:e.frozen||t.frozenToEnd?-1:0),this.columns.addMany(n))}_generateColumnsFromAttributeTableTemplate(e,t){if(!t)return null;const{elements:i,orderByFields:s}=t,l=A(e),r=[];r.push(...this._generateColumnsFromAttributeTableElements(e,i,s));const o=l.map(t=>{if(!t.fieldName||re(t.fieldName,r))return null;const{fieldName:i}=t,n=oe(e,i);return n?this._generateDefaultFieldColumn(e,n,{hidden:!0,orderByFields:s}):(this._logTemplateWarning("A valid 'field' could not be found for the provided template."),null)}).filter(n);return r.push(...o),this.attachmentsEnabled&&ae(e)&&!r.some(e=>$(e))&&r.push(this._generateDefaultAttachmentsColumn(e,{hidden:!0})),this.relatedRecordsEnabled&&ie(e)&&e.relationships?.forEach(({id:e},t)=>{const i=this.relationshipInfos.find(t=>t.relationshipId===e);i&&!r.some(t=>q(t)&&t.relationshipId===e)&&r.push(this._generateDefaultRelationshipColumn({hidden:!0,info:i,index:t}))}),r.length?r:null}_generateColumnsFromAttributeTableElements(e,t,i){return t?.map((t,s)=>{switch(t.type){case"field":return this._createFieldColumnFromElement({layer:e,element:t,orderByFields:i});case"group":return this._createGroupColumnFromElement({layer:e,element:t,orderByFields:i});case"attachment":return this._createAttachmentColumnFromElement({layer:e,element:t,index:s});case"relationship":return this._createRelationshipColumnFromElement({element:t,index:s})}}).filter(e=>!!e)??[]}_createFieldColumnFromElement(e){const{layer:t,element:i,orderByFields:s}=e,{fieldName:n}=i;if(null==n)return this._logTemplateWarning("A valid 'fieldName' must be provided."),null;const l=oe(t,n);if(!l)return this._logTemplateWarning("A valid 'field' could not be found for the provided template."),null;const{description:r,label:o}=i,a=s?.findIndex(({field:e})=>e&&e===n)??-1,d=a>-1?s?.at(a)?.order:void 0,h=a>-1?a:void 0,{grid:m,messages:c,messagesCommon:p,messagesURIUtils:u,store:g,view:b}=this;return new H({description:r,direction:d,field:l,fieldName:n,grid:m,initialSortPriority:h,label:o,layer:t,messages:c,messagesCommon:p,messagesURIUtils:u,store:g,view:b,onShowPromptCallback:this._onShowPromptCallback})}_createGroupColumnFromElement(e){const{layer:t,element:i,orderByFields:s}=e,{description:n,label:l}=i;if(!l)return this._logTemplateWarning("Group columns require a label."),null;if(!i.elements.length)return this._logTemplateWarning("Group columns require child columns."),null;const{grid:r,messages:o,messagesCommon:a,messagesURIUtils:d,store:h}=this;return new k({columns:this._generateColumnsFromAttributeTableElements(t,i.elements,s),description:n,grid:r,label:l,messages:o,messagesCommon:a,messagesURIUtils:d,store:h})}_createAttachmentColumnFromElement(e){if(!this.attachmentsEnabled)return void this._logTemplateWarning("The 'attachmentsEnabled' property is currently false.");const{layer:t,element:i,index:s}=e,{description:n,label:l}=i,{grid:r,messages:o,messagesCommon:a,messagesURIUtils:d,store:h}=this;return new W({description:n,fieldName:`${le.attachments}-${s}`,grid:r,label:l,layer:t,messages:o,messagesCommon:a,messagesURIUtils:d,store:h,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:n,relationshipId:l}=t,r=this.relationshipInfos.find(e=>e.relationshipId===l);if(!r)return this._logTemplateWarning("Unable to find valid related layer target based on the provided relationship id."),null;const{grid:o,messages:a,messagesCommon:d,messagesURIUtils:h,store:m}=this;return new B({description:s,fieldName:`${le.relationship}-${l}-${i}`,grid:o,label:n,messages:a,messagesCommon:d,messagesURIUtils:h,relationshipId:l,store:m,layer:r.relatedLayer,relatedLayer:r.layer,showRelatedTableCallback:e=>this._onShowRelatedTable(e)})}_generateColumnsFromColumnTemplates(e,t){const{grid:i,messages:s,messagesCommon:n,messagesURIUtils:l,store:r,view:o}=this;if(!t?.length)return null;const a=[];return t.forEach((t,d)=>{const{autoWidth:h,description:m,direction:c,flexGrow:p,fieldName:u,formatFunction:g,frozen:b,frozenToEnd:f,icon:y,iconText:T,initialSortPriority:w,invalid:C,label:I,labelTooltipText:v,menuConfig:_,resizable:E,sortable:S,textAlign:A,textWrap:F,timeZone:j,type:x,width:R}=t;if(!x)return void this._logTemplateWarning("Property 'type' is missing from the provided template.");if(b&&f)return void this._logTemplateWarning("Properties 'frozen' and 'frozenToEnd' cannot both be true for the same column.");const O=!1===t.visible;if("group"===x){if(!t.columnTemplates?.length)return void this._logTemplateWarning("Group columns must contain column templates.");if(!t.label)return void this._logTemplateWarning("Group columns require a label.");const r=this._generateColumnsFromColumnTemplates(e,t.columnTemplates),o=O||this._isFieldHidden(t.label);a.push(new k({autoWidth:h,columns:r,description:m,flexGrow:p,frozen:b,frozenToEnd:f,grid:i,hidden:o,icon:y,iconText:T,invalid:C,label:I,labelTooltipText:v,menuConfig:_,messages:s,messagesCommon:n,messagesURIUtils:l,resizable:E,textAlign:A,textWrap:F,timeZone:j,width:R}))}else if("attachment"===x){if(!this.attachmentsEnabled)return void this._logTemplateWarning("Attachment columns require attachments to be enabled on the table.");a.push(this._generateAttachmentsColumnFromTemplate(e,t,d))}else if("relationship"===x){if(!this.relatedRecordsEnabled)return void this._logTemplateWarning("Relationship columns require related records to be enabled on the table.");const{relationshipId:e}=t;if(null==e)return void this._logTemplateWarning("Property 'relationshipId' is missing from the provided template.");const i=this.relationshipInfos.find(t=>t.relationshipId===e);if(!i)return void this._logTemplateWarning("Unable to find valid related layer target based on the provided relationship id.");a.push(this._generateRelationshipColumnFromTemplate(i,t,d))}else if(!u)return void this._logTemplateWarning("Value for 'fieldName' property was missing from the provided template.");const U=O||this._isFieldHidden(u);if("column"===x)a.push(new M({autoWidth:h,description:m,direction:c,fieldName:u,flexGrow:p,formatFunction:g,frozen:b,frozenToEnd:f,grid:i,hidden:U,icon:y,iconText:T,initialSortPriority:w,invalid:C,label:I,labelTooltipText:v,menuConfig:_,messages:s,messagesCommon:n,messagesURIUtils:l,resizable:E,sortable:S,store:r,textAlign:A,textWrap:F,timeZone:j,width:R}));else if("field"===x){const d=oe(e,t.fieldName);if(!d)return void this._logTemplateWarning("A valid 'field' could not be found for the provided template.");const{editable:u,required:x}=t;a.push(new H({autoWidth:h,description:m,direction:c,editable:u,field:d,fieldName:d.name,flexGrow:p,formatFunction:g,frozen:b,frozenToEnd:f,grid:i,hidden:U,icon:y,iconText:T,initialSortPriority:w,invalid:C,label:I,labelTooltipText:v,layer:e,messages:s,messagesCommon:n,messagesURIUtils:l,menuConfig:_,required:x,resizable:E,sortable:S,store:r,template:t,textAlign:A,textWrap:F,timeZone:j,width:R,view:o,onShowPromptCallback:this._onShowPromptCallback}))}}),a.length?a:null}_generateDefaultFieldColumns(e){return e.fields?.map(t=>this._generateDefaultFieldColumn(e,t)).filter(n)??[]}_generateDefaultFieldColumn(e,t,i){const{grid:s,messages:n,messagesCommon:l,messagesURIUtils:r,store:o,view:a}=this;if(!t.visible||"geometry"===t.type)return null;const d=i?.orderByFields,h=t.name,m=d?.findIndex(({field:e})=>e&&e===h)??-1,c=m>-1?d?.at(m)?.order:void 0,p=m>-1?m:void 0;return new H({direction:c,field:t,fieldName:h,grid:s,hidden:i?.hidden||this._isFieldHidden(h),initialSortPriority:p,layer:e,messages:n,messagesCommon:l,messagesURIUtils:r,store:o,view:a,onShowPromptCallback:this._onShowPromptCallback})}_generateAttachmentsColumnFromTemplate(e,t,i){const{grid:s,messages:n,messagesCommon:l,messagesURIUtils:r,store:o}=this,{attachmentsViewEnabled:a,autoWidth:d,description:h,flexGrow:m,fieldName:c,formatFunction:p,frozen:u,frozenToEnd:g,icon:b,iconText:f,invalid:y,label:T,labelTooltipText:w,menuConfig:C,resizable:I,textAlign:v,textWrap:_,thumbnailAppearance:E,thumbnailCount:S,thumbnailIconScale:A,thumbnailsEnabled:F,timeZone:j,width:x}=t;return new W({attachmentsViewEnabled:a,autoWidth:d,description:h,fieldName:`${le.attachments}-${i}`,flexGrow:m,formatFunction:p,frozen:u,frozenToEnd:g,grid:s,hidden:!1===t.visible||this._isFieldHidden(T)||this._isFieldHidden(c),icon:b,iconText:f,invalid:y,label:T,labelTooltipText:w,layer:e,menuConfig:C,messages:n,messagesCommon:l,messagesURIUtils:r,resizable:I,store:o,textAlign:v,textWrap:_,thumbnailAppearance:E,thumbnailCount:S,thumbnailIconScale:A,thumbnailsEnabled:F,timeZone:j,width:x,onShowAttachments:e=>this._onShowAttachments(e)})}_generateDefaultAttachmentsColumn(e,t){const{grid:i,messages:s,messagesCommon:n,messagesURIUtils:l,store:r}=this,o=le.attachments;return new W({fieldName:o,grid:i,hidden:t?.hidden||this._isFieldHidden(o),layer:e,messages:s,messagesCommon:n,messagesURIUtils:l,store:r,onShowAttachments:e=>this._onShowAttachments(e)})}_generateRelationshipColumnFromTemplate(e,t,i){const{grid:s,messages:n,messagesCommon:l,messagesURIUtils:r,store:o}=this,{autoWidth:a,collapsed:d,description:h,flexGrow:m,fieldName:c,formatFunction:p,frozen:u,frozenToEnd:g,icon:b,iconText:f,invalid:y,label:T,labelTooltipText:w,menuConfig:C,relationshipId:I,resizable:v,textAlign:_,textWrap:E,timeZone:S,width:A}=t;return new B({autoWidth:a,collapsed:d,description:h,fieldName:`${le.relationship}-${I}-${i}`,flexGrow:m,formatFunction:p,frozen:u,frozenToEnd:g,grid:s,hidden:!1===t.visible||this._isFieldHidden(T)||this._isFieldHidden(c),icon:b,iconText:f,invalid:y,label:T,labelTooltipText:w,menuConfig:C,messages:n,messagesCommon:l,messagesURIUtils:r,relationshipId:I,resizable:v,store:o,textAlign:_,textWrap:E,timeZone:S,width:A,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:n}=t,l=e.find(e=>e.relationshipId===n);l&&i.push(this._generateDefaultRelationshipColumn({config:t,index:s,info:l}))}):e.forEach((e,t)=>i.push(this._generateDefaultRelationshipColumn({index:t,info:e}))),i):i}_generateDefaultRelationshipColumn(e){const{config:t,hidden:i,index:s,info:n}=e,{grid:l,messages:r,messagesCommon:o,messagesURIUtils:a,store:d}=this,{relationshipId:h}=n;return new B({...t,fieldName:`${le.relationship}-${h}-${s}`,grid:l,hidden:i,messages:r,messagesCommon:o,messagesURIUtils:a,layer:n.relatedLayer,relatedLayer:n.layer,relationshipId:h,store:d,showRelatedTableCallback:e=>this._onShowRelatedTable(e)})}_generateActionColumn(){return new z({hidden:this._isFieldHidden(le.action),store:this.store,...this.actionColumnConfig})}_isFieldHidden(e){const t=e?.toLowerCase();return(this.hiddenFields??this._defaultHiddenFields).some(e=>e.toLowerCase()===t)}async _syncTemporaryHighlight(e,t){if(!this.highlightEnabled)return this._currentTemporaryHighlight?.handle.remove(),void(this._currentTemporaryHighlight=null);if(await c(25),p(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:n,highlightEnabled:l}=this;e&&s&&n&&l&&(this._currentTemporaryHighlight={id:e,handle:s.highlight(e,{name:O})})}_syncSelection(){const{layer:e}=this;P(e)?this.highlightIds.items=this.effectiveSelectionManager.getSelection(e)??[]:this.highlightIds.removeAll()}_addToSelection(e){const t=this.layer;P(t)&&this.effectiveSelectionManager.add(t,e)}_removeFromSelection(e){const t=this.layer;P(t)&&this.effectiveSelectionManager.remove(t,e)}async _onHighlightIdsChange(e){const{added:t,removed:i}=e,{attachmentsViewOptions:s}=this;if(this._removeFromSelection(i),this._addToSelection(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"}),this.getFeatureTitle(e)}}}_syncTableParentSelection(e){const{tableParent:t}=this;t&&null!=e&&t.highlightIds.add(e)}_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(le.action)||s.add(le.action),s.includes(le.attachments)||s.add(le.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({multipleSelectionEnabledOverride:!1,relationshipColumnConfigs:[],showAllRelatedTables:!1,tableTemplateOverride:this._getTableTemplateForAttachmentsView(i)})}else e.set({multipleSelectionEnabledOverride:null,relationshipColumnConfigs:de(t,i.id),showAllRelatedTables:!1,tableTemplateOverride:null}),e.hiddenFields.removeMany([le.action,le.attachments])}_getTableTemplateForRelatedTableView(e,t,i){return new ee({columnTemplates:[new X({fieldName:t,editable:!1,menuConfig:{selectionMode:"single",icon:"chevron-down",items:this._extractFieldColumnInfosFromTableTemplate(e.viewModel).map(([s,n])=>({selected:s===t,label:n||s,clickFunction:()=>{e.tableTemplateOverride=this._getTableTemplateForRelatedTableView(e,s,i)}}))},resizable:!1}),new Y({autoWidth:!1,collapsed:!0,flexGrow:0,label:"",resizable:!1,relationshipId:i,width:pe})]})}_getTableTemplateForShowAllTablesView(e,t){const i=[new X({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 N({attachmentsViewEnabled:!1,autoWidth:!1,flexGrow:0,label:"",resizable:!1,thumbnailsEnabled:!1,width:pe})),new ee({columnTemplates:i})}async _onShowPromptCallback(e){const{column:t,objectId:i,oldValue:s,value:n}=e,{_subtypes:l,layer:r}=this;if(!r||!l.length)return void t.cancel();const o=l.find(e=>e.code===n);if(!o)return void t.cancel();const a=Promise.withResolvers(),d=this._createSubtypeEditPrompt(s,o,a),h=!!r.parent&&this.autoSaveEnabled;try{this.showPrompt(d);const e=await a.promise,s=[{fieldName:t.fieldName,value:n}];switch(e){case"update-fields":for(const[e,t]of Object.entries(o.defaultValues))null!=t&&s.push({fieldName:e,value:t});await t.updateItems({objectId:i,updates:s}),h&&this.refresh();break;case"keep-existing":await t.updateItems({objectId:i,updates:s}),h&&this.refresh();break;case"undo":t.cancel()}}finally{this.clearPrompt()}}_createSubtypeEditPrompt(e,t,s){const{_subtypes:n,messages:l,messagesCommon:r}=this,o=n.find(t=>t.code===e)?.name??`${e}`;let a="update-fields";const d=[{label:l.subtypes.useDefaultValuesOption,value:"update-fields"},{label:l.subtypes.keepCurrentValuesOption,value:"keep-existing"}];return{context:"info",title:l.subtypes.changeWarningTitle,message:i(l.subtypes.changeWarning,{originalType:o,newType:t.name}),radios:d,defaultRadioSelection:"update-fields",onRadioSelection:e=>{a=e},actions:{primary:{label:r.apply,action:()=>s.resolve(a),type:"positive"},secondary:{label:r.cancel,type:"neutral",action:()=>s.resolve("undo")}},cancel:()=>s.reject()}}_onShowAttachments({objectId:e}){this.hasPendingEdits||(this.attachmentsViewOptions.objectId=e)}_getTableTemplateForAttachmentsView(e){return new ee({columnTemplates:[new X({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 N({attachmentsViewEnabled:!1,autoWidth:!1,flexGrow:0,label:"",resizable:!1,thumbnailsEnabled:!1,width:pe})]})}_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})=>{if(null!=t&&""!==t)return[e,t];const s=i?.fieldsIndex.get(e);return[e,s&&I(s,i)]}):i?.fields.map(e=>[e.name,I(e,i)])??[]}_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?a.getLogger(this).warnOnce(e):a.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([w()],ue.prototype,"_defaultHiddenFields",null),e([w()],ue.prototype,"_effectiveTableTemplate",null),e([w()],ue.prototype,"_effectiveAttributeTableTemplate",null),e([w()],ue.prototype,"_highlightableLayerView",null),e([w()],ue.prototype,"_subtypes",null),e([w()],ue.prototype,"activeFilters",null),e([w({readOnly:!0})],ue.prototype,"activeSortOrders",null),e([w()],ue.prototype,"allRelatedTablesVisible",null),e([w()],ue.prototype,"attachmentsColumns",null),e([w()],ue.prototype,"attachmentsEnabled",null),e([w()],ue.prototype,"attachmentsViewOptions",void 0),e([w({type:F})],ue.prototype,"attributeTableTemplate",void 0),e([w()],ue.prototype,"autoRefreshEnabled",void 0),e([w()],ue.prototype,"autoSaveEnabled",null),e([w()],ue.prototype,"canAddRelatedFeature",null),e([w()],ue.prototype,"clearPrompt",null),e([w({readOnly:!0})],ue.prototype,"columns",void 0),e([w()],ue.prototype,"dataProvider",void 0),e([w()],ue.prototype,"defaultSelectionManager",void 0),e([w()],ue.prototype,"definitionExpression",null),e([w()],ue.prototype,"effectiveSelectionManager",null),e([w()],ue.prototype,"fieldColumns",null),e([w()],ue.prototype,"filterByViewExtent",null),e([w({types:v})],ue.prototype,"filterGeometry",null),e([w()],ue.prototype,"filterBySelectionEnabled",null),e([w({readOnly:!0})],ue.prototype,"grid",void 0),e([w()],ue.prototype,"hasContingentValues",null),e([w()],ue.prototype,"hasInvalidPendingEdits",null),e([w()],ue.prototype,"hasPendingEdits",null),e([w()],ue.prototype,"hiddenFields",null),e([w()],ue.prototype,"highlightEnabled",void 0),e([w()],ue.prototype,"initialSize",null),e([w()],ue.prototype,"isQueryingOrSyncing",null),e([w()],ue.prototype,"isSyncingAttachments",null),e([w()],ue.prototype,"layer",null),e([w()],ue.prototype,"layers",void 0),e([w()],ue.prototype,"layerFieldConfigurations",null),e([w()],ue.prototype,"layerView",null),e([w()],ue.prototype,"menuConfig",void 0),e([w()],ue.prototype,"messages",void 0),e([w(),ce("esri/t9n/common")],ue.prototype,"messagesCommon",void 0),e([w(),ce("esri/core/t9n/Units")],ue.prototype,"messagesUnits",void 0),e([w(),ce("esri/widgets/support/t9n/uriUtils")],ue.prototype,"messagesURIUtils",void 0),e([w()],ue.prototype,"outFields",null),e([w()],ue.prototype,"pendingEditsCount",null),e([w()],ue.prototype,"prompt",void 0),e([w()],ue.prototype,"relatedRecordsEnabled",null),e([w()],ue.prototype,"relatedTable",null),e([w()],ue.prototype,"relatedTableHasContingentValues",null),e([w()],ue.prototype,"relatedTables",void 0),e([w()],ue.prototype,"relationship",null),e([w()],ue.prototype,"relationshipColumnConfigs",void 0),e([w()],ue.prototype,"relationshipColumns",null),e([w()],ue.prototype,"relationshipConfig",null),e([w()],ue.prototype,"relationshipInfos",null),e([w()],ue.prototype,"relationships",null),e([w()],ue.prototype,"returnGeometryEnabled",null),e([w()],ue.prototype,"returnMEnabled",null),e([w()],ue.prototype,"returnZEnabled",null),e([w()],ue.prototype,"selectionManager",void 0),e([w()],ue.prototype,"selectionSource",null),e([w()],ue.prototype,"showAllRelatedTables",null),e([w()],ue.prototype,"showPrompt",null),e([w()],ue.prototype,"showRelatedTableCallback",void 0),e([w({readOnly:!0,type:J})],ue.prototype,"store",void 0),e([w()],ue.prototype,"supportsAttachments",null),e([w()],ue.prototype,"supportsAddAttachments",null),e([w()],ue.prototype,"supportsDeleteAttachments",null),e([w()],ue.prototype,"supportsResizeAttachments",null),e([w()],ue.prototype,"supportsUpdateAttachments",null),e([w()],ue.prototype,"syncTemplateOnChangesEnabled",void 0),e([w()],ue.prototype,"syncViewSelection",void 0),e([w()],ue.prototype,"tableController",void 0),e([w()],ue.prototype,"tableParent",void 0),e([w({type:ee})],ue.prototype,"tableTemplate",void 0),e([w()],ue.prototype,"tableTemplateOverride",void 0),e([w({type:x})],ue.prototype,"timeExtent",null),e([w()],ue.prototype,"timeZone",null),e([w()],ue.prototype,"view",null),ue=e([C("esri.widgets.FeatureTable.FeatureTableViewModel")],ue);const ge=ue;export{ge as default};
2
+ import{__decorate as e}from"tslib";import{onLocaleChange as t,substitute as i,fetchMessageBundle as s}from"../../intl.js";import{isSome as n}from"../../core/arrayUtils.js";import l from"../../core/Collection.js";import{referenceSetter as r}from"../../core/collectionUtils.js";import o from"../../core/Error.js";import a from"../../core/Logger.js";import{abortMaybe as d}from"../../core/maybe.js";import{debounce as h,ignoreAbortErrors as m,after as c,throwIfAborted as p}from"../../core/promiseUtils.js";import{watch as u,initial as g,on as b,sync as f,syncAndInitial as y}from"../../core/reactiveUtils.js";import{throttle as T}from"../../core/throttle.js";import{property as w,subclass as C}from"../../core/accessorSupport/decorators.js";import{getEffectiveFieldAlias as I}from"../../editing/fieldUtils.js";import{geometryTypes as v}from"../../geometry/support/typeUtils.js";import{getLowerCaseDefaultHiddenFields as _}from"../../layers/support/fieldUtils.js";import{getSubtypesFromLayer as E,isSubtypeGroupLayer as S}from"../../layers/support/layerUtils.js";import{createFieldInfos as A}from"../../support/popupUtils.js";import F from"../../tables/AttributeTableTemplate.js";import j from"../../tables/support/FieldOrder.js";import x from"../../time/TimeExtent.js";import R from"../../views/SelectionManager.js";import{temporaryHighlightName as O}from"../../views/support/HighlightDefaults.js";import{highlightsSupported as U}from"../../views/support/layerViewUtils.js";import{isSelectableLayerWithObjectIds as V,isSelectableLayer as P}from"../../views/support/selectionUtils.js";import z from"./ActionColumn.js";import W from"./AttachmentsColumn.js";import H from"./FieldColumn.js";import B from"./RelationshipColumn.js";import M from"./Grid/Column.js";import L from"./Grid/Grid.js";import G from"./Grid/GridViewModel.js";import k from"./Grid/GroupColumn.js";import N from"./support/AttachmentsColumnTemplate.js";import D from"./support/AttachmentsViewOptions.js";import{isAttachmentsColumn as $,isFieldColumn as Z,isRelationshipColumn as q}from"./support/columnUtils.js";import{downloadAttachmentInfo as Q,exportToCSV as K}from"./support/exportUtils.js";import J from"./support/FeatureStore.js";import X from"./support/FieldColumnTemplate.js";import Y from"./support/RelationshipColumnTemplate.js";import ee from"./support/TableTemplate.js";import{isIFeatureTableSupportedLayerWithFieldConfigurations as te,isIFeatureTableSupportedLayerWithRelationships as ie,findRelatedLayerInSources as se,findRelationship as ne,uniqueColumnNames as le,hasColumnForField as re,findField as oe,isIFeatureTableSupportedLayerWithAttachments as ae,getRelationshipIdsToShow as de}from"./support/tableUtils.js";import{createAttributeTableElements as he}from"./support/templateUtils.js";import{goTo as me}from"../support/goToUtils.js";import{messageBundle as ce}from"../support/widget.js";const pe="80px";let ue=class extends G{constructor(e){super(e),this._currentTemporaryHighlight=null,this._refreshDebounced=h(()=>this._refresh()),this._syncTemplateThrottled=T(()=>this._syncAttributeTableTemplate()),this._temporaryHighlightAbortController=null,this.attachmentsViewOptions=new D,this.attributeTableTemplate=null,this.autoRefreshEnabled=!0,this.columns=new l,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:n}=this;if(this.filterBySelectionEnabled&&!this.highlightIds.length||1===n.length&&-1===n.items[0])return void t([]);"loaded"!==s.state&&"loading"!==s.state&&await s.load();const l=this.paginationEnabled?this.pageIndex:e.page,r=await s.fetchItems({...e,page:l});t&&t(r)},this.defaultSelectionManager=new R,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 l,this.relationshipColumnConfigs=null,this.selectionManager=null,this.showRelatedTableCallback=null,this.store=null,this.syncTemplateOnChangesEnabled=!0,this.syncViewSelection=!1,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 J),this._set("grid",new L({viewModel:this}))}initialize(){const e=async()=>{this.messages=await s("esri/widgets/FeatureTable/t9n/FeatureTable"),this.messagesCommon=await s("esri/t9n/common"),this.messagesUnits=await s("esri/core/t9n/Units"),this.messagesURIUtils=await s("esri/widgets/support/t9n/uriUtils")};e(),this.addHandles([t(()=>{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()},g),u(()=>this.attachmentsEnabled,()=>this.layer?.loaded&&this._generateColumns()),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(()=>{})),this.syncViewSelection&&this._syncSelection(),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,()=>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()),b(()=>this.layer,"refresh",e=>this._onLayerRefresh(e)),b(()=>this.grid,["cell-click","cell-dblclick","cell-pointerover","cell-pointerout","cell-keydown","column-reorder"],({index:e,item:t,native:i,path:s,type:n})=>{const l=t?.feature,r=l?.getObjectId(),o="cell-keydown"===n&&i&&i instanceof KeyboardEvent&&"Enter"===i.key;this.emit(n,{feature:l,index:e,native:i,type:n,fieldName:s??void 0,objectId:r}),(o||"cell-click"===n)&&this._onCellInteraction(r)}),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()),b(()=>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()}),b(()=>this.tableParent?.highlightIds,"change",({added:e})=>{const{relationshipConfig:t}=this,i=e[0];if(null==i||!t)return;const{relatedLayer:s,relationshipId:n}=t;this.relationshipConfig={objectId:i,relatedLayer:s,relationshipId:n}}),b(()=>this.tableParent,"cell-click",async e=>{const{objectId:t}=e;this.tableController&&this.hasPendingEdits?await this.tableController.discardPendingEdits(void 0,!0).then(e=>e&&this._syncTableParentSelection(t)):this._syncTableParentSelection(t)}),u(()=>this.attachmentsViewOptions.objectId,(e,t)=>{null!=e?null==t&&this.showAttachmentsView({objectId:e}):this.hideAttachmentsView()}),u(()=>[this.layerFieldConfigurations,this.pendingEditsCount],()=>this.refreshCellContent()),b(()=>this.highlightIds,"change",e=>this._onHighlightIdsChange(e),{onListenerAdd:()=>this._syncSelection(),onListenerRemove:()=>this.defaultSelectionManager.clear()}),u(()=>this.grid?.temporaryHighlightId,e=>{this._temporaryHighlightAbortController?.abort(),this._temporaryHighlightAbortController=new AbortController;const t=this._syncTemporaryHighlight(e,this._temporaryHighlightAbortController.signal);m(this.view?.addUpdatingPromise(t)??t)},f),u(()=>this.effectiveSelectionManager,()=>this._syncSelection(),y),b(()=>this.effectiveSelectionManager,"selection-change",()=>this._syncSelection(),y),u(()=>[this.layer,this.view],()=>this.syncSelectionSources(),y),u(()=>this.highlightEnabled,e=>this.defaultSelectionManager.highlightEnabled=e,g)])}destroy(){this._drainColumns(),this._currentTemporaryHighlight?.handle.remove(),this._temporaryHighlightAbortController=d(this._temporaryHighlightAbortController),this.defaultSelectionManager.destroy(),this.grid?.destroy(),this.columns.destroyed||this.columns.destroy(),this.layer=null,this.view=null}get _defaultHiddenFields(){return _(this.layer)}get _effectiveTableTemplate(){return this.tableTemplateOverride||this.tableTemplate}get _effectiveAttributeTableTemplate(){return this.attributeTableTemplate||this.layer?.attributeTableTemplate}get _highlightableLayerView(){const e=this.layerView;return U(e)?e:null}get _subtypes(){return E(this.layer)}get actionColumn(){return super.actionColumn}get activeFilters(){const{filterGeometry:e,objectIds:t,filterBySelectionEnabled:i,highlightIds:s}=this,n=new l;return e&&n.push({type:"geometry",geometry:e}),i?n.push({type:"selection",objectIds:s.toArray()}):t.length&&n.push({type:"objectId",objectIds:t.toArray()}),n}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=>$(e))}get attachmentsEnabled(){return this.store.attachmentsEnabled}set attachmentsEnabled(e){this.store.attachmentsEnabled=e}get autoSaveEnabled(){return this.store.autoSaveEnabled}set autoSaveEnabled(e){this.store.autoSaveEnabled=e}get canAddRelatedFeature(){return this.store.canAddRelatedFeature}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 editingEnabled(){return super.editingEnabled}set editingEnabled(e){super.editingEnabled=e}get effectiveSelectionManager(){const{layer:e,view:t}=this;return e&&this.syncViewSelection&&V(e)&&t?.selectionManager?.sources.includes(e)?t.selectionManager:this.selectionManager??this.defaultSelectionManager}get effectiveMultipleSelectionEnabled(){return super.effectiveMultipleSelectionEnabled}get effectiveSize(){return super.effectiveSize}get fieldColumns(){return this.allColumns.filter(e=>Z(e))}get filterByViewExtent(){return this.store.filterByViewExtent}set filterByViewExtent(e){this.store.filterByViewExtent=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 hasContingentValues(){return this.relatedTableHasContingentValues||this.store.hasContingentValues}get hasInvalidPendingEdits(){return this.relatedTableHasInvalidPendingEdits||this.store.hasInvalidPendingEdits}get hasPendingEdits(){return this.relatedTableHasPendingEdits||this.store.hasPendingEdits}get hiddenFields(){return this._get("hiddenFields")??new l}set hiddenFields(e){this._set("hiddenFields",r(e,this._get("hiddenFields"),l))}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.drainRelatedTables(),this._set("layer",e)}get layerFieldConfigurations(){const e=this.layer;return te(e)?e.fieldConfigurations:void 0}get layerView(){return this.store.layerView}get maxSize(){return super.maxSize}set maxSize(e){super.maxSize=e}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 paginationEnabled(){return super.paginationEnabled}set paginationEnabled(e){super.paginationEnabled=e}get pendingEditsCount(){return this.store.pendingEditsCount}get relatedRecordsEnabled(){return this.store.relatedRecordsEnabled}set relatedRecordsEnabled(e){this.store.relatedRecordsEnabled=e}get relatedTable(){return this.relatedTables.at(-1)}get relatedTableHasContingentValues(){return!!this.relatedTable?.hasContingentValues}get relatedTableHasInvalidPendingEdits(){return!!this.relatedTable?.hasInvalidPendingEdits}get relatedTableHasPendingEdits(){return!!this.relatedTable?.hasPendingEdits}get relationship(){return this.store.relationship}get relationshipColumns(){return this.allColumns.filter(e=>q(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,n=this.store.relationshipInfos;if(n.length||!ie(e)||!i?.length)return n;const l=[],r=s?.layers||t||[];return i.forEach(t=>{const i=se(e,r,t);i&&(i.load(),l.push({layer:e,relatedLayer:i,relationshipId:t.id}))}),l}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 selectionSource(){return"table"}set selectionSource(e){this.syncViewSelection="view"===e,this._overrideIfSome("selectionSource",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.store.timeZone}set timeZone(e){this.store.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,n=i.objectId===e;await s.addAttachment(e,t).catch(e=>{n&&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)}),n&&!i.error&&(i.onEditComplete(),i.attachmentInfos=await s.getAttachmentsByObjectId(e,!0)),this.refreshCellContent()}addPendingEdits(e){this.store.addPendingEdits(e)}collapseRelatedTable(e,t){const{relatedLayer:i,objectId:s,relationshipId:n}=t,{objectIdField:r}=i,o=ne(i,n),a=i.displayField||o?.keyField||r;e.set({highlightIds:new l([s]),multipleSelectionEnabledOverride:!1,tableTemplateOverride:this._getTableTemplateForRelatedTableView(e,a,n)});const d=e.hiddenFields;d.includes(le.action)||d.add(le.action),d.includes(le.attachments)||d.add(le.attachments),e.scrollLeft()}async deleteAttachments(e,t){const{attachmentsViewOptions:i,store:s}=this,n=i.objectId===e;await s.deleteAttachments(e,t).catch(e=>{n&&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)}),n&&!i.error&&(i.onEditComplete(),i.attachmentInfos=await s.getAttachmentsByObjectId(e,!0)),this.refreshCellContent()}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 discardPendingEdits(e){return this.relatedTable&&this.relatedTableHasPendingEdits?this.relatedTable.discardPendingEdits(e):(this.store.discardPendingEdits(e),!0)}async downloadAttachmentById(e,t){const i=(await this.store.getAttachmentsByObjectId(e,!0)).find(e=>e.id===t);await Q(i)}drainRelatedTables(){this.relatedTables.drain(e=>e.destroy()),this.set({multipleSelectionEnabledOverride:null,relationshipColumnConfigs:null,showAllRelatedTables:!1,tableTemplateOverride:null}),this.hiddenFields.removeMany([le.action,le.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 K({layer:i,objectIds:t.toArray(),outFields:s,includeGeometry:e}):this._logWarning("Export failed.")}getFeatureStoreItemByObjectId(e){return this.store.getItemByObjectId(e)}async getFeatureTitle(e,t){return this.store.getFeatureTitle(e,t)}getFeatureTitleSync(e){const t=this.layer;if(!t)return`${e}`;const i=`${t.objectIdField}: ${e}`;return null==e?i:this.store.featureTitleMap.get(e)??i}getObjectIdIndex(e){return this.store.getItemIndexByObjectId(e)}getValue(e,t){const i=this.getFeatureStoreItemByObjectId(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,multipleSelectionEnabledOverride:null,tableTemplateOverride:null}),this.hiddenFields.remove(le.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()),m(this._refreshDebounced())])}refreshCellContent(){this.grid?.requestContentUpdate()}refreshPageCache(){this.grid?.refreshPageCache()}async reset(){this.goToPage(0),await(this.grid?.reset())}async savePendingEdits(){!this.relatedTableHasPendingEdits||this.relatedTableHasInvalidPendingEdits?this.hasPendingEdits&&!this.relatedTable&&(await this.store.savePendingEdits(),await this.refresh()):await(this.relatedTable?.savePendingEdits())}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:i,layer:s}=this;if(!this.attachmentsEnabled||!s)return void this._logWarning("The 'attachmentsEnabled' property is currently false.");await s.load();const n=this._getDefaultLayerDisplayField(s),r=await this.store.getAttachmentsByObjectId(e,!0),o=this.store.getItemIndexByObjectId(e);t.set({attachmentInfos:r,mode:r.length?"list":"file",objectId:e}),this.set({highlightIds:new l([e]),multipleSelectionEnabledOverride:!1,relationshipColumnConfigs:[],tableTemplateOverride:this._getTableTemplateForAttachmentsView(n)}),i.includes(le.action)||i.add(le.action),null!=o&&this.scrollToIndex(o)}syncAttributeTableTemplate(){this._syncAttributeTableTemplate(!0)}syncSelectionSources(){const{defaultSelectionManager:e,layer:t,view:i}=this;e.view=i,e.sources.removeAll(),t&&P(t)&&(e.sources.items=[t])}async updateAttachment(e,t,i){const{attachmentsViewOptions:s,store:n}=this,l=s.objectId===e;await n.updateAttachment(e,t,i).catch(e=>{l&&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)}),l&&!s.error&&(s.onEditComplete(),s.attachmentInfos=await n.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 n=await e.queryFeatures(s);try{await me(t,n.features)}catch(l){"AbortError"!==l.name&&console.error(l)}}_syncAttributeTableTemplate(e=!1){const{_effectiveAttributeTableTemplate:t,layer:i,tableTemplateOverride:s,syncTemplateOnChangesEnabled:n}=this;if(!i||!t||!n&&!e||s||this.tableParent||this.relatedTable||null!==this.attachmentsViewOptions.objectId)return;const{activeSortOrders:l,allColumns:r,columns:o}=this,a=[],d=he(o.toArray());l.forEach(({fieldName:e,direction:t})=>{e&&t&&a.push(new j({field:e,order:t}))}),r.forEach(({fieldName:e,direction:t})=>{t&&!a.some(t=>t.field===e)&&a.push(new j({field:e,order:t}))}),t.elements=d,t.orderByFields=a}async _refresh(){await super.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&&S(e.parent)&&await e.parent.loadAll();const i=e.capabilities.query?.maxRecordCount,s=i&&i<t,n=s?i:t;s&&(this._logWarning("The value for 'pageSize' has been adjusted due to the provided layer's max record count."),this.pageSize=n),this.grid?.set("pageSize",n),this.store.load(),this._generateColumns()}_onLayerRefresh(e){this.autoRefreshEnabled&&e.dataChanged&&this.refresh()}_generateColumns(){this._drainColumns();const{_effectiveTableTemplate:e,_effectiveAttributeTableTemplate:t,layer:i}=this,s=e?.columnTemplates;if(!i)return;const n=this._generateColumnsFromColumnTemplates(i,s)??this._generateColumnsFromAttributeTableTemplate(i,t)??this._generateDefaultFieldColumns(i);n.length&&(this.attachmentsEnabled&&!n.some(e=>$(e))&&n.push(this._generateDefaultAttachmentsColumn(i)),this.relatedRecordsEnabled&&this.relationshipInfos.length&&!n.some(e=>q(e))&&n.push(...this._generateDefaultRelationshipColumns()),this.actionColumnConfig&&n.push(this._generateActionColumn()),n.sort((e,t)=>e.frozen&&t.frozen||e.frozenToEnd&&t.frozenToEnd?0:e.frozen||t.frozenToEnd?-1:0),this.columns.addMany(n))}_generateColumnsFromAttributeTableTemplate(e,t){if(!t)return null;const{elements:i,orderByFields:s}=t,l=A(e),r=[];r.push(...this._generateColumnsFromAttributeTableElements(e,i,s));const o=l.map(t=>{if(!t.fieldName||re(t.fieldName,r))return null;const{fieldName:i}=t,n=oe(e,i);return n?this._generateDefaultFieldColumn(e,n,{hidden:!0,orderByFields:s}):(this._logTemplateWarning("A valid 'field' could not be found for the provided template."),null)}).filter(n);return r.push(...o),this.attachmentsEnabled&&ae(e)&&!r.some(e=>$(e))&&r.push(this._generateDefaultAttachmentsColumn(e,{hidden:!0})),this.relatedRecordsEnabled&&ie(e)&&e.relationships?.forEach(({id:e},t)=>{const i=this.relationshipInfos.find(t=>t.relationshipId===e);i&&!r.some(t=>q(t)&&t.relationshipId===e)&&r.push(this._generateDefaultRelationshipColumn({hidden:!0,info:i,index:t}))}),r.length?r:null}_generateColumnsFromAttributeTableElements(e,t,i){return t?.map((t,s)=>{switch(t.type){case"field":return this._createFieldColumnFromElement({layer:e,element:t,orderByFields:i});case"group":return this._createGroupColumnFromElement({layer:e,element:t,orderByFields:i});case"attachment":return this._createAttachmentColumnFromElement({layer:e,element:t,index:s});case"relationship":return this._createRelationshipColumnFromElement({element:t,index:s})}}).filter(e=>!!e)??[]}_createFieldColumnFromElement(e){const{layer:t,element:i,orderByFields:s}=e,{fieldName:n}=i;if(null==n)return this._logTemplateWarning("A valid 'fieldName' must be provided."),null;const l=oe(t,n);if(!l)return this._logTemplateWarning("A valid 'field' could not be found for the provided template."),null;const{description:r,label:o}=i,a=s?.findIndex(({field:e})=>e&&e===n)??-1,d=a>-1?s?.at(a)?.order:void 0,h=a>-1?a:void 0,{grid:m,messages:c,messagesCommon:p,messagesURIUtils:u,store:g,view:b}=this;return new H({description:r,direction:d,field:l,fieldName:n,grid:m,initialSortPriority:h,label:o,layer:t,messages:c,messagesCommon:p,messagesURIUtils:u,store:g,view:b,onShowPromptCallback:this._onShowPromptCallback})}_createGroupColumnFromElement(e){const{layer:t,element:i,orderByFields:s}=e,{description:n,label:l}=i;if(!l)return this._logTemplateWarning("Group columns require a label."),null;if(!i.elements.length)return this._logTemplateWarning("Group columns require child columns."),null;const{grid:r,messages:o,messagesCommon:a,messagesURIUtils:d,store:h}=this;return new k({columns:this._generateColumnsFromAttributeTableElements(t,i.elements,s),description:n,grid:r,label:l,messages:o,messagesCommon:a,messagesURIUtils:d,store:h})}_createAttachmentColumnFromElement(e){if(!this.attachmentsEnabled)return void this._logTemplateWarning("The 'attachmentsEnabled' property is currently false.");const{layer:t,element:i,index:s}=e,{description:n,label:l}=i,{grid:r,messages:o,messagesCommon:a,messagesURIUtils:d,store:h}=this;return new W({description:n,fieldName:`${le.attachments}-${s}`,grid:r,label:l,layer:t,messages:o,messagesCommon:a,messagesURIUtils:d,store:h,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:n,relationshipId:l}=t,r=this.relationshipInfos.find(e=>e.relationshipId===l);if(!r)return this._logTemplateWarning("Unable to find valid related layer target based on the provided relationship id."),null;const{grid:o,messages:a,messagesCommon:d,messagesURIUtils:h,store:m}=this;return new B({description:s,fieldName:`${le.relationship}-${l}-${i}`,grid:o,label:n,messages:a,messagesCommon:d,messagesURIUtils:h,relationshipId:l,store:m,layer:r.relatedLayer,relatedLayer:r.layer,showRelatedTableCallback:e=>this._onShowRelatedTable(e)})}_generateColumnsFromColumnTemplates(e,t){const{grid:i,messages:s,messagesCommon:n,messagesURIUtils:l,store:r,view:o}=this;if(!t?.length)return null;const a=[];return t.forEach((t,d)=>{const{autoWidth:h,description:m,direction:c,flexGrow:p,fieldName:u,forceVisible:g,formatFunction:b,frozen:f,frozenToEnd:y,icon:T,iconText:w,initialSortPriority:C,invalid:I,label:v,labelTooltipText:_,menuConfig:E,resizable:S,sortable:A,textAlign:F,textWrap:j,timeZone:x,type:R,width:O}=t;if(!R)return void this._logTemplateWarning("Property 'type' is missing from the provided template.");if(f&&y)return void this._logTemplateWarning("Properties 'frozen' and 'frozenToEnd' cannot both be true for the same column.");const U=!1===t.visible;if("group"===R){if(!t.columnTemplates?.length)return void this._logTemplateWarning("Group columns must contain column templates.");if(!t.label)return void this._logTemplateWarning("Group columns require a label.");const r=this._generateColumnsFromColumnTemplates(e,t.columnTemplates),o=U||this._isFieldHidden(t.label);a.push(new k({autoWidth:h,columns:r,description:m,flexGrow:p,forceVisible:g,frozen:f,frozenToEnd:y,grid:i,hidden:o,icon:T,iconText:w,invalid:I,label:v,labelTooltipText:_,menuConfig:E,messages:s,messagesCommon:n,messagesURIUtils:l,resizable:S,textAlign:F,textWrap:j,timeZone:x,width:O}))}else if("attachment"===R){if(!this.attachmentsEnabled)return void this._logTemplateWarning("Attachment columns require attachments to be enabled on the table.");a.push(this._generateAttachmentsColumnFromTemplate(e,t,d))}else if("relationship"===R){if(!this.relatedRecordsEnabled)return void this._logTemplateWarning("Relationship columns require related records to be enabled on the table.");const{relationshipId:e}=t;if(null==e)return void this._logTemplateWarning("Property 'relationshipId' is missing from the provided template.");const i=this.relationshipInfos.find(t=>t.relationshipId===e);if(!i)return void this._logTemplateWarning("Unable to find valid related layer target based on the provided relationship id.");a.push(this._generateRelationshipColumnFromTemplate(i,t,d))}else if(!u)return void this._logTemplateWarning("Value for 'fieldName' property was missing from the provided template.");const V=U||this._isFieldHidden(u);if("column"===R)a.push(new M({autoWidth:h,description:m,direction:c,fieldName:u,flexGrow:p,forceVisible:g,formatFunction:b,frozen:f,frozenToEnd:y,grid:i,hidden:V,icon:T,iconText:w,initialSortPriority:C,invalid:I,label:v,labelTooltipText:_,menuConfig:E,messages:s,messagesCommon:n,messagesURIUtils:l,resizable:S,sortable:A,store:r,textAlign:F,textWrap:j,timeZone:x,width:O}));else if("field"===R){const d=oe(e,t.fieldName);if(!d)return void this._logTemplateWarning("A valid 'field' could not be found for the provided template.");const{editable:u,required:R}=t;a.push(new H({autoWidth:h,description:m,direction:c,editable:u,field:d,fieldName:d.name,flexGrow:p,forceVisible:g,formatFunction:b,frozen:f,frozenToEnd:y,grid:i,hidden:V,icon:T,iconText:w,initialSortPriority:C,invalid:I,label:v,labelTooltipText:_,layer:e,messages:s,messagesCommon:n,messagesURIUtils:l,menuConfig:E,required:R,resizable:S,sortable:A,store:r,template:t,textAlign:F,textWrap:j,timeZone:x,width:O,view:o,onShowPromptCallback:this._onShowPromptCallback}))}}),a.length?a:null}_generateDefaultFieldColumns(e){return e.fields?.map(t=>this._generateDefaultFieldColumn(e,t)).filter(n)??[]}_generateDefaultFieldColumn(e,t,i){const{grid:s,messages:n,messagesCommon:l,messagesURIUtils:r,store:o,view:a}=this;if(!t.visible||"geometry"===t.type)return null;const d=i?.orderByFields,h=t.name,m=d?.findIndex(({field:e})=>e&&e===h)??-1,c=m>-1?d?.at(m)?.order:void 0,p=m>-1?m:void 0;return new H({direction:c,field:t,fieldName:h,grid:s,hidden:i?.hidden||this._isFieldHidden(h),initialSortPriority:p,layer:e,messages:n,messagesCommon:l,messagesURIUtils:r,store:o,view:a,onShowPromptCallback:this._onShowPromptCallback})}_generateAttachmentsColumnFromTemplate(e,t,i){const{grid:s,messages:n,messagesCommon:l,messagesURIUtils:r,store:o}=this,{attachmentsViewEnabled:a,autoWidth:d,description:h,flexGrow:m,fieldName:c,forceVisible:p,formatFunction:u,frozen:g,frozenToEnd:b,icon:f,iconText:y,invalid:T,label:w,labelTooltipText:C,menuConfig:I,resizable:v,textAlign:_,textWrap:E,thumbnailAppearance:S,thumbnailCount:A,thumbnailIconScale:F,thumbnailsEnabled:j,timeZone:x,width:R}=t;return new W({attachmentsViewEnabled:a,autoWidth:d,description:h,fieldName:`${le.attachments}-${i}`,flexGrow:m,forceVisible:p,formatFunction:u,frozen:g,frozenToEnd:b,grid:s,hidden:!1===t.visible||this._isFieldHidden(w)||this._isFieldHidden(c),icon:f,iconText:y,invalid:T,label:w,labelTooltipText:C,layer:e,menuConfig:I,messages:n,messagesCommon:l,messagesURIUtils:r,resizable:v,store:o,textAlign:_,textWrap:E,thumbnailAppearance:S,thumbnailCount:A,thumbnailIconScale:F,thumbnailsEnabled:j,timeZone:x,width:R,onShowAttachments:e=>this._onShowAttachments(e)})}_generateDefaultAttachmentsColumn(e,t){const{grid:i,messages:s,messagesCommon:n,messagesURIUtils:l,store:r}=this,o=le.attachments;return new W({fieldName:o,grid:i,hidden:t?.hidden||this._isFieldHidden(o),layer:e,messages:s,messagesCommon:n,messagesURIUtils:l,store:r,onShowAttachments:e=>this._onShowAttachments(e)})}_generateRelationshipColumnFromTemplate(e,t,i){const{grid:s,messages:n,messagesCommon:l,messagesURIUtils:r,store:o}=this,{autoWidth:a,collapsed:d,description:h,flexGrow:m,fieldName:c,formatFunction:p,frozen:u,frozenToEnd:g,icon:b,iconText:f,invalid:y,label:T,labelTooltipText:w,menuConfig:C,relationshipId:I,resizable:v,textAlign:_,textWrap:E,timeZone:S,width:A}=t;return new B({autoWidth:a,collapsed:d,description:h,fieldName:`${le.relationship}-${I}-${i}`,flexGrow:m,formatFunction:p,frozen:u,frozenToEnd:g,grid:s,hidden:!1===t.visible||this._isFieldHidden(T)||this._isFieldHidden(c),icon:b,iconText:f,invalid:y,label:T,labelTooltipText:w,menuConfig:C,messages:n,messagesCommon:l,messagesURIUtils:r,relationshipId:I,resizable:v,store:o,textAlign:_,textWrap:E,timeZone:S,width:A,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:n}=t,l=e.find(e=>e.relationshipId===n);l&&i.push(this._generateDefaultRelationshipColumn({config:t,index:s,info:l}))}):e.forEach((e,t)=>i.push(this._generateDefaultRelationshipColumn({index:t,info:e}))),i):i}_generateDefaultRelationshipColumn(e){const{config:t,hidden:i,index:s,info:n}=e,{grid:l,messages:r,messagesCommon:o,messagesURIUtils:a,store:d}=this,{relationshipId:h}=n;return new B({...t,fieldName:`${le.relationship}-${h}-${s}`,grid:l,hidden:i,messages:r,messagesCommon:o,messagesURIUtils:a,layer:n.relatedLayer,relatedLayer:n.layer,relationshipId:h,store:d,showRelatedTableCallback:e=>this._onShowRelatedTable(e)})}_generateActionColumn(){const{actionColumnConfig:e,store:t}=this,i=this._isFieldHidden(le.action)&&!0!==e?.forceVisible;return new z({hidden:i,store:t,...e})}_isFieldHidden(e){const t=e?.toLowerCase();return(this.hiddenFields??this._defaultHiddenFields).some(e=>e.toLowerCase()===t)}async _syncTemporaryHighlight(e,t){if(!this.highlightEnabled)return this._currentTemporaryHighlight?.handle.remove(),void(this._currentTemporaryHighlight=null);if(await c(25),p(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:n,highlightEnabled:l}=this;e&&s&&n&&l&&(this._currentTemporaryHighlight={id:e,handle:s.highlight(e,{name:O})})}_syncSelection(){const{layer:e}=this;V(e)?this.highlightIds.items=this.effectiveSelectionManager.getSelection(e)??[]:this.highlightIds.removeAll()}_addToSelection(e){const t=this.layer;V(t)&&this.effectiveSelectionManager.add(t,e)}_removeFromSelection(e){const t=this.layer;V(t)&&this.effectiveSelectionManager.remove(t,e)}async _onHighlightIdsChange(e){const{added:t,removed:i}=e,{attachmentsViewOptions:s}=this;if(this._removeFromSelection(i),this._addToSelection(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"}),this.getFeatureTitle(e)}}}_syncTableParentSelection(e){const{tableParent:t}=this;t&&null!=e&&t.highlightIds.add(e)}_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(le.action)||s.add(le.action),s.includes(le.attachments)||s.add(le.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({multipleSelectionEnabledOverride:!1,relationshipColumnConfigs:[],showAllRelatedTables:!1,tableTemplateOverride:this._getTableTemplateForAttachmentsView(i)})}else e.set({multipleSelectionEnabledOverride:null,relationshipColumnConfigs:de(t,i.id),showAllRelatedTables:!1,tableTemplateOverride:null}),e.hiddenFields.removeMany([le.action,le.attachments])}_getTableTemplateForRelatedTableView(e,t,i){return new ee({columnTemplates:[new X({fieldName:t,editable:!1,menuConfig:{selectionMode:"single",icon:"chevron-down",items:this._extractFieldColumnInfosFromTableTemplate(e.viewModel).map(([s,n])=>({selected:s===t,label:n||s,clickFunction:()=>{e.tableTemplateOverride=this._getTableTemplateForRelatedTableView(e,s,i)}}))},resizable:!1}),new Y({autoWidth:!1,collapsed:!0,flexGrow:0,label:"",resizable:!1,relationshipId:i,width:pe})]})}_getTableTemplateForShowAllTablesView(e,t){const i=[new X({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 N({attachmentsViewEnabled:!1,autoWidth:!1,flexGrow:0,label:"",resizable:!1,thumbnailsEnabled:!1,width:pe})),new ee({columnTemplates:i})}async _onShowPromptCallback(e){const{column:t,objectId:i,oldValue:s,value:n}=e,{_subtypes:l,layer:r}=this;if(!r||!l.length)return void t.cancel();const o=l.find(e=>e.code===n);if(!o)return void t.cancel();const a=Promise.withResolvers(),d=this._createSubtypeEditPrompt(s,o,a),h=!!r.parent&&this.autoSaveEnabled;try{this.showPrompt(d);const e=await a.promise,s=[{fieldName:t.fieldName,value:n}];switch(e){case"update-fields":for(const[e,t]of Object.entries(o.defaultValues))null!=t&&s.push({fieldName:e,value:t});await t.updateItems({objectId:i,updates:s}),h&&this.refresh();break;case"keep-existing":await t.updateItems({objectId:i,updates:s}),h&&this.refresh();break;case"undo":t.cancel()}}finally{this.clearPrompt()}}_createSubtypeEditPrompt(e,t,s){const{_subtypes:n,messages:l,messagesCommon:r}=this,o=n.find(t=>t.code===e)?.name??`${e}`;let a="update-fields";const d=[{label:l.subtypes.useDefaultValuesOption,value:"update-fields"},{label:l.subtypes.keepCurrentValuesOption,value:"keep-existing"}];return{context:"info",title:l.subtypes.changeWarningTitle,message:i(l.subtypes.changeWarning,{originalType:o,newType:t.name}),radios:d,defaultRadioSelection:"update-fields",onRadioSelection:e=>{a=e},actions:{primary:{label:r.apply,action:()=>s.resolve(a),type:"positive"},secondary:{label:r.cancel,type:"neutral",action:()=>s.resolve("undo")}},cancel:()=>s.reject()}}_onShowAttachments({objectId:e}){this.hasPendingEdits||(this.attachmentsViewOptions.objectId=e)}_getTableTemplateForAttachmentsView(e){return new ee({columnTemplates:[new X({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 N({attachmentsViewEnabled:!1,autoWidth:!1,flexGrow:0,label:"",resizable:!1,thumbnailsEnabled:!1,width:pe})]})}_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})=>{if(null!=t&&""!==t)return[e,t];const s=i?.fieldsIndex.get(e);return[e,s&&I(s,i)]}):i?.fields.map(e=>[e.name,I(e,i)])??[]}_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?a.getLogger(this).warnOnce(e):a.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([w()],ue.prototype,"_defaultHiddenFields",null),e([w()],ue.prototype,"_effectiveTableTemplate",null),e([w()],ue.prototype,"_effectiveAttributeTableTemplate",null),e([w()],ue.prototype,"_highlightableLayerView",null),e([w()],ue.prototype,"_subtypes",null),e([w()],ue.prototype,"activeFilters",null),e([w({readOnly:!0})],ue.prototype,"activeSortOrders",null),e([w()],ue.prototype,"allRelatedTablesVisible",null),e([w()],ue.prototype,"attachmentsColumns",null),e([w()],ue.prototype,"attachmentsEnabled",null),e([w()],ue.prototype,"attachmentsViewOptions",void 0),e([w({type:F})],ue.prototype,"attributeTableTemplate",void 0),e([w()],ue.prototype,"autoRefreshEnabled",void 0),e([w()],ue.prototype,"autoSaveEnabled",null),e([w()],ue.prototype,"canAddRelatedFeature",null),e([w()],ue.prototype,"clearPrompt",null),e([w({readOnly:!0})],ue.prototype,"columns",void 0),e([w()],ue.prototype,"dataProvider",void 0),e([w()],ue.prototype,"defaultSelectionManager",void 0),e([w()],ue.prototype,"definitionExpression",null),e([w()],ue.prototype,"effectiveSelectionManager",null),e([w()],ue.prototype,"fieldColumns",null),e([w()],ue.prototype,"filterByViewExtent",null),e([w({types:v})],ue.prototype,"filterGeometry",null),e([w()],ue.prototype,"filterBySelectionEnabled",null),e([w({readOnly:!0})],ue.prototype,"grid",void 0),e([w()],ue.prototype,"hasContingentValues",null),e([w()],ue.prototype,"hasInvalidPendingEdits",null),e([w()],ue.prototype,"hasPendingEdits",null),e([w()],ue.prototype,"hiddenFields",null),e([w()],ue.prototype,"highlightEnabled",void 0),e([w()],ue.prototype,"initialSize",null),e([w()],ue.prototype,"isQueryingOrSyncing",null),e([w()],ue.prototype,"isSyncingAttachments",null),e([w()],ue.prototype,"layer",null),e([w()],ue.prototype,"layers",void 0),e([w()],ue.prototype,"layerFieldConfigurations",null),e([w()],ue.prototype,"layerView",null),e([w()],ue.prototype,"menuConfig",void 0),e([w()],ue.prototype,"messages",void 0),e([w(),ce("esri/t9n/common")],ue.prototype,"messagesCommon",void 0),e([w(),ce("esri/core/t9n/Units")],ue.prototype,"messagesUnits",void 0),e([w(),ce("esri/widgets/support/t9n/uriUtils")],ue.prototype,"messagesURIUtils",void 0),e([w()],ue.prototype,"outFields",null),e([w()],ue.prototype,"pendingEditsCount",null),e([w()],ue.prototype,"prompt",void 0),e([w()],ue.prototype,"relatedRecordsEnabled",null),e([w()],ue.prototype,"relatedTable",null),e([w()],ue.prototype,"relatedTableHasContingentValues",null),e([w()],ue.prototype,"relatedTables",void 0),e([w()],ue.prototype,"relationship",null),e([w()],ue.prototype,"relationshipColumnConfigs",void 0),e([w()],ue.prototype,"relationshipColumns",null),e([w()],ue.prototype,"relationshipConfig",null),e([w()],ue.prototype,"relationshipInfos",null),e([w()],ue.prototype,"relationships",null),e([w()],ue.prototype,"returnGeometryEnabled",null),e([w()],ue.prototype,"returnMEnabled",null),e([w()],ue.prototype,"returnZEnabled",null),e([w()],ue.prototype,"selectionManager",void 0),e([w()],ue.prototype,"selectionSource",null),e([w()],ue.prototype,"showAllRelatedTables",null),e([w()],ue.prototype,"showPrompt",null),e([w()],ue.prototype,"showRelatedTableCallback",void 0),e([w({readOnly:!0,type:J})],ue.prototype,"store",void 0),e([w()],ue.prototype,"supportsAttachments",null),e([w()],ue.prototype,"supportsAddAttachments",null),e([w()],ue.prototype,"supportsDeleteAttachments",null),e([w()],ue.prototype,"supportsResizeAttachments",null),e([w()],ue.prototype,"supportsUpdateAttachments",null),e([w()],ue.prototype,"syncTemplateOnChangesEnabled",void 0),e([w()],ue.prototype,"syncViewSelection",void 0),e([w()],ue.prototype,"tableController",void 0),e([w()],ue.prototype,"tableParent",void 0),e([w({type:ee})],ue.prototype,"tableTemplate",void 0),e([w()],ue.prototype,"tableTemplateOverride",void 0),e([w({type:x})],ue.prototype,"timeExtent",null),e([w()],ue.prototype,"timeZone",null),e([w()],ue.prototype,"view",null),ue=e([C("esri.widgets.FeatureTable.FeatureTableViewModel")],ue);const ge=ue;export{ge as default};
@@ -5,7 +5,7 @@ import type { TimeZone } from "../../../time/types.js";
5
5
  import type { TextAlign, ColumnTableMenuConfig, Direction } from "./types.js";
6
6
  import type { FormatFunction } from "../support/types.js";
7
7
 
8
- export interface ColumnProperties extends Partial<Pick<Column, "autoWidth" | "description" | "direction" | "flexGrow" | "hidden" | "icon" | "iconText" | "label" | "labelTooltipText" | "sortable" | "textAlign" | "textWrap" | "timeZone" | "topLayerDisabled" | "visibleElements" | "width">> {
8
+ export interface ColumnProperties extends Partial<Pick<Column, "autoWidth" | "description" | "direction" | "flexGrow" | "forceVisible" | "hidden" | "icon" | "iconText" | "label" | "labelTooltipText" | "sortable" | "textAlign" | "textWrap" | "timeZone" | "topLayerDisabled" | "visibleElements" | "width">> {
9
9
  /** The unique field name as defined by the data source. */
10
10
  fieldName?: string;
11
11
  /** Indicates the initial sort priority of the column when first rendered. */
@@ -66,6 +66,12 @@ export default class Column extends Accessor {
66
66
  * using [fieldName](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTable/Grid/Column/#fieldName) if a [label](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTable/Grid/Column/#label) is not defined on the column.
67
67
  */
68
68
  get effectiveLabel(): string;
69
+ /**
70
+ * Indicates whether the column is visible, accounting for both 'forceVisible' and 'hidden' properties.
71
+ *
72
+ * @since 5.1
73
+ */
74
+ get effectiveVisible(): boolean;
69
75
  /** The unique field name as defined by the data source. */
70
76
  get fieldName(): string;
71
77
  /**
@@ -74,6 +80,15 @@ export default class Column extends Accessor {
74
80
  * @default 1
75
81
  */
76
82
  accessor flexGrow: number;
83
+ /**
84
+ * Indicates this column should always be visible in the default table view.
85
+ * The column may still be hidden in a nested table view. This property takes priority over
86
+ * the 'hidden' property.
87
+ *
88
+ * @default false
89
+ * @since 5.1
90
+ */
91
+ accessor forceVisible: boolean;
77
92
  /**
78
93
  * Custom function for rendering cell content that is called when the column is rendered in the table. The function should return the formatted content to display within a table's cell. This can be a string, number, an HTML element, or equivalent node type (e.g. a [Calcite component](https://developers.arcgis.com/calcite-design-system/components/)). If the content is an HTML element, it is appended to the root element. If the content is a string or number, it is set as the `innerHTML` of the root element. If the content is `null`, the root element is cleared. If the content is `undefined`, the root element is not modified. This property is useful when you want to customize the cell content. For example, you can use this property to create a custom cell renderer that displays a progress bar in the cell. The progress bar can be used to show the progress of a task.
79
94
  *
@@ -102,7 +117,7 @@ export default class Column extends Accessor {
102
117
  */
103
118
  get frozenToEnd(): boolean;
104
119
  /**
105
- * Indicates whether the column is visible.
120
+ * Indicates whether the column is hidden. Setting this property to true will hide the column.
106
121
  *
107
122
  * @default false
108
123
  */
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{watch as i,when as n,initial as o}from"../../../core/reactiveUtils.js";import{renderingSanitizer as s,stripHTMLSanitizer as l}from"../../../core/sanitizerUtils.js";import{property as r,subclass as a}from"../../../core/accessorSupport/decorators.js";import{css as c}from"./ColumnCSS.js";import{isEmptyStringOrWhitespace as d}from"../support/tableUtils.js";import{autoLink as p}from"../../support/uriUtils.js";import{setFocus as u}from"../../support/widgetUtils.js";const h=/<br\s*\/*>/gi;let m=class extends t{constructor(e){super(e),this._menuIsOpen=!1,this.autoWidth=!1,this.cellValueFormatFunction=({root:e,rowData:t,value:i})=>{const{formatFunction:n}=this,o=this.sanitizeContent(i);if(n&&t){const{index:i,item:{attachments:s,feature:l,relatedRecords:r}}=t;return n({attachments:s,column:this,feature:l,index:i,relatedRecords:r,value:o,virtualIndex:this.getVirtualRowIndex(e),field:void 0})}return o},this.description=null,this.direction=null,this.fieldName=null,this.flexGrow=1,this.footerRenderFunction=null,this.formatFunction=null,this.frozen=!1,this.frozenToEnd=!1,this.grid=null,this.headerRenderFunction=e=>{const{root:t}=e,i=this.createHeaderContent();this.removeCellContent(t),t.appendChild(i)},this.hidden=!1,this.icon=null,this.iconText=null,this.initialSortPriority=null,this.label=null,this.labelTooltipText=null,this.menuConfig=null,this.messages=null,this.messagesCommon=null,this.messagesURIUtils=null,this.renderFunction=({root:e,rowData:t})=>{const i=this.getCellValue(t),n=this.cellValueFormatFunction({root:e,rowData:t,value:i});let o=null;if(o=n instanceof HTMLElement?n:p(this.messagesURIUtils,n),this.removeCellContent(e),o instanceof HTMLElement)e.removeAttribute("title"),e.appendChild(o);else if(null!=o){const t=o.toString();e.innerHTML=t,e.title=t}},this.resizable=!0,this.sortable=!1,this.store=null,this.textAlign="start",this.textWrap=!1,this.timeZone=null,this.topLayerDisabled=!1,this.visibleElements=null,this.width=200}initialize(){const{fieldName:e}=this;this._set("sortElement",this.createSortElement()),this.sortElement.setAttribute("path",e),this.addHandles([i(()=>this.direction,e=>{const{sortElement:t}=this;this.effectiveSortable&&t&&(e?this.sortElement.direction!==e&&t.setAttribute("direction",e):t.removeAttribute("direction"))}),n(()=>this.grid?.isReady&&this.sortElement,()=>{const{direction:e,grid:t,hidden:i,sortElement:n}=this;i&&e&&n&&t&&!t.hasSorter(n)&&t.addSorter(n)},o),i(()=>[this.timeZone,this.icon,this.iconText,this.labelTooltipText],()=>this.grid?.requestContentUpdate()),i(()=>this.hidden,()=>this.closeMenu()),i(()=>this.fieldName,e=>{const{sortElement:t}=this;t&&t.path!==e&&t.setAttribute("path",e)}),i(()=>[this.effectiveLabel,this.labelTooltipText],([e,t])=>{const{sortElement:i}=this;i&&(i.setAttribute("title",t||e),i.textContent=e)})])}get _headerRequiresTextContainer(){return!(!this.effectiveSortable&&""===this.effectiveLabel&&null==this.effectiveDescription)}get customMenuItems(){return this.menuConfig?.items?.map(({disabled:e,hidden:t,icon:i,iconClass:n,label:o,selected:s,clickFunction:l})=>this.createCalciteDropdownItem({disabled:e,hidden:t,iconClass:n,iconStart:i,selected:s,textContent:o,onclick:e=>l(e)}))??[]}get defaultMenuItems(){if(!this.effectiveSortable)return[];const e=this.messages,t=[],i=this.visibleElements?.columnMenuItems;if(!1!==i?.sortAscending){const i=this.createCalciteDropdownItem({iconFlipRtl:"start",iconStart:"sort-ascending-arrow",textContent:e?.sortAsc,onclick:()=>this.direction="asc"});t.push(i)}if(!1!==i?.sortDescending){const i=this.createCalciteDropdownItem({iconFlipRtl:"start",iconStart:"sort-descending-arrow",textContent:e?.sortDesc,onclick:()=>this.direction="desc"});t.push(i)}return t}get effectiveDescription(){const{description:e}=this;return d(e)?null:this.sanitizeLabel(e)}get effectiveLabel(){return this.sanitizeLabel(this.label||this.fieldName)}get effectiveSortable(){return this.sortable}get iconNode(){const{icon:e,iconText:t}=this,i=t?this.sanitizeLabel(t):void 0;return e?this.createCalciteIcon({icon:e,textLabel:i}):null}set invalid(e){this._set("invalid",e),this.grid?.generateCellPartNames()}get invalid(){return this._get("invalid")??!1}get menu(){const{customMenuItems:e,defaultMenuItems:t,menuConfig:i}=this,n=!!i?.open,o=this.createCalciteAction({icon:i?.icon??"ellipsis",text:this.messages?.menu??"",scale:"m",slot:"trigger"}),s=document.createElement("calcite-dropdown");if(s.maxItems=i?.maxItems??4,s.placement="top-end",s.scale=i?.scale??"m",n&&(s.open=n,this._menuIsOpen=!0),s.appendChild(o),s.addEventListener("calciteDropdownOpen",()=>this._menuIsOpen=!0),s.addEventListener("calciteDropdownClose",()=>this._menuIsOpen=!1),s.onkeydown=this._stopPropagationOnSelect,s.addEventListener("mousewheel",e=>{e.stopPropagation()}),t.length){const e=s.appendChild(document.createElement("calcite-dropdown-group"));e.selectionMode="none",e.append(...t)}if(e.length){const t=s.appendChild(document.createElement("calcite-dropdown-group"));t.selectionMode=i?.selectionMode??"none",t.append(...e)}return s}get menuItems(){return[...this.defaultMenuItems,...this.customMenuItems]}get menuIsOpen(){return this._menuIsOpen}get menuIsVisible(){return!(!1===this.visibleElements?.columnMenus||!this.menuItems.length)}get tableHasInvalidPendingEdits(){return this.store.hasInvalidPendingEdits}get tableHasPendingEdits(){return this.store.hasPendingEdits}get tableTimeZone(){return this.store.timeZone}closeMenu(){this.menu.open=!1}createSortElement(){const{effectiveLabel:e,direction:t,fieldName:i,initialSortPriority:n}=this,o=document.createElement("vaadin-grid-sorter");return o.classList.add(c.sorter),o.setAttribute("path",i),o.setAttribute("title",this.labelTooltipText||e),o.textContent=e,t&&o.setAttribute("direction",t),null!=n&&(o._initialOrder=n),o.addEventListener("direction-changed",()=>{this.direction!==o.direction&&this._set("direction",o.direction)}),o}createCalciteAction(e){const t=document.createElement("calcite-action"),{alignment:i,className:n,disabled:o,icon:s,label:l,scale:r,slot:a,text:c,textEnabled:d,onclick:p}=e;return t.alignment=i??"center",t.className=n??"",t.disabled=!!o,s&&(t.icon=s),t.label=l??"",t.scale=r??"s",t.slot=a??"",t.text=t.title=c??"",t.textEnabled=!!d,t.onclick=p??null,t}createCalciteButton(e){const t=document.createElement("calcite-button"),{alignment:i,appearance:n,className:o,disabled:s,iconEnd:l,iconFlipRtl:r,kind:a,loading:c,onclick:d,scale:p,textContent:u,title:h,width:m}=e;return t.alignment=i??"center",t.className=o??"",t.scale=p??"s",t.appearance=n??"transparent",t.disabled=!!s,l&&(t.iconEnd=l),r&&(t.iconFlipRtl=r),t.kind=a??"brand",t.loading=!!c,t.textContent=u??"",h&&(t.title=h),t.width=m??"auto",t.onclick=d??null,t}createCalciteDropdownItem(e){const t=document.createElement("calcite-dropdown-item"),{disabled:i,hidden:n,iconClass:o,iconFlipRtl:s,iconStart:l,textContent:r,onclick:a,selected:d}=e,p=r??"";if(o&&!l){const e=document.createElement("span"),i=document.createElement("span");i.classList.add(c.headerMenuIcon,o),e.textContent=e.title=p,e.insertBefore(i,e.firstChild),t.appendChild(e)}else l&&(t.iconStart=l),t.textContent=t.title=p;return t.disabled=!!i,t.hidden="function"==typeof n?n():!!n,t.selected=!!d,s&&(t.iconFlipRtl=s),a&&(t.addEventListener("calciteDropdownItemSelect",a),t.onkeydown=this._stopPropagationOnSelect),t}createCalciteIcon(e){const{effectiveLabel:t}=this,{icon:i,scale:n,textLabel:o}=e,s=document.createElement("calcite-icon"),l=o??t;return s.icon=i,s.scale=n??"s",s.textLabel=l,s.title=l,s}createHeaderContent(){const{effectiveDescription:e,effectiveLabel:t,iconNode:i}=this,n=document.createElement("div");if(n.classList.add(c.headerContent),i&&n.appendChild(i),!this._headerRequiresTextContainer)return n;const o=n.appendChild(document.createElement("div"));return this.effectiveSortable?o.appendChild(this.sortElement):""!==t&&o.appendChild(this._createHeaderTextElement({label:t,cssClass:c.headerLabel,title:this.labelTooltipText})),null!=e&&!1!==this.visibleElements?.columnDescriptions&&o.appendChild(this._createHeaderTextElement({label:e,cssClass:c.headerDescription})),this.menuIsVisible&&n.appendChild(this.menu),n}getCellValue(e){return e?.item.feature.attributes?.[this.fieldName]}getVirtualRowIndex(e){const t=this.grid?.getRowContainingNode(e);return t?.parentElement?[...t.parentElement.children].indexOf(t):-1}itemHasInvalidPendingEdits(e,t){return this.store.itemHasInvalidPendingEdits(e,t)}itemHasPendingEdits(e,t){return this.store.itemHasPendingEdits(e,t)}openMenu(){this.menuIsVisible&&(this.menu.open=!0,u(this.menuItems[0]))}removeCellContent(e){if(e?.firstChild)try{for(;e?.firstChild;)e.removeChild(e.firstChild)}catch(t){}}sanitizeContent(e){return s.sanitize(e)}sanitizeLabel(e){return null==e||""===e?"":l.sanitize(e.toString()).replaceAll(h," ")}sort(){this.effectiveSortable&&this.sortElement?.click()}_stopPropagationOnSelect(e){"Enter"!==e.key&&" "!==e.key||e.stopPropagation()}_createHeaderTextElement({cssClass:e,label:t,title:i}){const n=document.createElement("span");n.classList.add(e);const o=n.appendChild(document.createElement("span"));return o.textContent=t,o.setAttribute("title",i||t),n}};e([r()],m.prototype,"_headerRequiresTextContainer",null),e([r()],m.prototype,"_menuIsOpen",void 0),e([r()],m.prototype,"autoWidth",void 0),e([r()],m.prototype,"cellValueFormatFunction",void 0),e([r()],m.prototype,"customMenuItems",null),e([r()],m.prototype,"defaultMenuItems",null),e([r()],m.prototype,"description",void 0),e([r()],m.prototype,"direction",void 0),e([r()],m.prototype,"effectiveDescription",null),e([r()],m.prototype,"effectiveLabel",null),e([r()],m.prototype,"effectiveSortable",null),e([r({constructOnly:!0})],m.prototype,"fieldName",void 0),e([r()],m.prototype,"flexGrow",void 0),e([r()],m.prototype,"footerRenderFunction",void 0),e([r()],m.prototype,"formatFunction",void 0),e([r()],m.prototype,"frozen",void 0),e([r()],m.prototype,"frozenToEnd",void 0),e([r()],m.prototype,"grid",void 0),e([r()],m.prototype,"headerRenderFunction",void 0),e([r()],m.prototype,"hidden",void 0),e([r()],m.prototype,"icon",void 0),e([r()],m.prototype,"iconNode",null),e([r()],m.prototype,"iconText",void 0),e([r({constructOnly:!0})],m.prototype,"initialSortPriority",void 0),e([r()],m.prototype,"invalid",null),e([r()],m.prototype,"label",void 0),e([r()],m.prototype,"labelTooltipText",void 0),e([r()],m.prototype,"menu",null),e([r()],m.prototype,"menuItems",null),e([r()],m.prototype,"menuConfig",void 0),e([r()],m.prototype,"menuIsOpen",null),e([r()],m.prototype,"menuIsVisible",null),e([r()],m.prototype,"messages",void 0),e([r()],m.prototype,"messagesCommon",void 0),e([r()],m.prototype,"messagesURIUtils",void 0),e([r()],m.prototype,"renderFunction",void 0),e([r()],m.prototype,"resizable",void 0),e([r()],m.prototype,"sortable",void 0),e([r({readOnly:!0})],m.prototype,"sortElement",void 0),e([r()],m.prototype,"store",void 0),e([r()],m.prototype,"tableHasInvalidPendingEdits",null),e([r()],m.prototype,"tableHasPendingEdits",null),e([r()],m.prototype,"tableTimeZone",null),e([r()],m.prototype,"textAlign",void 0),e([r()],m.prototype,"textWrap",void 0),e([r()],m.prototype,"timeZone",void 0),e([r()],m.prototype,"topLayerDisabled",void 0),e([r()],m.prototype,"visibleElements",void 0),e([r()],m.prototype,"width",void 0),m=e([a("esri.widgets.FeatureTable.Grid.Column")],m);const f=m;export{f as default};
2
+ import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{watch as i,when as n,initial as o}from"../../../core/reactiveUtils.js";import{renderingSanitizer as s,stripHTMLSanitizer as l}from"../../../core/sanitizerUtils.js";import{property as r,subclass as a}from"../../../core/accessorSupport/decorators.js";import{css as c}from"./ColumnCSS.js";import{isEmptyStringOrWhitespace as d}from"../support/tableUtils.js";import{autoLink as p}from"../../support/uriUtils.js";import{setFocus as u}from"../../support/widgetUtils.js";const h=/<br\s*\/*>/gi;let m=class extends t{constructor(e){super(e),this._menuIsOpen=!1,this.autoWidth=!1,this.cellValueFormatFunction=({root:e,rowData:t,value:i})=>{const{formatFunction:n}=this,o=this.sanitizeContent(i);if(n&&t){const{index:i,item:{attachments:s,feature:l,relatedRecords:r}}=t;return n({attachments:s,column:this,feature:l,index:i,relatedRecords:r,value:o,virtualIndex:this.getVirtualRowIndex(e),field:void 0})}return o},this.description=null,this.direction=null,this.fieldName=null,this.flexGrow=1,this.footerRenderFunction=null,this.forceVisible=!1,this.formatFunction=null,this.frozen=!1,this.frozenToEnd=!1,this.grid=null,this.headerRenderFunction=e=>{const{root:t}=e,i=this.createHeaderContent();this.removeCellContent(t),t.appendChild(i)},this.hidden=!1,this.icon=null,this.iconText=null,this.initialSortPriority=null,this.label=null,this.labelTooltipText=null,this.menuConfig=null,this.messages=null,this.messagesCommon=null,this.messagesURIUtils=null,this.renderFunction=({root:e,rowData:t})=>{const i=this.getCellValue(t),n=this.cellValueFormatFunction({root:e,rowData:t,value:i});let o=null;if(o=n instanceof HTMLElement?n:p(this.messagesURIUtils,n),this.removeCellContent(e),o instanceof HTMLElement)e.removeAttribute("title"),e.appendChild(o);else if(null!=o){const t=o.toString();e.innerHTML=t,e.title=t}},this.resizable=!0,this.sortable=!1,this.store=null,this.textAlign="start",this.textWrap=!1,this.timeZone=null,this.topLayerDisabled=!1,this.visibleElements=null,this.width=200}initialize(){const{fieldName:e}=this;this._set("sortElement",this.createSortElement()),this.sortElement.setAttribute("path",e),this.addHandles([i(()=>this.direction,e=>{const{sortElement:t}=this;this.effectiveSortable&&t&&(e?this.sortElement.direction!==e&&t.setAttribute("direction",e):t.removeAttribute("direction"))}),n(()=>this.grid?.isReady&&this.sortElement,()=>{const{effectiveVisible:e,direction:t,grid:i,sortElement:n}=this;!e&&t&&n&&i&&!i.hasSorter(n)&&i.addSorter(n)},o),i(()=>[this.timeZone,this.icon,this.iconText,this.labelTooltipText],()=>this.grid?.requestContentUpdate()),i(()=>this.effectiveVisible,()=>this.closeMenu()),i(()=>this.fieldName,e=>{const{sortElement:t}=this;t&&t.path!==e&&t.setAttribute("path",e)}),i(()=>[this.effectiveLabel,this.labelTooltipText],([e,t])=>{const{sortElement:i}=this;i&&(i.setAttribute("title",t||e),i.textContent=e)})])}get _headerRequiresTextContainer(){return!(!this.effectiveSortable&&""===this.effectiveLabel&&null==this.effectiveDescription)}get customMenuItems(){return this.menuConfig?.items?.map(({disabled:e,hidden:t,icon:i,iconClass:n,label:o,selected:s,clickFunction:l})=>this.createCalciteDropdownItem({disabled:e,hidden:t,iconClass:n,iconStart:i,selected:s,textContent:o,onclick:e=>l(e)}))??[]}get defaultMenuItems(){if(!this.effectiveSortable)return[];const e=this.messages,t=[],i=this.visibleElements?.columnMenuItems;if(!1!==i?.sortAscending){const i=this.createCalciteDropdownItem({iconFlipRtl:"start",iconStart:"sort-ascending-arrow",textContent:e?.sortAsc,onclick:()=>this.direction="asc"});t.push(i)}if(!1!==i?.sortDescending){const i=this.createCalciteDropdownItem({iconFlipRtl:"start",iconStart:"sort-descending-arrow",textContent:e?.sortDesc,onclick:()=>this.direction="desc"});t.push(i)}return t}get effectiveDescription(){const{description:e}=this;return d(e)?null:this.sanitizeLabel(e)}get effectiveLabel(){return this.sanitizeLabel(this.label||this.fieldName)}get effectiveSortable(){return this.sortable}get effectiveVisible(){return this.forceVisible||!this.hidden}get iconNode(){const{icon:e,iconText:t}=this,i=t?this.sanitizeLabel(t):void 0;return e?this.createCalciteIcon({icon:e,textLabel:i}):null}set invalid(e){this._set("invalid",e),this.grid?.generateCellPartNames()}get invalid(){return this._get("invalid")??!1}get menu(){const{customMenuItems:e,defaultMenuItems:t,menuConfig:i}=this,n=!!i?.open,o=this.createCalciteAction({icon:i?.icon??"ellipsis",text:this.messages?.menu??"",scale:"m",slot:"trigger"}),s=document.createElement("calcite-dropdown");if(s.maxItems=i?.maxItems??4,s.placement="top-end",s.scale=i?.scale??"m",n&&(s.open=n,this._menuIsOpen=!0),s.appendChild(o),s.addEventListener("calciteDropdownOpen",()=>this._menuIsOpen=!0),s.addEventListener("calciteDropdownClose",()=>this._menuIsOpen=!1),s.onkeydown=this._stopPropagationOnSelect,s.addEventListener("mousewheel",e=>{e.stopPropagation()}),t.length){const e=s.appendChild(document.createElement("calcite-dropdown-group"));e.selectionMode="none",e.append(...t)}if(e.length){const t=s.appendChild(document.createElement("calcite-dropdown-group"));t.selectionMode=i?.selectionMode??"none",t.append(...e)}return s}get menuItems(){return[...this.defaultMenuItems,...this.customMenuItems]}get menuIsOpen(){return this._menuIsOpen}get menuIsVisible(){return!(!1===this.visibleElements?.columnMenus||!this.menuItems.length)}get tableHasInvalidPendingEdits(){return this.store.hasInvalidPendingEdits}get tableHasPendingEdits(){return this.store.hasPendingEdits}get tableTimeZone(){return this.store.timeZone}closeMenu(){this.menu.open=!1}createSortElement(){const{effectiveLabel:e,direction:t,fieldName:i,initialSortPriority:n}=this,o=document.createElement("vaadin-grid-sorter");return o.classList.add(c.sorter),o.setAttribute("path",i),o.setAttribute("title",this.labelTooltipText||e),o.textContent=e,t&&o.setAttribute("direction",t),null!=n&&(o._initialOrder=n),o.addEventListener("direction-changed",()=>{this.direction!==o.direction&&this._set("direction",o.direction)}),o}createCalciteAction(e){const t=document.createElement("calcite-action"),{alignment:i,className:n,disabled:o,icon:s,label:l,scale:r,slot:a,text:c,textEnabled:d,onclick:p}=e;return t.alignment=i??"center",t.className=n??"",t.disabled=!!o,s&&(t.icon=s),t.label=l??"",t.scale=r??"s",t.slot=a??"",t.text=t.title=c??"",t.textEnabled=!!d,t.onclick=p??null,t}createCalciteButton(e){const t=document.createElement("calcite-button"),{alignment:i,appearance:n,className:o,disabled:s,iconEnd:l,iconFlipRtl:r,kind:a,loading:c,onclick:d,scale:p,textContent:u,title:h,width:m}=e;return t.alignment=i??"center",t.className=o??"",t.scale=p??"s",t.appearance=n??"transparent",t.disabled=!!s,l&&(t.iconEnd=l),r&&(t.iconFlipRtl=r),t.kind=a??"brand",t.loading=!!c,t.textContent=u??"",h&&(t.title=h),t.width=m??"auto",t.onclick=d??null,t}createCalciteDropdownItem(e){const t=document.createElement("calcite-dropdown-item"),{disabled:i,hidden:n,iconClass:o,iconFlipRtl:s,iconStart:l,textContent:r,onclick:a,selected:d}=e,p=r??"";if(o&&!l){const e=document.createElement("span"),i=document.createElement("span");i.classList.add(c.headerMenuIcon,o),e.textContent=e.title=p,e.insertBefore(i,e.firstChild),t.appendChild(e)}else l&&(t.iconStart=l),t.textContent=t.title=p;return t.disabled=!!i,t.hidden="function"==typeof n?n():!!n,t.selected=!!d,s&&(t.iconFlipRtl=s),a&&(t.addEventListener("calciteDropdownItemSelect",a),t.onkeydown=this._stopPropagationOnSelect),t}createCalciteIcon(e){const{effectiveLabel:t}=this,{icon:i,scale:n,textLabel:o}=e,s=document.createElement("calcite-icon"),l=o??t;return s.icon=i,s.scale=n??"s",s.textLabel=l,s.title=l,s}createHeaderContent(){const{effectiveDescription:e,effectiveLabel:t,iconNode:i}=this,n=document.createElement("div");if(n.classList.add(c.headerContent),i&&n.appendChild(i),!this._headerRequiresTextContainer)return n;const o=n.appendChild(document.createElement("div"));return this.effectiveSortable?o.appendChild(this.sortElement):""!==t&&o.appendChild(this._createHeaderTextElement({label:t,cssClass:c.headerLabel,title:this.labelTooltipText})),null!=e&&!1!==this.visibleElements?.columnDescriptions&&o.appendChild(this._createHeaderTextElement({label:e,cssClass:c.headerDescription})),this.menuIsVisible&&n.appendChild(this.menu),n}getCellValue(e){return e?.item.feature.attributes?.[this.fieldName]}getVirtualRowIndex(e){const t=this.grid?.getRowContainingNode(e);return t?.parentElement?[...t.parentElement.children].indexOf(t):-1}itemHasInvalidPendingEdits(e,t){return this.store.itemHasInvalidPendingEdits(e,t)}itemHasPendingEdits(e,t){return this.store.itemHasPendingEdits(e,t)}openMenu(){this.menuIsVisible&&(this.menu.open=!0,u(this.menuItems[0]))}removeCellContent(e){if(e?.firstChild)try{for(;e?.firstChild;)e.removeChild(e.firstChild)}catch(t){}}sanitizeContent(e){return s.sanitize(e)}sanitizeLabel(e){return null==e||""===e?"":l.sanitize(e.toString()).replaceAll(h," ")}sort(){this.effectiveSortable&&this.sortElement?.click()}_stopPropagationOnSelect(e){"Enter"!==e.key&&" "!==e.key||e.stopPropagation()}_createHeaderTextElement({cssClass:e,label:t,title:i}){const n=document.createElement("span");n.classList.add(e);const o=n.appendChild(document.createElement("span"));return o.textContent=t,o.setAttribute("title",i||t),n}};e([r()],m.prototype,"_headerRequiresTextContainer",null),e([r()],m.prototype,"_menuIsOpen",void 0),e([r()],m.prototype,"autoWidth",void 0),e([r()],m.prototype,"cellValueFormatFunction",void 0),e([r()],m.prototype,"customMenuItems",null),e([r()],m.prototype,"defaultMenuItems",null),e([r()],m.prototype,"description",void 0),e([r()],m.prototype,"direction",void 0),e([r()],m.prototype,"effectiveDescription",null),e([r()],m.prototype,"effectiveLabel",null),e([r()],m.prototype,"effectiveSortable",null),e([r()],m.prototype,"effectiveVisible",null),e([r({constructOnly:!0})],m.prototype,"fieldName",void 0),e([r()],m.prototype,"flexGrow",void 0),e([r()],m.prototype,"footerRenderFunction",void 0),e([r()],m.prototype,"forceVisible",void 0),e([r()],m.prototype,"formatFunction",void 0),e([r()],m.prototype,"frozen",void 0),e([r()],m.prototype,"frozenToEnd",void 0),e([r()],m.prototype,"grid",void 0),e([r()],m.prototype,"headerRenderFunction",void 0),e([r()],m.prototype,"hidden",void 0),e([r()],m.prototype,"icon",void 0),e([r()],m.prototype,"iconNode",null),e([r()],m.prototype,"iconText",void 0),e([r({constructOnly:!0})],m.prototype,"initialSortPriority",void 0),e([r()],m.prototype,"invalid",null),e([r()],m.prototype,"label",void 0),e([r()],m.prototype,"labelTooltipText",void 0),e([r()],m.prototype,"menu",null),e([r()],m.prototype,"menuItems",null),e([r()],m.prototype,"menuConfig",void 0),e([r()],m.prototype,"menuIsOpen",null),e([r()],m.prototype,"menuIsVisible",null),e([r()],m.prototype,"messages",void 0),e([r()],m.prototype,"messagesCommon",void 0),e([r()],m.prototype,"messagesURIUtils",void 0),e([r()],m.prototype,"renderFunction",void 0),e([r()],m.prototype,"resizable",void 0),e([r()],m.prototype,"sortable",void 0),e([r({readOnly:!0})],m.prototype,"sortElement",void 0),e([r()],m.prototype,"store",void 0),e([r()],m.prototype,"tableHasInvalidPendingEdits",null),e([r()],m.prototype,"tableHasPendingEdits",null),e([r()],m.prototype,"tableTimeZone",null),e([r()],m.prototype,"textAlign",void 0),e([r()],m.prototype,"textWrap",void 0),e([r()],m.prototype,"timeZone",void 0),e([r()],m.prototype,"topLayerDisabled",void 0),e([r()],m.prototype,"visibleElements",void 0),e([r()],m.prototype,"width",void 0),m=e([a("esri.widgets.FeatureTable.Grid.Column")],m);const f=m;export{f as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import"@vaadin/grid/vaadin-grid.js";import"@vaadin/grid/vaadin-grid-column-group.js";import"@vaadin/grid/vaadin-grid-selection-column.js";import"@vaadin/grid/vaadin-grid-sorter.js";import{isSome as t}from"../../../core/arrayUtils.js";import{on as i}from"../../../core/events.js";import{assertIsSome as r}from"../../../core/maybe.js";import{on as o,sync as n,watch as l}from"../../../core/reactiveUtils.js";import{renderingSanitizer as s}from"../../../core/sanitizerUtils.js";import{property as d,subclass as a}from"../../../core/accessorSupport/decorators.js";import h from"../../Widget.js";import u from"./GridViewModel.js";import{globalCss as g}from"../../support/globalCss.js";import{messageBundle as m,tsx as c}from"../../support/widget.js";const p="esri-grid",_={base:p,content:`${p}__content`,grid:`${p}__grid`,noDataMessage:`${p}__no-data-message`},f={sort:["Enter"," "]};let v=class extends h{constructor(e,t){super(e,t),this._columnElements=[],this._grid=null,this._temporaryHighlightId=null,this.itemIdPath="objectId",this.messages=null,this.selectionColumnEnabled=!0,this.viewModel=new u,this._onSelectedItemsChange=this._onSelectedItemsChange.bind(this)}initialize(){this.addHandles([this.columns.on("before-changes",()=>this.renderNow()),this.columns.on("change",()=>this.onColumnChange()),o(()=>this.highlightIds,"before-add",({target:e})=>{!this.effectiveMultipleSelectionEnabled&&e.length&&e.removeAll()},n),this.rowHighlightIds.on("change",()=>this.generateCellPartNames()),l(()=>this.effectiveSize,()=>this._updateGridSize()),l(()=>[this.isEditing,this.store?.hasPendingEdits],()=>{this.generateCellPartNames(),this.requestContentUpdate()}),l(()=>this.store?.state,(e,t)=>{"ready"!==e||"loaded"!==t&&"error"!==t||this.refreshPageCache()}),o(()=>this._table,"scroll",()=>this.viewModel.closeColumnMenus()),i(window,"resize",()=>this._updateColumnBorderStyles()),o(()=>this._table,"scrollend",()=>{this.paginationEnabled||(this.pageIndex=this.getVirtualPageIndex()),this._updateColumnBorderStyles()}),l(()=>this.effectiveMultipleSelectionEnabled,e=>{!e&&this.highlightIds.length>1&&this.highlightIds.removeAll()},n)])}destroy(){this.resetColumns(),this.columns.destroyed||this.columns.destroy()}resetColumns(){this.columns.drain(e=>!e.destroyed&&e.destroy())}get _columnRendering(){return this.columnPerformanceModeEnabled?"lazy":"eager"}get _selectedItems(){const{highlightIds:e,store:t}=this;return e.toArray().map(e=>t?.getItemByObjectId(e)??{objectId:e})}get _gridIsDisabled(){return 0===this.viewModel.allVisibleColumns.length||this.hasInvalidColumnConfiguration}get _noDataMessage(){return s.sanitize(this.noDataMessage)}get _table(){return this._grid?.$?.table}get cellPartNameGenerator(){return this.viewModel.cellPartNameGenerator}set cellPartNameGenerator(e){this.viewModel.cellPartNameGenerator=e}get columns(){return this.viewModel.columns}set columns(e){this.viewModel.columns=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 dataProvider(){return this.viewModel.dataProvider}set dataProvider(e){this.viewModel.dataProvider=e}get editingEnabled(){return this.viewModel.editingEnabled}set editingEnabled(e){this.viewModel.editingEnabled=e}get effectiveMultipleSelectionEnabled(){return this.viewModel.effectiveMultipleSelectionEnabled}get effectiveSize(){return this.viewModel.effectiveSize}get groupColumns(){return this.viewModel.groupColumns}get hasInvalidColumnConfiguration(){return this.viewModel.hasInvalidColumnConfiguration}get highlightIds(){return this.viewModel.highlightIds}set highlightIds(e){this.viewModel.highlightIds=e}get temporaryHighlightId(){return this._temporaryHighlightId}get isEditing(){return this.viewModel.isEditing}get isReady(){return!!this._grid}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get multipleSelectionEnabled(){return this.viewModel.multipleSelectionEnabled}set multipleSelectionEnabled(e){this.viewModel.multipleSelectionEnabled=e}get multipleSelectionEnabledOverride(){return this.viewModel.multipleSelectionEnabledOverride}set multipleSelectionEnabledOverride(e){this.viewModel.multipleSelectionEnabledOverride=e}get multiSortEnabled(){return this.viewModel.multiSortEnabled}set multiSortEnabled(e){this.viewModel.multiSortEnabled=e}get noDataMessage(){return this.viewModel.noDataMessage}set noDataMessage(e){this.viewModel.noDataMessage=e}get pageIndex(){return this.viewModel.pageIndex}set pageIndex(e){this.viewModel.pageIndex=e}get multipleSortPriority(){return this.viewModel.multipleSortPriority}set multipleSortPriority(e){this.viewModel.multipleSortPriority=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 rowDetailsRenderer(){return this.viewModel.rowDetailsRenderer}set rowDetailsRenderer(e){this.viewModel.rowDetailsRenderer=e}get rowHighlightIds(){return this.viewModel.rowHighlightIds}set rowHighlightIds(e){this.viewModel.rowHighlightIds=e}get size(){return this.viewModel.size}get sortOrders(){return this._grid?._sorters?this._grid._sorters.filter(e=>!!e&&e.path).map(({direction:e,path:t})=>({direction:e,path:t})):[]}get store(){return this.viewModel.store}get state(){return this.viewModel.state}addSorter(e){this._grid?.__updateSorter(e,!1,!1),this.notifyChange("sortOrders")}getColumnProps(e,t){const{id:i}=this,{autoWidth:r,direction:o,fieldName:n,flexGrow:l,frozen:s,frozenToEnd:d,hidden:a,label:h,resizable:u,textAlign:g,width:m}=e,c=`${i}_${n}_${t}`,{renderFunction:p,footerRenderFunction:_,headerRenderFunction:f}=e,v=_?(e,t)=>_({root:e,column:t}):void 0,y=f?(e,t)=>f({root:e,column:t}):void 0,C=p?(e,t,i)=>p({root:e,column:t,rowData:i}):void 0;let b="";return e.direction&&(b+=" direction"),e.invalid&&(b+=" invalid"),{footerRenderer:v,headerRenderer:y,renderer:C,autoWidth:r,direction:o,flexGrow:l,frozen:s,frozenToEnd:d,headerPartName:b,key:c,resizable:u,bind:this,"data-fieldName":n,header:h,hidden:this.hasInvalidColumnConfiguration||a,path:n,"text-align":g,width:"number"==typeof m?`${m}px`:m,afterCreate:this._afterColumnCreate,afterRemoved:this._afterColumnRemoved}}clearSelection(){this._clearSelection(),this.scheduleRender()}clearSort(){let e=!1;if(this._grid){if(this._grid._sorters?.length&&(this._grid._sorters.forEach(e=>{e._order=null,e.direction=null}),e=!0),this.columns.length){this.columns.some(e=>!!e.direction)&&(this.columns.forEach(e=>e.direction=null),e=!0)}e&&(this.notifyChange("sortOrders"),this.scheduleRender())}}findColumn(e){return this.viewModel.findColumn(e)}generateCellPartNames(){this._grid?.generateCellPartNames()}getFirstVisibleRowIndex(){return this._grid?._firstVisibleIndex||0}getVirtualPageIndex(){return Math.floor(this.getFirstVisibleRowIndex()/this.pageSize)}getLastVisibleRowIndex(){return this._grid?._lastVisibleIndex||0}getVisibleItemsCount(){return this._grid?._visibleItemsCount||0}getRowContainingNode(e){try{return this._grid?._getRowContainingNode(e)}catch{return null}}getSlotElementByName(e){return this._grid?.shadowRoot?.querySelector(`slot[name='${e}']`)??null}hasSorter(e){return this._grid?._sorters?.includes(e)||!1}hideColumn(e){this.viewModel.hideColumn(e)}recalculateColumnWidths(){this._grid?.recalculateColumnWidths()}async reset(){this._clearSelection(),this.store?.reset(),this.scrollToTop()}refreshPageCache(){this._grid?.clearCache(),this._temporaryHighlightId=null}requestContentUpdate(){this._grid?.requestContentUpdate(),this._temporaryHighlightId=null}selectRows(e){const{itemIdPath:t}=this,i=e?.filter(e=>!this.highlightIds.includes(e[t])),r=i.map(e=>e[t]);r.length&&(this.effectiveMultipleSelectionEnabled||(this.highlightIds.removeAll(),r.splice(1)),this.highlightIds.addMany(r))}deselectRows(e){const{itemIdPath:t}=this,i=e?.map(e=>e[t])||[];i.length&&this.highlightIds.removeMany(i)}showColumn(e){this.viewModel.showColumn(e)}sort({path:e,direction:t}){this.viewModel.sortColumn(e,t),this.notifyChange("sortOrders")}scrollToIndex(e){0!==this.size&&(this._grid?.isConnected&&this._grid?.scrollToIndex(e),this._temporaryHighlightId=null)}scrollToTop(){this.scrollToIndex(0)}scrollToBottom(){this.scrollToIndex(1/0)}scrollLeft(e){const{_table:t}=this;t&&(t.scrollLeft=e)}toggleColumnVisibility(e){this.viewModel.toggleColumnVisibility(e)}onColumnChange(){this._columnElements.forEach(e=>this._applyRenderersToColumnElement(e)),this.requestContentUpdate()}render(){return c("div",{bind:this,class:this.classes(_.base,g.widget)},c("div",{bind:this,class:_.content},this._renderGrid()))}_renderGrid(){return c("vaadin-grid",{afterCreate:this._afterGridCreate,afterUpdate:this._afterGridUpdate,bind:this,cellPartNameGenerator:this.cellPartNameGenerator,class:_.grid,columnRendering:this._columnRendering,columnReorderingAllowed:this.columnReorderingEnabled,dataProvider:this.dataProvider,disabled:this._gridIsDisabled,id:`${this.id}_grid`,itemIdPath:this.itemIdPath,multiSort:this.multiSortEnabled,multiSortPriority:this.multipleSortPriority,pageSize:this.pageSize,ref:"grid",rowDetailsRenderer:this.rowDetailsRenderer,selectedItems:this._selectedItems,size:this.effectiveSize},this._renderAllColumns(),this._renderEmptyState())}_renderAllColumns(){return"disabled"!==this.state&&this.columns.length?[this._renderSelectionColumn(),this._renderColumns()]:null}_renderSelectionColumn(){return c("vaadin-grid-selection-column",{_selectAllHidden:!0,autoWidth:!1,bind:this,dragSelect:!0,frozen:!0,hidden:this.hasInvalidColumnConfiguration||!this.selectionColumnEnabled,selectAll:!1,sortable:!1,textAlign:"center"})}_renderColumns(){return this.columns.toArray().map((e,t)=>"columns"in e?this._renderGroupColumn(e,t):this._renderColumn(e,t)).filter(t)}_renderColumn(e,t){const i=this.getColumnProps(e,t);if(!i.hidden)return c("vaadin-grid-column",{...i})}_renderGroupColumn(e,t){const i=this.getColumnProps(e,t);if(i.hidden||!e.columns)return null;const r=e.columns.filter(({hidden:e})=>!e);return r.length?c("vaadin-grid-column-group",{...i},r.map(e=>c("vaadin-grid-column",{...this.getColumnProps(e,t)}))):null}_renderEmptyState(){const e=this.viewModel;if("loaded"===e.state&&!e.isQueryingOrSyncing)return c("div",{class:_.noDataMessage,slot:"empty-state"},this._noDataMessage??this.messages.noDataFound)}_afterGridCreate(e){const t=this._grid=e;customElements.whenDefined("vaadin-grid").then(()=>{this._addGridEventListeners()}),t.__updateSorter=(e,i,r)=>{const o=t._sorters,n=!o.includes(e),{multiSort:l,multiSortOnShiftClick:s,multiSortPriority:d}=t,a=o.filter(t=>t!==e),h=l&&(!s||!r)||s&&i;e._order=null,e.direction?h?null!=e._initialOrder?(n?o[e._initialOrder]=e:o.splice(e._initialOrder,0,e),e._initialOrder=null):"append"===d&&n?t._sorters=[...a,e]:"prepend"===d&&(t._sorters=[e,...a]):(e.direction||s)&&(t._sorters=e.direction?[e]:[],a.forEach(e=>{e._order=null,e.direction=null})):n||(t._sorters=[...a])},t.__removeSorters=e=>{if(0===e.length)return;const i=new Set(e.filter(e=>!e.direction));t._sorters=t._sorters.filter(e=>!i.has(e)),t.__applySorters()}}_afterGridUpdate(e){this._grid||(this._grid=e)}_afterColumnCreate(e){this._columnElements.push(e)}_afterColumnRemoved(e){const t=this._columnElements.indexOf(e,0);t>-1&&this._columnElements.splice(t,1)}_updateGridSize(){this._grid&&(this._grid.size=this.effectiveSize,this.scheduleRender())}_addGridEventListeners(){const e=this._grid;r(e),this.addHandles([i(e,["click","dblclick","keydown","pointerover","pointerout"],e=>this._onGridInteraction(e)),i(e,["pointerover","pointerout","cell-focus"],e=>this._onTransientGridInteraction(e)),i(e,"selected-items-changed",this._onSelectedItemsChange),i(e,"sorter-changed",()=>{this.notifyChange("sortOrders"),this._updateColumnBorderStyles()}),i(e,"column-resize",e=>{const t=e.detail.resizedColumn,i=t.getAttribute("data-fieldName"),r=this.findColumn(i);r?.set({width:t.width}),this._updateColumnBorderStyles()}),i(e,"column-reorder",()=>this._onColumnOrderChange())])}_onGridInteraction(e){const t=this._grid;if(r(t),("pointerover"===e.type||"pointerout"===e.type)&&e.relatedTarget!==t){const{target:t,relatedTarget:i}=e;if(!this._isGridCellContentNode(t)||!this._isGridCellContentNode(i))return}let i=null;try{i=t.getEventContext(e)}catch(a){}if(!i)return;const{column:o,index:n,item:l,section:s}=i;if(!s)return;if("header"===s&&"keydown"===e.type&&o?.path){const t=e.key;f.sort.includes(t)&&this.findColumn(o.path)?.sort()}const d=`cell-${e.type}`;this.emit(d,{type:d,context:i,index:n,item:l,native:e,path:o?.path??void 0})}_onTransientGridInteraction(e){if("pointerout"===e.type)return void(this._temporaryHighlightId=null);const t=this._grid;if(t)try{const{item:i}=t.getEventContext(e);this._temporaryHighlightId=i?.objectId}catch{this._temporaryHighlightId=null}}_isGridCellContentNode(e){return!!(e&&e instanceof HTMLElement&&"vaadin-grid-cell-content"===e.localName)}_onColumnOrderChange(){const e=this._grid;r(e);const t=e._getColumnsInOrder(0),i=[],o=(this.viewModel.groupColumns.length?e._getColumnsInOrder(1):t).map(e=>e.getAttribute("data-fieldName"));t?.forEach(e=>{const t=e.getAttribute("data-fieldName");if(null!=t){const e=this.findColumn(t);i.push(t),e&&"columns"in e&&e.columns?.length&&e.columns.sort((e,t)=>o.indexOf(e.fieldName)>o.indexOf(t.fieldName)?1:-1)}}),this.columns.sort((e,t)=>i.indexOf(e.fieldName)>i.indexOf(t.fieldName)?1:-1),this.notifyChange("sortOrders"),this.emit("column-reorder",{type:"column-reorder"})}_clearSelection(){this.highlightIds.removeAll(),this._temporaryHighlightId=null}_onSelectedItemsChange(e){const{highlightIds:t,itemIdPath:i}=this,r=e.detail.value.map(e=>e[i]),o=r.filter(e=>!t.includes(e));if(!this.effectiveMultipleSelectionEnabled&&o.length&&t.length)t.removeAll(),t.add(o[0]);else{const e=t.filter(e=>!r.includes(e));t.removeMany(e),t.addMany(o)}}_applyRenderersToColumnElement(e){const t=e?.path,i=null!=t?this.findColumn(t):void 0;if(i)try{const{renderFunction:t,footerRenderFunction:r,headerRenderFunction:o}=i;t&&"renderer"in e&&(e.renderer=(e,i,r)=>t({root:e,column:i,rowData:r})),r&&(e.footerRenderer=(e,t)=>r({root:e,column:t})),o&&(e.headerRenderer=(e,t)=>o({root:e,column:t}))}catch(r){}}_updateColumnBorderStyles(){try{this._grid?._updateFirstAndLastColumn()}catch(e){}}};e([d()],v.prototype,"_columnElements",void 0),e([d()],v.prototype,"_columnRendering",null),e([d()],v.prototype,"_selectedItems",null),e([d()],v.prototype,"_grid",void 0),e([d()],v.prototype,"_gridIsDisabled",null),e([d()],v.prototype,"_noDataMessage",null),e([d()],v.prototype,"_table",null),e([d()],v.prototype,"_temporaryHighlightId",void 0),e([d()],v.prototype,"cellPartNameGenerator",null),e([d()],v.prototype,"columns",null),e([d()],v.prototype,"columnPerformanceModeEnabled",null),e([d()],v.prototype,"columnReorderingEnabled",null),e([d()],v.prototype,"dataProvider",null),e([d()],v.prototype,"editingEnabled",null),e([d()],v.prototype,"effectiveMultipleSelectionEnabled",null),e([d()],v.prototype,"effectiveSize",null),e([d()],v.prototype,"groupColumns",null),e([d()],v.prototype,"hasInvalidColumnConfiguration",null),e([d()],v.prototype,"highlightIds",null),e([d()],v.prototype,"temporaryHighlightId",null),e([d()],v.prototype,"isEditing",null),e([d()],v.prototype,"isReady",null),e([d()],v.prototype,"itemIdPath",void 0),e([d()],v.prototype,"label",null),e([d(),m("esri/widgets/FeatureTable/t9n/FeatureTable")],v.prototype,"messages",void 0),e([d()],v.prototype,"multipleSelectionEnabled",null),e([d()],v.prototype,"multipleSelectionEnabledOverride",null),e([d()],v.prototype,"multiSortEnabled",null),e([d()],v.prototype,"noDataMessage",null),e([d()],v.prototype,"pageIndex",null),e([d()],v.prototype,"multipleSortPriority",null),e([d()],v.prototype,"pageSize",null),e([d()],v.prototype,"paginationEnabled",null),e([d()],v.prototype,"rowDetailsRenderer",null),e([d()],v.prototype,"rowHighlightIds",null),e([d()],v.prototype,"selectionColumnEnabled",void 0),e([d()],v.prototype,"size",null),e([d({readOnly:!0})],v.prototype,"sortOrders",null),e([d()],v.prototype,"store",null),e([d()],v.prototype,"state",null),e([d()],v.prototype,"viewModel",void 0),v=e([a("esri.widgets.FeatureTable.Grid.Grid")],v);const y=v;export{y as default};
2
+ import{__decorate as e}from"tslib";import"@vaadin/grid/vaadin-grid.js";import"@vaadin/grid/vaadin-grid-column-group.js";import"@vaadin/grid/vaadin-grid-selection-column.js";import"@vaadin/grid/vaadin-grid-sorter.js";import{isSome as t}from"../../../core/arrayUtils.js";import{on as i}from"../../../core/events.js";import{assertIsSome as r}from"../../../core/maybe.js";import{on as o,sync as n,watch as l}from"../../../core/reactiveUtils.js";import{renderingSanitizer as s}from"../../../core/sanitizerUtils.js";import{property as d,subclass as a}from"../../../core/accessorSupport/decorators.js";import h from"../../Widget.js";import u from"./GridViewModel.js";import{globalCss as g}from"../../support/globalCss.js";import{messageBundle as c,tsx as m}from"../../support/widget.js";const p="esri-grid",_={base:p,content:`${p}__content`,grid:`${p}__grid`,noDataMessage:`${p}__no-data-message`},f={sort:["Enter"," "]};let v=class extends h{constructor(e,t){super(e,t),this._columnElements=[],this._grid=null,this._temporaryHighlightId=null,this.itemIdPath="objectId",this.messages=null,this.selectionColumnEnabled=!0,this.viewModel=new u,this._onSelectedItemsChange=this._onSelectedItemsChange.bind(this)}initialize(){this.addHandles([this.columns.on("before-changes",()=>this.renderNow()),this.columns.on("change",()=>this.onColumnChange()),o(()=>this.highlightIds,"before-add",({target:e})=>{!this.effectiveMultipleSelectionEnabled&&e.length&&e.removeAll()},n),this.rowHighlightIds.on("change",()=>this.generateCellPartNames()),l(()=>this.effectiveSize,()=>this._updateGridSize()),l(()=>[this.isEditing,this.store?.hasPendingEdits],()=>{this.generateCellPartNames(),this.requestContentUpdate()}),l(()=>this.store?.state,(e,t)=>{"ready"!==e||"loaded"!==t&&"error"!==t||this.refreshPageCache()}),o(()=>this._table,"scroll",()=>this.viewModel.closeColumnMenus()),i(window,"resize",()=>this._updateColumnBorderStyles()),o(()=>this._table,"scrollend",()=>{this.paginationEnabled||(this.pageIndex=this.getVirtualPageIndex()),this._updateColumnBorderStyles()}),l(()=>this.effectiveMultipleSelectionEnabled,e=>{!e&&this.highlightIds.length>1&&this.highlightIds.removeAll()},n)])}destroy(){this.resetColumns(),this.columns.destroyed||this.columns.destroy()}resetColumns(){this.columns.drain(e=>!e.destroyed&&e.destroy())}get _columnRendering(){return this.columnPerformanceModeEnabled?"lazy":"eager"}get _selectedItems(){const{highlightIds:e,store:t}=this;return e.toArray().map(e=>t?.getItemByObjectId(e)??{objectId:e})}get _gridIsDisabled(){return 0===this.viewModel.allVisibleColumns.length||this.hasInvalidColumnConfiguration}get _noDataMessage(){return s.sanitize(this.noDataMessage)}get _table(){return this._grid?.$?.table}get cellPartNameGenerator(){return this.viewModel.cellPartNameGenerator}set cellPartNameGenerator(e){this.viewModel.cellPartNameGenerator=e}get columns(){return this.viewModel.columns}set columns(e){this.viewModel.columns=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 dataProvider(){return this.viewModel.dataProvider}set dataProvider(e){this.viewModel.dataProvider=e}get editingEnabled(){return this.viewModel.editingEnabled}set editingEnabled(e){this.viewModel.editingEnabled=e}get effectiveMultipleSelectionEnabled(){return this.viewModel.effectiveMultipleSelectionEnabled}get effectiveSize(){return this.viewModel.effectiveSize}get groupColumns(){return this.viewModel.groupColumns}get hasInvalidColumnConfiguration(){return this.viewModel.hasInvalidColumnConfiguration}get highlightIds(){return this.viewModel.highlightIds}set highlightIds(e){this.viewModel.highlightIds=e}get temporaryHighlightId(){return this._temporaryHighlightId}get isEditing(){return this.viewModel.isEditing}get isReady(){return!!this._grid}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get multipleSelectionEnabled(){return this.viewModel.multipleSelectionEnabled}set multipleSelectionEnabled(e){this.viewModel.multipleSelectionEnabled=e}get multipleSelectionEnabledOverride(){return this.viewModel.multipleSelectionEnabledOverride}set multipleSelectionEnabledOverride(e){this.viewModel.multipleSelectionEnabledOverride=e}get multiSortEnabled(){return this.viewModel.multiSortEnabled}set multiSortEnabled(e){this.viewModel.multiSortEnabled=e}get noDataMessage(){return this.viewModel.noDataMessage}set noDataMessage(e){this.viewModel.noDataMessage=e}get pageIndex(){return this.viewModel.pageIndex}set pageIndex(e){this.viewModel.pageIndex=e}get multipleSortPriority(){return this.viewModel.multipleSortPriority}set multipleSortPriority(e){this.viewModel.multipleSortPriority=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 rowDetailsRenderer(){return this.viewModel.rowDetailsRenderer}set rowDetailsRenderer(e){this.viewModel.rowDetailsRenderer=e}get rowHighlightIds(){return this.viewModel.rowHighlightIds}set rowHighlightIds(e){this.viewModel.rowHighlightIds=e}get size(){return this.viewModel.size}get sortOrders(){return this._grid?._sorters?this._grid._sorters.filter(e=>!!e&&e.path).map(({direction:e,path:t})=>({direction:e,path:t})):[]}get store(){return this.viewModel.store}get state(){return this.viewModel.state}addSorter(e){this._grid?.__updateSorter(e,!1,!1),this.notifyChange("sortOrders")}getColumnProps(e,t){const{id:i}=this,{autoWidth:r,direction:o,effectiveVisible:n,fieldName:l,flexGrow:s,frozen:d,frozenToEnd:a,label:h,resizable:u,textAlign:g,width:c}=e,m=`${i}_${l}_${t}`,{renderFunction:p,footerRenderFunction:_,headerRenderFunction:f}=e,v=_?(e,t)=>_({root:e,column:t}):void 0,y=f?(e,t)=>f({root:e,column:t}):void 0,C=p?(e,t,i)=>p({root:e,column:t,rowData:i}):void 0;let b="";return e.direction&&(b+=" direction"),e.invalid&&(b+=" invalid"),{footerRenderer:v,headerRenderer:y,renderer:C,autoWidth:r,direction:o,flexGrow:s,frozen:d,frozenToEnd:a,headerPartName:b,key:m,resizable:u,bind:this,"data-fieldName":l,header:h,hidden:this.hasInvalidColumnConfiguration||!n,path:l,"text-align":g,width:"number"==typeof c?`${c}px`:c,afterCreate:this._afterColumnCreate,afterRemoved:this._afterColumnRemoved}}clearSelection(){this._clearSelection(),this.scheduleRender()}clearSort(){let e=!1;if(this._grid){if(this._grid._sorters?.length&&(this._grid._sorters.forEach(e=>{e._order=null,e.direction=null}),e=!0),this.columns.length){this.columns.some(e=>!!e.direction)&&(this.columns.forEach(e=>e.direction=null),e=!0)}e&&(this.notifyChange("sortOrders"),this.scheduleRender())}}findColumn(e){return this.viewModel.findColumn(e)}generateCellPartNames(){this._grid?.generateCellPartNames()}getFirstVisibleRowIndex(){return this._grid?._firstVisibleIndex||0}getVirtualPageIndex(){return Math.floor(this.getFirstVisibleRowIndex()/this.pageSize)}getLastVisibleRowIndex(){return this._grid?._lastVisibleIndex||0}getVisibleItemsCount(){return this._grid?._visibleItemsCount||0}getRowContainingNode(e){try{return this._grid?._getRowContainingNode(e)}catch{return null}}getSlotElementByName(e){return this._grid?.shadowRoot?.querySelector(`slot[name='${e}']`)??null}hasSorter(e){return this._grid?._sorters?.includes(e)||!1}hideColumn(e){this.viewModel.hideColumn(e)}recalculateColumnWidths(){this._grid?.recalculateColumnWidths()}async reset(){this._clearSelection(),this.store?.reset(),this.scrollToTop()}refreshPageCache(){this._grid?.clearCache(),this._temporaryHighlightId=null}requestContentUpdate(){this._grid?.requestContentUpdate(),this._temporaryHighlightId=null}selectRows(e){const{itemIdPath:t}=this,i=e?.filter(e=>!this.highlightIds.includes(e[t])),r=i.map(e=>e[t]);r.length&&(this.effectiveMultipleSelectionEnabled||(this.highlightIds.removeAll(),r.splice(1)),this.highlightIds.addMany(r))}deselectRows(e){const{itemIdPath:t}=this,i=e?.map(e=>e[t])||[];i.length&&this.highlightIds.removeMany(i)}showColumn(e){this.viewModel.showColumn(e)}sort({path:e,direction:t}){this.viewModel.sortColumn(e,t),this.notifyChange("sortOrders")}scrollToIndex(e){0!==this.size&&(this._grid?.isConnected&&this._grid?.scrollToIndex(e),this._temporaryHighlightId=null)}scrollToTop(){this.scrollToIndex(0)}scrollToBottom(){this.scrollToIndex(1/0)}scrollLeft(e){const{_table:t}=this;t&&(t.scrollLeft=e)}toggleColumnVisibility(e){this.viewModel.toggleColumnVisibility(e)}onColumnChange(){this._columnElements.forEach(e=>this._applyRenderersToColumnElement(e)),this.requestContentUpdate()}render(){return m("div",{bind:this,class:this.classes(_.base,g.widget)},m("div",{bind:this,class:_.content},this._renderGrid()))}_renderGrid(){return m("vaadin-grid",{afterCreate:this._afterGridCreate,afterUpdate:this._afterGridUpdate,bind:this,cellPartNameGenerator:this.cellPartNameGenerator,class:_.grid,columnRendering:this._columnRendering,columnReorderingAllowed:this.columnReorderingEnabled,dataProvider:this.dataProvider,disabled:this._gridIsDisabled,id:`${this.id}_grid`,itemIdPath:this.itemIdPath,multiSort:this.multiSortEnabled,multiSortPriority:this.multipleSortPriority,pageSize:this.pageSize,ref:"grid",rowDetailsRenderer:this.rowDetailsRenderer,selectedItems:this._selectedItems,size:this.effectiveSize},this._renderAllColumns(),this._renderEmptyState())}_renderAllColumns(){return"disabled"!==this.state&&this.columns.length?[this._renderSelectionColumn(),this._renderColumns()]:null}_renderSelectionColumn(){return m("vaadin-grid-selection-column",{_selectAllHidden:!0,autoWidth:!1,bind:this,dragSelect:!0,frozen:!0,hidden:this.hasInvalidColumnConfiguration||!this.selectionColumnEnabled,selectAll:!1,sortable:!1,textAlign:"center"})}_renderColumns(){return this.columns.toArray().map((e,t)=>"columns"in e?this._renderGroupColumn(e,t):this._renderColumn(e,t)).filter(t)}_renderColumn(e,t){const i=this.getColumnProps(e,t);if(!i.hidden)return m("vaadin-grid-column",{...i})}_renderGroupColumn(e,t){const i=this.getColumnProps(e,t);if(i.hidden||!e.columns)return null;const r=e.columns.filter(({effectiveVisible:e})=>e);return r.length?m("vaadin-grid-column-group",{...i},r.map(e=>m("vaadin-grid-column",{...this.getColumnProps(e,t)}))):null}_renderEmptyState(){const e=this.viewModel;if("loaded"===e.state&&!e.isQueryingOrSyncing)return m("div",{class:_.noDataMessage,slot:"empty-state"},this._noDataMessage??this.messages.noDataFound)}_afterGridCreate(e){const t=this._grid=e;customElements.whenDefined("vaadin-grid").then(()=>{this._addGridEventListeners()}),t.__updateSorter=(e,i,r)=>{const o=t._sorters,n=!o.includes(e),{multiSort:l,multiSortOnShiftClick:s,multiSortPriority:d}=t,a=o.filter(t=>t!==e),h=l&&(!s||!r)||s&&i;e._order=null,e.direction?h?null!=e._initialOrder?(n?o[e._initialOrder]=e:o.splice(e._initialOrder,0,e),e._initialOrder=null):"append"===d&&n?t._sorters=[...a,e]:"prepend"===d&&(t._sorters=[e,...a]):(e.direction||s)&&(t._sorters=e.direction?[e]:[],a.forEach(e=>{e._order=null,e.direction=null})):n||(t._sorters=[...a])},t.__removeSorters=e=>{if(0===e.length)return;const i=new Set(e.filter(e=>!e.direction));t._sorters=t._sorters.filter(e=>!i.has(e)),t.__applySorters()}}_afterGridUpdate(e){this._grid||(this._grid=e)}_afterColumnCreate(e){this._columnElements.push(e)}_afterColumnRemoved(e){const t=this._columnElements.indexOf(e,0);t>-1&&this._columnElements.splice(t,1)}_updateGridSize(){this._grid&&(this._grid.size=this.effectiveSize,this.scheduleRender())}_addGridEventListeners(){const e=this._grid;r(e),this.addHandles([i(e,["click","dblclick","keydown","pointerover","pointerout"],e=>this._onGridInteraction(e)),i(e,["pointerover","pointerout","cell-focus"],e=>this._onTransientGridInteraction(e)),i(e,"selected-items-changed",this._onSelectedItemsChange),i(e,"sorter-changed",()=>{this.notifyChange("sortOrders"),this._updateColumnBorderStyles()}),i(e,"column-resize",e=>{const t=e.detail.resizedColumn,i=t.getAttribute("data-fieldName"),r=this.findColumn(i);r?.set({width:t.width}),this._updateColumnBorderStyles()}),i(e,"column-reorder",()=>this._onColumnOrderChange())])}_onGridInteraction(e){const t=this._grid;if(r(t),("pointerover"===e.type||"pointerout"===e.type)&&e.relatedTarget!==t){const{target:t,relatedTarget:i}=e;if(!this._isGridCellContentNode(t)||!this._isGridCellContentNode(i))return}let i=null;try{i=t.getEventContext(e)}catch(a){}if(!i)return;const{column:o,index:n,item:l,section:s}=i;if(!s)return;if("header"===s&&"keydown"===e.type&&o?.path){const t=e.key;f.sort.includes(t)&&this.findColumn(o.path)?.sort()}const d=`cell-${e.type}`;this.emit(d,{type:d,context:i,index:n,item:l,native:e,path:o?.path??void 0})}_onTransientGridInteraction(e){if("pointerout"===e.type)return void(this._temporaryHighlightId=null);const t=this._grid;if(t)try{const{item:i}=t.getEventContext(e);this._temporaryHighlightId=i?.objectId}catch{this._temporaryHighlightId=null}}_isGridCellContentNode(e){return!!(e&&e instanceof HTMLElement&&"vaadin-grid-cell-content"===e.localName)}_onColumnOrderChange(){const e=this._grid;r(e);const t=e._getColumnsInOrder(0),i=[],o=(this.viewModel.groupColumns.length?e._getColumnsInOrder(1):t).map(e=>e.getAttribute("data-fieldName"));t?.forEach(e=>{const t=e.getAttribute("data-fieldName");if(null!=t){const e=this.findColumn(t);i.push(t),e&&"columns"in e&&e.columns?.length&&e.columns.sort((e,t)=>o.indexOf(e.fieldName)>o.indexOf(t.fieldName)?1:-1)}}),this.columns.sort((e,t)=>i.indexOf(e.fieldName)>i.indexOf(t.fieldName)?1:-1),this.notifyChange("sortOrders"),this.emit("column-reorder",{type:"column-reorder"})}_clearSelection(){this.highlightIds.removeAll(),this._temporaryHighlightId=null}_onSelectedItemsChange(e){const{highlightIds:t,itemIdPath:i}=this,r=e.detail.value.map(e=>e[i]),o=r.filter(e=>!t.includes(e));if(!this.effectiveMultipleSelectionEnabled&&o.length&&t.length)t.removeAll(),t.add(o[0]);else{const e=t.filter(e=>!r.includes(e));t.removeMany(e),t.addMany(o)}}_applyRenderersToColumnElement(e){const t=e?.path,i=null!=t?this.findColumn(t):void 0;if(i)try{const{renderFunction:t,footerRenderFunction:r,headerRenderFunction:o}=i;t&&"renderer"in e&&(e.renderer=(e,i,r)=>t({root:e,column:i,rowData:r})),r&&(e.footerRenderer=(e,t)=>r({root:e,column:t})),o&&(e.headerRenderer=(e,t)=>o({root:e,column:t}))}catch(r){}}_updateColumnBorderStyles(){try{this._grid?._updateFirstAndLastColumn()}catch(e){}}};e([d()],v.prototype,"_columnElements",void 0),e([d()],v.prototype,"_columnRendering",null),e([d()],v.prototype,"_selectedItems",null),e([d()],v.prototype,"_grid",void 0),e([d()],v.prototype,"_gridIsDisabled",null),e([d()],v.prototype,"_noDataMessage",null),e([d()],v.prototype,"_table",null),e([d()],v.prototype,"_temporaryHighlightId",void 0),e([d()],v.prototype,"cellPartNameGenerator",null),e([d()],v.prototype,"columns",null),e([d()],v.prototype,"columnPerformanceModeEnabled",null),e([d()],v.prototype,"columnReorderingEnabled",null),e([d()],v.prototype,"dataProvider",null),e([d()],v.prototype,"editingEnabled",null),e([d()],v.prototype,"effectiveMultipleSelectionEnabled",null),e([d()],v.prototype,"effectiveSize",null),e([d()],v.prototype,"groupColumns",null),e([d()],v.prototype,"hasInvalidColumnConfiguration",null),e([d()],v.prototype,"highlightIds",null),e([d()],v.prototype,"temporaryHighlightId",null),e([d()],v.prototype,"isEditing",null),e([d()],v.prototype,"isReady",null),e([d()],v.prototype,"itemIdPath",void 0),e([d()],v.prototype,"label",null),e([d(),c("esri/widgets/FeatureTable/t9n/FeatureTable")],v.prototype,"messages",void 0),e([d()],v.prototype,"multipleSelectionEnabled",null),e([d()],v.prototype,"multipleSelectionEnabledOverride",null),e([d()],v.prototype,"multiSortEnabled",null),e([d()],v.prototype,"noDataMessage",null),e([d()],v.prototype,"pageIndex",null),e([d()],v.prototype,"multipleSortPriority",null),e([d()],v.prototype,"pageSize",null),e([d()],v.prototype,"paginationEnabled",null),e([d()],v.prototype,"rowDetailsRenderer",null),e([d()],v.prototype,"rowHighlightIds",null),e([d()],v.prototype,"selectionColumnEnabled",void 0),e([d()],v.prototype,"size",null),e([d({readOnly:!0})],v.prototype,"sortOrders",null),e([d()],v.prototype,"store",null),e([d()],v.prototype,"state",null),e([d()],v.prototype,"viewModel",void 0),v=e([a("esri.widgets.FeatureTable.Grid.Grid")],v);const y=v;export{y as default};