@arcgis/core 4.33.0-next.20250528 → 4.33.0-next.20250530

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 (241) hide show
  1. package/applications/ExperienceBuilder/sketchUtils.d.ts +1 -0
  2. package/applications/ExperienceBuilder/sketchUtils.js +1 -1
  3. package/assets/esri/core/workers/RemoteClient.js +1 -1
  4. package/assets/esri/core/workers/chunks/{feaf79b69d2e2a1f2aa2.js → 06877ea5b9df7de89aff.js} +1 -1
  5. package/assets/esri/core/workers/chunks/09907c9ff597df9bc954.js +1 -0
  6. package/assets/esri/core/workers/chunks/{0716b21b1cfb8df066fa.js → 0dbb350ce651bc236ec8.js} +1 -1
  7. package/assets/esri/core/workers/chunks/0ed4ec00ef16aa58a33d.js +1 -0
  8. package/assets/esri/core/workers/chunks/109e5635c1b9a0929d16.js +1 -0
  9. package/assets/esri/core/workers/chunks/1573c017fd9fc0fe7527.js +1 -0
  10. package/assets/esri/core/workers/chunks/{0624ae07d3af8d5f1ac8.js → 15b3eb60f86954783fab.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{b845586219f284a215b2.js → 1db026cc25338dbc208e.js} +1 -1
  12. package/assets/esri/core/workers/chunks/21de4516bf5c9630edfd.js +1 -0
  13. package/assets/esri/core/workers/chunks/2254989ca3ff3960f2fe.js +1 -0
  14. package/assets/esri/core/workers/chunks/2dbd18df5c691c8d0a61.js +1 -0
  15. package/assets/esri/core/workers/chunks/2e1ceff3f88a6c78dfa2.js +1 -0
  16. package/assets/esri/core/workers/chunks/{847e88e1d6da1e74cdc8.js → 2ecc1057d53e0b4a60b7.js} +1 -1
  17. package/assets/esri/core/workers/chunks/3025e420e13e2bc8c0a1.js +1 -0
  18. package/assets/esri/core/workers/chunks/32537e2b014bc3d82f5c.js +346 -0
  19. package/assets/esri/core/workers/chunks/34f55bb89ddf26b10260.js +1 -0
  20. package/assets/esri/core/workers/chunks/355ab428a04ee9fcf888.js +1 -0
  21. package/assets/esri/core/workers/chunks/3a6ddff13bd47ed11798.js +1 -0
  22. package/assets/esri/core/workers/chunks/3a74654fa539f78ceb86.js +1 -0
  23. package/assets/esri/core/workers/chunks/3bec10a4f01757590c1c.js +1 -0
  24. package/assets/esri/core/workers/chunks/427318722815bef1496b.js +1 -0
  25. package/assets/esri/core/workers/chunks/4c3bd6cc0badb78c7112.js +1 -0
  26. package/assets/esri/core/workers/chunks/500fb5f615f0c1db1b66.js +1 -0
  27. package/assets/esri/core/workers/chunks/5222523fff30d07f88de.js +1 -0
  28. package/assets/esri/core/workers/chunks/539541dec5fcf3b657aa.js +1 -0
  29. package/assets/esri/core/workers/chunks/53e8c061f36516c3c3e4.js +1 -0
  30. package/assets/esri/core/workers/chunks/{ca76950d81ab4ebb65e1.js → 58f403f956b7b3467344.js} +1 -1
  31. package/assets/esri/core/workers/chunks/5a01bd7a9ee24be7bac4.js +1 -0
  32. package/assets/esri/core/workers/chunks/5bfcb3d87380e7f85b08.js +1 -0
  33. package/assets/esri/core/workers/chunks/{4dd0a5f327fa5fc7249d.js → 5ef1095842e21090f1f4.js} +1 -1
  34. package/assets/esri/core/workers/chunks/604d7250ed5e1edd59ac.js +1 -0
  35. package/assets/esri/core/workers/chunks/614bc3f05873b37af091.js +1 -0
  36. package/assets/esri/core/workers/chunks/6194636638b0439fccd8.js +1 -0
  37. package/assets/esri/core/workers/chunks/66e4cb2479bed1384ed5.js +1 -0
  38. package/assets/esri/core/workers/chunks/6b0ae9ccdd1acef5b5b4.js +1 -0
  39. package/assets/esri/core/workers/chunks/7112b092d98172b7db8b.js +1 -0
  40. package/assets/esri/core/workers/chunks/72ea996b03932c0f004f.js +1 -0
  41. package/assets/esri/core/workers/chunks/74d18c22fa1c178bd9df.js +1 -0
  42. package/assets/esri/core/workers/chunks/766e08d0c56b2b31b63b.js +1 -0
  43. package/assets/esri/core/workers/chunks/{cdb022ffffc6554de83a.js → 77dbb1d5d5e1a6ced932.js} +1 -1
  44. package/assets/esri/core/workers/chunks/{bd7b54db7fd278b15500.js → 7a2189614f2dad49ffcd.js} +1 -1
  45. package/assets/esri/core/workers/chunks/7a55e9cf27089ee1ef1f.js +1 -0
  46. package/assets/esri/core/workers/chunks/7ae88c141a5d85e5bb88.js +1 -0
  47. package/assets/esri/core/workers/chunks/7aef81778155be373d3e.js +1 -0
  48. package/assets/esri/core/workers/chunks/7e1906d35a764f7f10b0.js +1 -0
  49. package/assets/esri/core/workers/chunks/80777a9db53bee2ad8a8.js +1 -0
  50. package/assets/esri/core/workers/chunks/8249b5de5c15461a6787.js +1 -0
  51. package/assets/esri/core/workers/chunks/8385c13ac10e595374cb.js +1 -0
  52. package/assets/esri/core/workers/chunks/83db8bd42f94f97c7cf1.js +1 -0
  53. package/assets/esri/core/workers/chunks/88b1214c284c2ec7d51b.js +1 -0
  54. package/assets/esri/core/workers/chunks/8b86c75426c55b29ebed.js +1 -0
  55. package/assets/esri/core/workers/chunks/8c4b26d86483646c70d2.js +1 -0
  56. package/assets/esri/core/workers/chunks/9cb242dfc3765b590f51.js +1 -0
  57. package/assets/esri/core/workers/chunks/9f0f1472f36b42c507d1.js +1 -0
  58. package/assets/esri/core/workers/chunks/9fe62638dc7dce466612.js +1 -0
  59. package/assets/esri/core/workers/chunks/a2e9141ff4efd13413a1.js +66 -0
  60. package/assets/esri/core/workers/chunks/b534a8d70018ce16400b.js +1 -0
  61. package/assets/esri/core/workers/chunks/b763292829aa4d3fab60.js +1 -0
  62. package/assets/esri/core/workers/chunks/{54ea93f416ab52b413c1.js → b9f93c233c55bb528412.js} +1 -1
  63. package/assets/esri/core/workers/chunks/bbbd58b02a3ee8fe595e.js +1 -0
  64. package/assets/esri/core/workers/chunks/c3d95f7f4370486eed2c.js +1 -0
  65. package/assets/esri/core/workers/chunks/c3df693d1bce8f189fa2.js +1 -0
  66. package/assets/esri/core/workers/chunks/{6993a59cbb78bc26f029.js → c45a314ace9725aa250e.js} +1 -1
  67. package/assets/esri/core/workers/chunks/c96fed4889712f5a9135.js +1 -0
  68. package/assets/esri/core/workers/chunks/c9fbada1e84981784f6c.js +1 -0
  69. package/assets/esri/core/workers/chunks/cefcecbeef4f0a46f58c.js +1 -0
  70. package/assets/esri/core/workers/chunks/d2317b87aa2ac3ad97a6.js +1 -0
  71. package/assets/esri/core/workers/chunks/{0bbb38f59f37c51c72f0.js → d45a4e5806a80b69ceec.js} +1 -1
  72. package/assets/esri/core/workers/chunks/{7a23dc625a812a562c21.js → d5f770302dc686e55ba7.js} +1 -1
  73. package/assets/esri/core/workers/chunks/dc14507cfc052faa5890.js +1 -0
  74. package/assets/esri/core/workers/chunks/e7a440476cd1eb4c6547.js +1 -0
  75. package/assets/esri/core/workers/chunks/ede9738ac20e7dd5ce63.js +1 -0
  76. package/assets/esri/core/workers/chunks/eec034d88db320880133.js +1 -0
  77. package/assets/esri/core/workers/chunks/f1e87720b425d7fb348a.js +1 -0
  78. package/assets/esri/core/workers/chunks/fd207a40faf882d3b2a3.js +1 -0
  79. package/assets/esri/widgets/Editor/t9n/Editor_ar.json +1 -1
  80. package/assets/esri/widgets/Editor/t9n/Editor_bg.json +1 -1
  81. package/assets/esri/widgets/Editor/t9n/Editor_bs.json +1 -1
  82. package/assets/esri/widgets/Editor/t9n/Editor_ca.json +1 -1
  83. package/assets/esri/widgets/Editor/t9n/Editor_cs.json +1 -1
  84. package/assets/esri/widgets/Editor/t9n/Editor_da.json +1 -1
  85. package/assets/esri/widgets/Editor/t9n/Editor_de.json +1 -1
  86. package/assets/esri/widgets/Editor/t9n/Editor_el.json +1 -1
  87. package/assets/esri/widgets/Editor/t9n/Editor_es.json +1 -1
  88. package/assets/esri/widgets/Editor/t9n/Editor_et.json +1 -1
  89. package/assets/esri/widgets/Editor/t9n/Editor_fi.json +1 -1
  90. package/assets/esri/widgets/Editor/t9n/Editor_fr.json +1 -1
  91. package/assets/esri/widgets/Editor/t9n/Editor_he.json +1 -1
  92. package/assets/esri/widgets/Editor/t9n/Editor_hr.json +1 -1
  93. package/assets/esri/widgets/Editor/t9n/Editor_hu.json +1 -1
  94. package/assets/esri/widgets/Editor/t9n/Editor_id.json +1 -1
  95. package/assets/esri/widgets/Editor/t9n/Editor_it.json +1 -1
  96. package/assets/esri/widgets/Editor/t9n/Editor_ja.json +1 -1
  97. package/assets/esri/widgets/Editor/t9n/Editor_ko.json +1 -1
  98. package/assets/esri/widgets/Editor/t9n/Editor_lt.json +1 -1
  99. package/assets/esri/widgets/Editor/t9n/Editor_lv.json +1 -1
  100. package/assets/esri/widgets/Editor/t9n/Editor_nl.json +1 -1
  101. package/assets/esri/widgets/Editor/t9n/Editor_no.json +1 -1
  102. package/assets/esri/widgets/Editor/t9n/Editor_pl.json +1 -1
  103. package/assets/esri/widgets/Editor/t9n/Editor_pt-BR.json +1 -1
  104. package/assets/esri/widgets/Editor/t9n/Editor_pt-PT.json +1 -1
  105. package/assets/esri/widgets/Editor/t9n/Editor_ro.json +1 -1
  106. package/assets/esri/widgets/Editor/t9n/Editor_ru.json +1 -1
  107. package/assets/esri/widgets/Editor/t9n/Editor_sk.json +1 -1
  108. package/assets/esri/widgets/Editor/t9n/Editor_sl.json +1 -1
  109. package/assets/esri/widgets/Editor/t9n/Editor_sr.json +1 -1
  110. package/assets/esri/widgets/Editor/t9n/Editor_sv.json +1 -1
  111. package/assets/esri/widgets/Editor/t9n/Editor_th.json +1 -1
  112. package/assets/esri/widgets/Editor/t9n/Editor_tr.json +1 -1
  113. package/assets/esri/widgets/Editor/t9n/Editor_uk.json +1 -1
  114. package/assets/esri/widgets/Editor/t9n/Editor_vi.json +1 -1
  115. package/assets/esri/widgets/Editor/t9n/Editor_zh-CN.json +1 -1
  116. package/assets/esri/widgets/Editor/t9n/Editor_zh-HK.json +1 -1
  117. package/assets/esri/widgets/Editor/t9n/Editor_zh-TW.json +1 -1
  118. package/chunks/aiServices.js +1 -1
  119. package/interfaces.d.ts +67 -43
  120. package/layers/BuildingSceneLayer.js +1 -1
  121. package/layers/VideoLayer.js +1 -1
  122. package/layers/buildingSublayers/BuildingComponentSublayer.js +1 -1
  123. package/layers/graphics/editingSupport.js +1 -1
  124. package/layers/knowledgeGraph/KnowledgeGraphSublayer.js +1 -1
  125. package/layers/mixins/ImageryTileMixin.js +1 -1
  126. package/layers/mixins/operationalLayerModuleMap.js +1 -1
  127. package/layers/mixins/operationalLayers.js +1 -1
  128. package/layers/support/BuildingSummaryStatistics.js +1 -1
  129. package/layers/support/TelemetryDisplay.js +1 -1
  130. package/layers/support/TitleCreator.js +1 -1
  131. package/layers/support/featurePopupQueryUtils.js +5 -0
  132. package/layers/support/fieldUtils.js +1 -1
  133. package/layers/support/layersCreator.js +1 -1
  134. package/layers/support/multiLayerServiceUtils.js +5 -0
  135. package/networks/CircuitManager.js +1 -1
  136. package/networks/UnitIdentifierManager.js +1 -1
  137. package/networks/UtilityNetwork.js +1 -1
  138. package/package.json +1 -1
  139. package/portal/support/portalLayers.js +1 -1
  140. package/rest/featureService/FeatureService.js +1 -1
  141. package/rest/networks/circuits/queryCircuits.js +1 -1
  142. package/rest/networks/circuits/support/QueryCircuitsParameters.js +1 -1
  143. package/rest/networks/unitIdentifiers/support/{QueryUnitIdentifiersParamters.js → QueryUnitIdentifiersParameters.js} +1 -1
  144. package/support/revision.js +1 -1
  145. package/symbols/cim/effects/EffectEnclosingPolygon.js +1 -1
  146. package/symbols/cim/utils.js +1 -1
  147. package/symbols/support/cimSymbolUtils.js +1 -1
  148. package/symbols/support/previewCIMSymbol.js +1 -1
  149. package/views/3d/interactive/visualElements/DrapedVisualElementResources.js +1 -1
  150. package/views/3d/layers/BuildingComponentSublayerView3D.js +1 -1
  151. package/views/3d/layers/I3SMeshView3D.js +1 -1
  152. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  153. package/views/3d/layers/i3s/I3SUtil.js +1 -1
  154. package/views/3d/layers/support/DefinitionExpressionSceneLayerView.js +1 -1
  155. package/views/3d/layers/support/PopupSceneLayerView.js +1 -1
  156. package/views/3d/webgl-engine/core/renderPasses/AllRenderPasses.js +1 -1
  157. package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
  158. package/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js +3 -3
  159. package/views/SelectionManager.js +1 -1
  160. package/views/layers/FeatureLayerView.js +1 -1
  161. package/webdoc/support/writeUtils.js +1 -1
  162. package/webmap/utils.js +1 -1
  163. package/widgets/Attachments.js +1 -1
  164. package/widgets/BatchAttributeForm.js +1 -1
  165. package/widgets/Editor/UpdateFeaturesWorkflow.js +1 -1
  166. package/widgets/Editor/workflowUtils.js +1 -1
  167. package/widgets/Feature/support/featureUtils.js +1 -1
  168. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationItemList.js +1 -1
  169. package/widgets/FeatureTable/Grid/Grid.js +1 -1
  170. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  171. package/widgets/OrientedImageryViewer/adapters/sketch/TriangulatedMeasurementAdapter.js +1 -1
  172. package/widgets/OrientedImageryViewer/components/OrientedImageryVideoViewModel.js +1 -1
  173. package/widgets/OrientedImageryViewer/components/SequentialNavigationUI.js +1 -1
  174. package/widgets/OrientedImageryViewer/navigation/queries.js +1 -1
  175. package/widgets/OrientedImageryViewer/videoViewerUtils.js +5 -0
  176. package/widgets/OrientedImageryViewer.js +1 -1
  177. package/widgets/Sketch.js +1 -1
  178. package/widgets/support/SelectionToolbar/SelectionToolbarViewModel.js +1 -1
  179. package/widgets/support/SelectionToolbar.js +1 -1
  180. package/widgets/support/Selector2D/SelectionOperation.js +1 -1
  181. package/widgets/support/Selector2D/selectorUtils.js +1 -1
  182. package/assets/esri/core/workers/chunks/03db109e9b695528c35d.js +0 -1
  183. package/assets/esri/core/workers/chunks/09da6b3085fc84cd69d5.js +0 -1
  184. package/assets/esri/core/workers/chunks/09f76ca9b47b465c934f.js +0 -1
  185. package/assets/esri/core/workers/chunks/0a770f283eb77c8dc97a.js +0 -1
  186. package/assets/esri/core/workers/chunks/0b70b2ee62904318a12c.js +0 -1
  187. package/assets/esri/core/workers/chunks/0c2dccec20c0994366fe.js +0 -1
  188. package/assets/esri/core/workers/chunks/0d78fc2c2bc1152f84db.js +0 -1
  189. package/assets/esri/core/workers/chunks/17e43a050fbf8dc87588.js +0 -1
  190. package/assets/esri/core/workers/chunks/1d7f2abfccc54659d6f2.js +0 -1
  191. package/assets/esri/core/workers/chunks/1ee6e9a88f0676032e91.js +0 -1
  192. package/assets/esri/core/workers/chunks/1f9c6fbcd4d0eae1e574.js +0 -1
  193. package/assets/esri/core/workers/chunks/2cf82d3645c75d311e99.js +0 -1
  194. package/assets/esri/core/workers/chunks/2d90806faa4269828948.js +0 -1
  195. package/assets/esri/core/workers/chunks/3027eb0c20e996ad374a.js +0 -1
  196. package/assets/esri/core/workers/chunks/3bf1cf6c3cba172e2f6d.js +0 -1
  197. package/assets/esri/core/workers/chunks/3d7eedb787c1e3b9fbfc.js +0 -1
  198. package/assets/esri/core/workers/chunks/3fe7be535affae31de7e.js +0 -1
  199. package/assets/esri/core/workers/chunks/41cbba9b286cf5558a9c.js +0 -1
  200. package/assets/esri/core/workers/chunks/42bb9bb6fe44a47d9b81.js +0 -1
  201. package/assets/esri/core/workers/chunks/465f2db4ab8aa9c9f907.js +0 -1
  202. package/assets/esri/core/workers/chunks/4ca0738ed38c15b68a77.js +0 -1
  203. package/assets/esri/core/workers/chunks/515e3295495d0958db7e.js +0 -1
  204. package/assets/esri/core/workers/chunks/51ba7345c31e6eb79060.js +0 -1
  205. package/assets/esri/core/workers/chunks/52a57106a41b8c9483d7.js +0 -1
  206. package/assets/esri/core/workers/chunks/536d7986ebb710a8a452.js +0 -1
  207. package/assets/esri/core/workers/chunks/56d2a20c1b143697aa19.js +0 -1
  208. package/assets/esri/core/workers/chunks/5890740d5a761b038560.js +0 -1
  209. package/assets/esri/core/workers/chunks/5dbd8d81d94cfda5bb32.js +0 -1
  210. package/assets/esri/core/workers/chunks/5e1f7fe6bbc5754efee1.js +0 -1
  211. package/assets/esri/core/workers/chunks/61f9747c960d959b571b.js +0 -346
  212. package/assets/esri/core/workers/chunks/6408b7845858cf18102f.js +0 -1
  213. package/assets/esri/core/workers/chunks/74c0db9e3a62e9839b23.js +0 -1
  214. package/assets/esri/core/workers/chunks/7b12607633bbdc318936.js +0 -1
  215. package/assets/esri/core/workers/chunks/86023cc5ccbc7ac43479.js +0 -1
  216. package/assets/esri/core/workers/chunks/87eca6de502d18d8b7eb.js +0 -1
  217. package/assets/esri/core/workers/chunks/8aa8f9986b966ccb64e2.js +0 -1
  218. package/assets/esri/core/workers/chunks/8d14e957219364a81d5f.js +0 -66
  219. package/assets/esri/core/workers/chunks/937b653b10e8704b38bf.js +0 -1
  220. package/assets/esri/core/workers/chunks/98ef17d15517368d2383.js +0 -1
  221. package/assets/esri/core/workers/chunks/9cac00d4bfac14aaae12.js +0 -1
  222. package/assets/esri/core/workers/chunks/a0c35521e677459f6fa3.js +0 -1
  223. package/assets/esri/core/workers/chunks/a32dcd5bc4680374d30c.js +0 -1
  224. package/assets/esri/core/workers/chunks/aaa6d45316a7d3466d0f.js +0 -1
  225. package/assets/esri/core/workers/chunks/ae733c963d61065faa54.js +0 -1
  226. package/assets/esri/core/workers/chunks/b2a6afa0cd537805b4b8.js +0 -1
  227. package/assets/esri/core/workers/chunks/bf9b6b74654d303a6dae.js +0 -1
  228. package/assets/esri/core/workers/chunks/c6580fdcdc33153008b0.js +0 -1
  229. package/assets/esri/core/workers/chunks/c779335f5d5455c77a62.js +0 -1
  230. package/assets/esri/core/workers/chunks/cc4fe89e4f604e3c52ae.js +0 -1
  231. package/assets/esri/core/workers/chunks/cc9dd8924bfeb8bcd278.js +0 -1
  232. package/assets/esri/core/workers/chunks/d3c0d7799c92c6f0e7d3.js +0 -1
  233. package/assets/esri/core/workers/chunks/d52f5214a0330ed2e05e.js +0 -1
  234. package/assets/esri/core/workers/chunks/dbe10c20df7e0e563a0b.js +0 -1
  235. package/assets/esri/core/workers/chunks/df7ca2fe12e22ccfde17.js +0 -1
  236. package/assets/esri/core/workers/chunks/df933eac03dc63064723.js +0 -1
  237. package/assets/esri/core/workers/chunks/ee6240636d04d7d37b7b.js +0 -1
  238. package/assets/esri/core/workers/chunks/f00f8609bf0d14b488b8.js +0 -1
  239. package/assets/esri/core/workers/chunks/f1c6df5cf2ccb6ac47a1.js +0 -1
  240. package/assets/esri/core/workers/chunks/f3d97a4c4f433adbdab5.js +0 -1
  241. package/assets/esri/core/workers/chunks/fc0a3db3d6d26c763fb9.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as s}from"../../../../../chunks/tslib.es6.js";import"../../../../../core/Logger.js";import"../../../../../core/has.js";import"../../../../../core/RandomLCG.js";import"../../../../../core/Error.js";import{subclass as e}from"../../../../../core/accessorSupport/decorators/subclass.js";import{fromMat4 as t,transpose as r,invert as a}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as i}from"../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{copy as o}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{i as h,c as n}from"../../../../../chunks/vec32.js";import{create as m}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{MaterialPassParameters as c,ShadowMapPassParameters as l,HighlightPassParameters as u,ViewshedShadowMapPassParameters as d,AllRenderPasses as p}from"./AllRenderPasses.js";import{RenderPassIdentifier as _}from"./RenderPassIdentifier.js";import{ShaderOutput as P}from"../shaderLibrary/ShaderOutput.js";import{TwoVectorPosition as g}from"../util/TwoVectorPosition.js";import{SyncRenderPlugin as w}from"../../effects/RenderPlugin.js";import{DepthRange as f}from"../../lib/DepthRange.js";import{RenderSlot as E}from"../../lib/RenderSlot.js";let R=class extends w{constructor(){super({}),this.produces=new Map([[E.OPAQUE_MATERIAL,s=>this._produces(s,E.OPAQUE_MATERIAL)],[E.TRANSPARENT_MATERIAL,s=>this._produces(s,E.TRANSPARENT_MATERIAL)],[E.INTEGRATED_MESH,s=>this._produces(s,E.INTEGRATED_MESH)],[E.OCCLUDED_GROUND,s=>this._produces(s,E.OCCLUDED_GROUND)]]),this._materialPassParameters=new c,this._shadowPassParameters=new l,this._highlightPassParameters=new u,this._viewshedPassParameters=new d,this._systems=new Set}initializeRenderContext(s){this._context=s,this._passes=new p(s)}get rctx(){return this._context.renderContext.rctx}uninitializeRenderContext(){}dispose(){this._context=null,this._systems.clear()}register(s){this._systems.add(s)}_produces(s,e){return!!this._invoke(s,e,(s=>s.count>0))}prepareRender(s){const{_systems:e,_passes:t}=this;if(0!==e.size&&null!=t){for(const s of Object.values(t))s.prepareSubmit();e.forEach((e=>e.submit(t,s.bind)));for(const s of Object.values(t))s.finishSubmit()}}acquireTechniques(s){if(0===this._systems.size)return null;const e=s.output===P.Shadow||s.output===P.ShadowHighlight||s.output===P.ShadowExcludeHighlight?this._shadowPassParameters:s.output===P.ViewshedShadow?this._viewshedPassParameters:s.output===P.Highlight?this._highlightPassParameters:this._materialPassParameters,t=s.bind;return this._updateParameters(t.camera,e,t.slot===E.TRANSPARENT_MATERIAL),this._materialPassParameters.output=s.output,this._invoke(s.output,s.bind.slot,((e,t)=>e.acquire(t,s.bind)))}render(s,e){this._invoke(s.output,s.bind.slot,((t,r)=>t.dispatch(r,s.bind,e)))}_invoke(s,e,t){if(null==this._passes)return null;switch(e){case E.OPAQUE_MATERIAL:switch(s){case P.Color:case P.ColorEmission:case P.Depth:case P.Normal:case P.ObjectAndLayerIdColor:return t(this._passes.opaque,this._materialPassParameters);case P.Highlight:return t(this._passes.highlight,this._highlightPassParameters);case P.Shadow:return t(this._passes.shadowMap,this._shadowPassParameters);case P.ShadowHighlight:return t(this._passes.highlightShadowMap,this._shadowPassParameters);case P.ShadowExcludeHighlight:return t(this._passes.defaultShadowMap,this._shadowPassParameters);case P.ViewshedShadow:return t(this._passes.viewshedShadowMap,this._viewshedPassParameters)}break;case E.TRANSPARENT_MATERIAL:switch(s){case P.Color:case P.ColorEmission:case P.Depth:case P.Normal:case P.ObjectAndLayerIdColor:return t(this._passes.transparent,this._materialPassParameters)}break;case E.INTEGRATED_MESH:switch(s){case P.Color:case P.ColorEmission:case P.Depth:case P.Normal:case P.ObjectAndLayerIdColor:return t(this._passes.integratedMesh,this._materialPassParameters);case P.Highlight:return t(this._passes.highlightIntegratedMesh,this._highlightPassParameters)}break;case E.OCCLUDED_GROUND:switch(s){case P.Color:case P.ColorEmission:case P.Depth:case P.Normal:case P.ObjectAndLayerIdColor:return t(this._passes.occludedGround,this._materialPassParameters)}}return null}notifyDirty(){this._context.requestRender()}queryDepthRange(s){const e=new f;return this._systems.forEach((t=>e.union(t.queryDepthRange(s)))),e}get hasEmissions(){let s=!1;return this._systems.forEach((e=>s=e.hasEmissions||s)),s}_updateParameters(s,e,i){const m=s.viewInverseTransposeMatrix;h(A,m[3],m[7],m[11]),j.set(A),n(e.transformWorldFromViewTH,j.high),n(e.transformWorldFromViewTL,j.low),n(e.slicePlaneLocalOrigin,A),t(e.transformViewFromCameraRelativeRS,s.viewMatrix),o(e.transformProjFromView,s.projectionMatrix),e.identifier===_.Material&&(this._materialPassParameters.transparent=i,r(b,e.transformViewFromCameraRelativeRS),a(e.transformNormalViewFromGlobal,b))}hasHighlight(s){for(const e of this._systems)if(e.hasHighlight(s))return!0;return!1}};R=s([e("esri.views.3d.webgl-engine.core.renderPasses.RenderPassManager")],R);const A=m(),b=i(),j=new g;export{R as RenderPassManager};
