@arcgis/core 4.23.0-next.20220118 → 4.23.0-next.20220126

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 (359) hide show
  1. package/Graphic.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/00c5bb5eecb0e89266df.js +1 -0
  4. package/assets/esri/core/workers/chunks/021a37e2b191298e80b7.js +1 -0
  5. package/assets/esri/core/workers/chunks/1370c92c40fd6271553c.js +1 -0
  6. package/assets/esri/core/workers/chunks/199670a3a564ebe3bd79.js +1 -0
  7. package/assets/esri/core/workers/chunks/1e4d37c2b9dc83d20a11.js +1 -0
  8. package/assets/esri/core/workers/chunks/1fbcc8424452d0256bd6.js +1 -0
  9. package/assets/esri/core/workers/chunks/{7c9d2638693d5f798b23.js → 23b15e7c2f96d260e16c.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{b2ae5fc4f787ea568b88.js → 2460f3b6ada6ae900dec.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{99f0d896c17dd09cd285.js → 2629adf79e7fd9f25f07.js} +1 -1
  12. package/assets/esri/core/workers/chunks/2792ca40f1e92849247c.js +1 -0
  13. package/assets/esri/core/workers/chunks/2a96f1bba9ce6883e5e0.js +1 -0
  14. package/assets/esri/core/workers/chunks/2e899ef5881b4ec6fa55.js +1 -0
  15. package/assets/esri/core/workers/chunks/3231ee3e090bb4cac3fc.js +1 -0
  16. package/assets/esri/core/workers/chunks/{0c3e3a5baf54bd5e210c.js → 36e250278b5622ccf068.js} +1 -1
  17. package/assets/esri/core/workers/chunks/395ba088d4864588ff66.js +1 -0
  18. package/assets/esri/core/workers/chunks/3cc77692b2eee27b9c9e.js +1 -0
  19. package/assets/esri/core/workers/chunks/3f343f792fd9f44d6f25.js +1 -0
  20. package/assets/esri/core/workers/chunks/{8a250ec51097f16feb66.js → 40a1e713f63ec77110c0.js} +1 -1
  21. package/assets/esri/core/workers/chunks/422537fc3df707bb62c9.js +1 -0
  22. package/assets/esri/core/workers/chunks/{ba6fdaed6c315dc13981.js → 434b16731c6a81f868ef.js} +1 -1
  23. package/assets/esri/core/workers/chunks/4385a268c2a64281d1c1.js +1 -0
  24. package/assets/esri/core/workers/chunks/{44b01d42d4ec72913229.js → 438f0b5ae5c53ae4f06a.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{4d539878bfbd7c549e60.js → 46b4bb66a54bbd8e2e57.js} +1 -1
  26. package/assets/esri/core/workers/chunks/4c76146014dc15143ba3.js +1 -0
  27. package/assets/esri/core/workers/chunks/5a4a5585ec8027079f32.js +1 -0
  28. package/assets/esri/core/workers/chunks/5d991b74d958005c26c4.js +1 -0
  29. package/assets/esri/core/workers/chunks/5dfe1f8d520025e2118b.js +1 -0
  30. package/assets/esri/core/workers/chunks/601e697dc7414bda128a.js +1 -0
  31. package/assets/esri/core/workers/chunks/663ad15b86936eb06b69.js +1 -0
  32. package/assets/esri/core/workers/chunks/68a59ce98177d8513337.js +1 -0
  33. package/assets/esri/core/workers/chunks/{9cdaba126ac7fa5f33f0.js → 6cd5e4380d29b9a3c344.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{a7b1b75643ed31489495.js → 6f50a9647f026a8d4729.js} +1 -1
  35. package/assets/esri/core/workers/chunks/{47395d225229d237f0ac.js → 7bc5cc5dbf1b7b70ddac.js} +1 -1
  36. package/assets/esri/core/workers/chunks/7d661129a0d8c466eeec.js +1 -0
  37. package/assets/esri/core/workers/chunks/{64276aacaafa4c8a15bd.js → 7dcf52d3db3903c8eb9f.js} +1 -1
  38. package/assets/esri/core/workers/chunks/8070972c0efb78523b68.js +1 -0
  39. package/assets/esri/core/workers/chunks/8fa0a14165d43ffe87a5.js +1 -0
  40. package/assets/esri/core/workers/chunks/94515fb3ef38067eeadd.js +1 -0
  41. package/assets/esri/core/workers/chunks/94b8dbf859df71858d1c.js +1 -0
  42. package/assets/esri/core/workers/chunks/97a28641b3b2fd31bea2.js +1 -0
  43. package/assets/esri/core/workers/chunks/{d1454155ee1b8a421cbb.js → 97ec9eef0048760fa260.js} +1 -1
  44. package/assets/esri/core/workers/chunks/98986e6601b0366376b4.js +1 -0
  45. package/assets/esri/core/workers/chunks/9cdcf9309d6feda70185.js +1 -0
  46. package/assets/esri/core/workers/chunks/a78757b9c7e8cbea08fa.js +1 -0
  47. package/assets/esri/core/workers/chunks/aa04b90b82bf70caaae4.js +1 -0
  48. package/assets/esri/core/workers/chunks/{b10fcbe1393c812fc219.js → aa861b8eae6c85f3dad4.js} +1 -1
  49. package/assets/esri/core/workers/chunks/aace7e1fef256bb961c9.js +1 -0
  50. package/assets/esri/core/workers/chunks/{ed0297fc61014e848c18.js → af5694b4d278cf1db2d9.js} +1 -1
  51. package/assets/esri/core/workers/chunks/afbb4f802ca5774f0326.js +1 -0
  52. package/assets/esri/core/workers/chunks/b0b036ad3ad3cd956747.js +1 -0
  53. package/assets/esri/core/workers/chunks/b2c5f92e3d7606297ca9.js +1 -0
  54. package/assets/esri/core/workers/chunks/b2d2de935487257c568b.js +1 -0
  55. package/assets/esri/core/workers/chunks/b2ebe4f6d100e15b512d.js +1 -0
  56. package/assets/esri/core/workers/chunks/b8316c6469a543029bc6.js +1 -0
  57. package/assets/esri/core/workers/chunks/{4b69129c0557852d9b3d.js → ba5eb394f098968c22d2.js} +1 -1
  58. package/assets/esri/core/workers/chunks/bf0a65b4be31959f921d.js +1 -0
  59. package/assets/esri/core/workers/chunks/bf6dda4a2af14c4b7716.js +1 -0
  60. package/assets/esri/core/workers/chunks/c890c7fca27170e3341f.js +1 -0
  61. package/assets/esri/core/workers/chunks/{573dc3064e84ca86844d.js → c959e0d1cf7dce0421b9.js} +1 -1
  62. package/assets/esri/core/workers/chunks/c976785f2391c77d8a30.js +1 -0
  63. package/assets/esri/core/workers/chunks/{1fd48459afb58a6cf14f.js → ca2f5faa01d99c21ec14.js} +1 -1
  64. package/assets/esri/core/workers/chunks/{7aa543a97f055cddea99.js → cc146c57bbdac8029fd8.js} +1 -1
  65. package/assets/esri/core/workers/chunks/{d39b7983b68d6e5b404d.js → cdbc005eebec1503b99d.js} +1 -1
  66. package/assets/esri/core/workers/chunks/{7e596478507466953e65.js → cef4af64860ebbfc1c47.js} +1 -1
  67. package/assets/esri/core/workers/chunks/d72488db62fcf39447b6.js +1 -0
  68. package/assets/esri/core/workers/chunks/de6cff7b6cbbf99b20d1.js +981 -0
  69. package/assets/esri/core/workers/chunks/e4b84ca8ddfd48dd79b1.js +1 -0
  70. package/assets/esri/core/workers/chunks/e4e2036373166c1d5cf5.js +1 -0
  71. package/assets/esri/core/workers/chunks/e4f93c55eaefab4192b5.js +1 -0
  72. package/assets/esri/core/workers/chunks/e6165e17fbb07bfc40a1.js +1 -0
  73. package/assets/esri/core/workers/chunks/e9e5196b44b6923be1a3.js +1 -0
  74. package/assets/esri/core/workers/chunks/{f678293de9a6d8f5b5db.js → ec89466f76d0ba22525e.js} +1 -1
  75. package/assets/esri/core/workers/chunks/ee45618c45806ab654cb.js +1 -0
  76. package/assets/esri/core/workers/chunks/f4baa5ea2e42b1317941.js +1 -0
  77. package/assets/esri/core/workers/chunks/f760a3e030b0f358a92a.js +1 -0
  78. package/assets/esri/core/workers/chunks/face43cf5abcd2f5bd9d.js +1 -0
  79. package/assets/esri/libs/vxl/vxlLayer.wasm +0 -0
  80. package/assets/esri/themes/base/_mixins.scss +4 -1
  81. package/assets/esri/themes/base/icons/style.scss +11 -2
  82. package/assets/esri/themes/base/widgets/_BasemapLayerList.scss +13 -10
  83. package/assets/esri/themes/base/widgets/_CoordinateConversion.scss +4 -2
  84. package/assets/esri/themes/base/widgets/_Directions.scss +5 -3
  85. package/assets/esri/themes/base/widgets/_Editor.scss +5 -2
  86. package/assets/esri/themes/base/widgets/_ElevationProfile.scss +6 -4
  87. package/assets/esri/themes/base/widgets/_FeatureTable.scss +6 -0
  88. package/assets/esri/themes/base/widgets/_ItemList.scss +1 -1
  89. package/assets/esri/themes/base/widgets/_LayerList.scss +13 -9
  90. package/assets/esri/themes/base/widgets/_Popup.scss +4 -2
  91. package/assets/esri/themes/base/widgets/_Print.scss +24 -11
  92. package/assets/esri/themes/base/widgets/_Search.scss +4 -2
  93. package/assets/esri/themes/base/widgets/_TableList.scss +9 -7
  94. package/assets/esri/themes/base/widgets/_Weather.scss +12 -0
  95. package/assets/esri/themes/base/widgets/_Widget.scss +18 -9
  96. package/assets/esri/themes/dark/main.css +1 -1
  97. package/assets/esri/themes/dark-blue/main.css +1 -1
  98. package/assets/esri/themes/dark-green/main.css +1 -1
  99. package/assets/esri/themes/dark-purple/main.css +1 -1
  100. package/assets/esri/themes/dark-red/main.css +1 -1
  101. package/assets/esri/themes/light/main.css +1 -1
  102. package/assets/esri/themes/light/view.css +1 -1
  103. package/assets/esri/themes/light-blue/main.css +1 -1
  104. package/assets/esri/themes/light-green/main.css +1 -1
  105. package/assets/esri/themes/light-purple/main.css +1 -1
  106. package/assets/esri/themes/light-red/main.css +1 -1
  107. package/assets/esri/widgets/Weather/t9n/Weather.json +1 -1
  108. package/assets/esri/widgets/Weather/t9n/Weather_en.json +1 -1
  109. package/chunks/CloudsComposition.glsl.js +4 -4
  110. package/chunks/ComponentShader.glsl.js +19 -19
  111. package/chunks/DefaultMaterial.glsl.js +2 -2
  112. package/chunks/Terrain.glsl.js +11 -11
  113. package/chunks/WaterSurface.glsl.js +21 -21
  114. package/chunks/pe.js +1 -1
  115. package/chunks/vec3.js +1 -1
  116. package/chunks/vxlLayer.js +1 -1
  117. package/core/accessorSupport/ensureType.js +1 -1
  118. package/core/accessorSupport/get.js +1 -1
  119. package/core/accessorSupport/read.js +1 -1
  120. package/core/accessorSupport/set.js +1 -1
  121. package/core/accessorSupport/write.js +1 -1
  122. package/core/has.js +1 -1
  123. package/core/libs/gl-matrix-2/math/vec3.js +1 -1
  124. package/core/typedArrayUtil.js +1 -1
  125. package/core/workers/workerFactory.js +1 -1
  126. package/geometry/pe.js +1 -1
  127. package/geometry/support/axisAngleDegrees.js +1 -1
  128. package/geometry/support/heightModelInfoUtils.js +1 -1
  129. package/interfaces.d.ts +315 -78
  130. package/layers/RouteLayer.js +1 -1
  131. package/layers/VoxelLayer.js +1 -1
  132. package/layers/VoxelWasmPerScene.js +1 -1
  133. package/layers/mixins/OperationalLayer.js +1 -1
  134. package/layers/support/RasterWorker.js +1 -1
  135. package/layers/support/rasterDatasets/BaseRaster.js +1 -1
  136. package/layers/support/rasterFunctions/rasterProjectionHelper.js +1 -1
  137. package/libs/vxl/enums.js +1 -1
  138. package/package.json +2 -2
  139. package/popup/content/AttachmentsContent.js +1 -1
  140. package/popup/content/support/mediaInfoTypes.js +1 -1
  141. package/portal/schemas/buildingSceneLayerItem.js +1 -1
  142. package/portal/schemas/definitions.js +1 -1
  143. package/portal/schemas/integratedMeshLayerItem.js +1 -1
  144. package/portal/schemas/pointCloudLayerItem.js +1 -1
  145. package/portal/schemas/sceneLayerItem.js +1 -1
  146. package/portal/schemas/webScene.js +1 -1
  147. package/rasterRenderers.js +1 -1
  148. package/rest/find.js +1 -1
  149. package/rest/geometryService/generalize.js +1 -1
  150. package/rest/geometryService/lengths.js +1 -1
  151. package/rest/geometryService/offset.js +1 -1
  152. package/rest/geometryService/relation.js +1 -1
  153. package/rest/geometryService/trimExtend.js +1 -1
  154. package/rest/identify.js +1 -1
  155. package/{tasks → rest}/operations/find.js +0 -0
  156. package/{tasks → rest}/operations/generalize.js +0 -0
  157. package/rest/operations/identify.js +5 -0
  158. package/{tasks → rest}/operations/lengths.js +0 -0
  159. package/{tasks → rest}/operations/offset.js +0 -0
  160. package/{tasks → rest}/operations/relation.js +0 -0
  161. package/{tasks → rest}/operations/trimExtend.js +0 -0
  162. package/{tasks → rest}/operations/urlUtils.js +0 -0
  163. package/rest/print.js +1 -1
  164. package/rest/query/operations/query.js +1 -1
  165. package/rest/query/operations/queryAttachments.js +1 -1
  166. package/rest/query/operations/queryRelatedRecords.js +1 -1
  167. package/rest/query/operations/queryTopFeatures.js +1 -1
  168. package/rest/route/utils.js +1 -1
  169. package/rest/support/NetworkServiceDescription.js +1 -1
  170. package/rest/support/RouteInfo.js +1 -1
  171. package/rest/support/RouteParameters.js +1 -1
  172. package/rest/support/RouteSettings.js +5 -0
  173. package/rest/support/Stop.js +1 -1
  174. package/rest/support/networkEnums.js +1 -1
  175. package/support/revision.js +1 -1
  176. package/symbols/Font.js +1 -1
  177. package/symbols/LabelSymbol3D.js +1 -1
  178. package/symbols/PointSymbol3D.js +1 -1
  179. package/symbols/TextSymbol.js +1 -1
  180. package/symbols/TextSymbol3DLayer.js +1 -1
  181. package/symbols/cim/CIMSymbolHelper.js +1 -1
  182. package/symbols/cim/CIMSymbolRasterizer.js +1 -1
  183. package/symbols/cim/cimAnalyzer.js +1 -1
  184. package/symbols/cim/placements/PlacementAlongLineSameSize.js +1 -1
  185. package/symbols/support/Symbol3DVerticalOffset.js +1 -1
  186. package/symbols/support/cimSymbolUtils.js +1 -1
  187. package/symbols/support/previewCIMSymbol.js +1 -1
  188. package/symbols/support/previewSymbol2D.js +1 -1
  189. package/symbols/support/previewSymbol3D.js +1 -1
  190. package/symbols/support/previewWebStyleSymbol.js +1 -1
  191. package/symbols/support/svgUtils.js +1 -1
  192. package/symbols/support/textUtils.js +5 -0
  193. package/symbols.js +1 -1
  194. package/views/2d/engine/vectorTiles/style/VectorTilesRequestManager.js +1 -1
  195. package/views/2d/engine/webgl/brushes/raster/BrushRasterBitmap.js +1 -1
  196. package/views/2d/engine/webgl/mesh/templates/WGLFillTemplate.js +1 -1
  197. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  198. package/views/2d/layers/features/sources/BaseFeatureSource.js +1 -1
  199. package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
  200. package/views/2d/support/engineHelpers.js +1 -1
  201. package/views/3d/environment/CloudsComposition.glsl.js +1 -1
  202. package/views/3d/environment/CloudsComposition.js +1 -1
  203. package/views/3d/environment/CloudsGenerator.js +1 -1
  204. package/views/3d/environment/EnvironmentRenderer.js +1 -1
  205. package/views/3d/environment/Fog.js +1 -1
  206. package/views/3d/environment/SceneViewEnvironmentManager.js +1 -1
  207. package/views/3d/environment/weather.js +1 -1
  208. package/views/3d/interactive/editingTools/transformGraphic/ScaleRotateMeshAdapter.js +1 -1
  209. package/views/3d/layers/FeatureLayerViewBase3D.js +1 -1
  210. package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
  211. package/views/3d/layers/GraphicsLayerView3D.js +1 -1
  212. package/views/3d/layers/GraphicsView3D.js +1 -1
  213. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  214. package/views/3d/layers/VoxelLayerView3D.js +1 -1
  215. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  216. package/views/3d/layers/graphics/Graphics3DDrapedGraphicLayer.js +1 -1
  217. package/views/3d/layers/graphics/Graphics3DElevationAlignment.js +1 -1
  218. package/views/3d/layers/graphics/Graphics3DFeatureProcessor.js +5 -0
  219. package/views/3d/layers/graphics/Graphics3DFrustumVisibility.js +1 -1
  220. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  221. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  222. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  223. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  224. package/views/3d/layers/graphics/Graphics3DScaleVisibility.js +1 -1
  225. package/views/3d/layers/graphics/Graphics3DSymbolCreationContext.js +1 -1
  226. package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
  227. package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
  228. package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
  229. package/views/3d/layers/graphics/{Graphics3DGraphicLikeLayerView.js → GraphicsProcessor.js} +1 -1
  230. package/views/3d/layers/graphics/QueryEngine.js +1 -1
  231. package/views/3d/support/pointsOfInterest/Focus.js +1 -1
  232. package/views/3d/terrain/OverlayRenderer.js +1 -1
  233. package/views/3d/webgl-engine/core/shaderLibrary/Transform.glsl.js +7 -1
  234. package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js +28 -24
  235. package/views/3d/webgl-engine/core/shaderLibrary/shading/Water.glsl.js +21 -13
  236. package/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js +2 -2
  237. package/views/3d/webgl-engine/core/shaderLibrary/util/CloudsParallaxShading.glsl.js +12 -14
  238. package/views/3d/webgl-engine/lib/OffscreenRendering.js +1 -1
  239. package/views/3d/webgl-engine/lib/RenderGeometry.js +1 -1
  240. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  241. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  242. package/views/3d/webgl-engine/lib/TextRenderParameters.js +1 -1
  243. package/views/3d/webgl-engine/lib/TextRenderer.js +1 -1
  244. package/views/3d/webgl-engine/lib/intersectorUtilsConversions.js +1 -1
  245. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  246. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  247. package/views/3d/webgl-engine/materials/WaterTechnique.js +1 -1
  248. package/views/3d/webgl-engine/parts/Model.js +1 -1
  249. package/views/3d/webgl-engine/parts/ScreenshotManager.js +1 -1
  250. package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
  251. package/views/3d/webgl-engine/shaders/RealisticTreeTechnique.js +1 -1
  252. package/views/3d/webgl-engine/shaders/WaterSurface.glsl.js +1 -1
  253. package/views/SceneView.js +1 -1
  254. package/views/interactive/dragEventPipeline.js +1 -1
  255. package/views/interactive/editGeometry/operations/OffsetEdgeVertex.js +1 -1
  256. package/views/support/DefaultsFromMap.js +1 -1
  257. package/views/webgl/ContextState.js +1 -1
  258. package/views/webgl/FramebufferObject.js +1 -1
  259. package/views/webgl/Renderbuffer.js +1 -1
  260. package/views/webgl/RenderingContext.js +1 -1
  261. package/views/webgl/Texture.js +1 -1
  262. package/views/webgl/Util.js +1 -1
  263. package/views/webgl/enums.js +1 -1
  264. package/views/webgl/rasterUtils.js +1 -1
  265. package/views/webgl/testFloatBufferBlend.js +1 -1
  266. package/widgets/Attachments.js +1 -1
  267. package/widgets/Editor/workflowUtils.js +1 -1
  268. package/widgets/Feature/FeatureExpression.js +1 -1
  269. package/widgets/Feature/FeatureMedia/FeatureMediaViewModel.js +1 -1
  270. package/widgets/Feature/FeatureMedia.js +1 -1
  271. package/widgets/Feature/FeatureViewModel.js +1 -1
  272. package/widgets/FeatureForm/InputField.js +1 -1
  273. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  274. package/widgets/FeatureTable/Grid/Grid.js +1 -1
  275. package/widgets/FeatureTable.js +1 -1
  276. package/widgets/LayerList/LayerListViewModel.js +1 -1
  277. package/widgets/Popup/PopupViewModel.js +1 -1
  278. package/widgets/Popup/actionUtils.js +1 -1
  279. package/widgets/Slice/SliceViewModel.js +1 -1
  280. package/widgets/Slider/SliderViewModel.js +1 -1
  281. package/widgets/Slider.js +1 -1
  282. package/widgets/Weather/WeatherViewModel.js +1 -1
  283. package/widgets/Weather/css.js +1 -1
  284. package/widgets/Weather.js +1 -1
  285. package/widgets/support/InteractiveAnalysisViewModel.js +1 -1
  286. package/widgets/support/InteractiveToolViewModel.js +1 -1
  287. package/widgets/support/geolocationUtils.js +1 -1
  288. package/assets/components/assets/calcite-icon/checkSquareF16.json +0 -1
  289. package/assets/components/assets/calcite-icon/checkSquareF24.json +0 -1
  290. package/assets/components/assets/calcite-icon/checkSquareF32.json +0 -1
  291. package/assets/components/assets/calcite-icon/lineSolid4.json +0 -1
  292. package/assets/components/assets/calcite-icon/squareF16.json +0 -1
  293. package/assets/components/assets/calcite-icon/squareF24.json +0 -1
  294. package/assets/components/assets/calcite-icon/squareF32.json +0 -1
  295. package/assets/components/assets/calcite-icon/xHexagon16.json +0 -1
  296. package/assets/components/assets/calcite-icon/xHexagon24.json +0 -1
  297. package/assets/components/assets/calcite-icon/xHexagon32.json +0 -1
  298. package/assets/components/assets/calcite-icon/xHexagonF16.json +0 -1
  299. package/assets/components/assets/calcite-icon/xHexagonF24.json +0 -1
  300. package/assets/components/assets/calcite-icon/xHexagonF32.json +0 -1
  301. package/assets/components/assets/calcite-icon/xOctagonF16.json +0 -1
  302. package/assets/components/assets/calcite-icon/xOctagonF24.json +0 -1
  303. package/assets/components/assets/calcite-icon/xOctagonF32.json +0 -1
  304. package/assets/esri/core/workers/chunks/01ef8de7f76a8c61b464.js +0 -1
  305. package/assets/esri/core/workers/chunks/09da224052976e290828.js +0 -1
  306. package/assets/esri/core/workers/chunks/0f254c3e91e8fee55f28.js +0 -1
  307. package/assets/esri/core/workers/chunks/20411bb8e04703962ce6.js +0 -1
  308. package/assets/esri/core/workers/chunks/21a77eed1a4ef5b0ff08.js +0 -1
  309. package/assets/esri/core/workers/chunks/23745a5ab47c840dc452.js +0 -1
  310. package/assets/esri/core/workers/chunks/2416f8bf8bbd2ec786ab.js +0 -1
  311. package/assets/esri/core/workers/chunks/2d947080a27db6ce0d75.js +0 -1
  312. package/assets/esri/core/workers/chunks/2e445a8735ea2adb641a.js +0 -1
  313. package/assets/esri/core/workers/chunks/32f8c4af7e70ebdcb19e.js +0 -1
  314. package/assets/esri/core/workers/chunks/3564e14010953def6df9.js +0 -1
  315. package/assets/esri/core/workers/chunks/390d9021169e65c10eb8.js +0 -1
  316. package/assets/esri/core/workers/chunks/3a9740dccda6a733313c.js +0 -1
  317. package/assets/esri/core/workers/chunks/403c7d64f12f00330d88.js +0 -1
  318. package/assets/esri/core/workers/chunks/4409d77c9734de4e82a7.js +0 -1
  319. package/assets/esri/core/workers/chunks/4c301ca9c493b96df746.js +0 -1
  320. package/assets/esri/core/workers/chunks/60371c0f750cde87656d.js +0 -1
  321. package/assets/esri/core/workers/chunks/615aa2d3ecafe30c80c0.js +0 -1
  322. package/assets/esri/core/workers/chunks/631c5b514bb73782c570.js +0 -1
  323. package/assets/esri/core/workers/chunks/6c1e92ff4c732dfda756.js +0 -1
  324. package/assets/esri/core/workers/chunks/722a10c65456844d72b9.js +0 -1
  325. package/assets/esri/core/workers/chunks/75d53b28afe732c459b2.js +0 -1
  326. package/assets/esri/core/workers/chunks/85b34d91cf07567d6873.js +0 -1
  327. package/assets/esri/core/workers/chunks/8967288145f8fbd20e7d.js +0 -1
  328. package/assets/esri/core/workers/chunks/89de05207744149fb58b.js +0 -1
  329. package/assets/esri/core/workers/chunks/8fdd5bca3716816d359b.js +0 -1
  330. package/assets/esri/core/workers/chunks/987182b3a578fc7de251.js +0 -1
  331. package/assets/esri/core/workers/chunks/99a777693e4539f0b03b.js +0 -1
  332. package/assets/esri/core/workers/chunks/9d9dffc8884d66a258e4.js +0 -1
  333. package/assets/esri/core/workers/chunks/a28b53c61bddefb6616e.js +0 -1
  334. package/assets/esri/core/workers/chunks/a6ff3db3493543df81bc.js +0 -1
  335. package/assets/esri/core/workers/chunks/a8c13529367c037cdd94.js +0 -1
  336. package/assets/esri/core/workers/chunks/a960074644c3722be71e.js +0 -1
  337. package/assets/esri/core/workers/chunks/ac8dca61ade28c542ae2.js +0 -1
  338. package/assets/esri/core/workers/chunks/b99e69302ea701fff0ea.js +0 -971
  339. package/assets/esri/core/workers/chunks/b9de831ac379cf1d2969.js +0 -1
  340. package/assets/esri/core/workers/chunks/bc790b2f964144d10abe.js +0 -1
  341. package/assets/esri/core/workers/chunks/be2b7cce79fd41627931.js +0 -1
  342. package/assets/esri/core/workers/chunks/c13dfdd548dcb1bdb294.js +0 -1
  343. package/assets/esri/core/workers/chunks/c3eca92d02958732e141.js +0 -1
  344. package/assets/esri/core/workers/chunks/c6bd943fe8fd13bb4806.js +0 -1
  345. package/assets/esri/core/workers/chunks/c6f94b92e866b881d9b9.js +0 -1
  346. package/assets/esri/core/workers/chunks/cb68db7169b9dfd1c3ff.js +0 -1
  347. package/assets/esri/core/workers/chunks/cc96608b2802fbfe7a08.js +0 -1
  348. package/assets/esri/core/workers/chunks/cd02fe27eb07681cb366.js +0 -1
  349. package/assets/esri/core/workers/chunks/d52108864136c5a8a618.js +0 -1
  350. package/assets/esri/core/workers/chunks/da1c2873bdbc0956dca0.js +0 -1
  351. package/assets/esri/core/workers/chunks/dd433c160f7a0c120b82.js +0 -1
  352. package/assets/esri/core/workers/chunks/de03439ca2c9782bf325.js +0 -1
  353. package/assets/esri/core/workers/chunks/e2d68bcd2f99a65387bf.js +0 -1
  354. package/assets/esri/core/workers/chunks/ef8b75b92cf549e0507e.js +0 -1
  355. package/assets/esri/core/workers/chunks/f7fc4c993536e62f7f3e.js +0 -1
  356. package/assets/esri/core/workers/chunks/fd3e5d823dc7917f4b8f.js +0 -1
  357. package/symbols/support/constants.js +0 -5
  358. package/tasks/operations/identify.js +0 -5
  359. package/views/3d/layers/graphics/Graphics3DFeatureLikeLayerView.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../chunks/tslib.es6.js";import e from"../core/Error.js";import{formatFileSize as s}from"../core/unitFormatUtils.js";import{on as i,init as a}from"../core/watchUtils.js";import{aliasOf as n}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import"../core/has.js";import{cast as r}from"../core/accessorSupport/decorators/cast.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import m from"./Widget.js";import d from"./Attachments/AttachmentsViewModel.js";import{isSupportedImage as c,getIconPath as h}from"./Attachments/support/attachmentUtils.js";import{storeNode as u,discardNode as p,isRTL as b}from"./support/widgetUtils.js";import{messageBundle as g}from"./support/decorators/messageBundle.js";import"../core/Logger.js";import{tsx as _}from"./support/jsxFactory.js";const f={addButton:!0,addSubmitButton:!0,cancelAddButton:!0,cancelUpdateButton:!0,deleteButton:!0,errorMessage:!0,progressBar:!0,updateButton:!0},v={base:"esri-attachments",loaderContainer:"esri-attachments__loader-container",loader:"esri-attachments__loader",fadeIn:"esri-attachments--fade-in",container:"esri-attachments__container",containerList:"esri-attachments__container--list",containerPreview:"esri-attachments__container--preview",actions:"esri-attachments__actions",deleteButton:"esri-attachments__delete-button",addAttachmentButton:"esri-attachments__add-attachment-button",errorMessage:"esri-attachments__error-message",items:"esri-attachments__items",item:"esri-attachments__item",itemButton:"esri-attachments__item-button",itemMask:"esri-attachments__item-mask",itemMaskIcon:"esri-attachments__item-mask--icon",itemImage:"esri-attachments__image",itemImageResizable:"esri-attachments__image--resizable",itemLabel:"esri-attachments__label",itemFilename:"esri-attachments__filename",itemChevronIcon:"esri-attachments__item-chevron-icon",itemLink:"esri-attachments__item-link",itemLinkOverlay:"esri-attachments__item-link-overlay",itemLinkOverlayIcon:"esri-attachments__item-link-overlay-icon",itemEditIcon:"esri-attachments__item-edit-icon",itemAddIcon:"esri-attachments__item-add-icon",itemAddButton:"esri-attachments__item-add-button",formNode:"esri-attachments__form-node",fileFieldset:"esri-attachments__file-fieldset",fileLabel:"esri-attachments__file-label",fileName:"esri-attachments__file-name",fileInput:"esri-attachments__file-input",metadata:"esri-attachments__metadata",metadataFieldset:"esri-attachments__metadata-fieldset",progressBar:"esri-attachments__progress-bar",esriWidget:"esri-widget",esriButton:"esri-button",buttonDisabled:"esri-button--disabled",esriButtonSecondary:"esri-button--secondary",esriButtonTertiary:"esri-button--tertiary",esriButtonThird:"esri-button--third",esriButtonSmall:"esri-button--small",esriButtonHalf:"esri-button--half",empty:"esri-widget__content--empty",iconExternalLink:"esri-icon-link-external",iconEdit:"esri-icon-edit",iconRight:"esri-icon-right",iconLeft:"esri-icon-left",iconPlus:"esri-icon-plus"},y=window.CSS;let B=class extends m{constructor(t,e){super(t,e),this.abilities=null,this.displayType="auto",this.graphic=null,this.label=void 0,this.messages=null,this.messagesUnits=null,this.selectedFile=null,this.submitting=!1,this.viewModel=new d,this.visibleElements={...f},this._supportsImageOrientation=y&&y.supports&&y.supports("image-orientation","from-image"),this._addAttachmentForm=null,this._updateAttachmentForm=null}initialize(){this.own(i(this,"viewModel.attachmentInfos","change",(()=>this.scheduleRender())),a(this,"viewModel.mode",(()=>this._modeChanged())))}get effectiveDisplayType(){return"auto"===this.displayType?this.viewModel.supportsResizeAttachments?"preview":"list":this.displayType}castVisibleElements(t){return{...f,...t}}addAttachment(){const{_addAttachmentForm:t,viewModel:s}=this;return this._set("submitting",!0),this._set("error",null),s.addAttachment(t).then((t=>(this._set("submitting",!1),this._set("error",null),s.mode="view",t))).catch((t=>{throw this._set("submitting",!1),this._set("error",new e("attachments:add-attachment",this.messages.addErrorMessage,t)),t}))}deleteAttachment(t){const{viewModel:s}=this;return this._set("submitting",!0),this._set("error",null),s.deleteAttachment(t).then((t=>(this._set("submitting",!1),this._set("error",null),s.mode="view",t))).catch((t=>{throw this._set("submitting",!1),this._set("error",new e("attachments:delete-attachment",this.messages.deleteErrorMessage,t)),t}))}updateAttachment(){const{viewModel:t}=this,{_updateAttachmentForm:s}=this;return this._set("submitting",!0),this._set("error",null),t.updateAttachment(s).then((e=>(this._set("submitting",!1),this._set("error",null),t.mode="view",e))).catch((t=>{throw this._set("submitting",!1),this._set("error",new e("attachments:update-attachment",this.messages.updateErrorMessage,t)),t}))}render(){const{submitting:t,viewModel:e}=this,{state:s}=e;return _("div",{class:this.classes(v.base,v.esriWidget)},t?this.renderProgressBar():null,"loading"===s?this.renderLoading():this.renderAttachments(),this.renderErrorMessage())}renderErrorMessage(){const{error:t,visibleElements:e}=this;return t&&e.errorMessage?_("div",{key:"error-message",class:v.errorMessage},t.message):null}renderAttachments(){const{mode:t,activeAttachmentInfo:e}=this.viewModel;return"add"===t?this.renderAddForm():"edit"===t?this.renderDetailsForm(e):this.renderAttachmentContainer()}renderLoading(){return _("div",{class:v.loaderContainer,key:"loader"},_("div",{class:v.loader}))}renderProgressBar(){return this.visibleElements.progressBar?_("div",{class:v.progressBar,key:"progress-bar"}):null}renderAddForm(){const{submitting:t,selectedFile:e}=this,s=t||!e,i=this.visibleElements.cancelAddButton?_("button",{type:"button",bind:this,disabled:t,onclick:this._cancelForm,class:this.classes(v.esriButton,v.esriButtonTertiary,v.esriButtonSmall,v.esriButtonHalf,t&&v.buttonDisabled)},this.messages.cancel):null,a=this.visibleElements.addSubmitButton?_("button",{type:"submit",disabled:s,class:this.classes(v.esriButton,v.esriButtonSecondary,v.esriButtonSmall,v.esriButtonHalf,{[v.buttonDisabled]:s})},this.messages.add):null,n=e?_("span",{key:"file-name",class:v.fileName},e.name):null,r=_("form",{bind:this,afterCreate:u,afterRemoved:p,"data-node-ref":"_addAttachmentForm",onsubmit:this._submitAddAttachment},_("fieldset",{class:v.fileFieldset},n,_("label",{class:this.classes(v.fileLabel,v.esriButton,v.esriButtonSecondary)},e?this.messages.changeFile:this.messages.selectFile,_("input",{class:v.fileInput,type:"file",name:"attachment",bind:this,onchange:this._handleFileInputChange}))),a,i);return _("div",{key:"add-form-container",class:v.formNode},r)}renderDetailsForm(t){const{visibleElements:e,viewModel:i,selectedFile:a,submitting:n}=this,{contentType:r,size:o,url:l}=t,{abilities:m}=i,d=n||!a,c=m.editing&&m.operations.delete&&e.deleteButton?_("button",{key:"delete-button",type:"button",disabled:n,bind:this,onclick:e=>this._submitDeleteAttachment(e,t),class:this.classes(v.esriButton,v.esriButtonSmall,v.esriButtonTertiary,v.deleteButton,{[v.buttonDisabled]:n})},this.messages.delete):null,h=m.editing&&m.operations.update&&e.updateButton?_("button",{disabled:d,key:"update-button",type:"submit",class:this.classes(v.esriButton,v.esriButtonSmall,v.esriButtonThird,{[v.buttonDisabled]:d})},this.messages.update):null,b=this.visibleElements.cancelUpdateButton?_("button",{disabled:n,key:"cancel-button",type:"button",bind:this,onclick:this._cancelForm,class:this.classes(v.esriButton,v.esriButtonSmall,v.esriButtonTertiary,v.esriButtonThird,{[v.buttonDisabled]:n})},this.messages.cancel):null,g=a?_("span",{key:"file-name",class:v.fileName},a.name):null,f=m.editing&&m.operations.update?_("fieldset",{key:"file",class:v.fileFieldset},g,_("label",{class:this.classes(v.fileLabel,v.esriButton,v.esriButtonSecondary)},this.messages.changeFile,_("input",{class:v.fileInput,type:"file",name:"attachment",bind:this,onchange:this._handleFileInputChange}))):null,y=_("fieldset",{key:"size",class:v.metadataFieldset},_("label",null,s(this.messagesUnits,o))),B=_("fieldset",{key:"content-type",class:v.metadataFieldset},_("label",null,r)),A=_("form",{bind:this,afterCreate:u,afterRemoved:p,"data-node-ref":"_updateAttachmentForm",onsubmit:this._submitUpdateAttachment},_("div",{class:v.metadata},y,B),f,_("div",{class:v.actions},c,b,h));return _("div",{key:"edit-form-container",class:v.formNode},_("a",{class:v.itemLink,href:l,rel:"noreferrer",target:"_blank"},this.renderImageMask({attachmentInfo:t,size:400}),_("div",{class:v.itemLinkOverlay},_("span",{class:v.itemLinkOverlayIcon},_("svg",{xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 32 32"},_("path",{d:"M28 13h1v16H3V3h16v1H4v24h24zm-5-9h4.293L15.646 15.638l.707.707L28 4.707V9h1V3h-6z"}),_("path",{fill:"none",d:"M0 0h32v32H0z"}))))),A)}renderImageMask({attachmentInfo:t,size:e}){const{supportsResizeAttachments:s}=this.viewModel,{contentType:i,name:a,url:n}=t,r=s&&c(i),o=this._getCSSTransform(t,r),l=o?{transform:o,"image-orientation":"none"}:{},m=-1===n.indexOf("?")?"?":"&",d=r?`${n}${m}w=${e}`:h(i),u={[v.itemMaskIcon]:!r},p={[v.itemImageResizable]:s};return _("div",{class:this.classes(u,v.itemMask)},_("img",{styles:l,alt:a,src:d,class:this.classes(p,v.itemImage)}))}renderAttachmentInfo({attachmentInfo:t,displayType:e}){const{viewModel:s}=this,{abilities:i}=s,{name:a,url:n}=t,r=this.renderImageMask({attachmentInfo:t,size:"list"===e?48:400}),o=i.editing?_("span",{"aria-hidden":"true",class:this.classes(v.itemChevronIcon,b(this.container)?v.iconLeft:v.iconRight)}):null,l=[r,_("label",{class:v.itemLabel},_("span",{class:v.itemFilename},a||this.messages.noTitle),o)],m=i.editing?_("button",{key:"details-button",bind:this,class:v.itemButton,title:this.messages.attachmentDetails,"aria-label":this.messages.attachmentDetails,"data-attachment-info-id":t.id,onclick:()=>this._startEditAttachment(t),type:"button"},l):_("a",{key:"details-link",class:v.itemButton,href:n,target:"_blank"},l);return _("li",{class:v.item,key:t},m)}renderAttachmentContainer(){const{effectiveDisplayType:t,viewModel:e,visibleElements:s}=this,{attachmentInfos:i,abilities:a}=e,n=i&&i.length,r={[v.containerList]:"preview"!==t,[v.containerPreview]:"preview"===t},o=a.editing&&a.operations.add&&s.addButton?_("button",{bind:this,onclick:()=>this._startAddAttachment(),class:this.classes(v.esriButton,v.esriButtonTertiary,v.addAttachmentButton),type:"button"},_("span",{"aria-hidden":"true",class:this.classes(v.itemAddIcon,v.iconPlus)}),this.messages.add):null,l=n?_("ul",{class:v.items},i.toArray().map((e=>this.renderAttachmentInfo({attachmentInfo:e,displayType:t})))):_("div",{class:v.empty},this.messages.noAttachments);return _("div",{key:"attachments-container",class:this.classes(v.container,r)},l,o)}_modeChanged(){this._set("error",null),this._set("selectedFile",null)}_handleFileInputChange(t){const e=t.target,s=e&&e.files&&e.files.item(0);this._set("selectedFile",s)}_submitDeleteAttachment(t,e){t.preventDefault(),this.deleteAttachment(e)}_submitAddAttachment(t){t.preventDefault(),this.addAttachment()}_submitUpdateAttachment(t){t.preventDefault(),this.updateAttachment()}_startEditAttachment(t){const{viewModel:e}=this;e.activeAttachmentInfo=t,e.mode="edit"}_startAddAttachment(){this.viewModel.mode="add"}_cancelForm(t){t.preventDefault(),this.viewModel.mode="view"}_getCSSTransform(t,e){const{orientationInfo:s}=t;return!this._supportsImageOrientation&&e&&s?[s.rotation?`rotate(${s.rotation}deg)`:"",s.mirrored?"scaleX(-1)":""].join(" "):""}};t([n("viewModel.abilities")],B.prototype,"abilities",void 0),t([o()],B.prototype,"displayType",void 0),t([o({readOnly:!0})],B.prototype,"effectiveDisplayType",null),t([n("viewModel.graphic")],B.prototype,"graphic",void 0),t([o({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],B.prototype,"label",void 0),t([o(),g("esri/widgets/Attachments/t9n/Attachments")],B.prototype,"messages",void 0),t([o(),g("esri/core/t9n/Units")],B.prototype,"messagesUnits",void 0),t([o({readOnly:!0})],B.prototype,"selectedFile",void 0),t([o({readOnly:!0})],B.prototype,"submitting",void 0),t([o({readOnly:!0})],B.prototype,"error",void 0),t([o({type:d})],B.prototype,"viewModel",void 0),t([o()],B.prototype,"visibleElements",void 0),t([r("visibleElements")],B.prototype,"castVisibleElements",null),B=t([l("esri.widgets.Attachments")],B);const A=B;export{A as default};
5
+ import{_ as t}from"../chunks/tslib.es6.js";import e from"../core/Error.js";import{formatFileSize as s}from"../core/unitFormatUtils.js";import{on as i,init as a}from"../core/watchUtils.js";import{aliasOf as n}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import"../core/has.js";import{cast as r}from"../core/accessorSupport/decorators/cast.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import m from"./Widget.js";import d from"./Attachments/AttachmentsViewModel.js";import{isSupportedImage as c,getIconPath as h}from"./Attachments/support/attachmentUtils.js";import{storeNode as u,discardNode as p,isRTL as b}from"./support/widgetUtils.js";import{messageBundle as g}from"./support/decorators/messageBundle.js";import"../core/Logger.js";import{tsx as _}from"./support/jsxFactory.js";const f={addButton:!0,addSubmitButton:!0,cancelAddButton:!0,cancelUpdateButton:!0,deleteButton:!0,errorMessage:!0,progressBar:!0,updateButton:!0},v={base:"esri-attachments",loaderContainer:"esri-attachments__loader-container",loader:"esri-attachments__loader",fadeIn:"esri-attachments--fade-in",container:"esri-attachments__container",containerList:"esri-attachments__container--list",containerPreview:"esri-attachments__container--preview",actions:"esri-attachments__actions",deleteButton:"esri-attachments__delete-button",addAttachmentButton:"esri-attachments__add-attachment-button",errorMessage:"esri-attachments__error-message",items:"esri-attachments__items",item:"esri-attachments__item",itemButton:"esri-attachments__item-button",itemMask:"esri-attachments__item-mask",itemMaskIcon:"esri-attachments__item-mask--icon",itemImage:"esri-attachments__image",itemImageResizable:"esri-attachments__image--resizable",itemLabel:"esri-attachments__label",itemFilename:"esri-attachments__filename",itemChevronIcon:"esri-attachments__item-chevron-icon",itemLink:"esri-attachments__item-link",itemLinkOverlay:"esri-attachments__item-link-overlay",itemLinkOverlayIcon:"esri-attachments__item-link-overlay-icon",itemEditIcon:"esri-attachments__item-edit-icon",itemAddIcon:"esri-attachments__item-add-icon",itemAddButton:"esri-attachments__item-add-button",formNode:"esri-attachments__form-node",fileFieldset:"esri-attachments__file-fieldset",fileLabel:"esri-attachments__file-label",fileName:"esri-attachments__file-name",fileInput:"esri-attachments__file-input",metadata:"esri-attachments__metadata",metadataFieldset:"esri-attachments__metadata-fieldset",progressBar:"esri-attachments__progress-bar",esriWidget:"esri-widget",esriButton:"esri-button",buttonDisabled:"esri-button--disabled",esriButtonSecondary:"esri-button--secondary",esriButtonTertiary:"esri-button--tertiary",esriButtonThird:"esri-button--third",esriButtonSmall:"esri-button--small",esriButtonHalf:"esri-button--half",empty:"esri-widget__content--empty",iconExternalLink:"esri-icon-link-external",iconEdit:"esri-icon-edit",iconRight:"esri-icon-right",iconLeft:"esri-icon-left",iconPlus:"esri-icon-plus"},y=window.CSS;let B=class extends m{constructor(t,e){super(t,e),this.abilities=null,this.displayType="auto",this.graphic=null,this.label=void 0,this.messages=null,this.messagesUnits=null,this.selectedFile=null,this.submitting=!1,this.viewModel=new d,this.visibleElements={...f},this._supportsImageOrientation=y&&y.supports&&y.supports("image-orientation","from-image"),this._addAttachmentForm=null,this._updateAttachmentForm=null}initialize(){this.own(i(this,"viewModel.attachmentInfos","change",(()=>this.scheduleRender())),a(this,"viewModel.mode",(()=>this._modeChanged())))}get effectiveDisplayType(){const{displayType:t}=this;return t&&"auto"!==t?t:this.viewModel.supportsResizeAttachments?"preview":"list"}castVisibleElements(t){return{...f,...t}}addAttachment(){const{_addAttachmentForm:t,viewModel:s}=this;return this._set("submitting",!0),this._set("error",null),s.addAttachment(t).then((t=>(this._set("submitting",!1),this._set("error",null),s.mode="view",t))).catch((t=>{throw this._set("submitting",!1),this._set("error",new e("attachments:add-attachment",this.messages.addErrorMessage,t)),t}))}deleteAttachment(t){const{viewModel:s}=this;return this._set("submitting",!0),this._set("error",null),s.deleteAttachment(t).then((t=>(this._set("submitting",!1),this._set("error",null),s.mode="view",t))).catch((t=>{throw this._set("submitting",!1),this._set("error",new e("attachments:delete-attachment",this.messages.deleteErrorMessage,t)),t}))}updateAttachment(){const{viewModel:t}=this,{_updateAttachmentForm:s}=this;return this._set("submitting",!0),this._set("error",null),t.updateAttachment(s).then((e=>(this._set("submitting",!1),this._set("error",null),t.mode="view",e))).catch((t=>{throw this._set("submitting",!1),this._set("error",new e("attachments:update-attachment",this.messages.updateErrorMessage,t)),t}))}render(){const{submitting:t,viewModel:e}=this,{state:s}=e;return _("div",{class:this.classes(v.base,v.esriWidget)},t?this.renderProgressBar():null,"loading"===s?this.renderLoading():this.renderAttachments(),this.renderErrorMessage())}renderErrorMessage(){const{error:t,visibleElements:e}=this;return t&&e.errorMessage?_("div",{key:"error-message",class:v.errorMessage},t.message):null}renderAttachments(){const{mode:t,activeAttachmentInfo:e}=this.viewModel;return"add"===t?this.renderAddForm():"edit"===t?this.renderDetailsForm(e):this.renderAttachmentContainer()}renderLoading(){return _("div",{class:v.loaderContainer,key:"loader"},_("div",{class:v.loader}))}renderProgressBar(){return this.visibleElements.progressBar?_("div",{class:v.progressBar,key:"progress-bar"}):null}renderAddForm(){const{submitting:t,selectedFile:e}=this,s=t||!e,i=this.visibleElements.cancelAddButton?_("button",{type:"button",bind:this,disabled:t,onclick:this._cancelForm,class:this.classes(v.esriButton,v.esriButtonTertiary,v.esriButtonSmall,v.esriButtonHalf,t&&v.buttonDisabled)},this.messages.cancel):null,a=this.visibleElements.addSubmitButton?_("button",{type:"submit",disabled:s,class:this.classes(v.esriButton,v.esriButtonSecondary,v.esriButtonSmall,v.esriButtonHalf,{[v.buttonDisabled]:s})},this.messages.add):null,n=e?_("span",{key:"file-name",class:v.fileName},e.name):null,r=_("form",{bind:this,afterCreate:u,afterRemoved:p,"data-node-ref":"_addAttachmentForm",onsubmit:this._submitAddAttachment},_("fieldset",{class:v.fileFieldset},n,_("label",{class:this.classes(v.fileLabel,v.esriButton,v.esriButtonSecondary)},e?this.messages.changeFile:this.messages.selectFile,_("input",{class:v.fileInput,type:"file",name:"attachment",bind:this,onchange:this._handleFileInputChange}))),a,i);return _("div",{key:"add-form-container",class:v.formNode},r)}renderDetailsForm(t){const{visibleElements:e,viewModel:i,selectedFile:a,submitting:n}=this,{contentType:r,size:o,url:l}=t,{abilities:m}=i,d=n||!a,c=m.editing&&m.operations.delete&&e.deleteButton?_("button",{key:"delete-button",type:"button",disabled:n,bind:this,onclick:e=>this._submitDeleteAttachment(e,t),class:this.classes(v.esriButton,v.esriButtonSmall,v.esriButtonTertiary,v.deleteButton,{[v.buttonDisabled]:n})},this.messages.delete):null,h=m.editing&&m.operations.update&&e.updateButton?_("button",{disabled:d,key:"update-button",type:"submit",class:this.classes(v.esriButton,v.esriButtonSmall,v.esriButtonThird,{[v.buttonDisabled]:d})},this.messages.update):null,b=this.visibleElements.cancelUpdateButton?_("button",{disabled:n,key:"cancel-button",type:"button",bind:this,onclick:this._cancelForm,class:this.classes(v.esriButton,v.esriButtonSmall,v.esriButtonTertiary,v.esriButtonThird,{[v.buttonDisabled]:n})},this.messages.cancel):null,g=a?_("span",{key:"file-name",class:v.fileName},a.name):null,f=m.editing&&m.operations.update?_("fieldset",{key:"file",class:v.fileFieldset},g,_("label",{class:this.classes(v.fileLabel,v.esriButton,v.esriButtonSecondary)},this.messages.changeFile,_("input",{class:v.fileInput,type:"file",name:"attachment",bind:this,onchange:this._handleFileInputChange}))):null,y=_("fieldset",{key:"size",class:v.metadataFieldset},_("label",null,s(this.messagesUnits,o))),B=_("fieldset",{key:"content-type",class:v.metadataFieldset},_("label",null,r)),A=_("form",{bind:this,afterCreate:u,afterRemoved:p,"data-node-ref":"_updateAttachmentForm",onsubmit:this._submitUpdateAttachment},_("div",{class:v.metadata},y,B),f,_("div",{class:v.actions},c,b,h));return _("div",{key:"edit-form-container",class:v.formNode},_("a",{class:v.itemLink,href:l,rel:"noreferrer",target:"_blank"},this.renderImageMask({attachmentInfo:t,size:400}),_("div",{class:v.itemLinkOverlay},_("span",{class:v.itemLinkOverlayIcon},_("svg",{xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 32 32"},_("path",{d:"M28 13h1v16H3V3h16v1H4v24h24zm-5-9h4.293L15.646 15.638l.707.707L28 4.707V9h1V3h-6z"}),_("path",{fill:"none",d:"M0 0h32v32H0z"}))))),A)}renderImageMask({attachmentInfo:t,size:e}){const{supportsResizeAttachments:s}=this.viewModel,{contentType:i,name:a,url:n}=t,r=s&&c(i),o=this._getCSSTransform(t,r),l=o?{transform:o,"image-orientation":"none"}:{},m=-1===n.indexOf("?")?"?":"&",d=r?`${n}${m}w=${e}`:h(i),u={[v.itemMaskIcon]:!r},p={[v.itemImageResizable]:s};return _("div",{class:this.classes(u,v.itemMask)},_("img",{styles:l,alt:a,src:d,class:this.classes(p,v.itemImage)}))}renderAttachmentInfo({attachmentInfo:t,displayType:e}){const{viewModel:s}=this,{abilities:i}=s,{name:a,url:n}=t,r=this.renderImageMask({attachmentInfo:t,size:"list"===e?48:400}),o=i.editing?_("span",{"aria-hidden":"true",class:this.classes(v.itemChevronIcon,b(this.container)?v.iconLeft:v.iconRight)}):null,l=[r,_("label",{class:v.itemLabel},_("span",{class:v.itemFilename},a||this.messages.noTitle),o)],m=i.editing?_("button",{key:"details-button",bind:this,class:v.itemButton,title:this.messages.attachmentDetails,"aria-label":this.messages.attachmentDetails,"data-attachment-info-id":t.id,onclick:()=>this._startEditAttachment(t),type:"button"},l):_("a",{key:"details-link",class:v.itemButton,href:n,target:"_blank"},l);return _("li",{class:v.item,key:t},m)}renderAttachmentContainer(){const{effectiveDisplayType:t,viewModel:e,visibleElements:s}=this,{attachmentInfos:i,abilities:a}=e,n=i&&i.length,r={[v.containerList]:"preview"!==t,[v.containerPreview]:"preview"===t},o=a.editing&&a.operations.add&&s.addButton?_("button",{bind:this,onclick:()=>this._startAddAttachment(),class:this.classes(v.esriButton,v.esriButtonTertiary,v.addAttachmentButton),type:"button"},_("span",{"aria-hidden":"true",class:this.classes(v.itemAddIcon,v.iconPlus)}),this.messages.add):null,l=n?_("ul",{class:v.items},i.toArray().map((e=>this.renderAttachmentInfo({attachmentInfo:e,displayType:t})))):_("div",{class:v.empty},this.messages.noAttachments);return _("div",{key:"attachments-container",class:this.classes(v.container,r)},l,o)}_modeChanged(){this._set("error",null),this._set("selectedFile",null)}_handleFileInputChange(t){const e=t.target,s=e&&e.files&&e.files.item(0);this._set("selectedFile",s)}_submitDeleteAttachment(t,e){t.preventDefault(),this.deleteAttachment(e)}_submitAddAttachment(t){t.preventDefault(),this.addAttachment()}_submitUpdateAttachment(t){t.preventDefault(),this.updateAttachment()}_startEditAttachment(t){const{viewModel:e}=this;e.activeAttachmentInfo=t,e.mode="edit"}_startAddAttachment(){this.viewModel.mode="add"}_cancelForm(t){t.preventDefault(),this.viewModel.mode="view"}_getCSSTransform(t,e){const{orientationInfo:s}=t;return!this._supportsImageOrientation&&e&&s?[s.rotation?`rotate(${s.rotation}deg)`:"",s.mirrored?"scaleX(-1)":""].join(" "):""}};t([n("viewModel.abilities")],B.prototype,"abilities",void 0),t([o()],B.prototype,"displayType",void 0),t([o({readOnly:!0})],B.prototype,"effectiveDisplayType",null),t([n("viewModel.graphic")],B.prototype,"graphic",void 0),t([o({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],B.prototype,"label",void 0),t([o(),g("esri/widgets/Attachments/t9n/Attachments")],B.prototype,"messages",void 0),t([o(),g("esri/core/t9n/Units")],B.prototype,"messagesUnits",void 0),t([o({readOnly:!0})],B.prototype,"selectedFile",void 0),t([o({readOnly:!0})],B.prototype,"submitting",void 0),t([o({readOnly:!0})],B.prototype,"error",void 0),t([o({type:d})],B.prototype,"viewModel",void 0),t([o()],B.prototype,"visibleElements",void 0),t([r("visibleElements")],B.prototype,"castVisibleElements",null),B=t([l("esri.widgets.Attachments")],B);const A=B;export{A as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../Graphic.js";import"../../core/has.js";import{isSome as t,isNone as r,removeMaybe as i}from"../../core/maybe.js";import{whenOrAbort as a,eachAlways as n}from"../../core/promiseUtils.js";import{px2pt as s}from"../../core/screenUtils.js";import{init as o,whenFalseOnce as l}from"../../core/watchUtils.js";import{diff as c}from"../../core/accessorSupport/diffUtils.js";import{calculateTolerance as u}from"../../renderers/support/clickToleranceUtils.js";import{meterIn as p}from"../../renderers/support/lengthUtils.js";import{getTransformationType as y,TransformationType as f}from"../../renderers/visualVariables/support/sizeVariableUtils.js";import{getRotationAngle as d,getSize as m}from"../../renderers/visualVariables/support/visualVariableUtils.js";import{to3D as h}from"../../symbols/support/symbolConversion.js";import{getDisplayedSymbol as g}from"../../symbols/support/symbolUtils.js";import{GraphicState as b}from"../../views/3d/layers/graphics/GraphicState.js";import{createQueryGeometry as w}from"../../views/support/drapedUtils.js";import{hitTestSelectSameDistance as v}from"../../views/support/hitTestSelectUtils.js";function S(e){const r=e.sourceLayer;if("feature"!==r.type||!F(r.renderer))return{rotation:null,size:null};let i=null,a=null;const n=r.renderer.getVisualVariablesForType("rotation").filter((r=>(!r.axis||"heading"===r.axis)&&r.field&&!r.valueExpression&&t(d(r,e))));1===n.length&&(i=j(n[0],r));const s=r.renderer.getVisualVariablesForType("size").filter((r=>r.field&&!r.useSymbolValue&&!r.valueExpression&&y(r)===f.RealWorldSize&&t(m(r,e))));return 1===s.length&&(a=U(s[0],r)),{rotation:i,size:a}}function j(e,t){const r="heading"===(e.axis||"heading")&&"arithmetic"===e.rotationType?-1:1,i=e.field,a=t.fields&&t.fields.filter((e=>e.name===i)),n=a&&1===a.length?a[0].type:"double",s={initial:0,current:0};return{field:i,getDefault:()=>Promise.resolve(0),getValue:e=>(s.current=s.initial-r*e,z((s.current+360)%360,n)),initValue:e=>{s.initial=null!=e?e:s.current,s.current=0},isUpdatingInteractively:!1}}function I(e,t){switch(t){case"width":return e[0];case"depth":return e[1];case"height":return e[2];default:return e[2]||e[1]||e[0]}}async function V(e,t,i){if(r(t))return 0;const{symbol:a}=h(t);if(r(a)||"web-style"===a.type||"cim"===a.type)return 0;const n=a.symbolLayers.getItemAt(0);if(!n)return 0;switch(n.type){case"icon":{const{computeIconLayerResourceSize:e}=await import("../../symbols/support/symbolLayerUtils.js");return n.size||Math.min(B.icon,(await e(n,B.icon))[0])||B.icon}case"text":return n.size||B.text;case"line":return n.size||B.line;case"object":{const{computeObjectLayerResourceSize:t}=await import("../../symbols/support/symbolLayerUtils.js");return I(await t(n,e.scale/B.viewScaleSizeFactor),i)}case"path":return(null!=n.width?n.width:n.height)||e.scale/B.viewScaleSizeFactor;case"extrude":return n.size||e.scale/B.viewScaleSizeFactor;default:return 0}}function U(e,t){const r=e.field,i=e.axis,a=t.fields&&t.fields.filter((e=>e.name===r)),n=a&&1===a.length?a[0].type:"double",s={updating:!1,initial:0,current:0},o=p[e.valueUnit];let l;return l="area"===e.valueRepresentation?e=>(e*o/2)**2*Math.PI:"radius"===e.valueRepresentation||"distance"===e.valueRepresentation?e=>e*o/2:e=>e*o,{field:r,getDefault:async(e,t)=>z(l(await V(t,e,i)),n),getValue:(e,t)=>(s.initial||(s.initial=t.pixelSizeAt(t.center)),s.current=s.initial*e,z(s.current,n)),initValue:e=>{s.initial=null!=e?e:s.current,s.current=0},isUpdatingInteractively:!1}}function z(e,t){switch(t){case"small-integer":case"integer":case"long":return Math.round(e);case"double":case"single":return e;default:return 0}}function F(e){switch(e.type){case"class-breaks":case"simple":case"unique-value":case"dot-density":case"dictionary":return!0;default:return!1}}async function L(e){const r=await g(e,{useSourceLayer:!0,ignoreGraphicSymbol:!0}),i=c(e.symbol,r);t(i)&&(e.symbol=r)}function x(e){if("mesh"===e||"multipatch"===e)throw new Error("Mesh and Multipatch not supported");return e}async function M(e,t,r){await R(e,t);const i=e.on("create",(async i=>{if("cancel"===i.state)return R(e,t);if("complete"===i.state){const e=i.graphic;e.sourceLayer||(e.sourceLayer=t.layer),e.attributes||(e.attributes={...t.template.prototype.attributes}),await L(e),r(e)}}));return{remove:()=>{i.remove(),e.cancel()}}}async function R(e,t){const r=t.layer,i={...t.template.prototype.attributes};await T(e,r,i);const a={graphicProperties:{attributes:i,sourceLayer:r},hasZ:r.capabilities.data.supportsZ};return e.layer.elevationInfo=r.elevationInfo,e.create(x(r.geometryType),a)}async function T(t,i,a){var n;const s=new e({sourceLayer:i,attributes:a}),{rotation:o,size:l}=S(s);let c=await g(s,{useSourceLayer:!0}),u=!1;for(const e of[l,o]){if(r(e))continue;null==a[e.field]&&(a[e.field]=await e.getDefault(c,t.view),u=!0)}switch(u&&(c=await g(s,{useSourceLayer:!0})),null==(n=c)?void 0:n.type){case"simple-fill":case"polygon-3d":t.polygonSymbol=c;break;case"simple-line":case"line-3d":t.polylineSymbol=c;break;case"simple-marker":case"picture-marker":case"point-3d":t.pointSymbol=c}}function E(e,t){return e&&e.find((e=>e.layer===t))}async function k(e,t,r,i){if(0===e.length)return[];const{updatable:s,graphicsByLayer:o}=await r.async((async()=>{const{results:n}=await a(v(t,r),i),s=new Map,o=({layer:e})=>{const t=s.get(e);if(!t){const t=new Array;return s.set(e,t),t}return t};n.forEach((({graphic:e})=>o(e).push(e)));const l=e.filter((({supports:e,layer:t})=>e.indexOf("update")>-1&&s.has(t)));return 0!==l.length&&r.stopPropagation(),{updatable:l,graphicsByLayer:s}}));return a(n(s.map((async({layer:e})=>{const{objectIdField:t,displayField:r}=e,a=[t];e.fieldsIndex.has(r)&&a.push(r);const n=o.get(e);if(!!n.some((e=>a.some((t=>!(t in e.attributes)))))){const t=e.createQuery();return t.outFields=a,t.returnGeometry=!1,t.objectIds=n.map((e=>e.getObjectId())),e.queryFeatures(t,{signal:i}).then((({features:e})=>e))}return n}))),i)}async function A(e,t,r,i){if(0===e.length)return[];const s=await r.async((async()=>{const{results:n}=await a(t.hitTest(r),i);if(0===n.length)return[];const s=new Set;n.forEach((({graphic:e})=>s.add(e.layer)));const o=e.items.filter((({layer:e,supports:t})=>t.indexOf("update")>-1&&s.has(e)));return o.length>0&&r.stopPropagation(),o}));return a(n(s.map((({layer:e})=>{const{objectIdField:a,displayField:n}=e,s=[a];e.fieldsIndex.has(n)&&s.push(n);const o=e.createQuery();o.outFields=s,o.returnGeometry=!1;const l="renderer"in e?u({renderer:e.renderer,event:r}):0;return o.geometry=w(r.mapPoint,l,t),o.outSpatialReference=t.spatialReference,e.queryFeatures(o,{signal:i}).then((({features:e})=>e))}))),i)}async function G(e,t,r,i){switch(t.type){case"3d":return k(e,t,r,i);case"2d":return A(e,t,r,i)}}async function P(e,t,r){const i=e.layer,a=i.createQuery();return a.objectIds=[e.getAttribute(i.objectIdField)],a.outFields=["*"],a.outSpatialReference=t.spatialReference,a.returnM=i.capabilities.data.supportsM,a.returnZ=i.capabilities.data.supportsZ,(await i.queryFeatures(a,{signal:r})).features[0]}async function q(e,i,a,n){let s=!1;const{rotation:o,size:l}=n;[o,l].forEach((async a=>{if(r(a))return;const n=i.attributes[a.field];if(t(n))a.initValue(n);else{const t=await a.getDefault(i.symbol,e.view);a.initValue(t),i.setAttribute(a.field,t),s=!0}})),s&&await L(i);const c={multipleSelectionEnabled:!1};return"point"===a.geometryType&&(c.enableRotation=t(o),c.enableScaling=t(l)),e.layer.elevationInfo=a.elevationInfo,e.update(i,c)}function D(e){return!e||"rotate-start"!==e.type&&"rotate"!==e.type&&"rotate-stop"!==e.type?null:e}function O(e){return!e||"scale-start"!==e.type&&"scale"!==e.type&&"scale-stop"!==e.type?null:e}async function Z(e,r,i,a){var n;if(!t(r.geometry)||"point"!==(null==(n=r.geometry)?void 0:n.type))return;const s=a.rotation,o=D(i.toolEventInfo);if(t(s)&&t(o))if("rotate-stop"===o.type)s.isUpdatingInteractively=!1,s.initValue();else{s.isUpdatingInteractively=!0;const{field:t,getValue:i}=s;r.attributes[t]=i(o.angle,e)}const l=a.size,c=O(i.toolEventInfo);if(t(l)&&t(c))if("scale-stop"===c.type)l.isUpdatingInteractively=!1,l.initValue();else{l.isUpdatingInteractively=!0;const{field:t,getValue:i}=l;r.attributes[t]=i(c.xScale,e)}await L(r)}async function Q(e,a,n,s,c){const u=e.clone();await L(u),s.map.add(n.layer),n.layer.add(u);const p=e.sourceLayer,y=s.whenLayerView(p),f=()=>{const t=e.layer,r=e.attributes[t.objectIdField];return y.then((e=>e.setVisibility(r,!1)),(()=>{})),{remove(){y.then((e=>e.setVisibility(r,!0)),(()=>{}))}}};let d=null,m=null;if("3d"===s.type){const e=new b({graphic:u});d=s.trackGraphicState(e),o(e,"displaying",(e=>{m=e?f():i(m)}))}else m=f();await q(n,u,p,a);let h=null;y.then((e=>h=e),(()=>{}));const g=a.size,w=a.rotation,v=e.watch("attributes",(async e=>{let i=!1;for(const a in e){const n=e[a];n!==u.attributes[a]&&(u.setAttribute(a,n),t(g)&&!g.isUpdatingInteractively&&g.field===a&&g.initValue(n),t(w)&&!w.isUpdatingInteractively&&w.field===a&&w.initValue(n),(r(h)||h.requiredFields.includes(a))&&(i=!0))}i&&await L(u)})),S=n.on("update",(async e=>{const t=e.graphics[0];if("complete"===e.state)return q(n,t,p,a);await Z(s,t,e,a),c(t.clone())})),j=n.on(["undo","redo"],(async e=>{c(e.graphics[0].clone())})),I=()=>{};return{interactive:{remove(){j.remove(),S.remove(),n.cancel(),v&&v.remove(),this.remove=I}},visual:{remove(){i(m),s.whenLayerView(p).then((e=>l(e,"updating"))).then((()=>{i(d),n.layer.remove(u),this.remove=I}))}}}}const B={icon:s(24),text:s(12),line:s(1),viewScaleSizeFactor:100};function C(e,t,r){let i=!1;return e.filter((e=>!!i||(i=e===t,i))).map((e=>r[e]()))}function W(e){if(1!==e.length)return null;const t=e[0];if("items"in t){const e=t;return 1===e.items.length?e.items[0]:null}return t}function H(e,r){if(e.viewModel.refreshCreationTemplates(),"awaiting-feature-creation-info"===r[0].id){const i=W(e.viewModel.featureTemplatesViewModel.items);t(i)&&(e.creationInfo={layer:i.layer,template:i.template},r.shift())}return r}export{H as avoidFeatureTemplateSelectionWithOnlyOneItem,C as createWorkflowSteps,G as fetchCandidates,P as fetchFullFeature,E as findLayerInfo,S as getVisualVariableAttributes,M as setUpFeatureAdd,Q as setUpGeometryUpdate,B as sizeDefaults,R as startCreatingNewFeature,q as startUpdatingFeature,L as updateGraphicSymbolWhenRequired,Z as visualVariableInteractiveUpdate};
5
+ import e from"../../Graphic.js";import"../../core/has.js";import{isSome as t,isNone as r,removeMaybe as i}from"../../core/maybe.js";import{whenOrAbort as a,eachAlways as n}from"../../core/promiseUtils.js";import{px2pt as s}from"../../core/screenUtils.js";import{init as o,whenFalseOnce as l}from"../../core/watchUtils.js";import{diff as c}from"../../core/accessorSupport/diffUtils.js";import{calculateTolerance as u}from"../../renderers/support/clickToleranceUtils.js";import{meterIn as p}from"../../renderers/support/lengthUtils.js";import{getTransformationType as y,TransformationType as f}from"../../renderers/visualVariables/support/sizeVariableUtils.js";import{getRotationAngle as d,getSize as m}from"../../renderers/visualVariables/support/visualVariableUtils.js";import{to3D as h}from"../../symbols/support/symbolConversion.js";import{getDisplayedSymbol as g}from"../../symbols/support/symbolUtils.js";import{GraphicState as b}from"../../views/3d/layers/graphics/GraphicState.js";import{createQueryGeometry as w}from"../../views/support/drapedUtils.js";import{hitTestSelectSameDistance as v}from"../../views/support/hitTestSelectUtils.js";function S(e){const r=e.sourceLayer;if("feature"!==r.type||!F(r.renderer))return{rotation:null,size:null};let i=null,a=null;const n=r.renderer.getVisualVariablesForType("rotation").filter((r=>(!r.axis||"heading"===r.axis)&&r.field&&!r.valueExpression&&t(d(r,e))));1===n.length&&(i=j(n[0],r));const s=r.renderer.getVisualVariablesForType("size").filter((r=>r.field&&!r.useSymbolValue&&!r.valueExpression&&y(r)===f.RealWorldSize&&t(m(r,e))));return 1===s.length&&(a=U(s[0],r)),{rotation:i,size:a}}function j(e,t){const r="heading"===(e.axis||"heading")&&"arithmetic"===e.rotationType?-1:1,i=e.field,a=t.fields&&t.fields.filter((e=>e.name===i)),n=a&&1===a.length?a[0].type:"double",s={initial:0,current:0};return{field:i,getDefault:()=>Promise.resolve(0),getValue:e=>(s.current=s.initial-r*e,z((s.current+360)%360,n)),initValue:e=>{s.initial=null!=e?e:s.current,s.current=0},isUpdatingInteractively:!1}}function I(e,t){switch(t){case"width":return e[0];case"depth":return e[1];case"height":return e[2];default:return e[2]||e[1]||e[0]}}async function V(e,t,i){if(r(t))return 0;const{symbol:a}=h(t);if(r(a)||"web-style"===a.type||"cim"===a.type)return 0;const n=a.symbolLayers.getItemAt(0);if(!n)return 0;switch(n.type){case"icon":{const{computeIconLayerResourceSize:e}=await import("../../symbols/support/symbolLayerUtils.js");return n.size||Math.min(B.icon,(await e(n,B.icon))[0])||B.icon}case"text":return n.size||B.text;case"line":return n.size||B.line;case"object":{const{computeObjectLayerResourceSize:t}=await import("../../symbols/support/symbolLayerUtils.js");return I(await t(n,e.scale/B.viewScaleSizeFactor),i)}case"path":return(null!=n.width?n.width:n.height)||e.scale/B.viewScaleSizeFactor;case"extrude":return n.size||e.scale/B.viewScaleSizeFactor;default:return 0}}function U(e,t){const r=e.field,i=e.axis,a=t.fields&&t.fields.filter((e=>e.name===r)),n=a&&1===a.length?a[0].type:"double",s={updating:!1,initial:0,current:0},o=p[e.valueUnit];let l;return l="area"===e.valueRepresentation?e=>(e*o/2)**2*Math.PI:"radius"===e.valueRepresentation||"distance"===e.valueRepresentation?e=>e*o/2:e=>e*o,{field:r,getDefault:async(e,t)=>z(l(await V(t,e,i)),n),getValue:(e,t)=>(s.initial||(s.initial=t.pixelSizeAt(t.center)),s.current=s.initial*e,z(s.current,n)),initValue:e=>{s.initial=null!=e?e:s.current,s.current=0},isUpdatingInteractively:!1}}function z(e,t){switch(t){case"small-integer":case"integer":case"long":return Math.round(e);case"double":case"single":return e;default:return 0}}function F(e){switch(e.type){case"class-breaks":case"simple":case"unique-value":case"dot-density":case"dictionary":return!0;default:return!1}}async function L(e){const r=await g(e,{useSourceLayer:!0,ignoreGraphicSymbol:!0}),i=c(e.symbol,r);t(i)&&(e.symbol=r)}function x(e){if("mesh"===e||"multipatch"===e)throw new Error("Mesh and Multipatch not supported");return e}async function M(e,t,r){await R(e,t);const i=e.on("create",(async i=>{if("cancel"===i.state)return R(e,t);if("complete"===i.state){const e=i.graphic;e.sourceLayer||(e.sourceLayer=t.layer),e.attributes||(e.attributes={...t.template.prototype.attributes}),await L(e),r(e)}}));return{remove:()=>{i.remove(),e.cancel()}}}async function R(e,t){const r=t.layer,i={...t.template.prototype.attributes};await E(e,r,i);const a={graphicProperties:{attributes:i,sourceLayer:r},hasZ:r.capabilities.data.supportsZ};return e.layer.elevationInfo=r.elevationInfo,e.create(x(r.geometryType),a)}async function E(t,i,a){var n;const s=new e({sourceLayer:i,attributes:a}),{rotation:o,size:l}=S(s);let c=await g(s,{useSourceLayer:!0}),u=!1;for(const e of[l,o]){if(r(e))continue;null==a[e.field]&&(a[e.field]=await e.getDefault(c,t.view),u=!0)}switch(u&&(c=await g(s,{useSourceLayer:!0})),null==(n=c)?void 0:n.type){case"simple-fill":case"polygon-3d":t.polygonSymbol=c;break;case"simple-line":case"line-3d":t.polylineSymbol=c;break;case"simple-marker":case"picture-marker":case"point-3d":t.pointSymbol=c}}function T(e,t){return e&&e.find((e=>e.layer===t))}async function k(e,t,r,i){if(0===e.length)return[];const{updatable:s,graphicsByLayer:o}=await r.async((async()=>{const{results:n}=await a(v(t,r),i),s=new Map,o=({layer:e})=>{const t=s.get(e);if(!t){const t=new Array;return s.set(e,t),t}return t};n.forEach((({graphic:e})=>o(e).push(e)));const l=e.filter((({supports:e,layer:t})=>e.indexOf("update")>-1&&s.has(t)));return 0!==l.length&&r.stopPropagation(),{updatable:l,graphicsByLayer:s}}));return a(n(s.map((async({layer:e})=>{const{objectIdField:t,displayField:r}=e,a=[t];e.fieldsIndex.has(r)&&a.push(r);const n=o.get(e);if(!!n.some((e=>a.some((t=>!(t in e.attributes)))))){const t=e.createQuery();return t.outFields=a,t.returnGeometry=!1,t.objectIds=n.map((e=>e.getObjectId())),e.queryFeatures(t,{signal:i}).then((({features:e})=>e))}return n}))),i)}async function A(e,t,r,i){if(0===e.length)return[];let s=null;const o=await r.async((async()=>{const{results:n}=await a(t.hitTest(r),i);if(0===n.length)return[];const o=new Set;s=n,s.forEach((({graphic:e})=>o.add(e.layer)));const l=e.items.filter((({layer:e,supports:t})=>t.indexOf("update")>-1&&o.has(e)));return l.length>0&&r.stopPropagation(),l}));return a(n(o.map((({layer:e})=>{const{objectIdField:a,displayField:n}=e,o=[a];e.fieldsIndex.has(n)&&o.push(n);const l=e.createQuery();l.outFields=o,l.returnGeometry=!1;const c="renderer"in e?u({renderer:e.renderer,event:r}):0;return l.geometry=w(r.mapPoint,c,t),l.outSpatialReference=t.spatialReference,e.queryFeatures(l,{signal:i}).then((({features:t})=>(s.forEach((({graphic:r})=>{if(r.layer===e){t.find((t=>t.attributes[a]===r.attributes[e.objectIdField]))||t.push(r)}})),t)))}))),i)}async function G(e,t,r,i){switch(t.type){case"3d":return k(e,t,r,i);case"2d":return A(e,t,r,i)}}async function P(e,t,r){const i=e.layer,a=i.createQuery();return a.objectIds=[e.getAttribute(i.objectIdField)],a.outFields=["*"],a.outSpatialReference=t.spatialReference,a.returnM=i.capabilities.data.supportsM,a.returnZ=i.capabilities.data.supportsZ,(await i.queryFeatures(a,{signal:r})).features[0]}async function q(e,i,a,n){let s=!1;const{rotation:o,size:l}=n;[o,l].forEach((async a=>{if(r(a))return;const n=i.attributes[a.field];if(t(n))a.initValue(n);else{const t=await a.getDefault(i.symbol,e.view);a.initValue(t),i.setAttribute(a.field,t),s=!0}})),s&&await L(i);const c={multipleSelectionEnabled:!1};return"point"===a.geometryType&&(c.enableRotation=t(o),c.enableScaling=t(l)),e.layer.elevationInfo=a.elevationInfo,e.update(i,c)}function D(e){return!e||"rotate-start"!==e.type&&"rotate"!==e.type&&"rotate-stop"!==e.type?null:e}function O(e){return!e||"scale-start"!==e.type&&"scale"!==e.type&&"scale-stop"!==e.type?null:e}async function Z(e,r,i,a){var n;if(!t(r.geometry)||"point"!==(null==(n=r.geometry)?void 0:n.type))return;const s=a.rotation,o=D(i.toolEventInfo);if(t(s)&&t(o))if("rotate-stop"===o.type)s.isUpdatingInteractively=!1,s.initValue();else{s.isUpdatingInteractively=!0;const{field:t,getValue:i}=s;r.attributes[t]=i(o.angle,e)}const l=a.size,c=O(i.toolEventInfo);if(t(l)&&t(c))if("scale-stop"===c.type)l.isUpdatingInteractively=!1,l.initValue();else{l.isUpdatingInteractively=!0;const{field:t,getValue:i}=l;r.attributes[t]=i(c.xScale,e)}await L(r)}async function Q(e,a,n,s,c){const u=e.clone();await L(u),s.map.add(n.layer),n.layer.add(u);const p=e.sourceLayer,y=s.whenLayerView(p),f=()=>{const t=e.layer,r=e.attributes[t.objectIdField];return y.then((e=>e.setVisibility(r,!1)),(()=>{})),{remove(){y.then((e=>e.setVisibility(r,!0)),(()=>{}))}}};let d=null,m=null;if("3d"===s.type){const e=new b({graphic:u});d=s.trackGraphicState(e),o(e,"displaying",(e=>{m=e?f():i(m)}))}else m=f();await q(n,u,p,a);let h=null;y.then((e=>h=e),(()=>{}));const g=a.size,w=a.rotation,v=e.watch("attributes",(async e=>{let i=!1;for(const a in e){const n=e[a];n!==u.attributes[a]&&(u.setAttribute(a,n),t(g)&&!g.isUpdatingInteractively&&g.field===a&&g.initValue(n),t(w)&&!w.isUpdatingInteractively&&w.field===a&&w.initValue(n),(r(h)||h.requiredFields.includes(a))&&(i=!0))}i&&await L(u)})),S=n.on("update",(async e=>{const t=e.graphics[0];if("complete"===e.state)return q(n,t,p,a);await Z(s,t,e,a),c(t.clone())})),j=n.on(["undo","redo"],(async e=>{c(e.graphics[0].clone())})),I=()=>{};return{interactive:{remove(){j.remove(),S.remove(),n.cancel(),v&&v.remove(),this.remove=I}},visual:{remove(){i(m),s.whenLayerView(p).then((e=>l(e,"updating"))).then((()=>{i(d),n.layer.remove(u),this.remove=I}))}}}}const B={icon:s(24),text:s(12),line:s(1),viewScaleSizeFactor:100};function C(e,t,r){let i=!1;return e.filter((e=>!!i||(i=e===t,i))).map((e=>r[e]()))}function W(e){if(1!==e.length)return null;const t=e[0];if("items"in t){const e=t;return 1===e.items.length?e.items[0]:null}return t}function H(e,r){if(e.viewModel.refreshCreationTemplates(),"awaiting-feature-creation-info"===r[0].id){const i=W(e.viewModel.featureTemplatesViewModel.items);t(i)&&(e.creationInfo={layer:i.layer,template:i.template},r.shift())}return r}export{H as avoidFeatureTemplateSelectionWithOnlyOneItem,C as createWorkflowSteps,G as fetchCandidates,P as fetchFullFeature,T as findLayerInfo,S as getVisualVariableAttributes,M as setUpFeatureAdd,Q as setUpGeometryUpdate,B as sizeDefaults,R as startCreatingNewFeature,q as startUpdatingFeature,L as updateGraphicSymbolWhenRequired,Z as visualVariableInteractiveUpdate};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import{init as t}from"../../core/watchUtils.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";import i from"../Widget.js";import s from"./FeatureContent.js";import n from"./FeatureFields.js";import d from"./FeatureMedia.js";import a from"./FeatureExpression/FeatureExpressionViewModel.js";import"../support/widgetUtils.js";import"../../core/Logger.js";import{tsx as l}from"../support/jsxFactory.js";const p={iconLoading:"esri-icon-loading-indicator esri-rotating",base:"esri-feature-expression",loadingSpinnerContainer:"esri-feature__loading-container",spinner:"esri-feature__loading-spinner"};let c=class extends i{constructor(e,t){super(e,t),this.viewModel=new a}initialize(){t(this,"viewModel.contentElementViewModel",(()=>this._setupExpressionWidget()))}destroy(){var e;null==(e=this._contentWidget)||e.destroy(),this._contentWidget=null}renderLoading(){return l("div",{key:"loading-container",class:p.loadingSpinnerContainer},l("span",{class:this.classes(p.iconLoading,p.spinner)}))}render(){var e;const{state:t}=this.viewModel;return l("div",{class:p.base},"loading"===t?this.renderLoading():"disabled"===t?null:null==(e=this._contentWidget)?void 0:e.render())}_setupExpressionWidget(){var e;const{contentElementViewModel:t,contentElement:o}=this.viewModel,r=null==o?void 0:o.type;null==(e=this._contentWidget)||e.destroy(),this._contentWidget=null;const i=t?"fields"===r?new n({viewModel:t}):"media"===r?new d({viewModel:t}):"text"===r?new s({viewModel:t}):null:null;this._contentWidget=i,this.scheduleRender()}};e([o({type:a})],c.prototype,"viewModel",void 0),c=e([r("esri.widgets.Feature.FeatureExpression")],c);const u=c;export{u as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import{init as t}from"../../core/watchUtils.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import i from"../Widget.js";import r from"./FeatureContent.js";import n from"./FeatureFields.js";import d from"./FeatureMedia.js";import a from"./FeatureExpression/FeatureExpressionViewModel.js";import"../support/widgetUtils.js";import"../../core/Logger.js";import{tsx as l}from"../support/jsxFactory.js";const p={iconLoading:"esri-icon-loading-indicator esri-rotating",base:"esri-feature-expression",loadingSpinnerContainer:"esri-feature__loading-container",spinner:"esri-feature__loading-spinner"};let c=class extends i{constructor(e,t){super(e,t),this.viewModel=new a}initialize(){t(this,"viewModel.contentElementViewModel",(()=>this._setupExpressionWidget()))}destroy(){this._destroyContentWidget()}renderLoading(){return l("div",{key:"loading-container",class:p.loadingSpinnerContainer},l("span",{class:this.classes(p.iconLoading,p.spinner)}))}render(){var e;const{state:t}=this.viewModel;return l("div",{class:p.base},"loading"===t?this.renderLoading():"disabled"===t?null:null==(e=this._contentWidget)?void 0:e.render())}_destroyContentWidget(){const{_contentWidget:e}=this;e&&(e.viewModel=null,e.destroy()),this._contentWidget=null}_setupExpressionWidget(){const{contentElementViewModel:e,contentElement:t}=this.viewModel,o=null==t?void 0:t.type;this._destroyContentWidget();const s=e?"fields"===o?new n({viewModel:e}):"media"===o?new d({viewModel:e}):"text"===o?new r({viewModel:e}):null:null;this._contentWidget=s,this.scheduleRender()}};e([o({type:a})],c.prototype,"viewModel",void 0),c=e([s("esri.widgets.Feature.FeatureExpression")],c);const u=c;export{u as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../chunks/tslib.es6.js";import e from"../../../core/Accessor.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as i}from"../../../core/accessorSupport/decorators/subclass.js";import r from"../../../popup/FieldInfo.js";import a from"../../../popup/content/support/ChartMediaInfoValueSeries.js";import{substituteFieldsInLinksAndAttributes as s,fixTokens as l,substituteAttributes as n,getFixedFieldNames as d,getFixedFieldName as p,isRelatedField as u,formatValueToFieldInfo as f,getFieldInfo as m,getFieldInfoLabel as c}from"../support/featureUtils.js";import{getRelatedFieldInfo as h}from"../support/relatedFeatureUtils.js";let y=class extends e{constructor(t){super(t),this.activeMediaInfoIndex=0,this.attributes=null,this.description=null,this.fieldInfoMap=null,this.formattedAttributes=null,this.expressionAttributes=null,this.layer=null,this.mediaInfos=null,this.popupTemplate=null,this.relatedInfos=null,this.title=null}get activeMediaInfo(){return this.formattedMediaInfos[this.activeMediaInfoIndex]||null}get formattedMediaInfos(){return this._formatMediaInfos()||[]}get formattedMediaInfoCount(){return this.formattedMediaInfos.length}setActiveMedia(t){this._setContentElementMedia(t)}next(){this._pageContentElementMedia(1)}previous(){this._pageContentElementMedia(-1)}_setContentElementMedia(t){const{formattedMediaInfoCount:e}=this,o=(t+e)%e;this.activeMediaInfoIndex=o}_pageContentElementMedia(t){const{activeMediaInfoIndex:e}=this,o=e+t;this._setContentElementMedia(o)}_formatMediaInfos(){const{attributes:t,mediaInfos:e,formattedAttributes:o,expressionAttributes:i,fieldInfoMap:r,layer:a}=this;return null==e?void 0:e.map((e=>{const l=null==e?void 0:e.clone();if(!l)return null;if(l.title=s({attributes:t,fieldInfoMap:r,globalAttributes:o,expressionAttributes:i,layer:a,text:l.title}),l.caption=s({attributes:t,fieldInfoMap:r,globalAttributes:o,expressionAttributes:i,layer:a,text:l.caption}),l.altText=s({attributes:t,fieldInfoMap:r,globalAttributes:o,expressionAttributes:i,layer:a,text:l.altText}),"image"===l.type){const{value:t}=l;return this._setImageValue({value:t,formattedAttributes:o,layer:a}),l.value.sourceURL?l:void 0}if("pie-chart"===l.type||"line-chart"===l.type||"column-chart"===l.type||"bar-chart"===l.type){const{value:e}=l;return this._setChartValue({value:e,chartType:l.type,attributes:t,formattedAttributes:o,layer:a}),l}return null})).filter(Boolean)}_setImageValue(t){const{fieldInfoMap:e}=this,{value:o,formattedAttributes:i,layer:r}=t,{linkURL:a,sourceURL:s}=o;if(s){const t=l(s,r);o.sourceURL=n({formattedAttributes:i,template:t,fieldInfoMap:e})}if(a){const t=l(a,r);o.linkURL=n({formattedAttributes:i,template:t,fieldInfoMap:e})}}_setChartValue(t){const{value:e,attributes:o,formattedAttributes:i,chartType:r,layer:a}=t,{popupTemplate:s,relatedInfos:l}=this,{fields:n,normalizeField:f}=e;e.fields=d(n,a),f&&(e.normalizeField=p(f,a));if(!n.some((t=>!!(null!=i[t]||u(t)&&l.size))))return;const m=null==s?void 0:s.fieldInfos;n.forEach((t=>{if(u(t))return void(e.series=[...e.series,...this._getRelatedChartInfos({fieldInfos:m,fieldName:t,formattedAttributes:i,chartType:r,value:e})]);const a=this._getChartOption({value:e,attributes:o,chartType:r,formattedAttributes:i,fieldName:t,fieldInfos:m});e.series.push(a)}))}_getRelatedChartInfos(t){var e;const{fieldInfos:o,fieldName:i,formattedAttributes:r,chartType:a,value:s}=t,l=[],n=h(i),{layerId:d,fieldName:p}=n,u=null==(e=this.relatedInfos)?void 0:e.get(d.toString());if(!u)return l;const{relatedFeatures:f,relation:m}=u;if(!m||!f)return l;const{cardinality:c}=m;f.forEach((t=>{const{attributes:e}=t;e&&Object.keys(e).forEach((t=>{t===p&&l.push(this._getChartOption({value:s,attributes:e,formattedAttributes:r,fieldName:i,chartType:a,relatedFieldName:t,fieldInfos:o}))}))}));return"one-to-many"===c||"many-to-many"===c?l:[l[0]]}_getTooltip({label:t,value:e,chartType:o}){return"pie-chart"===o?t:`${t}: ${e}`}_getChartOption(t){var e;const{value:o,attributes:i,formattedAttributes:s,fieldName:l,relatedFieldName:n,fieldInfos:d,chartType:y}=t,{layer:I}=this,{normalizeField:v,tooltipField:b}=o,M=v?u(v)?i[h(v).fieldName]:i[v]:null,g=n&&void 0!==i[n]?i[n]:void 0!==i[l]?i[l]:s[l],A=void 0===g?null:g&&M?g/M:g,_=new a({value:A});if(u(l)){const t=h(l),e=h(b),o=e?e.fieldName:null,r=f(A,{fieldInfos:d,fieldName:n,layer:I,preventPlacesFormatting:!!M}),a=t?t.label||t.fieldName:n,s=o&&void 0!==i[o]?i[o]:a;return _.tooltip=this._getTooltip({label:s,value:r,chartType:y}),_}const x=m(d,l),T=p(l,I),C=b&&void 0!==s[b]?s[b]:c(x||new r({fieldName:T}),null==(e=this.popupTemplate)?void 0:e.expressionInfos),F=s[T];return _.tooltip=this._getTooltip({label:C,value:F,chartType:y}),_}};t([o()],y.prototype,"activeMediaInfoIndex",void 0),t([o({readOnly:!0})],y.prototype,"activeMediaInfo",null),t([o()],y.prototype,"attributes",void 0),t([o()],y.prototype,"description",void 0),t([o()],y.prototype,"fieldInfoMap",void 0),t([o()],y.prototype,"formattedAttributes",void 0),t([o()],y.prototype,"expressionAttributes",void 0),t([o({readOnly:!0})],y.prototype,"formattedMediaInfos",null),t([o()],y.prototype,"layer",void 0),t([o({readOnly:!0})],y.prototype,"formattedMediaInfoCount",null),t([o()],y.prototype,"mediaInfos",void 0),t([o()],y.prototype,"popupTemplate",void 0),t([o()],y.prototype,"relatedInfos",void 0),t([o()],y.prototype,"title",void 0),y=t([i("esri.widgets.Feature.FeatureMedia.FeatureMediaViewModel")],y);const I=y;export{I as default};
5
+ import{_ as t}from"../../../chunks/tslib.es6.js";import e from"../../../core/Accessor.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{cast as o}from"../../../core/accessorSupport/decorators/cast.js";import{subclass as r}from"../../../core/accessorSupport/decorators/subclass.js";import a from"../../../popup/FieldInfo.js";import s from"../../../popup/content/support/ChartMediaInfoValueSeries.js";import{substituteFieldsInLinksAndAttributes as l,fixTokens as n,substituteAttributes as d,getFixedFieldNames as p,getFixedFieldName as u,isRelatedField as f,formatValueToFieldInfo as c,getFieldInfo as m,getFieldInfoLabel as h}from"../support/featureUtils.js";import{getRelatedFieldInfo as y}from"../support/relatedFeatureUtils.js";const v={chartAnimation:!0};let I=class extends e{constructor(t){super(t),this.abilities={...v},this.activeMediaInfoIndex=0,this.attributes=null,this.description=null,this.fieldInfoMap=null,this.formattedAttributes=null,this.expressionAttributes=null,this.layer=null,this.mediaInfos=null,this.popupTemplate=null,this.relatedInfos=null,this.title=null}castAbilities(t){return{...v,...t}}get activeMediaInfo(){return this.formattedMediaInfos[this.activeMediaInfoIndex]||null}get formattedMediaInfos(){return this._formatMediaInfos()||[]}get formattedMediaInfoCount(){return this.formattedMediaInfos.length}setActiveMedia(t){this._setContentElementMedia(t)}next(){this._pageContentElementMedia(1)}previous(){this._pageContentElementMedia(-1)}_setContentElementMedia(t){const{formattedMediaInfoCount:e}=this,i=(t+e)%e;this.activeMediaInfoIndex=i}_pageContentElementMedia(t){const{activeMediaInfoIndex:e}=this,i=e+t;this._setContentElementMedia(i)}_formatMediaInfos(){const{attributes:t,mediaInfos:e,formattedAttributes:i,expressionAttributes:o,fieldInfoMap:r,layer:a}=this;return null==e?void 0:e.map((e=>{const s=null==e?void 0:e.clone();if(!s)return null;if(s.title=l({attributes:t,fieldInfoMap:r,globalAttributes:i,expressionAttributes:o,layer:a,text:s.title}),s.caption=l({attributes:t,fieldInfoMap:r,globalAttributes:i,expressionAttributes:o,layer:a,text:s.caption}),s.altText=l({attributes:t,fieldInfoMap:r,globalAttributes:i,expressionAttributes:o,layer:a,text:s.altText}),"image"===s.type){const{value:t}=s;return this._setImageValue({value:t,formattedAttributes:i,layer:a}),s.value.sourceURL?s:void 0}if("pie-chart"===s.type||"line-chart"===s.type||"column-chart"===s.type||"bar-chart"===s.type){const{value:e}=s;return this._setChartValue({value:e,chartType:s.type,attributes:t,formattedAttributes:i,layer:a}),s}return null})).filter(Boolean)}_setImageValue(t){const{fieldInfoMap:e}=this,{value:i,formattedAttributes:o,layer:r}=t,{linkURL:a,sourceURL:s}=i;if(s){const t=n(s,r);i.sourceURL=d({formattedAttributes:o,template:t,fieldInfoMap:e})}if(a){const t=n(a,r);i.linkURL=d({formattedAttributes:o,template:t,fieldInfoMap:e})}}_setChartValue(t){const{value:e,attributes:i,formattedAttributes:o,chartType:r,layer:a}=t,{popupTemplate:s,relatedInfos:l}=this,{fields:n,normalizeField:d}=e;e.fields=p(n,a),d&&(e.normalizeField=u(d,a));if(!n.some((t=>!!(null!=o[t]||f(t)&&l.size))))return;const c=null==s?void 0:s.fieldInfos;n.forEach((t=>{if(f(t))return void(e.series=[...e.series,...this._getRelatedChartInfos({fieldInfos:c,fieldName:t,formattedAttributes:o,chartType:r,value:e})]);const a=this._getChartOption({value:e,attributes:i,chartType:r,formattedAttributes:o,fieldName:t,fieldInfos:c});e.series.push(a)}))}_getRelatedChartInfos(t){var e;const{fieldInfos:i,fieldName:o,formattedAttributes:r,chartType:a,value:s}=t,l=[],n=y(o),{layerId:d,fieldName:p}=n,u=null==(e=this.relatedInfos)?void 0:e.get(d.toString());if(!u)return l;const{relatedFeatures:f,relation:c}=u;if(!c||!f)return l;const{cardinality:m}=c;f.forEach((t=>{const{attributes:e}=t;e&&Object.keys(e).forEach((t=>{t===p&&l.push(this._getChartOption({value:s,attributes:e,formattedAttributes:r,fieldName:o,chartType:a,relatedFieldName:t,fieldInfos:i}))}))}));return"one-to-many"===m||"many-to-many"===m?l:[l[0]]}_getTooltip({label:t,value:e,chartType:i}){return"pie-chart"===i?t:`${t}: ${e}`}_getChartOption(t){var e;const{value:i,attributes:o,formattedAttributes:r,fieldName:l,relatedFieldName:n,fieldInfos:d,chartType:p}=t,{layer:v}=this,{normalizeField:I,tooltipField:b}=i,M=I?f(I)?o[y(I).fieldName]:o[I]:null,A=n&&void 0!==o[n]?o[n]:void 0!==o[l]?o[l]:r[l],g=void 0===A?null:A&&M?A/M:A,_=new s({value:g});if(f(l)){const t=y(l),e=y(b),i=e?e.fieldName:null,r=c(g,{fieldInfos:d,fieldName:n,layer:v,preventPlacesFormatting:!!M}),a=t?t.label||t.fieldName:n,s=i&&void 0!==o[i]?o[i]:a;return _.tooltip=this._getTooltip({label:s,value:r,chartType:p}),_}const x=m(d,l),T=u(l,v),C=b&&void 0!==r[b]?r[b]:h(x||new a({fieldName:T}),null==(e=this.popupTemplate)?void 0:e.expressionInfos),F=r[T];return _.tooltip=this._getTooltip({label:C,value:F,chartType:p}),_}};t([i()],I.prototype,"abilities",void 0),t([o("abilities")],I.prototype,"castAbilities",null),t([i()],I.prototype,"activeMediaInfoIndex",void 0),t([i({readOnly:!0})],I.prototype,"activeMediaInfo",null),t([i()],I.prototype,"attributes",void 0),t([i()],I.prototype,"description",void 0),t([i()],I.prototype,"fieldInfoMap",void 0),t([i()],I.prototype,"formattedAttributes",void 0),t([i()],I.prototype,"expressionAttributes",void 0),t([i({readOnly:!0})],I.prototype,"formattedMediaInfos",null),t([i()],I.prototype,"layer",void 0),t([i({readOnly:!0})],I.prototype,"formattedMediaInfoCount",null),t([i()],I.prototype,"mediaInfos",void 0),t([i()],I.prototype,"popupTemplate",void 0),t([i()],I.prototype,"relatedInfos",void 0),t([i()],I.prototype,"title",void 0),I=t([r("esri.widgets.Feature.FeatureMedia.FeatureMediaViewModel")],I);const b=I;export{b as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import{eventKey as t}from"../../core/events.js";import{init as i}from"../../core/watchUtils.js";import{aliasOf as r}from"../../core/accessorSupport/decorators/aliasOf.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";import s from"../Widget.js";import n from"./FeatureMedia/FeatureMediaViewModel.js";import l from"./support/FeatureElementInfo.js";import{shouldOpenInNewTab as d}from"./support/featureUtils.js";import{loadChartsModule as c,getColorSet as m}from"../support/chartUtils.js";import{isRTL as u}from"../support/widgetUtils.js";import{messageBundle as h}from"../support/decorators/messageBundle.js";import"../../core/Logger.js";import{tsx as p}from"../support/jsxFactory.js";import{isDarkTheme as f}from"../support/widgetThemeUtils.js";const v={base:"esri-feature-media",mediaContainer:"esri-feature-media__container",mediaItemContainer:"esri-feature-media__item-container",mediaItem:"esri-feature-media__item",mediaItemTitle:"esri-feature-media__item-title",mediaItemCaption:"esri-feature-media__item-caption",mediaPrevious:"esri-feature-media__previous",mediaPreviousIconLTR:"esri-feature-media__previous-icon",mediaPreviousIconRTL:"esri-feature-media__previous-icon--rtl",mediaNext:"esri-feature-media__next",mediaNextIconLTR:"esri-feature-media__next-icon",mediaNextIconRTL:"esri-feature-media__next-icon--rtl",mediaChart:"esri-feature-media__chart",mediaButton:"esri-feature-media__button",mediaIcon:"esri-feature-media__icon",iconLeftTriangleArrow:"esri-icon-left-triangle-arrow",iconRightTriangleArrow:"esri-icon-right-triangle-arrow"},_=.05,I=.95,M=15;let w=class extends s{constructor(e,t){super(e,t),this._refreshTimer=null,this._refreshIntervalInfo=null,this._featureElementInfo=null,this.attributes=null,this.activeMediaInfoIndex=null,this.description=null,this.fieldInfoMap=null,this.layer=null,this.mediaInfos=null,this.popupTemplate=null,this.relatedInfos=null,this.title=null,this.viewModel=new n,this.messages=null,this._getChartDependencies=async e=>{const t=await c(),{destroyed:i,viewModel:r}=this;if(i||!r||!e)return;const{activeMediaInfo:a}=r;this._renderChart({chartDiv:e,mediaInfo:a,chartsModule:t})}}initialize(){this._featureElementInfo=new l,this.own(i(this,["viewModel.activeMediaInfo","viewModel.activeMediaInfoIndex"],(()=>this._setupMediaRefreshTimer())),i(this,["viewModel.description","viewModel.title"],(()=>this._setupFeatureElementInfo())))}destroy(){this._clearMediaRefreshTimer(),this._featureElementInfo.destroy()}render(){var e;return p("div",{bind:this,class:v.base,onkeyup:this._handleMediaKeyup},null==(e=this._featureElementInfo)?void 0:e.render(),this.renderMedia())}renderMedia(){const{formattedMediaInfoCount:e}=this.viewModel;return e?p("div",{key:"media-element-container",class:v.mediaContainer},this.renderMediaPageButton("previous"),this.renderMediaInfo(),this.renderMediaPageButton("next")):null}renderImageMediaInfo(e){const{_refreshIntervalInfo:t}=this,{activeMediaInfoIndex:i,formattedMediaInfoCount:r}=this.viewModel,{value:a,refreshInterval:o,altText:s,title:n,type:l}=e,{sourceURL:c,linkURL:m}=a,u=d(m)?"_blank":"_self",h="_blank"===u?"noreferrer":"",f=o?t:null,v=f?f.timestamp:0,_=f?f.sourceURL:c,I=p("img",{alt:s||n,key:`media-${l}-${i}-${r}-${v}`,src:_}),M=m?p("a",{title:n,href:m,rel:h,target:u},I):null;return M||I}renderChartMediaInfo(e){const{activeMediaInfoIndex:t,formattedMediaInfoCount:i}=this.viewModel;return p("div",{key:`media-${e.type}-${t}-${i}`,bind:this,class:v.mediaChart,afterCreate:this._getChartDependencies})}renderMediaInfoType(){const{activeMediaInfo:e}=this.viewModel;return e?"image"===e.type?this.renderImageMediaInfo(e):-1!==e.type.indexOf("chart")?this.renderChartMediaInfo(e):null:null}renderMediaInfo(){const{activeMediaInfo:e}=this.viewModel;if(!e)return null;const t=e.title?p("div",{key:"media-title",class:v.mediaItemTitle,innerHTML:e.title}):null,i=e.caption?p("div",{key:"media-caption",class:v.mediaItemCaption,innerHTML:e.caption}):null;return p("div",{key:"media-container",class:v.mediaItemContainer},p("div",{key:"media-item-container",class:v.mediaItem},this.renderMediaInfoType()),t,i)}renderMediaPageButton(e){if(this.viewModel.formattedMediaInfoCount<2)return null;const t="previous"===e,i=t?this.messages.previous:this.messages.next,r=t?this.classes(v.mediaButton,v.mediaPrevious):this.classes(v.mediaButton,v.mediaNext),a=t?this.classes(v.mediaIcon,v.mediaPreviousIconLTR,v.iconLeftTriangleArrow):this.classes(v.mediaIcon,v.mediaNextIconLTR,v.iconRightTriangleArrow),o=t?this.classes(v.mediaIcon,v.mediaPreviousIconRTL,v.iconRightTriangleArrow):this.classes(v.mediaIcon,v.mediaNextIconRTL,v.iconLeftTriangleArrow),s=t?"media-previous":"media-next",n=t?this._previous:this._next;return p("button",{type:"button",key:s,title:i,"aria-label":i,tabIndex:0,class:r,bind:this,onclick:n},p("span",{"aria-hidden":"true",class:a}),p("span",{"aria-hidden":"true",class:o}))}_setupFeatureElementInfo(){const{description:e,title:t}=this;this._featureElementInfo.set({description:e,title:t})}_next(){this.viewModel.next()}_previous(){this.viewModel.previous()}_handleMediaKeyup(e){const i=t(e);"ArrowLeft"===i&&(e.stopPropagation(),this.viewModel.previous()),"ArrowRight"===i&&(e.stopPropagation(),this.viewModel.next())}_renderChart(e){const{chartsModule:t,chartDiv:i,mediaInfo:r}=e,{value:a,type:o}=r,{am4core:s}=t,n=m(s);function l(e){e instanceof s.ColorSet&&n&&(e.list=n)}f()&&s.useTheme(t.am4themes_dark),s.useTheme(t.am4themes_animated),s.useTheme(l);const d="pie-chart"===o?this._createPieChart(e):this._createXYChart(e);i.setAttribute("aria-label",r.altText||r.title),d.data=a.series.map((e=>({tooltip:e.tooltip,value:e.value}))).filter((e=>"pie-chart"!==o||e.value>0))}_customizeChartTooltip(e,t){e.label.wrap=!0,e.label.maxWidth=200,e.autoTextColor=!1,e.getFillFromObject=!1,e.label.fill=t.color("#ffffff"),e.background.fill=t.color({r:0,g:0,b:0,a:.7})}_createPieChart(e){const{chartDiv:t,chartsModule:i}=e,{am4core:r,am4charts:a}=i,o=r.create(t,a.PieChart);o.rtl=u(this.container);const s=o.series.push(new a.PieSeries);return s.labels.template.disabled=!0,s.ticks.template.disabled=!0,s.dataFields.value="value",s.dataFields.category="tooltip",this._customizeChartTooltip(s.tooltip,r),o}_getMinSeriesValue(e){let t=0;return e.forEach((e=>t=Math.min(e.value,t))),t}_createColumnChart(e,t){const{chartsModule:i,mediaInfo:r}=t,{value:a}=r,{am4core:o,am4charts:s}=i,n=e.xAxes.push(new s.CategoryAxis);n.dataFields.category="tooltip",n.renderer.labels.template.disabled=!0,this._customizeChartTooltip(n.tooltip,o),n.tooltip.events.on("sizechanged",(()=>{n.tooltip.dy=-n.tooltip.contentHeight}));const l=e.yAxes.push(new s.ValueAxis),d=l.renderer.labels.template;l.renderer.minLabelPosition=_,l.renderer.maxLabelPosition=I,l.min=this._getMinSeriesValue(a.series),this._customizeChartTooltip(l.tooltip,o),d.wrap=!0;const c=e.series.push(new s.ColumnSeries);c.dataFields.valueY="value",c.dataFields.categoryX="tooltip",e.cursor=new s.XYCursor,a.series.length>M&&(e.scrollbarX=new o.Scrollbar)}_createBarChart(e,t){const{chartsModule:i,mediaInfo:r}=t,{value:a}=r,{am4core:o,am4charts:s}=i,n=e.yAxes.push(new s.CategoryAxis);n.dataFields.category="tooltip",n.renderer.inversed=!0,n.renderer.labels.template.disabled=!0,this._customizeChartTooltip(n.tooltip,o),n.tooltip.events.on("sizechanged",(()=>{n.tooltip.dx=n.tooltip.contentWidth}));const l=e.xAxes.push(new s.ValueAxis),d=l.renderer.labels.template;l.renderer.minLabelPosition=_,l.renderer.maxLabelPosition=I,l.min=this._getMinSeriesValue(a.series),this._customizeChartTooltip(l.tooltip,o),d.wrap=!0;const c=e.series.push(new s.ColumnSeries);c.dataFields.valueX="value",c.dataFields.categoryY="tooltip",e.cursor=new s.XYCursor,a.series.length>M&&(e.scrollbarY=new o.Scrollbar)}_createLineChart(e,t){const{chartsModule:i,mediaInfo:r}=t,{value:a}=r,{am4core:o,am4charts:s}=i,n=e.xAxes.push(new s.CategoryAxis);n.dataFields.category="tooltip",n.renderer.labels.template.disabled=!0,this._customizeChartTooltip(n.tooltip,o),n.tooltip.events.on("sizechanged",(()=>{n.tooltip.dy=-n.tooltip.contentHeight}));const l=e.yAxes.push(new s.ValueAxis),d=l.renderer.labels.template;l.renderer.minLabelPosition=_,l.renderer.maxLabelPosition=I,l.min=this._getMinSeriesValue(a.series),this._customizeChartTooltip(l.tooltip,o),d.wrap=!0;const c=e.series.push(new s.LineSeries);c.dataFields.categoryX="tooltip",c.dataFields.valueY="value",e.cursor=new s.XYCursor,a.series.length>M&&(e.scrollbarX=new o.Scrollbar)}_createXYChart(e){const{chartDiv:t,chartsModule:i,mediaInfo:r}=e,{type:a}=r,{am4core:o,am4charts:s}=i,n=o.create(t,s.XYChart);return n.rtl=u(this.container),"column-chart"===a&&this._createColumnChart(n,e),"bar-chart"===a&&this._createBarChart(n,e),"line-chart"===a&&this._createLineChart(n,e),n}_clearMediaRefreshTimer(){const{_refreshTimer:e}=this;e&&(clearTimeout(e),this._refreshTimer=null)}_updateMediaInfoTimestamp(e){const t=Date.now();this._refreshIntervalInfo={timestamp:t,sourceURL:this._getImageSource(e,t)},this.scheduleRender()}_setupMediaRefreshTimer(){this._clearMediaRefreshTimer();const{activeMediaInfo:e}=this.viewModel;e&&"image"===e.type&&e.refreshInterval&&this._setRefreshTimeout(e)}_setRefreshTimeout(e){const{refreshInterval:t,value:i}=e;if(!t)return;const r=6e4*t;this._updateMediaInfoTimestamp(i.sourceURL);const a=setInterval((()=>{this._updateMediaInfoTimestamp(i.sourceURL)}),r);this._refreshTimer=a}_getImageSource(e,t){const i=-1!==e.indexOf("?")?"&":"?",[r,a=""]=e.split("#");return`${r}${i}timestamp=${t}${a?"#":""}${a}`}};e([r("viewModel.attributes")],w.prototype,"attributes",void 0),e([r("viewModel.activeMediaInfoIndex")],w.prototype,"activeMediaInfoIndex",void 0),e([r("viewModel.description")],w.prototype,"description",void 0),e([r("viewModel.fieldInfoMap")],w.prototype,"fieldInfoMap",void 0),e([r("viewModel.layer")],w.prototype,"layer",void 0),e([r("viewModel.mediaInfos")],w.prototype,"mediaInfos",void 0),e([r("viewModel.popupTemplate")],w.prototype,"popupTemplate",void 0),e([r("viewModel.relatedInfos")],w.prototype,"relatedInfos",void 0),e([r("viewModel.title")],w.prototype,"title",void 0),e([a({type:n})],w.prototype,"viewModel",void 0),e([a(),h("esri/widgets/Feature/t9n/Feature")],w.prototype,"messages",void 0),w=e([o("esri.widgets.Feature.FeatureMedia")],w);const g=w;export{g as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import{eventKey as t}from"../../core/events.js";import{init as i}from"../../core/watchUtils.js";import{aliasOf as r}from"../../core/accessorSupport/decorators/aliasOf.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";import s from"../Widget.js";import n from"./FeatureMedia/FeatureMediaViewModel.js";import l from"./support/FeatureElementInfo.js";import{shouldOpenInNewTab as d}from"./support/featureUtils.js";import{loadChartsModule as c,getColorSet as m}from"../support/chartUtils.js";import{isRTL as u}from"../support/widgetUtils.js";import{messageBundle as h}from"../support/decorators/messageBundle.js";import"../../core/Logger.js";import{tsx as p}from"../support/jsxFactory.js";import{isDarkTheme as f}from"../support/widgetThemeUtils.js";const v={base:"esri-feature-media",mediaContainer:"esri-feature-media__container",mediaItemContainer:"esri-feature-media__item-container",mediaItem:"esri-feature-media__item",mediaItemTitle:"esri-feature-media__item-title",mediaItemCaption:"esri-feature-media__item-caption",mediaPrevious:"esri-feature-media__previous",mediaPreviousIconLTR:"esri-feature-media__previous-icon",mediaPreviousIconRTL:"esri-feature-media__previous-icon--rtl",mediaNext:"esri-feature-media__next",mediaNextIconLTR:"esri-feature-media__next-icon",mediaNextIconRTL:"esri-feature-media__next-icon--rtl",mediaChart:"esri-feature-media__chart",mediaButton:"esri-feature-media__button",mediaIcon:"esri-feature-media__icon",iconLeftTriangleArrow:"esri-icon-left-triangle-arrow",iconRightTriangleArrow:"esri-icon-right-triangle-arrow"},_=.05,I=.95,M=15;let w=class extends s{constructor(e,t){super(e,t),this._refreshTimer=null,this._refreshIntervalInfo=null,this._featureElementInfo=null,this.attributes=null,this.activeMediaInfoIndex=null,this.description=null,this.fieldInfoMap=null,this.layer=null,this.mediaInfos=null,this.popupTemplate=null,this.relatedInfos=null,this.title=null,this.viewModel=new n,this.messages=null,this._getChartDependencies=async e=>{const t=await c(),{destroyed:i,viewModel:r}=this;if(i||!r||!e)return;const{activeMediaInfo:a}=r;this._renderChart({chartDiv:e,mediaInfo:a,chartsModule:t})}}initialize(){this._featureElementInfo=new l,this.own(i(this,["viewModel.activeMediaInfo","viewModel.activeMediaInfoIndex"],(()=>this._setupMediaRefreshTimer())),i(this,["viewModel.description","viewModel.title"],(()=>this._setupFeatureElementInfo())))}destroy(){this._clearMediaRefreshTimer(),this._featureElementInfo.destroy()}render(){var e;return p("div",{bind:this,class:v.base,onkeyup:this._handleMediaKeyup},null==(e=this._featureElementInfo)?void 0:e.render(),this.renderMedia())}renderMedia(){const{formattedMediaInfoCount:e}=this.viewModel;return e?p("div",{key:"media-element-container",class:v.mediaContainer},this.renderMediaPageButton("previous"),this.renderMediaInfo(),this.renderMediaPageButton("next")):null}renderImageMediaInfo(e){const{_refreshIntervalInfo:t}=this,{activeMediaInfoIndex:i,formattedMediaInfoCount:r}=this.viewModel,{value:a,refreshInterval:o,altText:s,title:n,type:l}=e,{sourceURL:c,linkURL:m}=a,u=d(m)?"_blank":"_self",h="_blank"===u?"noreferrer":"",f=o?t:null,v=f?f.timestamp:0,_=f?f.sourceURL:c,I=p("img",{alt:s||n,key:`media-${l}-${i}-${r}-${v}`,src:_}),M=m?p("a",{title:n,href:m,rel:h,target:u},I):null;return M||I}renderChartMediaInfo(e){const{activeMediaInfoIndex:t,formattedMediaInfoCount:i}=this.viewModel;return p("div",{key:`media-${e.type}-${t}-${i}`,bind:this,class:v.mediaChart,afterCreate:this._getChartDependencies})}renderMediaInfoType(){const{activeMediaInfo:e}=this.viewModel;return e?"image"===e.type?this.renderImageMediaInfo(e):-1!==e.type.indexOf("chart")?this.renderChartMediaInfo(e):null:null}renderMediaInfo(){const{activeMediaInfo:e}=this.viewModel;if(!e)return null;const t=e.title?p("div",{key:"media-title",class:v.mediaItemTitle,innerHTML:e.title}):null,i=e.caption?p("div",{key:"media-caption",class:v.mediaItemCaption,innerHTML:e.caption}):null;return p("div",{key:"media-container",class:v.mediaItemContainer},p("div",{key:"media-item-container",class:v.mediaItem},this.renderMediaInfoType()),t,i)}renderMediaPageButton(e){if(this.viewModel.formattedMediaInfoCount<2)return null;const t="previous"===e,i=t?this.messages.previous:this.messages.next,r=t?this.classes(v.mediaButton,v.mediaPrevious):this.classes(v.mediaButton,v.mediaNext),a=t?this.classes(v.mediaIcon,v.mediaPreviousIconLTR,v.iconLeftTriangleArrow):this.classes(v.mediaIcon,v.mediaNextIconLTR,v.iconRightTriangleArrow),o=t?this.classes(v.mediaIcon,v.mediaPreviousIconRTL,v.iconRightTriangleArrow):this.classes(v.mediaIcon,v.mediaNextIconRTL,v.iconLeftTriangleArrow),s=t?"media-previous":"media-next",n=t?this._previous:this._next;return p("button",{type:"button",key:s,title:i,"aria-label":i,tabIndex:0,class:r,bind:this,onclick:n},p("span",{"aria-hidden":"true",class:a}),p("span",{"aria-hidden":"true",class:o}))}_setupFeatureElementInfo(){const{description:e,title:t}=this;this._featureElementInfo.set({description:e,title:t})}_next(){this.viewModel.next()}_previous(){this.viewModel.previous()}_handleMediaKeyup(e){const i=t(e);"ArrowLeft"===i&&(e.stopPropagation(),this.viewModel.previous()),"ArrowRight"===i&&(e.stopPropagation(),this.viewModel.next())}_renderChart(e){const{abilities:t}=this.viewModel,{chartsModule:i,chartDiv:r,mediaInfo:a}=e,{value:o,type:s}=a,{am4core:n}=i,l=m(n);function d(e){e instanceof n.ColorSet&&l&&(e.list=l)}f()&&n.useTheme(i.am4themes_dark);const c=window.matchMedia("(prefers-reduced-motion: reduce)");t.chartAnimation&&!c.matches?n.useTheme(i.am4themes_animated):n.unuseTheme(i.am4themes_animated),n.useTheme(d);const u="pie-chart"===s?this._createPieChart(e):this._createXYChart(e);r.setAttribute("aria-label",a.altText||a.title),u.data=o.series.map((e=>({tooltip:e.tooltip,value:e.value}))).filter((e=>"pie-chart"!==s||e.value>0))}_customizeChartTooltip(e,t){e.label.wrap=!0,e.label.maxWidth=200,e.autoTextColor=!1,e.getFillFromObject=!1,e.label.fill=t.color("#ffffff"),e.background.fill=t.color({r:0,g:0,b:0,a:.7})}_createPieChart(e){const{chartDiv:t,chartsModule:i}=e,{am4core:r,am4charts:a}=i,o=r.create(t,a.PieChart);o.rtl=u(this.container);const s=o.series.push(new a.PieSeries);return s.labels.template.disabled=!0,s.ticks.template.disabled=!0,s.dataFields.value="value",s.dataFields.category="tooltip",this._customizeChartTooltip(s.tooltip,r),o}_getMinSeriesValue(e){let t=0;return e.forEach((e=>t=Math.min(e.value,t))),t}_createColumnChart(e,t){const{chartsModule:i,mediaInfo:r}=t,{value:a}=r,{am4core:o,am4charts:s}=i,n=e.xAxes.push(new s.CategoryAxis);n.dataFields.category="tooltip",n.renderer.labels.template.disabled=!0,this._customizeChartTooltip(n.tooltip,o),n.tooltip.events.on("sizechanged",(()=>{n.tooltip.dy=-n.tooltip.contentHeight}));const l=e.yAxes.push(new s.ValueAxis),d=l.renderer.labels.template;l.renderer.minLabelPosition=_,l.renderer.maxLabelPosition=I,l.min=this._getMinSeriesValue(a.series),this._customizeChartTooltip(l.tooltip,o),d.wrap=!0;const c=e.series.push(new s.ColumnSeries);c.dataFields.valueY="value",c.dataFields.categoryX="tooltip",e.cursor=new s.XYCursor,a.series.length>M&&(e.scrollbarX=new o.Scrollbar)}_createBarChart(e,t){const{chartsModule:i,mediaInfo:r}=t,{value:a}=r,{am4core:o,am4charts:s}=i,n=e.yAxes.push(new s.CategoryAxis);n.dataFields.category="tooltip",n.renderer.inversed=!0,n.renderer.labels.template.disabled=!0,this._customizeChartTooltip(n.tooltip,o),n.tooltip.events.on("sizechanged",(()=>{n.tooltip.dx=n.tooltip.contentWidth}));const l=e.xAxes.push(new s.ValueAxis),d=l.renderer.labels.template;l.renderer.minLabelPosition=_,l.renderer.maxLabelPosition=I,l.min=this._getMinSeriesValue(a.series),this._customizeChartTooltip(l.tooltip,o),d.wrap=!0;const c=e.series.push(new s.ColumnSeries);c.dataFields.valueX="value",c.dataFields.categoryY="tooltip",e.cursor=new s.XYCursor,a.series.length>M&&(e.scrollbarY=new o.Scrollbar)}_createLineChart(e,t){const{chartsModule:i,mediaInfo:r}=t,{value:a}=r,{am4core:o,am4charts:s}=i,n=e.xAxes.push(new s.CategoryAxis);n.dataFields.category="tooltip",n.renderer.labels.template.disabled=!0,this._customizeChartTooltip(n.tooltip,o),n.tooltip.events.on("sizechanged",(()=>{n.tooltip.dy=-n.tooltip.contentHeight}));const l=e.yAxes.push(new s.ValueAxis),d=l.renderer.labels.template;l.renderer.minLabelPosition=_,l.renderer.maxLabelPosition=I,l.min=this._getMinSeriesValue(a.series),this._customizeChartTooltip(l.tooltip,o),d.wrap=!0;const c=e.series.push(new s.LineSeries);c.dataFields.categoryX="tooltip",c.dataFields.valueY="value",e.cursor=new s.XYCursor,a.series.length>M&&(e.scrollbarX=new o.Scrollbar)}_createXYChart(e){const{chartDiv:t,chartsModule:i,mediaInfo:r}=e,{type:a}=r,{am4core:o,am4charts:s}=i,n=o.create(t,s.XYChart);return n.rtl=u(this.container),"column-chart"===a&&this._createColumnChart(n,e),"bar-chart"===a&&this._createBarChart(n,e),"line-chart"===a&&this._createLineChart(n,e),n}_clearMediaRefreshTimer(){const{_refreshTimer:e}=this;e&&(clearTimeout(e),this._refreshTimer=null)}_updateMediaInfoTimestamp(e){const t=Date.now();this._refreshIntervalInfo={timestamp:t,sourceURL:this._getImageSource(e,t)},this.scheduleRender()}_setupMediaRefreshTimer(){this._clearMediaRefreshTimer();const{activeMediaInfo:e}=this.viewModel;e&&"image"===e.type&&e.refreshInterval&&this._setRefreshTimeout(e)}_setRefreshTimeout(e){const{refreshInterval:t,value:i}=e;if(!t)return;const r=6e4*t;this._updateMediaInfoTimestamp(i.sourceURL);const a=setInterval((()=>{this._updateMediaInfoTimestamp(i.sourceURL)}),r);this._refreshTimer=a}_getImageSource(e,t){const i=-1!==e.indexOf("?")?"&":"?",[r,a=""]=e.split("#");return`${r}${i}timestamp=${t}${a?"#":""}${a}`}};e([r("viewModel.attributes")],w.prototype,"attributes",void 0),e([r("viewModel.activeMediaInfoIndex")],w.prototype,"activeMediaInfoIndex",void 0),e([r("viewModel.description")],w.prototype,"description",void 0),e([r("viewModel.fieldInfoMap")],w.prototype,"fieldInfoMap",void 0),e([r("viewModel.layer")],w.prototype,"layer",void 0),e([r("viewModel.mediaInfos")],w.prototype,"mediaInfos",void 0),e([r("viewModel.popupTemplate")],w.prototype,"popupTemplate",void 0),e([r("viewModel.relatedInfos")],w.prototype,"relatedInfos",void 0),e([r("viewModel.title")],w.prototype,"title",void 0),e([a({type:n})],w.prototype,"viewModel",void 0),e([a(),h("esri/widgets/Feature/t9n/Feature")],w.prototype,"messages",void 0),w=e([o("esri.widgets.Feature.FeatureMedia")],w);const g=w;export{g as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import{FeatureSetQueryInterceptor as r}from"../../arcade/featureset/support/FeatureSetQueryInterceptor.js";import i from"../../core/Accessor.js";import o from"../../core/Handles.js";import s from"../../core/Logger.js";import{isSome as n}from"../../core/maybe.js";import{isAbortError as a,eachAlways as l}from"../../core/promiseUtils.js";import{throttle as p}from"../../core/throttle.js";import{init as c}from"../../core/watchUtils.js";import{property as d}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{cast as u}from"../../core/accessorSupport/decorators/cast.js";import{subclass as f}from"../../core/accessorSupport/decorators/subclass.js";import h from"../../popup/content/TextContent.js";import m from"./FeatureAttachments/FeatureAttachmentsViewModel.js";import _ from"./FeatureContent/FeatureContentViewModel.js";import y from"./FeatureExpression/FeatureExpressionViewModel.js";import b from"./FeatureFields/FeatureFieldsViewModel.js";import g from"./FeatureMedia/FeatureMediaViewModel.js";import{createCompiledExpressions as I}from"./support/arcadeFeatureUtils.js";import{preLayerQueryCallback as A,preRequestCallback as v,createfieldInfoMap as M,getAllFieldInfos as x,getSourceLayer as w,substituteFieldsInLinksAndAttributes as C,isExpressionField as F,isRelatedField as E,formatEditInfo as T,graphicCallback as V,queryUpdatedFeature as P,formatAttributes as j}from"./support/featureUtils.js";import{queryLayerInfos as L,queryRelatedFeatures as R,setRelatedFeatures as O,getRelatedFieldInfo as S,createRelatedInfo as k,updateRelatedInfo as U}from"./support/relatedFeatureUtils.js";var N;const q=1,D="content-view-models",Q="esri.widgets.FeatureViewModel",B=s.getLogger(Q),G={attachmentsContent:!0,customContent:!0,expressionContent:!0,fieldsContent:!0,mediaContent:!0,textContent:!0};let H=N=class extends i{constructor(e){super(e),this._handles=new o,this._error=null,this._featureAbortController=null,this.graphicChangedThrottled=p(this._graphicChanged,q,this),this._expressionAttributes=null,this._graphicExpressionAttributes=null,this.abilities={...G},this.content=null,this.contentViewModels=[],this.defaultPopupTemplateEnabled=!1,this.formattedAttributes=null,this.lastEditInfo=null,this.relatedInfos=new Map,this.title="",this.view=null,this._isAllowedContentType=e=>{const{abilities:t}=this;return"attachments"===e.type&&t.attachmentsContent||"custom"===e.type&&t.customContent||"fields"===e.type&&t.fieldsContent||"media"===e.type&&t.mediaContent||"text"===e.type&&t.textContent||"expression"===e.type&&t.expressionContent},this._handles.add(c(this,["graphic","_effectivePopupTemplate","abilities"],(()=>this.graphicChangedThrottled())))}destroy(){this._clear(),this._cancelFeatureQuery(),this._error=null,this._handles.destroy(),this._handles=null,this.graphic=null,this._destroyContentViewModels(),this.relatedInfos.clear()}get _effectivePopupTemplate(){return n(this.graphic)?this.graphic.getEffectivePopupTemplate(this.defaultPopupTemplateEnabled):null}get _fieldInfoMap(){return M(x(this._effectivePopupTemplate),this._sourceLayer)}get _sourceLayer(){return w(this.graphic)}castAbilities(e){return{...G,...e}}get state(){return this.graphic?this._error?"error":this.waitingForContent?"loading":"ready":"disabled"}set graphic(e){this._set("graphic",e?e.clone():null)}get spatialReference(){return this.get("view.spatialReference")||null}set spatialReference(e){void 0!==e?this._override("spatialReference",e):this._clearOverride("spatialReference")}get map(){return this.get("view.map")||null}set map(e){void 0!==e?this._override("map",e):this._clearOverride("map")}get waitingForContent(){return!!this._featureAbortController}setActiveMedia(e,t){const r=this.contentViewModels[e];r instanceof g&&r.setActiveMedia(t)}nextMedia(e){const t=this.contentViewModels[e];t instanceof g&&t.next()}previousMedia(e){const t=this.contentViewModels[e];t instanceof g&&t.previous()}_clear(){this._set("title",""),this._set("content",null),this._set("formattedAttributes",null)}async _graphicChanged(){this._cancelFeatureQuery(),this._error=null,this._clear();const{graphic:e}=this;if(!e)return;const t=new AbortController;this._featureAbortController=t;try{await this._queryFeature({signal:t.signal})}catch(r){a(r)||(this._error=r,B.error("error","The popupTemplate could not be displayed for this feature.",{error:r,graphic:e,popupTemplate:this._effectivePopupTemplate}))}this._featureAbortController===t&&(this._featureAbortController=null)}_cancelFeatureQuery(){const{_featureAbortController:e}=this;e&&e.abort(),this._featureAbortController=null}_compileContentElement(e,t){return"attachments"===e.type?this._compileAttachments(e,t):"custom"===e.type?this._compileCustom(e,t):"fields"===e.type?this._compileFields(e,t):"media"===e.type?this._compileMedia(e,t):"text"===e.type?this._compileText(e,t):"expression"===e.type?this._compileExpression(e,t):void 0}_compileContent(e){if(this._destroyContentViewModels(),this.graphic)return Array.isArray(e)?e.filter(this._isAllowedContentType).map(((e,t)=>this._compileContentElement(e,t))):"string"==typeof e?this._compileText(new h({text:e}),0).text:e}_destroyContentViewModels(){var e;null==(e=this._handles)||e.remove(D),this.contentViewModels.forEach((e=>e&&!e.destroyed&&e.destroy())),this._set("contentViewModels",[])}_setExpressionContentVM(e,t){const{formattedAttributes:r}=this,{contentElement:i,contentElementViewModel:o}=e,s=null==i?void 0:i.type;o&&s&&("fields"===s&&(this._createFieldsFormattedAttributes({contentElement:i,contentElementIndex:t,formattedAttributes:r}),o.set(this._createFieldsVMParams(i,t))),"media"===s&&(this._createMediaFormattedAttributes({contentElement:i,contentElementIndex:t,formattedAttributes:r}),o.set(this._createMediaVMParams(i,t))),"text"===s&&o.set(this._createTextVMParams(i)))}_compileExpression(e,t){const{expressionInfo:r}=e,{graphic:i,map:o,spatialReference:s,view:n}=this,a=new y({expressionInfo:r,graphic:i,interceptor:N.interceptor,map:o,spatialReference:s,view:n});return this.contentViewModels[t]=a,this._handles.add(c(a,"contentElementViewModel",(()=>this._setExpressionContentVM(a,t))),D),e}_compileAttachments(e,t){const{graphic:r}=this,{description:i,title:o}=e;return this.contentViewModels[t]=new m({graphic:r,...this._compileTitleAndDesc({title:o,description:i})}),e}_compileCustom(e,t){const{graphic:r}=this,{creator:i,destroyer:o}=e;return this.contentViewModels[t]=new _({graphic:r,creator:i,destroyer:o}),e}_compileTitleAndDesc({title:e,description:t}){const{_fieldInfoMap:r,_sourceLayer:i,graphic:o,formattedAttributes:s,_expressionAttributes:n}=this,{attributes:a}=o,l=s.global;return{title:C({attributes:a,fieldInfoMap:r,globalAttributes:l,expressionAttributes:n,layer:i,text:e}),description:C({attributes:a,fieldInfoMap:r,globalAttributes:l,expressionAttributes:n,layer:i,text:t})}}_createFieldsVMParams(e,t){const{_effectivePopupTemplate:r,formattedAttributes:i}=this,o={...i.global,...i.content[t]},s=(null==e?void 0:e.fieldInfos)||(null==r?void 0:r.fieldInfos),n=null==s?void 0:s.filter((({fieldName:e})=>F(e)||E(e)||o.hasOwnProperty(e))),a=null==r?void 0:r.expressionInfos,{description:l,title:p}=e;return{attributes:o,expressionInfos:a,fieldInfos:n,...this._compileTitleAndDesc({title:p,description:l})}}_compileFields(e,t){const r=e.clone(),i=new b(this._createFieldsVMParams(e,t));return this.contentViewModels[t]=i,r.fieldInfos=i.formattedFieldInfos.slice(0),r}_createMediaVMParams(e,t){const{graphic:r,_fieldInfoMap:i,formattedAttributes:o,_effectivePopupTemplate:s,relatedInfos:n,_sourceLayer:a,_expressionAttributes:l}=this,{attributes:p}=r,{description:c,mediaInfos:d,title:u}=e;return{activeMediaInfoIndex:e.activeMediaInfoIndex||0,attributes:p,layer:a,fieldInfoMap:i,formattedAttributes:{...o.global,...o.content[t]},expressionAttributes:l,mediaInfos:d,popupTemplate:s,relatedInfos:n,...this._compileTitleAndDesc({title:u,description:c})}}_compileMedia(e,t){const r=e.clone(),i=new g(this._createMediaVMParams(e,t));return r.mediaInfos=i.formattedMediaInfos.slice(0),this.contentViewModels[t]=i,r}_createTextVMParams(e){const{graphic:t,_fieldInfoMap:r,_sourceLayer:i,_expressionAttributes:o}=this;if(e&&e.text){const{attributes:s}=t,n=this.formattedAttributes.global;e.text=C({attributes:s,fieldInfoMap:r,globalAttributes:n,expressionAttributes:o,layer:i,text:e.text})}return{graphic:t,creator:e.text}}_compileText(e,t){const r=e.clone();return this.contentViewModels[t]=new _(this._createTextVMParams(r)),r}_compileLastEditInfo(){const{_effectivePopupTemplate:e,_sourceLayer:t,graphic:r}=this;if(!e)return;const{lastEditInfoEnabled:i}=e,o=null==t?void 0:t.editFieldsInfo;return i&&o?T(o,r.attributes):void 0}_compileTitle(e){const{_fieldInfoMap:t,_sourceLayer:r,graphic:i,_expressionAttributes:o}=this,{attributes:s}=i,n=this.formattedAttributes.global;return C({attributes:s,fieldInfoMap:t,globalAttributes:n,expressionAttributes:o,layer:r,text:e})}async _getTitle(){const{_effectivePopupTemplate:e,graphic:t}=this,r=null==e?void 0:e.title;return V(r,{graphic:t})}async _getContent(){const{_effectivePopupTemplate:e,graphic:t}=this,r=null==e?void 0:e.content;return V(r,{graphic:t})}async _queryFeature(e){const{_featureAbortController:t,_sourceLayer:r,graphic:i,_effectivePopupTemplate:o,spatialReference:s,map:n,view:a}=this,{content:{value:p},title:{value:c}}=await l({content:this._getContent(),title:this._getTitle()});if(t!==this._featureAbortController||!i)return;await P({graphic:i,popupTemplate:o,layer:r,spatialReference:s},e);const{expressionAttributes:{value:d}}=await l({checkForRelatedFeatures:this._checkForRelatedFeatures(e),expressionAttributes:I({expressionInfos:null==o?void 0:o.expressionInfos,spatialReference:s,graphic:i,map:n,interceptor:N.interceptor,view:a})});t===this._featureAbortController&&i&&(this._expressionAttributes=d,this._graphicExpressionAttributes={...i.attributes,...d},this._set("formattedAttributes",this._createFormattedAttributes(p)),this._set("title",this._compileTitle(c)),this._set("lastEditInfo",this._compileLastEditInfo()||null),this._set("content",this._compileContent(p)||null))}_createMediaFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:r}){const{_effectivePopupTemplate:i,graphic:o,relatedInfos:s,_sourceLayer:n,_fieldInfoMap:a,_graphicExpressionAttributes:l}=this;r.content[t]=j({fieldInfos:null==i?void 0:i.fieldInfos,graphic:o,attributes:{...l,...e.attributes},layer:n,fieldInfoMap:a,relatedInfos:s})}_createFieldsFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:r}){if(e.fieldInfos){const{graphic:i,relatedInfos:o,_sourceLayer:s,_fieldInfoMap:n,_graphicExpressionAttributes:a}=this;r.content[t]=j({fieldInfos:e.fieldInfos,graphic:i,attributes:{...a,...e.attributes},layer:s,fieldInfoMap:n,relatedInfos:o})}}_createFormattedAttributes(e){const{_effectivePopupTemplate:t,graphic:r,relatedInfos:i,_sourceLayer:o,_fieldInfoMap:s,_graphicExpressionAttributes:n}=this,a=null==t?void 0:t.fieldInfos,l={global:j({fieldInfos:a,graphic:r,attributes:n,layer:o,fieldInfoMap:s,relatedInfos:i}),content:[]};return Array.isArray(e)&&e.forEach(((e,t)=>{"fields"===e.type&&this._createFieldsFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:l}),"media"===e.type&&this._createMediaFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:l})})),l}_checkForRelatedFeatures(e){const{graphic:t,_effectivePopupTemplate:r}=this;return this._queryRelatedInfos(t,x(r),e)}async _queryRelatedInfos(e,t,r){const{relatedInfos:i,_sourceLayer:o}=this;i.clear();const s=n(o.associatedLayer)?await o.associatedLayer.load(r):o;if(!s)return;const a=t.filter((e=>e&&E(e.fieldName)));if(!a||!a.length)return;t.forEach((e=>this._configureRelatedInfo(e,s)));const l=await L({relatedInfos:i,layer:s},r);Object.keys(l).forEach((e=>{var t;const r=i.get(e.toString()),o=null==(t=l[e])?void 0:t.value;r&&o&&(r.layerInfo=o.data)}));const p=await R({graphic:e,relatedInfos:i,layer:s},r);Object.keys(p).forEach((e=>{var t;O(null==(t=p[e])?void 0:t.value,i.get(e.toString()))}))}_configureRelatedInfo(e,t){const{relatedInfos:r}=this,i=S(e.fieldName);if(!i)return;const{layerId:o,fieldName:s}=i;if(!o)return;const n=r.get(o.toString())||k(o,t);n&&(U({relatedInfo:n,fieldName:s,fieldInfo:e}),this.relatedInfos.set(o,n))}};H.interceptor=new r(A,v),e([d()],H.prototype,"_error",void 0),e([d()],H.prototype,"_featureAbortController",void 0),e([d({readOnly:!0})],H.prototype,"_effectivePopupTemplate",null),e([d({readOnly:!0})],H.prototype,"_fieldInfoMap",null),e([d({readOnly:!0})],H.prototype,"_sourceLayer",null),e([d()],H.prototype,"abilities",void 0),e([u("abilities")],H.prototype,"castAbilities",null),e([d({readOnly:!0})],H.prototype,"content",void 0),e([d({readOnly:!0})],H.prototype,"contentViewModels",void 0),e([d({type:Boolean})],H.prototype,"defaultPopupTemplateEnabled",void 0),e([d({readOnly:!0})],H.prototype,"state",null),e([d({readOnly:!0})],H.prototype,"formattedAttributes",void 0),e([d({type:t,value:null})],H.prototype,"graphic",null),e([d({readOnly:!0})],H.prototype,"lastEditInfo",void 0),e([d({readOnly:!0})],H.prototype,"relatedInfos",void 0),e([d()],H.prototype,"spatialReference",null),e([d({readOnly:!0})],H.prototype,"title",void 0),e([d()],H.prototype,"map",null),e([d({readOnly:!0})],H.prototype,"waitingForContent",null),e([d()],H.prototype,"view",void 0),H=N=e([f(Q)],H);const z=H;export{z as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import{FeatureSetQueryInterceptor as r}from"../../arcade/featureset/support/FeatureSetQueryInterceptor.js";import i from"../../core/Accessor.js";import o from"../../core/Handles.js";import s from"../../core/Logger.js";import{isSome as n}from"../../core/maybe.js";import{isAbortError as a,eachAlways as l}from"../../core/promiseUtils.js";import{throttle as p}from"../../core/throttle.js";import{init as c}from"../../core/watchUtils.js";import{property as d}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{cast as u}from"../../core/accessorSupport/decorators/cast.js";import{subclass as f}from"../../core/accessorSupport/decorators/subclass.js";import h from"../../popup/content/TextContent.js";import m from"./FeatureAttachments/FeatureAttachmentsViewModel.js";import _ from"./FeatureContent/FeatureContentViewModel.js";import y from"./FeatureExpression/FeatureExpressionViewModel.js";import b from"./FeatureFields/FeatureFieldsViewModel.js";import g from"./FeatureMedia/FeatureMediaViewModel.js";import{createCompiledExpressions as A}from"./support/arcadeFeatureUtils.js";import{preLayerQueryCallback as I,preRequestCallback as v,createfieldInfoMap as M,getAllFieldInfos as x,getSourceLayer as w,substituteFieldsInLinksAndAttributes as C,isExpressionField as F,isRelatedField as E,formatEditInfo as T,graphicCallback as V,queryUpdatedFeature as P,formatAttributes as j}from"./support/featureUtils.js";import{queryLayerInfos as L,queryRelatedFeatures as R,setRelatedFeatures as O,getRelatedFieldInfo as S,createRelatedInfo as k,updateRelatedInfo as U}from"./support/relatedFeatureUtils.js";var N;const q=1,D="content-view-models",Q="esri.widgets.FeatureViewModel",B=s.getLogger(Q),G={attachmentsContent:!0,chartAnimation:!0,customContent:!0,expressionContent:!0,fieldsContent:!0,mediaContent:!0,textContent:!0};let H=N=class extends i{constructor(e){super(e),this._handles=new o,this._error=null,this._featureAbortController=null,this.graphicChangedThrottled=p(this._graphicChanged,q,this),this._expressionAttributes=null,this._graphicExpressionAttributes=null,this.abilities={...G},this.content=null,this.contentViewModels=[],this.defaultPopupTemplateEnabled=!1,this.formattedAttributes=null,this.lastEditInfo=null,this.relatedInfos=new Map,this.title="",this.view=null,this._isAllowedContentType=e=>{const{abilities:t}=this;return"attachments"===e.type&&t.attachmentsContent||"custom"===e.type&&t.customContent||"fields"===e.type&&t.fieldsContent||"media"===e.type&&t.mediaContent||"text"===e.type&&t.textContent||"expression"===e.type&&t.expressionContent},this._handles.add(c(this,["graphic","_effectivePopupTemplate","abilities"],(()=>this.graphicChangedThrottled())))}destroy(){this._clear(),this._cancelFeatureQuery(),this._error=null,this._handles.destroy(),this._handles=null,this.graphic=null,this._destroyContentViewModels(),this.relatedInfos.clear()}get _effectivePopupTemplate(){return n(this.graphic)?this.graphic.getEffectivePopupTemplate(this.defaultPopupTemplateEnabled):null}get _fieldInfoMap(){return M(x(this._effectivePopupTemplate),this._sourceLayer)}get _sourceLayer(){return w(this.graphic)}castAbilities(e){return{...G,...e}}get state(){return this.graphic?this._error?"error":this.waitingForContent?"loading":"ready":"disabled"}set graphic(e){this._set("graphic",e?e.clone():null)}get spatialReference(){return this.get("view.spatialReference")||null}set spatialReference(e){void 0!==e?this._override("spatialReference",e):this._clearOverride("spatialReference")}get map(){return this.get("view.map")||null}set map(e){void 0!==e?this._override("map",e):this._clearOverride("map")}get waitingForContent(){return!!this._featureAbortController}setActiveMedia(e,t){const r=this.contentViewModels[e];r instanceof g&&r.setActiveMedia(t)}nextMedia(e){const t=this.contentViewModels[e];t instanceof g&&t.next()}previousMedia(e){const t=this.contentViewModels[e];t instanceof g&&t.previous()}_clear(){this._set("title",""),this._set("content",null),this._set("formattedAttributes",null)}async _graphicChanged(){this._cancelFeatureQuery(),this._error=null,this._clear();const{graphic:e}=this;if(!e)return;const t=new AbortController;this._featureAbortController=t;try{await this._queryFeature({signal:t.signal})}catch(r){a(r)||(this._error=r,B.error("error","The popupTemplate could not be displayed for this feature.",{error:r,graphic:e,popupTemplate:this._effectivePopupTemplate}))}this._featureAbortController===t&&(this._featureAbortController=null)}_cancelFeatureQuery(){const{_featureAbortController:e}=this;e&&e.abort(),this._featureAbortController=null}_compileContentElement(e,t){return"attachments"===e.type?this._compileAttachments(e,t):"custom"===e.type?this._compileCustom(e,t):"fields"===e.type?this._compileFields(e,t):"media"===e.type?this._compileMedia(e,t):"text"===e.type?this._compileText(e,t):"expression"===e.type?this._compileExpression(e,t):void 0}_compileContent(e){if(this._destroyContentViewModels(),this.graphic)return Array.isArray(e)?e.filter(this._isAllowedContentType).map(((e,t)=>this._compileContentElement(e,t))):"string"==typeof e?this._compileText(new h({text:e}),0).text:e}_destroyContentViewModels(){var e;null==(e=this._handles)||e.remove(D),this.contentViewModels.forEach((e=>e&&!e.destroyed&&e.destroy())),this._set("contentViewModels",[])}_setExpressionContentVM(e,t){const{formattedAttributes:r}=this,{contentElement:i,contentElementViewModel:o}=e,s=null==i?void 0:i.type;o&&s&&("fields"===s&&(this._createFieldsFormattedAttributes({contentElement:i,contentElementIndex:t,formattedAttributes:r}),o.set(this._createFieldsVMParams(i,t))),"media"===s&&(this._createMediaFormattedAttributes({contentElement:i,contentElementIndex:t,formattedAttributes:r}),o.set(this._createMediaVMParams(i,t))),"text"===s&&o.set(this._createTextVMParams(i)))}_compileExpression(e,t){const{expressionInfo:r}=e,{graphic:i,map:o,spatialReference:s,view:n}=this,a=new y({expressionInfo:r,graphic:i,interceptor:N.interceptor,map:o,spatialReference:s,view:n});return this.contentViewModels[t]=a,this._handles.add(c(a,"contentElementViewModel",(()=>this._setExpressionContentVM(a,t))),D),e}_compileAttachments(e,t){const{graphic:r}=this,{description:i,title:o}=e;return this.contentViewModels[t]=new m({graphic:r,...this._compileTitleAndDesc({title:o,description:i})}),e}_compileCustom(e,t){const{graphic:r}=this,{creator:i,destroyer:o}=e;return this.contentViewModels[t]=new _({graphic:r,creator:i,destroyer:o}),e}_compileTitleAndDesc({title:e,description:t}){const{_fieldInfoMap:r,_sourceLayer:i,graphic:o,formattedAttributes:s,_expressionAttributes:n}=this,{attributes:a}=o,l=s.global;return{title:C({attributes:a,fieldInfoMap:r,globalAttributes:l,expressionAttributes:n,layer:i,text:e}),description:C({attributes:a,fieldInfoMap:r,globalAttributes:l,expressionAttributes:n,layer:i,text:t})}}_createFieldsVMParams(e,t){const{_effectivePopupTemplate:r,formattedAttributes:i}=this,o={...i.global,...i.content[t]},s=(null==e?void 0:e.fieldInfos)||(null==r?void 0:r.fieldInfos),n=null==s?void 0:s.filter((({fieldName:e})=>F(e)||E(e)||o.hasOwnProperty(e))),a=null==r?void 0:r.expressionInfos,{description:l,title:p}=e;return{attributes:o,expressionInfos:a,fieldInfos:n,...this._compileTitleAndDesc({title:p,description:l})}}_compileFields(e,t){const r=e.clone(),i=new b(this._createFieldsVMParams(e,t));return this.contentViewModels[t]=i,r.fieldInfos=i.formattedFieldInfos.slice(0),r}_createMediaVMParams(e,t){const{abilities:r,graphic:i,_fieldInfoMap:o,formattedAttributes:s,_effectivePopupTemplate:n,relatedInfos:a,_sourceLayer:l,_expressionAttributes:p}=this,{attributes:c}=i,{description:d,mediaInfos:u,title:f}=e;return{abilities:{chartAnimation:r.chartAnimation},activeMediaInfoIndex:e.activeMediaInfoIndex||0,attributes:c,layer:l,fieldInfoMap:o,formattedAttributes:{...s.global,...s.content[t]},expressionAttributes:p,mediaInfos:u,popupTemplate:n,relatedInfos:a,...this._compileTitleAndDesc({title:f,description:d})}}_compileMedia(e,t){const r=e.clone(),i=new g(this._createMediaVMParams(e,t));return r.mediaInfos=i.formattedMediaInfos.slice(0),this.contentViewModels[t]=i,r}_createTextVMParams(e){const{graphic:t,_fieldInfoMap:r,_sourceLayer:i,_expressionAttributes:o}=this;if(e&&e.text){const{attributes:s}=t,n=this.formattedAttributes.global;e.text=C({attributes:s,fieldInfoMap:r,globalAttributes:n,expressionAttributes:o,layer:i,text:e.text})}return{graphic:t,creator:e.text}}_compileText(e,t){const r=e.clone();return this.contentViewModels[t]=new _(this._createTextVMParams(r)),r}_compileLastEditInfo(){const{_effectivePopupTemplate:e,_sourceLayer:t,graphic:r}=this;if(!e)return;const{lastEditInfoEnabled:i}=e,o=null==t?void 0:t.editFieldsInfo;return i&&o?T(o,r.attributes):void 0}_compileTitle(e){const{_fieldInfoMap:t,_sourceLayer:r,graphic:i,_expressionAttributes:o}=this,{attributes:s}=i,n=this.formattedAttributes.global;return C({attributes:s,fieldInfoMap:t,globalAttributes:n,expressionAttributes:o,layer:r,text:e})}async _getTitle(){const{_effectivePopupTemplate:e,graphic:t}=this,r=null==e?void 0:e.title;return V(r,{graphic:t})}async _getContent(){const{_effectivePopupTemplate:e,graphic:t}=this,r=null==e?void 0:e.content;return V(r,{graphic:t})}async _queryFeature(e){const{_featureAbortController:t,_sourceLayer:r,graphic:i,_effectivePopupTemplate:o,spatialReference:s,map:n,view:a}=this,{content:{value:p},title:{value:c}}=await l({content:this._getContent(),title:this._getTitle()});if(t!==this._featureAbortController||!i)return;await P({graphic:i,popupTemplate:o,layer:r,spatialReference:s},e);const{expressionAttributes:{value:d}}=await l({checkForRelatedFeatures:this._checkForRelatedFeatures(e),expressionAttributes:A({expressionInfos:null==o?void 0:o.expressionInfos,spatialReference:s,graphic:i,map:n,interceptor:N.interceptor,view:a})});t===this._featureAbortController&&i&&(this._expressionAttributes=d,this._graphicExpressionAttributes={...i.attributes,...d},this._set("formattedAttributes",this._createFormattedAttributes(p)),this._set("title",this._compileTitle(c)),this._set("lastEditInfo",this._compileLastEditInfo()||null),this._set("content",this._compileContent(p)||null))}_createMediaFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:r}){const{_effectivePopupTemplate:i,graphic:o,relatedInfos:s,_sourceLayer:n,_fieldInfoMap:a,_graphicExpressionAttributes:l}=this;r.content[t]=j({fieldInfos:null==i?void 0:i.fieldInfos,graphic:o,attributes:{...l,...e.attributes},layer:n,fieldInfoMap:a,relatedInfos:s})}_createFieldsFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:r}){if(e.fieldInfos){const{graphic:i,relatedInfos:o,_sourceLayer:s,_fieldInfoMap:n,_graphicExpressionAttributes:a}=this;r.content[t]=j({fieldInfos:e.fieldInfos,graphic:i,attributes:{...a,...e.attributes},layer:s,fieldInfoMap:n,relatedInfos:o})}}_createFormattedAttributes(e){const{_effectivePopupTemplate:t,graphic:r,relatedInfos:i,_sourceLayer:o,_fieldInfoMap:s,_graphicExpressionAttributes:n}=this,a=null==t?void 0:t.fieldInfos,l={global:j({fieldInfos:a,graphic:r,attributes:n,layer:o,fieldInfoMap:s,relatedInfos:i}),content:[]};return Array.isArray(e)&&e.forEach(((e,t)=>{"fields"===e.type&&this._createFieldsFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:l}),"media"===e.type&&this._createMediaFormattedAttributes({contentElement:e,contentElementIndex:t,formattedAttributes:l})})),l}_checkForRelatedFeatures(e){const{graphic:t,_effectivePopupTemplate:r}=this;return this._queryRelatedInfos(t,x(r),e)}async _queryRelatedInfos(e,t,r){const{relatedInfos:i,_sourceLayer:o}=this;i.clear();const s=n(o.associatedLayer)?await o.associatedLayer.load(r):o;if(!s)return;const a=t.filter((e=>e&&E(e.fieldName)));if(!a||!a.length)return;t.forEach((e=>this._configureRelatedInfo(e,s)));const l=await L({relatedInfos:i,layer:s},r);Object.keys(l).forEach((e=>{var t;const r=i.get(e.toString()),o=null==(t=l[e])?void 0:t.value;r&&o&&(r.layerInfo=o.data)}));const p=await R({graphic:e,relatedInfos:i,layer:s},r);Object.keys(p).forEach((e=>{var t;O(null==(t=p[e])?void 0:t.value,i.get(e.toString()))}))}_configureRelatedInfo(e,t){const{relatedInfos:r}=this,i=S(e.fieldName);if(!i)return;const{layerId:o,fieldName:s}=i;if(!o)return;const n=r.get(o.toString())||k(o,t);n&&(U({relatedInfo:n,fieldName:s,fieldInfo:e}),this.relatedInfos.set(o,n))}};H.interceptor=new r(I,v),e([d()],H.prototype,"_error",void 0),e([d()],H.prototype,"_featureAbortController",void 0),e([d({readOnly:!0})],H.prototype,"_effectivePopupTemplate",null),e([d({readOnly:!0})],H.prototype,"_fieldInfoMap",null),e([d({readOnly:!0})],H.prototype,"_sourceLayer",null),e([d()],H.prototype,"abilities",void 0),e([u("abilities")],H.prototype,"castAbilities",null),e([d({readOnly:!0})],H.prototype,"content",void 0),e([d({readOnly:!0})],H.prototype,"contentViewModels",void 0),e([d({type:Boolean})],H.prototype,"defaultPopupTemplateEnabled",void 0),e([d({readOnly:!0})],H.prototype,"state",null),e([d({readOnly:!0})],H.prototype,"formattedAttributes",void 0),e([d({type:t,value:null})],H.prototype,"graphic",null),e([d({readOnly:!0})],H.prototype,"lastEditInfo",void 0),e([d({readOnly:!0})],H.prototype,"relatedInfos",void 0),e([d()],H.prototype,"spatialReference",null),e([d({readOnly:!0})],H.prototype,"title",void 0),e([d()],H.prototype,"map",null),e([d({readOnly:!0})],H.prototype,"waitingForContent",null),e([d()],H.prototype,"view",void 0),H=N=e([f(Q)],H);const z=H;export{z as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import"../../intl.js";import t from"../../core/Accessor.js";import{isNone as i,get as r,isSome as n}from"../../core/maybe.js";import{property as l}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";import s from"../../layers/support/CodedValueDomain.js";import"../../layers/support/Domain.js";import"../../layers/support/InheritedDomain.js";import"../../layers/support/RangeDomain.js";import{validateDomainValue as a,DomainValidationError as u,getDomainRange as d}from"../../layers/support/domainUtils.js";import{isNumericField as p,isStringField as m,isDateField as c,TypeValidationError as y,validateFieldValue as h,getFeatureEditFields as f,getFeatureGeometryFields as v,NumericRangeValidationError as g,getFieldRange as b}from"../../layers/support/fieldUtils.js";import{substitute as E}from"../../intl/substitute.js";var _,O;!function(e){e.Text="text",e.Number="number",e.Date="date",e.Unsupported="unsupported"}(_||(_={})),function(e){e.TOO_SHORT="length-validation-error::too-short"}(O||(O={}));const F={type:"number"},T={type:"number",intlOptions:{notation:"scientific"}},x={type:"date",intlOptions:{day:"2-digit",month:"2-digit",year:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}};let D=class extends t{constructor(e){super(e),this.arcade=null,this.visibilityFunction=null,this.requiredFunction=null,this.feature=null,this.field=null,this.fieldElement=null,this.initialFeature=null,this.layer=null,this.description=null,this.inputType=null,this.error=null,this.group=null,this.hint=null,this.messages=null,this.name=null}get evaluatedRequirement(){const{requiredFunction:e}=this;if(i(e))return null;const{arcade:t}=this;return t.arcadeUtils.executeFunction(e,t.arcadeUtils.createExecContext(this.feature))}get evaluatedVisibility(){const{visibilityFunction:e}=this;if(i(e))return null;const{arcade:t}=this;return t.arcadeUtils.executeFunction(e,t.arcadeUtils.createExecContext(this.feature))}get domain(){var e;const{typeIdField:t}=this.layer,i=t===this.name,l=null==(e=this.field)?void 0:e.domain;if(i&&!l){const{layer:e}=this,t="subtype-group"===e.type?e.sublayers.map((({subtypeCode:e,title:t})=>({id:e,name:t}))):e.types.map((({id:e,name:t})=>({code:e,name:t})));return new s({name:"__internal-type-based-coded-value-domain__",codedValues:t})}const{feature:o}=this,a=t&&this.layer.getFieldDomain(this.name,{feature:o})||l,u=r(this.fieldElement,"domain");return n(u)&&this._isDomainCompatible(u)?u:a}get editable(){var e,t;const{field:i,fieldElement:r,layer:l,name:o}=this,s=l.capabilities.operations.supportsEditing&&i.editable;if("subtype-group"===l.type)return s;const a=null==(e=l.popupTemplate)||null==(t=e.fieldInfos)?void 0:t.find((({fieldName:e})=>e===o)),u=n(r)?!1!==r.editable:!1!==(null==a?void 0:a.isEditable);return s&&u}get errorMessage(){return this._toErrorMessage()}get includeTime(){const{fieldElement:e}=this,t=n(e)&&"datetime-picker"===e.input.type?e.input.includeTime:void 0;return void 0===t||t}get label(){return n(this.fieldElement)&&this.fieldElement.label||this.field.alias||this.field.name}get maxLength(){const e=-1;if(this.type===_.Date)return e;const{field:t,fieldElement:i}=this,r=null==t?void 0:t.length,l=n(i)&&N(i.input)?i.input.maxLength:NaN;return!isNaN(l)&&l>=e&&(r===e||l<=r)?l:r}get minLength(){const e=-1;if(this.type===_.Date)return e;const{field:t,fieldElement:i}=this,r=null==t?void 0:t.length,l=n(i)&&N(i.input)?i.input.minLength:NaN;return!isNaN(l)&&l>=e&&(r===e||l<=r)?l:e}get required(){var e,t;if(!this.editable)return!1;return!(null==(e=this.field)?void 0:e.nullable)||null!=(t=this.evaluatedRequirement)&&t}get type(){const{field:e}=this;return p(e)?_.Number:m(e)?_.Text:c(e)?_.Date:_.Unsupported}get valid(){const e=this.editable?this._validate():null;return this._set("error",e),null===e}get value(){return this._get("value")}set value(e){this.notifyChange("evaluatedVisibility"),this._set("value",e)}get visible(){return!this._isEditorField()&&(n(this.fieldElement)?null==(e=this.evaluatedVisibility)||e:this._isVisibleByDefault());var e}_isDomainCompatible(e){const{field:t}=this;if("coded-value"===(null==e?void 0:e.type)){const i=typeof e.codedValues[0].code;if("string"===i&&m(t)||"number"===i&&p(t))return!0}return!!("range"===(null==e?void 0:e.type)&&p(t)||c(t))}_validate(){const{domain:e,field:t,initialFeature:i,minLength:r,required:n,type:l,valid:o,value:s}=this,u=n&&null===s,d=void 0!==o;return!u&&i.getAttribute(t.name)===s&&d?null:"text"===l&&r>-1&&"string"==typeof s&&s.length<r?O.TOO_SHORT:e?null!==s||n?a(e,s):null:u?y.INVALID_TYPE:h(t,s)}_isVisibleByDefault(){var e;const t=null==(e=this.field)?void 0:e.type;return"oid"!==t&&"global-id"!==t&&!this._isGeometryField()}_isEditorField(){return f(this.layer).indexOf(this.name)>-1}_isGeometryField(){return v(this.layer).indexOf(this.name)>-1}_toErrorMessage(){const{domain:e,field:t,messages:i,minLength:r,value:n,required:l,type:o}=this,s=this.error;if(l&&null===n)return i.validationErrors.cannotBeNull;if(s===u.VALUE_OUT_OF_RANGE||s===g.OUT_OF_RANGE){const r=d(e)||b(t);return E(i.validationErrors.outsideRange,r,{format:{max:"date"===o?x:r.isInteger?F:T,min:"date"===o?x:r.isInteger?F:T}})}return s===u.INVALID_CODED_VALUE?i.validationErrors.invalidCodedValue:s===y.INVALID_TYPE?i.validationErrors.invalidType:s===O.TOO_SHORT?E(i.validationErrors.tooShort,{min:r}):null}};function N(e){return!!e&&"maxLength"in e}e([l()],D.prototype,"arcade",void 0),e([l()],D.prototype,"visibilityFunction",void 0),e([l()],D.prototype,"requiredFunction",void 0),e([l()],D.prototype,"evaluatedRequirement",null),e([l()],D.prototype,"evaluatedVisibility",null),e([l()],D.prototype,"feature",void 0),e([l()],D.prototype,"field",void 0),e([l()],D.prototype,"fieldElement",void 0),e([l()],D.prototype,"initialFeature",void 0),e([l()],D.prototype,"layer",void 0),e([l({aliasOf:"fieldElement.description"})],D.prototype,"description",void 0),e([l()],D.prototype,"domain",null),e([l()],D.prototype,"editable",null),e([l({aliasOf:"fieldElement.input.type"})],D.prototype,"inputType",void 0),e([l({readOnly:!0})],D.prototype,"error",void 0),e([l({dependsOn:["error","messages","value"]})],D.prototype,"errorMessage",null),e([l()],D.prototype,"group",void 0),e([l({aliasOf:"fieldElement.hint"})],D.prototype,"hint",void 0),e([l()],D.prototype,"includeTime",null),e([l()],D.prototype,"label",null),e([l()],D.prototype,"maxLength",null),e([l()],D.prototype,"minLength",null),e([l()],D.prototype,"messages",void 0),e([l({aliasOf:"field.name"})],D.prototype,"name",void 0),e([l()],D.prototype,"required",null),e([l()],D.prototype,"type",null),e([l()],D.prototype,"valid",null),e([l({value:null})],D.prototype,"value",null),e([l()],D.prototype,"visible",null),D=e([o("esri.widgets.FeatureForm.InputField")],D);const j=D;export{j as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import"../../intl.js";import t from"../../core/Accessor.js";import{isSome as i,isNone as l,get as r}from"../../core/maybe.js";import{property as n}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";import s from"../../layers/support/CodedValueDomain.js";import"../../layers/support/Domain.js";import"../../layers/support/InheritedDomain.js";import"../../layers/support/RangeDomain.js";import{validateDomainValue as a,DomainValidationError as u,getDomainRange as d}from"../../layers/support/domainUtils.js";import{isNumericField as p,isStringField as c,isDateField as m,TypeValidationError as h,validateFieldValue as y,getFeatureEditFields as f,getFeatureGeometryFields as v,NumericRangeValidationError as g,getFieldRange as E}from"../../layers/support/fieldUtils.js";import{substitute as b}from"../../intl/substitute.js";var _,x;!function(e){e.Text="text",e.Number="number",e.Date="date",e.Unsupported="unsupported"}(_||(_={})),function(e){e.TOO_SHORT="length-validation-error::too-short"}(x||(x={}));const F={type:"number"},O={type:"number",intlOptions:{notation:"scientific"}},V={type:"date",intlOptions:{day:"2-digit",month:"2-digit",year:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}};let T=class extends t{constructor(e){super(e),this._storedValue=null,this.arcade=null,this.editableFunction=null,this.requiredFunction=null,this.valueFunction=null,this.visibilityFunction=null,this.feature=null,this.field=null,this.fieldElement=null,this.initialFeature=null,this.layer=null,this.description=null,this.inputType=null,this.error=null,this.group=null,this.hint=null,this.messages=null,this.name=null}get _configAllowsEdits(){var e,t,l;const{fieldElement:r,layer:n,name:o}=this;if(i(r))return!1!==r.editable;const s="subtype-group"!==n.type?null==(e=n.popupTemplate)||null==(t=e.fieldInfos)?void 0:t.find((({fieldName:e})=>e===o)):null;return null==(l=null==s?void 0:s.isEditable)||l}get _layerFieldAllowsEdits(){const{field:e,layer:t}=this;return t.capabilities.operations.supportsEditing&&e.editable}get evaluatedEditableExpression(){const{editableFunction:e}=this;if(l(e))return null;const{arcade:t}=this;return t.arcadeUtils.executeFunction(e,t.arcadeUtils.createExecContext(this.feature))}get evaluatedRequiredExpression(){const{requiredFunction:e}=this;if(l(e))return null;const{arcade:t}=this;return t.arcadeUtils.executeFunction(e,t.arcadeUtils.createExecContext(this.feature))}get evaluatedVisibilityExpression(){const{visibilityFunction:e}=this;if(l(e))return null;const{arcade:t}=this;return t.arcadeUtils.executeFunction(e,t.arcadeUtils.createExecContext(this.feature))}get evaluatedValueExpression(){const{valueFunction:e}=this;if(l(e))return null;const{arcade:t}=this;return t.arcadeUtils.executeFunction(e,t.arcadeUtils.createExecContext(this.feature))}get domain(){var e;const{typeIdField:t}=this.layer,l=t===this.name,n=null==(e=this.field)?void 0:e.domain;if(l&&!n){const{layer:e}=this,t="subtype-group"===e.type?e.sublayers.map((({subtypeCode:e,title:t})=>({id:e,name:t}))):e.types.map((({id:e,name:t})=>({code:e,name:t})));return new s({name:"__internal-type-based-coded-value-domain__",codedValues:t})}const{feature:o}=this,a=t&&this.layer.getFieldDomain(this.name,{feature:o})||n,u=r(this.fieldElement,"domain");return i(u)&&this._isDomainCompatible(u)?u:a}get editable(){var e;return!!this._layerFieldAllowsEdits&&(null!=(e=this.evaluatedEditableExpression)?e:this._configAllowsEdits)}get errorMessage(){return this._toErrorMessage()}get includeTime(){const{fieldElement:e}=this,t=i(e)&&"datetime-picker"===e.input.type?e.input.includeTime:void 0;return void 0===t||t}get label(){return i(this.fieldElement)&&this.fieldElement.label||this.field.alias||this.field.name}get maxLength(){const e=-1;if(this.type===_.Date)return e;const{field:t,fieldElement:l}=this,r=null==t?void 0:t.length,n=i(l)&&D(l.input)?l.input.maxLength:NaN;return!isNaN(n)&&n>=e&&(r===e||n<=r)?n:r}get minLength(){const e=-1;if(this.type===_.Date)return e;const{field:t,fieldElement:l}=this,r=null==t?void 0:t.length,n=i(l)&&D(l.input)?l.input.minLength:NaN;return!isNaN(n)&&n>=e&&(r===e||n<=r)?n:e}get required(){var e,t;return!!this.editable&&(!1===(null==(e=this.field)?void 0:e.nullable)||null!=(t=this.evaluatedRequiredExpression)&&t)}get type(){const{field:e}=this;return p(e)?_.Number:c(e)?_.Text:m(e)?_.Date:_.Unsupported}get valid(){const e=this.editable?this._validate():null;return this._set("error",e),null===e}get value(){const{_layerFieldAllowsEdits:e,_configAllowsEdits:t,valueFunction:l}=this;return e&&!t&&i(l)?this.evaluatedValueExpression:this.get("_storedValue")}set value(e){this.notifyChange("evaluatedVisibilityExpression"),this.set("_storedValue",e)}get visible(){return!this._isEditorField()&&(i(this.fieldElement)?null==(e=this.evaluatedVisibilityExpression)||e:this._isVisibleByDefault());var e}_isDomainCompatible(e){const{field:t}=this;if("coded-value"===(null==e?void 0:e.type)){const i=typeof e.codedValues[0].code;if("string"===i&&c(t)||"number"===i&&p(t))return!0}return!!("range"===(null==e?void 0:e.type)&&p(t)||m(t))}_validate(){const{domain:e,field:t,initialFeature:i,minLength:l,required:r,type:n,valid:o,value:s}=this,u=r&&null===s,d=void 0!==o;return!u&&i.getAttribute(t.name)===s&&d?null:"text"===n&&l>-1&&"string"==typeof s&&s.length<l?x.TOO_SHORT:e?null!==s||r?a(e,s):null:u?h.INVALID_TYPE:y(t,s)}_isVisibleByDefault(){var e;const t=null==(e=this.field)?void 0:e.type;return"oid"!==t&&"global-id"!==t&&!this._isGeometryField()}_isEditorField(){return f(this.layer).indexOf(this.name)>-1}_isGeometryField(){return v(this.layer).indexOf(this.name)>-1}_toErrorMessage(){const{domain:e,field:t,messages:i,minLength:l,value:r,required:n,type:o}=this,s=this.error;if(n&&null===r)return i.validationErrors.cannotBeNull;if(s===u.VALUE_OUT_OF_RANGE||s===g.OUT_OF_RANGE){const l=d(e)||E(t);return b(i.validationErrors.outsideRange,l,{format:{max:"date"===o?V:l.isInteger?F:O,min:"date"===o?V:l.isInteger?F:O}})}return s===u.INVALID_CODED_VALUE?i.validationErrors.invalidCodedValue:s===h.INVALID_TYPE?i.validationErrors.invalidType:s===x.TOO_SHORT?b(i.validationErrors.tooShort,{min:l}):null}};function D(e){return!!e&&"maxLength"in e}e([n()],T.prototype,"_storedValue",void 0),e([n()],T.prototype,"_configAllowsEdits",null),e([n()],T.prototype,"_layerFieldAllowsEdits",null),e([n()],T.prototype,"arcade",void 0),e([n()],T.prototype,"editableFunction",void 0),e([n()],T.prototype,"requiredFunction",void 0),e([n()],T.prototype,"valueFunction",void 0),e([n()],T.prototype,"visibilityFunction",void 0),e([n()],T.prototype,"evaluatedEditableExpression",null),e([n()],T.prototype,"evaluatedRequiredExpression",null),e([n()],T.prototype,"evaluatedVisibilityExpression",null),e([n()],T.prototype,"evaluatedValueExpression",null),e([n()],T.prototype,"feature",void 0),e([n()],T.prototype,"field",void 0),e([n()],T.prototype,"fieldElement",void 0),e([n()],T.prototype,"initialFeature",void 0),e([n()],T.prototype,"layer",void 0),e([n({aliasOf:"fieldElement.description"})],T.prototype,"description",void 0),e([n()],T.prototype,"domain",null),e([n()],T.prototype,"editable",null),e([n({aliasOf:"fieldElement.input.type"})],T.prototype,"inputType",void 0),e([n({readOnly:!0})],T.prototype,"error",void 0),e([n({dependsOn:["error","messages","value"]})],T.prototype,"errorMessage",null),e([n()],T.prototype,"group",void 0),e([n({aliasOf:"fieldElement.hint"})],T.prototype,"hint",void 0),e([n()],T.prototype,"includeTime",null),e([n()],T.prototype,"label",null),e([n()],T.prototype,"maxLength",null),e([n()],T.prototype,"minLength",null),e([n()],T.prototype,"messages",void 0),e([n({aliasOf:"field.name"})],T.prototype,"name",void 0),e([n()],T.prototype,"required",null),e([n()],T.prototype,"type",null),e([n()],T.prototype,"valid",null),e([n({value:null})],T.prototype,"value",null),e([n()],T.prototype,"visible",null),T=e([o("esri.widgets.FeatureForm.InputField")],T);const A=T;export{A as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import"../../intl.js";import s from"../../core/Collection.js";import{HandleOwnerMixin as i}from"../../core/HandleOwner.js";import r from"../../core/Handles.js";import{on as o,watch as l}from"../../core/watchUtils.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as n}from"../../core/accessorSupport/decorators/subclass.js";import{highlightsSupported as d}from"../../views/support/layerViewUtils.js";import h from"./AttachmentsColumn.js";import m from"./FieldColumn.js";import c from"./Grid/Grid.js";import g from"./Grid/GridViewModel.js";import u from"./support/FeatureStore.js";import{onLocaleChange as p}from"../../intl/locale.js";import{fetchMessageBundle as f}from"../../intl/messages.js";let y=class extends(i(g)){constructor(e){super(e),this._defaultHiddenFields=["CreationDate","Creator","EditDate","Editor","GlobalID"],this._highlights=new r,this.cellClassNameGenerator=(e,t)=>e.path||null,this.dataProvider=async(e,t)=>{const{store:s}=this,{page:i,pageSize:r,sortOrders:o}=e,l=this._sortOrdersToLayerOrderByFields(o);t&&(s?(await s.set({orderByFields:l}),"loaded"!==s.state&&"loading"!==s.state&&await s.load(),t&&t(await s.fetchItems({page:i,pageSize:r}))):t&&t([]))},this.editingEnabled=!1,this.grid=null,this.hiddenFields=new s,this.highlightOnRowSelectEnabled=!0,this.itemIdPath="objectId",this.messagesCommon=null,this.relatedRecordsEnabled=!1,this.store=null,this.view=null;const{hiddenFields:t,itemIdPath:i}=this;t.addMany(this._defaultHiddenFields),this._set("store",new u),this._set("grid",new c({itemIdPath:i,viewModel:this}))}initialize(){const e=async()=>{this.messages=await f("esri/widgets/FeatureTable/t9n/FeatureTable"),this.messagesCommon=await f("esri/t9n/common")};e(),this.handles.add([p(e),o(this,"grid.selectedItems","change",(e=>this._onSelectionChange(e))),l(this,"relatedRecordsEnabled",(e=>this.store.relatedRecordsEnabled=e)),l(this,["layer.loaded"],(()=>{var e;null!=(e=this.layer)&&e.loaded&&this._onLayerLoad()})),l(this.store,"state",(e=>{var t;"loaded"===e&&(null==(t=this.grid)||t.scrollToTop())})),l(this,["editingEnabled","messages"],(()=>{var e;return(null==(e=this.layer)?void 0:e.loaded)&&this._generateColumns()})),l(this,"layer.definitionExpression",((e,t)=>(e||t)&&"loaded"===this.store.state&&this.refresh()))])}destroy(){var e,t;this._resetColumns(),this.handles.removeAll(),this._highlights.removeAll(),this._highlights.destroy(),null==(e=this.grid)||e.destroy(),null==(t=this.columns)||t.destroy(),this.layer=null,this.view=null}set attachmentsEnabled(e){this.attachmentsEnabled!==e&&(this._set("attachmentsEnabled",e),this._generateColumns(),this.store.attachmentsEnabled=e)}set fieldConfigs(e){var t;this._set("fieldConfigs",e),(null==(t=this.layer)?void 0:t.loaded)&&this._generateColumns()}set filterGeometry(e){(this.filterGeometry||e)&&(this.clearSelection(),this._set("filterGeometry",e),this.store.filterGeometry=e)}set layer(e){var t;this._set("layer",e),null==(t=this.grid)||t.clearSort(),this._resetColumns(),this.store.layer=e,e&&(e.loaded?this._onLayerLoad():e.load()),this.notifyChange("state")}set messages(e){var t;null==(t=this.grid)||t.set("messages",e),this._set("messages",e)}clearHighlights(){this._highlights.removeAll()}clearSelection(){var e;null==(e=this.grid)||e.clearSelection()}deselectRows(e){const t=this._getStoreItemsFromSelectionParams(e);this.grid.deselectRows(t)}getObjectIdIndex(e){var t;return null==(t=this.store)?void 0:t.getObjectIdIndex(e)}getValue(e,t){var s;const i=this.store.getItemByObjectId(e);return null==i||null==(s=i.feature)?void 0:s.attributes[t]}refresh(){var e;null==(e=this.grid)||e.refresh()}selectRows(e){const t=this._getStoreItemsFromSelectionParams(e);this.grid.selectRows(t)}scrollToIndex(e){var t;null==(t=this.grid)||t.scrollToIndex(e)}_onLayerLoad(){const e=this.layer.capabilities.query.maxRecordCount;e&&e<this.pageSize&&this.grid&&(this.grid.pageSize=e),this._generateColumns()}_generateColumns(){this._resetColumns(),this.columns.addMany([...this._createFieldColumns()]),this.attachmentsEnabled&&this.columns.push(this._createAttachmentsColumn())}_createFieldColumns(){return this.fieldConfigs&&this.fieldConfigs.length?this._createColumnsFromConfigs():this._createColumnsFromFields()}_createColumnsFromConfigs(){var e,t;const{editingEnabled:s,fieldConfigs:i,grid:r,hiddenFields:o,layer:l,messages:a,messagesCommon:n,store:d}=this,h=null!=(e=null==(t=this.layer)?void 0:t.fields)?e:[];return i.filter((e=>(h||[]).find((t=>e.name===t.name)))).map((e=>{const t=e.direction||null,i=e.formatFunction||null,c=e.textAlign||null,g=(h||[]).find((t=>e.name===t.name)),u=!1===e.visible||!0!==e.visible&&o.indexOf(g.name)>-1;return new m({config:e,direction:t,editingEnabled:s,field:g,formatFunction:i,grid:r,hidden:u,layer:l,store:d,messages:a,messagesCommon:n,textAlign:c})}))}_createColumnsFromFields(){var e,t;const{editingEnabled:s,grid:i,hiddenFields:r,layer:o,messages:l,messagesCommon:a,store:n}=this;return(null!=(e=null==(t=this.layer)?void 0:t.fields)?e:[]).map((e=>{const t=r.indexOf(e.name)>-1;return new m({editingEnabled:s,field:e,grid:i,hidden:t,layer:o,store:n,messages:l,messagesCommon:a})}))}_createAttachmentsColumn(){var e;return new h({header:null==(e=this.messages)?void 0:e.attachments})}_sortOrdersToLayerOrderByFields(e){return e&&e.length?e.filter(((e,t,s)=>s.map((e=>e.path)).indexOf(e.path)===t)).map((({direction:e,path:t})=>e?t+" "+e.toUpperCase():"")):[]}_highlight(e){const{view:t}=this,s=t&&e&&t.allLayerViews.items.find((({layer:t})=>t===e.layer));d(s)&&this._highlights.add(s.highlight(e),`feature-${e.getObjectId()}`)}_unhighlight(e){e&&this._highlights.remove(`feature-${e.getObjectId()}`)}_getStoreItemsFromSelectionParams(e){const s=[];return(e=e instanceof Array?e:[e]).forEach((e=>{let i=e instanceof t?e:null;const r=i?i.getObjectId():e;if("number"==typeof r||"string"==typeof r){if(!i){const e=this.store.getItemByObjectId(r);e&&(i=e.feature)}s.push({objectId:r,feature:i})}})),s}_onSelectionChange(e){const{highlightOnRowSelectEnabled:t}=this,{added:s,removed:i}=e;t&&s.forEach((e=>this._highlight(e.feature))),t&&i.forEach((e=>this._unhighlight(e.feature)))}_resetColumns(){this.columns.items.forEach((e=>e.destroy())),this.columns.removeAll()}};e([a()],y.prototype,"attachmentsEnabled",null),e([a()],y.prototype,"cellClassNameGenerator",void 0),e([a()],y.prototype,"dataProvider",void 0),e([a()],y.prototype,"editingEnabled",void 0),e([a()],y.prototype,"fieldConfigs",null),e([a()],y.prototype,"filterGeometry",null),e([a({readOnly:!0})],y.prototype,"grid",void 0),e([a()],y.prototype,"hiddenFields",void 0),e([a()],y.prototype,"highlightOnRowSelectEnabled",void 0),e([a({readOnly:!0})],y.prototype,"itemIdPath",void 0),e([a()],y.prototype,"layer",null),e([a()],y.prototype,"messages",null),e([a()],y.prototype,"messagesCommon",void 0),e([a()],y.prototype,"relatedRecordsEnabled",void 0),e([a({readOnly:!0,type:u})],y.prototype,"store",void 0),e([a()],y.prototype,"view",void 0),y=e([n("esri.widgets.FeatureTable.FeatureTableViewModel")],y);const v=y;export{v as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import"../../intl.js";import s from"../../core/Collection.js";import{HandleOwnerMixin as i}from"../../core/HandleOwner.js";import r from"../../core/Handles.js";import{on as o,watch as l}from"../../core/watchUtils.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as n}from"../../core/accessorSupport/decorators/subclass.js";import{highlightsSupported as d}from"../../views/support/layerViewUtils.js";import h from"./AttachmentsColumn.js";import m from"./FieldColumn.js";import c from"./Grid/Grid.js";import g from"./Grid/GridViewModel.js";import u from"./support/FeatureStore.js";import{onLocaleChange as p}from"../../intl/locale.js";import{fetchMessageBundle as f}from"../../intl/messages.js";let y=class extends(i(g)){constructor(e){super(e),this._defaultHiddenFields=["CreationDate","Creator","EditDate","Editor","GlobalID"],this._highlights=new r,this.cellClassNameGenerator=(e,t)=>e.path||null,this.dataProvider=async(e,t)=>{const{store:s}=this,{page:i,pageSize:r,sortOrders:o}=e,l=this._sortOrdersToLayerOrderByFields(o);t&&(s?(await s.set({orderByFields:l}),"loaded"!==s.state&&"loading"!==s.state&&await s.load(),t&&t(await s.fetchItems({page:i,pageSize:r}))):t&&t([]))},this.editingEnabled=!1,this.grid=null,this.hiddenFields=new s,this.highlightOnRowSelectEnabled=!0,this.itemIdPath="objectId",this.messagesCommon=null,this.relatedRecordsEnabled=!1,this.store=null,this.view=null;const{hiddenFields:t,itemIdPath:i}=this;t.addMany(this._defaultHiddenFields),this._set("store",new u),this._set("grid",new c({itemIdPath:i,viewModel:this}))}initialize(){const e=async()=>{this.messages=await f("esri/widgets/FeatureTable/t9n/FeatureTable"),this.messagesCommon=await f("esri/t9n/common")};e(),this.handles.add([p(e),o(this,"grid.selectedItems","change",(e=>this._onSelectionChange(e))),l(this,"relatedRecordsEnabled",(e=>this.store.relatedRecordsEnabled=e)),l(this,["layer.loaded"],(()=>{var e;null!=(e=this.layer)&&e.loaded&&this._onLayerLoad()})),l(this.store,"state",(e=>{var t;"loaded"===e&&(null==(t=this.grid)||t.scrollToTop())})),l(this,["editingEnabled","messages"],(()=>{var e;return(null==(e=this.layer)?void 0:e.loaded)&&this._generateColumns()})),l(this,"layer.definitionExpression",((e,t)=>(e||t)&&"loaded"===this.store.state&&this.refresh()))])}destroy(){var e,t;this._resetColumns(),this.handles.removeAll(),this._highlights.removeAll(),this._highlights.destroy(),null==(e=this.grid)||e.destroy(),null==(t=this.columns)||t.destroy(),this.layer=null,this.view=null}set attachmentsEnabled(e){this.attachmentsEnabled!==e&&(this._set("attachmentsEnabled",e),this._generateColumns(),this.store.attachmentsEnabled=e)}set fieldConfigs(e){var t;this._set("fieldConfigs",e),(null==(t=this.layer)?void 0:t.loaded)&&this._generateColumns()}set filterGeometry(e){(this.filterGeometry||e)&&(this.clearSelection(),this._set("filterGeometry",e),this.store.filterGeometry=e)}set layer(e){var t;this._set("layer",e),null==(t=this.grid)||t.clearSort(),this._resetColumns(),this.store.layer=e,e&&(e.loaded?this._onLayerLoad():e.load()),this.notifyChange("state")}set messages(e){var t;null==(t=this.grid)||t.set("messages",e),this._set("messages",e)}clearHighlights(){this._highlights.removeAll()}clearSelection(){var e;null==(e=this.grid)||e.clearSelection()}deselectRows(e){const t=this._getStoreItemsFromSelectionParams(e);this.grid.deselectRows(t)}getObjectIdIndex(e){var t;return null==(t=this.store)?void 0:t.getObjectIdIndex(e)}getValue(e,t){var s;const i=this.store.getItemByObjectId(e);return null==i||null==(s=i.feature)?void 0:s.attributes[t]}refresh(){var e;null==(e=this.grid)||e.refresh()}selectRows(e){const t=this._getStoreItemsFromSelectionParams(e);this.grid.selectRows(t)}scrollToIndex(e){var t;null==(t=this.grid)||t.scrollToIndex(e)}_onLayerLoad(){const e=this.layer.capabilities.query.maxRecordCount;e&&e<this.pageSize&&this.grid&&(this.grid.pageSize=e),this._generateColumns()}_generateColumns(){this._resetColumns(),this.columns.addMany([...this._createFieldColumns()]),this.attachmentsEnabled&&this.columns.push(this._createAttachmentsColumn())}_createFieldColumns(){return this.fieldConfigs&&this.fieldConfigs.length?this._createColumnsFromConfigs():this._createColumnsFromFields()}_createColumnsFromConfigs(){var e,t;const{editingEnabled:s,fieldConfigs:i,grid:r,hiddenFields:o,layer:l,messages:a,messagesCommon:n,store:d}=this,h=null!=(e=null==(t=this.layer)?void 0:t.fields)?e:[];return i.filter((e=>(h||[]).find((t=>e.name===t.name)))).map((e=>{const t=e.direction||null,i=e.formatFunction||null,c=e.textAlign||null,g=(h||[]).find((t=>e.name===t.name)),u=!1===e.visible||!0!==e.visible&&o.indexOf(g.name)>-1;return new m({config:e,direction:t,editingEnabled:s,field:g,formatFunction:i,grid:r,hidden:u,layer:l,store:d,messages:a,messagesCommon:n,textAlign:c})}))}_createColumnsFromFields(){var e,t;const{editingEnabled:s,grid:i,hiddenFields:r,layer:o,messages:l,messagesCommon:a,store:n}=this;return(null!=(e=null==(t=this.layer)?void 0:t.fields)?e:[]).map((e=>{const t=r.indexOf(e.name)>-1;return new m({editingEnabled:s,field:e,grid:i,hidden:t,layer:o,store:n,messages:l,messagesCommon:a})}))}_createAttachmentsColumn(){var e;return new h({header:null==(e=this.messages)?void 0:e.attachments})}_sortOrdersToLayerOrderByFields(e){return e&&e.length?e.filter(((e,t,s)=>s.map((e=>e.path)).indexOf(e.path)===t)).filter((({direction:e})=>!!e)).map((({direction:e,path:t})=>t+" "+e.toUpperCase())):[]}_highlight(e){const{view:t}=this,s=t&&e&&t.allLayerViews.items.find((({layer:t})=>t===e.layer));d(s)&&this._highlights.add(s.highlight(e),`feature-${e.getObjectId()}`)}_unhighlight(e){e&&this._highlights.remove(`feature-${e.getObjectId()}`)}_getStoreItemsFromSelectionParams(e){const s=[];return(e=e instanceof Array?e:[e]).forEach((e=>{let i=e instanceof t?e:null;const r=i?i.getObjectId():e;if("number"==typeof r||"string"==typeof r){if(!i){const e=this.store.getItemByObjectId(r);e&&(i=e.feature)}s.push({objectId:r,feature:i})}})),s}_onSelectionChange(e){const{highlightOnRowSelectEnabled:t}=this,{added:s,removed:i}=e;t&&s.forEach((e=>this._highlight(e.feature))),t&&i.forEach((e=>this._unhighlight(e.feature)))}_resetColumns(){this.columns.items.forEach((e=>e.destroy())),this.columns.removeAll()}};e([a()],y.prototype,"attachmentsEnabled",null),e([a()],y.prototype,"cellClassNameGenerator",void 0),e([a()],y.prototype,"dataProvider",void 0),e([a()],y.prototype,"editingEnabled",void 0),e([a()],y.prototype,"fieldConfigs",null),e([a()],y.prototype,"filterGeometry",null),e([a({readOnly:!0})],y.prototype,"grid",void 0),e([a()],y.prototype,"hiddenFields",void 0),e([a()],y.prototype,"highlightOnRowSelectEnabled",void 0),e([a({readOnly:!0})],y.prototype,"itemIdPath",void 0),e([a()],y.prototype,"layer",null),e([a()],y.prototype,"messages",null),e([a()],y.prototype,"messagesCommon",void 0),e([a()],y.prototype,"relatedRecordsEnabled",void 0),e([a({readOnly:!0,type:u})],y.prototype,"store",void 0),e([a()],y.prototype,"view",void 0),y=e([n("esri.widgets.FeatureTable.FeatureTableViewModel")],y);const v=y;export{v as default};
@@ -956,4 +956,4 @@ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Col
956
956
  <template class="header" id="headerTemplate">
957
957
  <vaadin-grid-sorter path="[[path]]" direction="{{direction}}">[[_getHeader(header, path)]]</vaadin-grid-sorter>
958
958
  </template>
959
- `}static get is(){return"vaadin-grid-sort-column"}static get properties(){return{path:String,direction:{type:String,notify:!0}}}_prepareHeaderTemplate(){const e=this._prepareTemplatizer(this.$.headerTemplate);return e.templatizer.dataHost=this,e}_getHeader(e,t){return e||this._generateHeader(t)}}customElements.define(Ka.is,Ka);const Qa={selectionColumn:!0},el={base:"esri-grid",content:"esri-grid__content",grid:"esri-grid__grid",widget:"esri-widget"};let tl=class extends(s(c)){constructor(e,i){super(e,i),this._grid=null,this._headerStyles="display: flex; font-weight: 400;",this._hostStyles='font-family: "Avenir Next", "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 1em; background-color: inherit; color: inherit;',this._rowHoverStyles="background-color: var(--lumo-row-background-hover);",this._columnElements=[],this.cellClassNameGenerator=null,this.columnReorderingEnabled=!0,this.dataProvider=null,this.itemIdPath=null,this.label=void 0,this.messages=null,this.pageSize=50,this.selectedItems=new t,this.size=null,this.rowDetailsRenderer=null,this.store=null,this.viewModel=new u,this.visibleElements={...Qa}}initialize(){this.handles.add([this.columns.on("change",(()=>this._syncColumnRenderers())),n(this,"viewModel.size",(()=>this._updateGridSize())),n(this,"store.state",((e,t)=>{"ready"!==e||"loaded"!==t&&"error"!==t||this.refreshCache()})),o(this,"_grid.$.table","scroll",(()=>{var e;null==(e=this.viewModel)||e.closeColumnMenus()}))])}destroy(){var e;this.handles.removeAll(),this.resetColumns(),null==(e=this.columns)||e.destroy()}resetColumns(){this.columns.items.forEach((e=>e.destroy())),this.columns.removeAll()}castVisibleElements(e){return{...Qa,...e}}render(){return m("div",{bind:this,class:this.classes(el.base,el.widget)},m("div",{bind:this,class:el.content},this.renderGrid()))}renderGrid(){return m("vaadin-grid",{...this.getGridProps()},this.renderAllColumns())}renderAllColumns(){if("disabled"!==this.viewModel.state&&this.columns&&this.columns.length)return[this.renderSelectionColumn(),this.renderColumns()]}renderSelectionColumn(){return m("vaadin-grid-selection-column",{_selectAllHidden:!0,selectAll:!1,bind:this,hidden:!this.visibleElements.selectionColumn,sortable:!1,frozen:!p(this.container)})}renderColumns(){return this.columns.items.map(((e,t)=>m("vaadin-grid-column",{...this.getColumnProps(e,t)})))}getGridProps(){const{columnReorderingEnabled:e,id:t,pageSize:i,size:s}=this;return{_safari:!1,class:el.grid,id:`${t}_grid`,theme:"compact column-borders",ref:"grid",bind:this,afterCreate:this._afterGridCreate,afterUpdate:this._afterGridUpdate,columnReorderingAllowed:e,pageSize:i,size:s}}getColumnProps(e,t){const{id:i}=this,{autoWidth:s,direction:n,flexGrow:o,frozen:a,header:l,hidden:d,path:h,resizable:c,textAlign:u,width:p}=e;return{autoWidth:s,direction:n,flexGrow:o,frozen:a,header:l,hidden:d,key:`${i}_${l}_${r(t)?t:h}`,path:h,resizable:c,"text-align":u,width:"number"==typeof p?`${p}px`:p,bind:this,afterCreate:this._afterColumnCreate,afterRemoved:this._afterColumnRemoved}}clearSelection(){this._clearSelection(),this.scheduleRender()}clearSort(){let e=!1;if(this._grid&&this._grid._sorters&&this._grid._sorters.length&&(this._grid._sorters=[],e=!0),this.columns&&this.columns.length){!!this.columns.find((e=>!!e.direction))&&(this.columns.forEach((e=>e.direction=null)),e=!0)}e&&this.scheduleRender()}deselectItem(e){this._deselectRowByItem(e)}deselectRow(e){const t=this.viewModel.getRowItemAt(e);t&&this._deselectRowByItem(t)}findColumn(){}generateCellClassNames(){var e;null==(e=this._grid)||e.generateCellClassNames()}getSlotElementByName(e){var t,i;return null==(t=this._grid)||null==(i=t.shadowRoot)?void 0:i.querySelector(`slot[name='${e}']`)}hideColumn(e){var t;null==(t=this.viewModel)||t.hideColumn(e),this.scheduleRender()}notifyResize(){var e;null==(e=this._grid)||e.notifyResize()}recalculateColumnWidths(){var e;null==(e=this._grid)||e.recalculateColumnWidths()}async refresh(){var e;this._clearSelection(),await(null==(e=this.store)?void 0:e.reset()),this.scrollToTop()}refreshCache(){var e;null==(e=this._grid)||e.clearCache()}selectRows(e){const t=this._grid.selectedItems.slice();e.forEach((e=>{t.findIndex((t=>t.objectId===e.objectId))<0&&this._grid.selectedItems.push(e)})),this._updateSelectionProps(),this._grid.render()}deselectRows(e){const t=this._grid.selectedItems.slice();e.forEach((e=>{const i=t.findIndex((t=>t.objectId===e.objectId));i>-1&&t.splice(i,1)})),this._grid.selectedItems=t,this._updateSelectionProps(),this._grid.render()}selectItem(e){this._selectRowByItem(e)}selectRow(e){const t=this.viewModel.getRowItemAt(e);t&&this._selectRowByItem(t)}showColumn(e){var t;null==(t=this.viewModel)||t.showColumn(e),this.scheduleRender()}sort({path:e,direction:t}){var i;null==(i=this.viewModel)||i.sortColumn(e,t)}scrollToIndex(e){var t;null==(t=this._grid)||t.scrollToIndex(e)}scrollToTop(){var e;null==(e=this._grid)||e.scrollToIndex(0)}_afterGridCreate(e){const{cellClassNameGenerator:t,dataProvider:i,itemIdPath:s,rowDetailsRenderer:r}=this;e.cellClassNameGenerator=t,e.dataProvider=i,e.rowDetailsRenderer=r,e.itemIdPath=s,this._grid=e,customElements.whenDefined("vaadin-grid").then((()=>{this._appendStyles(),this._addGridEventListeners()}))}_afterGridUpdate(e){this._grid||(this._grid=e)}_afterColumnCreate(e){this._applyRenderersToColumnElement(e),this._columnElements.push(e)}_afterColumnRemoved(e){const t=this._columnElements.indexOf(e,0);t>-1&&this._columnElements.splice(t,1)}_syncColumnRenderers(){this._columnElements.forEach((e=>this._applyRenderersToColumnElement(e)))}_appendStyles(){var e;const t=null==(e=this._grid)?void 0:e.shadowRoot,i=document.createElement("style");i.textContent=`\n :host { ${this._hostStyles} }\n [part~="header-cell"] ::slotted(vaadin-grid-cell-content) { ${this._headerStyles} }\n [part~="row"]:hover [part~="body-cell"] { ${this._rowHoverStyles} }\n `,null==t||t.appendChild(i)}_updateGridSize(){this._grid&&(this._grid.size=this.size||0,this.scheduleRender())}_addGridEventListeners(){const{_grid:e}=this;this.handles.add([i(e,"click",(e=>this._onRowClick(e))),i(e,"selected-items-changed",(e=>this._onSelectionChange(e)))])}_onRowClick(e){const{_grid:t}=this,i=t.getEventContext(e),{item:s,section:r}=i;s&&r&&"details"!==r&&"header"!==r&&this.emit("row-click",{context:i,native:e})}_selectRowByItem(e){var t;null==(t=this._grid)||t.selectItem(e)}_deselectRowByItem(e){var t;null==(t=this._grid)||t.deselectItem(e)}_clearSelection(){var e,t;null!=(e=this._grid)&&null!=(t=e.selectedItems)&&t.length&&(this._grid.selectedItems=[],this._updateSelectionProps(),this._grid.render())}_onSelectionChange(e){const t=e;if("selectedItems.splices"===t.detail.path){const{removed:e,index:i,object:s}=t.detail.value.indexSplices[0];this._updateSelectionProps(),this.emit("selection-change",{index:i,added:s,removed:e})}}_updateSelectionProps(){this.selectedItems.length&&this.selectedItems.removeAll(),this._grid&&this.selectedItems.addMany(this._grid.selectedItems)}_applyRenderersToColumnElement(e){const t=e.getAttribute("path"),i=this.viewModel.findColumn(t);if(i)try{i.renderFunction&&(e.renderer=(e,t,s)=>i.renderFunction({root:e,column:t,rowData:s})),i.footerRenderFunction&&(e.footerRenderer=(e,t)=>i.footerRenderFunction({root:e,column:t})),i.headerRenderFunction&&(e.headerRenderer=(e,t)=>i.headerRenderFunction({root:e,column:t}))}catch(s){}}};e([d()],tl.prototype,"_grid",void 0),e([a("viewModel.cellClassNameGenerator")],tl.prototype,"cellClassNameGenerator",void 0),e([a("viewModel.columns")],tl.prototype,"columns",void 0),e([a("viewModel.columnReorderingEnabled")],tl.prototype,"columnReorderingEnabled",void 0),e([a("viewModel.dataProvider")],tl.prototype,"dataProvider",void 0),e([d()],tl.prototype,"itemIdPath",void 0),e([d({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],tl.prototype,"label",void 0),e([d(),_("esri/widgets/FeatureTable/t9n/FeatureTable")],tl.prototype,"messages",void 0),e([a("viewModel.pageSize")],tl.prototype,"pageSize",void 0),e([d({readOnly:!0})],tl.prototype,"selectedItems",void 0),e([a("viewModel.size")],tl.prototype,"size",void 0),e([a("viewModel.rowDetailsRenderer")],tl.prototype,"rowDetailsRenderer",void 0),e([a("viewModel.store")],tl.prototype,"store",void 0),e([d()],tl.prototype,"viewModel",void 0),e([d()],tl.prototype,"visibleElements",void 0),e([l("visibleElements")],tl.prototype,"castVisibleElements",null),e([a("viewModel.findColumn")],tl.prototype,"findColumn",null),tl=e([h("esri.widgets.FeatureTable.Grid.Grid")],tl);const il=tl;export{il as default};
959
+ `}static get is(){return"vaadin-grid-sort-column"}static get properties(){return{path:String,direction:{type:String,notify:!0}}}_prepareHeaderTemplate(){const e=this._prepareTemplatizer(this.$.headerTemplate);return e.templatizer.dataHost=this,e}_getHeader(e,t){return e||this._generateHeader(t)}}customElements.define(Ka.is,Ka);const Qa={selectionColumn:!0,columnMenus:!0},el={base:"esri-grid",content:"esri-grid__content",grid:"esri-grid__grid",noColumnMenu:"esri-grid--no-column-menu",widget:"esri-widget"};let tl=class extends(s(c)){constructor(e,i){super(e,i),this._grid=null,this._headerStyles="display: flex; font-weight: 400;",this._hostStyles='font-family: "Avenir Next", "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 1em; background-color: inherit; color: inherit;',this._rowHoverStyles="background-color: var(--lumo-row-background-hover);",this._columnElements=[],this.cellClassNameGenerator=null,this.columnReorderingEnabled=!0,this.dataProvider=null,this.itemIdPath=null,this.label=void 0,this.messages=null,this.pageSize=50,this.selectedItems=new t,this.size=null,this.rowDetailsRenderer=null,this.store=null,this.viewModel=new u,this.visibleElements={...Qa}}initialize(){this.handles.add([this.columns.on("change",(()=>this._syncColumnRenderers())),n(this,"viewModel.size",(()=>this._updateGridSize())),n(this,"store.state",((e,t)=>{"ready"!==e||"loaded"!==t&&"error"!==t||this.refreshCache()})),o(this,"_grid.$.table","scroll",(()=>{var e;null==(e=this.viewModel)||e.closeColumnMenus()}))])}destroy(){var e;this.handles.removeAll(),this.resetColumns(),null==(e=this.columns)||e.destroy()}resetColumns(){this.columns.items.forEach((e=>e.destroy())),this.columns.removeAll()}castVisibleElements(e){return{...Qa,...e}}render(){const{columnMenus:e}=this.visibleElements;return m("div",{bind:this,class:this.classes(el.base,el.widget,{[el.noColumnMenu]:!e})},m("div",{bind:this,class:el.content},this.renderGrid()))}renderGrid(){return m("vaadin-grid",{...this.getGridProps()},this.renderAllColumns())}renderAllColumns(){if("disabled"!==this.viewModel.state&&this.columns&&this.columns.length)return[this.renderSelectionColumn(),this.renderColumns()]}renderSelectionColumn(){return m("vaadin-grid-selection-column",{_selectAllHidden:!0,selectAll:!1,bind:this,hidden:!this.visibleElements.selectionColumn,sortable:!1,frozen:!p(this.container)})}renderColumns(){return this.columns.items.map(((e,t)=>m("vaadin-grid-column",{...this.getColumnProps(e,t)})))}getGridProps(){const{columnReorderingEnabled:e,id:t,pageSize:i,size:s}=this;return{_safari:!1,class:el.grid,id:`${t}_grid`,theme:"compact column-borders",ref:"grid",bind:this,afterCreate:this._afterGridCreate,afterUpdate:this._afterGridUpdate,columnReorderingAllowed:e,pageSize:i,size:s}}getColumnProps(e,t){const{id:i}=this,{autoWidth:s,direction:n,flexGrow:o,frozen:a,header:l,hidden:d,path:h,resizable:c,textAlign:u,width:p}=e;return{autoWidth:s,direction:n,flexGrow:o,frozen:a,header:l,hidden:d,key:`${i}_${l}_${r(t)?t:h}`,path:h,resizable:c,"text-align":u,width:"number"==typeof p?`${p}px`:p,bind:this,afterCreate:this._afterColumnCreate,afterRemoved:this._afterColumnRemoved}}clearSelection(){this._clearSelection(),this.scheduleRender()}clearSort(){let e=!1;if(this._grid&&this._grid._sorters&&this._grid._sorters.length&&(this._grid._sorters=[],e=!0),this.columns&&this.columns.length){!!this.columns.find((e=>!!e.direction))&&(this.columns.forEach((e=>e.direction=null)),e=!0)}e&&this.scheduleRender()}deselectItem(e){this._deselectRowByItem(e)}deselectRow(e){const t=this.viewModel.getRowItemAt(e);t&&this._deselectRowByItem(t)}findColumn(){}generateCellClassNames(){var e;null==(e=this._grid)||e.generateCellClassNames()}getSlotElementByName(e){var t,i;return null==(t=this._grid)||null==(i=t.shadowRoot)?void 0:i.querySelector(`slot[name='${e}']`)}hideColumn(e){var t;null==(t=this.viewModel)||t.hideColumn(e),this.scheduleRender()}notifyResize(){var e;null==(e=this._grid)||e.notifyResize()}recalculateColumnWidths(){var e;null==(e=this._grid)||e.recalculateColumnWidths()}async refresh(){var e;this._clearSelection(),await(null==(e=this.store)?void 0:e.reset()),this.scrollToTop()}refreshCache(){var e;null==(e=this._grid)||e.clearCache()}selectRows(e){const t=this._grid.selectedItems.slice();e.forEach((e=>{t.findIndex((t=>t.objectId===e.objectId))<0&&this._grid.selectedItems.push(e)})),this._updateSelectionProps(),this._grid.render()}deselectRows(e){const t=this._grid.selectedItems.slice();e.forEach((e=>{const i=t.findIndex((t=>t.objectId===e.objectId));i>-1&&t.splice(i,1)})),this._grid.selectedItems=t,this._updateSelectionProps(),this._grid.render()}selectItem(e){this._selectRowByItem(e)}selectRow(e){const t=this.viewModel.getRowItemAt(e);t&&this._selectRowByItem(t)}showColumn(e){var t;null==(t=this.viewModel)||t.showColumn(e),this.scheduleRender()}sort({path:e,direction:t}){var i;null==(i=this.viewModel)||i.sortColumn(e,t)}scrollToIndex(e){var t;null==(t=this._grid)||t.scrollToIndex(e)}scrollToTop(){var e;null==(e=this._grid)||e.scrollToIndex(0)}_afterGridCreate(e){const{cellClassNameGenerator:t,dataProvider:i,itemIdPath:s,rowDetailsRenderer:r}=this;e.cellClassNameGenerator=t,e.dataProvider=i,e.rowDetailsRenderer=r,e.itemIdPath=s,this._grid=e,customElements.whenDefined("vaadin-grid").then((()=>{this._appendStyles(),this._addGridEventListeners()}))}_afterGridUpdate(e){this._grid||(this._grid=e)}_afterColumnCreate(e){this._applyRenderersToColumnElement(e),this._columnElements.push(e)}_afterColumnRemoved(e){const t=this._columnElements.indexOf(e,0);t>-1&&this._columnElements.splice(t,1)}_syncColumnRenderers(){this._columnElements.forEach((e=>this._applyRenderersToColumnElement(e)))}_appendStyles(){var e;const t=null==(e=this._grid)?void 0:e.shadowRoot,i=document.createElement("style");i.textContent=`\n :host { ${this._hostStyles} }\n [part~="header-cell"] ::slotted(vaadin-grid-cell-content) { ${this._headerStyles} }\n [part~="row"]:hover [part~="body-cell"] { ${this._rowHoverStyles} }\n `,null==t||t.appendChild(i)}_updateGridSize(){this._grid&&(this._grid.size=this.size||0,this.scheduleRender())}_addGridEventListeners(){const{_grid:e}=this;this.handles.add([i(e,"click",(e=>this._onRowClick(e))),i(e,"selected-items-changed",(e=>this._onSelectionChange(e)))])}_onRowClick(e){const{_grid:t}=this,i=t.getEventContext(e),{item:s,section:r}=i;s&&r&&"details"!==r&&"header"!==r&&this.emit("row-click",{context:i,native:e})}_selectRowByItem(e){var t;null==(t=this._grid)||t.selectItem(e)}_deselectRowByItem(e){var t;null==(t=this._grid)||t.deselectItem(e)}_clearSelection(){var e,t;null!=(e=this._grid)&&null!=(t=e.selectedItems)&&t.length&&(this._grid.selectedItems=[],this._updateSelectionProps(),this._grid.render())}_onSelectionChange(e){const t=e;if("selectedItems.splices"===t.detail.path){const{removed:e,index:i,object:s}=t.detail.value.indexSplices[0];this._updateSelectionProps(),this.emit("selection-change",{index:i,added:s,removed:e})}}_updateSelectionProps(){this.selectedItems.length&&this.selectedItems.removeAll(),this._grid&&this.selectedItems.addMany(this._grid.selectedItems)}_applyRenderersToColumnElement(e){const t=e.getAttribute("path"),i=this.viewModel.findColumn(t);if(i)try{i.renderFunction&&(e.renderer=(e,t,s)=>i.renderFunction({root:e,column:t,rowData:s})),i.footerRenderFunction&&(e.footerRenderer=(e,t)=>i.footerRenderFunction({root:e,column:t})),i.headerRenderFunction&&(e.headerRenderer=(e,t)=>i.headerRenderFunction({root:e,column:t}))}catch(s){}}};e([d()],tl.prototype,"_grid",void 0),e([a("viewModel.cellClassNameGenerator")],tl.prototype,"cellClassNameGenerator",void 0),e([a("viewModel.columns")],tl.prototype,"columns",void 0),e([a("viewModel.columnReorderingEnabled")],tl.prototype,"columnReorderingEnabled",void 0),e([a("viewModel.dataProvider")],tl.prototype,"dataProvider",void 0),e([d()],tl.prototype,"itemIdPath",void 0),e([d({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],tl.prototype,"label",void 0),e([d(),_("esri/widgets/FeatureTable/t9n/FeatureTable")],tl.prototype,"messages",void 0),e([a("viewModel.pageSize")],tl.prototype,"pageSize",void 0),e([d({readOnly:!0})],tl.prototype,"selectedItems",void 0),e([a("viewModel.size")],tl.prototype,"size",void 0),e([a("viewModel.rowDetailsRenderer")],tl.prototype,"rowDetailsRenderer",void 0),e([a("viewModel.store")],tl.prototype,"store",void 0),e([d()],tl.prototype,"viewModel",void 0),e([d()],tl.prototype,"visibleElements",void 0),e([l("visibleElements")],tl.prototype,"castVisibleElements",null),e([a("viewModel.findColumn")],tl.prototype,"findColumn",null),tl=e([h("esri.widgets.FeatureTable.Grid.Grid")],tl);const il=tl;export{il as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import t from"../core/Collection.js";import{HandleOwnerMixin as l}from"../core/HandleOwner.js";import{on as o,watch as s}from"../core/watchUtils.js";import{aliasOf as i}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import"../core/has.js";import{cast as n}from"../core/accessorSupport/decorators/cast.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import{subclass as a}from"../core/accessorSupport/decorators/subclass.js";import d from"./Widget.js";import u from"./FeatureTable/FeatureTableViewModel.js";import c from"./FeatureTable/Grid/support/ButtonMenu.js";import m from"./FeatureTable/Grid/support/ButtonMenuItem.js";import"./support/widgetUtils.js";import{messageBundle as h}from"./support/decorators/messageBundle.js";import"../core/Logger.js";import{tsx as p}from"./support/jsxFactory.js";import{onLocaleChange as g}from"../intl/locale.js";import{substitute as v}from"../intl/substitute.js";import{fetchMessageBundle as w}from"../intl/messages.js";const b={header:!0,menu:!0,menuItems:{clearSelection:!0,refreshData:!0,toggleColumns:!0},selectionColumn:!0},f={base:"esri-feature-table",header:"esri-feature-table__header",title:"esri-feature-table__title",content:"esri-feature-table__content",loader:"esri-feature-table__loader",loaderContainer:"esri-feature-table__loader-container",menuContainer:"esri-feature-table__menu",menuIcon:"esri-icon-handle-horizontal",menuItemGroupOpenedIcon:"esri-icon-down",menuItemGroupClosedIcon:"esri-icon-right",checkmarkIcon:"esri-icon-check-mark",widget:"esri-widget"};let M=class extends(l(d)){constructor(e,l){super(e,l),this.attachmentsEnabled=null,this.columns=new t,this.editingEnabled=null,this.fieldConfigs=null,this.filterGeometry=null,this.grid=null,this.highlightOnRowSelectEnabled=!0,this.label=void 0,this.layer=null,this.messages=null,this.menu=null,this.menuConfig=null,this.pageSize=50,this.view=null,this.viewModel=new u,this.visibleElements={...b}}initialize(){var e,t,l;const i=async()=>this.messages=await w("esri/widgets/FeatureTable/t9n/FeatureTable");i(),this.handles.add([g(i),o(this,"grid.selectedItems","change",(e=>this._onSelectionChange(e))),s(this,["viewModel.store.querying","viewModel.store.syncing","grid.size"],(()=>this.scheduleRender())),o(this,"viewModel.columns","change",(()=>this._updateMenuItems())),s(this,"menuConfig",(()=>this._syncMenuConfig())),s(this,"messages",(()=>{var e;this.menu.label=null==(e=this.messages)?void 0:e.options,this._updateMenuItems()}))]),this._set("menu",new c({label:null==(e=this.messages)?void 0:e.options,iconClass:f.menuIcon,...this.menuConfig}));const{attachmentsEnabled:n,relatedRecordsEnabled:r}=this;null==(t=this.viewModel)||null==(l=t.store)||l.set({attachmentsEnabled:n,relatedRecordsEnabled:r})}destroy(){var e;this.clearSelection(),this.handles.removeAll(),null==(e=this.menu)||e.destroy()}castVisibleElements(e){var t;const l={...b,...e};return null==(t=this.grid)||t.set("visibleElements",{...this.grid.visibleElements,selectionColumn:l.selectionColumn}),l}clearHighlights(){}clearSelection(){}deselectRows(){}hideColumn(e){var t;null==(t=this.grid)||t.hideColumn(e),this._updateMenuItems()}refresh(){}showColumn(e){var t;null==(t=this.grid)||t.showColumn(e),this._updateMenuItems()}sortColumn(){}selectRows(){}scrollToIndex(){}render(){var e;return p("div",{bind:this,class:this.classes(f.base,f.widget)},this.visibleElements.header?this._renderHeader():null,p("div",{class:f.content},"disabled"!==this.state&&(null==(e=this.grid)?void 0:e.render())))}_renderHeader(){return p("div",{key:"header",class:f.header},this._renderLoader(),this._renderTitle(),this.visibleElements.menu?this._renderMenu():null)}_renderTitle(){return p("div",{class:f.title,key:"title"},this._getTitle())}_getTitle(){const{grid:e,layer:{title:t},messages:l,viewModel:{size:o}}=this;return e?v(l.header,{title:t,count:o,selected:e.selectedItems.length||0}):""}_renderLoader(){const{state:e,store:t}=this.viewModel,l="loading"===e||t.syncing||t.querying;return p("div",{class:f.loaderContainer},l?p("div",{class:f.loader,key:"loader"}):null)}_renderMenu(){return p("div",{class:f.menuContainer},this.menu.render())}_onSelectionChange(e){const{added:t,removed:l}=e;this.emit("selection-change",{added:[...t],removed:[...l]})}_syncMenuConfig(){var e;null==(e=this.menu)||e.set({...this.menuConfig,items:this._getMenuItems()})}_updateMenuItems(){var e;null==(e=this.menu)||e.set("items",this._getMenuItems())}_getMenuItems(){var e;const t=null==(e=this.menuConfig)?void 0:e.items,l=this._getDefaultMenuItems(),o=[];return(null==l?void 0:l.length)&&o.push(...l),(null==t?void 0:t.length)&&o.push(...t),o}_getDefaultMenuItems(){var e;const{messages:t,viewModel:l,visibleElements:o}=this,{menuItems:s}=o,i=[];return(null==s?void 0:s.clearSelection)&&i.push(new m({selectionEnabled:!1,label:null==t?void 0:t.clearSelection,clickFunction:()=>this.clearSelection()})),(null==s?void 0:s.refreshData)&&i.push(new m({selectionEnabled:!1,label:null==t?void 0:t.refreshData,clickFunction:()=>this.refresh()})),(null==s?void 0:s.toggleColumns)&&i.push(new m({iconClass:f.menuItemGroupClosedIcon,label:null==t?void 0:t.toggleColumns,clickFunction:this._toggleMenuItemSelectedIcon,items:null==l||null==(e=l.columns)?void 0:e.items.map((({header:e,hidden:t,path:l})=>new m({label:e||l,selected:!t,selectionEnabled:!0,iconClass:f.checkmarkIcon,clickFunction:()=>this._toggleColumnFromMenuItem(l)})))})),i.length?i:null}_toggleMenuItemSelectedIcon({item:e}){null==e||e.set("iconClass",null!=e&&e.selected?f.menuItemGroupOpenedIcon:f.menuItemGroupClosedIcon)}_toggleColumnFromMenuItem(e){const{grid:t,viewModel:l}=this,o=l.findColumn(e);null!=o&&o.hidden?t.showColumn(e):t.hideColumn(e)}};e([i("viewModel.attachmentsEnabled")],M.prototype,"attachmentsEnabled",void 0),e([i("viewModel.columns")],M.prototype,"columns",void 0),e([i("viewModel.editingEnabled")],M.prototype,"editingEnabled",void 0),e([i("viewModel.fieldConfigs")],M.prototype,"fieldConfigs",void 0),e([i("viewModel.filterGeometry")],M.prototype,"filterGeometry",void 0),e([i("viewModel.grid")],M.prototype,"grid",void 0),e([i("viewModel.highlightOnRowSelectEnabled")],M.prototype,"highlightOnRowSelectEnabled",void 0),e([r({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],M.prototype,"label",void 0),e([i("viewModel.layer")],M.prototype,"layer",void 0),e([r(),h("esri/widgets/FeatureTable/t9n/FeatureTable")],M.prototype,"messages",void 0),e([r({readOnly:!0})],M.prototype,"menu",void 0),e([r()],M.prototype,"menuConfig",void 0),e([i("viewModel.pageSize")],M.prototype,"pageSize",void 0),e([i("viewModel.relatedRecordsEnabled")],M.prototype,"relatedRecordsEnabled",void 0),e([i("viewModel.state")],M.prototype,"state",void 0),e([i("viewModel.view")],M.prototype,"view",void 0),e([r()],M.prototype,"viewModel",void 0),e([r()],M.prototype,"visibleElements",void 0),e([n("visibleElements")],M.prototype,"castVisibleElements",null),e([i("viewModel.clearHighlights")],M.prototype,"clearHighlights",null),e([i("viewModel.clearSelection")],M.prototype,"clearSelection",null),e([i("viewModel.deselectRows")],M.prototype,"deselectRows",null),e([i("viewModel.refresh")],M.prototype,"refresh",null),e([i("viewModel.sortColumn")],M.prototype,"sortColumn",null),e([i("viewModel.selectRows")],M.prototype,"selectRows",null),e([i("viewModel.scrollToIndex")],M.prototype,"scrollToIndex",null),M=e([a("esri.widgets.FeatureTable")],M);const y=M;export{y as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import t from"../core/Collection.js";import{HandleOwnerMixin as l}from"../core/HandleOwner.js";import{on as o,watch as s}from"../core/watchUtils.js";import{aliasOf as i}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import"../core/has.js";import{cast as n}from"../core/accessorSupport/decorators/cast.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import{subclass as a}from"../core/accessorSupport/decorators/subclass.js";import d from"./Widget.js";import u from"./FeatureTable/FeatureTableViewModel.js";import c from"./FeatureTable/Grid/support/ButtonMenu.js";import m from"./FeatureTable/Grid/support/ButtonMenuItem.js";import"./support/widgetUtils.js";import{messageBundle as h}from"./support/decorators/messageBundle.js";import"../core/Logger.js";import{tsx as p}from"./support/jsxFactory.js";import{onLocaleChange as g}from"../intl/locale.js";import{substitute as v}from"../intl/substitute.js";import{fetchMessageBundle as w}from"../intl/messages.js";const b={header:!0,menu:!0,menuItems:{clearSelection:!0,refreshData:!0,toggleColumns:!0},selectionColumn:!0,columnMenus:!0},f={base:"esri-feature-table",header:"esri-feature-table__header",title:"esri-feature-table__title",content:"esri-feature-table__content",loader:"esri-feature-table__loader",loaderContainer:"esri-feature-table__loader-container",menuContainer:"esri-feature-table__menu",menuIcon:"esri-icon-handle-horizontal",menuItemGroupOpenedIcon:"esri-icon-down",menuItemGroupClosedIcon:"esri-icon-right",checkmarkIcon:"esri-icon-check-mark",widget:"esri-widget"};let M=class extends(l(d)){constructor(e,l){super(e,l),this.attachmentsEnabled=null,this.columns=new t,this.editingEnabled=null,this.fieldConfigs=null,this.filterGeometry=null,this.grid=null,this.highlightOnRowSelectEnabled=!0,this.label=void 0,this.layer=null,this.messages=null,this.menu=null,this.menuConfig=null,this.pageSize=50,this.view=null,this.viewModel=new u,this.visibleElements={...b}}initialize(){var e,t,l;const i=async()=>this.messages=await w("esri/widgets/FeatureTable/t9n/FeatureTable");i(),this.handles.add([g(i),o(this,"grid.selectedItems","change",(e=>this._onSelectionChange(e))),s(this,["viewModel.store.querying","viewModel.store.syncing","grid.size"],(()=>this.scheduleRender())),o(this,"viewModel.columns","change",(()=>this._updateMenuItems())),s(this,"menuConfig",(()=>this._syncMenuConfig())),s(this,"messages",(()=>{var e;this.menu.label=null==(e=this.messages)?void 0:e.options,this._updateMenuItems()}))]),this._set("menu",new c({label:null==(e=this.messages)?void 0:e.options,iconClass:f.menuIcon,...this.menuConfig}));const{attachmentsEnabled:n,relatedRecordsEnabled:r}=this;null==(t=this.viewModel)||null==(l=t.store)||l.set({attachmentsEnabled:n,relatedRecordsEnabled:r})}destroy(){var e;this.clearSelection(),this.handles.removeAll(),null==(e=this.menu)||e.destroy()}castVisibleElements(e){var t;const l={...b,...e};return null==(t=this.grid)||t.set("visibleElements",{...this.grid.visibleElements,selectionColumn:l.selectionColumn,columnMenus:l.columnMenus}),l}clearHighlights(){}clearSelection(){}deselectRows(){}hideColumn(e){var t;null==(t=this.grid)||t.hideColumn(e),this._updateMenuItems()}refresh(){}showColumn(e){var t;null==(t=this.grid)||t.showColumn(e),this._updateMenuItems()}sortColumn(){}selectRows(){}scrollToIndex(){}render(){var e;return p("div",{bind:this,class:this.classes(f.base,f.widget)},this.visibleElements.header?this._renderHeader():null,p("div",{class:f.content},"disabled"!==this.state&&(null==(e=this.grid)?void 0:e.render())))}_renderHeader(){return p("div",{key:"header",class:f.header},this._renderLoader(),this._renderTitle(),this.visibleElements.menu?this._renderMenu():null)}_renderTitle(){return p("div",{class:f.title,key:"title"},this._getTitle())}_getTitle(){const{grid:e,layer:{title:t},messages:l,viewModel:{size:o}}=this;return e?v(l.header,{title:t,count:o,selected:e.selectedItems.length||0}):""}_renderLoader(){const{state:e,store:t}=this.viewModel,l="loading"===e||t.syncing||t.querying;return p("div",{class:f.loaderContainer},l?p("div",{class:f.loader,key:"loader"}):null)}_renderMenu(){return p("div",{class:f.menuContainer},this.menu.render())}_onSelectionChange(e){const{added:t,removed:l}=e;this.emit("selection-change",{added:[...t],removed:[...l]})}_syncMenuConfig(){var e;null==(e=this.menu)||e.set({...this.menuConfig,items:this._getMenuItems()})}_updateMenuItems(){var e;null==(e=this.menu)||e.set("items",this._getMenuItems())}_getMenuItems(){var e;const t=null==(e=this.menuConfig)?void 0:e.items,l=this._getDefaultMenuItems(),o=[];return(null==l?void 0:l.length)&&o.push(...l),(null==t?void 0:t.length)&&o.push(...t),o}_getDefaultMenuItems(){var e;const{messages:t,viewModel:l,visibleElements:o}=this,{menuItems:s}=o,i=[];return(null==s?void 0:s.clearSelection)&&i.push(new m({selectionEnabled:!1,label:null==t?void 0:t.clearSelection,clickFunction:()=>this.clearSelection()})),(null==s?void 0:s.refreshData)&&i.push(new m({selectionEnabled:!1,label:null==t?void 0:t.refreshData,clickFunction:()=>this.refresh()})),(null==s?void 0:s.toggleColumns)&&i.push(new m({iconClass:f.menuItemGroupClosedIcon,label:null==t?void 0:t.toggleColumns,clickFunction:this._toggleMenuItemSelectedIcon,items:null==l||null==(e=l.columns)?void 0:e.items.map((({header:e,hidden:t,path:l})=>new m({label:e||l,selected:!t,selectionEnabled:!0,iconClass:f.checkmarkIcon,clickFunction:()=>this._toggleColumnFromMenuItem(l)})))})),i.length?i:null}_toggleMenuItemSelectedIcon({item:e}){null==e||e.set("iconClass",null!=e&&e.selected?f.menuItemGroupOpenedIcon:f.menuItemGroupClosedIcon)}_toggleColumnFromMenuItem(e){const{grid:t,viewModel:l}=this,o=l.findColumn(e);null!=o&&o.hidden?t.showColumn(e):t.hideColumn(e)}};e([i("viewModel.attachmentsEnabled")],M.prototype,"attachmentsEnabled",void 0),e([i("viewModel.columns")],M.prototype,"columns",void 0),e([i("viewModel.editingEnabled")],M.prototype,"editingEnabled",void 0),e([i("viewModel.fieldConfigs")],M.prototype,"fieldConfigs",void 0),e([i("viewModel.filterGeometry")],M.prototype,"filterGeometry",void 0),e([i("viewModel.grid")],M.prototype,"grid",void 0),e([i("viewModel.highlightOnRowSelectEnabled")],M.prototype,"highlightOnRowSelectEnabled",void 0),e([r({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],M.prototype,"label",void 0),e([i("viewModel.layer")],M.prototype,"layer",void 0),e([r(),h("esri/widgets/FeatureTable/t9n/FeatureTable")],M.prototype,"messages",void 0),e([r({readOnly:!0})],M.prototype,"menu",void 0),e([r()],M.prototype,"menuConfig",void 0),e([i("viewModel.pageSize")],M.prototype,"pageSize",void 0),e([i("viewModel.relatedRecordsEnabled")],M.prototype,"relatedRecordsEnabled",void 0),e([i("viewModel.state")],M.prototype,"state",void 0),e([i("viewModel.view")],M.prototype,"view",void 0),e([r()],M.prototype,"viewModel",void 0),e([r()],M.prototype,"visibleElements",void 0),e([n("visibleElements")],M.prototype,"castVisibleElements",null),e([i("viewModel.clearHighlights")],M.prototype,"clearHighlights",null),e([i("viewModel.clearSelection")],M.prototype,"clearSelection",null),e([i("viewModel.deselectRows")],M.prototype,"deselectRows",null),e([i("viewModel.refresh")],M.prototype,"refresh",null),e([i("viewModel.sortColumn")],M.prototype,"sortColumn",null),e([i("viewModel.selectRows")],M.prototype,"selectRows",null),e([i("viewModel.scrollToIndex")],M.prototype,"scrollToIndex",null),M=e([a("esri.widgets.FeatureTable")],M);const y=M;export{y as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.23/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Collection.js";import s from"../../core/Evented.js";import i from"../../core/Handles.js";import{debounce as r,throwIfNotAbortError as a}from"../../core/promiseUtils.js";import{init as o,watch as l}from"../../core/watchUtils.js";import{property as n}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as c}from"../../core/accessorSupport/decorators/subclass.js";import d from"./ListItem.js";import{getItemLayers as h,findLayerListMode as m}from"./support/layerListUtils.js";const p=300,y={view:"view",viewLayers:"view-layers",mapLayers:"map-layers",layerViews:"layer-views",layerListMode:"layer-list-mode"},_="hide",v=t.ofType(d);let L=class extends s.EventedAccessor{constructor(e){super(e),this._handles=new i,this.listItemCreatedFunction=null,this.operationalItems=new v,this.view=null,this._callListItemsCreatedDebounced=r((async()=>this._callListItemsCreated()),p)}initialize(){this._handles.add(o(this,["view","view.ready"],(()=>this._viewHandles())),y.view)}destroy(){this._handles.destroy(),this._handles=null,this.view=null,this.operationalItems.removeAll()}get state(){const e=this.get("view");return this.get("view.ready")?"ready":e?"loading":"disabled"}triggerAction(e,t){e&&!e.disabled&&this.emit("trigger-action",{action:e,item:t})}moveListItem(e,t,s,i){var r,a;const o=null==e?void 0:e.layer;if(!o)return;const l=null==(r=this.view)||null==(a=r.map)?void 0:a.layers,n=t?h(t):l,c=s?h(s):l;if(!n||!c)return;const{operationalItems:d}=this,m=(null==t?void 0:t.children)||d,p=(null==s?void 0:s.children)||d,y=c.length-i;e.parent=s||null,m.includes(e)&&m.remove(e),n.includes(o)&&n.remove(o),p.includes(e)||p.add(e,y),c.includes(o)||c.add(o,y)}_createLayerViewHandles(e){const{_handles:t}=this;t.remove(y.layerViews),this._compileList(),e&&t.add(e.on("change",(()=>this._compileList())),y.layerViews)}_createMapLayerHandles(e){const{_handles:t}=this;t.remove(y.mapLayers),this._compileList(),e&&t.add(e.on("change",(()=>this._compileList())),y.mapLayers)}_watchItemProperties(e){this._handles.add([e.children.on("change",(()=>{this._callListItemCreatedChildren(e.children)}))],`children-change-${e.uid}`)}_callListItemCreatedChildren(e){e.forEach((e=>this._callListItemCreated(e)))}_callListItemCreated(e){if("function"==typeof this.listItemCreatedFunction){const t={item:e};this.listItemCreatedFunction.call(null,t)}this._callListItemCreatedChildren(e.children)}_createListItem(e){const{view:t}=this,s=new d({layer:e,view:t});return this._watchItemProperties(s),s}_removeAllItems(){const{_handles:e,operationalItems:t}=this;t.forEach((t=>{e.remove(`children-change-${t.uid}`)})),t.removeAll()}_getViewableLayers(e){if(e)return e.filter((e=>m(e)!==_))}_watchLayersListMode(e){const{_handles:t}=this;t.remove(y.layerListMode),e&&e.forEach((e=>{t.add(l(e,"listMode",(()=>this._compileList())),y.layerListMode)}))}_compileList(){const e=this.get("view.map.layers");this._watchLayersListMode(e);const t=this._getViewableLayers(e);t&&t.length?(this._createNewItems(t),this._removeItems(t),this._sortItems(t),this._beforeCallListItemsCreated()):this._removeAllItems()}async _beforeCallListItemsCreated(){return this._callListItemsCreatedDebounced().catch(a)}async _callListItemsCreated(){var e;await(null==(e=this.view)?void 0:e.when()),this.operationalItems.forEach((e=>this._callListItemCreated(e)))}_createNewItems(e){const{operationalItems:t}=this;e.forEach((e=>{t.find((t=>t.layer===e))||t.add(this._createListItem(e))}))}_removeItems(e){const{_handles:t,operationalItems:s}=this,i=[];s.forEach((s=>{s&&e&&e.find((e=>s.layer===e))||(t.remove(`children-change-${s.uid}`),i.push(s))})),s.removeMany(i)}_sortItems(e){const{operationalItems:t}=this;t.sort(((t,s)=>{const i=e.indexOf(t.layer),r=e.indexOf(s.layer);return i>r?-1:i<r?1:0}))}_viewHandles(){const{_handles:e,view:t}=this;e.remove([y.mapLayers,y.layerViews,y.viewLayers]),this._compileList(),t&&t.ready&&e.add([o(this,"view.map.allLayers",(e=>this._createMapLayerHandles(e))),o(this,"view.allLayerViews",(e=>this._createLayerViewHandles(e))),o(this,"listItemCreatedFunction",(()=>this._compileList()))],y.viewLayers)}};e([n()],L.prototype,"listItemCreatedFunction",void 0),e([n({type:v})],L.prototype,"operationalItems",void 0),e([n({readOnly:!0})],L.prototype,"state",null),e([n()],L.prototype,"view",void 0),L=e([c("esri.widgets.LayerList.LayerListViewModel")],L);const w=L;export{w as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Collection.js";import s from"../../core/Evented.js";import i from"../../core/Handles.js";import{debounce as r,throwIfNotAbortError as a}from"../../core/promiseUtils.js";import{init as o,watch as l}from"../../core/watchUtils.js";import{property as n}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as c}from"../../core/accessorSupport/decorators/subclass.js";import d from"./ListItem.js";import{getItemLayers as h,findLayerListMode as m}from"./support/layerListUtils.js";const p=300,y={view:"view",viewLayers:"view-layers",mapLayers:"map-layers",layerViews:"layer-views",layerListMode:"layer-list-mode",children:"children"},_="hide",v=t.ofType(d);let w=class extends s.EventedAccessor{constructor(e){super(e),this._handles=new i,this.listItemCreatedFunction=null,this.operationalItems=new v,this.view=null,this._callListItemsCreatedDebounced=r((async()=>this._callListItemsCreated()),p)}initialize(){this._handles.add(o(this,["view","view.ready"],(()=>this._viewHandles())),y.view)}destroy(){this._handles.destroy(),this._handles=null,this.view=null,this.operationalItems.removeAll()}get state(){const e=this.get("view");return this.get("view.ready")?"ready":e?"loading":"disabled"}triggerAction(e,t){e&&!e.disabled&&this.emit("trigger-action",{action:e,item:t})}moveListItem(e,t,s,i){var r,a;const o=null==e?void 0:e.layer;if(!o)return;const l=null==(r=this.view)||null==(a=r.map)?void 0:a.layers,n=t?h(t):l,c=s?h(s):l;if(!n||!c)return;const{operationalItems:d}=this,m=(null==t?void 0:t.children)||d,p=(null==s?void 0:s.children)||d,y=c.length-i;e.parent=s||null,m.includes(e)&&m.remove(e),n.includes(o)&&n.remove(o),p.includes(e)||p.add(e,y),c.includes(o)||c.add(o,y)}_createLayerViewHandles(e){const{_handles:t}=this;t.remove(y.layerViews),this._compileList(),e&&t.add(e.on("change",(()=>this._compileList())),y.layerViews)}_createMapLayerHandles(e){const{_handles:t}=this;t.remove(y.mapLayers),this._compileList(),e&&t.add(e.on("change",(()=>this._compileList())),y.mapLayers)}_watchItemProperties(e){this._watchItemChildren(e,`${y.children}-${e.uid}`)}_watchItemChildren(e,t){this._handles.add([e.children.on("change",(()=>{this._callListItemCreatedChildren(e.children)}))],t),e.children.forEach((e=>this._watchItemChildren(e,t)))}_callListItemCreatedChildren(e){e.forEach((e=>this._callListItemCreated(e)))}_callListItemCreated(e){if("function"==typeof this.listItemCreatedFunction){const t={item:e};this.listItemCreatedFunction.call(null,t)}this._callListItemCreatedChildren(e.children)}_createListItem(e){const{view:t}=this,s=new d({layer:e,view:t});return this._watchItemProperties(s),s}_removeAllItems(){const{_handles:e,operationalItems:t}=this;t.forEach((t=>{e.remove(`${y.children}-${t.uid}`)})),t.removeAll()}_getViewableLayers(e){if(e)return e.filter((e=>m(e)!==_))}_watchLayersListMode(e){const{_handles:t}=this;t.remove(y.layerListMode),e&&e.forEach((e=>{t.add(l(e,"listMode",(()=>this._compileList())),y.layerListMode)}))}_compileList(){const e=this.get("view.map.layers");this._watchLayersListMode(e);const t=this._getViewableLayers(e);t&&t.length?(this._createNewItems(t),this._removeItems(t),this._sortItems(t),this._beforeCallListItemsCreated()):this._removeAllItems()}async _beforeCallListItemsCreated(){return this._callListItemsCreatedDebounced().catch(a)}async _callListItemsCreated(){var e;await(null==(e=this.view)?void 0:e.when()),this.operationalItems.forEach((e=>this._callListItemCreated(e)))}_createNewItems(e){const{operationalItems:t}=this;e.forEach((e=>{t.find((t=>t.layer===e))||t.add(this._createListItem(e))}))}_removeItems(e){const{_handles:t,operationalItems:s}=this,i=[];s.forEach((s=>{s&&e&&e.find((e=>s.layer===e))||(t.remove(`${y.children}-${s.uid}`),i.push(s))})),s.removeMany(i)}_sortItems(e){const{operationalItems:t}=this;t.sort(((t,s)=>{const i=e.indexOf(t.layer),r=e.indexOf(s.layer);return i>r?-1:i<r?1:0}))}_viewHandles(){const{_handles:e,view:t}=this;e.remove([y.mapLayers,y.layerViews,y.viewLayers]),this._compileList(),t&&t.ready&&e.add([o(this,"view.map.allLayers",(e=>this._createMapLayerHandles(e))),o(this,"view.allLayerViews",(e=>this._createLayerViewHandles(e))),o(this,"listItemCreatedFunction",(()=>this._compileList()))],y.viewLayers)}};e([n()],w.prototype,"listItemCreatedFunction",void 0),e([n({type:v})],w.prototype,"operationalItems",void 0),e([n({readOnly:!0})],w.prototype,"state",null),e([n()],w.prototype,"view",void 0),w=e([c("esri.widgets.LayerList.LayerListViewModel")],w);const L=w;export{L as default};