@itwin/map-layers 5.4.3 → 5.5.0

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 (306) hide show
  1. package/CHANGELOG.md +19 -2
  2. package/README.md +7 -7
  3. package/lib/cjs/BrowserStorage.d.ts +1 -1
  4. package/lib/cjs/BrowserStorage.d.ts.map +1 -1
  5. package/lib/cjs/BrowserStorage.js +24 -14
  6. package/lib/cjs/BrowserStorage.js.map +1 -1
  7. package/lib/cjs/CustomParamUtils.d.ts +1 -1
  8. package/lib/cjs/CustomParamUtils.d.ts.map +1 -1
  9. package/lib/cjs/CustomParamUtils.js +18 -7
  10. package/lib/cjs/CustomParamUtils.js.map +1 -1
  11. package/lib/cjs/CustomParamsMappingStorage.d.ts +1 -1
  12. package/lib/cjs/CustomParamsMappingStorage.d.ts.map +1 -1
  13. package/lib/cjs/CustomParamsMappingStorage.js +3 -3
  14. package/lib/cjs/CustomParamsMappingStorage.js.map +1 -1
  15. package/lib/cjs/CustomParamsStorage.d.ts +1 -1
  16. package/lib/cjs/CustomParamsStorage.d.ts.map +1 -1
  17. package/lib/cjs/CustomParamsStorage.js +3 -3
  18. package/lib/cjs/CustomParamsStorage.js.map +1 -1
  19. package/lib/cjs/MapLayerPreferences.d.ts +2 -1
  20. package/lib/cjs/MapLayerPreferences.d.ts.map +1 -1
  21. package/lib/cjs/MapLayerPreferences.js +50 -25
  22. package/lib/cjs/MapLayerPreferences.js.map +1 -1
  23. package/lib/cjs/MapLayersActionIds.d.ts +5 -0
  24. package/lib/cjs/MapLayersActionIds.d.ts.map +1 -0
  25. package/lib/cjs/MapLayersActionIds.js +10 -0
  26. package/lib/cjs/MapLayersActionIds.js.map +1 -0
  27. package/lib/cjs/MapLayersPrefBrowserStorage.d.ts.map +1 -1
  28. package/lib/cjs/MapLayersPrefBrowserStorage.js +4 -5
  29. package/lib/cjs/MapLayersPrefBrowserStorage.js.map +1 -1
  30. package/lib/cjs/PreferencesBrowserStorage.d.ts +18 -18
  31. package/lib/cjs/PreferencesBrowserStorage.d.ts.map +1 -1
  32. package/lib/cjs/PreferencesBrowserStorage.js +14 -14
  33. package/lib/cjs/PreferencesBrowserStorage.js.map +1 -1
  34. package/lib/cjs/map-layers.d.ts +1 -0
  35. package/lib/cjs/map-layers.d.ts.map +1 -1
  36. package/lib/cjs/map-layers.js +4 -3
  37. package/lib/cjs/map-layers.js.map +1 -1
  38. package/lib/cjs/mapLayers.d.ts +2 -2
  39. package/lib/cjs/mapLayers.d.ts.map +1 -1
  40. package/lib/cjs/mapLayers.js.map +1 -1
  41. package/lib/cjs/public/locales/en/mapLayers.json +179 -184
  42. package/lib/cjs/ui/FeatureInfoUiItemsProvider.d.ts +3 -2
  43. package/lib/cjs/ui/FeatureInfoUiItemsProvider.d.ts.map +1 -1
  44. package/lib/cjs/ui/FeatureInfoUiItemsProvider.js +48 -16
  45. package/lib/cjs/ui/FeatureInfoUiItemsProvider.js.map +1 -1
  46. package/lib/cjs/ui/Interfaces.d.ts +3 -3
  47. package/lib/cjs/ui/Interfaces.d.ts.map +1 -1
  48. package/lib/cjs/ui/Interfaces.js.map +1 -1
  49. package/lib/cjs/ui/MapLayersUiItemsProvider.d.ts +3 -2
  50. package/lib/cjs/ui/MapLayersUiItemsProvider.d.ts.map +1 -1
  51. package/lib/cjs/ui/MapLayersUiItemsProvider.js +2 -6
  52. package/lib/cjs/ui/MapLayersUiItemsProvider.js.map +1 -1
  53. package/lib/cjs/ui/widget/AttachLayerPopupButton.d.ts.map +1 -1
  54. package/lib/cjs/ui/widget/AttachLayerPopupButton.js +81 -46
  55. package/lib/cjs/ui/widget/AttachLayerPopupButton.js.map +1 -1
  56. package/lib/cjs/ui/widget/BasemapPanel.d.ts.map +1 -1
  57. package/lib/cjs/ui/widget/BasemapPanel.js +44 -25
  58. package/lib/cjs/ui/widget/BasemapPanel.js.map +1 -1
  59. package/lib/cjs/ui/widget/BasemapPanel.scss +2 -4
  60. package/lib/cjs/ui/widget/ConfirmMessageDialog.d.ts +1 -1
  61. package/lib/cjs/ui/widget/ConfirmMessageDialog.d.ts.map +1 -1
  62. package/lib/cjs/ui/widget/ConfirmMessageDialog.js +31 -8
  63. package/lib/cjs/ui/widget/ConfirmMessageDialog.js.map +1 -1
  64. package/lib/cjs/ui/widget/CustomParamEditDialog.d.ts +1 -1
  65. package/lib/cjs/ui/widget/CustomParamEditDialog.d.ts.map +1 -1
  66. package/lib/cjs/ui/widget/CustomParamEditDialog.js +34 -20
  67. package/lib/cjs/ui/widget/CustomParamEditDialog.js.map +1 -1
  68. package/lib/cjs/ui/widget/CustomParamEditDialog.scss +1 -2
  69. package/lib/cjs/ui/widget/CustomParamsSettings.d.ts.map +1 -1
  70. package/lib/cjs/ui/widget/CustomParamsSettings.js +43 -28
  71. package/lib/cjs/ui/widget/CustomParamsSettings.js.map +1 -1
  72. package/lib/cjs/ui/widget/CustomParamsSettings.scss +7 -9
  73. package/lib/cjs/ui/widget/FeatureInfoDataProvider.d.ts +3 -2
  74. package/lib/cjs/ui/widget/FeatureInfoDataProvider.d.ts.map +1 -1
  75. package/lib/cjs/ui/widget/FeatureInfoDataProvider.js +4 -2
  76. package/lib/cjs/ui/widget/FeatureInfoDataProvider.js.map +1 -1
  77. package/lib/cjs/ui/widget/FeatureInfoWidget.d.ts +1 -1
  78. package/lib/cjs/ui/widget/FeatureInfoWidget.d.ts.map +1 -1
  79. package/lib/cjs/ui/widget/FeatureInfoWidget.js +36 -6
  80. package/lib/cjs/ui/widget/FeatureInfoWidget.js.map +1 -1
  81. package/lib/cjs/ui/widget/MapLayerActionButtons.d.ts +1 -1
  82. package/lib/cjs/ui/widget/MapLayerActionButtons.d.ts.map +1 -1
  83. package/lib/cjs/ui/widget/MapLayerActionButtons.js +30 -17
  84. package/lib/cjs/ui/widget/MapLayerActionButtons.js.map +1 -1
  85. package/lib/cjs/ui/widget/MapLayerDroppable.d.ts +2 -2
  86. package/lib/cjs/ui/widget/MapLayerDroppable.d.ts.map +1 -1
  87. package/lib/cjs/ui/widget/MapLayerDroppable.js +64 -50
  88. package/lib/cjs/ui/widget/MapLayerDroppable.js.map +1 -1
  89. package/lib/cjs/ui/widget/MapLayerManager.d.ts +2 -2
  90. package/lib/cjs/ui/widget/MapLayerManager.d.ts.map +1 -1
  91. package/lib/cjs/ui/widget/MapLayerManager.js +160 -86
  92. package/lib/cjs/ui/widget/MapLayerManager.js.map +1 -1
  93. package/lib/cjs/ui/widget/MapLayerManager.scss +3 -6
  94. package/lib/cjs/ui/widget/MapLayerSettingsMenu.d.ts +2 -2
  95. package/lib/cjs/ui/widget/MapLayerSettingsMenu.d.ts.map +1 -1
  96. package/lib/cjs/ui/widget/MapLayerSettingsMenu.js +33 -13
  97. package/lib/cjs/ui/widget/MapLayerSettingsMenu.js.map +1 -1
  98. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.d.ts.map +1 -1
  99. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.js +36 -14
  100. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.js.map +1 -1
  101. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.scss +5 -5
  102. package/lib/cjs/ui/widget/MapLayersWidget.d.ts +1 -1
  103. package/lib/cjs/ui/widget/MapLayersWidget.d.ts.map +1 -1
  104. package/lib/cjs/ui/widget/MapLayersWidget.js +34 -11
  105. package/lib/cjs/ui/widget/MapLayersWidget.js.map +1 -1
  106. package/lib/cjs/ui/widget/MapManagerMapLayersHeader.d.ts.map +1 -1
  107. package/lib/cjs/ui/widget/MapManagerMapLayersHeader.js +5 -8
  108. package/lib/cjs/ui/widget/MapManagerMapLayersHeader.js.map +1 -1
  109. package/lib/cjs/ui/widget/MapManagerSettings.d.ts.map +1 -1
  110. package/lib/cjs/ui/widget/MapManagerSettings.js +55 -56
  111. package/lib/cjs/ui/widget/MapManagerSettings.js.map +1 -1
  112. package/lib/cjs/ui/widget/MapManagerSettings.scss +1 -1
  113. package/lib/cjs/ui/widget/MapSelectFeaturesDialog.d.ts +2 -2
  114. package/lib/cjs/ui/widget/MapSelectFeaturesDialog.d.ts.map +1 -1
  115. package/lib/cjs/ui/widget/MapSelectFeaturesDialog.js +33 -18
  116. package/lib/cjs/ui/widget/MapSelectFeaturesDialog.js.map +1 -1
  117. package/lib/cjs/ui/widget/MapSelectFeaturesDialog.scss +1 -3
  118. package/lib/cjs/ui/widget/MapUrlDialog.d.ts +4 -3
  119. package/lib/cjs/ui/widget/MapUrlDialog.d.ts.map +1 -1
  120. package/lib/cjs/ui/widget/MapUrlDialog.js +125 -96
  121. package/lib/cjs/ui/widget/MapUrlDialog.js.map +1 -1
  122. package/lib/cjs/ui/widget/MapUrlDialog.scss +6 -7
  123. package/lib/cjs/ui/widget/SelectApiKey.d.ts.map +1 -1
  124. package/lib/cjs/ui/widget/SelectApiKey.js +38 -10
  125. package/lib/cjs/ui/widget/SelectApiKey.js.map +1 -1
  126. package/lib/cjs/ui/widget/SelectCustomParam.d.ts.map +1 -1
  127. package/lib/cjs/ui/widget/SelectCustomParam.js +40 -11
  128. package/lib/cjs/ui/widget/SelectCustomParam.js.map +1 -1
  129. package/lib/cjs/ui/widget/SelectMapFormat.d.ts +3 -3
  130. package/lib/cjs/ui/widget/SelectMapFormat.d.ts.map +1 -1
  131. package/lib/cjs/ui/widget/SelectMapFormat.js +35 -13
  132. package/lib/cjs/ui/widget/SelectMapFormat.js.map +1 -1
  133. package/lib/cjs/ui/widget/SubLayersDataProvider.d.ts +2 -2
  134. package/lib/cjs/ui/widget/SubLayersDataProvider.d.ts.map +1 -1
  135. package/lib/cjs/ui/widget/SubLayersDataProvider.js +13 -9
  136. package/lib/cjs/ui/widget/SubLayersDataProvider.js.map +1 -1
  137. package/lib/cjs/ui/widget/SubLayersPopupButton.d.ts +1 -1
  138. package/lib/cjs/ui/widget/SubLayersPopupButton.d.ts.map +1 -1
  139. package/lib/cjs/ui/widget/SubLayersPopupButton.js +30 -12
  140. package/lib/cjs/ui/widget/SubLayersPopupButton.js.map +1 -1
  141. package/lib/cjs/ui/widget/SubLayersTree.d.ts +2 -2
  142. package/lib/cjs/ui/widget/SubLayersTree.d.ts.map +1 -1
  143. package/lib/cjs/ui/widget/SubLayersTree.js +83 -45
  144. package/lib/cjs/ui/widget/SubLayersTree.js.map +1 -1
  145. package/lib/cjs/ui/widget/SubLayersTree.scss +4 -7
  146. package/lib/cjs/ui/widget/TransparencyPopupButton.d.ts.map +1 -1
  147. package/lib/cjs/ui/widget/TransparencyPopupButton.js +33 -16
  148. package/lib/cjs/ui/widget/TransparencyPopupButton.js.map +1 -1
  149. package/lib/cjs/ui/widget/TransparencyPopupButton.scss +1 -2
  150. package/lib/cjs/ui/widget/UserPreferencesStorageOptions.d.ts +1 -1
  151. package/lib/cjs/ui/widget/UserPreferencesStorageOptions.d.ts.map +1 -1
  152. package/lib/cjs/ui/widget/UserPreferencesStorageOptions.js +2 -8
  153. package/lib/cjs/ui/widget/UserPreferencesStorageOptions.js.map +1 -1
  154. package/lib/esm/BrowserStorage.d.ts +1 -1
  155. package/lib/esm/BrowserStorage.d.ts.map +1 -1
  156. package/lib/esm/BrowserStorage.js +24 -14
  157. package/lib/esm/BrowserStorage.js.map +1 -1
  158. package/lib/esm/CustomParamUtils.d.ts +1 -1
  159. package/lib/esm/CustomParamUtils.d.ts.map +1 -1
  160. package/lib/esm/CustomParamUtils.js +18 -7
  161. package/lib/esm/CustomParamUtils.js.map +1 -1
  162. package/lib/esm/CustomParamsMappingStorage.d.ts +1 -1
  163. package/lib/esm/CustomParamsMappingStorage.d.ts.map +1 -1
  164. package/lib/esm/CustomParamsMappingStorage.js +3 -3
  165. package/lib/esm/CustomParamsMappingStorage.js.map +1 -1
  166. package/lib/esm/CustomParamsStorage.d.ts +1 -1
  167. package/lib/esm/CustomParamsStorage.d.ts.map +1 -1
  168. package/lib/esm/CustomParamsStorage.js +3 -3
  169. package/lib/esm/CustomParamsStorage.js.map +1 -1
  170. package/lib/esm/MapLayerPreferences.d.ts +2 -1
  171. package/lib/esm/MapLayerPreferences.d.ts.map +1 -1
  172. package/lib/esm/MapLayerPreferences.js +50 -25
  173. package/lib/esm/MapLayerPreferences.js.map +1 -1
  174. package/lib/esm/MapLayersActionIds.d.ts +5 -0
  175. package/lib/esm/MapLayersActionIds.d.ts.map +1 -0
  176. package/lib/esm/MapLayersActionIds.js +7 -0
  177. package/lib/esm/MapLayersActionIds.js.map +1 -0
  178. package/lib/esm/MapLayersPrefBrowserStorage.d.ts.map +1 -1
  179. package/lib/esm/MapLayersPrefBrowserStorage.js +4 -5
  180. package/lib/esm/MapLayersPrefBrowserStorage.js.map +1 -1
  181. package/lib/esm/PreferencesBrowserStorage.d.ts +18 -18
  182. package/lib/esm/PreferencesBrowserStorage.d.ts.map +1 -1
  183. package/lib/esm/PreferencesBrowserStorage.js +14 -14
  184. package/lib/esm/PreferencesBrowserStorage.js.map +1 -1
  185. package/lib/esm/map-layers.d.ts +1 -0
  186. package/lib/esm/map-layers.d.ts.map +1 -1
  187. package/lib/esm/map-layers.js +4 -3
  188. package/lib/esm/map-layers.js.map +1 -1
  189. package/lib/esm/mapLayers.d.ts +2 -2
  190. package/lib/esm/mapLayers.d.ts.map +1 -1
  191. package/lib/esm/mapLayers.js.map +1 -1
  192. package/lib/esm/public/locales/en/mapLayers.json +179 -184
  193. package/lib/esm/ui/FeatureInfoUiItemsProvider.d.ts +3 -2
  194. package/lib/esm/ui/FeatureInfoUiItemsProvider.d.ts.map +1 -1
  195. package/lib/esm/ui/FeatureInfoUiItemsProvider.js +48 -16
  196. package/lib/esm/ui/FeatureInfoUiItemsProvider.js.map +1 -1
  197. package/lib/esm/ui/Interfaces.d.ts +3 -3
  198. package/lib/esm/ui/Interfaces.d.ts.map +1 -1
  199. package/lib/esm/ui/Interfaces.js.map +1 -1
  200. package/lib/esm/ui/MapLayersUiItemsProvider.d.ts +3 -2
  201. package/lib/esm/ui/MapLayersUiItemsProvider.d.ts.map +1 -1
  202. package/lib/esm/ui/MapLayersUiItemsProvider.js +2 -6
  203. package/lib/esm/ui/MapLayersUiItemsProvider.js.map +1 -1
  204. package/lib/esm/ui/widget/AttachLayerPopupButton.d.ts.map +1 -1
  205. package/lib/esm/ui/widget/AttachLayerPopupButton.js +57 -45
  206. package/lib/esm/ui/widget/AttachLayerPopupButton.js.map +1 -1
  207. package/lib/esm/ui/widget/BasemapPanel.d.ts.map +1 -1
  208. package/lib/esm/ui/widget/BasemapPanel.js +19 -23
  209. package/lib/esm/ui/widget/BasemapPanel.js.map +1 -1
  210. package/lib/esm/ui/widget/BasemapPanel.scss +2 -4
  211. package/lib/esm/ui/widget/ConfirmMessageDialog.d.ts +1 -1
  212. package/lib/esm/ui/widget/ConfirmMessageDialog.d.ts.map +1 -1
  213. package/lib/esm/ui/widget/ConfirmMessageDialog.js +5 -5
  214. package/lib/esm/ui/widget/ConfirmMessageDialog.js.map +1 -1
  215. package/lib/esm/ui/widget/CustomParamEditDialog.d.ts +1 -1
  216. package/lib/esm/ui/widget/CustomParamEditDialog.d.ts.map +1 -1
  217. package/lib/esm/ui/widget/CustomParamEditDialog.js +9 -18
  218. package/lib/esm/ui/widget/CustomParamEditDialog.js.map +1 -1
  219. package/lib/esm/ui/widget/CustomParamEditDialog.scss +1 -2
  220. package/lib/esm/ui/widget/CustomParamsSettings.d.ts.map +1 -1
  221. package/lib/esm/ui/widget/CustomParamsSettings.js +18 -26
  222. package/lib/esm/ui/widget/CustomParamsSettings.js.map +1 -1
  223. package/lib/esm/ui/widget/CustomParamsSettings.scss +7 -9
  224. package/lib/esm/ui/widget/FeatureInfoDataProvider.d.ts +3 -2
  225. package/lib/esm/ui/widget/FeatureInfoDataProvider.d.ts.map +1 -1
  226. package/lib/esm/ui/widget/FeatureInfoDataProvider.js +4 -2
  227. package/lib/esm/ui/widget/FeatureInfoDataProvider.js.map +1 -1
  228. package/lib/esm/ui/widget/FeatureInfoWidget.d.ts +1 -1
  229. package/lib/esm/ui/widget/FeatureInfoWidget.d.ts.map +1 -1
  230. package/lib/esm/ui/widget/FeatureInfoWidget.js +12 -5
  231. package/lib/esm/ui/widget/FeatureInfoWidget.js.map +1 -1
  232. package/lib/esm/ui/widget/MapLayerActionButtons.d.ts +1 -1
  233. package/lib/esm/ui/widget/MapLayerActionButtons.d.ts.map +1 -1
  234. package/lib/esm/ui/widget/MapLayerActionButtons.js +6 -16
  235. package/lib/esm/ui/widget/MapLayerActionButtons.js.map +1 -1
  236. package/lib/esm/ui/widget/MapLayerDroppable.d.ts +2 -2
  237. package/lib/esm/ui/widget/MapLayerDroppable.d.ts.map +1 -1
  238. package/lib/esm/ui/widget/MapLayerDroppable.js +38 -47
  239. package/lib/esm/ui/widget/MapLayerDroppable.js.map +1 -1
  240. package/lib/esm/ui/widget/MapLayerManager.d.ts +2 -2
  241. package/lib/esm/ui/widget/MapLayerManager.d.ts.map +1 -1
  242. package/lib/esm/ui/widget/MapLayerManager.js +136 -85
  243. package/lib/esm/ui/widget/MapLayerManager.js.map +1 -1
  244. package/lib/esm/ui/widget/MapLayerManager.scss +3 -6
  245. package/lib/esm/ui/widget/MapLayerSettingsMenu.d.ts +2 -2
  246. package/lib/esm/ui/widget/MapLayerSettingsMenu.d.ts.map +1 -1
  247. package/lib/esm/ui/widget/MapLayerSettingsMenu.js +9 -12
  248. package/lib/esm/ui/widget/MapLayerSettingsMenu.js.map +1 -1
  249. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.d.ts.map +1 -1
  250. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.js +11 -12
  251. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.js.map +1 -1
  252. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.scss +5 -5
  253. package/lib/esm/ui/widget/MapLayersWidget.d.ts +1 -1
  254. package/lib/esm/ui/widget/MapLayersWidget.d.ts.map +1 -1
  255. package/lib/esm/ui/widget/MapLayersWidget.js +9 -9
  256. package/lib/esm/ui/widget/MapLayersWidget.js.map +1 -1
  257. package/lib/esm/ui/widget/MapManagerMapLayersHeader.d.ts.map +1 -1
  258. package/lib/esm/ui/widget/MapManagerMapLayersHeader.js +5 -8
  259. package/lib/esm/ui/widget/MapManagerMapLayersHeader.js.map +1 -1
  260. package/lib/esm/ui/widget/MapManagerSettings.d.ts.map +1 -1
  261. package/lib/esm/ui/widget/MapManagerSettings.js +29 -53
  262. package/lib/esm/ui/widget/MapManagerSettings.js.map +1 -1
  263. package/lib/esm/ui/widget/MapManagerSettings.scss +1 -1
  264. package/lib/esm/ui/widget/MapSelectFeaturesDialog.d.ts +2 -2
  265. package/lib/esm/ui/widget/MapSelectFeaturesDialog.d.ts.map +1 -1
  266. package/lib/esm/ui/widget/MapSelectFeaturesDialog.js +7 -15
  267. package/lib/esm/ui/widget/MapSelectFeaturesDialog.js.map +1 -1
  268. package/lib/esm/ui/widget/MapSelectFeaturesDialog.scss +1 -3
  269. package/lib/esm/ui/widget/MapUrlDialog.d.ts +4 -3
  270. package/lib/esm/ui/widget/MapUrlDialog.d.ts.map +1 -1
  271. package/lib/esm/ui/widget/MapUrlDialog.js +100 -94
  272. package/lib/esm/ui/widget/MapUrlDialog.js.map +1 -1
  273. package/lib/esm/ui/widget/MapUrlDialog.scss +6 -7
  274. package/lib/esm/ui/widget/SelectApiKey.d.ts.map +1 -1
  275. package/lib/esm/ui/widget/SelectApiKey.js +12 -7
  276. package/lib/esm/ui/widget/SelectApiKey.js.map +1 -1
  277. package/lib/esm/ui/widget/SelectCustomParam.d.ts.map +1 -1
  278. package/lib/esm/ui/widget/SelectCustomParam.js +14 -8
  279. package/lib/esm/ui/widget/SelectCustomParam.js.map +1 -1
  280. package/lib/esm/ui/widget/SelectMapFormat.d.ts +3 -3
  281. package/lib/esm/ui/widget/SelectMapFormat.d.ts.map +1 -1
  282. package/lib/esm/ui/widget/SelectMapFormat.js +9 -10
  283. package/lib/esm/ui/widget/SelectMapFormat.js.map +1 -1
  284. package/lib/esm/ui/widget/SubLayersDataProvider.d.ts +2 -2
  285. package/lib/esm/ui/widget/SubLayersDataProvider.d.ts.map +1 -1
  286. package/lib/esm/ui/widget/SubLayersDataProvider.js +13 -9
  287. package/lib/esm/ui/widget/SubLayersDataProvider.js.map +1 -1
  288. package/lib/esm/ui/widget/SubLayersPopupButton.d.ts +1 -1
  289. package/lib/esm/ui/widget/SubLayersPopupButton.d.ts.map +1 -1
  290. package/lib/esm/ui/widget/SubLayersPopupButton.js +6 -11
  291. package/lib/esm/ui/widget/SubLayersPopupButton.js.map +1 -1
  292. package/lib/esm/ui/widget/SubLayersTree.d.ts +2 -2
  293. package/lib/esm/ui/widget/SubLayersTree.d.ts.map +1 -1
  294. package/lib/esm/ui/widget/SubLayersTree.js +59 -44
  295. package/lib/esm/ui/widget/SubLayersTree.js.map +1 -1
  296. package/lib/esm/ui/widget/SubLayersTree.scss +4 -7
  297. package/lib/esm/ui/widget/TransparencyPopupButton.d.ts.map +1 -1
  298. package/lib/esm/ui/widget/TransparencyPopupButton.js +8 -14
  299. package/lib/esm/ui/widget/TransparencyPopupButton.js.map +1 -1
  300. package/lib/esm/ui/widget/TransparencyPopupButton.scss +1 -2
  301. package/lib/esm/ui/widget/UserPreferencesStorageOptions.d.ts +1 -1
  302. package/lib/esm/ui/widget/UserPreferencesStorageOptions.d.ts.map +1 -1
  303. package/lib/esm/ui/widget/UserPreferencesStorageOptions.js +2 -8
  304. package/lib/esm/ui/widget/UserPreferencesStorageOptions.js.map +1 -1
  305. package/lib/public/locales/en/mapLayers.json +179 -184
  306. package/package.json +9 -21