5
+ import{_ as s}from"../../../../../chunks/tslib.es6.js";import"../../../../../core/Logger.js";import"../../../../../core/has.js";import"../../../../../core/RandomLCG.js";import"../../../../../core/Error.js";import{subclass as e}from"../../../../../core/accessorSupport/decorators/subclass.js";import{fromMat4 as t,transpose as r,invert as a}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as i}from"../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{copy as o}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{i as h,c as n}from"../../../../../chunks/vec32.js";import{create as m}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{MaterialPassParameters as c,ShadowMapPassParameters as l,HighlightPassParameters as u,ViewshedShadowMapPassParameters as d,AllRenderPasses as p}from"./AllRenderPasses.js";import{RenderPassIdentifier as _}from"./RenderPassIdentifier.js";import{ShaderOutput as P}from"../shaderLibrary/ShaderOutput.js";import{TwoVectorPosition as g}from"../util/TwoVectorPosition.js";import{SyncRenderPlugin as w}from"../../effects/RenderPlugin.js";import{DepthRange as f}from"../../lib/DepthRange.js";import{RenderSlot as E}from"../../lib/RenderSlot.js";let R=class extends w{constructor(){super({}),this.produces=new Map([[E.OPAQUE_MATERIAL,s=>this._produces(s,E.OPAQUE_MATERIAL)],[E.TRANSPARENT_MATERIAL,s=>this._produces(s,E.TRANSPARENT_MATERIAL)],[E.INTEGRATED_MESH,s=>this._produces(s,E.INTEGRATED_MESH)],[E.OCCLUDED_GROUND,s=>this._produces(s,E.OCCLUDED_GROUND)]]),this._materialPassParameters=new c,this._shadowPassParameters=new l,this._highlightPassParameters=new u,this._viewshedPassParameters=new d,this._systems=new Set}initializeRenderContext(s){this._context=s,this._passes=new p(s)}get rctx(){return this._context.renderContext.rctx}uninitializeRenderContext(){}dispose(){this._context=null,this._systems.clear()}register(s){this._systems.add(s)}_produces(s,e){return!!this._invoke(s,e,(s=>s.count>0))}prepareRender(s){const{_systems:e,_passes:t}=this;if(0!==e.size&&null!=t){for(const s of Object.values(t))s.prepareSubmit();e.forEach((e=>e.submit(t,s.bind)));for(const s of Object.values(t))s.finishSubmit()}}acquireTechniques(s){if(0===this._systems.size)return null;const e=s.output===P.Shadow||s.output===P.ShadowHighlight||s.output===P.ShadowExcludeHighlight?this._shadowPassParameters:s.output===P.ViewshedShadow?this._viewshedPassParameters:s.output===P.Highlight?this._highlightPassParameters:this._materialPassParameters,t=s.bind;return this._updateParameters(t.camera,e,t.slot),this._materialPassParameters.output=s.output,this._invoke(s.output,s.bind.slot,((e,t)=>e.acquire(t,s.bind)))}render(s,e){this._invoke(s.output,s.bind.slot,((t,r)=>t.dispatch(r,s.bind,e)))}_invoke(s,e,t){if(null==this._passes)return null;switch(e){case E.OPAQUE_MATERIAL:switch(s){case P.Color:case P.ColorEmission:case P.Depth:case P.Normal:case P.ObjectAndLayerIdColor:return t(this._passes.opaque,this._materialPassParameters);case P.Highlight:return t(this._passes.highlight,this._highlightPassParameters);case P.Shadow:return t(this._passes.shadowMap,this._shadowPassParameters);case P.ShadowHighlight:return t(this._passes.highlightShadowMap,this._shadowPassParameters);case P.ShadowExcludeHighlight:return t(this._passes.defaultShadowMap,this._shadowPassParameters);case P.ViewshedShadow:return t(this._passes.viewshedShadowMap,this._viewshedPassParameters)}break;case E.TRANSPARENT_MATERIAL:switch(s){case P.Color:case P.ColorEmission:case P.Depth:case P.Normal:case P.ObjectAndLayerIdColor:return t(this._passes.transparent,this._materialPassParameters)}break;case E.INTEGRATED_MESH:switch(s){case P.Color:case P.ColorEmission:case P.Depth:case P.Normal:case P.ObjectAndLayerIdColor:return t(this._passes.integratedMesh,this._materialPassParameters);case P.Highlight:return t(this._passes.highlightIntegratedMesh,this._highlightPassParameters)}break;case E.OCCLUDED_GROUND:switch(s){case P.Color:case P.ColorEmission:case P.Depth:case P.Normal:case P.ObjectAndLayerIdColor:return t(this._passes.occludedGround,this._materialPassParameters)}}return null}notifyDirty(){this._context.requestRender()}queryDepthRange(s){const e=new f;return this._systems.forEach((t=>e.union(t.queryDepthRange(s)))),e}get hasEmissions(){let s=!1;return this._systems.forEach((e=>s=e.hasEmissions||s)),s}_updateParameters(s,e,i){const m=s.viewInverseTransposeMatrix,c=i===E.TRANSPARENT_MATERIAL,l=i===E.OCCLUDED_GROUND;h(A,m[3],m[7],m[11]),j.set(A),n(e.transformWorldFromViewTH,j.high),n(e.transformWorldFromViewTL,j.low),n(e.slicePlaneLocalOrigin,A),t(e.transformViewFromCameraRelativeRS,s.viewMatrix),o(e.transformProjFromView,s.projectionMatrix),e.identifier===_.Material&&(this._materialPassParameters.transparent=c,this._materialPassParameters.occludedGround=l,r(b,e.transformViewFromCameraRelativeRS),a(e.transformNormalViewFromGlobal,b))}hasHighlight(s){for(const e of this._systems)if(e.hasHighlight(s))return!0;return!1}};R=s([e("esri.views.3d.webgl-engine.core.renderPasses.RenderPassManager")],R);const A=m(),b=i(),j=new g;export{R as RenderPassManager};
@@ -2,7 +2,7 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{create as e}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{hasArea as o,width as r,height as t}from"../../../../../../geometry/support/aaBoundingRect.js";import{OverlayIndex as a}from"../../../../terrain/interfaces.js";import{OverlayContent as l}from"../../../../terrain/OverlayContent.js";import{RenderPassIdentifier as i}from"../../renderPasses/RenderPassIdentifier.js";import{ShaderOutput as n,isColorOrColorEmission as s}from"../ShaderOutput.js";import{addMainLightDirection as d,addMainLightIntensity as v}from"../shading/MainLighting.glsl.js";import{PBRMode as c}from"../shading/PhysicallyBasedRenderingParameters.glsl.js";import{Water as u}from"../shading/Water.glsl.js";import{Float4DrawUniform as x}from"../../shaderModules/Float4DrawUniform.js";import{FloatPassUniform as y}from"../../shaderModules/FloatPassUniform.js";import{glsl as m}from"../../shaderModules/glsl.js";import{Texture2DPassUniform as p}from"../../shaderModules/Texture2DPassUniform.js";import{Texture2DUintPassUniform as f}from"../../shaderModules/Texture2DUintPassUniform.js";import{Uniform as g}from"../../../../../webgl/Uniform.js";var h;function C(e,o){const{vertex:r,fragment:t}=e;r.uniforms.add(new x("overlayTexOffset",((e,o)=>V(e,o))),new x("overlayTexScale",((e,o)=>I(e,o)))),t.constants.add("overlayOpacity","float",1),t.uniforms.add(new p("ovColorTex",((e,o)=>b(e,o)))),T(e,o)}function O(e,o){const{vertex:r,fragment:t}=e,{output:a}=o;r.uniforms.add(new M("overlayTexOffset"),new M("overlayTexScale")),t.uniforms.add(new y("overlayOpacity",(e=>e.overlayOpacity))),a!==n.Highlight&&t.uniforms.add(new p("ovColorTex",((e,o)=>o.overlay?.getTexture(e.overlayContent)))),T(e,o)}function T(e,o){const r=o.pbrMode===c.Water||o.pbrMode===c.WaterOnIntegratedMesh||o.pbrMode===c.TerrainWithWater;r&&e.include(u,o);const{vertex:t,fragment:a,varyings:i}=e;i.add("vtcOverlay","vec4");const{output:s}=o,x=s===n.Highlight;t.code.add(m`void setOverlayVTC(in vec2 uv) {
5
+ import{create as e}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{hasArea as o,width as r,height as t}from"../../../../../../geometry/support/aaBoundingRect.js";import{OverlayIndex as a}from"../../../../terrain/interfaces.js";import{OverlayContent as l}from"../../../../terrain/OverlayContent.js";import{RenderPassIdentifier as i}from"../../renderPasses/RenderPassIdentifier.js";import{ShaderOutput as n,isColorOrColorEmission as d}from"../ShaderOutput.js";import{addMainLightDirection as s,addMainLightIntensity as v}from"../shading/MainLighting.glsl.js";import{PBRMode as c}from"../shading/PhysicallyBasedRenderingParameters.glsl.js";import{Water as u}from"../shading/Water.glsl.js";import{Float4DrawUniform as x}from"../../shaderModules/Float4DrawUniform.js";import{FloatPassUniform as y}from"../../shaderModules/FloatPassUniform.js";import{glsl as m}from"../../shaderModules/glsl.js";import{Texture2DPassUniform as p}from"../../shaderModules/Texture2DPassUniform.js";import{Texture2DUintPassUniform as f}from"../../shaderModules/Texture2DUintPassUniform.js";import{Uniform as g}from"../../../../../webgl/Uniform.js";var h;function C(e,o){const{vertex:r,fragment:t}=e;r.uniforms.add(new x("overlayTexOffset",((e,o)=>V(e,o))),new x("overlayTexScale",((e,o)=>I(e,o)))),t.constants.add("overlayOpacity","float",1),t.uniforms.add(new p("ovColorTex",((e,o)=>b(e,o)))),T(e,o)}function O(e,o){const{vertex:r,fragment:t}=e,{output:a}=o;r.uniforms.add(new M("overlayTexOffset"),new M("overlayTexScale")),t.uniforms.add(new y("overlayOpacity",(e=>e.overlayOpacity))),a!==n.Highlight&&t.uniforms.add(new p("ovColorTex",((e,o)=>o.overlay?.getTexture(e.overlayContent)))),T(e,o)}function T(e,o){const r=o.pbrMode===c.Water||o.pbrMode===c.WaterOnIntegratedMesh||o.pbrMode===c.TerrainWithWater;r&&e.include(u,o);const{vertex:t,fragment:a,varyings:i}=e;i.add("vtcOverlay","vec4");const{output:d}=o,x=d===n.Highlight;t.code.add(m`void setOverlayVTC(in vec2 uv) {
6
6
  vtcOverlay = vec4(uv, uv) * overlayTexScale + overlayTexOffset;
7
7
  }`),a.code.add(m`bool isValid(vec2 uv, vec2 dxdy) {
8
8
  return (uv.x >= 0.0 + dxdy.x) && (uv.x <= 1.0 - dxdy.x) && (uv.y >= 0.0 + dxdy.y) && (uv.y <= 1.0 - dxdy.y);
@@ -38,10 +38,10 @@ vec4 color1 = texelFetch(ovColorTex, ivec2(vec2(texCoords.z * 0.5 + 0.5, texCoor
38
38
  bool isValid0 = isValid(texCoords.xy, fwidth(texCoords.xy));
39
39
  bool isValid1 = isValid(texCoords.zw, vec2(0.0, 0.0));
40
40
  return mix(color1 * float(isValid1), color0, float(isValid0));
41
- }`)),r&&(d(a),v(a),a.code.add(m`vec4 getOverlayWaterColor(vec4 maskInput, vec4 colorInput, vec3 vposEyeDir,
41
+ }`)),r&&(s(a),v(a),a.code.add(m`vec4 getOverlayWaterColor(vec4 maskInput, vec4 colorInput, vec3 vposEyeDir,
42
42
  float shadow, vec3 localUp, mat3 tbn, vec3 position, vec3 positionWorld) {
43
43
  vec3 n = normalize(tbn * (2.0 * maskInput.rgb - vec3(1.0)));
44
44
  vec3 v = vposEyeDir;
45
45
  vec3 final = getSeaColor(n, v, mainLightDirection, colorInput.rgb, mainLightIntensity, localUp, 1.0 - shadow, maskInput.w, position, positionWorld);
46
46
  return vec4(final, colorInput.w);
47
- }`))}function b(e,o){return e.identifier===i.Material&&s(e.output)?o.overlay?.getTexture(l.ColorNoRasterImage):e.identifier===i.Material&&e.output===n.ObjectAndLayerIdColor?o.overlay?.getTexture(l.ObjectAndLayerIdColor):e.identifier===i.Highlight?o.overlay?.getTexture(l.Highlight):null}function V(e,l){const i=l.overlay?.overlays[a.INNER]?.extent;o(i)&&(w[0]=e.toMapSpace[0]/r(i)-i[0]/r(i),w[1]=e.toMapSpace[1]/t(i)-i[1]/t(i));const n=l.overlay?.overlays[a.OUTER]?.extent;return o(n)&&(w[2]=e.toMapSpace[0]/r(n)-n[0]/r(n),w[3]=e.toMapSpace[1]/t(n)-n[1]/t(n)),w}function I(e,l){const i=l.overlay?.overlays[a.INNER]?.extent;o(i)&&(w[0]=e.toMapSpace[2]/r(i),w[1]=e.toMapSpace[3]/t(i));const n=l.overlay?.overlays[a.OUTER]?.extent;return o(n)&&(w[2]=e.toMapSpace[2]/r(n),w[3]=e.toMapSpace[3]/t(n)),w}!function(e){e[e.Disabled=0]="Disabled",e[e.Enabled=1]="Enabled",e[e.EnabledWithWater=2]="EnabledWithWater",e[e.COUNT=3]="COUNT"}(h||(h={}));const w=e();class M extends g{constructor(e){super(e,"vec4")}}export{C as OverlayIM,h as OverlayMode,O as OverlayTerrain,b as getIMColorTexture};
47
+ }`))}function b(e,o){return e.identifier===i.Material&&d(e.output)?e.occludedGround?o.overlay?.getTexture(l.Occluded):o.overlay?.getTexture(l.ColorNoRasterImage):e.identifier===i.Material&&e.output===n.ObjectAndLayerIdColor?o.overlay?.getTexture(l.ObjectAndLayerIdColor):e.identifier===i.Highlight?o.overlay?.getTexture(l.Highlight):null}function V(e,l){const i=l.overlay?.overlays[a.INNER]?.extent;o(i)&&(w[0]=e.toMapSpace[0]/r(i)-i[0]/r(i),w[1]=e.toMapSpace[1]/t(i)-i[1]/t(i));const n=l.overlay?.overlays[a.OUTER]?.extent;return o(n)&&(w[2]=e.toMapSpace[0]/r(n)-n[0]/r(n),w[3]=e.toMapSpace[1]/t(n)-n[1]/t(n)),w}function I(e,l){const i=l.overlay?.overlays[a.INNER]?.extent;o(i)&&(w[0]=e.toMapSpace[2]/r(i),w[1]=e.toMapSpace[3]/t(i));const n=l.overlay?.overlays[a.OUTER]?.extent;return o(n)&&(w[2]=e.toMapSpace[2]/r(n),w[3]=e.toMapSpace[3]/t(n)),w}!function(e){e[e.Disabled=0]="Disabled",e[e.Enabled=1]="Enabled",e[e.EnabledWithWater=2]="EnabledWithWater",e[e.COUNT=3]="COUNT"}(h||(h={}));const w=e();class M extends g{constructor(e){super(e,"vec4")}}export{C as OverlayIM,h as OverlayMode,O as OverlayTerrain,b as getIMColorTexture};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import{difference as t,isSome as s}from"../core/arrayUtils.js";import o from"../core/Collection.js";import{referenceSetter as i}from"../core/collectionUtils.js";import n from"../core/Evented.js";import r from"../core/Logger.js";import{getOrCreateMapValue as l}from"../core/MapUtils.js";import{removeMaybe as c}from"../core/maybe.js";import a from"../core/ReactiveMap.js";import{watch as h,on as u,initial as d}from"../core/reactiveUtils.js";import{symmetricDifference as f}from"../core/SetUtils.js";import{property as p}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import{subclass as g}from"../core/accessorSupport/decorators/subclass.js";import{isSubtypeSublayer as y,isKnowledgeGraphLayer as m,isMapImageLayer as _,isSubtypeGroupLayer as v}from"../layers/support/layerUtils.js";import w from"../rest/support/Query.js";import{isSelectableLayer as S}from"./support/selectionUtils.js";let j=class extends n.EventedAccessor{constructor(e){super(e),this._selectionMap=new a,this._sources=new o,this._trashCan=[],this._layerEditHandles=new o,this._vizTaskId=0,this.view=null,this.showHighlight=!0,this.highlightName="default"}initialize(){this.addHandles([h((()=>[this.view,this.showHighlight]),(()=>this._refreshVisualization())),h((()=>this.view),(e=>{e?.when().then((()=>this.syncSources()))}),d),u((()=>this.sources),"change",(e=>{const t=this._selectionMap;for(const s of e.removed)t.delete(s);this._refreshListeners(),this._refreshVisualization()}),{onListenerAdd:()=>this._refreshListeners()})])}destroy(){this._layerEditHandles.drain(c)}get selections(){return Array.from(this._selectionMap.entries()).map((e=>{const[t,s]=e;return{layer:t,selection:[...s.selection]}}))}get count(){let e=0;for(const t of this._selectionMap.values())e+=t.selection.length;return e}get hasSelection(){return this.count>0}get sources(){return this._sources}set sources(e){i(e,this._sources)}syncSources(){const e=new Set,t=this.view?.map;if(!t)return;const s=t=>{m(t)?(t.layers?.forEach(s),t.tables?.forEach(s)):_(t)?(t.sublayers?.forEach(s),t.subtables?.forEach(s)):v(t)?t.sublayers?.forEach(s):S(t)&&e.add(t)};t.allLayers.forEach(s),t.allTables.forEach(s),this.sources=[...e]}async getSelectedFeatures(e,t={},s="layerView"){const{view:o,selections:i}=this;if(!o&&"layerView"===s)return r.getLogger(this).warn("Cannot query layer views without a view."),[];const n=e?.length?i.filter((t=>e.includes(t.layer))):i,l=[];return n.forEach((async e=>{const{layer:i,selection:n}=e;if(!n.length)return;const r=y(i)?i.parent:i;if(null==r)return;if("layer"===s)return void l.push(H(r,n,t));if(M(r)||!o||!E(r))return;const c=await o.whenLayerView(r).catch((()=>null));c&&l.push(H(c,n,t))})),(await Promise.all(l)).filter((e=>null!=e))}updateSelection(e){const s=new Map;for(const[t,n]of this._selectionMap)s.set(t,[...n.selection]);let o=!1;const i=e.current.concat(e.added);for(const t of i){const e=t.sourceLayer,i=t.getObjectId();if(this.sources.includes(e)&&(S(e)||y(e))&&null!==i){const t=l(s,e,(()=>[]));t.includes(i)||(t.push(i),o=!0)}}for(const t of e.removed){const e=t.sourceLayer,i=t.getObjectId();if(this.sources.includes(e)&&(S(e)||y(e))&&null!==i){const t=s.get(e),n=t?.indexOf(i);void 0!==n&&n>=0&&(t?.splice(n,1),o=!0)}}if(o){const{_selectionMap:e,_trashCan:o}=this,i=[];for(const[n,r]of s){const s=e.get(n);void 0!==s&&o.push(s),e.set(n,{selection:r}),i.push({layer:n,selection:r,...t(void 0!==s?s.selection:[],r)})}this._onSelectionChange(i)}}setSelection(e,t){this._setSelection(e,t)}getSelection(e){const t=this._selectionMap.get(e);return t?.selection}appendToSelection(e,t){const s=this._selectionMap.get(e),o=void 0!==s?[...s.selection]:[];for(const i of t)o.includes(i)||o.push(i);this._setSelection(e,o)}removeFromSelection(e,t){const s=this._selectionMap.get(e);if(!s)return;const o=[];for(const i of s.selection)t.includes(i)||o.push(i);this._setSelection(e,o)}toggleInSelection(e,t){const s=this._selectionMap.get(e);if(!s||0===s.selection.length)return void this._setSelection(e,t);const o=new Set(s.selection),i=new Set(t),n=f(o,i);this._setSelection(e,Array.from(n))}clear(){const e=this._selectionMap.values();this._trashCan.push(...e);const t=[];for(const[s,o]of this._selectionMap.entries())t.push({layer:s,added:[],removed:[...o.selection],selection:[]});this._selectionMap.clear(),this._onSelectionChange(t)}_onSelectionChange(e){this._refreshVisualization(),this.emit("selection-change",{view:this.view,changes:e})}_refreshVisualization(){if(null==this.view||null==this.sources)return;for(this._vizTaskId++;this._trashCan.length>0;){const e=this._trashCan.pop();e?.highlightHandle?.remove()}const{sources:e,view:t,_selectionMap:s,showHighlight:o}=this,i=this._vizTaskId;for(const n of e){const e=s.get(n),r=y(n)?n.parent:n;if(null!=r&&E(r)){if(M(r))continue;t.whenLayerView(r).then((t=>{e?.highlightHandle?.remove(),null!=e&&o&&i===this._vizTaskId&&"highlight"in t&&"function"==typeof t.highlight&&e.selection.length>0&&(e.highlightHandle=t.highlight(e.selection,this.highlightName))})).catch((()=>{e?.highlightHandle?.remove()}))}}}_refreshListeners(){this._layerEditHandles.drain(c);for(const e of this.sources){const t=y(e)?e.parent:e;if(null!=t&&S(t)&&"on"in t&&t.on){const s=t.on("edits",(t=>{this._handleEditChanges(t,e)}));this._layerEditHandles.push(s)}}}_handleEditChanges(e,t){if(void 0!==e.deletedFeatures&&e.deletedFeatures.length>0&&this._selectionMap.has(t)){const o=e.deletedFeatures.filter((e=>null==e.error)).map((e=>e.objectId)).filter(s);this.removeFromSelection(t,o)}}_setSelection(e,s){if(!this.sources.includes(e))throw new Error(`Cannot set selection on layer ${e.title} because it is not in 'sources'`);const o=this._selectionMap.get(e);if(void 0===o||!C(o,{selection:s})){void 0!==o&&this._trashCan.push(o),this._selectionMap.set(e,{selection:[...s]});const i={layer:e,selection:[...s],...t(void 0!==o?o.selection:[],s)};this._onSelectionChange([i])}}};e([p({readOnly:!0,nonNullable:!0})],j.prototype,"selections",null),e([p({readOnly:!0,nonNullable:!0})],j.prototype,"count",null),e([p()],j.prototype,"view",void 0),e([p({readOnly:!0,nonNullable:!0})],j.prototype,"hasSelection",null),e([p()],j.prototype,"showHighlight",void 0),e([p()],j.prototype,"sources",null),e([p()],j.prototype,"highlightName",void 0),j=e([g("esri.views.SelectionManager")],j);const M=e=>y(e)?!0===e.parent?.isTable:e.isTable,b=e=>void 0!==e.layer,E=e=>void 0!==e?.when,C=(e,t)=>{if(null==e&&null==t)return!0;if(null!=e&&null==t||null==e&&null!=t)return!1;if(null!=e&&null!=t&&null!=e.selection&&null!=t.selection){const s=[...e.selection],o=[...t.selection];if(s.length!==o.length)return!1;s.sort(),o.sort();for(let e=0;e<s.length;e++)if(s[e]!==o[e])return!1}return!0},H=async(e,t,s={})=>{let o;if(b(e)){const i=e;o=void 0===i?null:await i.queryFeatures(new w({...s,objectIds:t})).then((t=>({data:t,layer:e.layer})))}else{const i=e;o=void 0===i?null:await i.queryFeatures(new w({...s,objectIds:t})).then((e=>({data:e,layer:i})))}return o},L=j;export{L as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import{difference as t}from"../core/arrayUtils.js";import s from"../core/Collection.js";import{referenceSetter as o}from"../core/collectionUtils.js";import i from"../core/Evented.js";import n from"../core/Logger.js";import{getOrCreateMapValue as r}from"../core/MapUtils.js";import{removeMaybe as l}from"../core/maybe.js";import c from"../core/ReactiveMap.js";import{watch as a,on as h,initial as u}from"../core/reactiveUtils.js";import{symmetricDifference as d}from"../core/SetUtils.js";import{property as f}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import{subclass as p}from"../core/accessorSupport/decorators/subclass.js";import{isSubtypeSublayer as g,isSubtypeGroupLayer as y,isKnowledgeGraphLayer as m,isMapImageLayer as _}from"../layers/support/layerUtils.js";import v from"../rest/support/Query.js";import{isSelectableLayer as w}from"./support/selectionUtils.js";let S=class extends i.EventedAccessor{constructor(e){super(e),this._selectionMap=new c,this._sources=new s,this._trashCan=[],this._layerEditHandles=new s,this._vizTaskId=0,this.view=null,this.showHighlight=!0,this.highlightName="default"}initialize(){this.addHandles([a((()=>[this.view,this.showHighlight]),(()=>this._refreshVisualization())),a((()=>this.view),(e=>{e?.when().then((()=>this.syncSources()))}),u),h((()=>this.sources),"change",(e=>{const t=this._selectionMap;for(const s of e.removed)t.delete(s);this._refreshListeners(),this._refreshVisualization()}),{onListenerAdd:()=>this._refreshListeners()})])}destroy(){this._layerEditHandles.drain(l)}get selections(){return Array.from(this._selectionMap.entries()).map((e=>{const[t,s]=e;return{layer:t,selection:[...s.selection]}}))}get count(){let e=0;for(const t of this._selectionMap.values())e+=t.selection.length;return e}get hasSelection(){return this.count>0}get sources(){return this._sources}set sources(e){o(e,this._sources)}syncSources(){const e=new Set,t=this.view?.map;if(!t)return;const s=t=>{m(t)?(t.layers?.forEach(s),t.tables?.forEach(s)):_(t)?(t.sublayers?.forEach(s),t.subtables?.forEach(s)):y(t)?t.sublayers?.forEach(s):w(t)&&e.add(t)};t.allLayers.forEach(s),t.allTables.forEach(s),this.sources=[...e]}async getSelectedFeatures(e,t={},s="layerView"){const{view:o,selections:i}=this;if(!o&&"layerView"===s)return n.getLogger(this).warn("Cannot query layer views without a view."),[];const r=e?.length?i.filter((t=>e.includes(t.layer))):i,l=[];return r.forEach((async e=>{const{layer:i,selection:n}=e;if(!n.length)return;const r=g(i)?i.parent:i;if(null==r)return;if("layer"===s)return void l.push(F(r,n,t));if(b(r)||!o||!E(r))return;const c=await o.whenLayerView(r).catch((()=>null));c&&l.push(F(c,n,t))})),(await Promise.all(l)).filter((e=>null!=e))}updateSelection(e){const s=new Map;for(const[t,n]of this._selectionMap)s.set(t,[...n.selection]);let o=!1;const i=e.current.concat(e.added);for(const t of i){const e=t.sourceLayer,i=t.getObjectId();if(this.sources.includes(e)&&(w(e)||g(e))&&null!==i){const t=r(s,e,(()=>[]));t.includes(i)||(t.push(i),o=!0)}}for(const t of e.removed){const e=t.sourceLayer,i=t.getObjectId();if(this.sources.includes(e)&&(w(e)||g(e))&&null!==i){const t=s.get(e),n=t?.indexOf(i);void 0!==n&&n>=0&&(t?.splice(n,1),o=!0)}}if(o){const{_selectionMap:e,_trashCan:o}=this,i=[];for(const[n,r]of s){const s=e.get(n);void 0!==s&&o.push(s),e.set(n,{selection:r}),i.push({layer:n,selection:r,...t(void 0!==s?s.selection:[],r)})}this._onSelectionChange(i)}}setSelection(e,t){this._setSelection(e,t)}getSelection(e){const t=this._selectionMap.get(e);return t?.selection}appendToSelection(e,t){const s=this._selectionMap.get(e),o=void 0!==s?[...s.selection]:[];for(const i of t)o.includes(i)||o.push(i);this._setSelection(e,o)}removeFromSelection(e,t){const s=this._selectionMap.get(e);if(!s)return;const o=[];for(const i of s.selection)t.includes(i)||o.push(i);this._setSelection(e,o)}toggleInSelection(e,t){const s=this._selectionMap.get(e);if(!s||0===s.selection.length)return void this._setSelection(e,t);const o=new Set(s.selection),i=new Set(t),n=d(o,i);this._setSelection(e,Array.from(n))}clear(){const e=this._selectionMap.values();this._trashCan.push(...e);const t=[];for(const[s,o]of this._selectionMap.entries())t.push({layer:s,added:[],removed:[...o.selection],selection:[]});this._selectionMap.clear(),this._onSelectionChange(t)}_onSelectionChange(e){this._refreshVisualization(),this.emit("selection-change",{view:this.view,changes:e})}_refreshVisualization(){if(null==this.view||null==this.sources)return;for(this._vizTaskId++;this._trashCan.length>0;){const e=this._trashCan.pop();e?.highlightHandle?.remove()}const{sources:e,view:t,_selectionMap:s,showHighlight:o}=this,i=this._vizTaskId;for(const n of e){const e=s.get(n),r=g(n)?n.parent:n;if(null!=r&&E(r)){if(b(r))continue;t.whenLayerView(r).then((t=>{e?.highlightHandle?.remove(),null!=e&&o&&i===this._vizTaskId&&"highlight"in t&&"function"==typeof t.highlight&&e.selection.length>0&&(e.highlightHandle=t.highlight(e.selection,this.highlightName))})).catch((()=>{e?.highlightHandle?.remove()}))}}}_refreshListeners(){this._layerEditHandles.drain(l);const e=new Set(this.sources.map((e=>g(e)?e.parent:e)));for(const t of e)w(t)&&"on"in t&&t.on&&this._layerEditHandles.push(t.on("edits",(e=>this._onLayerEdit(e,t))))}_onLayerEdit(e,t){if(y(t))this._onParentLayerEdit(e,t);else if(e.deletedFeatures.length&&this._selectionMap.has(t)){const s=[];e.deletedFeatures.forEach((({error:e,objectId:t})=>{null!=t&&null==e&&s.push(t)})),this.removeFromSelection(t,s)}}_onParentLayerEdit(e,t){const{deletedFeatures:s,edits:o,updatedFeatures:i}=e;if(o?.updateFeatures?.forEach((e=>{const s=e.getObjectId()??e.attributes[t.objectIdField];if(null==s)return;if(i.find((e=>e.objectId===s))?.error)return;const o=t.findSublayerForFeature(e);if(!w(o))return;const n=t.sublayers.find((e=>!(!w(e)||!this.getSelection(e)?.includes(s))));w(n)&&n!==o&&(this.removeFromSelection(n,[s]),this.appendToSelection(o,[s]))})),s.length){const e=[];s.forEach((({error:t,objectId:s})=>{null!=s&&null==t&&e.push(s)})),t.sublayers.forEach((t=>{w(t)&&this._selectionMap.has(t)&&this.removeFromSelection(t,e)}))}}_setSelection(e,s){if(!this.sources.includes(e))throw new Error(`Cannot set selection on layer ${e.title} because it is not in 'sources'`);const o=this._selectionMap.get(e);if(void 0===o||!M(o,{selection:s})){void 0!==o&&this._trashCan.push(o),this._selectionMap.set(e,{selection:[...s]});const i={layer:e,selection:[...s],...t(void 0!==o?o.selection:[],s)};this._onSelectionChange([i])}}};e([f({readOnly:!0,nonNullable:!0})],S.prototype,"selections",null),e([f({readOnly:!0,nonNullable:!0})],S.prototype,"count",null),e([f()],S.prototype,"view",void 0),e([f({readOnly:!0,nonNullable:!0})],S.prototype,"hasSelection",null),e([f()],S.prototype,"showHighlight",void 0),e([f()],S.prototype,"sources",null),e([f()],S.prototype,"highlightName",void 0),S=e([p("esri.views.SelectionManager")],S);const b=e=>g(e)?!0===e.parent?.isTable:e.isTable,j=e=>void 0!==e.layer,E=e=>void 0!==e?.when,M=(e,t)=>{if(null==e&&null==t)return!0;if(null!=e&&null==t||null==e&&null!=t)return!1;if(null!=e&&null!=t&&null!=e.selection&&null!=t.selection){const s=[...e.selection],o=[...t.selection];if(s.length!==o.length)return!1;s.sort(),o.sort();for(let e=0;e<s.length;e++)if(s[e]!==o[e])return!1}return!0},F=async(e,t,s={})=>{let o;if(j(e)){const i=e;o=void 0===i?null:await i.queryFeatures(new v({...s,objectIds:t})).then((t=>({data:t,layer:e.layer})))}else{const i=e;o=void 0===i?null:await i.queryFeatures(new v({...s,objectIds:t})).then((e=>({data:e,layer:i})))}return o},L=S;export{L 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.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import"../../core/has.js";import t from"../../core/Logger.js";import{throwIfAborted as i}from"../../core/promiseUtils.js";import{watch as r,on as s,syncAndInitial as l}from"../../core/reactiveUtils.js";import{sqlAnd as o}from"../../core/sql.js";import{property as n}from"../../core/accessorSupport/decorators/property.js";import"../../core/RandomLCG.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import{getFeatureIdInfoFieldNames as u}from"../../layers/graphics/data/FeatureIdInfo.js";import{systemIsSpatialFieldName as d}from"../../layers/knowledgeGraph/constants.js";import{getEffectiveDisplayFilter as p}from"../../layers/support/displayFilterUtils.js";import f from"../../layers/support/FeatureEffect.js";import y from"../../layers/support/FeatureFilter.js";import{getSignedInUser as c}from"../../layers/support/featureLayerUtils.js";import{fixFields as h,unpackFieldNames as m,collectLabelingFields as F,collectElevationFields as g,collectFilterFields as I,collectFeatureReductionFields as b,collectOrderByInfos as w,collectFields as v,collectTrackInfoFields as E,collectDisplayFilterFields as x,collectField as q,featureHasFields as j}from"../../layers/support/fieldUtils.js";import{getFloorFilterClause as R}from"../../layers/support/floorFilterUtils.js";import{getUtilityNetworkFields as _}from"../../networks/support/networkFieldUtils.js";import O from"../../rest/support/Query.js";import{loadArcade as C}from"../../support/loadArcade.js";import{createFeatureIdInfo as k}from"../2d/layers/features/layerAdapters/featureServiceUtils.js";import{getRequiredFields as P,getFetchPopupTemplate as U}from"./support/popupUtils.js";import{WhereClauseVisitor as T}from"./support/WhereClauseVisitor.js";const A=A=>{let L=class extends A{constructor(...e){super(...e),this._updatingRequiredPromise=null,this.filter=null,this.layer=null,this.requiresCurrentUser=!1,this.requiredFields=[],this.view=null}initialize(){this.addHandles([r((()=>{const e=this.layer,t=this.view;return[e&&"elevationInfo"in e?e.elevationInfo?.featureExpressionInfo:null,e&&"displayField"in e?e.displayField:null,e&&"timeInfo"in e&&e.timeInfo,e&&"renderer"in e&&e.renderer,e&&"labelingInfo"in e&&e.labelingInfo,e&&"floorInfo"in e&&e.floorInfo,t?.requiredFieldsOptions?.featureTitleFields&&e&&"featureTitleFields"in e&&e.featureTitleFields,t?.requiredFieldsOptions?.utilityNetworkFields&&_(t,e),e.displayFilterInfo,this.displayFilterEnabled,this.filter,this.featureEffect,this.timeExtent,"knowledge-graph-sublayer"===e?.type&&"link-chart"===e.parentCompositeLayer.type&&e.parentCompositeLayer.linkChart?.linkChartProperties.nonspatialDataDisplay?.mode,"parquet"===e?.type&&e.popupTemplate]}),(()=>this._handleChange()),l),s((()=>this.view?.floors),"change",(()=>this._handleChange())),s((()=>this.layer.displayFilterInfo?.filters),"change",(()=>this._handleChange())),s((()=>this.layer&&"sublayers"in this.layer?this.layer.sublayers:null),"change",(()=>this._handleChange()))])}get availableFields(){if(!this.layer)return[];const{layer:e,layer:{fieldsIndex:t},requiredFields:i}=this;return"outFields"in e&&e.outFields?h(t,[...m(t,e.outFields),...i]):h(t,i)}get displayFilterEnabled(){return(this.view?.displayFilterEnabled??!0)&&(!("displayFilterEnabled"in this.layer)||(this.layer?.displayFilterEnabled??!0))}get effectiveDisplayFilter(){const e=this.layer;return this.displayFilterEnabled&&e.displayFilterInfo?p(e.displayFilterInfo,this.view):null}get featureEffect(){return this.layer&&"featureEffect"in this.layer?this.layer.featureEffect:null}set featureEffect(e){this._override("featureEffect",e)}get maximumNumberOfFeatures(){return 0}set maximumNumberOfFeatures(e){t.getLogger(this).error("#maximumNumberOfFeatures=","Setting maximum number of features is not supported")}get maximumNumberOfFeaturesExceeded(){return!1}get signedInUser(){return this.layer?.url?c(this.layer.url):Promise.resolve(null)}highlight(e,t){throw new Error("missing implementation")}createQuery(){const e={outFields:["*"],returnGeometry:!0,outSpatialReference:this.view.spatialReference},t=null!=this.filter?this.filter.createQuery(e):new O(e);return"floorInfo"in this.layer&&this.layer.floorInfo&&(t.where=o(t.where,R(this))),this.displayFilterEnabled&&(t.where=o(t.where,this.effectiveDisplayFilter?.where)),null!=this.timeExtent&&(t.timeExtent=null!=t.timeExtent?t.timeExtent.intersection(this.timeExtent):this.timeExtent.clone()),t}createAggregateQuery(){const e={outFields:["*"],returnGeometry:!0,outSpatialReference:this.view.spatialReference};return new O(e)}queryFeatures(e,t){throw new Error("missing implementation")}queryObjectIds(e,t){throw new Error("missing implementation")}queryFeatureCount(e,t){throw new Error("missing implementation")}queryExtent(e,t){throw new Error("missing implementation")}async fetchPopupFeaturesFromGraphics(e,t){return this._fetchPopupFeatures(e,t)}_loadArcadeModules(e){return e.expressionInfos?.length||Array.isArray(e.content)&&e.content.some((e=>"expression"===e.type))?C():Promise.resolve()}_handleChange(){const e=Promise.all([this._updateRequiredFields(),this._updateClientWhereClauseRequirements()]).then((()=>{}));return this._set("_updatingRequiredPromise",e),e.then((()=>{this._updatingRequiredPromise===e&&this._set("_updatingRequiredPromise",null)})),e}async _updateClientWhereClauseRequirements(){if(!this.layer||!this.view)return;const{layer:e}=this,i=new T(e.fieldsIndex);if(i.visitFilter(this.filter),"featureReduction"in e&&i.visitFeatureReduction(e.featureReduction),"labelingInfo"in e&&i.visitLabelingInfo(e.labelsVisible,e.labelingInfo),"trackInfo"in e&&i.visitTrackInfo(e.trackInfo),"2d"===this.view.type&&(i.visitFilter(this.featureEffect?.filter),i.visitDisplayFilter(this.displayFilterEnabled,e.displayFilterInfo),"featureReduction"in e&&i.visitFeatureReduction(e.featureReduction)),"subtype-group"===e.type)for(const t of e.sublayers)i.visitLabelingInfo(t.labelsVisible,t.labelingInfo);try{const e=await i.finish();this._set("requiresCurrentUser",e.requiresCurrentUser)}catch(r){t.getLogger(this).error(r)}}async _updateRequiredFields(){if(!this.layer||!this.view)return;const e="3d"===this.view.type,{layer:i,layer:{fieldsIndex:r}}=this,s="renderer"in i&&i.renderer,l="orderBy"in i&&i.orderBy,o="featureReduction"in i?i.featureReduction:null,n=new Set,a=[s?s.collectRequiredFields(n,r):null,F(n,i),e&&"elevationInfo"in i?g(n,i):null,null!=this.filter?I(n,i,this.filter):null,e||null==this.featureEffect?null:I(n,i,this.featureEffect.filter),!e&&o?b(n,i,o):null,!e&&l?w(n,i,l):null];if("timeInfo"in i&&i.timeInfo&&this.timeExtent&&v(n,i.fieldsIndex,[i.timeInfo.startField,i.timeInfo.endField]),"timeInfo"in i&&i.timeInfo&&"trackInfo"in i&&i.trackInfo){const{trackInfo:e}=i;v(n,i.fieldsIndex,[i.timeInfo.trackIdField]),"feature"!==i.type&&"startTimeField"!==e.timeField||v(n,i.fieldsIndex,[i.timeInfo.startField]),"endTimeField"===e.timeField&&v(n,i.fieldsIndex,[i.timeInfo.endField]),await E(n,i)}if("floorInfo"in i&&i.floorInfo&&v(n,i.fieldsIndex,[i.floorInfo.floorField]),"featureTitleFields"in i&&this.view?.requiredFieldsOptions?.featureTitleFields&&i.featureTitleFields&&v(n,i.fieldsIndex,i.featureTitleFields),"feature"===i.type&&i.globalIdField&&this.view?.requiredFieldsOptions?.globalIdField&&v(n,i.fieldsIndex,[i.globalIdField]),this.displayFilterEnabled&&a.push(x(n,i,i.displayFilterInfo)),"feature"===i.type&&e&&null!=i.infoFor3D&&(null==i.globalIdField&&t.getLogger(this).error("globalIdField missing on 3DObjectFeatureLayer"),v(n,i.fieldsIndex,[i.globalIdField])),"subtype-group"===i.type){q(n,r,i.subtypeField);const e=i.sublayers.map((e=>Promise.all([e.renderer?.collectRequiredFields(n,r),F(n,e)])));a.push(Promise.all(e))}if("catalog-footprint"===i.type&&i.parent){const e=i.parent;v(n,r,[e.itemNameField,e.itemSourceField,e.itemTypeField,e.maxScaleField,e.minScaleField])}"knowledge-graph-sublayer"===i.type&&"link-chart"===i.parentCompositeLayer.type&&q(n,r,d),"parquet"===i.type&&a.push(P(i,i.popupTemplate).then((e=>{for(const t of e)n.add(t)})));const p=await Promise.allSettled(a);if(e)q(n,r,i.objectIdField);else for(const t of u(k(i)))q(n,r,t);e&&"displayField"in i&&i.displayField&&q(n,r,i.displayField);for(const u of p)"rejected"===u.status&&t.getLogger(this).error(u.reason);const f=Array.from(n).sort();this._set("requiredFields",f)}_popupFeatureHasRequiredFields(e,t){return j(t,e)}async _fetchPopupFeatures(e,t){const r=new Array(e.length),s=new Map,l=new Map,n=await this._createPopupQuery(e.map((e=>e.origin?.layer??e.layer)),t);for(let o=0;o<e.length;o++){const a=e[o];if(a.isAggregate){r[o]=a;continue}const u=a.origin?.layer??a.layer;if(!u||!("popupEnabled"in u)||!u.popupEnabled)continue;const d=m(this.layer.fieldsIndex,n.outFields),p=U(u,t);if(null==p)continue;const f=await this._loadArcadeModules(p);i(t);if(f&&f.arcadeUtils.hasGeometryOperations(p)||!this._popupFeatureHasRequiredFields(a,d)){const e=a.getObjectId();if(null!=e){s.set(e,{graphic:a,index:o});continue}const t=a.getGlobalId();if(null!=t){l.set(t,{graphic:a,index:o});continue}}r[o]=a}if("stream"===this.layer.type||"parquet"===this.layer.type||0===s.size&&0===l.size)return r.filter(Boolean);const a=[];if(s.size>0){const e=n.clone();"uniqueIdFields"in this.layer&&this.layer.uniqueIdFields?.length&&(e.outFields??=[],e.outFields.push(...this.layer.uniqueIdFields)),e.objectIds=Array.from(s.keys()),a.push({type:"object-id",query:e,map:s})}const u="globalIdField"in this.layer?this.layer.globalIdField:null;if(null!=u&&l.size>0){const e=n.clone();e.outFields??=[],e.outFields.push(u);const t=Array.from(l.keys());e.where=o(n.where,`${u} IN (${t.map((e=>`'${e}'`)).join(",")})`),a.push({type:"global-id",query:e,map:l})}for(const{type:i,query:o,map:d}of a)try{const e=await this.layer.queryFeatures(o,t);for(const t of e.features){const e="object-id"===i?t.getObjectId():t.getGlobalId();if(null==e)continue;const s=d.get(e);if(!s)continue;const{graphic:{geometry:l,origin:o},index:n}=s;t.geometry||=l,t.origin=o,r[n]=t}}catch{}return r.filter(Boolean)}async _createPopupQuery(e,t){const r=this.layer.createQuery(),s=new Set;let l=!1;const n=e??[this.layer];for(const o of n){if(!("popupEnabled"in o))continue;const e=U(o,t);if(null==e)continue;const r=await this._loadArcadeModules(e);i(t);const n=r&&r.arcadeUtils.hasGeometryOperations(e);l=!("point"!==this.layer.geometryType&&!n);const a=await P(this.layer,e);i(t);for(const t of a)s.add(t)}return r.returnGeometry=l,r.returnZ=l,r.returnM=l,r.outFields=Array.from(s),r.outSpatialReference=this.view.spatialReference,"floorInfo"in this.layer&&this.layer.floorInfo&&(r.where=o(r.where,R(this))),r}canResume(){return!!super.canResume()&&(null==this.timeExtent||!this.timeExtent.isEmpty)}getTest(){}get test(){}};return e([n()],L.prototype,"_updatingRequiredPromise",void 0),e([n({readOnly:!0})],L.prototype,"availableFields",null),e([n({readOnly:!0})],L.prototype,"displayFilterEnabled",null),e([n({readOnly:!0})],L.prototype,"effectiveDisplayFilter",null),e([n({type:f})],L.prototype,"featureEffect",null),e([n({type:y})],L.prototype,"filter",void 0),e([n()],L.prototype,"layer",void 0),e([n({type:Number})],L.prototype,"maximumNumberOfFeatures",null),e([n({readOnly:!0,type:Boolean})],L.prototype,"maximumNumberOfFeaturesExceeded",null),e([n()],L.prototype,"requiresCurrentUser",void 0),e([n({readOnly:!0})],L.prototype,"requiredFields",void 0),e([n({readOnly:!0})],L.prototype,"signedInUser",null),e([n()],L.prototype,"suspended",void 0),e([n()],L.prototype,"view",void 0),L=e([a("esri.views.layers.FeatureLayerView")],L),L};export{A as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import"../../core/has.js";import t from"../../core/Logger.js";import{throwIfAborted as r}from"../../core/promiseUtils.js";import{watch as i,on as l,syncAndInitial as s}from"../../core/reactiveUtils.js";import{sqlAnd as o}from"../../core/sql.js";import{property as n}from"../../core/accessorSupport/decorators/property.js";import"../../core/RandomLCG.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import{getFeatureIdInfoFieldNames as u}from"../../layers/graphics/data/FeatureIdInfo.js";import{systemIsSpatialFieldName as d}from"../../layers/knowledgeGraph/constants.js";import{getEffectiveDisplayFilter as p}from"../../layers/support/displayFilterUtils.js";import f from"../../layers/support/FeatureEffect.js";import y from"../../layers/support/FeatureFilter.js";import{getSignedInUser as m}from"../../layers/support/featureLayerUtils.js";import{fetchFeaturePopupFeatures as h,loadFeaturePopupArcadeModules as c}from"../../layers/support/featurePopupQueryUtils.js";import{fixFields as F,unpackFieldNames as g,collectLabelingFields as I,collectElevationFields as b,collectFilterFields as w,collectFeatureReductionFields as E,collectOrderByInfos as v,collectFields as x,collectTrackInfoFields as q,collectDisplayFilterFields as R,collectField as j,featureHasFields as _}from"../../layers/support/fieldUtils.js";import{getFloorFilterClause as C}from"../../layers/support/floorFilterUtils.js";import{getUtilityNetworkFields as O}from"../../networks/support/networkFieldUtils.js";import k from"../../rest/support/Query.js";import{createFeatureIdInfo as U}from"../2d/layers/features/layerAdapters/featureServiceUtils.js";import{getRequiredFields as P,getFetchPopupTemplate as T}from"./support/popupUtils.js";import{WhereClauseVisitor as L}from"./support/WhereClauseVisitor.js";const S=S=>{let N=class extends S{constructor(...e){super(...e),this._updatingRequiredPromise=null,this.filter=null,this.layer=null,this.requiresCurrentUser=!1,this.requiredFields=[],this.view=null}initialize(){this.addHandles([i((()=>{const e=this.layer,t=this.view;return[e&&"elevationInfo"in e?e.elevationInfo?.featureExpressionInfo:null,e&&"displayField"in e?e.displayField:null,e&&"timeInfo"in e&&e.timeInfo,e&&"renderer"in e&&e.renderer,e&&"labelingInfo"in e&&e.labelingInfo,e&&"floorInfo"in e&&e.floorInfo,t?.requiredFieldsOptions?.featureTitleFields&&e&&"featureTitleFields"in e&&e.featureTitleFields,t?.requiredFieldsOptions?.utilityNetworkFields&&O(t,e),e.displayFilterInfo,this.displayFilterEnabled,this.filter,this.featureEffect,this.timeExtent,"knowledge-graph-sublayer"===e?.type&&"link-chart"===e.parentCompositeLayer.type&&e.parentCompositeLayer.linkChart?.linkChartProperties.nonspatialDataDisplay?.mode,"parquet"===e?.type&&e.popupTemplate]}),(()=>this._handleChange()),s),l((()=>this.view?.floors),"change",(()=>this._handleChange())),l((()=>this.layer.displayFilterInfo?.filters),"change",(()=>this._handleChange())),l((()=>this.layer&&"sublayers"in this.layer?this.layer.sublayers:null),"change",(()=>this._handleChange()))])}get availableFields(){if(!this.layer)return[];const{layer:e,layer:{fieldsIndex:t},requiredFields:r}=this;return"outFields"in e&&e.outFields?F(t,[...g(t,e.outFields),...r]):F(t,r)}get displayFilterEnabled(){return(this.view?.displayFilterEnabled??!0)&&(!("displayFilterEnabled"in this.layer)||(this.layer?.displayFilterEnabled??!0))}get effectiveDisplayFilter(){const e=this.layer;return this.displayFilterEnabled&&e.displayFilterInfo?p(e.displayFilterInfo,this.view):null}get featureEffect(){return this.layer&&"featureEffect"in this.layer?this.layer.featureEffect:null}set featureEffect(e){this._override("featureEffect",e)}get maximumNumberOfFeatures(){return 0}set maximumNumberOfFeatures(e){t.getLogger(this).error("#maximumNumberOfFeatures=","Setting maximum number of features is not supported")}get maximumNumberOfFeaturesExceeded(){return!1}get signedInUser(){return this.layer?.url?m(this.layer.url):Promise.resolve(null)}highlight(e,t){throw new Error("missing implementation")}createQuery(){const e={outFields:["*"],returnGeometry:!0,outSpatialReference:this.view.spatialReference},t=null!=this.filter?this.filter.createQuery(e):new k(e);return"floorInfo"in this.layer&&this.layer.floorInfo&&(t.where=o(t.where,C(this))),this.displayFilterEnabled&&(t.where=o(t.where,this.effectiveDisplayFilter?.where)),null!=this.timeExtent&&(t.timeExtent=null!=t.timeExtent?t.timeExtent.intersection(this.timeExtent):this.timeExtent.clone()),t}createAggregateQuery(){const e={outFields:["*"],returnGeometry:!0,outSpatialReference:this.view.spatialReference};return new k(e)}queryFeatures(e,t){throw new Error("missing implementation")}queryObjectIds(e,t){throw new Error("missing implementation")}queryFeatureCount(e,t){throw new Error("missing implementation")}queryExtent(e,t){throw new Error("missing implementation")}async fetchPopupFeaturesFromGraphics(e,t){const r=await this._createPopupQuery(e.map((e=>e.origin?.layer??e.layer)),t);return await h(this.layer,e,r,{getPopupTemplate:e=>e&&"popupEnabled"in e&&e.popupEnabled?T(e,t):null,hasRequiredFields:(e,t)=>this._popupFeatureHasRequiredFields(e,t),...t})}_handleChange(){const e=Promise.all([this._updateRequiredFields(),this._updateClientWhereClauseRequirements()]).then((()=>{}));return this._set("_updatingRequiredPromise",e),e.then((()=>{this._updatingRequiredPromise===e&&this._set("_updatingRequiredPromise",null)})),e}async _updateClientWhereClauseRequirements(){if(!this.layer||!this.view)return;const{layer:e}=this,r=new L(e.fieldsIndex);if(r.visitFilter(this.filter),"featureReduction"in e&&r.visitFeatureReduction(e.featureReduction),"labelingInfo"in e&&r.visitLabelingInfo(e.labelsVisible,e.labelingInfo),"trackInfo"in e&&r.visitTrackInfo(e.trackInfo),"2d"===this.view.type&&(r.visitFilter(this.featureEffect?.filter),r.visitDisplayFilter(this.displayFilterEnabled,e.displayFilterInfo),"featureReduction"in e&&r.visitFeatureReduction(e.featureReduction)),"subtype-group"===e.type)for(const t of e.sublayers)r.visitLabelingInfo(t.labelsVisible,t.labelingInfo);try{const e=await r.finish();this._set("requiresCurrentUser",e.requiresCurrentUser)}catch(i){t.getLogger(this).error(i)}}async _updateRequiredFields(){if(!this.layer||!this.view)return;const e="3d"===this.view.type,{layer:r,layer:{fieldsIndex:i}}=this,l="renderer"in r&&r.renderer,s="orderBy"in r&&r.orderBy,o="featureReduction"in r?r.featureReduction:null,n=new Set,a=[l?l.collectRequiredFields(n,i):null,I(n,r),e&&"elevationInfo"in r?b(n,r):null,null!=this.filter?w(n,r,this.filter):null,e||null==this.featureEffect?null:w(n,r,this.featureEffect.filter),!e&&o?E(n,r,o):null,!e&&s?v(n,r,s):null];if("timeInfo"in r&&r.timeInfo&&this.timeExtent&&x(n,r.fieldsIndex,[r.timeInfo.startField,r.timeInfo.endField]),"timeInfo"in r&&r.timeInfo&&"trackInfo"in r&&r.trackInfo){const{trackInfo:e}=r;x(n,r.fieldsIndex,[r.timeInfo.trackIdField]),"feature"!==r.type&&"startTimeField"!==e.timeField||x(n,r.fieldsIndex,[r.timeInfo.startField]),"endTimeField"===e.timeField&&x(n,r.fieldsIndex,[r.timeInfo.endField]),await q(n,r)}if("floorInfo"in r&&r.floorInfo&&x(n,r.fieldsIndex,[r.floorInfo.floorField]),"featureTitleFields"in r&&this.view?.requiredFieldsOptions?.featureTitleFields&&r.featureTitleFields&&x(n,r.fieldsIndex,r.featureTitleFields),"feature"===r.type&&r.globalIdField&&this.view?.requiredFieldsOptions?.globalIdField&&x(n,r.fieldsIndex,[r.globalIdField]),this.displayFilterEnabled&&a.push(R(n,r,r.displayFilterInfo)),"feature"===r.type&&e&&null!=r.infoFor3D&&(null==r.globalIdField&&t.getLogger(this).error("globalIdField missing on 3DObjectFeatureLayer"),x(n,r.fieldsIndex,[r.globalIdField])),"subtype-group"===r.type){j(n,i,r.subtypeField);const e=r.sublayers.map((e=>Promise.all([e.renderer?.collectRequiredFields(n,i),I(n,e)])));a.push(Promise.all(e))}if("catalog-footprint"===r.type&&r.parent){const e=r.parent;x(n,i,[e.itemNameField,e.itemSourceField,e.itemTypeField,e.maxScaleField,e.minScaleField])}"knowledge-graph-sublayer"===r.type&&"link-chart"===r.parentCompositeLayer.type&&j(n,i,d),"parquet"===r.type&&a.push(P(r,r.popupTemplate).then((e=>{for(const t of e)n.add(t)})));const p=await Promise.allSettled(a);if(e)j(n,i,r.objectIdField);else for(const t of u(U(r)))j(n,i,t);e&&"displayField"in r&&r.displayField&&j(n,i,r.displayField);for(const u of p)"rejected"===u.status&&t.getLogger(this).error(u.reason);const f=Array.from(n).sort();this._set("requiredFields",f)}_popupFeatureHasRequiredFields(e,t){return _(e,t)}async _createPopupQuery(e,t){const i=this.layer.createQuery(),l=new Set;let s=!1;const n=e??[this.layer];for(const o of n){if(!("popupEnabled"in o))continue;const e=T(o,t);if(null==e)continue;const i=await c(e);r(t);const n=i&&i.arcadeUtils.hasGeometryOperations(e);s=!("point"!==this.layer.geometryType&&!n);const a=await P(this.layer,e);r(t);for(const t of a)l.add(t)}return i.returnGeometry=s,i.returnZ=s,i.returnM=s,i.outFields=Array.from(l),i.outSpatialReference=this.view.spatialReference,"floorInfo"in this.layer&&this.layer.floorInfo&&(i.where=o(i.where,C(this))),i}canResume(){return!!super.canResume()&&(null==this.timeExtent||!this.timeExtent.isEmpty)}getTest(){}get test(){}};return e([n()],N.prototype,"_updatingRequiredPromise",void 0),e([n({readOnly:!0})],N.prototype,"availableFields",null),e([n({readOnly:!0})],N.prototype,"displayFilterEnabled",null),e([n({readOnly:!0})],N.prototype,"effectiveDisplayFilter",null),e([n({type:f})],N.prototype,"featureEffect",null),e([n({type:y})],N.prototype,"filter",void 0),e([n()],N.prototype,"layer",void 0),e([n({type:Number})],N.prototype,"maximumNumberOfFeatures",null),e([n({readOnly:!0,type:Boolean})],N.prototype,"maximumNumberOfFeaturesExceeded",null),e([n()],N.prototype,"requiresCurrentUser",void 0),e([n({readOnly:!0})],N.prototype,"requiredFields",void 0),e([n({readOnly:!0})],N.prototype,"signedInUser",null),e([n()],N.prototype,"suspended",void 0),e([n()],N.prototype,"view",void 0),N=e([a("esri.views.layers.FeatureLayerView")],N),N};export{S as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../core/Error.js";import{clone as t}from"../../core/lang.js";import{getDeepValue as n}from"../../core/object.js";import{numberToJSON as r}from"../../core/accessorSupport/extensions/serializableProperty/writer.js";import{isFeatureCollectionLayer as i}from"../../layers/support/layerUtils.js";const o=new Set(["bing-maps","imagery","imagery-tile","map-image","open-street-map","tile","unknown","unsupported","vector-tile","web-tile","wcs","wms","wmts"]),l=new Set(["catalog","csv","feature","geo-rss","geojson","group","imagery","imagery-tile","kml","knowledge-graph","map-image","map-notes","media","ogc-feature","oriented-imagery","route","stream","subtype-group","tile","unknown","unsupported","vector-tile","web-tile","wcs","wfs","wms","wmts"]),a=new Set([...l,"link-chart"]);function s(e){o.delete(e),l.delete(e)}function c(e){o.add(e),l.add(e)}function u(e){switch(e.layerContainerType){case"basemap":return o;case"operational-layers":return"link-chart"===e.origin?a:l;default:return null}}function d(e,t){if(t.restrictedWebMapWriting){const n=u(t);return null==n||n.has(e.type)&&!i(e)}return!0}function p(e,t){if(t)if(i(e)){const r=n("featureCollection.layers",t),i=r?.[0]?.layerDefinition;i&&m(e,i)}else"group"!==e.type&&m(e,t)}function m(e,t){"maxScale"in e&&(t.maxScale=r(e.maxScale)??void 0),"minScale"in e&&(t.minScale=r(e.minScale)??void 0)}function f(e,t){if(p(e,t),t&&(t.id=e.id,"blendMode"in e&&(t.blendMode=e.blendMode,"normal"===t.blendMode&&delete t.blendMode),t.opacity=r(e.opacity)??void 0,t.title=e.title||"Layer",t.visibility=e.visible,"legendEnabled"in e&&"wmts"!==e.type))if(i(e)){const n=t.featureCollection;n&&(n.showLegend=e.legendEnabled)}else t.showLegend=e.legendEnabled}function g(n,r,o){if(!n.persistenceEnabled)return null;if(!("write"in n)||!n.write)return o?.messages&&o.messages.push(new e("layer:unsupported",`Layers (${n.title}, ${n.id}) of type '${n.declaredClass}' cannot be persisted`,{layer:n})),null;if(i(n)&&!n.isTable)r=n.resourceInfo;else if(d(n,o)){const e={};return n.write(e,o)?e:null}return null!=r&&f(n,r=t(r)),r}export{c as disableRestrictedWriting,s as enableRestrictedWriting,g as getLayerJSON};
5
+ import e from"../../core/Error.js";import{clone as t}from"../../core/lang.js";import{getDeepValue as n}from"../../core/object.js";import{numberToJSON as r}from"../../core/accessorSupport/extensions/serializableProperty/writer.js";import{isFeatureCollectionLayer as i}from"../../layers/support/layerUtils.js";const o=new Set(["bing-maps","imagery","imagery-tile","map-image","open-street-map","tile","unknown","unsupported","vector-tile","web-tile","wcs","wms","wmts"]),l=new Set(["catalog","csv","feature","geo-rss","geojson","group","imagery","imagery-tile","kml","knowledge-graph","map-image","map-notes","media","ogc-feature","oriented-imagery","route","stream","subtype-group","tile","unknown","unsupported","vector-tile","video","web-tile","wcs","wfs","wms","wmts"]),a=new Set([...l,"link-chart"]);function s(e){o.delete(e),l.delete(e)}function c(e){o.add(e),l.add(e)}function u(e){switch(e.layerContainerType){case"basemap":return o;case"operational-layers":return"link-chart"===e.origin?a:l;default:return null}}function d(e,t){if(t.restrictedWebMapWriting){const n=u(t);return null==n||n.has(e.type)&&!i(e)}return!0}function p(e,t){if(t)if(i(e)){const r=n("featureCollection.layers",t),i=r?.[0]?.layerDefinition;i&&m(e,i)}else"group"!==e.type&&m(e,t)}function m(e,t){"maxScale"in e&&(t.maxScale=r(e.maxScale)??void 0),"minScale"in e&&(t.minScale=r(e.minScale)??void 0)}function f(e,t){if(p(e,t),t&&(t.id=e.id,"blendMode"in e&&(t.blendMode=e.blendMode,"normal"===t.blendMode&&delete t.blendMode),t.opacity=r(e.opacity)??void 0,t.title=e.title||"Layer",t.visibility=e.visible,"legendEnabled"in e&&"wmts"!==e.type))if(i(e)){const n=t.featureCollection;n&&(n.showLegend=e.legendEnabled)}else t.showLegend=e.legendEnabled}function g(n,r,o){if(!n.persistenceEnabled)return null;if(!("write"in n)||!n.write)return o?.messages&&o.messages.push(new e("layer:unsupported",`Layers (${n.title}, ${n.id}) of type '${n.declaredClass}' cannot be persisted`,{layer:n})),null;if(i(n)&&!n.isTable)r=n.resourceInfo;else if(d(n,o)){const e={};return n.write(e,o)?e:null}return null!=r&&f(n,r=t(r)),r}export{c as disableRestrictedWriting,s as enableRestrictedWriting,g as getLayerJSON};
package/webmap/utils.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{Version as e}from"./Version.js";function r(e){return null!=e&&"object"==typeof e&&"declaredClass"in e&&"esri.WebMap"===e.declaredClass}const n=new e(2,33);export{n as currentVersion,r as isWebMap};
5
+ import{Version as e}from"./Version.js";function r(e){return null!=e&&"object"==typeof e&&"declaredClass"in e&&"esri.WebMap"===e.declaredClass}const n=new e(2,34);export{n as currentVersion,r as isWebMap};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Error.js";import{on as s,watch as i,initial as a}from"../core/reactiveUtils.js";import{formatFileSize as n}from"../core/unitFormatUtils.js";import{property as l}from"../core/accessorSupport/decorators/property.js";import{cast as r}from"../core/accessorSupport/decorators/cast.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as o}from"../core/accessorSupport/decorators/subclass.js";import d from"./Widget.js";import c from"./Attachments/AttachmentsViewModel.js";import{getIconPath as m,isSupportedImage as h}from"./Attachments/support/attachmentUtils.js";import{loadCalciteComponents as u}from"./support/componentsUtils.js";import{globalCss as p}from"./support/globalCss.js";import{legacyIcon as b}from"./support/legacyIcon.js";import{discardNode as _,storeNode as g,isRTL as f}from"./support/widgetUtils.js";import{messageBundle as v}from"./support/decorators/messageBundle.js";import{tsx as y}from"./support/jsxFactory.js";const A={addButton:!0,addSubmitButton:!0,cancelAddButton:!0,cancelUpdateButton:!0,deleteButton:!0,errorMessage:!0,progressBar:!0,updateButton:!0},w="esri-attachments",F={base:w,loaderContainer:`${w}__loader-container`,loader:`${w}__loader`,container:`${w}__container`,containerList:`${w}__container--list`,containerPreview:`${w}__container--preview`,actions:`${w}__actions`,deleteButton:`${w}__delete-button`,addAttachmentButton:`${w}__add-attachment-button`,errorMessage:`${w}__error-message`,items:`${w}__items`,item:`${w}__item`,itemButton:`${w}__item-button`,itemMask:`${w}__item-mask`,itemMaskIcon:`${w}__item-mask--icon`,itemImage:`${w}__image`,itemImageResizable:`${w}__image--resizable`,itemLabel:`${w}__label`,itemFilename:`${w}__filename`,itemChevronIcon:`${w}__item-chevron-icon`,itemLink:`${w}__item-link`,itemLinkOverlay:`${w}__item-link-overlay`,itemLinkOverlayIcon:`${w}__item-link-overlay-icon`,itemAddIcon:`${w}__item-add-icon`,formNode:`${w}__form-node`,fileFieldset:`${w}__file-fieldset`,fileLabel:`${w}__file-label`,fileName:`${w}__file-name`,fileInput:`${w}__file-input`,metadata:`${w}__metadata`,metadataFieldset:`${w}__metadata-fieldset`,progressBar:`${w}__progress-bar`},k=window.CSS;let M=class extends d{constructor(e,t){super(e,t),this.displayType="auto",this.messages=null,this.messagesUnits=null,this.selectedFile=null,this.submitting=!1,this.viewModel=null,this.visibleElements={...A},this._supportsImageOrientation=k&&k.supports&&k.supports("image-orientation","from-image"),this._addAttachmentForm=null,this._updateAttachmentForm=null}normalizeCtorArgs(e){return e?.viewModel||(e={viewModel:new c,...e}),e}initialize(){this.addHandles([s((()=>this.viewModel?.attachmentInfos),"change",(()=>this.scheduleRender())),s((()=>this.viewModel?.fileInfos),"change",(()=>this.scheduleRender())),i((()=>this.viewModel?.mode),(()=>this._modeChanged()),a)])}loadDependencies(){return u({icon:()=>import("@esri/calcite-components/dist/components/calcite-icon")})}get capabilities(){return this.viewModel.capabilities}set capabilities(e){this.viewModel.capabilities=e}get effectiveDisplayType(){const{displayType:e}=this;return e&&"auto"!==e?e:this.viewModel.supportsResizeAttachments?"preview":"list"}get graphic(){return this.viewModel.graphic}set graphic(e){this.viewModel.graphic=e}get icon(){return"attachment"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}castVisibleElements(e){return{...A,...e}}addAttachment(){const{_addAttachmentForm:e,viewModel:s}=this;return this._set("submitting",!0),this._set("error",null),s.addAttachment(e).then((e=>(this._set("submitting",!1),this._set("error",null),s.mode="view",e))).catch((e=>{throw this._set("submitting",!1),this._set("error",new t("attachments:add-attachment",this.messages.addErrorMessage,e)),e}))}deleteAttachment(e){const{viewModel:s}=this;return this._set("submitting",!0),this._set("error",null),s.deleteAttachment(e).then((e=>(this._set("submitting",!1),this._set("error",null),s.mode="view",e))).catch((e=>{throw this._set("submitting",!1),this._set("error",new t("attachments:delete-attachment",this.messages.deleteErrorMessage,e)),e}))}updateAttachment(){const{viewModel:e}=this,{_updateAttachmentForm:s}=this;return this._set("submitting",!0),this._set("error",null),e.updateAttachment(s).then((t=>(this._set("submitting",!1),this._set("error",null),e.mode="view",t))).catch((e=>{throw this._set("submitting",!1),this._set("error",new t("attachments:update-attachment",this.messages.updateErrorMessage,e)),e}))}addFile(){const e=this.viewModel.addFile(this.selectedFile,this._addAttachmentForm);return this.viewModel.mode="view",e}updateFile(){const{viewModel:e}=this,t=e.updateFile(this.selectedFile,this._updateAttachmentForm,e.activeFileInfo);return e.mode="view",t}deleteFile(e){const t=this.viewModel.deleteFile(e||this.viewModel.activeFileInfo?.file);return this.viewModel.mode="view",t}render(){const{submitting:e,viewModel:t}=this,{state:s}=t;return y("div",{class:this.classes(F.base,p.widget)},e?this._renderProgressBar():null,"loading"===s?this._renderLoading():this._renderAttachments(),this._renderErrorMessage())}_renderErrorMessage(){const{error:e,visibleElements:t}=this;return e&&t.errorMessage?y("div",{class:F.errorMessage,key:"error-message"},e.message):null}_renderAttachments(){const{activeFileInfo:e,mode:t,activeAttachmentInfo:s}=this.viewModel;return"add"===t?this._renderAddForm():"edit"===t?this._renderDetailsForm(s||e):this._renderAttachmentContainer()}_renderLoading(){return y("div",{class:F.loaderContainer,key:"loader"},y("div",{class:F.loader}))}_renderProgressBar(){return this.visibleElements.progressBar?y("div",{class:F.progressBar,key:"progress-bar"}):null}_renderAddForm(){const{submitting:e,selectedFile:t}=this,s=e||!t,i=this.visibleElements.cancelAddButton?y("button",{bind:this,class:this.classes(p.button,p.buttonTertiary,p.buttonSmall,p.buttonHalf,e&&p.buttonDisabled),disabled:e,onclick:this._cancelForm,type:"button"},this.messages.cancel):null,a=this.visibleElements.addSubmitButton?y("button",{class:this.classes(p.button,p.buttonSecondary,p.buttonSmall,p.buttonHalf,{[p.buttonDisabled]:s}),disabled:s,type:"submit"},this.messages.add):null,n=t?y("span",{class:F.fileName,key:"file-name"},t.name):null,l=y("form",{afterCreate:g,afterRemoved:_,bind:this,"data-node-ref":"_addAttachmentForm",onsubmit:this._submitAddAttachment},y("fieldset",{class:F.fileFieldset},n,y("label",{class:this.classes(F.fileLabel,p.button,p.buttonSecondary)},t?this.messages.changeFile:this.messages.selectFile,y("input",{bind:this,class:F.fileInput,name:"attachment",onchange:this._handleFileInputChange,type:"file"}))),a,i);return y("div",{class:F.formNode,key:"add-form-container"},l)}_renderDetailsForm(e){const{visibleElements:t,viewModel:s,selectedFile:i,submitting:a}=this,{capabilities:l}=s,r=a||!i;let o,d,c,m;i?(o=i.type,d=i.name,c=i.size):e&&"file"in e?(o=e.file.type,d=e.file.name,c=e.file.size):e&&"contentType"in e&&(o=e.contentType,d=e.name,c=e.size,m=e.url);const h=l.editing&&l.operations?.delete&&t.deleteButton?y("button",{bind:this,class:this.classes(p.button,p.buttonSmall,p.buttonTertiary,F.deleteButton,{[p.buttonDisabled]:a}),disabled:a,key:"delete-button",onclick:t=>this._submitDeleteAttachment(t,e),type:"button"},this.messages.delete):void 0,u=l.editing&&l.operations?.update&&t.updateButton?y("button",{class:this.classes(p.button,p.buttonSmall,p.buttonThird,{[p.buttonDisabled]:r}),disabled:r,key:"update-button",type:"submit"},this.messages.update):void 0,b=this.visibleElements.cancelUpdateButton?y("button",{bind:this,class:this.classes(p.button,p.buttonSmall,p.buttonTertiary,p.buttonThird,{[p.buttonDisabled]:a}),disabled:a,key:"cancel-button",onclick:this._cancelForm,type:"button"},this.messages.cancel):void 0,f=l.editing&&l.operations?.update?y("fieldset",{class:F.fileFieldset,key:"file"},y("span",{class:F.fileName,key:"file-name"},d),y("label",{class:this.classes(F.fileLabel,p.button,p.buttonSecondary)},this.messages.changeFile,y("input",{bind:this,class:F.fileInput,name:"attachment",onchange:this._handleFileInputChange,type:"file"}))):void 0,v=y("fieldset",{class:F.metadataFieldset,key:"size"},y("label",null,n(this.messagesUnits,c??0))),A=y("fieldset",{class:F.metadataFieldset,key:"content-type"},y("label",null,o)),w=null!=m?y("a",{class:F.itemLink,href:m,rel:"noreferrer",target:"_blank"},this._renderImageMask(e,400),y("div",{class:F.itemLinkOverlay},y("span",{class:F.itemLinkOverlayIcon},y("calcite-icon",{icon:"launch"})))):this._renderImageMask(e,400),k=y("form",{afterCreate:g,afterRemoved:_,bind:this,"data-node-ref":"_updateAttachmentForm",onsubmit:t=>this._submitUpdateAttachment(t,e)},y("div",{class:F.metadata},v,A),f,y("div",{class:F.actions},h,b,u));return y("div",{class:F.formNode,key:"edit-form-container"},w,k)}_renderImageMask(e,t){return e?"file"in e?this._renderGenericImageMask(e.file.name,e.file.type):this._renderImageMaskForAttachment(e,t):null}_renderGenericImageMask(e,t){const{supportsResizeAttachments:s}=this.viewModel,i=m(t),a={[F.itemImageResizable]:s};return y("div",{class:this.classes(F.itemMaskIcon,F.itemMask),key:i},y("img",{alt:e,class:this.classes(a,F.itemImage),src:i,title:e}))}_renderImageMaskForAttachment(e,t){const{supportsResizeAttachments:s}=this.viewModel;if(!e)return null;const{contentType:i,name:a,url:n}=e;if(!s||!h(i))return this._renderGenericImageMask(a,i);const l=this._getCSSTransform(e),r=l?{transform:l,"image-orientation":"none"}:{},o=`${n}${n?.includes("?")?"&":"?"}w=${t}`,d={[F.itemImageResizable]:s};return y("div",{class:this.classes(F.itemMask),key:o},y("img",{alt:a,class:this.classes(d,F.itemImage),src:o,styles:r,title:a}))}_renderFile(e){const{file:t}=e;return y("li",{class:F.item,key:t},y("button",{"aria-label":this.messages.attachmentDetails,bind:this,class:F.itemButton,key:"details-button",onclick:()=>this._startEditFile(e),title:this.messages.attachmentDetails,type:"button"},this._renderImageMask(e),y("label",{class:F.itemLabel},y("span",{class:F.itemFilename},t.name||this.messages.noTitle),y("span",{"aria-hidden":"true",class:this.classes(F.itemChevronIcon,f(this.container)?b.left:b.right)}))))}_renderAttachmentInfo({attachmentInfo:e,displayType:t}){const{viewModel:s,effectiveDisplayType:i}=this,{capabilities:a,supportsResizeAttachments:n}=s,{contentType:l,name:r,url:o}=e,d=this._renderImageMask(e,"list"===t?48:400),c=a.editing?y("span",{"aria-hidden":"true",class:this.classes(F.itemChevronIcon,f(this.container)?b.left:b.right)}):null,m=[d,"preview"===i&&n&&h(l)?null:y("label",{class:F.itemLabel},y("span",{class:F.itemFilename},r||this.messages.noTitle),c)],u=a.editing?y("button",{"aria-label":this.messages.attachmentDetails,bind:this,class:F.itemButton,"data-attachment-info-id":e.id,key:"details-button",onclick:()=>this._startEditAttachment(e),title:this.messages.attachmentDetails,type:"button"},m):y("a",{class:F.itemButton,href:o??void 0,key:"details-link",rel:"noreferrer",target:"_blank"},m);return y("li",{class:F.item,key:e},u)}_renderAttachmentContainer(){const{effectiveDisplayType:e,viewModel:t,visibleElements:s}=this,{attachmentInfos:i,capabilities:a,fileInfos:n}=t,l=!!i?.length,r=!!n?.length,o={[F.containerList]:"preview"!==e,[F.containerPreview]:"preview"===e},d=a.editing&&a.operations?.add&&s.addButton?y("button",{bind:this,class:this.classes(p.button,p.buttonTertiary,F.addAttachmentButton),onclick:()=>this._startAddAttachment(),type:"button"},y("span",{"aria-hidden":"true",class:this.classes(F.itemAddIcon,b.plus)}),this.messages.add):void 0,c=l?y("ul",{class:F.items,key:"attachments-list"},i.toArray().map((t=>this._renderAttachmentInfo({attachmentInfo:t,displayType:e})))):void 0,m=r?y("ul",{class:F.items,key:"file-list"},n.toArray().map((e=>this._renderFile(e)))):void 0,h=r||l?void 0:y("div",{class:p.empty},this.messages.noAttachments);return y("div",{class:this.classes(F.container,o),key:"attachments-container"},c,m,h,d)}_modeChanged(){this._set("error",null),this._set("selectedFile",null)}_handleFileInputChange(e){const t=e.target,s=t.files?.item(0);this._set("selectedFile",s)}_submitDeleteAttachment(e,t){e.preventDefault(),t&&("file"in t?this.deleteFile(t.file):t&&this.deleteAttachment(t))}_submitAddAttachment(e){e.preventDefault(),this.viewModel.filesEnabled?this.addFile():this.addAttachment()}_submitUpdateAttachment(e,t){e.preventDefault(),t&&"file"in t?this.updateFile():this.updateAttachment()}_startEditAttachment(e){const{viewModel:t}=this;t.activeFileInfo=null,t.activeAttachmentInfo=e,t.mode="edit"}_startEditFile(e){const{viewModel:t}=this;t.activeAttachmentInfo=null,t.activeFileInfo=e,t.mode="edit"}_startAddAttachment(){this.viewModel.mode="add"}_cancelForm(e){e.preventDefault(),this.viewModel.mode="view"}_getCSSTransform(e){const{orientationInfo:t}=e;return!this._supportsImageOrientation&&t?[t.rotation?`rotate(${t.rotation}deg)`:"",t.mirrored?"scaleX(-1)":""].join(" "):""}};e([l()],M.prototype,"capabilities",null),e([l()],M.prototype,"displayType",void 0),e([l({readOnly:!0})],M.prototype,"effectiveDisplayType",null),e([l()],M.prototype,"graphic",null),e([l()],M.prototype,"icon",null),e([l()],M.prototype,"label",null),e([l(),v("esri/widgets/Attachments/t9n/Attachments")],M.prototype,"messages",void 0),e([l(),v("esri/core/t9n/Units")],M.prototype,"messagesUnits",void 0),e([l({readOnly:!0})],M.prototype,"selectedFile",void 0),e([l({readOnly:!0})],M.prototype,"submitting",void 0),e([l({readOnly:!0})],M.prototype,"error",void 0),e([l({type:c})],M.prototype,"viewModel",void 0),e([l()],M.prototype,"visibleElements",void 0),e([r("visibleElements")],M.prototype,"castVisibleElements",null),M=e([o("esri.widgets.Attachments")],M);export{M as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Error.js";import{on as s,watch as i,initial as a}from"../core/reactiveUtils.js";import{formatFileSize as n}from"../core/unitFormatUtils.js";import{property as l}from"../core/accessorSupport/decorators/property.js";import{cast as r}from"../core/accessorSupport/decorators/cast.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as o}from"../core/accessorSupport/decorators/subclass.js";import d from"./Widget.js";import c from"./Attachments/AttachmentsViewModel.js";import{getIconPath as m,isSupportedImage as h}from"./Attachments/support/attachmentUtils.js";import{loadCalciteComponents as u}from"./support/componentsUtils.js";import{globalCss as p}from"./support/globalCss.js";import{legacyIcon as b}from"./support/legacyIcon.js";import{discardNode as _,storeNode as g,isRTL as f}from"./support/widgetUtils.js";import{messageBundle as v}from"./support/decorators/messageBundle.js";import{tsx as y}from"./support/jsxFactory.js";const A={addButton:!0,addSubmitButton:!0,cancelAddButton:!0,cancelUpdateButton:!0,deleteButton:!0,errorMessage:!0,progressBar:!0,updateButton:!0},w="esri-attachments",F={base:w,loaderContainer:`${w}__loader-container`,loader:`${w}__loader`,container:`${w}__container`,containerList:`${w}__container--list`,containerPreview:`${w}__container--preview`,actions:`${w}__actions`,deleteButton:`${w}__delete-button`,addAttachmentButton:`${w}__add-attachment-button`,errorMessage:`${w}__error-message`,items:`${w}__items`,item:`${w}__item`,itemButton:`${w}__item-button`,itemMask:`${w}__item-mask`,itemMaskIcon:`${w}__item-mask--icon`,itemImage:`${w}__image`,itemImageResizable:`${w}__image--resizable`,itemLabel:`${w}__label`,itemFilename:`${w}__filename`,itemChevronIcon:`${w}__item-chevron-icon`,itemLink:`${w}__item-link`,itemLinkOverlay:`${w}__item-link-overlay`,itemLinkOverlayIcon:`${w}__item-link-overlay-icon`,itemAddIcon:`${w}__item-add-icon`,formNode:`${w}__form-node`,fileFieldset:`${w}__file-fieldset`,fileLabel:`${w}__file-label`,fileName:`${w}__file-name`,fileInput:`${w}__file-input`,metadata:`${w}__metadata`,metadataFieldset:`${w}__metadata-fieldset`,progressBar:`${w}__progress-bar`},k=window.CSS;let M=class extends d{constructor(e,t){super(e,t),this.displayType="auto",this.messages=null,this.messagesUnits=null,this.selectedFile=null,this.submitting=!1,this.viewModel=null,this.visibleElements={...A},this._supportsImageOrientation=k&&k.supports&&k.supports("image-orientation","from-image"),this._addAttachmentForm=null,this._updateAttachmentForm=null}normalizeCtorArgs(e){return e?.viewModel||(e={viewModel:new c,...e}),e}initialize(){this.addHandles([s((()=>this.viewModel?.attachmentInfos),"change",(()=>this.scheduleRender())),s((()=>this.viewModel?.fileInfos),"change",(()=>this.scheduleRender())),i((()=>this.viewModel?.mode),(()=>this._modeChanged()),a)])}loadDependencies(){return u({icon:()=>import("@esri/calcite-components/dist/components/calcite-icon")})}get capabilities(){return this.viewModel.capabilities}set capabilities(e){this.viewModel.capabilities=e}get effectiveDisplayType(){const{displayType:e}=this;return e&&"auto"!==e?e:this.viewModel.supportsResizeAttachments?"preview":"list"}get graphic(){return this.viewModel.graphic}set graphic(e){this.viewModel.graphic=e}get icon(){return"attachment"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}castVisibleElements(e){return{...A,...e}}addAttachment(){const{_addAttachmentForm:e,viewModel:s}=this;return this._set("submitting",!0),this._set("error",null),s.addAttachment(e).then((e=>(this._set("submitting",!1),this._set("error",null),s.mode="view",e))).catch((e=>{throw this._set("submitting",!1),this._set("error",new t("attachments:add-attachment",this.messages.addErrorMessage,e)),e}))}deleteAttachment(e){const{viewModel:s}=this;return this._set("submitting",!0),this._set("error",null),s.deleteAttachment(e).then((e=>(this._set("submitting",!1),this._set("error",null),s.mode="view",e))).catch((e=>{throw this._set("submitting",!1),this._set("error",new t("attachments:delete-attachment",this.messages.deleteErrorMessage,e)),e}))}updateAttachment(){const{viewModel:e}=this,{_updateAttachmentForm:s}=this;return this._set("submitting",!0),this._set("error",null),e.updateAttachment(s).then((t=>(this._set("submitting",!1),this._set("error",null),e.mode="view",t))).catch((e=>{throw this._set("submitting",!1),this._set("error",new t("attachments:update-attachment",this.messages.updateErrorMessage,e)),e}))}addFile(){const e=this.viewModel.addFile(this.selectedFile,this._addAttachmentForm);return this.viewModel.mode="view",e}updateFile(){const{viewModel:e}=this,t=e.updateFile(this.selectedFile,this._updateAttachmentForm,e.activeFileInfo);return e.mode="view",t}deleteFile(e){const t=this.viewModel.deleteFile(e||this.viewModel.activeFileInfo?.file);return this.viewModel.mode="view",t}render(){const{submitting:e,viewModel:t}=this,{state:s}=t;return y("div",{class:this.classes(F.base,p.widget)},e?this._renderProgressBar():null,"loading"===s?this._renderLoading():this._renderAttachments(),this._renderErrorMessage())}_renderErrorMessage(){const{error:e,visibleElements:t}=this;return e&&t.errorMessage?y("div",{class:F.errorMessage,key:"error-message"},e.message):null}_renderAttachments(){const{activeFileInfo:e,mode:t,activeAttachmentInfo:s}=this.viewModel;return"add"===t?this._renderAddForm():"edit"===t?this._renderDetailsForm(s||e):this._renderAttachmentContainer()}_renderLoading(){return y("div",{class:F.loaderContainer,key:"loader"},y("div",{class:F.loader}))}_renderProgressBar(){return this.visibleElements.progressBar?y("div",{class:F.progressBar,key:"progress-bar"}):null}_renderAddForm(){const{submitting:e,selectedFile:t}=this,s=e||!t,i=this.visibleElements.cancelAddButton?y("button",{bind:this,class:this.classes(p.button,p.buttonTertiary,p.buttonSmall,p.buttonHalf,e&&p.buttonDisabled),disabled:e,onclick:this._cancelForm,type:"button"},this.messages.cancel):null,a=this.visibleElements.addSubmitButton?y("button",{class:this.classes(p.button,p.buttonSecondary,p.buttonSmall,p.buttonHalf,{[p.buttonDisabled]:s}),disabled:s,type:"submit"},this.messages.add):null,n=t?y("span",{class:F.fileName,key:"file-name"},t.name):null,l=y("form",{afterCreate:g,afterRemoved:_,bind:this,"data-node-ref":"_addAttachmentForm",onsubmit:this._submitAddAttachment},y("fieldset",{class:F.fileFieldset},n,y("label",{class:this.classes(F.fileLabel,p.button,p.buttonSecondary)},t?this.messages.changeFile:this.messages.selectFile,y("input",{bind:this,class:F.fileInput,name:"attachment",onchange:this._handleFileInputChange,type:"file"}))),a,i);return y("div",{class:F.formNode,key:"add-form-container"},l)}_renderDetailsForm(e){const{visibleElements:t,viewModel:s,selectedFile:i,submitting:a}=this,{capabilities:l}=s,r=a||!i;let o,d,c,m;i?(o=i.type,d=i.name,c=i.size):e&&"file"in e?(o=e.file.type,d=e.file.name,c=e.file.size):e&&"contentType"in e&&(o=e.contentType,d=e.name,c=e.size,m=e.url);const h=l.editing&&l.operations?.delete&&t.deleteButton?y("button",{bind:this,class:this.classes(p.button,p.buttonSmall,p.buttonTertiary,F.deleteButton,{[p.buttonDisabled]:a}),disabled:a,key:"delete-button",onclick:t=>this._submitDeleteAttachment(t,e),type:"button"},this.messages.delete):void 0,u=l.editing&&l.operations?.update&&t.updateButton?y("button",{class:this.classes(p.button,p.buttonSmall,p.buttonThird,{[p.buttonDisabled]:r}),disabled:r,key:"update-button",type:"submit"},this.messages.update):void 0,b=this.visibleElements.cancelUpdateButton?y("button",{bind:this,class:this.classes(p.button,p.buttonSmall,p.buttonTertiary,p.buttonThird,{[p.buttonDisabled]:a}),disabled:a,key:"cancel-button",onclick:this._cancelForm,type:"button"},this.messages.cancel):void 0,f=l.editing&&l.operations?.update?y("fieldset",{class:F.fileFieldset,key:"file"},y("span",{class:F.fileName,key:"file-name"},d),y("label",{class:this.classes(F.fileLabel,p.button,p.buttonSecondary)},this.messages.changeFile,y("input",{bind:this,class:F.fileInput,name:"attachment",onchange:this._handleFileInputChange,type:"file"}))):void 0,v=y("fieldset",{class:F.metadataFieldset,key:"size"},y("label",null,n(this.messagesUnits,c??0))),A=y("fieldset",{class:F.metadataFieldset,key:"content-type"},y("label",null,o)),w=null!=m?y("a",{class:F.itemLink,href:m,rel:"noreferrer",target:"_blank"},this._renderImageMask(e,400),y("div",{class:F.itemLinkOverlay},y("span",{class:F.itemLinkOverlayIcon},y("calcite-icon",{icon:"launch"})))):this._renderImageMask(e,400),k=y("form",{afterCreate:g,afterRemoved:_,bind:this,"data-node-ref":"_updateAttachmentForm",onsubmit:t=>this._submitUpdateAttachment(t,e)},y("div",{class:F.metadata},v,A),f,y("div",{class:F.actions},h,b,u));return y("div",{class:F.formNode,key:"edit-form-container"},w,k)}_renderImageMask(e,t){return e?"file"in e?this._renderGenericImageMask(e.file.name,e.file.type):this._renderImageMaskForAttachment(e,t):null}_renderGenericImageMask(e,t){const{supportsResizeAttachments:s}=this.viewModel,i=m(t),a={[F.itemImageResizable]:s};return y("div",{class:this.classes(F.itemMaskIcon,F.itemMask),key:i},y("img",{alt:e,class:this.classes(a,F.itemImage),src:i,title:e}))}_renderImageMaskForAttachment(e,t){const{supportsResizeAttachments:s}=this.viewModel;if(!e)return null;const{contentType:i,name:a,size:n,url:l}=e;if(!s||!h(i))return this._renderGenericImageMask(a,i);const r=this._getCSSTransform(e),o=r?{transform:r,"image-orientation":"none"}:{},d=`${l}${l?.includes("?")?"&":"?"}w=${t}&s=${n}`,c={[F.itemImageResizable]:s};return y("div",{class:this.classes(F.itemMask),key:d},y("img",{alt:a,class:this.classes(c,F.itemImage),src:d,styles:o,title:a}))}_renderFile(e){const{file:t}=e;return y("li",{class:F.item,key:t},y("button",{"aria-label":this.messages.attachmentDetails,bind:this,class:F.itemButton,key:"details-button",onclick:()=>this._startEditFile(e),title:this.messages.attachmentDetails,type:"button"},this._renderImageMask(e),y("label",{class:F.itemLabel},y("span",{class:F.itemFilename},t.name||this.messages.noTitle),y("span",{"aria-hidden":"true",class:this.classes(F.itemChevronIcon,f(this.container)?b.left:b.right)}))))}_renderAttachmentInfo({attachmentInfo:e,displayType:t}){const{viewModel:s,effectiveDisplayType:i}=this,{capabilities:a,supportsResizeAttachments:n}=s,{contentType:l,name:r,url:o}=e,d=this._renderImageMask(e,"list"===t?48:400),c=a.editing?y("span",{"aria-hidden":"true",class:this.classes(F.itemChevronIcon,f(this.container)?b.left:b.right)}):null,m=[d,"preview"===i&&n&&h(l)?null:y("label",{class:F.itemLabel},y("span",{class:F.itemFilename},r||this.messages.noTitle),c)],u=a.editing?y("button",{"aria-label":this.messages.attachmentDetails,bind:this,class:F.itemButton,"data-attachment-info-id":e.id,key:"details-button",onclick:()=>this._startEditAttachment(e),title:this.messages.attachmentDetails,type:"button"},m):y("a",{class:F.itemButton,href:o??void 0,key:"details-link",rel:"noreferrer",target:"_blank"},m);return y("li",{class:F.item,key:e},u)}_renderAttachmentContainer(){const{effectiveDisplayType:e,viewModel:t,visibleElements:s}=this,{attachmentInfos:i,capabilities:a,fileInfos:n}=t,l=!!i?.length,r=!!n?.length,o={[F.containerList]:"preview"!==e,[F.containerPreview]:"preview"===e},d=a.editing&&a.operations?.add&&s.addButton?y("button",{bind:this,class:this.classes(p.button,p.buttonTertiary,F.addAttachmentButton),onclick:()=>this._startAddAttachment(),type:"button"},y("span",{"aria-hidden":"true",class:this.classes(F.itemAddIcon,b.plus)}),this.messages.add):void 0,c=l?y("ul",{class:F.items,key:"attachments-list"},i.toArray().map((t=>this._renderAttachmentInfo({attachmentInfo:t,displayType:e})))):void 0,m=r?y("ul",{class:F.items,key:"file-list"},n.toArray().map((e=>this._renderFile(e)))):void 0,h=r||l?void 0:y("div",{class:p.empty},this.messages.noAttachments);return y("div",{class:this.classes(F.container,o),key:"attachments-container"},c,m,h,d)}_modeChanged(){this._set("error",null),this._set("selectedFile",null)}_handleFileInputChange(e){const t=e.target,s=t.files?.item(0);this._set("selectedFile",s)}_submitDeleteAttachment(e,t){e.preventDefault(),t&&("file"in t?this.deleteFile(t.file):t&&this.deleteAttachment(t))}_submitAddAttachment(e){e.preventDefault(),this.viewModel.filesEnabled?this.addFile():this.addAttachment()}_submitUpdateAttachment(e,t){e.preventDefault(),t&&"file"in t?this.updateFile():this.updateAttachment()}_startEditAttachment(e){const{viewModel:t}=this;t.activeFileInfo=null,t.activeAttachmentInfo=e,t.mode="edit"}_startEditFile(e){const{viewModel:t}=this;t.activeAttachmentInfo=null,t.activeFileInfo=e,t.mode="edit"}_startAddAttachment(){this.viewModel.mode="add"}_cancelForm(e){e.preventDefault(),this.viewModel.mode="view"}_getCSSTransform(e){const{orientationInfo:t}=e;return!this._supportsImageOrientation&&t?[t.rotation?`rotate(${t.rotation}deg)`:"",t.mirrored?"scaleX(-1)":""].join(" "):""}};e([l()],M.prototype,"capabilities",null),e([l()],M.prototype,"displayType",void 0),e([l({readOnly:!0})],M.prototype,"effectiveDisplayType",null),e([l()],M.prototype,"graphic",null),e([l()],M.prototype,"icon",null),e([l()],M.prototype,"label",null),e([l(),v("esri/widgets/Attachments/t9n/Attachments")],M.prototype,"messages",void 0),e([l(),v("esri/core/t9n/Units")],M.prototype,"messagesUnits",void 0),e([l({readOnly:!0})],M.prototype,"selectedFile",void 0),e([l({readOnly:!0})],M.prototype,"submitting",void 0),e([l({readOnly:!0})],M.prototype,"error",void 0),e([l({type:c})],M.prototype,"viewModel",void 0),e([l()],M.prototype,"visibleElements",void 0),e([r("visibleElements")],M.prototype,"castVisibleElements",null),M=e([o("esri.widgets.Attachments")],M);export{M 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.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import"../core/has.js";import{abortHandle as t}from"../core/handleUtils.js";import{getOrCreateMapValue as i}from"../core/MapUtils.js";import{watch as o,whenOnce as n}from"../core/reactiveUtils.js";import{property as a}from"../core/accessorSupport/decorators/property.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as s}from"../core/accessorSupport/decorators/subclass.js";import{isIntegerField as r}from"../layers/support/fieldUtils.js";import{isString as l}from"../support/guards.js";import d from"./Widget.js";import{getHiddenFieldsValidationErrorMessage as p,getVisibleFieldInputValidationErrorMessage as u,isElementTemplateWithInputType as c}from"./BatchAttributeForm/batchAttributeFormUtils.js";import m from"./BatchAttributeForm/BatchAttributeFormViewModel.js";import{css as h}from"./BatchAttributeForm/css.js";import{VisibleElements as v}from"./BatchAttributeForm/VisibleElements.js";import{InputVisibilityCode as f,isGroupInput as b,isFieldInput as _,differentValuesString as C}from"./BatchAttributeForm/inputs/support/inputUtils.js";import{loadCalciteComponents as g}from"./support/componentsUtils.js";import{getLabelForDateFieldValue as y,getIntlOptionsForField as I,prepareISOFieldValueForDateComponents as F,prepareUnixFieldValueForDateComponents as w,normalizeTimeOnlyString as x,getISOFieldValueFromDateComponents as M,getUnixFieldValueFromDateComponents as O}from"./support/dateUtils.js";import{globalCss as T}from"./support/globalCss.js";import{setFocus as k}from"./support/widgetUtils.js";import{messageBundle as D}from"./support/decorators/messageBundle.js";import{vmEvent as V}from"./support/decorators/vmEvent.js";import{tsx as E}from"./support/jsxFactory.js";import{isEmptyValue as S}from"./support/forms/formUtils.js";import{substitute as U}from"../intl/substitute.js";const R="data-element-id";let L=class extends d{constructor(e,t){super(e,t),this.headingLevel=2,this.messagesCommon=null,this.messages=null,this.featureFormMessages=null,this.viewModel=new m,this.visibleElements=new v,this.groupDisplay="all",this._attemptFocusOnNextRender=!1,this._dateComponentMap=new Map,this._touchedInputs=new Set,this._focusedFieldInput=null,this._batchSwitchInputInitialValues=new Map,this._saveInput=this._saveInput.bind(this),this._onFormSubmit=this._onFormSubmit.bind(this),this._onComponentFocus=this._onComponentFocus.bind(this),this._onComponentBlur=this._onComponentBlur.bind(this),this._afterComponentCreateOrUpdate=this._afterComponentCreateOrUpdate.bind(this),this._afterDateComponentCreate=this._afterDateComponentCreate.bind(this),this._afterDateComponentUpdate=this._afterDateComponentUpdate.bind(this),this._afterRadioGroupCreateOrUpdate=this._afterRadioGroupCreateOrUpdate.bind(this)}initialize(){this.addHandles([o((()=>this.features),(()=>{this._dateComponentMap.clear();const e=new AbortController;n((()=>!this.viewModel.updating),e.signal).then((()=>{this._attemptFocusOnNextRender=!0})),this.addHandles(t(e))})),o((()=>this.viewModel.activeForm),(()=>{this._batchSwitchInputInitialValues.clear()}))])}loadDependencies(){return g({input:()=>import("@esri/calcite-components/dist/components/calcite-input"),block:()=>import("@esri/calcite-components/dist/components/calcite-block"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item"),"combobox-item-group":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item-group"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown"),"dropdown-group":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-group"),"dropdown-item":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-item"),"input-date-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-date-picker"),"input-number":()=>import("@esri/calcite-components/dist/components/calcite-input-number"),"input-time-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-time-picker"),"input-time-zone":()=>import("@esri/calcite-components/dist/components/calcite-input-time-zone"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),"input-message":()=>import("@esri/calcite-components/dist/components/calcite-input-message"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch"),"text-area":()=>import("@esri/calcite-components/dist/components/calcite-text-area"),"radio-button":()=>import("@esri/calcite-components/dist/components/calcite-radio-button"),"radio-button-group":()=>import("@esri/calcite-components/dist/components/calcite-radio-button-group")})}get activeFeatureIndex(){return this.viewModel.activeFeatureIndex}set activeFeatureIndex(e){this.viewModel.activeFeatureIndex=e}get disabled(){return this.viewModel.disabled}set disabled(e){this.viewModel.disabled=e}get _effectiveDisabled(){return this.disabled||this.viewModel.updating}get features(){return this.viewModel.features}set features(e){this.viewModel.features=e}get map(){return this.viewModel.map}set map(e){this.viewModel.map=e}get spatialReference(){return this.viewModel.spatialReference}set spatialReference(e){this.viewModel.spatialReference=e}get timeZone(){return this.viewModel.timeZone}set timeZone(e){this.viewModel.timeZone=e}get icon(){return"edit-attributes"}set icon(e){this._overrideIfSome("icon",e)}get readOnly(){return this.viewModel.readOnly}set readOnly(e){this.viewModel.readOnly=e}goToClosestError(){const e=this.viewModel.getFirstVisibleInvalidFieldInput();if(!e)return;const{groupInput:t}=e;t&&(t.open||(t.open=!0)),setTimeout((()=>{if(!this.domNode)return;const t=this.domNode.querySelector(`[data-element-id="${e.input.template.elementId}"]`);t&&k(t)}),10)}render(){const{status:e}=this.viewModel;return"failed"===e?this.viewModel.hasTooManyComplexFeatures?this._renderErrorNotice(U(this.messages.formFailedToLoadTooManyComplexFeatures,{num:this.viewModel.maximumFeatureCountWithComplexForms})):this.viewModel.hasTooManyFeatures?this._renderErrorNotice(U(this.messages.formFailedToLoadTooManyFeatures,{num:this.viewModel.maximumFeatureCount})):this._renderErrorNotice(this.messages.formFailedToLoad):this.viewModel.expressionEvaluationFailed?this._renderErrorNotice(this.messages.expressionEvaluationFailed):this.viewModel.hasLayersWithContingentValues?this._renderErrorNotice(this.messages.unsupportedContingentValues):E("div",{class:this.classes(h.base,T.widget,T.panel)},"loaded"===e?this._renderForm():"loading"===e&&this.visibleElements.loadingIndicator?E("calcite-loader",{key:"loader",label:this.messagesCommon?.loading}):null)}_setDateTimeTimeZoneMap(e){const{datePart:t,elementId:o}=e.dataset,n=this._getCalciteElementFromDateTimeTimeZonePicker(e,t);if(!n)return;const a=i(this._dateComponentMap,`${o}`,(()=>({placeholder:{date:"",time:"",timeZone:""}})));switch(a.placeholder[t]=n.placeholder??"",t){case"date":a.date=e;break;case"time":a.time=e;break;case"timeZone":a.timeZone=e,a.defaultComboboxItemElements=n.selectedItems}"timeZone"===t&&(a.defaultComboboxItemElements=n.selectedItems)}_getCalciteElementFromDateTimeTimeZonePicker(e,t){const i=e.shadowRoot;return i?"timeZone"===t?i.querySelector("calcite-combobox"):i.querySelector("calcite-input-text"):null}_updateDateTimeOrTimeZoneShadowDom(e,t){const{datePart:i,elementId:o}=e.dataset,n=this._dateComponentMap.get(`${o}`);if(!n)return;const a=this._getCalciteElementFromDateTimeTimeZonePicker(e,i);if(a)switch(i){case"date":case"time":a.placeholder=t?this.messages.differentValues:n.placeholder[i];break;case"timeZone":t?(a.value="",a.placeholder=this.messages.differentValues):(!a.selectedItems.length&&n.defaultComboboxItemElements?.length&&(a.selectedItems[0]=n.defaultComboboxItemElements[0]),a.placeholder=n.placeholder[i])}}_renderErrorNotice(e){return E("div",{class:this.classes(h.base,T.widget,T.panel)},E("calcite-notice",{class:h.noticeError,icon:!0,kind:"warning",open:!0},E("div",{slot:"message"},e)))}_renderForm(){return E("form",{onsubmit:this._onFormSubmit},this._renderInvisibleFieldsError(),this._renderContent())}_renderInvisibleFieldsError(){const{viewModel:e}=this,{hasNonActiveInvalidFeatures:t,activeForm:i}=e;let o;if(!e.submitHasBeenAttempted)return null;if(i.invalidHiddenInputs.length>0)if(o=p(i,e.mode,this.messages),"batch"===this.viewModel.mode){const e=i.invalidHiddenInputs.filter((e=>e.effectiveVisibilityCode===f.HIDDEN_GROUP_VISIBILITY_EXPRESSION_ALL||e.visibilityCode===f.HIDDEN_VISIBILITY_EXPRESSION_ALL));e.length>0?o+=` (${e.map((e=>e.label)).join(", ")})`:o=null}else o+=` (${i.invalidHiddenInputs.map((e=>e.label)).join(", ")})`;else if(t)return null;return o?E("calcite-notice",{class:h.noticeError,icon:!0,kind:"danger",open:!0},E("div",{slot:"message"},o)):null}_renderContent(){if(!this.viewModel.hasVisibleInputs)return[E("calcite-notice",{class:h.noticeError,icon:!0,kind:"warning",open:!0},E("div",{slot:"message"},this.messages.noVisibleFields[this.viewModel.noVisibleElementsReason]))];const{inputs:e}=this.viewModel.activeForm;return e.filter((e=>e.visible)).map((e=>this._renderInput(e)))}_renderInput(e){return b(e)?this._renderGroupInput(e):_(e)?this._renderLabeledField(e):void 0}_renderGroupInput(e){const{inputs:t,template:i,open:o}=e,n=t.filter((e=>e.visible)),a=i.label??"";return E("calcite-block",{class:this.classes(h.group,"sequential"===this.groupDisplay?h.groupSequential:null,this.disabled?h.inputDisabled:null),collapsible:!0,description:i.description??void 0,disabled:this._effectiveDisabled,expanded:o,heading:a,headingLevel:this.headingLevel,key:`{${i.elementId}-key}`,label:a,onCalciteBlockClose:()=>{e.open=!1},onCalciteBlockOpen:()=>{e.open=!0}},n.map((e=>this._renderInput(e))))}_renderLabeledField(e){const{label:t,elementId:i}=e.template,{required:o,dataType:n}=e,a=o?U(this.messages.requiredFieldLabel,{name:t}):t;return E("calcite-label",{"aria-label":a,class:h.label,key:`field--${i}`},E("div",{class:h.labelTextContent,key:"labelTextContainer"},t,o?E("span",{"aria-hidden":"true",title:this.messagesCommon.required},"*"):void 0),"unsupported"!==n?this._renderFieldInput(e):this._renderReadOnlyComponent(e),this._renderAuxiliaryText(e))}_renderFieldInput(e){const t=this.getCommonInputProps(e),{dataType:i}=e;return"date"===i?this._renderDateComponents(e,t):"coded-value"===e.domain?.type?this._renderCodedInputs({input:e,props:t}):"number"===i?this._renderNumberComponent(e,t):this._renderStringComponent(e,t)}_renderAuxiliaryText(e){const{compositeError:t,description:i,submittable:o}=e,n=!o&&t&&(this.viewModel.submitHasBeenAttempted||this._touchedInputs.has(e.template.elementId))?u(e,t,this.messages):null;return n?E("calcite-input-message",{icon:!0,status:"invalid"},n):i?E("calcite-input-message",{class:h.description,icon:!1,status:"idle"},i):null}_renderCodedInputs({input:e,props:t}){const i=e.template.input?.type??null,o=e.codedValueOptions;switch(i){case"switch":return this._renderSwitchField({input:e,props:t});case"radio-buttons":return this._renderRadioButtonGroupComponent({input:e,options:o.flat(),props:t});default:return this._renderComboBoxComponent({options:o,props:t,input:e})}}_renderSwitchField({input:e,props:t}){if((this._batchSwitchInputInitialValues.get(e)===C||e.value===C)&&"batch"===this.viewModel.mode){const i={dropdown:{afterCreate:this._afterComponentCreateOrUpdate,afterUpdate:this._afterComponentCreateOrUpdate,disabled:t.readOnly,open:!1,[R]:t[R]},trigger:{appearance:"transparent",iconEnd:"chevron-down",kind:"neutral",slot:"trigger",label:t.label},group:{mode:"single"}};return this._renderDropdownComponent({buttonValue:e.value,dropdownProps:i,options:[{name:this.messages.differentValues,value:C,disabled:!0},...e.codedValueDomainOptions]})}return this._renderSwitchComponent({input:e,props:t})}_renderSwitchComponent({input:e,props:t}){return E("calcite-switch",{...t,checked:!!c(e.template,"switch")&&e.value===e.template.input.onValue,class:h.inputSwitch,disabled:t.readOnly,onblur:()=>{this._focusedFieldInput=null},onCalciteSwitchChange:({currentTarget:e})=>this._saveInput(e)})}_renderDropdownComponent({buttonValue:e,options:t,dropdownProps:i}){const{trigger:o,dropdown:n,group:a}=i;return E("calcite-dropdown",{...n,onblur:()=>{this._focusedFieldInput=null},onfocus:this._onComponentFocus,onCalciteDropdownSelect:({currentTarget:e})=>this._saveInput(e)},E("calcite-button",{...o},e===C?this.messages.differentValues:e),E("calcite-dropdown-group",{selectionMode:a.mode},t.map((t=>E("calcite-dropdown-item",{disabled:t.disabled,label:String(t.name),selected:e===t.value},t.name)))))}_renderComboBoxComponent({input:e,options:t,props:i}){const o="INSERT"===this.viewModel.editType,n=this._touchedInputs.has(e?.template?.elementId),a=o&&e.showNoValueOptionEnabled&&!n?()=>{}:i.onblur,s={...i,onblur:a};return E("calcite-combobox",{...s,selectionMode:"single",value:i.placeholder===this.messages.differentValues?C:String(i.value),onCalciteComboboxChange:({currentTarget:e})=>{e.value!==C&&this._saveInput(e)}},this.renderComboboxOptionsList({input:e,options:t,props:i}))}renderComboboxOptionsList({input:e,options:t,props:i}){const[o,n]=t.map((e=>e.map((({name:e,value:t})=>E("calcite-combobox-item",{key:`#${t}`,selected:i.value===t,textLabel:e,value:`${t}`}))))),a=[...o];n.length>0&&a.push(E("calcite-combobox-item-group",{key:"unsupported",label:this.featureFormMessages.subtypes.unsupportedDomainGroupTitle},n));const s=i.placeholder===this.messages.differentValues,r=!s&&S(i.value);return e.showNoValueOptionEnabled&&a.unshift(E("calcite-combobox-item",{key:"empty-option",selected:r,textLabel:e.showNoValueLabel||this.messages.empty,value:""})),s&&a.unshift(E("calcite-combobox-item",{key:C,selected:!0,textLabel:this.messages.differentValues,value:C})),a}_renderRadioButtonGroupComponent({input:e,options:t,props:i}){const o=t.map((({name:t,value:o})=>this._renderRadioButtons({label:t,value:o,selected:o===e.value,props:i})));if(e.showNoValueOptionEnabled){const t="",n=e.showNoValueLabel||this.messages.empty,a=S(e.value);o.unshift(this._renderRadioButtons({label:n,value:t,selected:a,props:i}))}return E("calcite-radio-button-group",{afterCreate:this._afterRadioGroupCreateOrUpdate,afterUpdate:this._afterRadioGroupCreateOrUpdate,class:h.inputRadioGroup,disabled:i.readOnly,key:`${i.key}-radio-group`,layout:"vertical",name:i.name,required:i.required},o,i.placeholder===this.messages.differentValues?E("calcite-label",{class:h.placeholderRadio,key:i.label,layout:"inline"},E("calcite-radio-button",{checked:!0,class:h.inputRadio,disabled:!0,name:i.placeholder,value:i.placeholder}),i.placeholder):null)}_renderRadioButtons({value:e,selected:t,label:i,props:o}){return E("calcite-label",{class:h.inputRadioLabel,key:o.label,layout:"inline"},E("calcite-radio-button",{...o,afterCreate:void 0,afterUpdate:void 0,checked:t,class:h.inputRadio,disabled:o.readOnly,name:o.label,onblur:()=>{this._focusedFieldInput=null},value:e,onCalciteRadioButtonChange:({currentTarget:e})=>{e.checked&&this._saveInput(e)}}),i)}_renderStringComponent(e,t){const{template:i}=e;return!i.field.editable||this.readOnly?this._renderReadOnlyComponent(e):i.input&&"text-area"===i.input.type?E("calcite-text-area",{...t,class:this.classes(h.individualElement),resize:"vertical",value:t.value?String(t.value):"",onCalciteTextAreaInput:({currentTarget:e})=>this._saveInput(e)}):E("calcite-input",{...t,class:this.classes(h.individualElement),type:"text",value:t.value?String(t.value):"",onCalciteInputInput:({currentTarget:e})=>this._saveInput(e)})}_renderNumberComponent(e,t){const i=r(e.field);return E("calcite-input-number",{...t,integer:i,type:"number",value:i&&""!==t.value?Math.round(parseFloat(String(t.value))).toString():String(t.value),onCalciteInputNumberInput:({currentTarget:e})=>this._saveInput(e)})}_renderReadOnlyComponent(e,t){const i=this.getCommonInputProps(e);return E("calcite-input",{...i,class:this.classes(h.fieldInput,h.inputDisabled,h.individualElement),readOnly:!0,type:"text",value:String(t??i.value??"")})}_renderDateComponents(e,t){const{type:i}=e.field;switch(i){case"date":return this._renderDateFieldComponents(e,t);case"date-only":return this._renderDateOnlyFieldComponent(e,t);case"time-only":return this._renderTimeOnlyFieldComponent(e,t);case"timestamp-offset":return this._renderTimestampOffsetFieldComponents(e,t);default:return this._renderReadOnlyComponent(e,y(e.field,t.value,{timeZone:e.effectiveTimeZone,...I(e.template.field)}))}}_renderDateOnlyFieldComponent(e,t){const{class:i,key:o,readOnly:n}=t,{rawMax:a,rawMin:s}=e.range;return E("calcite-input-date-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentUpdate,class:i,"data-date-part":"date","data-element-id":t[R],key:`${o}-date-input`,max:l(a)?a:void 0,min:l(s)?s:void 0,onblur:()=>{this._focusedFieldInput=null},onfocus:this._onComponentFocus,overlayPositioning:"fixed",readOnly:n,value:e.value===C?"":e.value?String(e.value):"",onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.currentTarget)})}_renderTimeOnlyFieldComponent(e,t){const{class:i,key:o,readOnly:n}=t;return E("calcite-input-time-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentUpdate,class:i,"data-date-part":"time","data-element-id":t[R],key:`${o}-time-input`,onblur:()=>{this._focusedFieldInput=null},onfocus:this._onComponentFocus,overlayPositioning:"fixed",readOnly:n,value:e.value===C?"":e.value?String(e.value):"",onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.currentTarget)})}_renderTimestampOffsetFieldComponents(e,t){const{class:i,key:o,readOnly:n}=t,{rawMax:a,rawMin:s}=e.range,r=F(a),l=F(s),d=F(e.value===C?"":e.value),p=e.includeTimeOffset,u={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentUpdate,overlayPositioning:"fixed",readOnly:n,[R]:t[R],onfocus:this._onComponentFocus};return E("div",{class:h.dateInputContainer,key:`${o}-date-time-container`},E("calcite-input-date-picker",{...u,class:i,"data-date-part":"date",key:`${o}-date-input`,max:r?.date??void 0,min:l?.date??void 0,onblur:()=>{this._focusedFieldInput=null},value:d.date??"",onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),E("calcite-input-time-picker",{...u,class:i,"data-date-part":"time",key:`${o}-time-input`,onblur:()=>{this._focusedFieldInput=null},value:d.time??"",onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),p?E("calcite-input-time-zone",{...u,class:i,"data-date-part":"timeZone",key:`${o}-timezone-input`,onblur:()=>{this._focusedFieldInput=null},value:d.timeZoneOffset??"0",onCalciteInputTimeZoneChange:t=>this._saveValueFromDateComponent(e,t.target)}):null)}_renderDateFieldComponents(e,t){const{class:i,key:o,readOnly:n,min:a,max:s}=t,r=e.effectiveTimeZone,l=w(e.value===C?"":e.value,r),d=w(s,r),p=w(a,r),u=e.includeTime,c={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentUpdate,overlayPositioning:"fixed",readOnly:n,[R]:t[R],onfocus:this._onComponentFocus};return E("div",{class:h.dateInputContainer,key:`${o}-date-time-container`},E("calcite-input-date-picker",{...c,class:i,"data-date-part":"date",key:`${o}-date-input`,max:d?.date??void 0,min:p?.date??void 0,onblur:()=>{this._focusedFieldInput=null},value:l.date??"",onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),u?E("calcite-input-time-picker",{...c,"data-date-part":"time",key:`${o}-time-input`,onblur:()=>{this._focusedFieldInput=null},step:1,value:l.time??"",onCalciteInputTimePickerChange:t=>{this._saveValueFromDateComponent(e,t.target)}}):null)}getCommonInputProps(e){const{_effectiveDisabled:t}=this,{template:i,valid:o,value:n,minLength:a,maxLength:s,required:r,fieldName:l,editable:d,userHasChangedValue:p,range:{max:u,min:c}}=e,m=!d||t||this.readOnly;let v=i.hint??void 0,f=!1;return n===C&&(v=this.messages.differentValues,f=!0),{afterCreate:this._afterComponentCreateOrUpdate,afterUpdate:this._afterComponentCreateOrUpdate,"aria-invalid":o?"false":"true",class:this.classes(h.fieldInput,m?h.inputDisabled:null),status:!p&&!this.viewModel.submitHasBeenAttempted||o?"idle":"invalid",maxLength:s&&s>-1?s:void 0,minLength:a&&a>-1?a:void 0,key:i.elementId,label:l,name:l,max:null!=u?u:void 0,min:null!=c?c:void 0,readOnly:m,onblur:this._onComponentBlur,required:r,placeholder:v,value:f?"":n??"",[R]:i.elementId,onfocus:this._onComponentFocus}}_onFormSubmit(e){e.preventDefault()}_getFieldInputFromHTMLElement(e){return this.viewModel.findFieldInput(e.getAttribute(R))}_afterRadioGroupCreateOrUpdate(e){const t=e.selectedItem,i=e.querySelector("calcite-radio-button"),o=t||i;o&&this._afterComponentCreateOrUpdate(o)}_onComponentFocus(e){const t=e.target,i=this._getFieldInputFromHTMLElement(t);this._touchedInputs.add(i.template.elementId),this._focusedFieldInput=i}_afterComponentCreateOrUpdate(e){const t=this._getFieldInputFromHTMLElement(e),i=this._focusedFieldInput;this._attemptFocusOnNextRender&&i===t&&(this._attemptFocusOnNextRender=!1,k(e))}_onComponentBlur(){this._focusedFieldInput=null}_parseValue(e,t){if(c(t.template,"switch")){if("calcite-dropdown"===e.localName&&t.domain)for(const i of t.domain.codedValues)if(i.name===e.selectedItems[0].textContent)return i.code;return e.checked?t.template.input.onValue:t.template.input.offValue}const i=e.value;return null==i||""===i?null:"number"===t.dataType?"-0"===i||"-0."===i||"-0,"===i?i:parseFloat(i):"date"===t.field.type?parseFloat(i):i}_saveInput(e){const t=this._getFieldInputFromHTMLElement(e),{elementId:o}=t.template;if(!t)return;const n=t?.value;if(c(t.template,"switch")&&"single"!==this.viewModel.mode){const e=i(this._batchSwitchInputInitialValues,t,(()=>t.value));this._batchSwitchInputInitialValues.set(t,null===e?n:e)}const a=this._parseValue(e,t);a!==n&&this.viewModel.setValue(o,a)}async _afterDateComponentCreate(e){const t=this._getFieldInputFromHTMLElement(e);await e.componentOnReady(),this._setDateTimeTimeZoneMap(e),this._updateDateTimeOrTimeZoneShadowDom(e,t.value===C),this._afterComponentCreateOrUpdate(e)}async _afterDateComponentUpdate(e){const{value:t}=this._getFieldInputFromHTMLElement(e);await e.componentOnReady(),this._updateDateTimeOrTimeZoneShadowDom(e,t===C),this._afterComponentCreateOrUpdate(e)}_saveValueFromDateComponent(e,t){const{elementId:i}=e.template,o=e.field.type,n=this._dateComponentMap.get(`${i}`);if(!n)return;const a=e.effectiveTimeZone;let s=e.value===C?void 0:e.value,r=null;"date-only"===o?r=Array.isArray(t.value)?t.value[0]:t.value:"time-only"===o?(s=x(s),r=x(t.value)):r="timestamp-offset"===o?null!=t.value?M({dateComponent:n.date,timeComponent:n.time,oldValue:s,timeZoneComponent:n.timeZone,defaultTimeZone:a}):null:null!=t.value?O({oldValue:s,dateComponent:n.date,timeZone:a,timeComponent:n.time?.value===C?void 0:n.time}):null,s!==r&&(null!==r&&t.value?this.viewModel.setValue(`${i}`,r):this.viewModel.setValue(`${i}`,null))}};e([a()],L.prototype,"activeFeatureIndex",null),e([a()],L.prototype,"disabled",null),e([a()],L.prototype,"_effectiveDisabled",null),e([a()],L.prototype,"features",null),e([a()],L.prototype,"map",null),e([a()],L.prototype,"spatialReference",null),e([a()],L.prototype,"timeZone",null),e([a()],L.prototype,"headingLevel",void 0),e([a()],L.prototype,"icon",null),e([a(),D("esri/t9n/common")],L.prototype,"messagesCommon",void 0),e([a(),D("esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm")],L.prototype,"messages",void 0),e([a(),D("esri/widgets/FeatureForm/t9n/FeatureForm")],L.prototype,"featureFormMessages",void 0),e([a()],L.prototype,"readOnly",null),e([a(),V(["value-change","submit"])],L.prototype,"viewModel",void 0),e([a({type:v,nonNullable:!0})],L.prototype,"visibleElements",void 0),e([a()],L.prototype,"groupDisplay",void 0),L=e([s("esri.widgets.BatchAttributeForm")],L);const j=L;export{j as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import"../core/has.js";import{getOrCreateMapValue as t}from"../core/MapUtils.js";import{watch as i,on as o}from"../core/reactiveUtils.js";import{property as n}from"../core/accessorSupport/decorators/property.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as a}from"../core/accessorSupport/decorators/subclass.js";import{isIntegerField as s}from"../layers/support/fieldUtils.js";import{isString as r}from"../support/guards.js";import l from"./Widget.js";import{getHiddenFieldsValidationErrorMessage as d,getVisibleFieldInputValidationErrorMessage as p,isElementTemplateWithInputType as u}from"./BatchAttributeForm/batchAttributeFormUtils.js";import c from"./BatchAttributeForm/BatchAttributeFormViewModel.js";import{css as m}from"./BatchAttributeForm/css.js";import{VisibleElements as h}from"./BatchAttributeForm/VisibleElements.js";import{InputVisibilityCode as v,isGroupInput as f,isFieldInput as b,differentValuesString as _}from"./BatchAttributeForm/inputs/support/inputUtils.js";import{loadCalciteComponents as C}from"./support/componentsUtils.js";import{getLabelForDateFieldValue as g,getIntlOptionsForField as y,prepareISOFieldValueForDateComponents as I,prepareUnixFieldValueForDateComponents as F,normalizeTimeOnlyString as w,getISOFieldValueFromDateComponents as M,getUnixFieldValueFromDateComponents as x}from"./support/dateUtils.js";import{globalCss as O}from"./support/globalCss.js";import{setFocus as T}from"./support/widgetUtils.js";import{messageBundle as k}from"./support/decorators/messageBundle.js";import{vmEvent as D}from"./support/decorators/vmEvent.js";import{tsx as V}from"./support/jsxFactory.js";import{isEmptyValue as E}from"./support/forms/formUtils.js";import{substitute as S}from"../intl/substitute.js";const U="data-element-id";let R=class extends l{constructor(e,t){super(e,t),this.headingLevel=2,this.messagesCommon=null,this.messages=null,this.featureFormMessages=null,this.viewModel=new c,this.visibleElements=new h,this.groupDisplay="all",this._attemptFocusOnNextRender=!1,this._dateComponentMap=new Map,this._touchedInputs=new Set,this._focusedFieldInput=null,this._batchSwitchInputInitialValues=new Map,this._saveInput=this._saveInput.bind(this),this._onFormSubmit=this._onFormSubmit.bind(this),this._onComponentFocus=this._onComponentFocus.bind(this),this._onComponentBlur=this._onComponentBlur.bind(this),this._afterComponentCreateOrUpdate=this._afterComponentCreateOrUpdate.bind(this),this._afterDateComponentCreate=this._afterDateComponentCreate.bind(this),this._afterDateComponentUpdate=this._afterDateComponentUpdate.bind(this),this._afterRadioGroupCreateOrUpdate=this._afterRadioGroupCreateOrUpdate.bind(this)}initialize(){this.addHandles([i((()=>this.features),(()=>{this._dateComponentMap.clear()})),i((()=>this.viewModel.activeForm),(()=>{this._batchSwitchInputInitialValues.clear()})),o((()=>this.viewModel),"submit",(()=>{this.valid||this.goToClosestError()}))])}loadDependencies(){return C({input:()=>import("@esri/calcite-components/dist/components/calcite-input"),block:()=>import("@esri/calcite-components/dist/components/calcite-block"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item"),"combobox-item-group":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item-group"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown"),"dropdown-group":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-group"),"dropdown-item":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-item"),"input-date-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-date-picker"),"input-number":()=>import("@esri/calcite-components/dist/components/calcite-input-number"),"input-time-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-time-picker"),"input-time-zone":()=>import("@esri/calcite-components/dist/components/calcite-input-time-zone"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),"input-message":()=>import("@esri/calcite-components/dist/components/calcite-input-message"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch"),"text-area":()=>import("@esri/calcite-components/dist/components/calcite-text-area"),"radio-button":()=>import("@esri/calcite-components/dist/components/calcite-radio-button"),"radio-button-group":()=>import("@esri/calcite-components/dist/components/calcite-radio-button-group")})}get activeFeatureIndex(){return this.viewModel.activeFeatureIndex}set activeFeatureIndex(e){this.viewModel.activeFeatureIndex=e}get disabled(){return this.viewModel.disabled}set disabled(e){this.viewModel.disabled=e}get _effectiveDisabled(){return this.disabled||this.viewModel.updating}get features(){return this.viewModel.features}set features(e){this.viewModel.features=e}get map(){return this.viewModel.map}set map(e){this.viewModel.map=e}get spatialReference(){return this.viewModel.spatialReference}set spatialReference(e){this.viewModel.spatialReference=e}get timeZone(){return this.viewModel.timeZone}set timeZone(e){this.viewModel.timeZone=e}get icon(){return"edit-attributes"}set icon(e){this._overrideIfSome("icon",e)}get readOnly(){return this.viewModel.readOnly}set readOnly(e){this.viewModel.readOnly=e}get valid(){return this.viewModel.valid}goToClosestError(){const e=this.viewModel.getFirstVisibleInvalidFieldInput();if(!e)return;const{groupInput:t}=e;t&&(t.open||(t.open=!0)),this._focusedFieldInput=e.input,this._attemptFocusOnNextRender=!0,this.scheduleRender()}render(){const{status:e}=this.viewModel;return"failed"===e?this.viewModel.hasTooManyComplexFeatures?this._renderErrorNotice(S(this.messages.formFailedToLoadTooManyComplexFeatures,{num:this.viewModel.maximumFeatureCountWithComplexForms})):this.viewModel.hasTooManyFeatures?this._renderErrorNotice(S(this.messages.formFailedToLoadTooManyFeatures,{num:this.viewModel.maximumFeatureCount})):this._renderErrorNotice(this.messages.formFailedToLoad):this.viewModel.expressionEvaluationFailed?this._renderErrorNotice(this.messages.expressionEvaluationFailed):this.viewModel.hasLayersWithContingentValues?this._renderErrorNotice(this.messages.unsupportedContingentValues):V("div",{class:this.classes(m.base,O.widget,O.panel)},"loaded"===e?this._renderForm():"loading"===e&&this.visibleElements.loadingIndicator?V("calcite-loader",{key:"loader",label:this.messagesCommon?.loading}):null)}submit(){this.viewModel.submit()}_setDateTimeTimeZoneMap(e){const{datePart:i,elementId:o}=e.dataset,n=this._getCalciteElementFromDateTimeTimeZonePicker(e,i);if(!n)return;const a=t(this._dateComponentMap,`${o}`,(()=>({placeholder:{date:"",time:"",timeZone:""}})));switch(a.placeholder[i]=n.placeholder??"",i){case"date":a.date=e;break;case"time":a.time=e;break;case"timeZone":a.timeZone=e,a.defaultComboboxItemElements=n.selectedItems}"timeZone"===i&&(a.defaultComboboxItemElements=n.selectedItems)}_getCalciteElementFromDateTimeTimeZonePicker(e,t){const i=e.shadowRoot;return i?"timeZone"===t?i.querySelector("calcite-combobox"):i.querySelector("calcite-input-text"):null}_updateDateTimeOrTimeZoneShadowDom(e,t){const{datePart:i,elementId:o}=e.dataset,n=this._dateComponentMap.get(`${o}`);if(!n)return;const a=this._getCalciteElementFromDateTimeTimeZonePicker(e,i);if(a)switch(i){case"date":case"time":a.placeholder=t?this.messages.differentValues:n.placeholder[i];break;case"timeZone":t?(a.value="",a.placeholder=this.messages.differentValues):(!a.selectedItems.length&&n.defaultComboboxItemElements?.length&&(a.selectedItems[0]=n.defaultComboboxItemElements[0]),a.placeholder=n.placeholder[i])}}_renderErrorNotice(e){return V("div",{class:this.classes(m.base,O.widget,O.panel)},V("calcite-notice",{class:m.noticeError,icon:!0,kind:"warning",open:!0},V("div",{slot:"message"},e)))}_renderForm(){return V("form",{onsubmit:this._onFormSubmit},this._renderInvisibleFieldsError(),this._renderContent())}_renderInvisibleFieldsError(){const{viewModel:e}=this,{hasNonActiveInvalidFeatures:t,activeForm:i}=e;let o;if(!e.submitHasBeenAttempted)return null;if(i.invalidHiddenInputs.length>0)if(o=d(i,e.mode,this.messages),"batch"===this.viewModel.mode){const e=i.invalidHiddenInputs.filter((e=>e.effectiveVisibilityCode===v.HIDDEN_GROUP_VISIBILITY_EXPRESSION_ALL||e.visibilityCode===v.HIDDEN_VISIBILITY_EXPRESSION_ALL));e.length>0?o+=` (${e.map((e=>e.label)).join(", ")})`:o=null}else o+=` (${i.invalidHiddenInputs.map((e=>e.label)).join(", ")})`;else if(t)return null;return o?V("calcite-notice",{class:m.noticeError,icon:!0,kind:"danger",open:!0},V("div",{slot:"message"},o)):null}_renderContent(){if(!this.viewModel.hasVisibleInputs)return[V("calcite-notice",{class:m.noticeError,icon:!0,kind:"warning",open:!0},V("div",{slot:"message"},this.messages.noVisibleFields[this.viewModel.noVisibleElementsReason]))];const{inputs:e}=this.viewModel.activeForm;return e.filter((e=>e.visible)).map((e=>this._renderInput(e)))}_renderInput(e){return f(e)?this._renderGroupInput(e):b(e)?this._renderLabeledField(e):void 0}_renderGroupInput(e){const{inputs:t,template:i,open:o}=e,n=t.filter((e=>e.visible)),a=i.label??"";return V("calcite-block",{class:this.classes(m.group,"sequential"===this.groupDisplay?m.groupSequential:null,this.disabled?m.inputDisabled:null),collapsible:!0,description:i.description??void 0,disabled:this._effectiveDisabled,expanded:o,heading:a,headingLevel:this.headingLevel,key:`{${i.elementId}-key}`,label:a,onCalciteBlockClose:()=>{e.open=!1},onCalciteBlockOpen:()=>{e.open=!0}},n.map((e=>this._renderInput(e))))}_renderLabeledField(e){const{label:t,elementId:i}=e.template,{required:o,dataType:n}=e,a=o?S(this.messages.requiredFieldLabel,{name:t}):t;return V("calcite-label",{"aria-label":a,class:m.label,key:`field--${i}`},V("div",{class:m.labelTextContent,key:"labelTextContainer"},t,o?V("span",{"aria-hidden":"true",title:this.messagesCommon.required},"*"):void 0),"unsupported"!==n?this._renderFieldInput(e):this._renderReadOnlyComponent(e),this._renderAuxiliaryText(e))}_renderFieldInput(e){const t=this.getCommonInputProps(e),{dataType:i}=e;return"date"===i?this._renderDateComponents(e,t):"coded-value"===e.domain?.type?this._renderCodedInputs({input:e,props:t}):"number"===i?this._renderNumberComponent(e,t):this._renderStringComponent(e,t)}_renderAuxiliaryText(e){const{compositeError:t,description:i,submittable:o}=e,n=!o&&t&&(this.viewModel.submitHasBeenAttempted||this._touchedInputs.has(e.template.elementId))?p(e,t,this.messages):null;return n?V("calcite-input-message",{icon:!0,status:"invalid"},n):i?V("calcite-input-message",{class:m.description,icon:!1,status:"idle"},i):null}_renderCodedInputs({input:e,props:t}){const i=e.template.input?.type??null,o=e.codedValueOptions;switch(i){case"switch":return this._renderSwitchField({input:e,props:t});case"radio-buttons":return this._renderRadioButtonGroupComponent({input:e,options:o.flat(),props:t});default:return this._renderComboBoxComponent({options:o,props:t,input:e})}}_renderSwitchField({input:e,props:t}){if((this._batchSwitchInputInitialValues.get(e)===_||e.value===_)&&"batch"===this.viewModel.mode){const i={dropdown:{afterCreate:this._afterComponentCreateOrUpdate,afterUpdate:this._afterComponentCreateOrUpdate,disabled:t.readOnly,open:!1,[U]:t[U]},trigger:{appearance:"transparent",iconEnd:"chevron-down",kind:"neutral",slot:"trigger",label:t.label},group:{mode:"single"}};return this._renderDropdownComponent({buttonValue:e.value,dropdownProps:i,options:[{name:this.messages.differentValues,value:_,disabled:!0},...e.codedValueDomainOptions]})}return this._renderSwitchComponent({input:e,props:t})}_renderSwitchComponent({input:e,props:t}){return V("calcite-switch",{...t,checked:!!u(e.template,"switch")&&e.value===e.template.input.onValue,class:m.inputSwitch,disabled:t.readOnly,onblur:()=>{this._focusedFieldInput=null},onCalciteSwitchChange:({currentTarget:e})=>this._saveInput(e)})}_renderDropdownComponent({buttonValue:e,options:t,dropdownProps:i}){const{trigger:o,dropdown:n,group:a}=i;return V("calcite-dropdown",{...n,onblur:()=>{this._focusedFieldInput=null},onfocus:this._onComponentFocus,onCalciteDropdownSelect:({currentTarget:e})=>this._saveInput(e)},V("calcite-button",{...o},e===_?this.messages.differentValues:e),V("calcite-dropdown-group",{selectionMode:a.mode},t.map((t=>V("calcite-dropdown-item",{disabled:t.disabled,label:String(t.name),selected:e===t.value},t.name)))))}_renderComboBoxComponent({input:e,options:t,props:i}){const o="INSERT"===this.viewModel.editType,n=this._touchedInputs.has(e?.template?.elementId),a=o&&e.showNoValueOptionEnabled&&!n?()=>{}:i.onblur,s={...i,onblur:a};return V("calcite-combobox",{...s,selectionMode:"single",value:i.placeholder===this.messages.differentValues?_:String(i.value),onCalciteComboboxChange:({currentTarget:e})=>{e.value!==_&&this._saveInput(e)}},this.renderComboboxOptionsList({input:e,options:t,props:i}))}renderComboboxOptionsList({input:e,options:t,props:i}){const[o,n]=t.map((e=>e.map((({name:e,value:t})=>V("calcite-combobox-item",{key:`#${t}`,selected:i.value===t,textLabel:e,value:`${t}`}))))),a=[...o];n.length>0&&a.push(V("calcite-combobox-item-group",{key:"unsupported",label:this.featureFormMessages.subtypes.unsupportedDomainGroupTitle},n));const s=i.placeholder===this.messages.differentValues,r=!s&&E(i.value);return e.showNoValueOptionEnabled&&a.unshift(V("calcite-combobox-item",{key:"empty-option",selected:r,textLabel:e.showNoValueLabel||this.messages.empty,value:""})),s&&a.unshift(V("calcite-combobox-item",{key:_,selected:!0,textLabel:this.messages.differentValues,value:_})),a}_renderRadioButtonGroupComponent({input:e,options:t,props:i}){const o=t.map((({name:t,value:o})=>this._renderRadioButtons({label:t,value:o,selected:o===e.value,props:i})));if(e.showNoValueOptionEnabled){const t="",n=e.showNoValueLabel||this.messages.empty,a=E(e.value);o.unshift(this._renderRadioButtons({label:n,value:t,selected:a,props:i}))}return V("calcite-radio-button-group",{afterCreate:this._afterRadioGroupCreateOrUpdate,afterUpdate:this._afterRadioGroupCreateOrUpdate,class:m.inputRadioGroup,disabled:i.readOnly,key:`${i.key}-radio-group`,layout:"vertical",name:i.name,required:i.required},o,i.placeholder===this.messages.differentValues?V("calcite-label",{class:m.placeholderRadio,key:i.label,layout:"inline"},V("calcite-radio-button",{checked:!0,class:m.inputRadio,disabled:!0,name:i.placeholder,value:i.placeholder}),i.placeholder):null)}_renderRadioButtons({value:e,selected:t,label:i,props:o}){return V("calcite-label",{class:m.inputRadioLabel,key:o.label,layout:"inline"},V("calcite-radio-button",{...o,afterCreate:void 0,afterUpdate:void 0,checked:t,class:m.inputRadio,disabled:o.readOnly,name:o.label,onblur:()=>{this._focusedFieldInput=null},value:e,onCalciteRadioButtonChange:({currentTarget:e})=>{e.checked&&this._saveInput(e)}}),i)}_renderStringComponent(e,t){const{template:i}=e;return!i.field.editable||this.readOnly?this._renderReadOnlyComponent(e):i.input&&"text-area"===i.input.type?V("calcite-text-area",{...t,class:this.classes(m.individualElement),resize:"vertical",value:t.value?String(t.value):"",onCalciteTextAreaInput:({currentTarget:e})=>this._saveInput(e)}):V("calcite-input",{...t,class:this.classes(m.individualElement),type:"text",value:t.value?String(t.value):"",onCalciteInputInput:({currentTarget:e})=>this._saveInput(e)})}_renderNumberComponent(e,t){const i=s(e.field);return V("calcite-input-number",{...t,integer:i,type:"number",value:i&&""!==t.value?Math.round(parseFloat(String(t.value))).toString():String(t.value),onCalciteInputNumberInput:({currentTarget:e})=>this._saveInput(e)})}_renderReadOnlyComponent(e,t){const i=this.getCommonInputProps(e);return V("calcite-input",{...i,class:this.classes(m.fieldInput,m.inputDisabled,m.individualElement),readOnly:!0,type:"text",value:String(t??i.value??"")})}_renderDateComponents(e,t){const{type:i}=e.field;switch(i){case"date":return this._renderDateFieldComponents(e,t);case"date-only":return this._renderDateOnlyFieldComponent(e,t);case"time-only":return this._renderTimeOnlyFieldComponent(e,t);case"timestamp-offset":return this._renderTimestampOffsetFieldComponents(e,t);default:return this._renderReadOnlyComponent(e,g(e.field,t.value,{timeZone:e.effectiveTimeZone,...y(e.template.field)}))}}_renderDateOnlyFieldComponent(e,t){const{class:i,key:o,readOnly:n}=t,{rawMax:a,rawMin:s}=e.range;return V("calcite-input-date-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentUpdate,class:i,"data-date-part":"date","data-element-id":t[U],key:`${o}-date-input`,max:r(a)?a:void 0,min:r(s)?s:void 0,onblur:()=>{this._focusedFieldInput=null},onfocus:this._onComponentFocus,overlayPositioning:"fixed",readOnly:n,value:e.value===_?"":e.value?String(e.value):"",onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.currentTarget)})}_renderTimeOnlyFieldComponent(e,t){const{class:i,key:o,readOnly:n}=t;return V("calcite-input-time-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentUpdate,class:i,"data-date-part":"time","data-element-id":t[U],key:`${o}-time-input`,onblur:()=>{this._focusedFieldInput=null},onfocus:this._onComponentFocus,overlayPositioning:"fixed",readOnly:n,value:e.value===_?"":e.value?String(e.value):"",onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.currentTarget)})}_renderTimestampOffsetFieldComponents(e,t){const{class:i,key:o,readOnly:n}=t,{rawMax:a,rawMin:s}=e.range,r=I(a),l=I(s),d=I(e.value===_?"":e.value),p=e.includeTimeOffset,u={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentUpdate,overlayPositioning:"fixed",readOnly:n,[U]:t[U],onfocus:this._onComponentFocus};return V("div",{class:m.dateInputContainer,key:`${o}-date-time-container`},V("calcite-input-date-picker",{...u,class:i,"data-date-part":"date",key:`${o}-date-input`,max:r?.date??void 0,min:l?.date??void 0,onblur:()=>{this._focusedFieldInput=null},value:d.date??"",onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),V("calcite-input-time-picker",{...u,class:i,"data-date-part":"time",key:`${o}-time-input`,onblur:()=>{this._focusedFieldInput=null},value:d.time??"",onCalciteInputTimePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),p?V("calcite-input-time-zone",{...u,class:i,"data-date-part":"timeZone",key:`${o}-timezone-input`,onblur:()=>{this._focusedFieldInput=null},value:d.timeZoneOffset??"0",onCalciteInputTimeZoneChange:t=>this._saveValueFromDateComponent(e,t.target)}):null)}_renderDateFieldComponents(e,t){const{class:i,key:o,readOnly:n,min:a,max:s}=t,r=e.effectiveTimeZone,l=F(e.value===_?"":e.value,r),d=F(s,r),p=F(a,r),u=e.includeTime,c={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentUpdate,overlayPositioning:"fixed",readOnly:n,[U]:t[U],onfocus:this._onComponentFocus};return V("div",{class:m.dateInputContainer,key:`${o}-date-time-container`},V("calcite-input-date-picker",{...c,class:i,"data-date-part":"date",key:`${o}-date-input`,max:d?.date??void 0,min:p?.date??void 0,onblur:()=>{this._focusedFieldInput=null},value:l.date??"",onCalciteInputDatePickerChange:t=>this._saveValueFromDateComponent(e,t.target)}),u?V("calcite-input-time-picker",{...c,"data-date-part":"time",key:`${o}-time-input`,onblur:()=>{this._focusedFieldInput=null},step:1,value:l.time??"",onCalciteInputTimePickerChange:t=>{this._saveValueFromDateComponent(e,t.target)}}):null)}getCommonInputProps(e){const{_effectiveDisabled:t}=this,{template:i,valid:o,value:n,minLength:a,maxLength:s,required:r,fieldName:l,editable:d,userHasChangedValue:p,range:{max:u,min:c}}=e,h=!d||t||this.readOnly;let v=i.hint??void 0,f=!1;return n===_&&(v=this.messages.differentValues,f=!0),{afterCreate:this._afterComponentCreateOrUpdate,afterUpdate:this._afterComponentCreateOrUpdate,"aria-invalid":o?"false":"true",class:this.classes(m.fieldInput,h?m.inputDisabled:null),status:!p&&!this.viewModel.submitHasBeenAttempted||o?"idle":"invalid",maxLength:s&&s>-1?s:void 0,minLength:a&&a>-1?a:void 0,key:i.elementId,label:l,name:l,max:null!=u?u:void 0,min:null!=c?c:void 0,readOnly:h,onblur:this._onComponentBlur,required:r,placeholder:v,value:f?"":n??"",[U]:i.elementId,onfocus:this._onComponentFocus}}_onFormSubmit(e){e.preventDefault()}_getFieldInputFromHTMLElement(e){return this.viewModel.findFieldInput(e.getAttribute(U))}_afterRadioGroupCreateOrUpdate(e){const t=e.selectedItem,i=e.querySelector("calcite-radio-button"),o=t||i;o&&this._afterComponentCreateOrUpdate(o)}_onComponentFocus(e){const t=e.target,i=this._getFieldInputFromHTMLElement(t);this._touchedInputs.add(i.template.elementId),this._focusedFieldInput=i}_afterComponentCreateOrUpdate(e){const t=this._getFieldInputFromHTMLElement(e),i=this._focusedFieldInput;this._attemptFocusOnNextRender&&i===t&&(this._attemptFocusOnNextRender=!1,T(e))}_onComponentBlur(){this._focusedFieldInput=null}_parseValue(e,t){if(u(t.template,"switch")){if("calcite-dropdown"===e.localName&&t.domain)for(const i of t.domain.codedValues)if(i.name===e.selectedItems[0].textContent)return i.code;return e.checked?t.template.input.onValue:t.template.input.offValue}const i=e.value;return null==i||""===i?null:"number"===t.dataType?"-0"===i||"-0."===i||"-0,"===i?i:parseFloat(i):"date"===t.field.type?parseFloat(i):i}_saveInput(e){const i=this._getFieldInputFromHTMLElement(e),{elementId:o}=i.template;if(!i)return;const n=i?.value;if(u(i.template,"switch")&&"single"!==this.viewModel.mode){const e=t(this._batchSwitchInputInitialValues,i,(()=>i.value));this._batchSwitchInputInitialValues.set(i,null===e?n:e)}const a=this._parseValue(e,i);a!==n&&this.viewModel.setValue(o,a)}async _afterDateComponentCreate(e){const t=this._getFieldInputFromHTMLElement(e);await e.componentOnReady(),this._setDateTimeTimeZoneMap(e),this._updateDateTimeOrTimeZoneShadowDom(e,t.value===_),this._afterComponentCreateOrUpdate(e)}async _afterDateComponentUpdate(e){const{value:t}=this._getFieldInputFromHTMLElement(e);await e.componentOnReady(),this._updateDateTimeOrTimeZoneShadowDom(e,t===_),this._afterComponentCreateOrUpdate(e)}_saveValueFromDateComponent(e,t){const{elementId:i}=e.template,o=e.field.type,n=this._dateComponentMap.get(`${i}`);if(!n)return;const a=e.effectiveTimeZone;let s=e.value===_?void 0:e.value,r=null;"date-only"===o?r=Array.isArray(t.value)?t.value[0]:t.value:"time-only"===o?(s=w(s),r=w(t.value)):r="timestamp-offset"===o?null!=t.value?M({dateComponent:n.date,timeComponent:n.time,oldValue:s,timeZoneComponent:n.timeZone,defaultTimeZone:a}):null:null!=t.value?x({oldValue:s,dateComponent:n.date,timeZone:a,timeComponent:n.time?.value===_?void 0:n.time}):null,s!==r&&(null!==r&&t.value?this.viewModel.setValue(`${i}`,r):this.viewModel.setValue(`${i}`,null))}};e([n()],R.prototype,"activeFeatureIndex",null),e([n()],R.prototype,"disabled",null),e([n()],R.prototype,"_effectiveDisabled",null),e([n()],R.prototype,"features",null),e([n()],R.prototype,"map",null),e([n()],R.prototype,"spatialReference",null),e([n()],R.prototype,"timeZone",null),e([n()],R.prototype,"headingLevel",void 0),e([n()],R.prototype,"icon",null),e([n(),k("esri/t9n/common")],R.prototype,"messagesCommon",void 0),e([n(),k("esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm")],R.prototype,"messages",void 0),e([n(),k("esri/widgets/FeatureForm/t9n/FeatureForm")],R.prototype,"featureFormMessages",void 0),e([n()],R.prototype,"readOnly",null),e([n()],R.prototype,"valid",null),e([n(),D(["value-change","submit"])],R.prototype,"viewModel",void 0),e([n({type:h,nonNullable:!0})],R.prototype,"visibleElements",void 0),e([n()],R.prototype,"groupDisplay",void 0),R=e([a("esri.widgets.BatchAttributeForm")],R);const L=R;export{L 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.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../chunks/tslib.es6.js";import{unique as e,isSome as r}from"../../core/arrayUtils.js";import o from"../../core/Collection.js";import i from"../../core/Error.js";import s from"../../core/Logger.js";import{destroyMaybe as a}from"../../core/maybe.js";import{whenOnce as n}from"../../core/reactiveUtils.js";import{property as l}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as d}from"../../core/accessorSupport/decorators/subclass.js";import{isTable as u}from"../../layers/support/layerUtils.js";import{hasEffectiveFeatureExpressionInfo as p}from"../../support/elevationInfoUtils.js";import c from"../BatchAttributeForm/BatchAttributeFormViewModel.js";import f from"./UpdateFeaturesWorkflowData.js";import h from"./Workflow.js";import{whenEditorLayerView as m}from"./workflowUtils.js";import{SketchController as y}from"./support/SketchController.js";var w;const g=()=>s.getLogger("esri.widgets.Editor.UpdateFeaturesWorkflow");let F=w=class extends h{constructor(t){super(t),this.type="update-features",this._formViewModel=null,this._sketchController=null}async initialize(){this._initializeFormViewModel();try{await this._updatingHandles.addPromise((async()=>{const{fullFeatures:t}=await this.data.when();this._formViewModel.features=new o(t),await this._initializeVisuals(t)})())}catch(t){this.cancel({force:!0,error:new i("update-features-workflow:initialize","Failed to initialize the workflow data.",t)})}}destroy(){this._sketchController=a(this._sketchController),this._formViewModel.destroy()}get features(){return this.data.features}get formViewModel(){return this._formViewModel}get hasPendingEdits(){const{data:t}=this;return t.features.some((e=>!!t.getPendingEditsForFeature(e)?.modified))}get parent(){return this.data.parent}get parentLayer(){return this.parent?.data.editorItem.layer}get selectedFeature(){return this.data.selectedFeature}get updating(){return this._updatingHandles.updating||this._formViewModel.updating||!!this._sketchController?.updating}static create(t){const{applyEdits:o,applyEditsFeatureService:i,...s}=t,a=e(t.features.map((t=>t.sourceLayer??t.layer))).map((e=>t.viewModel.editorItems.find((t=>t.layer===e)))).filter(r),n=new w({data:new f({...s,editorItems:a}),onCommit:k(t.applyEdits)});return n._set("steps",v()),n}async deleteAndCommit(){return this.data.stageDelete(),this.commit()}enter(){throw new Error("Method not implemented.")}exit(t){throw new Error("Method not implemented.")}async reset(){}async start(){await super.start(),await n((()=>!this.updating))}_initializeFormViewModel(){const{data:t}=this,e=t.viewModel.view,r=new c({editType:"UPDATE",map:e?.map,spatialReference:e?.spatialReference,timeZone:t.timeZone});this._formViewModel=r,this.addHandles(r.on("value-change",(e=>{for(const r of e.features)t.getPendingEditsForFeature(r)?.setAttribute(e.fieldName,e.value);this._sketchController?.notifyAttributesChanged(e)})))}async _initializeHighlights(t,e,r){const o=await m(r,e);this.addHandles(o.highlight(t))}async _initializeSketchController(t,e,r){const o=new y({sourceLayer:e,view:r,features:t});this._sketchController=o,await n((()=>!o.updating));const{data:i}=this;await o.startUpdatingFeatures(t,(t=>{const e=[];for(const{feature:r,geometry:o}of t)i.getPendingEditsForFeature(r)?.updateGeometry(o),e.push(r);this._formViewModel.notifyGeometriesChanged(e)}),(()=>{g().warnOnce("editor:batch-update-visual-variables","UpdateFeaturesWorkflow does not currently support modifying visual variables through the scale and rotate tools.")}))}async _initializeVisuals(t){const{data:e}=this,{view:r}=e.viewModel;if(!r)return;const o=M(e);if(u(o))return;const i=e.getEditorItemForLayer(o);return!i?.capabilities.update.geometry||"3d"===r?.type&&p(o.elevationInfo)?this._initializeHighlights(t,o,r):this._initializeSketchController(t,o,r)}};t([l()],F.prototype,"features",null),t([l()],F.prototype,"formViewModel",null),t([l()],F.prototype,"hasPendingEdits",null),t([l()],F.prototype,"parent",null),t([l()],F.prototype,"parentLayer",null),t([l()],F.prototype,"selectedFeature",null),t([l()],F.prototype,"type",void 0),t([l()],F.prototype,"updating",null),t([l()],F.prototype,"_formViewModel",void 0),t([l()],F.prototype,"_sketchController",void 0),F=w=t([d("esri.widgets.Editor.UpdateFeaturesWorkflow")],F);const _=F;function v(){return[{id:"editing-features",async setUp(){},async tearDown(){}}]}function k(t){return async e=>{const r=M(e),o=[],i=[];for(const t of e.fullFeatures){const r=e.getPendingEditsForFeature(t),s=r?.stagedForDelete;if(!r?.modified&&!s)continue;const a=t.clone();if(!r?.attributesModified||s){const e=t.sourceLayer;if(!e){g().warn("Feature has no sourceLayer. It will not be included in any applyEdits payload.");continue}const r=e.objectIdField;if(a.attributes={[r]:t.getAttribute(r)},"scene"===e.type&&null!=e.infoFor3D){const r=e.associatedLayer?.globalIdField;null!=r&&a.setAttribute(r,t.getAttribute(r))}}r?.geometryModified&&!s||(a.geometry=null),s?i.push(a):o.push(a)}if(o.length+i.length===0)return void g().warn("No edits to apply. Workflow will finish without sending an applyEdits request.");const s={updateFeatures:o.length>0?o:void 0,deleteFeatures:i.length>0?i:void 0};await t(r,s)}}function M(t){if(t.layers.length>1)throw new i("update-features-workflow:multiple-layers-not-supported","The UpdateFeaturesWorkflow does not support updating features from multiple layers.");return t.layers[0]}export{_ as default};
5
+ import{_ as t}from"../../chunks/tslib.es6.js";import{unique as e,isSome as r}from"../../core/arrayUtils.js";import o from"../../core/Collection.js";import i from"../../core/Error.js";import s from"../../core/Logger.js";import{destroyMaybe as a}from"../../core/maybe.js";import{whenOnce as n}from"../../core/reactiveUtils.js";import{property as l}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as d}from"../../core/accessorSupport/decorators/subclass.js";import{isTable as u}from"../../layers/support/layerUtils.js";import{hasEffectiveFeatureExpressionInfo as p}from"../../support/elevationInfoUtils.js";import c from"../BatchAttributeForm/BatchAttributeFormViewModel.js";import f from"./UpdateFeaturesWorkflowData.js";import h from"./Workflow.js";import{whenEditorLayerView as m}from"./workflowUtils.js";import{SketchController as w}from"./support/SketchController.js";var y;const g=()=>s.getLogger("esri.widgets.Editor.UpdateFeaturesWorkflow");let F=y=class extends h{constructor(t){super(t),this.type="update-features",this._formViewModel=null,this._sketchController=null}async initialize(){this._initializeFormViewModel();try{await this._updatingHandles.addPromise((async()=>{const{fullFeatures:t}=await this.data.when();this._formViewModel.features=new o(t),await this._initializeVisuals(t)})())}catch(t){this.cancel({force:!0,error:new i("update-features-workflow:initialize","Failed to initialize the workflow data.",t)})}}destroy(){this._sketchController=a(this._sketchController),this._formViewModel.destroy()}get features(){return this.data.features}get formViewModel(){return this._formViewModel}get hasPendingEdits(){const{data:t}=this;return t.features.some((e=>!!t.getPendingEditsForFeature(e)?.modified))}get parent(){return this.data.parent}get parentLayer(){return this.parent?.data.editorItem.layer}get selectedFeature(){return this.data.selectedFeature}get updating(){return this._updatingHandles.updating||this._formViewModel.updating||!!this._sketchController?.updating}static create(t){const{applyEdits:o,applyEditsFeatureService:i,...s}=t,a=e(t.features.map((t=>t.sourceLayer??t.layer))).map((e=>t.viewModel.editorItems.find((t=>t.layer===e)))).filter(r),n=new y({data:new f({...s,editorItems:a}),onCommit:k(t.applyEdits)});return n._set("steps",v()),n}async deleteAndCommit(){return this.data.stageDelete(),this.commit()}enter(){throw new Error("Method not implemented.")}exit(t){throw new Error("Method not implemented.")}async reset(){}async save(){const{formViewModel:t}=this;t.submit(),t.valid&&await super.save()}async start(){await super.start(),await n((()=>!this.updating))}_initializeFormViewModel(){const{data:t}=this,e=t.viewModel.view,r=new c({editType:"UPDATE",map:e?.map,spatialReference:e?.spatialReference,timeZone:t.timeZone});this._formViewModel=r,this.addHandles(r.on("value-change",(e=>{for(const r of e.features)t.getPendingEditsForFeature(r)?.setAttribute(e.fieldName,e.value);this._sketchController?.notifyAttributesChanged(e)})))}async _initializeHighlights(t,e,r){const o=await m(r,e);this.addHandles(o.highlight(t))}async _initializeSketchController(t,e,r){const o=new w({sourceLayer:e,view:r,features:t});this._sketchController=o,await n((()=>!o.updating));const{data:i}=this;await o.startUpdatingFeatures(t,(t=>{const e=[];for(const{feature:r,geometry:o}of t)i.getPendingEditsForFeature(r)?.updateGeometry(o),e.push(r);this._formViewModel.notifyGeometriesChanged(e)}),(()=>{g().warnOnce("editor:batch-update-visual-variables","UpdateFeaturesWorkflow does not currently support modifying visual variables through the scale and rotate tools.")}))}async _initializeVisuals(t){const{data:e}=this,{view:r}=e.viewModel;if(!r)return;const o=M(e);if(u(o))return;const i=e.getEditorItemForLayer(o);return!i?.capabilities.update.geometry||"3d"===r?.type&&p(o.elevationInfo)?this._initializeHighlights(t,o,r):this._initializeSketchController(t,o,r)}};t([l()],F.prototype,"features",null),t([l()],F.prototype,"formViewModel",null),t([l()],F.prototype,"hasPendingEdits",null),t([l()],F.prototype,"parent",null),t([l()],F.prototype,"parentLayer",null),t([l()],F.prototype,"selectedFeature",null),t([l()],F.prototype,"type",void 0),t([l()],F.prototype,"updating",null),t([l()],F.prototype,"_formViewModel",void 0),t([l()],F.prototype,"_sketchController",void 0),F=y=t([d("esri.widgets.Editor.UpdateFeaturesWorkflow")],F);const _=F;function v(){return[{id:"editing-features",async setUp(){},async tearDown(){}}]}function k(t){return async e=>{const r=M(e),o=[],i=[];for(const t of e.fullFeatures){const r=e.getPendingEditsForFeature(t),s=r?.stagedForDelete;if(!r?.modified&&!s)continue;const a=t.clone();if(!r?.attributesModified||s){const e=t.sourceLayer;if(!e){g().warn("Feature has no sourceLayer. It will not be included in any applyEdits payload.");continue}const r=e.objectIdField;if(a.attributes={[r]:t.getAttribute(r)},"scene"===e.type&&null!=e.infoFor3D){const r=e.associatedLayer?.globalIdField;null!=r&&a.setAttribute(r,t.getAttribute(r))}}r?.geometryModified&&!s||(a.geometry=null),s?i.push(a):o.push(a)}if(o.length+i.length===0)return void g().warn("No edits to apply. Workflow will finish without sending an applyEdits request.");const s={updateFeatures:o.length>0?o:void 0,deleteFeatures:i.length>0?i:void 0};await t(r,s)}}function M(t){if(t.layers.length>1)throw new i("update-features-workflow:multiple-layers-not-supported","The UpdateFeaturesWorkflow does not support updating features from multiple layers.");return t.layers[0]}export{_ as default};