@@ -1 +1 @@
1
- {"version":3,"file":"MapLayersUiItemsProvider.js","sourceRoot":"","sources":["../../../src/ui/MapLayersUiItemsProvider.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,+BAA+B;AAC/B,oDAAgH;AAChH,8DAA2D;AAE3D,4CAA2C;AAE3C,MAAa,wBAAwB;IAInC,YAAmB,eAAiC;QAHpC,OAAE,GAAG,0BAA0B,CAAC;QAI9C,IAAI,CAAC,gBAAgB,GAAG,eAAe,IAAI;YACzC,qBAAqB,EAAE,KAAK;YAC5B,cAAc,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE,wBAAwB,EAAE,IAAI,EAAE;YACzE,0BAA0B,EAAE,KAAK;SAClC,CAAC;IACJ,CAAC;IAEM,cAAc,CAAC,QAAgB,EAAE,UAAkB,EAAE,QAA4B,EAAE,OAA2B;QACnH,MAAM,OAAO,GAAa,EAAE,CAAC;QAC7B,MAAM,UAAU,GAAG,OAAO,IAAI,+BAAiB,CAAC,KAAK,CAAC;QACtD,IAAI,UAAU,KAAK,wBAAU,CAAC,OAAO,IAAI,QAAQ,KAAK,gCAAkB,CAAC,KAAK,IAAI,UAAU,KAAK,+BAAiB,CAAC,KAAK,EAAE;YACxH,OAAO,CAAC,IAAI,CAAC;gBACX,EAAE,EAAE,4BAA4B;gBAChC,KAAK,EAAE,uBAAW,CAAC,YAAY,CAAC,kBAAkB,CAAC,wBAAwB,CAAC;gBAC5E,IAAI,EAAE,UAAU;gBAChB,OAAO,EAAE,oBAAC,iCAAe,IAAC,eAAe,EAAE,IAAI,CAAC,gBAAgB,GAAI;aACrE,CAAC,CAAC;SACJ;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AAzBD,4DAyBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\nimport * as React from \"react\";\nimport { StagePanelLocation, StagePanelSection, StageUsage, UiItemsProvider, Widget } from \"@itwin/appui-react\";\nimport { MapLayersWidget } from \"./widget/MapLayersWidget\";\nimport { MapLayerOptions } from \"./Interfaces\";\nimport { MapLayersUI } from \"../mapLayers\";\n\nexport class MapLayersUiItemsProvider implements UiItemsProvider {\n public readonly id = \"MapLayersUiItemsProvider\";\n private _mapLayerOptions?: MapLayerOptions;\n\n public constructor(mapLayerOptions?: MapLayerOptions) {\n this._mapLayerOptions = mapLayerOptions ?? {\n hideExternalMapLayers: false,\n mapTypeOptions: { supportTileUrl: false, supportWmsAuthentication: true },\n fetchPublicMapLayerSources: false,\n };\n }\n\n public provideWidgets(_stageId: string, stageUsage: string, location: StagePanelLocation, section?: StagePanelSection) {\n const widgets: Widget[] = [];\n const tmpSection = section ?? StagePanelSection.Start;\n if (stageUsage === StageUsage.General && location === StagePanelLocation.Right && tmpSection === StagePanelSection.Start) {\n widgets.push({\n id: \"map-layers:mapLayersWidget\",\n label: MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.Label\"),\n icon: \"icon-map\",\n content: <MapLayersWidget mapLayerOptions={this._mapLayerOptions} />,\n });\n }\n return widgets;\n }\n}\n"]}
1
+ {"version":3,"file":"MapLayersUiItemsProvider.js","sourceRoot":"","sources":["../../../src/ui/MapLayersUiItemsProvider.tsx"],"names":[],"mappings":";;;;AAMA,oDAAuF;AACvF,8DAA2D;AAE3D,4CAA2C;AAE3C,MAAa,wBAAwB;IAInC,YAAmB,eAAiC;QAHpC,OAAE,GAAG,0BAA0B,CAAC;QAI9C,IAAI,CAAC,gBAAgB,GAAG,eAAe,IAAI;YACzC,qBAAqB,EAAE,KAAK;YAC5B,cAAc,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE,wBAAwB,EAAE,IAAI,EAAE;YACzE,0BAA0B,EAAE,KAAK;SAClC,CAAC;IACJ,CAAC;IAEM,cAAc,CAAC,QAAgB,EAAE,UAAkB,EAAE,QAA4B,EAAE,OAA2B;QACnH,MAAM,OAAO,GAAa,EAAE,CAAC;QAC7B,MAAM,UAAU,GAAG,OAAO,IAAI,+BAAiB,CAAC,KAAK,CAAC;QACtD,IAAI,UAAU,KAAK,wBAAU,CAAC,OAAO,IAAI,QAAQ,KAAK,gCAAkB,CAAC,KAAK,IAAI,UAAU,KAAK,+BAAiB,CAAC,KAAK,EAAE;YACxH,OAAO,CAAC,IAAI,CAAC;gBACX,EAAE,EAAE,4BAA4B;gBAChC,KAAK,EAAE,uBAAW,CAAC,YAAY,CAAC,kBAAkB,CAAC,wBAAwB,CAAC;gBAC5E,IAAI,EAAE,UAAU;gBAChB,OAAO,EAAE,uBAAC,iCAAe,IAAC,eAAe,EAAE,IAAI,CAAC,gBAAgB,GAAI;aACrE,CAAC,CAAC;SACJ;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AAzBD,4DAyBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport type { UiItemsProvider, Widget } from \"@itwin/appui-react\";\nimport { StagePanelLocation, StagePanelSection, StageUsage } from \"@itwin/appui-react\";\nimport { MapLayersWidget } from \"./widget/MapLayersWidget\";\nimport type { MapLayerOptions } from \"./Interfaces\";\nimport { MapLayersUI } from \"../mapLayers\";\n\nexport class MapLayersUiItemsProvider implements UiItemsProvider {\n public readonly id = \"MapLayersUiItemsProvider\";\n private _mapLayerOptions?: MapLayerOptions;\n\n public constructor(mapLayerOptions?: MapLayerOptions) {\n this._mapLayerOptions = mapLayerOptions ?? {\n hideExternalMapLayers: false,\n mapTypeOptions: { supportTileUrl: false, supportWmsAuthentication: true },\n fetchPublicMapLayerSources: false,\n };\n }\n\n public provideWidgets(_stageId: string, stageUsage: string, location: StagePanelLocation, section?: StagePanelSection) {\n const widgets: Widget[] = [];\n const tmpSection = section ?? StagePanelSection.Start;\n if (stageUsage === StageUsage.General && location === StagePanelLocation.Right && tmpSection === StagePanelSection.Start) {\n widgets.push({\n id: \"map-layers:mapLayersWidget\",\n label: MapLayersUI.localization.getLocalizedString(\"mapLayers:Widget.Label\"),\n icon: \"icon-map\",\n content: <MapLayersWidget mapLayerOptions={this._mapLayerOptions} />,\n });\n }\n return widgets;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"AttachLayerPopupButton.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/AttachLayerPopupButton.tsx"],"names":[],"mappings":";AA2cA,gBAAgB;AAChB,oBAAY,qBAAqB;IAC/B,OAAO,IAAA;IACP,IAAI,IAAA;IACJ,IAAI,IAAA;CACL;AACD,MAAM,WAAW,2BAA2B;IAC1C,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,qBAAqB,CAAC;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,gBAAgB;AAEhB,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,2BAA2B,eAkHxE"}
1
+ {"version":3,"file":"AttachLayerPopupButton.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/AttachLayerPopupButton.tsx"],"names":[],"mappings":";AA0hBA,gBAAgB;AAChB,oBAAY,qBAAqB;IAC/B,OAAO,IAAA;IACP,IAAI,IAAA;IACJ,IAAI,IAAA;CACL;AACD,MAAM,WAAW,2BAA2B;IAC1C,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,qBAAqB,CAAC;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,gBAAgB;AAEhB,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,2BAA2B,eA+HxE"}
@@ -1,15 +1,39 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  Object.defineProperty(exports, "__esModule", { value: true });
3
26
  exports.AttachLayerPopupButton = exports.AttachLayerButtonType = void 0;
27
+ const jsx_runtime_1 = require("react/jsx-runtime");
4
28
  /*---------------------------------------------------------------------------------------------
5
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
6
- * See LICENSE.md in the project root for license terms and full copyright notice.
7
- *--------------------------------------------------------------------------------------------*/
8
- const React = require("react");
29
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
30
+ * See LICENSE.md in the project root for license terms and full copyright notice.
31
+ *--------------------------------------------------------------------------------------------*/
32
+ const React = __importStar(require("react"));
9
33
  const appui_abstract_1 = require("@itwin/appui-abstract");
10
34
  const appui_react_1 = require("@itwin/appui-react");
11
35
  const core_frontend_1 = require("@itwin/core-frontend");
12
- const UiCore = require("@itwin/core-react");
36
+ const UiCore = __importStar(require("@itwin/core-react"));
13
37
  const itwinui_icons_react_1 = require("@itwin/itwinui-icons-react");
14
38
  const itwinui_react_1 = require("@itwin/itwinui-react");
15
39
  const MapLayerPreferences_1 = require("../../MapLayerPreferences");
@@ -28,7 +52,7 @@ var LayerAction;
28
52
  function AttachLayerPanel({ isOverlay, onLayerAttached, onHandleOutsideClick }) {
29
53
  const [layerNameToAdd, setLayerNameToAdd] = React.useState();
30
54
  const [sourceFilterString, setSourceFilterString] = React.useState();
31
- const { placeholderLabel, addCustomLayerLabel, addCustomLayerToolTip, loadingMapSources, removeLayerDefButtonTitle, editLayerDefButtonTitle, removeLayerDefDialogTitle } = React.useMemo(() => {
55
+ const { placeholderLabel, addCustomLayerLabel, addCustomLayerToolTip, loadingMapSources, removeLayerDefButtonTitle, editLayerDefButtonTitle, removeLayerDefDialogTitle, } = React.useMemo(() => {
32
56
  return {
33
57
  placeholderLabel: mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:CustomAttach.SearchPlaceholder"),
34
58
  addCustomLayerLabel: mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:CustomAttach.Custom"),
@@ -69,8 +93,8 @@ function AttachLayerPanel({ isOverlay, onLayerAttached, onHandleOutsideClick })
69
93
  const generateUniqueMapLayerName = (layerName) => {
70
94
  let uniqueLayerName = layerName;
71
95
  let layerNameIdx = 1;
72
- while ((backgroundLayers && backgroundLayers.some((layer) => uniqueLayerName === layer.name))
73
- || (overlayLayers && overlayLayers.some((layer) => uniqueLayerName === layer.name))) {
96
+ while ((backgroundLayers && backgroundLayers.some((layer) => uniqueLayerName === layer.name)) ||
97
+ (overlayLayers && overlayLayers.some((layer) => uniqueLayerName === layer.name))) {
74
98
  uniqueLayerName = `${layerName} (${layerNameIdx++})`;
75
99
  }
76
100
  return { layerNameUpdate: layerNameIdx > 1, uniqueLayerName };
@@ -137,28 +161,33 @@ function AttachLayerPanel({ isOverlay, onLayerAttached, onHandleOutsideClick })
137
161
  const visibleSubLayers = selectedSubLayers.filter((value) => value.visible);
138
162
  // Re-apply default visibility from the source validation
139
163
  visibleSubLayers.forEach((visible) => {
140
- const found = sourceSubLayers.find((value) => { visible.name === value.name; });
141
- if (found)
164
+ const found = sourceSubLayers.find((value) => {
165
+ visible.name === value.name;
166
+ });
167
+ if (found) {
142
168
  visible.visible = found?.visible;
169
+ }
143
170
  });
144
171
  attachLayer(source, visibleSubLayers, true);
145
172
  }, [attachLayer]);
146
173
  const openFeatureSelectionDialog = React.useCallback((subLayers, source) => {
147
174
  // Keep leafs sub-layers and force default visibility to false
148
175
  const noGroupLayers = subLayers.filter((value) => value.children === undefined);
149
- const visibleLayers = noGroupLayers.map((value) => { return { ...value, visible: false }; });
150
- appui_react_1.UiFramework.dialogs.modal.open(React.createElement(MapSelectFeaturesDialog_1.MapSelectFeaturesDialog, { handleOk: (selectedLayers) => { handleSelectFeaturesOk(source, subLayers, selectedLayers); }, handleCancel: handleSelectFeaturesCancel, source: source, subLayers: visibleLayers }));
176
+ const visibleLayers = noGroupLayers.map((value) => {
177
+ return { ...value, visible: false };
178
+ });
179
+ appui_react_1.UiFramework.dialogs.modal.open((0, jsx_runtime_1.jsx)(MapSelectFeaturesDialog_1.MapSelectFeaturesDialog, { handleOk: (selectedLayers) => {
180
+ handleSelectFeaturesOk(source, subLayers, selectedLayers);
181
+ }, handleCancel: handleSelectFeaturesCancel, source: source, subLayers: visibleLayers }));
151
182
  }, [handleSelectFeaturesCancel, handleSelectFeaturesOk]);
152
183
  const needsFeatureSelection = React.useCallback((source, validation) => {
153
- return (source.formatId === "ArcGISFeature" || source.formatId === "WMTS") // TODO, replace this with a flag in MapLayerSourceStatus
154
- && validation.subLayers
155
- && validation.subLayers.length > 1;
184
+ return ((source.formatId === "ArcGISFeature" || source.formatId === "WMTS") && // TODO, replace this with a flag in MapLayerSourceStatus
185
+ validation.subLayers &&
186
+ validation.subLayers.length > 1);
156
187
  }, []);
157
188
  const handleModalUrlDialogOk = React.useCallback((action, sourceState) => {
158
189
  appui_react_1.UiFramework.dialogs.modal.close();
159
- if (LayerAction.New === action
160
- && sourceState
161
- && (sourceState.validation.status === core_frontend_1.MapLayerSourceStatus.Valid)) {
190
+ if (LayerAction.New === action && sourceState && sourceState.validation.status === core_frontend_1.MapLayerSourceStatus.Valid) {
162
191
  if (needsFeatureSelection(sourceState.source, sourceState.validation)) {
163
192
  openFeatureSelectionDialog(sourceState.validation.subLayers, sourceState.source);
164
193
  }
@@ -204,7 +233,7 @@ function AttachLayerPanel({ isOverlay, onLayerAttached, onHandleOutsideClick })
204
233
  else if (sourceValidation.status === core_frontend_1.MapLayerSourceStatus.RequireAuth && isMounted.current) {
205
234
  const layer = foundSource.toLayerSettings();
206
235
  if (layer) {
207
- appui_react_1.UiFramework.dialogs.modal.open(React.createElement(MapUrlDialog_1.MapUrlDialog, { activeViewport: activeViewport, isOverlay: isOverlay, signInModeArgs: { layer, validation: sourceValidation, source: foundSource }, onOkResult: (sourceState) => handleModalUrlDialogOk(LayerAction.New, sourceState), onCancelResult: handleModalUrlDialogCancel, mapLayerOptions: mapLayerOptions }));
236
+ appui_react_1.UiFramework.dialogs.modal.open((0, jsx_runtime_1.jsx)(MapUrlDialog_1.MapUrlDialog, { activeViewport: activeViewport, isOverlay: isOverlay, signInModeArgs: { layer, validation: sourceValidation, source: foundSource }, onOkResult: (sourceState) => handleModalUrlDialogOk(LayerAction.New, sourceState), onCancelResult: handleModalUrlDialogCancel, mapLayerOptions: mapLayerOptions }));
208
237
  }
209
238
  if (onHandleOutsideClick) {
210
239
  onHandleOutsideClick(false);
@@ -233,7 +262,25 @@ function AttachLayerPanel({ isOverlay, onLayerAttached, onHandleOutsideClick })
233
262
  if (isMounted.current) {
234
263
  setLayerNameToAdd(undefined);
235
264
  }
236
- }, [attachLayer, needsFeatureSelection, setLayerNameToAdd, layerNameToAdd, activeViewport, sources, backgroundLayers, isOverlay, overlayLayers, onLayerAttached, handleModalUrlDialogOk, handleSelectFeaturesCancel, handleSelectFeaturesOk, handleModalUrlDialogCancel, onHandleOutsideClick, openFeatureSelectionDialog, mapLayerOptions]);
265
+ }, [
266
+ attachLayer,
267
+ needsFeatureSelection,
268
+ setLayerNameToAdd,
269
+ layerNameToAdd,
270
+ activeViewport,
271
+ sources,
272
+ backgroundLayers,
273
+ isOverlay,
274
+ overlayLayers,
275
+ onLayerAttached,
276
+ handleModalUrlDialogOk,
277
+ handleSelectFeaturesCancel,
278
+ handleSelectFeaturesOk,
279
+ handleModalUrlDialogCancel,
280
+ onHandleOutsideClick,
281
+ openFeatureSelectionDialog,
282
+ mapLayerOptions,
283
+ ]);
237
284
  const options = React.useMemo(() => sources, [sources]);
238
285
  const filteredOptions = React.useMemo(() => {
239
286
  if (undefined === sourceFilterString || 0 === sourceFilterString.length) {
@@ -244,7 +291,7 @@ function AttachLayerPanel({ isOverlay, onLayerAttached, onHandleOutsideClick })
244
291
  }
245
292
  }, [options, sourceFilterString]);
246
293
  const handleAddNewMapSource = React.useCallback(() => {
247
- appui_react_1.UiFramework.dialogs.modal.open(React.createElement(MapUrlDialog_1.MapUrlDialog, { activeViewport: activeViewport, isOverlay: isOverlay, onOkResult: (result) => handleModalUrlDialogOk(LayerAction.New, result), onCancelResult: handleModalUrlDialogCancel, mapLayerOptions: mapLayerOptions }));
294
+ appui_react_1.UiFramework.dialogs.modal.open((0, jsx_runtime_1.jsx)(MapUrlDialog_1.MapUrlDialog, { activeViewport: activeViewport, isOverlay: isOverlay, onOkResult: (result) => handleModalUrlDialogOk(LayerAction.New, result), onCancelResult: handleModalUrlDialogCancel, mapLayerOptions: mapLayerOptions }));
248
295
  if (onHandleOutsideClick) {
249
296
  onHandleOutsideClick(false);
250
297
  }
@@ -293,7 +340,7 @@ function AttachLayerPanel({ isOverlay, onLayerAttached, onHandleOutsideClick })
293
340
  event.stopPropagation(); // We don't want the owning ListBox to react on mouse click.
294
341
  const layerName = source.name;
295
342
  const msg = mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:CustomAttach.RemoveLayerDefDialogMessage", { layerName });
296
- appui_react_1.UiFramework.dialogs.modal.open(React.createElement(ConfirmMessageDialog_1.ConfirmMessageDialog, { className: "map-sources-delete-confirmation", title: removeLayerDefDialogTitle, message: msg, maxWidth: 400, onClose: () => handleNoConfirmation(layerName), onEscape: () => handleNoConfirmation(layerName), onYesResult: async () => handleYesConfirmation(source), onNoResult: () => handleNoConfirmation(layerName) }));
343
+ appui_react_1.UiFramework.dialogs.modal.open((0, jsx_runtime_1.jsx)(ConfirmMessageDialog_1.ConfirmMessageDialog, { className: "map-sources-delete-confirmation", title: removeLayerDefDialogTitle, message: msg, maxWidth: 400, onClose: () => handleNoConfirmation(layerName), onEscape: () => handleNoConfirmation(layerName), onYesResult: async () => handleYesConfirmation(source), onNoResult: () => handleNoConfirmation(layerName) }));
297
344
  if (onHandleOutsideClick) {
298
345
  onHandleOutsideClick(false);
299
346
  }
@@ -309,26 +356,19 @@ function AttachLayerPanel({ isOverlay, onLayerAttached, onHandleOutsideClick })
309
356
  if (matchingSource === undefined) {
310
357
  return;
311
358
  }
312
- appui_react_1.UiFramework.dialogs.modal.open(React.createElement(MapUrlDialog_1.MapUrlDialog, { activeViewport: activeViewport, isOverlay: isOverlay, mapLayerSourceToEdit: matchingSource, onOkResult: (result) => handleModalUrlDialogOk(LayerAction.Edit, result), onCancelResult: handleModalUrlDialogCancel, mapLayerOptions: mapLayerOptions }));
359
+ appui_react_1.UiFramework.dialogs.modal.open((0, jsx_runtime_1.jsx)(MapUrlDialog_1.MapUrlDialog, { activeViewport: activeViewport, isOverlay: isOverlay, mapLayerSourceToEdit: matchingSource, onOkResult: (result) => handleModalUrlDialogOk(LayerAction.Edit, result), onCancelResult: handleModalUrlDialogCancel, mapLayerOptions: mapLayerOptions }));
313
360
  if (onHandleOutsideClick) {
314
361
  onHandleOutsideClick(false);
315
362
  }
316
363
  }, [activeViewport, handleModalUrlDialogCancel, handleModalUrlDialogOk, isOverlay, mapLayerOptions, onHandleOutsideClick, sources]);
317
- return (React.createElement("div", { className: "map-manager-header" },
318
- (loading || loadingSources) && React.createElement(UiCore.LoadingSpinner, { message: loadingMapSources }),
319
- React.createElement("div", { className: "map-manager-source-listbox-header" },
320
- React.createElement(itwinui_react_1.Input, { type: "text", className: "map-manager-source-list-filter", placeholder: placeholderLabel, value: sourceFilterString, onChange: handleFilterTextChanged, size: "small" }),
321
- React.createElement(itwinui_react_1.Button, { className: "map-manager-add-source-button", title: addCustomLayerToolTip, onClick: handleAddNewMapSource }, addCustomLayerLabel)),
322
- React.createElement("div", { className: "map-manager-sources" },
323
- React.createElement(UiCore.Listbox, { id: "map-sources", selectedValue: layerNameToAdd, className: "map-manager-source-list", onKeyPress: handleKeypressOnSourceList, onListboxValueChange: onListboxValueChange }, filteredOptions?.map((source) => React.createElement(UiCore.ListboxItem, { key: source.name, className: "map-source-list-entry", value: source.name, onMouseEnter: () => setLayerNameUnderCursor(source.name), onMouseLeave: () => setLayerNameUnderCursor(undefined) },
324
- React.createElement("span", { className: "map-source-list-entry-name", title: source.name }, source.name),
325
- // otherwise list feels cluttered.
326
- (!!iTwinId && layerNameUnderCursor && layerNameUnderCursor === source.name) &&
327
- React.createElement(React.Fragment, null,
328
- React.createElement(itwinui_react_1.Button, { size: "small", styleType: "borderless", className: "map-source-list-entry-button", title: editLayerDefButtonTitle, onClick: onItemEditButtonClicked },
329
- React.createElement(UiCore.Icon, { iconSpec: "icon-edit" })),
330
- React.createElement(itwinui_react_1.Button, { size: "small", styleType: "borderless", className: "map-source-list-entry-button", title: removeLayerDefButtonTitle, onClick: (event) => { onItemRemoveButtonClicked(source, event); } },
331
- React.createElement(UiCore.Icon, { iconSpec: "icon-delete" })))))))));
364
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "map-manager-header", children: [(loading || loadingSources) && (0, jsx_runtime_1.jsx)(UiCore.LoadingSpinner, { message: loadingMapSources }), (0, jsx_runtime_1.jsxs)("div", { className: "map-manager-source-listbox-header", children: [(0, jsx_runtime_1.jsx)(itwinui_react_1.Input, { type: "text", className: "map-manager-source-list-filter", placeholder: placeholderLabel, value: sourceFilterString, onChange: handleFilterTextChanged, size: "small" }), (0, jsx_runtime_1.jsx)(itwinui_react_1.Button, { className: "map-manager-add-source-button", title: addCustomLayerToolTip, onClick: handleAddNewMapSource, children: addCustomLayerLabel })] }), (0, jsx_runtime_1.jsx)("div", { className: "map-manager-sources", children: (0, jsx_runtime_1.jsx)(UiCore.Listbox, { id: "map-sources", selectedValue: layerNameToAdd, className: "map-manager-source-list", onKeyPress: handleKeypressOnSourceList, onListboxValueChange: onListboxValueChange, children: filteredOptions?.map((source) => (
365
+ // eslint-disable-next-line @itwin/no-internal
366
+ (0, jsx_runtime_1.jsxs)(UiCore.ListboxItem, { className: "map-source-list-entry", value: source.name, onMouseEnter: () => setLayerNameUnderCursor(source.name), onMouseLeave: () => setLayerNameUnderCursor(undefined), children: [(0, jsx_runtime_1.jsx)("span", { className: "map-source-list-entry-name", title: source.name, children: source.name }),
367
+ // Display the delete icon only when the mouse over a specific item
368
+ // otherwise list feels cluttered.
369
+ !!iTwinId && layerNameUnderCursor && layerNameUnderCursor === source.name && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(itwinui_react_1.Button, { size: "small", styleType: "borderless", className: "map-source-list-entry-button", title: editLayerDefButtonTitle, onClick: onItemEditButtonClicked, children: (0, jsx_runtime_1.jsx)(UiCore.Icon, { iconSpec: "icon-edit" }) }), (0, jsx_runtime_1.jsx)(itwinui_react_1.Button, { size: "small", styleType: "borderless", className: "map-source-list-entry-button", title: removeLayerDefButtonTitle, onClick: (event) => {
370
+ onItemRemoveButtonClicked(source, event);
371
+ }, children: (0, jsx_runtime_1.jsx)(UiCore.Icon, { iconSpec: "icon-delete" }) })] }))] }, source.name))) }) })] }));
332
372
  }
333
373
  /** @internal */
334
374
  var AttachLayerButtonType;
@@ -392,8 +432,7 @@ function AttachLayerPopupButton(props) {
392
432
  function renderButton() {
393
433
  let button;
394
434
  if (props.buttonType === undefined || props.buttonType === AttachLayerButtonType.Icon) {
395
- button = (React.createElement(itwinui_react_1.IconButton, { disabled: props.disabled, size: "small", styleType: "borderless", ref: buttonRef, className: "map-manager-attach-layer-button", title: popupOpen ? hideAttachLayerLabel : showAttachLayerLabel, onClick: togglePopup },
396
- React.createElement(itwinui_icons_react_1.SvgAdd, null)));
435
+ button = ((0, jsx_runtime_1.jsx)(itwinui_react_1.IconButton, { disabled: props.disabled, size: "small", styleType: "borderless", ref: buttonRef, className: "map-manager-attach-layer-button", title: popupOpen ? hideAttachLayerLabel : showAttachLayerLabel, onClick: togglePopup, children: (0, jsx_runtime_1.jsx)(itwinui_icons_react_1.SvgAdd, {}) }));
397
436
  }
398
437
  else {
399
438
  const determineStyleType = () => {
@@ -406,15 +445,11 @@ function AttachLayerPopupButton(props) {
406
445
  }
407
446
  };
408
447
  const styleType = determineStyleType();
409
- button = (React.createElement(itwinui_react_1.Button, { disabled: props.disabled, ref: buttonRef, styleType: styleType, title: popupOpen ? hideAttachLayerLabel : showAttachLayerLabel, onClick: togglePopup }, addCustomLayerButtonLabel));
448
+ button = ((0, jsx_runtime_1.jsx)(itwinui_react_1.Button, { disabled: props.disabled, ref: buttonRef, styleType: styleType, title: popupOpen ? hideAttachLayerLabel : showAttachLayerLabel, onClick: togglePopup, children: addCustomLayerButtonLabel }));
410
449
  }
411
450
  return button;
412
451
  }
413
- return (React.createElement(React.Fragment, null,
414
- renderButton(),
415
- React.createElement(UiCore.Popup, { isOpen: popupOpen, position: appui_abstract_1.RelativePosition.BottomRight, onClose: handleClosePopup, onOutsideClick: onHandleOutsideClick, closeOnWheel: false, target: buttonRef.current, closeOnEnter: false, closeOnContextMenu: false },
416
- React.createElement("div", { ref: panelRef, className: "map-sources-popup-panel" },
417
- React.createElement(AttachLayerPanel, { isOverlay: props.isOverlay, onLayerAttached: handleLayerAttached, onHandleOutsideClick: setHandleOutsideClick })))));
452
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [renderButton(), (0, jsx_runtime_1.jsx)(UiCore.Popup, { isOpen: popupOpen, position: appui_abstract_1.RelativePosition.BottomRight, onClose: handleClosePopup, onOutsideClick: onHandleOutsideClick, closeOnWheel: false, target: buttonRef.current, closeOnEnter: false, closeOnContextMenu: false, children: (0, jsx_runtime_1.jsx)("div", { ref: panelRef, className: "map-sources-popup-panel", children: (0, jsx_runtime_1.jsx)(AttachLayerPanel, { isOverlay: props.isOverlay, onLayerAttached: handleLayerAttached, onHandleOutsideClick: setHandleOutsideClick }) }) })] }));
418
453
  }
419
454
  exports.AttachLayerPopupButton = AttachLayerPopupButton;
420
455
  //# sourceMappingURL=AttachLayerPopupButton.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AttachLayerPopupButton.js","sourceRoot":"","sources":["../../../../src/ui/widget/AttachLayerPopupButton.tsx"],"names":[],"m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BAAiB,CAAC;oBAC3B,KAAK,qBAAqB,CAAC,OAAO,CAAC;oBACnC;wBACE,OAAO,KAAK,CAAC;iBAChB;YACH,CAAC,CAAC;YACF,MAAM,SAAS,GAAG,kBAAkB,EAAE,CAAC;YACvC,MAAM,GAAG,CACP,oBAAC,sBAAM,IAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,oBAAoB,EACpI,OAAO,EAAE,WAAW,IAAG,yBAAyB,CAAU,CAC7D,CAAC;SACH;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,OAAO,CACL;QACG,YAAY,EAAE;QACf,oBAAC,MAAM,CAAC,KAAK,IACX,MAAM,EAAE,SAAS,EACjB,QAAQ,EAAE,iCAAgB,CAAC,WAAW,EACtC,OAAO,EAAE,gBAAgB,EACzB,cAAc,EAAE,oBAAoB,EACpC,YAAY,EAAE,KAAK,EACnB,MAAM,EAAE,SAAS,CAAC,OAAO,EACzB,YAAY,EAAE,KAAK,EACnB,kBAAkB,EAAE,KAAK;YAEzB,6BAAK,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAC,yBAAyB;gBACrD,oBAAC,gBAAgB,IACf,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,eAAe,EAAE,mBAAmB,EACpC,oBAAoB,EAAE,qBAAqB,GAAI,CAC7C,CACQ,CACf,CACJ,CAAC;AACJ,CAAC;AAlHD,wDAkHC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport * as React from \"react\";\r\nimport { RelativePosition } from \"@itwin/appui-abstract\";\r\nimport { UiFramework } from \"@itwin/appui-react\";\r\nimport { MapSubLayerProps } from \"@itwin/core-common\";\r\nimport {\r\n IModelApp, MapLayerSource, MapLayerSourceStatus, MapLayerSourceValidation, NotifyMessageDetails, OutputMessagePriority,\r\n} from \"@itwin/core-frontend\";\r\nimport * as UiCore from \"@itwin/core-react\";\r\nimport { SvgAdd } from \"@itwin/itwinui-icons-react\";\r\nimport { Button, IconButton, Input } from \"@itwin/itwinui-react\";\r\nimport { MapLayerPreferences } from \"../../MapLayerPreferences\";\r\nimport { MapLayersUI } from \"../../mapLayers\";\r\nimport { ConfirmMessageDialog } from \"./ConfirmMessageDialog\";\r\nimport { useSourceMapContext } from \"./MapLayerManager\";\r\nimport { MapSelectFeaturesDialog } from \"./MapSelectFeaturesDialog\";\r\nimport { MapUrlDialog, SourceState } from \"./MapUrlDialog\";\r\n\r\n// cSpell:ignore droppable Sublayer\r\n\r\nenum LayerAction {\r\n New,\r\n Edit\r\n}\r\n\r\ninterface AttachLayerPanelProps {\r\n isOverlay: boolean;\r\n onLayerAttached: () => void;\r\n onHandleOutsideClick?: (shouldHandle: boolean) => void;\r\n}\r\n\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nfunction AttachLayerPanel({ isOverlay, onLayerAttached, onHandleOutsideClick }: AttachLayerPanelProps) {\r\n const [layerNameToAdd, setLayerNameToAdd] = React.useState<string | undefined>();\r\n const [sourceFilterString, setSourceFilterString] = React.useState<string | undefined>();\r\n\r\n const { placeholderLabel, addCustomLayerLabel, addCustomLayerToolTip, loadingMapSources, removeLayerDefButtonTitle, editLayerDefButtonTitle, removeLayerDefDialogTitle } = React.useMemo(() => {\r\n return {\r\n placeholderLabel: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.SearchPlaceholder\"),\r\n addCustomLayerLabel: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.Custom\"),\r\n addCustomLayerToolTip: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.AttachCustomLayer\"),\r\n loadingMapSources: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.LoadingMapSources\"),\r\n removeLayerDefButtonTitle: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.RemoveLayerDefButtonTitle\"),\r\n editLayerDefButtonTitle: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.EditLayerDefButtonTitle\"),\r\n removeLayerDefDialogTitle: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.RemoveLayerDefDialogTitle\"),\r\n };\r\n }, []);\r\n\r\n const [loading, setLoading] = React.useState(false);\r\n const [layerNameUnderCursor, setLayerNameUnderCursor] = React.useState<string | undefined>();\r\n\r\n const resumeOutsideClick = React.useCallback(() => {\r\n if (onHandleOutsideClick) {\r\n onHandleOutsideClick(true);\r\n }\r\n }, [onHandleOutsideClick]);\r\n\r\n // 'isMounted' is used to prevent any async operation once the hook has been\r\n // unloaded. Otherwise we get a 'Can't perform a React state update on an unmounted component.' warning in the console.\r\n const isMounted = React.useRef(false);\r\n React.useEffect(() => {\r\n isMounted.current = true;\r\n return () => {\r\n isMounted.current = false;\r\n\r\n // We close any open dialogs that we might have opened\r\n // This was added because the modal dialog remained remained displayed after the session expired.\r\n UiFramework.dialogs.modal.close();\r\n };\r\n }, []);\r\n\r\n const handleFilterTextChanged = React.useCallback((event: React.ChangeEvent<HTMLInputElement>) => {\r\n setSourceFilterString(event.target.value);\r\n }, []);\r\n\r\n const { loadingSources, sources, activeViewport, backgroundLayers, overlayLayers, mapLayerOptions } = useSourceMapContext();\r\n const iTwinId = activeViewport?.iModel?.iTwinId;\r\n const iModelId = activeViewport?.iModel?.iModelId;\r\n\r\n const attachLayer = React.useCallback((source: MapLayerSource, subLayers: MapSubLayerProps[]|undefined, oneMapLayerPerSubLayer: boolean) => {\r\n if (activeViewport) {\r\n const generateUniqueMapLayerName = (layerName: string) => {\r\n let uniqueLayerName = layerName;\r\n let layerNameIdx = 1;\r\n while (\r\n (backgroundLayers && backgroundLayers.some((layer) => uniqueLayerName === layer.name))\r\n || (overlayLayers && overlayLayers.some((layer) => uniqueLayerName === layer.name)) ) {\r\n uniqueLayerName = `${layerName} (${layerNameIdx++})`;\r\n }\r\n return {layerNameUpdate: layerNameIdx>1, uniqueLayerName};\r\n };\r\n\r\n const doAttachLayer = (layerName: string, subLayer?: MapSubLayerProps) => {\r\n const generatedName = generateUniqueMapLayerName(layerName);\r\n let sourceToAdd = source;\r\n if (generatedName.layerNameUpdate || sourceToAdd.name !== generatedName.uniqueLayerName) {\r\n // create a source with a unique name\r\n const clonedSource = MapLayerSource.fromJSON({...source.toJSON(), name: generatedName.uniqueLayerName});\r\n if (clonedSource !== undefined) {\r\n clonedSource.userName = source.userName;\r\n clonedSource.password = source.password;\r\n clonedSource.unsavedQueryParams = {...source.unsavedQueryParams};\r\n clonedSource.savedQueryParams = {...source.savedQueryParams};\r\n sourceToAdd = clonedSource;\r\n }\r\n }\r\n\r\n const settings = sourceToAdd.toLayerSettings(subLayer ? [subLayer] : subLayers);\r\n if (settings) {\r\n activeViewport.displayStyle.attachMapLayer({ settings, mapLayerIndex: {index: -1, isOverlay} });\r\n return generatedName.uniqueLayerName;\r\n }\r\n return undefined;\r\n };\r\n\r\n if (oneMapLayerPerSubLayer && subLayers) {\r\n const layerNamesAttached: string[] = [];\r\n for (const subLayer of subLayers) {\r\n const attachedLayerName = doAttachLayer(`${source.name} - ${subLayer.name}`, subLayer);\r\n if (attachedLayerName !== undefined) {\r\n layerNamesAttached.push(attachedLayerName);\r\n }\r\n }\r\n\r\n if (layerNamesAttached.length > 0) {\r\n const msg = IModelApp.localization.getLocalizedString(\"mapLayers:Messages.MapLayersAttached\", { layerNames: layerNamesAttached.join(\", \") });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, msg));\r\n }\r\n } else {\r\n const attachedLayerName = doAttachLayer(source.name, undefined);\r\n if (attachedLayerName !== undefined) {\r\n const msg = IModelApp.localization.getLocalizedString(\"mapLayers:Messages.MapLayerAttached\", { sourceName: attachedLayerName });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, msg));\r\n }\r\n }\r\n\r\n if (isMounted.current) {\r\n setLoading(false);\r\n }\r\n }\r\n if (isMounted.current) {\r\n onLayerAttached();\r\n resumeOutsideClick();\r\n }\r\n\r\n }, [activeViewport, backgroundLayers, isOverlay, onLayerAttached, overlayLayers, resumeOutsideClick]);\r\n\r\n const handleSelectFeaturesCancel = React.useCallback( () => {\r\n if (isMounted.current) {\r\n setLoading(false);\r\n }\r\n resumeOutsideClick();\r\n UiFramework.dialogs.modal.close();\r\n\r\n }, [resumeOutsideClick, setLoading]);\r\n\r\n const handleSelectFeaturesOk = React.useCallback((source: MapLayerSource, sourceSubLayers: MapSubLayerProps[], selectedSubLayers: MapSubLayerProps[] ) => {\r\n // keep only visible subLayers\r\n const visibleSubLayers = selectedSubLayers.filter((value) => value.visible);\r\n\r\n // Re-apply default visibility from the source validation\r\n visibleSubLayers.forEach((visible) => {\r\n const found = sourceSubLayers.find((value) => {visible.name === value.name;});\r\n if (found)\r\n visible.visible = found?.visible;\r\n });\r\n attachLayer(source, visibleSubLayers, true);\r\n\r\n }, [attachLayer]);\r\n\r\n const openFeatureSelectionDialog = React.useCallback((subLayers: MapSubLayerProps[], source: MapLayerSource ) => {\r\n // Keep leafs sub-layers and force default visibility to false\r\n const noGroupLayers = subLayers.filter((value: MapSubLayerProps) => value.children === undefined);\r\n const visibleLayers = noGroupLayers.map((value: MapSubLayerProps) => {return {...value, visible: false};});\r\n UiFramework.dialogs.modal.open(\r\n <MapSelectFeaturesDialog\r\n handleOk={(selectedLayers) => {handleSelectFeaturesOk(source, subLayers, selectedLayers);}}\r\n handleCancel={handleSelectFeaturesCancel}\r\n source={source}\r\n subLayers={visibleLayers}/>);\r\n }, [handleSelectFeaturesCancel, handleSelectFeaturesOk]);\r\n\r\n const needsFeatureSelection = React.useCallback((source: MapLayerSource, validation: MapLayerSourceValidation ) => {\r\n return (source.formatId === \"ArcGISFeature\" || source.formatId === \"WMTS\") // TODO, replace this with a flag in MapLayerSourceStatus\r\n && validation.subLayers\r\n && validation.subLayers.length > 1;\r\n }, []);\r\n\r\n const handleModalUrlDialogOk = React.useCallback((action: LayerAction, sourceState?: SourceState) => {\r\n UiFramework.dialogs.modal.close();\r\n if (LayerAction.New === action\r\n && sourceState\r\n && (sourceState.validation.status === MapLayerSourceStatus.Valid)) {\r\n if (needsFeatureSelection(sourceState.source, sourceState.validation)) {\r\n openFeatureSelectionDialog(sourceState.validation.subLayers!, sourceState.source);\r\n } else {\r\n attachLayer(sourceState.source, sourceState.validation.subLayers, false);\r\n }\r\n } else {\r\n resumeOutsideClick();\r\n }\r\n }, [attachLayer, needsFeatureSelection, openFeatureSelectionDialog, resumeOutsideClick]);\r\n\r\n const handleModalUrlDialogCancel = React.useCallback(() => {\r\n // close popup and refresh UI\r\n setLoading(false);\r\n UiFramework.dialogs.modal.close();\r\n resumeOutsideClick();\r\n }, [setLoading, resumeOutsideClick]);\r\n\r\n React.useEffect(() => {\r\n async function attemptToAddLayer() {\r\n if (layerNameToAdd && activeViewport) {\r\n // if the layer is not in the style add it now.\r\n const foundSource = sources?.find((source) => source.name === layerNameToAdd);\r\n if (foundSource === undefined) {\r\n return;\r\n }\r\n\r\n try {\r\n if (isMounted.current) {\r\n setLoading(true);\r\n }\r\n\r\n const sourceValidation = await foundSource.validateSource();\r\n if (sourceValidation.status === MapLayerSourceStatus.Valid || sourceValidation.status === MapLayerSourceStatus.RequireAuth) {\r\n if (sourceValidation.status === MapLayerSourceStatus.Valid) {\r\n if (sourceValidation.subLayers && needsFeatureSelection(foundSource, sourceValidation)) {\r\n openFeatureSelectionDialog(sourceValidation.subLayers, foundSource);\r\n if (onHandleOutsideClick) {\r\n onHandleOutsideClick(false);\r\n }\r\n } else {\r\n attachLayer(foundSource, sourceValidation.subLayers, false);\r\n }\r\n } else if (sourceValidation.status === MapLayerSourceStatus.RequireAuth && isMounted.current) {\r\n const layer = foundSource.toLayerSettings();\r\n if (layer) {\r\n UiFramework.dialogs.modal.open(\r\n <MapUrlDialog\r\n activeViewport={activeViewport}\r\n isOverlay={isOverlay}\r\n signInModeArgs={{layer, validation: sourceValidation, source: foundSource}}\r\n onOkResult={(sourceState?: SourceState) => handleModalUrlDialogOk(LayerAction.New, sourceState)}\r\n onCancelResult={handleModalUrlDialogCancel}\r\n mapLayerOptions={mapLayerOptions} />\r\n );\r\n }\r\n\r\n if (onHandleOutsideClick) {\r\n onHandleOutsideClick(false);\r\n }\r\n }\r\n\r\n } else {\r\n const msg = IModelApp.localization.getLocalizedString(\"mapLayers:Messages.MapLayerValidationFailed\", { sourceUrl: foundSource.url });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\r\n if (isMounted.current) {\r\n setLoading(false);\r\n }\r\n }\r\n } catch (err) {\r\n if (isMounted.current) {\r\n setLoading(false);\r\n }\r\n const msg = IModelApp.localization.getLocalizedString(\"mapLayers:Messages.MapLayerAttachError\", { error: err, sourceName: foundSource.name });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\r\n }\r\n }\r\n return;\r\n }\r\n\r\n attemptToAddLayer(); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n\r\n if (isMounted.current) {\r\n setLayerNameToAdd(undefined);\r\n }\r\n }, [attachLayer, needsFeatureSelection, setLayerNameToAdd, layerNameToAdd, activeViewport, sources, backgroundLayers, isOverlay, overlayLayers, onLayerAttached, handleModalUrlDialogOk, handleSelectFeaturesCancel, handleSelectFeaturesOk, handleModalUrlDialogCancel, onHandleOutsideClick, openFeatureSelectionDialog, mapLayerOptions]);\r\n\r\n const options = React.useMemo(() => sources, [sources]);\r\n\r\n const filteredOptions = React.useMemo(() => {\r\n if (undefined === sourceFilterString || 0 === sourceFilterString.length) {\r\n return options;\r\n } else {\r\n return options?.filter((option) => option.name.toLowerCase().includes(sourceFilterString?.toLowerCase()));\r\n }\r\n }, [options, sourceFilterString]);\r\n\r\n const handleAddNewMapSource = React.useCallback(() => {\r\n UiFramework.dialogs.modal.open(<MapUrlDialog\r\n activeViewport={activeViewport}\r\n isOverlay={isOverlay}\r\n onOkResult={(result?: SourceState) => handleModalUrlDialogOk(LayerAction.New, result)}\r\n onCancelResult={handleModalUrlDialogCancel}\r\n mapLayerOptions={mapLayerOptions} />);\r\n if (onHandleOutsideClick) {\r\n onHandleOutsideClick(false);\r\n }\r\n return;\r\n }, [activeViewport, handleModalUrlDialogCancel, handleModalUrlDialogOk, isOverlay, mapLayerOptions, onHandleOutsideClick]);\r\n\r\n const handleAttach = React.useCallback((mapName: string) => {\r\n setLayerNameToAdd(mapName);\r\n }, []);\r\n\r\n const handleKeypressOnSourceList = React.useCallback((event: React.KeyboardEvent<HTMLUListElement>) => {\r\n const key = event.key;\r\n if (key === \"Enter\") {\r\n event.preventDefault();\r\n const mapName = event.currentTarget?.dataset?.value;\r\n if (mapName && mapName.length) {\r\n handleAttach(mapName);\r\n }\r\n }\r\n }, [handleAttach]);\r\n\r\n const onListboxValueChange = React.useCallback((mapName: string) => {\r\n setLayerNameToAdd(mapName);\r\n }, []);\r\n\r\n const handleNoConfirmation = React.useCallback((_layerName: string) => {\r\n UiFramework.dialogs.modal.close();\r\n resumeOutsideClick();\r\n }, [resumeOutsideClick]);\r\n\r\n const handleYesConfirmation = React.useCallback(async (source: MapLayerSource) => {\r\n const layerName = source.name;\r\n if (!!iTwinId) {\r\n try {\r\n await MapLayerPreferences.deleteByName(source, iTwinId, iModelId);\r\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.RemoveLayerDefSuccess\", { layerName });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, msg));\r\n } catch (err: any) {\r\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.RemoveLayerDefError\", { layerName });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\r\n }\r\n }\r\n\r\n UiFramework.dialogs.modal.close();\r\n resumeOutsideClick();\r\n }, [iTwinId, iModelId, resumeOutsideClick]);\r\n\r\n /*\r\n Handle Remove layer button clicked\r\n */\r\n const onItemRemoveButtonClicked = React.useCallback((source, event) => {\r\n event.stopPropagation(); // We don't want the owning ListBox to react on mouse click.\r\n\r\n const layerName = source.name;\r\n\r\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.RemoveLayerDefDialogMessage\", { layerName });\r\n UiFramework.dialogs.modal.open(\r\n <ConfirmMessageDialog\r\n className=\"map-sources-delete-confirmation\"\r\n title={removeLayerDefDialogTitle}\r\n message={msg}\r\n maxWidth={400}\r\n onClose={() => handleNoConfirmation(layerName)}\r\n onEscape={() => handleNoConfirmation(layerName)}\r\n onYesResult={async () => handleYesConfirmation(source)}\r\n onNoResult={() => handleNoConfirmation(layerName)}\r\n />\r\n );\r\n if (onHandleOutsideClick) {\r\n onHandleOutsideClick(false);\r\n }\r\n }, [handleNoConfirmation, handleYesConfirmation, onHandleOutsideClick, removeLayerDefDialogTitle]);\r\n\r\n /*\r\n Handle Edit layer button clicked\r\n */\r\n const onItemEditButtonClicked = React.useCallback((event) => {\r\n event.stopPropagation(); // We don't want the owning ListBox to react on mouse click.\r\n\r\n const targetLayerName = event?.currentTarget?.parentNode?.dataset?.value;\r\n const matchingSource = sources.find((layerSource) => layerSource.name === targetLayerName);\r\n\r\n // we expect a single layer source matching this name\r\n if (matchingSource === undefined) {\r\n return;\r\n }\r\n UiFramework.dialogs.modal.open(<MapUrlDialog\r\n activeViewport={activeViewport}\r\n isOverlay={isOverlay}\r\n mapLayerSourceToEdit={matchingSource}\r\n onOkResult={(result?: SourceState) => handleModalUrlDialogOk(LayerAction.Edit, result)}\r\n onCancelResult={handleModalUrlDialogCancel}\r\n mapLayerOptions={mapLayerOptions} />);\r\n\r\n if (onHandleOutsideClick) {\r\n onHandleOutsideClick(false);\r\n }\r\n }, [activeViewport, handleModalUrlDialogCancel, handleModalUrlDialogOk, isOverlay, mapLayerOptions, onHandleOutsideClick, sources]);\r\n\r\n return (\r\n <div className=\"map-manager-header\">\r\n {(loading || loadingSources) && <UiCore.LoadingSpinner message={loadingMapSources} />}\r\n <div className=\"map-manager-source-listbox-header\">\r\n <Input type=\"text\" className=\"map-manager-source-list-filter\"\r\n placeholder={placeholderLabel}\r\n value={sourceFilterString}\r\n onChange={handleFilterTextChanged}\r\n size=\"small\" />\r\n <Button className=\"map-manager-add-source-button\" title={addCustomLayerToolTip} onClick={handleAddNewMapSource}>\r\n {addCustomLayerLabel}</Button>\r\n </div>\r\n <div className=\"map-manager-sources\">\r\n <UiCore.Listbox\r\n id=\"map-sources\"\r\n selectedValue={layerNameToAdd}\r\n className=\"map-manager-source-list\"\r\n onKeyPress={handleKeypressOnSourceList}\r\n onListboxValueChange={onListboxValueChange} >\r\n {\r\n filteredOptions?.map((source) =>\r\n <UiCore.ListboxItem\r\n key={source.name}\r\n className=\"map-source-list-entry\"\r\n value={source.name}\r\n onMouseEnter={() => setLayerNameUnderCursor(source.name)}\r\n onMouseLeave={() => setLayerNameUnderCursor(undefined)}>\r\n <span className=\"map-source-list-entry-name\" title={source.name}>{source.name}</span>\r\n\r\n { // Display the delete icon only when the mouse over a specific item\r\n // otherwise list feels cluttered.\r\n (!!iTwinId && layerNameUnderCursor && layerNameUnderCursor === source.name) &&\r\n <>\r\n <Button\r\n size=\"small\"\r\n styleType=\"borderless\"\r\n className=\"map-source-list-entry-button\"\r\n title={editLayerDefButtonTitle}\r\n onClick={onItemEditButtonClicked}>\r\n <UiCore.Icon iconSpec=\"icon-edit\" />\r\n </Button>\r\n <Button\r\n size=\"small\"\r\n styleType=\"borderless\"\r\n className=\"map-source-list-entry-button\"\r\n title={removeLayerDefButtonTitle}\r\n onClick={(event: React.MouseEvent) => { onItemRemoveButtonClicked(source, event); }}>\r\n <UiCore.Icon iconSpec=\"icon-delete\" />\r\n </Button>\r\n </>}\r\n\r\n </UiCore.ListboxItem>\r\n )\r\n }\r\n </UiCore.Listbox>\r\n </div>\r\n </div>\r\n\r\n );\r\n}\r\n\r\n/** @internal */\r\nexport enum AttachLayerButtonType {\r\n Primary,\r\n Blue,\r\n Icon\r\n}\r\nexport interface AttachLayerPopupButtonProps {\r\n isOverlay: boolean;\r\n buttonType?: AttachLayerButtonType;\r\n disabled?: boolean;\r\n}\r\n\r\n/** @internal */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function AttachLayerPopupButton(props: AttachLayerPopupButtonProps) {\r\n const { showAttachLayerLabel, hideAttachLayerLabel, addCustomLayerButtonLabel } = React.useMemo(() => {\r\n return {\r\n showAttachLayerLabel: MapLayersUI.localization.getLocalizedString(\"mapLayers:AttachLayerPopup.Attach\"),\r\n hideAttachLayerLabel: MapLayersUI.localization.getLocalizedString(\"mapLayers:AttachLayerPopup.Close\"),\r\n addCustomLayerButtonLabel: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.AddCustomLayerButtonLabel\"),\r\n };\r\n }, []);\r\n\r\n const [handleOutsideClick, setHandleOutsideClick] = React.useState(true);\r\n const [popupOpen, setPopupOpen] = React.useState(false);\r\n const buttonRef = React.useRef<HTMLButtonElement>(null);\r\n const panelRef = React.useRef<HTMLDivElement>(null);\r\n\r\n // 'isMounted' is used to prevent any async operation once the hook has been\r\n // unloaded. Otherwise we get a 'Can't perform a React state update on an unmounted component.' warning in the console.\r\n const isMounted = React.useRef(false);\r\n React.useEffect(() => {\r\n isMounted.current = true;\r\n return () => {\r\n isMounted.current = false;\r\n };\r\n }, []);\r\n\r\n const togglePopup = React.useCallback(() => {\r\n setPopupOpen(!popupOpen);\r\n }, [popupOpen]);\r\n\r\n const handleClosePopup = React.useCallback(() => {\r\n setPopupOpen(false);\r\n }, []);\r\n\r\n const onHandleOutsideClick = React.useCallback((event: MouseEvent) => {\r\n if (!handleOutsideClick) {\r\n return;\r\n }\r\n\r\n // If clicking on button that open panel - don't trigger outside click processing\r\n if (buttonRef?.current && buttonRef?.current.contains(event.target as Node)) {\r\n return;\r\n }\r\n\r\n // If clicking the panel, this is not an outside clicked\r\n if (panelRef.current && panelRef?.current.contains(event.target as Node)) {\r\n return;\r\n }\r\n\r\n // If we reach this point, we got an outside clicked, no close the popup\r\n setPopupOpen(false);\r\n\r\n }, [handleOutsideClick]);\r\n\r\n const { refreshFromStyle } = useSourceMapContext();\r\n\r\n const handleLayerAttached = React.useCallback(() => {\r\n if (!isMounted.current) {\r\n return;\r\n }\r\n setPopupOpen(false);\r\n refreshFromStyle();\r\n }, [refreshFromStyle]);\r\n\r\n function renderButton(): React.ReactNode {\r\n let button: React.ReactNode;\r\n\r\n if (props.buttonType === undefined || props.buttonType === AttachLayerButtonType.Icon) {\r\n button = (\r\n <IconButton disabled={props.disabled} size=\"small\" styleType=\"borderless\" ref={buttonRef} className=\"map-manager-attach-layer-button\" title={popupOpen ? hideAttachLayerLabel : showAttachLayerLabel}\r\n onClick={togglePopup}>\r\n <SvgAdd/>\r\n </IconButton>\r\n );\r\n } else {\r\n const determineStyleType = () => {\r\n switch (props.buttonType) {\r\n case AttachLayerButtonType.Blue:\r\n return \"high-visibility\";\r\n case AttachLayerButtonType.Primary:\r\n default:\r\n return \"cta\";\r\n }\r\n };\r\n const styleType = determineStyleType();\r\n button = (\r\n <Button disabled={props.disabled} ref={buttonRef} styleType={styleType} title={popupOpen ? hideAttachLayerLabel : showAttachLayerLabel}\r\n onClick={togglePopup}>{addCustomLayerButtonLabel}</Button>\r\n );\r\n }\r\n\r\n return button;\r\n }\r\n\r\n return (\r\n <>\r\n {renderButton()}\r\n <UiCore.Popup\r\n isOpen={popupOpen}\r\n position={RelativePosition.BottomRight}\r\n onClose={handleClosePopup}\r\n onOutsideClick={onHandleOutsideClick}\r\n closeOnWheel={false}\r\n target={buttonRef.current}\r\n closeOnEnter={false}\r\n closeOnContextMenu={false}\r\n >\r\n <div ref={panelRef} className=\"map-sources-popup-panel\" >\r\n <AttachLayerPanel\r\n isOverlay={props.isOverlay}\r\n onLayerAttached={handleLayerAttached}\r\n onHandleOutsideClick={setHandleOutsideClick} />\r\n </div>\r\n </UiCore.Popup >\r\n </>\r\n );\r\n}\r\n"]}
1
+ {"version":3,"file":"AttachLayerPopupButton.js","sourceRoot":"","sources":["../../../../src/ui/widget/AttachLayerPopupButton.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;gGAGgG;AAChG,6CAA+B;AAC/B,0DAAyD;AACzD,oDAAiD;AACjD,wDAAoI;AACpI,0DAA4C;AAC5C,oEAAoD;AACpD,wDAAiE;AACjE,mEAAgE;AAChE,+CAA8C;AAC9C,iEAA8D;AAC9D,uDAAwD;AACxD,uEAAoE;AACpE,iDAA8C;AAK9C,mCAAmC;AAEnC,IAAK,WAGJ;AAHD,WAAK,WAAW;IACd,2CAAG,CAAA;IACH,6CAAI,CAAA;AACN,CAAC,EAHI,WAAW,KAAX,WAAW,QAGf;AAQD,gEAAgE;AAChE,SAAS,gBAAgB,CAAC,EAAE,SAAS,EAAE,eAAe,EAAE,oBAAoB,EAAyB;IACnG,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAsB,CAAC;IACjF,MAAM,CAAC,kBAAkB,EAAE,qBAAqB,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAsB,CAAC;IAEzF,MAAM,EACJ,gBAAgB,EAChB,mBAAmB,EACnB,qBAAqB,EACrB,iBAAiB,EACjB,yBAAyB,EACzB,uBAAuB,EACvB,yBAAyB,GAC1B,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE;QACrB,OAAO;YACL,gBAAgB,EAAE,uBAAW,CAAC,YAAY,CAAC,kBAAkB,CAAC,0CAA0C,CAAC;YACzG,mBAAmB,EAAE,uBAAW,CAAC,YAAY,CAAC,kBAAkB,CAAC,+BAA+B,CAAC;YACjG,qBAAqB,EAAE,uBAAW,CAAC,YAAY,CAAC,kBAAkB,CAAC,0CAA0C,CAAC;YAC9G,iBAAiB,EA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9D,OAAO,EAAE,WAAW,YAEpB,uBAAC,4BAAM,KAAG,GACC,CACd,CAAC;SACH;aAAM;YACL,MAAM,kBAAkB,GAAG,GAAG,EAAE;gBAC9B,QAAQ,KAAK,CAAC,UAAU,EAAE;oBACxB,KAAK,qBAAqB,CAAC,IAAI;wBAC7B,OAAO,iBAAiB,CAAC;oBAC3B,KAAK,qBAAqB,CAAC,OAAO,CAAC;oBACnC;wBACE,OAAO,KAAK,CAAC;iBAChB;YACH,CAAC,CAAC;YACF,MAAM,SAAS,GAAG,kBAAkB,EAAE,CAAC;YACvC,MAAM,GAAG,CACP,uBAAC,sBAAM,IACL,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,GAAG,EAAE,SAAS,EACd,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,oBAAoB,EAC9D,OAAO,EAAE,WAAW,YAEnB,yBAAyB,GACnB,CACV,CAAC;SACH;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,OAAO,CACL,6DACG,YAAY,EAAE,EACf,uBAAC,MAAM,CAAC,KAAK,IACX,MAAM,EAAE,SAAS,EACjB,QAAQ,EAAE,iCAAgB,CAAC,WAAW,EACtC,OAAO,EAAE,gBAAgB,EACzB,cAAc,EAAE,oBAAoB,EACpC,YAAY,EAAE,KAAK,EACnB,MAAM,EAAE,SAAS,CAAC,OAAO,EACzB,YAAY,EAAE,KAAK,EACnB,kBAAkB,EAAE,KAAK,YAEzB,gCAAK,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAC,yBAAyB,YACrD,uBAAC,gBAAgB,IAAC,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,eAAe,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,qBAAqB,GAAI,GAC/H,GACO,IACd,CACJ,CAAC;AACJ,CAAC;AA/HD,wDA+HC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\nimport * as React from \"react\";\nimport { RelativePosition } from \"@itwin/appui-abstract\";\nimport { UiFramework } from \"@itwin/appui-react\";\nimport { IModelApp, MapLayerSource, MapLayerSourceStatus, NotifyMessageDetails, OutputMessagePriority } from \"@itwin/core-frontend\";\nimport * as UiCore from \"@itwin/core-react\";\nimport { SvgAdd } from \"@itwin/itwinui-icons-react\";\nimport { Button, IconButton, Input } from \"@itwin/itwinui-react\";\nimport { MapLayerPreferences } from \"../../MapLayerPreferences\";\nimport { MapLayersUI } from \"../../mapLayers\";\nimport { ConfirmMessageDialog } from \"./ConfirmMessageDialog\";\nimport { useSourceMapContext } from \"./MapLayerManager\";\nimport { MapSelectFeaturesDialog } from \"./MapSelectFeaturesDialog\";\nimport { MapUrlDialog } from \"./MapUrlDialog\";\n\nimport type { MapSubLayerProps } from \"@itwin/core-common\";\nimport type { MapLayerSourceValidation } from \"@itwin/core-frontend\";\nimport type { SourceState } from \"./MapUrlDialog\";\n// cSpell:ignore droppable Sublayer\n\nenum LayerAction {\n New,\n Edit,\n}\n\ninterface AttachLayerPanelProps {\n isOverlay: boolean;\n onLayerAttached: () => void;\n onHandleOutsideClick?: (shouldHandle: boolean) => void;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nfunction AttachLayerPanel({ isOverlay, onLayerAttached, onHandleOutsideClick }: AttachLayerPanelProps) {\n const [layerNameToAdd, setLayerNameToAdd] = React.useState<string | undefined>();\n const [sourceFilterString, setSourceFilterString] = React.useState<string | undefined>();\n\n const {\n placeholderLabel,\n addCustomLayerLabel,\n addCustomLayerToolTip,\n loadingMapSources,\n removeLayerDefButtonTitle,\n editLayerDefButtonTitle,\n removeLayerDefDialogTitle,\n } = React.useMemo(() => {\n return {\n placeholderLabel: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.SearchPlaceholder\"),\n addCustomLayerLabel: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.Custom\"),\n addCustomLayerToolTip: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.AttachCustomLayer\"),\n loadingMapSources: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.LoadingMapSources\"),\n removeLayerDefButtonTitle: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.RemoveLayerDefButtonTitle\"),\n editLayerDefButtonTitle: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.EditLayerDefButtonTitle\"),\n removeLayerDefDialogTitle: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.RemoveLayerDefDialogTitle\"),\n };\n }, []);\n\n const [loading, setLoading] = React.useState(false);\n const [layerNameUnderCursor, setLayerNameUnderCursor] = React.useState<string | undefined>();\n\n const resumeOutsideClick = React.useCallback(() => {\n if (onHandleOutsideClick) {\n onHandleOutsideClick(true);\n }\n }, [onHandleOutsideClick]);\n\n // 'isMounted' is used to prevent any async operation once the hook has been\n // unloaded. Otherwise we get a 'Can't perform a React state update on an unmounted component.' warning in the console.\n const isMounted = React.useRef(false);\n React.useEffect(() => {\n isMounted.current = true;\n return () => {\n isMounted.current = false;\n\n // We close any open dialogs that we might have opened\n // This was added because the modal dialog remained remained displayed after the session expired.\n UiFramework.dialogs.modal.close();\n };\n }, []);\n\n const handleFilterTextChanged = React.useCallback((event: React.ChangeEvent<HTMLInputElement>) => {\n setSourceFilterString(event.target.value);\n }, []);\n\n const { loadingSources, sources, activeViewport, backgroundLayers, overlayLayers, mapLayerOptions } = useSourceMapContext();\n const iTwinId = activeViewport?.iModel?.iTwinId;\n const iModelId = activeViewport?.iModel?.iModelId;\n\n const attachLayer = React.useCallback(\n (source: MapLayerSource, subLayers: MapSubLayerProps[] | undefined, oneMapLayerPerSubLayer: boolean) => {\n if (activeViewport) {\n const generateUniqueMapLayerName = (layerName: string) => {\n let uniqueLayerName = layerName;\n let layerNameIdx = 1;\n while (\n (backgroundLayers && backgroundLayers.some((layer) => uniqueLayerName === layer.name)) ||\n (overlayLayers && overlayLayers.some((layer) => uniqueLayerName === layer.name))\n ) {\n uniqueLayerName = `${layerName} (${layerNameIdx++})`;\n }\n return { layerNameUpdate: layerNameIdx > 1, uniqueLayerName };\n };\n\n const doAttachLayer = (layerName: string, subLayer?: MapSubLayerProps) => {\n const generatedName = generateUniqueMapLayerName(layerName);\n let sourceToAdd = source;\n if (generatedName.layerNameUpdate || sourceToAdd.name !== generatedName.uniqueLayerName) {\n // create a source with a unique name\n const clonedSource = MapLayerSource.fromJSON({ ...source.toJSON(), name: generatedName.uniqueLayerName });\n if (clonedSource !== undefined) {\n clonedSource.userName = source.userName;\n clonedSource.password = source.password;\n clonedSource.unsavedQueryParams = { ...source.unsavedQueryParams };\n clonedSource.savedQueryParams = { ...source.savedQueryParams };\n sourceToAdd = clonedSource;\n }\n }\n\n const settings = sourceToAdd.toLayerSettings(subLayer ? [subLayer] : subLayers);\n if (settings) {\n activeViewport.displayStyle.attachMapLayer({ settings, mapLayerIndex: { index: -1, isOverlay } });\n return generatedName.uniqueLayerName;\n }\n return undefined;\n };\n\n if (oneMapLayerPerSubLayer && subLayers) {\n const layerNamesAttached: string[] = [];\n for (const subLayer of subLayers) {\n const attachedLayerName = doAttachLayer(`${source.name} - ${subLayer.name}`, subLayer);\n if (attachedLayerName !== undefined) {\n layerNamesAttached.push(attachedLayerName);\n }\n }\n\n if (layerNamesAttached.length > 0) {\n const msg = IModelApp.localization.getLocalizedString(\"mapLayers:Messages.MapLayersAttached\", { layerNames: layerNamesAttached.join(\", \") });\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, msg));\n }\n } else {\n const attachedLayerName = doAttachLayer(source.name, undefined);\n if (attachedLayerName !== undefined) {\n const msg = IModelApp.localization.getLocalizedString(\"mapLayers:Messages.MapLayerAttached\", { sourceName: attachedLayerName });\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, msg));\n }\n }\n\n if (isMounted.current) {\n setLoading(false);\n }\n }\n if (isMounted.current) {\n onLayerAttached();\n resumeOutsideClick();\n }\n },\n [activeViewport, backgroundLayers, isOverlay, onLayerAttached, overlayLayers, resumeOutsideClick],\n );\n\n const handleSelectFeaturesCancel = React.useCallback(() => {\n if (isMounted.current) {\n setLoading(false);\n }\n resumeOutsideClick();\n UiFramework.dialogs.modal.close();\n }, [resumeOutsideClick, setLoading]);\n\n const handleSelectFeaturesOk = React.useCallback(\n (source: MapLayerSource, sourceSubLayers: MapSubLayerProps[], selectedSubLayers: MapSubLayerProps[]) => {\n // keep only visible subLayers\n const visibleSubLayers = selectedSubLayers.filter((value) => value.visible);\n\n // Re-apply default visibility from the source validation\n visibleSubLayers.forEach((visible) => {\n const found = sourceSubLayers.find((value) => {\n visible.name === value.name;\n });\n if (found) {\n visible.visible = found?.visible;\n }\n });\n attachLayer(source, visibleSubLayers, true);\n },\n [attachLayer],\n );\n\n const openFeatureSelectionDialog = React.useCallback(\n (subLayers: MapSubLayerProps[], source: MapLayerSource) => {\n // Keep leafs sub-layers and force default visibility to false\n const noGroupLayers = subLayers.filter((value: MapSubLayerProps) => value.children === undefined);\n const visibleLayers = noGroupLayers.map((value: MapSubLayerProps) => {\n return { ...value, visible: false };\n });\n UiFramework.dialogs.modal.open(\n <MapSelectFeaturesDialog\n handleOk={(selectedLayers) => {\n handleSelectFeaturesOk(source, subLayers, selectedLayers);\n }}\n handleCancel={handleSelectFeaturesCancel}\n source={source}\n subLayers={visibleLayers}\n />,\n );\n },\n [handleSelectFeaturesCancel, handleSelectFeaturesOk],\n );\n\n const needsFeatureSelection = React.useCallback((source: MapLayerSource, validation: MapLayerSourceValidation) => {\n return (\n (source.formatId === \"ArcGISFeature\" || source.formatId === \"WMTS\") && // TODO, replace this with a flag in MapLayerSourceStatus\n validation.subLayers &&\n validation.subLayers.length > 1\n );\n }, []);\n\n const handleModalUrlDialogOk = React.useCallback(\n (action: LayerAction, sourceState?: SourceState) => {\n UiFramework.dialogs.modal.close();\n if (LayerAction.New === action && sourceState && sourceState.validation.status === MapLayerSourceStatus.Valid) {\n if (needsFeatureSelection(sourceState.source, sourceState.validation)) {\n openFeatureSelectionDialog(sourceState.validation.subLayers!, sourceState.source);\n } else {\n attachLayer(sourceState.source, sourceState.validation.subLayers, false);\n }\n } else {\n resumeOutsideClick();\n }\n },\n [attachLayer, needsFeatureSelection, openFeatureSelectionDialog, resumeOutsideClick],\n );\n\n const handleModalUrlDialogCancel = React.useCallback(() => {\n // close popup and refresh UI\n setLoading(false);\n UiFramework.dialogs.modal.close();\n resumeOutsideClick();\n }, [setLoading, resumeOutsideClick]);\n\n React.useEffect(() => {\n async function attemptToAddLayer() {\n if (layerNameToAdd && activeViewport) {\n // if the layer is not in the style add it now.\n const foundSource = sources?.find((source) => source.name === layerNameToAdd);\n if (foundSource === undefined) {\n return;\n }\n\n try {\n if (isMounted.current) {\n setLoading(true);\n }\n\n const sourceValidation = await foundSource.validateSource();\n if (sourceValidation.status === MapLayerSourceStatus.Valid || sourceValidation.status === MapLayerSourceStatus.RequireAuth) {\n if (sourceValidation.status === MapLayerSourceStatus.Valid) {\n if (sourceValidation.subLayers && needsFeatureSelection(foundSource, sourceValidation)) {\n openFeatureSelectionDialog(sourceValidation.subLayers, foundSource);\n if (onHandleOutsideClick) {\n onHandleOutsideClick(false);\n }\n } else {\n attachLayer(foundSource, sourceValidation.subLayers, false);\n }\n } else if (sourceValidation.status === MapLayerSourceStatus.RequireAuth && isMounted.current) {\n const layer = foundSource.toLayerSettings();\n if (layer) {\n UiFramework.dialogs.modal.open(\n <MapUrlDialog\n activeViewport={activeViewport}\n isOverlay={isOverlay}\n signInModeArgs={{ layer, validation: sourceValidation, source: foundSource }}\n onOkResult={(sourceState?: SourceState) => handleModalUrlDialogOk(LayerAction.New, sourceState)}\n onCancelResult={handleModalUrlDialogCancel}\n mapLayerOptions={mapLayerOptions}\n />,\n );\n }\n\n if (onHandleOutsideClick) {\n onHandleOutsideClick(false);\n }\n }\n } else {\n const msg = IModelApp.localization.getLocalizedString(\"mapLayers:Messages.MapLayerValidationFailed\", { sourceUrl: foundSource.url });\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\n if (isMounted.current) {\n setLoading(false);\n }\n }\n } catch (err) {\n if (isMounted.current) {\n setLoading(false);\n }\n const msg = IModelApp.localization.getLocalizedString(\"mapLayers:Messages.MapLayerAttachError\", { error: err, sourceName: foundSource.name });\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\n }\n }\n return;\n }\n\n attemptToAddLayer(); // eslint-disable-line @typescript-eslint/no-floating-promises\n\n if (isMounted.current) {\n setLayerNameToAdd(undefined);\n }\n }, [\n attachLayer,\n needsFeatureSelection,\n setLayerNameToAdd,\n layerNameToAdd,\n activeViewport,\n sources,\n backgroundLayers,\n isOverlay,\n overlayLayers,\n onLayerAttached,\n handleModalUrlDialogOk,\n handleSelectFeaturesCancel,\n handleSelectFeaturesOk,\n handleModalUrlDialogCancel,\n onHandleOutsideClick,\n openFeatureSelectionDialog,\n mapLayerOptions,\n ]);\n\n const options = React.useMemo(() => sources, [sources]);\n\n const filteredOptions = React.useMemo(() => {\n if (undefined === sourceFilterString || 0 === sourceFilterString.length) {\n return options;\n } else {\n return options?.filter((option) => option.name.toLowerCase().includes(sourceFilterString?.toLowerCase()));\n }\n }, [options, sourceFilterString]);\n\n const handleAddNewMapSource = React.useCallback(() => {\n UiFramework.dialogs.modal.open(\n <MapUrlDialog\n activeViewport={activeViewport}\n isOverlay={isOverlay}\n onOkResult={(result?: SourceState) => handleModalUrlDialogOk(LayerAction.New, result)}\n onCancelResult={handleModalUrlDialogCancel}\n mapLayerOptions={mapLayerOptions}\n />,\n );\n if (onHandleOutsideClick) {\n onHandleOutsideClick(false);\n }\n return;\n }, [activeViewport, handleModalUrlDialogCancel, handleModalUrlDialogOk, isOverlay, mapLayerOptions, onHandleOutsideClick]);\n\n const handleAttach = React.useCallback((mapName: string) => {\n setLayerNameToAdd(mapName);\n }, []);\n\n const handleKeypressOnSourceList = React.useCallback(\n (event: React.KeyboardEvent<HTMLUListElement>) => {\n const key = event.key;\n if (key === \"Enter\") {\n event.preventDefault();\n const mapName = event.currentTarget?.dataset?.value;\n if (mapName && mapName.length) {\n handleAttach(mapName);\n }\n }\n },\n [handleAttach],\n );\n\n const onListboxValueChange = React.useCallback((mapName: string) => {\n setLayerNameToAdd(mapName);\n }, []);\n\n const handleNoConfirmation = React.useCallback(\n (_layerName: string) => {\n UiFramework.dialogs.modal.close();\n resumeOutsideClick();\n },\n [resumeOutsideClick],\n );\n\n const handleYesConfirmation = React.useCallback(\n async (source: MapLayerSource) => {\n const layerName = source.name;\n if (!!iTwinId) {\n try {\n await MapLayerPreferences.deleteByName(source, iTwinId, iModelId);\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.RemoveLayerDefSuccess\", { layerName });\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, msg));\n } catch (err: any) {\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.RemoveLayerDefError\", { layerName });\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));\n }\n }\n\n UiFramework.dialogs.modal.close();\n resumeOutsideClick();\n },\n [iTwinId, iModelId, resumeOutsideClick],\n );\n\n /*\n Handle Remove layer button clicked\n */\n const onItemRemoveButtonClicked = React.useCallback(\n (source, event) => {\n event.stopPropagation(); // We don't want the owning ListBox to react on mouse click.\n\n const layerName = source.name;\n\n const msg = MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.RemoveLayerDefDialogMessage\", { layerName });\n UiFramework.dialogs.modal.open(\n <ConfirmMessageDialog\n className=\"map-sources-delete-confirmation\"\n title={removeLayerDefDialogTitle}\n message={msg}\n maxWidth={400}\n onClose={() => handleNoConfirmation(layerName)}\n onEscape={() => handleNoConfirmation(layerName)}\n onYesResult={async () => handleYesConfirmation(source)}\n onNoResult={() => handleNoConfirmation(layerName)}\n />,\n );\n if (onHandleOutsideClick) {\n onHandleOutsideClick(false);\n }\n },\n [handleNoConfirmation, handleYesConfirmation, onHandleOutsideClick, removeLayerDefDialogTitle],\n );\n\n /*\n Handle Edit layer button clicked\n */\n const onItemEditButtonClicked = React.useCallback(\n (event) => {\n event.stopPropagation(); // We don't want the owning ListBox to react on mouse click.\n\n const targetLayerName = event?.currentTarget?.parentNode?.dataset?.value;\n const matchingSource = sources.find((layerSource) => layerSource.name === targetLayerName);\n\n // we expect a single layer source matching this name\n if (matchingSource === undefined) {\n return;\n }\n UiFramework.dialogs.modal.open(\n <MapUrlDialog\n activeViewport={activeViewport}\n isOverlay={isOverlay}\n mapLayerSourceToEdit={matchingSource}\n onOkResult={(result?: SourceState) => handleModalUrlDialogOk(LayerAction.Edit, result)}\n onCancelResult={handleModalUrlDialogCancel}\n mapLayerOptions={mapLayerOptions}\n />,\n );\n\n if (onHandleOutsideClick) {\n onHandleOutsideClick(false);\n }\n },\n [activeViewport, handleModalUrlDialogCancel, handleModalUrlDialogOk, isOverlay, mapLayerOptions, onHandleOutsideClick, sources],\n );\n\n return (\n <div className=\"map-manager-header\">\n {(loading || loadingSources) && <UiCore.LoadingSpinner message={loadingMapSources} />}\n <div className=\"map-manager-source-listbox-header\">\n <Input\n type=\"text\"\n className=\"map-manager-source-list-filter\"\n placeholder={placeholderLabel}\n value={sourceFilterString}\n onChange={handleFilterTextChanged}\n size=\"small\"\n />\n <Button className=\"map-manager-add-source-button\" title={addCustomLayerToolTip} onClick={handleAddNewMapSource}>\n {addCustomLayerLabel}\n </Button>\n </div>\n <div className=\"map-manager-sources\">\n {/* eslint-disable-next-line @itwin/no-internal */}\n <UiCore.Listbox\n id=\"map-sources\"\n selectedValue={layerNameToAdd}\n className=\"map-manager-source-list\"\n onKeyPress={handleKeypressOnSourceList}\n onListboxValueChange={onListboxValueChange}\n >\n {filteredOptions?.map((source) => (\n // eslint-disable-next-line @itwin/no-internal\n <UiCore.ListboxItem\n key={source.name}\n className=\"map-source-list-entry\"\n value={source.name}\n onMouseEnter={() => setLayerNameUnderCursor(source.name)}\n onMouseLeave={() => setLayerNameUnderCursor(undefined)}\n >\n <span className=\"map-source-list-entry-name\" title={source.name}>\n {source.name}\n </span>\n\n {\n // Display the delete icon only when the mouse over a specific item\n // otherwise list feels cluttered.\n !!iTwinId && layerNameUnderCursor && layerNameUnderCursor === source.name && (\n <>\n <Button\n size=\"small\"\n styleType=\"borderless\"\n className=\"map-source-list-entry-button\"\n title={editLayerDefButtonTitle}\n onClick={onItemEditButtonClicked}\n >\n <UiCore.Icon iconSpec=\"icon-edit\" />\n </Button>\n <Button\n size=\"small\"\n styleType=\"borderless\"\n className=\"map-source-list-entry-button\"\n title={removeLayerDefButtonTitle}\n onClick={(event: React.MouseEvent) => {\n onItemRemoveButtonClicked(source, event);\n }}\n >\n <UiCore.Icon iconSpec=\"icon-delete\" />\n </Button>\n </>\n )\n }\n </UiCore.ListboxItem>\n ))}\n </UiCore.Listbox>\n </div>\n </div>\n );\n}\n\n/** @internal */\nexport enum AttachLayerButtonType {\n Primary,\n Blue,\n Icon,\n}\nexport interface AttachLayerPopupButtonProps {\n isOverlay: boolean;\n buttonType?: AttachLayerButtonType;\n disabled?: boolean;\n}\n\n/** @internal */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function AttachLayerPopupButton(props: AttachLayerPopupButtonProps) {\n const { showAttachLayerLabel, hideAttachLayerLabel, addCustomLayerButtonLabel } = React.useMemo(() => {\n return {\n showAttachLayerLabel: MapLayersUI.localization.getLocalizedString(\"mapLayers:AttachLayerPopup.Attach\"),\n hideAttachLayerLabel: MapLayersUI.localization.getLocalizedString(\"mapLayers:AttachLayerPopup.Close\"),\n addCustomLayerButtonLabel: MapLayersUI.localization.getLocalizedString(\"mapLayers:CustomAttach.AddCustomLayerButtonLabel\"),\n };\n }, []);\n\n const [handleOutsideClick, setHandleOutsideClick] = React.useState(true);\n const [popupOpen, setPopupOpen] = React.useState(false);\n const buttonRef = React.useRef<HTMLButtonElement>(null);\n const panelRef = React.useRef<HTMLDivElement>(null);\n\n // 'isMounted' is used to prevent any async operation once the hook has been\n // unloaded. Otherwise we get a 'Can't perform a React state update on an unmounted component.' warning in the console.\n const isMounted = React.useRef(false);\n React.useEffect(() => {\n isMounted.current = true;\n return () => {\n isMounted.current = false;\n };\n }, []);\n\n const togglePopup = React.useCallback(() => {\n setPopupOpen(!popupOpen);\n }, [popupOpen]);\n\n const handleClosePopup = React.useCallback(() => {\n setPopupOpen(false);\n }, []);\n\n const onHandleOutsideClick = React.useCallback(\n (event: MouseEvent) => {\n if (!handleOutsideClick) {\n return;\n }\n\n // If clicking on button that open panel - don't trigger outside click processing\n if (buttonRef?.current && buttonRef?.current.contains(event.target as Node)) {\n return;\n }\n\n // If clicking the panel, this is not an outside clicked\n if (panelRef.current && panelRef?.current.contains(event.target as Node)) {\n return;\n }\n\n // If we reach this point, we got an outside clicked, no close the popup\n setPopupOpen(false);\n },\n [handleOutsideClick],\n );\n\n const { refreshFromStyle } = useSourceMapContext();\n\n const handleLayerAttached = React.useCallback(() => {\n if (!isMounted.current) {\n return;\n }\n setPopupOpen(false);\n refreshFromStyle();\n }, [refreshFromStyle]);\n\n function renderButton(): React.ReactNode {\n let button: React.ReactNode;\n\n if (props.buttonType === undefined || props.buttonType === AttachLayerButtonType.Icon) {\n button = (\n <IconButton\n disabled={props.disabled}\n size=\"small\"\n styleType=\"borderless\"\n ref={buttonRef}\n className=\"map-manager-attach-layer-button\"\n title={popupOpen ? hideAttachLayerLabel : showAttachLayerLabel}\n onClick={togglePopup}\n >\n <SvgAdd />\n </IconButton>\n );\n } else {\n const determineStyleType = () => {\n switch (props.buttonType) {\n case AttachLayerButtonType.Blue:\n return \"high-visibility\";\n case AttachLayerButtonType.Primary:\n default:\n return \"cta\";\n }\n };\n const styleType = determineStyleType();\n button = (\n <Button\n disabled={props.disabled}\n ref={buttonRef}\n styleType={styleType}\n title={popupOpen ? hideAttachLayerLabel : showAttachLayerLabel}\n onClick={togglePopup}\n >\n {addCustomLayerButtonLabel}\n </Button>\n );\n }\n\n return button;\n }\n\n return (\n <>\n {renderButton()}\n <UiCore.Popup\n isOpen={popupOpen}\n position={RelativePosition.BottomRight}\n onClose={handleClosePopup}\n onOutsideClick={onHandleOutsideClick}\n closeOnWheel={false}\n target={buttonRef.current}\n closeOnEnter={false}\n closeOnContextMenu={false}\n >\n <div ref={panelRef} className=\"map-sources-popup-panel\">\n <AttachLayerPanel isOverlay={props.isOverlay} onLayerAttached={handleLayerAttached} onHandleOutsideClick={setHandleOutsideClick} />\n </div>\n </UiCore.Popup>\n </>\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"BasemapPanel.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/BasemapPanel.tsx"],"names":[],"mappings":";AAOA,OAAO,qBAAqB,CAAC;AAiB7B,UAAU,iBAAiB;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,gBAAgB;AAEhB,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,eA+PpD"}
1
+ {"version":3,"file":"BasemapPanel.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/BasemapPanel.tsx"],"names":[],"mappings":";AAOA,OAAO,qBAAqB,CAAC;AAkB7B,UAAU,iBAAiB;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,gBAAgB;AAEhB,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,eA2SpD"}
@@ -1,14 +1,38 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.BasemapPanel = void 0;
27
+ const jsx_runtime_1 = require("react/jsx-runtime");
2
28
  /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
- * See LICENSE.md in the project root for license terms and full copyright notice.
5
- *--------------------------------------------------------------------------------------------*/
29
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
30
+ * See LICENSE.md in the project root for license terms and full copyright notice.
31
+ *--------------------------------------------------------------------------------------------*/
6
32
  /* eslint-disable deprecation/deprecation */
7
33
  // cSpell:ignore droppable Sublayer Basemap
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.BasemapPanel = void 0;
10
34
  require("./BasemapPanel.scss");
11
- const React = require("react");
35
+ const React = __importStar(require("react"));
12
36
  const appui_react_1 = require("@itwin/appui-react");
13
37
  const core_common_1 = require("@itwin/core-common");
14
38
  const core_react_1 = require("@itwin/core-react");
@@ -81,15 +105,18 @@ function BasemapPanel(props) {
81
105
  const handleMapImageryChanged = React.useCallback((args) => {
82
106
  const baseMap = args.backgroundBase;
83
107
  // Optimization: If serialized 'backgroundBase' objects are identical, skip refresh
84
- if (JSON.stringify(baseMap.toJSON()) === JSON.stringify(selectedBaseMap?.toJSON()))
108
+ if (JSON.stringify(baseMap.toJSON()) === JSON.stringify(selectedBaseMap?.toJSON())) {
85
109
  return;
110
+ }
86
111
  setSelectedBaseMap(baseMap); // cache current base map objects
87
112
  updateBaseMapOptions(baseMap);
88
113
  if (baseMap instanceof core_common_1.ImageMapLayerSettings) {
89
- if (baseMap.transparency !== baseMapTransparencyValue)
114
+ if (baseMap.transparency !== baseMapTransparencyValue) {
90
115
  setBaseMapTransparencyValue(baseMap.transparency);
91
- if (baseMap.visible !== baseMapVisible)
116
+ }
117
+ if (baseMap.visible !== baseMapVisible) {
92
118
  setBaseMapVisible(baseMap.visible);
119
+ }
93
120
  }
94
121
  else if (baseMap instanceof core_common_1.ColorDef) {
95
122
  if (baseMap.getAlpha() !== baseMapTransparencyValue) {
@@ -122,9 +149,9 @@ function BasemapPanel(props) {
122
149
  }, [activeViewport]);
123
150
  // This effect is only to keep a custom base map option when a 'default' base map is picked.
124
151
  React.useEffect(() => {
125
- if (selectedBaseMap instanceof core_common_1.BaseMapLayerSettings
126
- && !selectedBaseMap.provider
127
- && undefined === baseMapOptions.find((opt) => opt.label === selectedBaseMap.name)) {
152
+ if (selectedBaseMap instanceof core_common_1.BaseMapLayerSettings &&
153
+ !selectedBaseMap.provider &&
154
+ undefined === baseMapOptions.find((opt) => opt.label === selectedBaseMap.name)) {
128
155
  setCustomBaseMap(selectedBaseMap);
129
156
  }
130
157
  }, [baseMapOptions, selectedBaseMap]);
@@ -139,8 +166,8 @@ function BasemapPanel(props) {
139
166
  core_common_1.ColorDef.create(core_common_1.ColorByName.darkBrown),
140
167
  ]);
141
168
  const baseIsColor = React.useMemo(() => selectedBaseMap instanceof core_common_1.ColorDef, [selectedBaseMap]);
142
- const baseIsMap = React.useMemo(() => !baseIsColor && (selectedBaseMap !== undefined), [baseIsColor, selectedBaseMap]);
143
- const bgColor = React.useMemo(() => baseIsColor ? selectedBaseMap.toJSON() : presetColors[0].toJSON(), [baseIsColor, selectedBaseMap, presetColors]);
169
+ const baseIsMap = React.useMemo(() => !baseIsColor && selectedBaseMap !== undefined, [baseIsColor, selectedBaseMap]);
170
+ const bgColor = React.useMemo(() => (baseIsColor ? selectedBaseMap.toJSON() : presetColors[0].toJSON()), [baseIsColor, selectedBaseMap, presetColors]);
144
171
  const [colorDialogTitle] = React.useState(mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:ColorDialog.Title"));
145
172
  const [selectedBaseMapValue, setSelectedBaseMapValue] = React.useState({ value: "", label: "" });
146
173
  React.useEffect(() => {
@@ -190,8 +217,8 @@ function BasemapPanel(props) {
190
217
  }, []);
191
218
  const handleBgColorClick = React.useCallback((newColor, e) => {
192
219
  e.preventDefault();
193
- appui_react_1.UiFramework.dialogs.modal.open(React.createElement(imodel_components_react_1.ColorPickerDialog, { dialogTitle: colorDialogTitle, color: newColor, colorPresets: presetColors, colorInputType: "rgb", onOkResult: handleBackgroundColorDialogOk, onCancelResult: handleBackgroundColorDialogCancel }));
194
- }, [presetColors, handleBackgroundColorDialogOk]); // eslint-disable-line react-hooks/exhaustive-deps
220
+ appui_react_1.UiFramework.dialogs.modal.open((0, jsx_runtime_1.jsx)(imodel_components_react_1.ColorPickerDialog, { dialogTitle: colorDialogTitle, color: newColor, colorPresets: presetColors, colorInputType: "rgb", onOkResult: handleBackgroundColorDialogOk, onCancelResult: handleBackgroundColorDialogCancel }));
221
+ }, [colorDialogTitle, presetColors, handleBackgroundColorDialogOk, handleBackgroundColorDialogCancel]); // eslint-disable-line react-hooks/exhaustive-deps
195
222
  const handleBaseMapSelection = React.useCallback((value) => {
196
223
  if (activeViewport && value) {
197
224
  if (value === customBaseMapValue && customBaseMap) {
@@ -229,15 +256,7 @@ function BasemapPanel(props) {
229
256
  const [baseLayerLabel] = React.useState(mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:Basemap.BaseLayer"));
230
257
  const [selectBaseMapLabel] = React.useState(mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:Basemap.SelectBaseMap"));
231
258
  const [toggleVisibility] = React.useState(mapLayers_1.MapLayersUI.localization.getLocalizedString("mapLayers:Widget.ToggleVisibility"));
232
- return (React.createElement(React.Fragment, null,
233
- React.createElement("span", { className: "map-manager-base-label" }, baseLayerLabel),
234
- React.createElement("div", { className: "map-manager-base-item" },
235
- React.createElement(itwinui_react_1.Button, { className: "map-manager-basemap-visibility map-manager-visibility-icon", size: "small", styleType: "borderless", title: toggleVisibility, onClick: handleVisibilityChange, disabled: props.disabled || !activeViewport || !(activeViewport.displayStyle.backgroundMapBase instanceof core_common_1.ImageMapLayerSettings) },
236
- React.createElement(core_react_1.WebFontIcon, { iconName: baseMapVisible ? "icon-visibility" : "icon-visibility-hide-2" })),
237
- React.createElement(itwinui_react_1.Select, { className: "map-manager-base-item-select", options: baseMapOptions, placeholder: selectBaseMapLabel, value: selectedBaseMapValue.value, onChange: handleBaseMapSelection, size: "small", disabled: props.disabled }),
238
- baseIsColor &&
239
- React.createElement(imodel_components_react_1.ColorSwatch, { className: "map-manager-base-item-color", colorDef: core_common_1.ColorDef.fromJSON(bgColor), round: false, onColorPick: handleBgColorClick }),
240
- React.createElement(TransparencyPopupButton_1.TransparencyPopupButton, { disabled: props.disabled, transparency: baseMapTransparencyValue, onTransparencyChange: handleBasemapTransparencyChange }))));
259
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("span", { className: "map-manager-base-label", children: baseLayerLabel }), (0, jsx_runtime_1.jsxs)("div", { className: "map-manager-base-item", children: [(0, jsx_runtime_1.jsx)(itwinui_react_1.Button, { className: "map-manager-basemap-visibility map-manager-visibility-icon", size: "small", styleType: "borderless", title: toggleVisibility, onClick: handleVisibilityChange, disabled: props.disabled || !activeViewport || !(activeViewport.displayStyle.backgroundMapBase instanceof core_common_1.ImageMapLayerSettings), children: (0, jsx_runtime_1.jsx)(core_react_1.WebFontIcon, { iconName: baseMapVisible ? "icon-visibility" : "icon-visibility-hide-2" }) }), (0, jsx_runtime_1.jsx)(itwinui_react_1.Select, { className: "map-manager-base-item-select", options: baseMapOptions, placeholder: selectBaseMapLabel, value: selectedBaseMapValue.value, onChange: handleBaseMapSelection, size: "small", disabled: props.disabled }), baseIsColor && ((0, jsx_runtime_1.jsx)(imodel_components_react_1.ColorSwatch, { className: "map-manager-base-item-color", colorDef: core_common_1.ColorDef.fromJSON(bgColor), round: false, onColorPick: handleBgColorClick })), (0, jsx_runtime_1.jsx)(TransparencyPopupButton_1.TransparencyPopupButton, { disabled: props.disabled, transparency: baseMapTransparencyValue, onTransparencyChange: handleBasemapTransparencyChange })] })] }));
241
260
  }
242
261
  exports.BasemapPanel = BasemapPanel;
243
262
  //# sourceMappingURL=BasemapPanel.js.map