@itwin/map-layers 5.6.2 → 6.0.0-dev.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 (223) hide show
  1. package/CHANGELOG.md +2 -2
  2. package/README.md +2 -0
  3. package/lib/cjs/BrowserStorage.js.map +1 -1
  4. package/lib/cjs/CustomParamUtils.js.map +1 -1
  5. package/lib/cjs/MapLayerPreferences.d.ts +2 -2
  6. package/lib/cjs/MapLayerPreferences.d.ts.map +1 -1
  7. package/lib/cjs/MapLayerPreferences.js +4 -4
  8. package/lib/cjs/MapLayerPreferences.js.map +1 -1
  9. package/lib/cjs/MapLayersActionIds.js +1 -1
  10. package/lib/cjs/MapLayersActionIds.js.map +1 -1
  11. package/lib/cjs/PreferencesBrowserStorage.js.map +1 -1
  12. package/lib/cjs/ui/FeatureInfoUiItemsProvider.d.ts +6 -7
  13. package/lib/cjs/ui/FeatureInfoUiItemsProvider.d.ts.map +1 -1
  14. package/lib/cjs/ui/FeatureInfoUiItemsProvider.js +26 -22
  15. package/lib/cjs/ui/FeatureInfoUiItemsProvider.js.map +1 -1
  16. package/lib/cjs/ui/Interfaces.d.ts +1 -1
  17. package/lib/cjs/ui/Interfaces.d.ts.map +1 -1
  18. package/lib/cjs/ui/MapLayersUiItemsProvider.js.map +1 -1
  19. package/lib/cjs/ui/widget/AttachLayerPopupButton.d.ts +1 -2
  20. package/lib/cjs/ui/widget/AttachLayerPopupButton.d.ts.map +1 -1
  21. package/lib/cjs/ui/widget/AttachLayerPopupButton.js +10 -26
  22. package/lib/cjs/ui/widget/AttachLayerPopupButton.js.map +1 -1
  23. package/lib/cjs/ui/widget/BasemapPanel.d.ts +1 -2
  24. package/lib/cjs/ui/widget/BasemapPanel.d.ts.map +1 -1
  25. package/lib/cjs/ui/widget/BasemapPanel.js +14 -25
  26. package/lib/cjs/ui/widget/BasemapPanel.js.map +1 -1
  27. package/lib/cjs/ui/widget/ConfirmMessageDialog.d.ts +7 -8
  28. package/lib/cjs/ui/widget/ConfirmMessageDialog.d.ts.map +1 -1
  29. package/lib/cjs/ui/widget/ConfirmMessageDialog.js +16 -9
  30. package/lib/cjs/ui/widget/ConfirmMessageDialog.js.map +1 -1
  31. package/lib/cjs/ui/widget/CustomParamEditDialog.d.ts +1 -2
  32. package/lib/cjs/ui/widget/CustomParamEditDialog.d.ts.map +1 -1
  33. package/lib/cjs/ui/widget/CustomParamEditDialog.js +1 -3
  34. package/lib/cjs/ui/widget/CustomParamEditDialog.js.map +1 -1
  35. package/lib/cjs/ui/widget/CustomParamsSettings.d.ts +1 -2
  36. package/lib/cjs/ui/widget/CustomParamsSettings.d.ts.map +1 -1
  37. package/lib/cjs/ui/widget/CustomParamsSettings.js +2 -10
  38. package/lib/cjs/ui/widget/CustomParamsSettings.js.map +1 -1
  39. package/lib/cjs/ui/widget/CustomParamsSettings.scss +2 -0
  40. package/lib/cjs/ui/widget/FeatureInfoDataProvider.js.map +1 -1
  41. package/lib/cjs/ui/widget/FeatureInfoWidget.d.ts +1 -2
  42. package/lib/cjs/ui/widget/FeatureInfoWidget.d.ts.map +1 -1
  43. package/lib/cjs/ui/widget/FeatureInfoWidget.js +7 -6
  44. package/lib/cjs/ui/widget/FeatureInfoWidget.js.map +1 -1
  45. package/lib/cjs/ui/widget/MapLayerActionButtons.d.ts +1 -2
  46. package/lib/cjs/ui/widget/MapLayerActionButtons.d.ts.map +1 -1
  47. package/lib/cjs/ui/widget/MapLayerActionButtons.js +2 -2
  48. package/lib/cjs/ui/widget/MapLayerActionButtons.js.map +1 -1
  49. package/lib/cjs/ui/widget/MapLayerDroppable.d.ts +1 -2
  50. package/lib/cjs/ui/widget/MapLayerDroppable.d.ts.map +1 -1
  51. package/lib/cjs/ui/widget/MapLayerDroppable.js +4 -6
  52. package/lib/cjs/ui/widget/MapLayerDroppable.js.map +1 -1
  53. package/lib/cjs/ui/widget/MapLayerManager.d.ts +1 -1
  54. package/lib/cjs/ui/widget/MapLayerManager.d.ts.map +1 -1
  55. package/lib/cjs/ui/widget/MapLayerManager.js +1 -4
  56. package/lib/cjs/ui/widget/MapLayerManager.js.map +1 -1
  57. package/lib/cjs/ui/widget/MapLayerManager.scss +0 -3
  58. package/lib/cjs/ui/widget/MapLayerSettingsMenu.d.ts +2 -3
  59. package/lib/cjs/ui/widget/MapLayerSettingsMenu.d.ts.map +1 -1
  60. package/lib/cjs/ui/widget/MapLayerSettingsMenu.js +3 -4
  61. package/lib/cjs/ui/widget/MapLayerSettingsMenu.js.map +1 -1
  62. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.d.ts +1 -2
  63. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.d.ts.map +1 -1
  64. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.js +5 -6
  65. package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.js.map +1 -1
  66. package/lib/cjs/ui/widget/MapLayersWidget.d.ts +1 -2
  67. package/lib/cjs/ui/widget/MapLayersWidget.d.ts.map +1 -1
  68. package/lib/cjs/ui/widget/MapLayersWidget.js +3 -4
  69. package/lib/cjs/ui/widget/MapLayersWidget.js.map +1 -1
  70. package/lib/cjs/ui/widget/MapManagerMapLayersHeader.d.ts +1 -2
  71. package/lib/cjs/ui/widget/MapManagerMapLayersHeader.d.ts.map +1 -1
  72. package/lib/cjs/ui/widget/MapManagerSettings.d.ts +1 -2
  73. package/lib/cjs/ui/widget/MapManagerSettings.d.ts.map +1 -1
  74. package/lib/cjs/ui/widget/MapManagerSettings.js +8 -9
  75. package/lib/cjs/ui/widget/MapManagerSettings.js.map +1 -1
  76. package/lib/cjs/ui/widget/MapSelectFeaturesDialog.d.ts +1 -2
  77. package/lib/cjs/ui/widget/MapSelectFeaturesDialog.d.ts.map +1 -1
  78. package/lib/cjs/ui/widget/MapSelectFeaturesDialog.js +4 -6
  79. package/lib/cjs/ui/widget/MapSelectFeaturesDialog.js.map +1 -1
  80. package/lib/cjs/ui/widget/MapUrlDialog.d.ts +2 -3
  81. package/lib/cjs/ui/widget/MapUrlDialog.d.ts.map +1 -1
  82. package/lib/cjs/ui/widget/MapUrlDialog.js +12 -17
  83. package/lib/cjs/ui/widget/MapUrlDialog.js.map +1 -1
  84. package/lib/cjs/ui/widget/SelectApiKey.d.ts +1 -2
  85. package/lib/cjs/ui/widget/SelectApiKey.d.ts.map +1 -1
  86. package/lib/cjs/ui/widget/SelectApiKey.js +2 -3
  87. package/lib/cjs/ui/widget/SelectApiKey.js.map +1 -1
  88. package/lib/cjs/ui/widget/SelectCustomParam.d.ts +1 -2
  89. package/lib/cjs/ui/widget/SelectCustomParam.d.ts.map +1 -1
  90. package/lib/cjs/ui/widget/SelectCustomParam.js +3 -4
  91. package/lib/cjs/ui/widget/SelectCustomParam.js.map +1 -1
  92. package/lib/cjs/ui/widget/SelectMapFormat.d.ts +1 -1
  93. package/lib/cjs/ui/widget/SelectMapFormat.d.ts.map +1 -1
  94. package/lib/cjs/ui/widget/SelectMapFormat.js +1 -2
  95. package/lib/cjs/ui/widget/SelectMapFormat.js.map +1 -1
  96. package/lib/cjs/ui/widget/SubLayersDataProvider.d.ts +1 -1
  97. package/lib/cjs/ui/widget/SubLayersDataProvider.d.ts.map +1 -1
  98. package/lib/cjs/ui/widget/SubLayersDataProvider.js +2 -2
  99. package/lib/cjs/ui/widget/SubLayersDataProvider.js.map +1 -1
  100. package/lib/cjs/ui/widget/SubLayersPopupButton.d.ts +2 -3
  101. package/lib/cjs/ui/widget/SubLayersPopupButton.d.ts.map +1 -1
  102. package/lib/cjs/ui/widget/SubLayersPopupButton.js +6 -4
  103. package/lib/cjs/ui/widget/SubLayersPopupButton.js.map +1 -1
  104. package/lib/cjs/ui/widget/SubLayersTree.d.ts +4 -5
  105. package/lib/cjs/ui/widget/SubLayersTree.d.ts.map +1 -1
  106. package/lib/cjs/ui/widget/SubLayersTree.js +28 -21
  107. package/lib/cjs/ui/widget/SubLayersTree.js.map +1 -1
  108. package/lib/cjs/ui/widget/TransparencyPopupButton.d.ts +2 -3
  109. package/lib/cjs/ui/widget/TransparencyPopupButton.d.ts.map +1 -1
  110. package/lib/cjs/ui/widget/TransparencyPopupButton.js +1 -2
  111. package/lib/cjs/ui/widget/TransparencyPopupButton.js.map +1 -1
  112. package/lib/cjs/ui/widget/UserPreferencesStorageOptions.d.ts +1 -1
  113. package/lib/cjs/ui/widget/UserPreferencesStorageOptions.d.ts.map +1 -1
  114. package/lib/esm/BrowserStorage.js.map +1 -1
  115. package/lib/esm/CustomParamUtils.js.map +1 -1
  116. package/lib/esm/MapLayerPreferences.d.ts +2 -2
  117. package/lib/esm/MapLayerPreferences.d.ts.map +1 -1
  118. package/lib/esm/MapLayerPreferences.js +3 -3
  119. package/lib/esm/MapLayerPreferences.js.map +1 -1
  120. package/lib/esm/PreferencesBrowserStorage.js.map +1 -1
  121. package/lib/esm/ui/FeatureInfoUiItemsProvider.d.ts +6 -7
  122. package/lib/esm/ui/FeatureInfoUiItemsProvider.d.ts.map +1 -1
  123. package/lib/esm/ui/FeatureInfoUiItemsProvider.js +27 -23
  124. package/lib/esm/ui/FeatureInfoUiItemsProvider.js.map +1 -1
  125. package/lib/esm/ui/Interfaces.d.ts +1 -1
  126. package/lib/esm/ui/Interfaces.d.ts.map +1 -1
  127. package/lib/esm/ui/MapLayersUiItemsProvider.js.map +1 -1
  128. package/lib/esm/ui/widget/AttachLayerPopupButton.d.ts +1 -2
  129. package/lib/esm/ui/widget/AttachLayerPopupButton.d.ts.map +1 -1
  130. package/lib/esm/ui/widget/AttachLayerPopupButton.js +11 -27
  131. package/lib/esm/ui/widget/AttachLayerPopupButton.js.map +1 -1
  132. package/lib/esm/ui/widget/BasemapPanel.d.ts +1 -2
  133. package/lib/esm/ui/widget/BasemapPanel.d.ts.map +1 -1
  134. package/lib/esm/ui/widget/BasemapPanel.js +15 -26
  135. package/lib/esm/ui/widget/BasemapPanel.js.map +1 -1
  136. package/lib/esm/ui/widget/ConfirmMessageDialog.d.ts +7 -8
  137. package/lib/esm/ui/widget/ConfirmMessageDialog.d.ts.map +1 -1
  138. package/lib/esm/ui/widget/ConfirmMessageDialog.js +17 -10
  139. package/lib/esm/ui/widget/ConfirmMessageDialog.js.map +1 -1
  140. package/lib/esm/ui/widget/CustomParamEditDialog.d.ts +1 -2
  141. package/lib/esm/ui/widget/CustomParamEditDialog.d.ts.map +1 -1
  142. package/lib/esm/ui/widget/CustomParamEditDialog.js +3 -5
  143. package/lib/esm/ui/widget/CustomParamEditDialog.js.map +1 -1
  144. package/lib/esm/ui/widget/CustomParamsSettings.d.ts +1 -2
  145. package/lib/esm/ui/widget/CustomParamsSettings.d.ts.map +1 -1
  146. package/lib/esm/ui/widget/CustomParamsSettings.js +3 -11
  147. package/lib/esm/ui/widget/CustomParamsSettings.js.map +1 -1
  148. package/lib/esm/ui/widget/CustomParamsSettings.scss +2 -0
  149. package/lib/esm/ui/widget/FeatureInfoDataProvider.js.map +1 -1
  150. package/lib/esm/ui/widget/FeatureInfoWidget.d.ts +1 -2
  151. package/lib/esm/ui/widget/FeatureInfoWidget.d.ts.map +1 -1
  152. package/lib/esm/ui/widget/FeatureInfoWidget.js +10 -9
  153. package/lib/esm/ui/widget/FeatureInfoWidget.js.map +1 -1
  154. package/lib/esm/ui/widget/MapLayerActionButtons.d.ts +1 -2
  155. package/lib/esm/ui/widget/MapLayerActionButtons.d.ts.map +1 -1
  156. package/lib/esm/ui/widget/MapLayerActionButtons.js +2 -2
  157. package/lib/esm/ui/widget/MapLayerActionButtons.js.map +1 -1
  158. package/lib/esm/ui/widget/MapLayerDroppable.d.ts +1 -2
  159. package/lib/esm/ui/widget/MapLayerDroppable.d.ts.map +1 -1
  160. package/lib/esm/ui/widget/MapLayerDroppable.js +5 -7
  161. package/lib/esm/ui/widget/MapLayerDroppable.js.map +1 -1
  162. package/lib/esm/ui/widget/MapLayerManager.d.ts +1 -1
  163. package/lib/esm/ui/widget/MapLayerManager.d.ts.map +1 -1
  164. package/lib/esm/ui/widget/MapLayerManager.js +1 -4
  165. package/lib/esm/ui/widget/MapLayerManager.js.map +1 -1
  166. package/lib/esm/ui/widget/MapLayerManager.scss +0 -3
  167. package/lib/esm/ui/widget/MapLayerSettingsMenu.d.ts +2 -3
  168. package/lib/esm/ui/widget/MapLayerSettingsMenu.d.ts.map +1 -1
  169. package/lib/esm/ui/widget/MapLayerSettingsMenu.js +3 -4
  170. package/lib/esm/ui/widget/MapLayerSettingsMenu.js.map +1 -1
  171. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.d.ts +1 -2
  172. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.d.ts.map +1 -1
  173. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.js +5 -6
  174. package/lib/esm/ui/widget/MapLayerSettingsPopupButton.js.map +1 -1
  175. package/lib/esm/ui/widget/MapLayersWidget.d.ts +1 -2
  176. package/lib/esm/ui/widget/MapLayersWidget.d.ts.map +1 -1
  177. package/lib/esm/ui/widget/MapLayersWidget.js +3 -4
  178. package/lib/esm/ui/widget/MapLayersWidget.js.map +1 -1
  179. package/lib/esm/ui/widget/MapManagerMapLayersHeader.d.ts +1 -2
  180. package/lib/esm/ui/widget/MapManagerMapLayersHeader.d.ts.map +1 -1
  181. package/lib/esm/ui/widget/MapManagerSettings.d.ts +1 -2
  182. package/lib/esm/ui/widget/MapManagerSettings.d.ts.map +1 -1
  183. package/lib/esm/ui/widget/MapManagerSettings.js +8 -9
  184. package/lib/esm/ui/widget/MapManagerSettings.js.map +1 -1
  185. package/lib/esm/ui/widget/MapSelectFeaturesDialog.d.ts +1 -2
  186. package/lib/esm/ui/widget/MapSelectFeaturesDialog.d.ts.map +1 -1
  187. package/lib/esm/ui/widget/MapSelectFeaturesDialog.js +4 -6
  188. package/lib/esm/ui/widget/MapSelectFeaturesDialog.js.map +1 -1
  189. package/lib/esm/ui/widget/MapUrlDialog.d.ts +2 -3
  190. package/lib/esm/ui/widget/MapUrlDialog.d.ts.map +1 -1
  191. package/lib/esm/ui/widget/MapUrlDialog.js +14 -19
  192. package/lib/esm/ui/widget/MapUrlDialog.js.map +1 -1
  193. package/lib/esm/ui/widget/SelectApiKey.d.ts +1 -2
  194. package/lib/esm/ui/widget/SelectApiKey.d.ts.map +1 -1
  195. package/lib/esm/ui/widget/SelectApiKey.js +2 -3
  196. package/lib/esm/ui/widget/SelectApiKey.js.map +1 -1
  197. package/lib/esm/ui/widget/SelectCustomParam.d.ts +1 -2
  198. package/lib/esm/ui/widget/SelectCustomParam.d.ts.map +1 -1
  199. package/lib/esm/ui/widget/SelectCustomParam.js +3 -4
  200. package/lib/esm/ui/widget/SelectCustomParam.js.map +1 -1
  201. package/lib/esm/ui/widget/SelectMapFormat.d.ts +1 -1
  202. package/lib/esm/ui/widget/SelectMapFormat.d.ts.map +1 -1
  203. package/lib/esm/ui/widget/SelectMapFormat.js +2 -3
  204. package/lib/esm/ui/widget/SelectMapFormat.js.map +1 -1
  205. package/lib/esm/ui/widget/SubLayersDataProvider.d.ts +1 -1
  206. package/lib/esm/ui/widget/SubLayersDataProvider.d.ts.map +1 -1
  207. package/lib/esm/ui/widget/SubLayersDataProvider.js +1 -1
  208. package/lib/esm/ui/widget/SubLayersDataProvider.js.map +1 -1
  209. package/lib/esm/ui/widget/SubLayersPopupButton.d.ts +2 -3
  210. package/lib/esm/ui/widget/SubLayersPopupButton.d.ts.map +1 -1
  211. package/lib/esm/ui/widget/SubLayersPopupButton.js +7 -5
  212. package/lib/esm/ui/widget/SubLayersPopupButton.js.map +1 -1
  213. package/lib/esm/ui/widget/SubLayersTree.d.ts +4 -5
  214. package/lib/esm/ui/widget/SubLayersTree.d.ts.map +1 -1
  215. package/lib/esm/ui/widget/SubLayersTree.js +23 -16
  216. package/lib/esm/ui/widget/SubLayersTree.js.map +1 -1
  217. package/lib/esm/ui/widget/TransparencyPopupButton.d.ts +2 -3
  218. package/lib/esm/ui/widget/TransparencyPopupButton.d.ts.map +1 -1
  219. package/lib/esm/ui/widget/TransparencyPopupButton.js +1 -2
  220. package/lib/esm/ui/widget/TransparencyPopupButton.js.map +1 -1
  221. package/lib/esm/ui/widget/UserPreferencesStorageOptions.d.ts +1 -1
  222. package/lib/esm/ui/widget/UserPreferencesStorageOptions.d.ts.map +1 -1
  223. package/package.json +48 -56
@@ -1 +1 @@
1
- {"version":3,"file":"BrowserStorage.js","sourceRoot":"","sources":["../../src/BrowserStorage.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAgBhG,MAAM,OAAO,cAAc;IAIzB,YAAY,IAA2B;QACrC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,WAAW,CAAC;QACrC,IAAI,CAAC,wBAAwB,GAAG,IAAI,CAAC,uBAAuB,IAAI,IAAI,CAAC;IACvE,CAAC;IAEO,eAAe;QACrB,MAAM,OAAO,GAAG,MAAM,CAAC,YAAY,CAAC;QAEpC,IAAI,GAAG,GAA0B,EAAE,CAAC;QACpC,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACnD,IAAI,OAAO,KAAK,IAAI,EAAE;YACpB,OAAO,SAAS,CAAC;SAClB;QACD,IAAI,CAAC,OAAO,IAAI,OAAO,KAAK,IAAI,EAAE;YAChC,OAAO,GAAG,CAAC;SACZ;QAED,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC1B,OAAO,GAAG,CAAC;IACb,CAAC;IAEM,GAAG,CAAC,GAAuB;QAChC,MAAM,GAAG,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;QACnC,IAAI,GAAG,KAAK,SAAS,EAAE;YACrB,OAAO,SAAS,CAAC;SAClB;QAED,IAAI,GAAG,EAAE;YACP,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;gBACnC,OAAO,SAAS,CAAC;aAClB;YAED,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC;SACjB;aAAM;YACL,sCAAsC;YACtC,OAAO,MAAM,CAA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;QAED,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;IACtE,CAAC;IAEM,IAAI,CAAC,GAAW,EAAE,OAAa;QACpC,IAAI,GAAG,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;QACjC,IAAI,GAAG,KAAK,SAAS,EAAE;YACrB,GAAG,GAAG,EAAE,CAAC;SACV;QAED,GAAG,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC;QAEnB,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;QACtC,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;IAC5D,CAAC;CACF","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\n/** Index signature holding preferences content\n *\n * @internal\n */\ninterface KeyContentProps<Type> {\n [preferenceKey: string]: Type;\n}\n\nexport interface BrowserStorageOptions {\n /** indicate whether or not delete function should throw an error if the provided key cannot be found. */\n throwOnDeleteMissingKey?: boolean;\n itemKeyName: string;\n}\n\nexport class BrowserStorage<Type> {\n private readonly _itemKeyName;\n private readonly _throwOnDeleteMissingKey;\n\n constructor(opts: BrowserStorageOptions) {\n this._itemKeyName = opts.itemKeyName;\n this._throwOnDeleteMissingKey = opts.throwOnDeleteMissingKey ?? true;\n }\n\n private loadFromStorage() {\n const storage = window.localStorage;\n\n let map: KeyContentProps<Type> = {};\n const itemStr = storage.getItem(this._itemKeyName);\n if (itemStr === null) {\n return undefined;\n }\n if (!itemStr || itemStr === \"{}\") {\n return map;\n }\n\n map = JSON.parse(itemStr);\n return map;\n }\n\n public get(key: string | undefined) {\n const map = this.loadFromStorage();\n if (map === undefined) {\n return undefined;\n }\n\n if (key) {\n if (!Object.keys(map).includes(key)) {\n return undefined;\n }\n\n return map[key];\n } else {\n // No key provided, return all objects\n return Object.entries(map).map(([_key, value]) => value);\n }\n }\n\n public getContent() {\n return this.loadFromStorage();\n }\n\n public delete(key: string) {\n const map = this.loadFromStorage();\n if (map === undefined) {\n if (this._throwOnDeleteMissingKey) {\n throw new Error(\"Could not find key from storage.\");\n } else {\n return;\n }\n }\n\n if (!Object.keys(map).includes(key)) {\n if (this._throwOnDeleteMissingKey) {\n throw Error(\"Could not find key from storage.\");\n } else {\n return;\n }\n }\n delete map[key];\n window.localStorage.setItem(this._itemKeyName, JSON.stringify(map));\n }\n\n public deleteMatchingContent(content: Type) {\n const map = this.loadFromStorage();\n if (map === undefined) {\n return;\n }\n const contentJson = JSON.stringify(content);\n for (const [key, value] of Object.entries(map)) {\n if (JSON.stringify(value) === contentJson) {\n delete map[key];\n }\n }\n\n window.localStorage.setItem(this._itemKeyName, JSON.stringify(map));\n }\n\n public save(key: string, content: Type) {\n let map = this.loadFromStorage();\n if (map === undefined) {\n map = {};\n }\n\n map[key] = content;\n\n const itemValue = JSON.stringify(map);\n window.localStorage.setItem(this._itemKeyName, itemValue);\n }\n}\n"]}
1
+ {"version":3,"file":"BrowserStorage.js","sourceRoot":"","sources":["../../src/BrowserStorage.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAgBhG,MAAM,OAAO,cAAc;IAIzB,YAAY,IAA2B;QACrC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,WAAW,CAAC;QACrC,IAAI,CAAC,wBAAwB,GAAG,IAAI,CAAC,uBAAuB,IAAI,IAAI,CAAC;IACvE,CAAC;IAEO,eAAe;QACrB,MAAM,OAAO,GAAG,MAAM,CAAC,YAAY,CAAC;QAEpC,IAAI,GAAG,GAA0B,EAAE,CAAC;QACpC,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACnD,IAAI,OAAO,KAAK,IAAI,EAAE,C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,YAAY,EAAE,SAAS,CAAC,CAAC;IAC5D,CAAC;CACF","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\n/** Index signature holding preferences content\n *\n * @internal\n */\ninterface KeyContentProps<Type> {\n [preferenceKey: string]: Type;\n}\n\nexport interface BrowserStorageOptions {\n /** indicate whether or not delete function should throw an error if the provided key cannot be found. */\n throwOnDeleteMissingKey?: boolean;\n itemKeyName: string;\n}\n\nexport class BrowserStorage<Type> {\n private readonly _itemKeyName;\n private readonly _throwOnDeleteMissingKey;\n\n constructor(opts: BrowserStorageOptions) {\n this._itemKeyName = opts.itemKeyName;\n this._throwOnDeleteMissingKey = opts.throwOnDeleteMissingKey ?? true;\n }\n\n private loadFromStorage() {\n const storage = window.localStorage;\n\n let map: KeyContentProps<Type> = {};\n const itemStr = storage.getItem(this._itemKeyName);\n if (itemStr === null) {\n return undefined;\n }\n if (!itemStr || itemStr === \"{}\") {\n return map;\n }\n\n map = JSON.parse(itemStr);\n return map;\n }\n\n public get(key: string | undefined) {\n const map = this.loadFromStorage();\n if (map === undefined) {\n return undefined;\n }\n\n if (key) {\n if (!Object.keys(map).includes(key)) {\n return undefined;\n }\n\n return map[key];\n } else {\n // No key provided, return all objects\n return Object.entries(map).map(([_key, value]) => value);\n }\n }\n\n public getContent() {\n return this.loadFromStorage();\n }\n\n public delete(key: string) {\n const map = this.loadFromStorage();\n if (map === undefined) {\n if (this._throwOnDeleteMissingKey) {\n throw new Error(\"Could not find key from storage.\");\n } else {\n return;\n }\n }\n\n if (!Object.keys(map).includes(key)) {\n if (this._throwOnDeleteMissingKey) {\n throw Error(\"Could not find key from storage.\");\n } else {\n return;\n }\n }\n delete map[key];\n window.localStorage.setItem(this._itemKeyName, JSON.stringify(map));\n }\n\n public deleteMatchingContent(content: Type) {\n const map = this.loadFromStorage();\n if (map === undefined) {\n return;\n }\n const contentJson = JSON.stringify(content);\n for (const [key, value] of Object.entries(map)) {\n if (JSON.stringify(value) === contentJson) {\n delete map[key];\n }\n }\n\n window.localStorage.setItem(this._itemKeyName, JSON.stringify(map));\n }\n\n public save(key: string, content: Type) {\n let map = this.loadFromStorage();\n if (map === undefined) {\n map = {};\n }\n\n map[key] = content;\n\n const itemValue = JSON.stringify(map);\n window.localStorage.setItem(this._itemKeyName, itemValue);\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"CustomParamUtils.js","sourceRoot":"","sources":["../../src/CustomParamUtils.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG5D,MAAM,OAAO,gBAAgB;IACpB,MAAM,CAAC,qBAAqB,CAAC,MAAsB,EAAE,gBAA0B;QACpF,MAAM,SAAS,GAAG,IAAI,mBAAmB,EAAE,CAAC;QAC5C,gBAAgB,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE;YACrC,MAAM,gBAAgB,GAAG,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;YAClD,IAAI,WAAwC,CAAC;YAC7C,IAAI,KAAK,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAAE;gBACnC,IAAI,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE;oBAC/B,WAAW,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC;iBACnC;aACF;iBAAM;gBACL,WAAW,GAAG,gBAAgB,CAAC;aAChC;YAED,IAAI,WAAW,IAAI,MAAM,EAAE;gBACzB,IAAI,WAAW,CAAC,MAAM,EAAE;oBACtB,IAAI,CAAC,MAAM,CAAC,kBAAkB,EAAE;wBAC9B,MAAM,CAAC,kBAAkB,GAAG,EAAE,CAAC;qBAChC;oBACD,MAAM,CAAC,kBAAkB,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC,KAAK,CAAC;iBAChE;qBAAM;oBACL,IAAI,CAAC,MAAM,CAAC,gBAAgB,EAAE;wBAC5B,MAAM,CAAC,gBAAgB,GAAG,EAAE,CAAC;qBAC9B;oBACD,MAAM,CAAC,gBAAgB,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC,KAAK,CAAC;iBAC9D;aACF;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF","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 type { MapLayerSource } from \"@itwin/core-frontend\";\nimport { CustomParamsStorage } from \"./CustomParamsStorage\";\nimport type { CustomParamItem } from \"./ui/Interfaces\";\n\nexport class CustomParamUtils {\n public static setSourceCustomParams(source: MapLayerSource, customParamNames: string[]) {\n const cpStorage = new CustomParamsStorage();\n customParamNames.forEach((paramName) => {\n const paramFromStorage = cpStorage.get(paramName);\n let customParam: CustomParamItem | undefined;\n if (Array.isArray(paramFromStorage)) {\n if (paramFromStorage.length > 0) {\n customParam = paramFromStorage[0];\n }\n } else {\n customParam = paramFromStorage;\n }\n\n if (customParam && source) {\n if (customParam.secret) {\n if (!source.unsavedQueryParams) {\n source.unsavedQueryParams = {};\n }\n source.unsavedQueryParams[customParam.key] = customParam.value;\n } else {\n if (!source.savedQueryParams) {\n source.savedQueryParams = {};\n }\n source.savedQueryParams[customParam.key] = customParam.value;\n }\n }\n });\n }\n}\n"]}
1
+ {"version":3,"file":"CustomParamUtils.js","sourceRoot":"","sources":["../../src/CustomParamUtils.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG5D,MAAM,OAAO,gBAAgB;IACpB,MAAM,CAAC,qBAAqB,CAAC,MAAsB,EAAE,gBAA0B;QACpF,MAAM,SAAS,GAAG,IAAI,mBAAmB,EAAE,CAAC;QAC5C,gBAAgB,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE;YACrC,MAAM,gBAAgB,GAAG,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;YAClD,IAAI,WAAwC,CAAC;YAC7C,IAAI,KAAK,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAAE,CAAC;gBACpC,IAAI,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBAChC,WAAW,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC;gBACpC,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,WAAW,GAAG,gBAAgB,CAAC;YACjC,CAAC;YAED,IAAI,WAAW,IAAI,MAAM,EAAE,CAAC;gBAC1B,IAAI,WAAW,CAAC,MAAM,EAAE,CAAC;oBACvB,IAAI,CAAC,MAAM,CAAC,kBAAkB,EAAE,CAAC;wBAC/B,MAAM,CAAC,kBAAkB,GAAG,EAAE,CAAC;oBACjC,CAAC;oBACD,MAAM,CAAC,kBAAkB,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC,KAAK,CAAC;gBACjE,CAAC;qBAAM,CAAC;oBACN,IAAI,CAAC,MAAM,CAAC,gBAAgB,EAAE,CAAC;wBAC7B,MAAM,CAAC,gBAAgB,GAAG,EAAE,CAAC;oBAC/B,CAAC;oBACD,MAAM,CAAC,gBAAgB,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC,KAAK,CAAC;gBAC/D,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF","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 type { MapLayerSource } from \"@itwin/core-frontend\";\nimport { CustomParamsStorage } from \"./CustomParamsStorage\";\nimport type { CustomParamItem } from \"./ui/Interfaces\";\n\nexport class CustomParamUtils {\n public static setSourceCustomParams(source: MapLayerSource, customParamNames: string[]) {\n const cpStorage = new CustomParamsStorage();\n customParamNames.forEach((paramName) => {\n const paramFromStorage = cpStorage.get(paramName);\n let customParam: CustomParamItem | undefined;\n if (Array.isArray(paramFromStorage)) {\n if (paramFromStorage.length > 0) {\n customParam = paramFromStorage[0];\n }\n } else {\n customParam = paramFromStorage;\n }\n\n if (customParam && source) {\n if (customParam.secret) {\n if (!source.unsavedQueryParams) {\n source.unsavedQueryParams = {};\n }\n source.unsavedQueryParams[customParam.key] = customParam.value;\n } else {\n if (!source.savedQueryParams) {\n source.savedQueryParams = {};\n }\n source.savedQueryParams[customParam.key] = customParam.value;\n }\n }\n });\n }\n}\n"]}
@@ -1,6 +1,6 @@
1
+ import { BeEvent } from "@itwin/core-bentley";
1
2
  import { MapLayerSource } from "@itwin/core-frontend";
2
3
  import type { GuidString } from "@itwin/core-bentley";
3
- import { BeEvent } from "@itwin/core-bentley";
4
4
  /** @internal */
5
5
  export interface MapLayerPreferencesContent {
6
6
  url: string;
@@ -34,7 +34,7 @@ export declare class MapLayerPreferences {
34
34
  *
35
35
  * @see [[MapLayerSourceChangeType]]
36
36
  */
37
- static readonly onLayerSourceChanged: BeEvent<(changeType: MapLayerSourceChangeType, oldSource?: MapLayerSource | undefined, newSource?: MapLayerSource | undefined) => void>;
37
+ static readonly onLayerSourceChanged: BeEvent<(changeType: MapLayerSourceChangeType, oldSource?: MapLayerSource, newSource?: MapLayerSource) => void>;
38
38
  /** Store the Map Layer source preference. If the same setting exists at a higher level, an error will be thrown and the setting will not be updated.
39
39
  *
40
40
  * Returns false if the settings object would override some other settings object in a larger scope i.e. storing settings on model when
@@ -1 +1 @@
1
- {"version":3,"file":"MapLayerPreferences.d.ts","sourceRoot":"","sources":["../../src/MapLayerPreferences.ts"],"names":[],"mappings":"AAKA,OAAO,EAAa,cAAc,EAA+C,MAAM,sBAAsB,CAAC;AAC9G,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AA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CAAC,SAAS,EAAE,cAAc,EAAE,SAAS,EAAE,cAAc,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IA4ClJ;;;;;OAKG;WACiB,YAAY,CAAC,MAAM,EAAE,cAAc,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IA2BnH;;;;;;;;;;;OAWG;mBACkB,MAAM;IA8F3B;;;;OAIG;WACiB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,0BAA0B,GAAG,SAAS,CAAC;IA4B9H;;;;OAIG;WACiB,UAAU,CAAC,OAAO,EAAE,UAAU,EAAE,QAAQ,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAiDrG,OAAO,CAAC,MAAM,KAAK,oBAAoB,GAEtC;CACF"}
@@ -2,8 +2,8 @@
2
2
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
3
  * See LICENSE.md in the project root for license terms and full copyright notice.
4
4
  *--------------------------------------------------------------------------------------------*/
5
- import { IModelApp, MapLayerSource, NotifyMessageDetails, OutputMessagePriority } from "@itwin/core-frontend";
6
5
  import { BeEvent } from "@itwin/core-bentley";
6
+ import { IModelApp, MapLayerSource, NotifyMessageDetails, OutputMessagePriority } from "@itwin/core-frontend";
7
7
  import { MapLayersUI } from "./mapLayers";
8
8
  /** @internal */
9
9
  export var MapLayerSourceChangeType;
@@ -82,7 +82,7 @@ export class MapLayerPreferences {
82
82
  iModelId,
83
83
  });
84
84
  }
85
- catch (_err) {
85
+ catch {
86
86
  await MapLayersUI.iTwinConfig.delete({
87
87
  accessToken,
88
88
  namespace: MapLayerPreferences._preferenceNamespace,
@@ -127,7 +127,7 @@ export class MapLayerPreferences {
127
127
  iModelId,
128
128
  });
129
129
  }
130
- catch (_err) {
130
+ catch {
131
131
  // failed to store based on iModelId, attempt using iTwinId
132
132
  await MapLayersUI.iTwinConfig.delete({
133
133
  accessToken,
@@ -1 +1 @@
1
- {"version":3,"file":"MapLayerPreferences.js","sourceRoot":"","sources":["../../src/MapLayerPreferences.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAE9G,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAU1C,gBAAgB;AAChB,MAAM,CAAN,IAAY,wBAIX;AAJD,WAAY,wBAAwB;IAClC,yEAAS,CAAA;IACT,6EAAW,CAAA;IACX,+EAAY,CAAA;AACd,CAAC,EAJW,wBAAwB,KAAxB,wBAAwB,QAInC;AASD;;;;;GAKG;AACH,MAAM,OAAO,mBAAmB;IAY9B;;;;;;OAMG;IACI,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,MAAsB,EAAE,OAAmB,EAAE,QAAqB,EAAE,aAAuB;QACzH,IAAI,CAAC,WAAW,CAAC,WAAW,EAAE;YAC5B,OAAO,KAAK,CAAC;SACd;QACD,MAAM,WAAW,GAAG,SAAS,KAAK,SAAS,CAAC,mBAAmB,CAAC,CAAC,CAAC,MAAM,SAAS,CAAC,mBAAmB,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;QAEnI,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC;QACnC,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE;YACxB,OAAO,KAAK,CAAC;SACd;QACD,MAAM,eAAe,GAA+B;YAClD,GAAG,EAAE,UAAU,CAAC,GAAG;YACnB,IAAI,EAAE,UAAU,CAAC,IAAI;YACrB,QAAQ,EAAE,UAAU,CAAC,QAAQ;YAC7B,qBAAqB,E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,CAAC;QAClD,KAAK,MAAM,QAAQ,IAAI,YAAY,EAAE;YACnC,QAAQ,CAAC,OAAO,CAAC,CAAC,UAAe,EAAE,EAAE;gBACnC,MAAM,cAAc,GAAG,cAAc,CAAC,QAAQ,CAAC,UAAwC,CAAC,CAAC;gBACzF,IAAI,cAAc,EAAE;oBAClB,oBAAoB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;iBAC3C;YACH,CAAC,CAAC,CAAC;SACJ;QACD,OAAO,oBAAoB,CAAC;IAC9B,CAAC;IAEO,MAAM,KAAK,oBAAoB;QACrC,OAAO,gCAAgC,CAAC;IAC1C,CAAC;;AA7UD;;;;;;GAMG;AACoB,wCAAoB,GAAG,IAAI,OAAO,EAEtD,CAAC,CAAC,mFAAmF","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 { IModelApp, MapLayerSource, NotifyMessageDetails, OutputMessagePriority } from \"@itwin/core-frontend\";\nimport type { GuidString } from \"@itwin/core-bentley\";\nimport { BeEvent } from \"@itwin/core-bentley\";\nimport { MapLayersUI } from \"./mapLayers\";\n\n/** @internal */\nexport interface MapLayerPreferencesContent {\n url: string;\n name: string;\n formatId: string;\n transparentBackground: boolean | undefined;\n}\n\n/** @internal */\nexport enum MapLayerSourceChangeType {\n Added = 0,\n Removed = 1,\n Replaced = 2,\n}\n\n/** @internal */\nexport interface MapLayerSourceArg {\n readonly source: MapLayerSource;\n readonly iTwinId: GuidString;\n readonly iModelId: GuidString;\n}\n\n/** A wrapper around user preferences to provide a way to store [[MapLayerSettings]].\n *\n * Note: This is currently internal only and used directly by the MapLayersExtension. It makes use of the IModelApp.authorizationClient if it exists.\n *\n * @internal\n */\nexport class MapLayerPreferences {\n /** Event raised whenever a source is added, replaced or removed:\n * changeType : Type of changed occurred.\n * oldSource : Source that was removed or replaced.\n * newSource : Source that was added or replacement of oldSource.\n *\n * @see [[MapLayerSourceChangeType]]\n */\n public static readonly onLayerSourceChanged = new BeEvent<\n (changeType: MapLayerSourceChangeType, oldSource?: MapLayerSource, newSource?: MapLayerSource) => void\n >(); // Used to notify the frontend that it needs to update its list of available layers\n\n /** Store the Map Layer source preference. If the same setting exists at a higher level, an error will be thrown and the setting will not be updated.\n *\n * Returns false if the settings object would override some other settings object in a larger scope i.e. storing settings on model when\n * a project setting exists with same name or map layer url.\n * @param source source to be stored on the setting service\n * @param storeOnIModel if true store the settings object on the model, if false store it on the project\n */\n public static async storeSource(source: MapLayerSource, iTwinId: GuidString, iModelId?: GuidString, storeOnIModel?: boolean): Promise<boolean> {\n if (!MapLayersUI.iTwinConfig) {\n return false;\n }\n const accessToken = undefined !== IModelApp.authorizationClient ? await IModelApp.authorizationClient.getAccessToken() : undefined;\n\n const sourceJSON = source.toJSON();\n if (!sourceJSON.formatId) {\n return false;\n }\n const mapLayerSetting: MapLayerPreferencesContent = {\n url: sourceJSON.url,\n name: sourceJSON.name,\n formatId: sourceJSON.formatId,\n transparentBackground: sourceJSON.transparentBackground,\n };\n\n const result: boolean = await MapLayerPreferences.delete(sourceJSON.url, sourceJSON.name, iTwinId, iModelId, storeOnIModel);\n if (result) {\n await MapLayersUI.iTwinConfig.save({\n accessToken,\n content: mapLayerSetting,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: sourceJSON.name,\n iTwinId,\n iModelId: storeOnIModel ? iModelId : undefined,\n });\n MapLayerPreferences.onLayerSourceChanged.raiseEvent(MapLayerSourceChangeType.Added, undefined, MapLayerSource.fromJSON(mapLayerSetting));\n return true;\n } else {\n return false;\n }\n }\n\n /** Replace the old map layer source with a new map layer source.\n *\n * The source is replaced at the same level that the original source is defined. (i.e. if the old source is defined at a project level, the new source will also be defined there.)\n *\n * @param oldSource\n * @param newSource\n * @param iTwinId\n * @param iModelId\n */\n public static async replaceSource(oldSource: MapLayerSource, newSource: MapLayerSource, iTwinId: GuidString, iModelId?: GuidString): Promise<void> {\n if (!MapLayersUI.iTwinConfig) {\n return;\n }\n const accessToken = undefined !== IModelApp.authorizationClient ? await IModelApp.authorizationClient.getAccessToken() : undefined;\n\n let storeOnIModel = false;\n try {\n await MapLayersUI.iTwinConfig.delete({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: oldSource.name,\n iTwinId,\n iModelId,\n });\n } catch (_err) {\n await MapLayersUI.iTwinConfig.delete({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: oldSource.name,\n iTwinId,\n });\n storeOnIModel = true;\n }\n\n const mapLayerSetting: MapLayerPreferencesContent = {\n url: newSource.url,\n name: newSource.name,\n formatId: newSource.formatId,\n transparentBackground: newSource.transparentBackground,\n };\n\n await MapLayersUI.iTwinConfig.save({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: newSource.name,\n iTwinId,\n iModelId: storeOnIModel ? iModelId : undefined,\n content: mapLayerSetting,\n });\n\n MapLayerPreferences.onLayerSourceChanged.raiseEvent(MapLayerSourceChangeType.Replaced, oldSource, newSource);\n }\n\n /** Deletes the provided MapLayerSource by name from both the iTwin or iModel level.\n *\n * @param source The source to delete. The name is used to identify the source.\n * @param iTwinId\n * @param iModelId\n */\n public static async deleteByName(source: MapLayerSource, iTwinId: GuidString, iModelId?: GuidString): Promise<void> {\n if (!MapLayersUI.iTwinConfig) {\n return;\n }\n const accessToken = undefined !== IModelApp.authorizationClient ? await IModelApp.authorizationClient.getAccessToken() : undefined;\n\n try {\n await MapLayersUI.iTwinConfig.delete({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: source.name,\n iTwinId,\n iModelId,\n });\n } catch (_err) {\n // failed to store based on iModelId, attempt using iTwinId\n await MapLayersUI.iTwinConfig.delete({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: source.name,\n iTwinId,\n });\n }\n\n MapLayerPreferences.onLayerSourceChanged.raiseEvent(MapLayerSourceChangeType.Removed, source, undefined);\n }\n\n /** Deletes the current setting with the provided key if it is defined at the same preference level.\n *\n * If the preference is defined within a different level, false will be returned indicating the setting should not be overriden.\n *\n * The two potential preference levels are iTwin and iModel.\n *\n * @param url\n * @param name\n * @param iTwinId\n * @param iModelId\n * @param storeOnIModel\n */\n private static async delete(url: string, name: string, iTwinId: GuidString, iModelId?: GuidString, storeOnIModel?: boolean): Promise<boolean> {\n if (!MapLayersUI.iTwinConfig) {\n return true;\n }\n const accessToken = undefined !== IModelApp.authorizationClient ? await IModelApp.authorizationClient.getAccessToken() : undefined;\n\n const iTwinPreferenceByName = await MapLayersUI.iTwinConfig.get({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: name,\n iTwinId,\n });\n\n if (undefined !== iTwinPreferenceByName && storeOnIModel) {\n const errorMessage = IModelApp.localization.getLocalizedString(\"mapLayers:CustomAttach.LayerExistsAsProjectSetting\", {\n layer: iTwinPreferenceByName.name,\n });\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, errorMessage));\n return false;\n } else if (iTwinPreferenceByName) {\n const infoMessage = IModelApp.localization.getLocalizedString(\"mapLayers:CustomAttach.LayerExistsOverwriting\", { layer: iTwinPreferenceByName.name });\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, infoMessage));\n await MapLayersUI.iTwinConfig.delete({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: iTwinPreferenceByName.name,\n iTwinId,\n });\n }\n\n // check if setting with url already exists, if it does, delete it\n const settingFromUrl = await MapLayerPreferences.getByUrl(url, iTwinId, undefined);\n if (settingFromUrl && storeOnIModel) {\n const errorMessage = IModelApp.localization.getLocalizedString(\"mapLayers:CustomAttach.LayerWithUrlExistsAsProjectSetting\", {\n url: settingFromUrl.url,\n name: settingFromUrl.name,\n });\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, errorMessage));\n return false;\n } else if (settingFromUrl) {\n const infoMessage = IModelApp.localization.getLocalizedString(\"mapLayers:CustomAttach.LayerWithUrlExistsOverwriting\", {\n url: settingFromUrl.url,\n oldName: settingFromUrl.name,\n newName: name,\n });\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, infoMessage));\n await MapLayersUI.iTwinConfig.delete({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: settingFromUrl.name,\n iTwinId,\n });\n }\n\n if (iModelId) {\n // delete any settings on model so user can update them if theres collisions\n const settingOnIModelFromName = await MapLayersUI.iTwinConfig.get({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: name,\n iTwinId,\n iModelId,\n });\n const settingFromUrlOnIModel = await MapLayerPreferences.getByUrl(url, iTwinId, iModelId);\n if (settingOnIModelFromName) {\n const infoMessage = IModelApp.localization.getLocalizedString(\"mapLayers:CustomAttach.LayerExistsOverwriting\", { layer: settingOnIModelFromName.name });\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, infoMessage));\n await MapLayersUI.iTwinConfig.delete({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: settingOnIModelFromName.name,\n iTwinId,\n iModelId,\n });\n }\n if (settingFromUrlOnIModel) {\n const infoMessage = IModelApp.localization.getLocalizedString(\"mapLayers:CustomAttach.LayerWithUrlExistsOverwriting\", {\n url: settingFromUrlOnIModel.url,\n oldName: settingFromUrlOnIModel.name,\n newName: name,\n });\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, infoMessage));\n await MapLayersUI.iTwinConfig.delete({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: settingFromUrlOnIModel.name,\n iTwinId,\n iModelId,\n });\n }\n }\n return true;\n }\n\n /** Attempts to get a map layer based off a specific url.\n * @param url\n * @param iTwinId\n * @param iModelId\n */\n public static async getByUrl(url: string, iTwinId: string, iModelId?: string): Promise<MapLayerPreferencesContent | undefined> {\n if (!MapLayersUI.iTwinConfig) {\n return undefined;\n }\n\n const accessToken = undefined !== IModelApp.authorizationClient ? await IModelApp.authorizationClient.getAccessToken() : undefined;\n\n const settingResponse = await MapLayersUI.iTwinConfig.get({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: \"\",\n iTwinId,\n iModelId,\n });\n\n if (undefined === settingResponse || 0 === settingResponse.length) {\n return undefined;\n }\n\n let savedMapLayer;\n settingResponse.settingsMap?.forEach((savedLayer: any) => {\n if (savedLayer.url === url) {\n savedMapLayer = savedLayer;\n }\n });\n return savedMapLayer;\n }\n\n /** Get all MapLayerSources from the user's preferences, iTwin setting and iModel settings.\n * @param iTwinId id of the iTwin\n * @param iModelId id of the iModel\n * @throws if any of the calls to grab settings fail.\n */\n public static async getSources(iTwinId: GuidString, iModelId?: GuidString): Promise<MapLayerSource[]> {\n if (!MapLayersUI.iTwinConfig) {\n return [];\n }\n const accessToken = undefined !== IModelApp.authorizationClient ? await IModelApp.authorizationClient.getAccessToken() : undefined;\n\n const mapLayerList = [];\n\n try {\n const userResultByProject = await MapLayersUI.iTwinConfig.get({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: \"\",\n iTwinId,\n });\n if (undefined !== userResultByProject) {\n mapLayerList.push(userResultByProject);\n }\n } catch (err: any) {\n throw new Error(IModelApp.localization.getLocalizedString(\"mapLayers:CustomAttach.ErrorRetrieveUserProject\", { errorMessage: err }));\n }\n\n try {\n const userResultByIModel = await MapLayersUI.iTwinConfig.get({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: \"\",\n iTwinId,\n iModelId,\n });\n if (undefined !== userResultByIModel) {\n mapLayerList.push(userResultByIModel);\n }\n } catch (err: any) {\n throw new Error(IModelApp.localization.getLocalizedString(\"mapLayers:CustomAttach.ErrorRetrieveUserProject\", { errorMessage: err }));\n }\n\n const savedMapLayerSources: MapLayerSource[] = [];\n for (const mapLayer of mapLayerList) {\n mapLayer.forEach((savedLayer: any) => {\n const mapLayerSource = MapLayerSource.fromJSON(savedLayer as MapLayerPreferencesContent);\n if (mapLayerSource) {\n savedMapLayerSources.push(mapLayerSource);\n }\n });\n }\n return savedMapLayerSources;\n }\n\n private static get _preferenceNamespace() {\n return \"MapLayerSource-SettingsService\";\n }\n}\n"]}
1
+ {"version":3,"file":"MapLayerPreferences.js","sourceRoot":"","sources":["../../src/MapLayerPreferences.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC9G,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAW1C,gBAAgB;AAChB,MAAM,CAAN,IAAY,wBAIX;AAJD,WAAY,wBAAwB;IAClC,yEAAS,CAAA;IACT,6EAAW,CAAA;IACX,+EAAY,CAAA;AACd,CAAC,EAJW,wBAAwB,KAAxB,wBAAwB,QAInC;AASD;;;;;GAKG;AACH,MAAM,OAAO,mBAAmB;IAY9B;;;;;;OAMG;IACI,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,MAAsB,EAAE,OAAmB,EAAE,QAAqB,EAAE,aAAuB;QACzH,IAAI,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC;YAC7B,OAAO,KAAK,CAAC;QACf,CAAC;QACD,MAAM,WAAW,GAAG,SAAS,KAAK,SAAS,CAAC,mBAAmB,CAAC,CAAC,CAAC,MAAM,SAAS,CAAC,mBAAmB,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;QAEnI,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC;QACnC,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC;YACzB,OAAO,KAAK,CAAC;QACf,CAAC;QACD,MAAM,eAAe,GAA+B;YAClD,GAAG,EAAE,UAAU,CAAC,GAAG;YACnB,IAAI,EAAE,UAAU,CAAC,IAAI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T,CAAC,CAAC;YACH,IAAI,SAAS,KAAK,kBAAkB,EAAE,CAAC;gBACrC,YAAY,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;YACxC,CAAC;QACH,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CAAC,SAAS,CAAC,YAAY,CAAC,kBAAkB,CAAC,iDAAiD,EAAE,EAAE,YAAY,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;QACvI,CAAC;QAED,MAAM,oBAAoB,GAAqB,EAAE,CAAC;QAClD,KAAK,MAAM,QAAQ,IAAI,YAAY,EAAE,CAAC;YACpC,QAAQ,CAAC,OAAO,CAAC,CAAC,UAAe,EAAE,EAAE;gBACnC,MAAM,cAAc,GAAG,cAAc,CAAC,QAAQ,CAAC,UAAwC,CAAC,CAAC;gBACzF,IAAI,cAAc,EAAE,CAAC;oBACnB,oBAAoB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;gBAC5C,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;QACD,OAAO,oBAAoB,CAAC;IAC9B,CAAC;IAEO,MAAM,KAAK,oBAAoB;QACrC,OAAO,gCAAgC,CAAC;IAC1C,CAAC;;AA7UD;;;;;;GAMG;AACoB,wCAAoB,GAAG,IAAI,OAAO,EAEtD,CAAC,CAAC,mFAAmF","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 { BeEvent } from \"@itwin/core-bentley\";\nimport { IModelApp, MapLayerSource, NotifyMessageDetails, OutputMessagePriority } from \"@itwin/core-frontend\";\nimport { MapLayersUI } from \"./mapLayers\";\n\nimport type { GuidString } from \"@itwin/core-bentley\";\n/** @internal */\nexport interface MapLayerPreferencesContent {\n url: string;\n name: string;\n formatId: string;\n transparentBackground: boolean | undefined;\n}\n\n/** @internal */\nexport enum MapLayerSourceChangeType {\n Added = 0,\n Removed = 1,\n Replaced = 2,\n}\n\n/** @internal */\nexport interface MapLayerSourceArg {\n readonly source: MapLayerSource;\n readonly iTwinId: GuidString;\n readonly iModelId: GuidString;\n}\n\n/** A wrapper around user preferences to provide a way to store [[MapLayerSettings]].\n *\n * Note: This is currently internal only and used directly by the MapLayersExtension. It makes use of the IModelApp.authorizationClient if it exists.\n *\n * @internal\n */\nexport class MapLayerPreferences {\n /** Event raised whenever a source is added, replaced or removed:\n * changeType : Type of changed occurred.\n * oldSource : Source that was removed or replaced.\n * newSource : Source that was added or replacement of oldSource.\n *\n * @see [[MapLayerSourceChangeType]]\n */\n public static readonly onLayerSourceChanged = new BeEvent<\n (changeType: MapLayerSourceChangeType, oldSource?: MapLayerSource, newSource?: MapLayerSource) => void\n >(); // Used to notify the frontend that it needs to update its list of available layers\n\n /** Store the Map Layer source preference. If the same setting exists at a higher level, an error will be thrown and the setting will not be updated.\n *\n * Returns false if the settings object would override some other settings object in a larger scope i.e. storing settings on model when\n * a project setting exists with same name or map layer url.\n * @param source source to be stored on the setting service\n * @param storeOnIModel if true store the settings object on the model, if false store it on the project\n */\n public static async storeSource(source: MapLayerSource, iTwinId: GuidString, iModelId?: GuidString, storeOnIModel?: boolean): Promise<boolean> {\n if (!MapLayersUI.iTwinConfig) {\n return false;\n }\n const accessToken = undefined !== IModelApp.authorizationClient ? await IModelApp.authorizationClient.getAccessToken() : undefined;\n\n const sourceJSON = source.toJSON();\n if (!sourceJSON.formatId) {\n return false;\n }\n const mapLayerSetting: MapLayerPreferencesContent = {\n url: sourceJSON.url,\n name: sourceJSON.name,\n formatId: sourceJSON.formatId,\n transparentBackground: sourceJSON.transparentBackground,\n };\n\n const result: boolean = await MapLayerPreferences.delete(sourceJSON.url, sourceJSON.name, iTwinId, iModelId, storeOnIModel);\n if (result) {\n await MapLayersUI.iTwinConfig.save({\n accessToken,\n content: mapLayerSetting,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: sourceJSON.name,\n iTwinId,\n iModelId: storeOnIModel ? iModelId : undefined,\n });\n MapLayerPreferences.onLayerSourceChanged.raiseEvent(MapLayerSourceChangeType.Added, undefined, MapLayerSource.fromJSON(mapLayerSetting));\n return true;\n } else {\n return false;\n }\n }\n\n /** Replace the old map layer source with a new map layer source.\n *\n * The source is replaced at the same level that the original source is defined. (i.e. if the old source is defined at a project level, the new source will also be defined there.)\n *\n * @param oldSource\n * @param newSource\n * @param iTwinId\n * @param iModelId\n */\n public static async replaceSource(oldSource: MapLayerSource, newSource: MapLayerSource, iTwinId: GuidString, iModelId?: GuidString): Promise<void> {\n if (!MapLayersUI.iTwinConfig) {\n return;\n }\n const accessToken = undefined !== IModelApp.authorizationClient ? await IModelApp.authorizationClient.getAccessToken() : undefined;\n\n let storeOnIModel = false;\n try {\n await MapLayersUI.iTwinConfig.delete({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: oldSource.name,\n iTwinId,\n iModelId,\n });\n } catch {\n await MapLayersUI.iTwinConfig.delete({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: oldSource.name,\n iTwinId,\n });\n storeOnIModel = true;\n }\n\n const mapLayerSetting: MapLayerPreferencesContent = {\n url: newSource.url,\n name: newSource.name,\n formatId: newSource.formatId,\n transparentBackground: newSource.transparentBackground,\n };\n\n await MapLayersUI.iTwinConfig.save({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: newSource.name,\n iTwinId,\n iModelId: storeOnIModel ? iModelId : undefined,\n content: mapLayerSetting,\n });\n\n MapLayerPreferences.onLayerSourceChanged.raiseEvent(MapLayerSourceChangeType.Replaced, oldSource, newSource);\n }\n\n /** Deletes the provided MapLayerSource by name from both the iTwin or iModel level.\n *\n * @param source The source to delete. The name is used to identify the source.\n * @param iTwinId\n * @param iModelId\n */\n public static async deleteByName(source: MapLayerSource, iTwinId: GuidString, iModelId?: GuidString): Promise<void> {\n if (!MapLayersUI.iTwinConfig) {\n return;\n }\n const accessToken = undefined !== IModelApp.authorizationClient ? await IModelApp.authorizationClient.getAccessToken() : undefined;\n\n try {\n await MapLayersUI.iTwinConfig.delete({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: source.name,\n iTwinId,\n iModelId,\n });\n } catch {\n // failed to store based on iModelId, attempt using iTwinId\n await MapLayersUI.iTwinConfig.delete({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: source.name,\n iTwinId,\n });\n }\n\n MapLayerPreferences.onLayerSourceChanged.raiseEvent(MapLayerSourceChangeType.Removed, source, undefined);\n }\n\n /** Deletes the current setting with the provided key if it is defined at the same preference level.\n *\n * If the preference is defined within a different level, false will be returned indicating the setting should not be overriden.\n *\n * The two potential preference levels are iTwin and iModel.\n *\n * @param url\n * @param name\n * @param iTwinId\n * @param iModelId\n * @param storeOnIModel\n */\n private static async delete(url: string, name: string, iTwinId: GuidString, iModelId?: GuidString, storeOnIModel?: boolean): Promise<boolean> {\n if (!MapLayersUI.iTwinConfig) {\n return true;\n }\n const accessToken = undefined !== IModelApp.authorizationClient ? await IModelApp.authorizationClient.getAccessToken() : undefined;\n\n const iTwinPreferenceByName = await MapLayersUI.iTwinConfig.get({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: name,\n iTwinId,\n });\n\n if (undefined !== iTwinPreferenceByName && storeOnIModel) {\n const errorMessage = IModelApp.localization.getLocalizedString(\"mapLayers:CustomAttach.LayerExistsAsProjectSetting\", {\n layer: iTwinPreferenceByName.name,\n });\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, errorMessage));\n return false;\n } else if (iTwinPreferenceByName) {\n const infoMessage = IModelApp.localization.getLocalizedString(\"mapLayers:CustomAttach.LayerExistsOverwriting\", { layer: iTwinPreferenceByName.name });\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, infoMessage));\n await MapLayersUI.iTwinConfig.delete({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: iTwinPreferenceByName.name,\n iTwinId,\n });\n }\n\n // check if setting with url already exists, if it does, delete it\n const settingFromUrl = await MapLayerPreferences.getByUrl(url, iTwinId, undefined);\n if (settingFromUrl && storeOnIModel) {\n const errorMessage = IModelApp.localization.getLocalizedString(\"mapLayers:CustomAttach.LayerWithUrlExistsAsProjectSetting\", {\n url: settingFromUrl.url,\n name: settingFromUrl.name,\n });\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, errorMessage));\n return false;\n } else if (settingFromUrl) {\n const infoMessage = IModelApp.localization.getLocalizedString(\"mapLayers:CustomAttach.LayerWithUrlExistsOverwriting\", {\n url: settingFromUrl.url,\n oldName: settingFromUrl.name,\n newName: name,\n });\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, infoMessage));\n await MapLayersUI.iTwinConfig.delete({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: settingFromUrl.name,\n iTwinId,\n });\n }\n\n if (iModelId) {\n // delete any settings on model so user can update them if theres collisions\n const settingOnIModelFromName = await MapLayersUI.iTwinConfig.get({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: name,\n iTwinId,\n iModelId,\n });\n const settingFromUrlOnIModel = await MapLayerPreferences.getByUrl(url, iTwinId, iModelId);\n if (settingOnIModelFromName) {\n const infoMessage = IModelApp.localization.getLocalizedString(\"mapLayers:CustomAttach.LayerExistsOverwriting\", { layer: settingOnIModelFromName.name });\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, infoMessage));\n await MapLayersUI.iTwinConfig.delete({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: settingOnIModelFromName.name,\n iTwinId,\n iModelId,\n });\n }\n if (settingFromUrlOnIModel) {\n const infoMessage = IModelApp.localization.getLocalizedString(\"mapLayers:CustomAttach.LayerWithUrlExistsOverwriting\", {\n url: settingFromUrlOnIModel.url,\n oldName: settingFromUrlOnIModel.name,\n newName: name,\n });\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, infoMessage));\n await MapLayersUI.iTwinConfig.delete({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: settingFromUrlOnIModel.name,\n iTwinId,\n iModelId,\n });\n }\n }\n return true;\n }\n\n /** Attempts to get a map layer based off a specific url.\n * @param url\n * @param iTwinId\n * @param iModelId\n */\n public static async getByUrl(url: string, iTwinId: string, iModelId?: string): Promise<MapLayerPreferencesContent | undefined> {\n if (!MapLayersUI.iTwinConfig) {\n return undefined;\n }\n\n const accessToken = undefined !== IModelApp.authorizationClient ? await IModelApp.authorizationClient.getAccessToken() : undefined;\n\n const settingResponse = await MapLayersUI.iTwinConfig.get({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: \"\",\n iTwinId,\n iModelId,\n });\n\n if (undefined === settingResponse || 0 === settingResponse.length) {\n return undefined;\n }\n\n let savedMapLayer;\n settingResponse.settingsMap?.forEach((savedLayer: any) => {\n if (savedLayer.url === url) {\n savedMapLayer = savedLayer;\n }\n });\n return savedMapLayer;\n }\n\n /** Get all MapLayerSources from the user's preferences, iTwin setting and iModel settings.\n * @param iTwinId id of the iTwin\n * @param iModelId id of the iModel\n * @throws if any of the calls to grab settings fail.\n */\n public static async getSources(iTwinId: GuidString, iModelId?: GuidString): Promise<MapLayerSource[]> {\n if (!MapLayersUI.iTwinConfig) {\n return [];\n }\n const accessToken = undefined !== IModelApp.authorizationClient ? await IModelApp.authorizationClient.getAccessToken() : undefined;\n\n const mapLayerList = [];\n\n try {\n const userResultByProject = await MapLayersUI.iTwinConfig.get({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: \"\",\n iTwinId,\n });\n if (undefined !== userResultByProject) {\n mapLayerList.push(userResultByProject);\n }\n } catch (err: any) {\n throw new Error(IModelApp.localization.getLocalizedString(\"mapLayers:CustomAttach.ErrorRetrieveUserProject\", { errorMessage: err }));\n }\n\n try {\n const userResultByIModel = await MapLayersUI.iTwinConfig.get({\n accessToken,\n namespace: MapLayerPreferences._preferenceNamespace,\n key: \"\",\n iTwinId,\n iModelId,\n });\n if (undefined !== userResultByIModel) {\n mapLayerList.push(userResultByIModel);\n }\n } catch (err: any) {\n throw new Error(IModelApp.localization.getLocalizedString(\"mapLayers:CustomAttach.ErrorRetrieveUserProject\", { errorMessage: err }));\n }\n\n const savedMapLayerSources: MapLayerSource[] = [];\n for (const mapLayer of mapLayerList) {\n mapLayer.forEach((savedLayer: any) => {\n const mapLayerSource = MapLayerSource.fromJSON(savedLayer as MapLayerPreferencesContent);\n if (mapLayerSource) {\n savedMapLayerSources.push(mapLayerSource);\n }\n });\n }\n return savedMapLayerSources;\n }\n\n private static get _preferenceNamespace() {\n return \"MapLayerSource-SettingsService\";\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"PreferencesBrowserStorage.js","sourceRoot":"","sources":["../../src/PreferencesBrowserStorage.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAkBlD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,OAAO,yBAAyB;IAIpC,YAAY,oBAA4B,EAAE,IAAuC;QAC/E,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,qBAAqB,GAAG,oBAAoB,CAAC;IACpD,CAAC;IAEO,iBAAiB,CAAC,GAAe;QACvC,MAAM,UAAU,GAAG,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACxD,MAAM,WAAW,GAAG,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC3D,OAAO,GAAG,IAAI,CAAC,qBAAqB,GAAG,UAAU,GAAG,WAAW,EAAE,CAAC;IACpE,CAAC;IAEO,MAAM,CAAC,gBAAgB,CAAC,GAAqB;QACnD,IAAI,GAAG,CAAC,GAAG,EAAE;YACX,MAAM,KAAK,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;YACvD,OAAO,GAAG,KAAK,GAAG,GAAG,CAAC,GAAG,EAAE,CAAC;SAC7B;QAED,OAAO,EAAE,CAAC;IACZ,CAAC;IAEM,KAAK,CAAC,GAAG,CAAC,GAAkC;QACjD,MAAM,OAAO,GAAG,IAAI,cAAc,CAAkB,EAAE,WAAW,EAAE,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAClG,OAAO,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC;IACtE,CAAC;IAEM,KAAK,CAAC,MAAM,CAAC,GAAkC;QACpD,MAAM,OAAO,GAAG,IAAI,cAAc,CAAkB,EAAE,WAAW,EAAE,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAClG,OAAO,CAAC,MAAM,CAAC,yBAAyB,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC;IAClE,CAAC;IAEM,KAAK,CAAC,IAAI,CAAC,GAA+B;QAC/C,MAAM,OAAO,GAAG,IAAI,cAAc,CAAkB,EAAE,WAAW,EAAE,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAClG,OAAO,CAAC,IAAI,CAAC,yBAAyB,CAAC,gBAAgB,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IAC7E,CAAC;CACF","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 type { ITwinIdArg, PreferenceArg, PreferenceKeyArg, UserPreferencesAccess } from \"@itwin/core-frontend\";\nimport { BrowserStorage } from \"./BrowserStorage\";\n\n/** Index signature holding preferences content\n *\n * @internal\n */\ninterface KeyContentProps {\n [preferenceKey: string]: any;\n}\n\n/**\n * @beta\n */\nexport interface PreferencesBrowserStorageOptions {\n /** indicate whether or not delete function should throw an error if the provided key cannot be found. */\n throwOnDeleteMissingKey?: boolean;\n}\n\n/** User preferences implementation using browser's local storage.\n * It creates storage item key in the form of:\n * <storageItemKeyPrefix>.<itwin_guid?>.<imodel_guid?>\n *\n * <itwin_guid> and <imodel_guid> being optional.\n *\n * Each entry in the storage is a serialized JSON of the following index signature:\n * {\n * \"<preference_namespace?>.<preference_key>\": {\n * ...\n * <preferences_json_content>\n * },\n * ...\n * }\n * @beta\n */\nexport class PreferencesBrowserStorage implements UserPreferencesAccess {\n private readonly _options: PreferencesBrowserStorageOptions | undefined;\n private readonly _storageItemKeyPrefix: string;\n\n constructor(storageItemKeyPrefix: string, opts?: PreferencesBrowserStorageOptions) {\n this._options = opts;\n this._storageItemKeyPrefix = storageItemKeyPrefix;\n }\n\n private getStorageItemKey(arg: ITwinIdArg) {\n const itwinIdStr = arg.iTwinId ? `.${arg.iTwinId}` : \"\";\n const imodelIdStr = arg.iModelId ? `.${arg.iModelId}` : \"\";\n return `${this._storageItemKeyPrefix}${itwinIdStr}${imodelIdStr}`;\n }\n\n private static getPreferenceKey(arg: PreferenceKeyArg) {\n if (arg.key) {\n const nsStr = arg.namespace ? `${arg.namespace}.` : \"\";\n return `${nsStr}${arg.key}`;\n }\n\n return \"\";\n }\n\n public async get(arg: PreferenceKeyArg & ITwinIdArg) {\n const storage = new BrowserStorage<KeyContentProps>({ itemKeyName: this.getStorageItemKey(arg) });\n return storage.get(PreferencesBrowserStorage.getPreferenceKey(arg));\n }\n\n public async delete(arg: PreferenceKeyArg & ITwinIdArg) {\n const storage = new BrowserStorage<KeyContentProps>({ itemKeyName: this.getStorageItemKey(arg) });\n storage.delete(PreferencesBrowserStorage.getPreferenceKey(arg));\n }\n\n public async save(arg: PreferenceArg & ITwinIdArg) {\n const storage = new BrowserStorage<KeyContentProps>({ itemKeyName: this.getStorageItemKey(arg) });\n storage.save(PreferencesBrowserStorage.getPreferenceKey(arg), arg.content);\n }\n}\n"]}
1
+ {"version":3,"file":"PreferencesBrowserStorage.js","sourceRoot":"","sources":["../../src/PreferencesBrowserStorage.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAkBlD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,OAAO,yBAAyB;IAIpC,YAAY,oBAA4B,EAAE,IAAuC;QAC/E,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,qBAAqB,GAAG,oBAAoB,CAAC;IACpD,CAAC;IAEO,iBAAiB,CAAC,GAAe;QACvC,MAAM,UAAU,GAAG,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACxD,MAAM,WAAW,GAAG,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC3D,OAAO,GAAG,IAAI,CAAC,qBAAqB,GAAG,UAAU,GAAG,WAAW,EAAE,CAAC;IACpE,CAAC;IAEO,MAAM,CAAC,gBAAgB,CAAC,GAAqB;QACnD,IAAI,GAAG,CAAC,GAAG,EAAE,CAAC;YACZ,MAAM,KAAK,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;YACvD,OAAO,GAAG,KAAK,GAAG,GAAG,CAAC,GAAG,EAAE,CAAC;QAC9B,CAAC;QAED,OAAO,EAAE,CAAC;IACZ,CAAC;IAEM,KAAK,CAAC,GAAG,CAAC,GAAkC;QACjD,MAAM,OAAO,GAAG,IAAI,cAAc,CAAkB,EAAE,WAAW,EAAE,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAClG,OAAO,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC;IACtE,CAAC;IAEM,KAAK,CAAC,MAAM,CAAC,GAAkC;QACpD,MAAM,OAAO,GAAG,IAAI,cAAc,CAAkB,EAAE,WAAW,EAAE,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAClG,OAAO,CAAC,MAAM,CAAC,yBAAyB,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC;IAClE,CAAC;IAEM,KAAK,CAAC,IAAI,CAAC,GAA+B;QAC/C,MAAM,OAAO,GAAG,IAAI,cAAc,CAAkB,EAAE,WAAW,EAAE,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAClG,OAAO,CAAC,IAAI,CAAC,yBAAyB,CAAC,gBAAgB,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IAC7E,CAAC;CACF","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 type { ITwinIdArg, PreferenceArg, PreferenceKeyArg, UserPreferencesAccess } from \"@itwin/core-frontend\";\nimport { BrowserStorage } from \"./BrowserStorage\";\n\n/** Index signature holding preferences content\n *\n * @internal\n */\ninterface KeyContentProps {\n [preferenceKey: string]: any;\n}\n\n/**\n * @beta\n */\nexport interface PreferencesBrowserStorageOptions {\n /** indicate whether or not delete function should throw an error if the provided key cannot be found. */\n throwOnDeleteMissingKey?: boolean;\n}\n\n/** User preferences implementation using browser's local storage.\n * It creates storage item key in the form of:\n * <storageItemKeyPrefix>.<itwin_guid?>.<imodel_guid?>\n *\n * <itwin_guid> and <imodel_guid> being optional.\n *\n * Each entry in the storage is a serialized JSON of the following index signature:\n * {\n * \"<preference_namespace?>.<preference_key>\": {\n * ...\n * <preferences_json_content>\n * },\n * ...\n * }\n * @beta\n */\nexport class PreferencesBrowserStorage implements UserPreferencesAccess {\n private readonly _options: PreferencesBrowserStorageOptions | undefined;\n private readonly _storageItemKeyPrefix: string;\n\n constructor(storageItemKeyPrefix: string, opts?: PreferencesBrowserStorageOptions) {\n this._options = opts;\n this._storageItemKeyPrefix = storageItemKeyPrefix;\n }\n\n private getStorageItemKey(arg: ITwinIdArg) {\n const itwinIdStr = arg.iTwinId ? `.${arg.iTwinId}` : \"\";\n const imodelIdStr = arg.iModelId ? `.${arg.iModelId}` : \"\";\n return `${this._storageItemKeyPrefix}${itwinIdStr}${imodelIdStr}`;\n }\n\n private static getPreferenceKey(arg: PreferenceKeyArg) {\n if (arg.key) {\n const nsStr = arg.namespace ? `${arg.namespace}.` : \"\";\n return `${nsStr}${arg.key}`;\n }\n\n return \"\";\n }\n\n public async get(arg: PreferenceKeyArg & ITwinIdArg) {\n const storage = new BrowserStorage<KeyContentProps>({ itemKeyName: this.getStorageItemKey(arg) });\n return storage.get(PreferencesBrowserStorage.getPreferenceKey(arg));\n }\n\n public async delete(arg: PreferenceKeyArg & ITwinIdArg) {\n const storage = new BrowserStorage<KeyContentProps>({ itemKeyName: this.getStorageItemKey(arg) });\n storage.delete(PreferencesBrowserStorage.getPreferenceKey(arg));\n }\n\n public async save(arg: PreferenceArg & ITwinIdArg) {\n const storage = new BrowserStorage<KeyContentProps>({ itemKeyName: this.getStorageItemKey(arg) });\n storage.save(PreferencesBrowserStorage.getPreferenceKey(arg), arg.content);\n }\n}\n"]}
@@ -1,19 +1,18 @@
1
- /// <reference types="react" />
2
- import type { ToolbarItem, UiItemsProvider } from "@itwin/appui-react";
3
- import { StagePanelLocation, StagePanelSection, ToolbarOrientation, ToolbarUsage, ToolItemDef, WidgetState } from "@itwin/appui-react";
1
+ import { StagePanelLocation, StagePanelSection, WidgetState } from "@itwin/appui-react";
2
+ import type { ToolbarActionItem, ToolbarItem, UiItemsProvider } from "@itwin/appui-react";
4
3
  import type { MapFeatureInfoOptions } from "./Interfaces";
5
- export declare const getMapFeatureInfoToolItemDef: () => ToolItemDef;
4
+ export declare const getMapFeatureInfoToolItemDef: (itemPriority: number) => ToolbarActionItem;
6
5
  export declare class FeatureInfoUiItemsProvider implements UiItemsProvider {
7
6
  private _featureInfoOpts;
8
7
  readonly id = "FeatureInfoUiItemsProvider";
9
8
  static readonly widgetId = "map-layers:mapFeatureInfoWidget";
10
9
  constructor(_featureInfoOpts: MapFeatureInfoOptions);
11
- provideToolbarItems(_stageId: string, stageUsage: string, toolbarUsage: ToolbarUsage, toolbarOrientation: ToolbarOrientation): ReadonlyArray<ToolbarItem>;
10
+ getToolbarItems(): ReadonlyArray<ToolbarItem>;
12
11
  provideWidgets(_stageId: string, stageUsage: string, location: StagePanelLocation, section?: StagePanelSection): {
13
12
  id: string;
14
13
  label: string;
15
- icon: JSX.Element;
16
- content: JSX.Element;
14
+ icon: import("react/jsx-runtime").JSX.Element;
15
+ content: import("react/jsx-runtime").JSX.Element;
17
16
  defaultState: WidgetState;
18
17
  }[];
19
18
  }
@@ -1 +1 @@
1
- {"version":3,"file":"FeatureInfoUiItemsProvider.d.ts","sourceRoot":"","sources":["../../../src/ui/FeatureInfoUiItemsProvider.tsx"],"names":[],"mappings":";AAMA,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EAGjB,kBAAkB,EAClB,YAAY,EACZ,WAAW,EACX,WAAW,EACZ,MAAM,oBAAoB,CAAC;AAS5B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AA+B1D,eAAO,MAAM,4BAA4B,QAAO,WAa5C,CAAC;AAEL,qBAAa,0BAA2B,YAAW,eAAe;IAK7C,OAAO,CAAC,gBAAgB;IAH3C,SAAgB,EAAE,gCAAgC;IAClD,gBAAuB,QAAQ,qCAAqC;gBAEzC,gBAAgB,EAAE,qBAAqB;IAE3D,mBAAmB,CACxB,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,YAAY,EAC1B,kBAAkB,EAAE,kBAAkB,GACrC,aAAa,CAAC,WAAW,CAAC;IAatB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE,iBAAiB;;;;;;;CAgBtH"}
1
+ {"version":3,"file":"FeatureInfoUiItemsProvider.d.ts","sourceRoot":"","sources":["../../../src/ui/FeatureInfoUiItemsProvider.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAsE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAQ5J,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAG1F,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AA4B1D,eAAO,MAAM,4BAA4B,iBAAkB,MAAM,KAAG,iBAqBnE,CAAC;AAEF,qBAAa,0BAA2B,YAAW,eAAe;IAI7C,OAAO,CAAC,gBAAgB;IAH3C,SAAgB,EAAE,gCAAgC;IAClD,gBAAuB,QAAQ,qCAAqC;gBAEzC,gBAAgB,EAAE,qBAAqB;IAE3D,eAAe,IAAI,aAAa,CAAC,WAAW,CAAC;IAQ7C,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE,iBAAiB;;;;;;;CAgBtH"}
@@ -4,18 +4,17 @@ import { jsx as _jsx } from "react/jsx-runtime";
4
4
  * See LICENSE.md in the project root for license terms and full copyright notice.
5
5
  *--------------------------------------------------------------------------------------------*/
6
6
  import { ConditionalBooleanValue } from "@itwin/appui-abstract";
7
- import { StagePanelLocation, StagePanelSection, StageUsage, ToolbarHelper, ToolbarOrientation, ToolbarUsage, ToolItemDef, WidgetState, } from "@itwin/appui-react";
7
+ import { StagePanelLocation, StagePanelSection, StageUsage, ToolbarItemUtilities, ToolbarOrientation, ToolbarUsage, WidgetState } from "@itwin/appui-react";
8
8
  import { IModelApp } from "@itwin/core-frontend";
9
9
  import { SvgMapInfo } from "@itwin/itwinui-icons-react";
10
10
  import { MapFeatureInfoTool } from "@itwin/map-layers-formats";
11
11
  import { MapLayersUI } from "../mapLayers";
12
- import { MapFeatureInfoWidget } from "./widget/FeatureInfoWidget";
13
12
  import { MapLayersSyncUiEventId } from "../MapLayersActionIds";
13
+ import { MapFeatureInfoWidget } from "./widget/FeatureInfoWidget";
14
14
  const supportsMapFeatureInfo = (vp, isOverlay, mapLayerProps) => {
15
15
  for (let mapLayerIndex = 0; mapLayerIndex < mapLayerProps.length; mapLayerIndex++) {
16
16
  if (mapLayerProps[mapLayerIndex].visible && mapLayerProps[mapLayerIndex].transparency !== 1.0) {
17
17
  const layerProvider = vp.getMapLayerImageryProvider({ index: mapLayerIndex, isOverlay });
18
- // eslint-disable-next-line @itwin/no-internal
19
18
  if (layerProvider?.supportsMapFeatureInfo) {
20
19
  return true;
21
20
  }
@@ -37,31 +36,36 @@ const isMapFeatureInfoSupported = () => {
37
36
  }
38
37
  return false;
39
38
  };
40
- export const getMapFeatureInfoToolItemDef = () => new ToolItemDef({
41
- toolId: MapFeatureInfoTool.toolId,
42
- iconSpec: _jsx(SvgMapInfo, {}),
43
- label: MapLayersUI.localization.getLocalizedString("mapLayers:FeatureInfoWidget.Label"),
44
- description: () => MapFeatureInfoTool.description,
45
- execute: async () => {
46
- await IModelApp.tools.run(MapFeatureInfoTool.toolId);
47
- },
48
- isHidden: new ConditionalBooleanValue(() => {
49
- // Hide the MapFeatureInfoTool if the Map Layers toggle is off or no ArcGISFeature layers are active
50
- return !isMapFeatureInfoSupported();
51
- }, [MapLayersSyncUiEventId.MapImageryChanged]),
52
- });
39
+ export const getMapFeatureInfoToolItemDef = (itemPriority) => {
40
+ return ToolbarItemUtilities.createActionItem({
41
+ id: MapFeatureInfoTool.toolId,
42
+ icon: _jsx(SvgMapInfo, {}), // TODO: Update to iconNode when moving to 5.x appui-react
43
+ label: MapLayersUI.localization.getLocalizedString("mapLayers:FeatureInfoWidget.Label"),
44
+ description: MapFeatureInfoTool.description,
45
+ itemPriority,
46
+ execute: async () => {
47
+ await IModelApp.tools.run(MapFeatureInfoTool.toolId);
48
+ },
49
+ isHidden: new ConditionalBooleanValue(() => {
50
+ // Hide the MapFeatureInfoTool if the Map Layers toggle is off or no ArcGISFeature layers are active
51
+ return !isMapFeatureInfoSupported();
52
+ }, [MapLayersSyncUiEventId.MapImageryChanged]),
53
+ layouts: {
54
+ standard: {
55
+ orientation: ToolbarOrientation.Vertical,
56
+ usage: ToolbarUsage.ContentManipulation,
57
+ }
58
+ }
59
+ });
60
+ };
53
61
  export class FeatureInfoUiItemsProvider {
54
62
  constructor(_featureInfoOpts) {
55
63
  this._featureInfoOpts = _featureInfoOpts;
56
- // eslint-disable-line deprecation/deprecation
57
64
  this.id = "FeatureInfoUiItemsProvider";
58
65
  }
59
- provideToolbarItems(_stageId, stageUsage, toolbarUsage, toolbarOrientation) {
60
- if (!this._featureInfoOpts?.disableDefaultFeatureInfoTool &&
61
- stageUsage === StageUsage.General &&
62
- toolbarUsage === ToolbarUsage.ContentManipulation &&
63
- toolbarOrientation === ToolbarOrientation.Vertical) {
64
- return [ToolbarHelper.createToolbarItemFromItemDef(60, getMapFeatureInfoToolItemDef())];
66
+ getToolbarItems() {
67
+ if (!this._featureInfoOpts?.disableDefaultFeatureInfoTool) {
68
+ return [getMapFeatureInfoToolItemDef(60)];
65
69
  }
66
70
  return [];
67
71
  }
@@ -1 +1 @@
1
- {"version":3,"file":"FeatureInfoUiItemsProvider.js","sourceRoot":"","s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vC,qBAAgB,GAAhB,gBAAgB,CAAuB;QAJlE,8CAA8C;QAC9B,OAAE,GAAG,4BAA4B,CAAC;IAGmB,CAAC;IAE/D,mBAAmB,CACxB,QAAgB,EAChB,UAAkB,EAClB,YAA0B,EAC1B,kBAAsC;QAEtC,IACE,CAAC,IAAI,CAAC,gBAAgB,EAAE,6BAA6B;YACrD,UAAU,KAAK,UAAU,CAAC,OAAO;YACjC,YAAY,KAAK,YAAY,CAAC,mBAAmB;YACjD,kBAAkB,KAAK,kBAAkB,CAAC,QAAQ,EAClD;YACA,OAAO,CAAC,aAAa,CAAC,4BAA4B,CAAC,EAAE,EAAE,4BAA4B,EAAE,CAAC,CAAC,CAAC;SACzF;QAED,OAAO,EAAE,CAAC;IACZ,CAAC;IAEM,cAAc,CAAC,QAAgB,EAAE,UAAkB,EAAE,QAA4B,EAAE,OAA2B;QACnH,MAAM,OAAO,GAAG,EAAE,CAAC;QAEnB,MAAM,UAAU,GAAG,OAAO,IAAI,iBAAiB,CAAC,GAAG,CAAC;QACpD,IAAI,UAAU,KAAK,iBAAiB,CAAC,GAAG,IAAI,UAAU,KAAK,UAAU,CAAC,OAAO,IAAI,QAAQ,KAAK,kBAAkB,CAAC,KAAK,EAAE;YACtH,OAAO,CAAC,IAAI,CAAC;gBACX,EAAE,EAAE,0BAA0B,CAAC,QAAQ;gBACvC,KAAK,EAAE,WAAW,CAAC,YAAY,CAAC,kBAAkB,CAAC,mCAAmC,CAAC;gBACvF,IAAI,EAAE,KAAC,UAAU,KAAG;gBACpB,OAAO,EAAE,KAAC,oBAAoB,IAAC,eAAe,EAAE,IAAI,CAAC,gBAAgB,GAAI;gBACzE,YAAY,EAAE,WAAW,CAAC,MAAM;aACjC,CAAC,CAAC;SACJ;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;;AArCsB,mCAAQ,GAAG,iCAAiC,CAAC","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 { ConditionalBooleanValue } from \"@itwin/appui-abstract\";\nimport type { ToolbarItem, UiItemsProvider } from \"@itwin/appui-react\";\nimport {\n StagePanelLocation,\n StagePanelSection,\n StageUsage,\n ToolbarHelper,\n ToolbarOrientation,\n ToolbarUsage,\n ToolItemDef,\n WidgetState,\n} from \"@itwin/appui-react\";\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport type { ScreenViewport } from \"@itwin/core-frontend\";\nimport type { MapLayerProps } from \"@itwin/core-common\";\nimport { SvgMapInfo } from \"@itwin/itwinui-icons-react\";\nimport { MapFeatureInfoTool } from \"@itwin/map-layers-formats\";\n\nimport { MapLayersUI } from \"../mapLayers\";\nimport { MapFeatureInfoWidget } from \"./widget/FeatureInfoWidget\";\nimport type { MapFeatureInfoOptions } from \"./Interfaces\";\nimport { MapLayersSyncUiEventId } from \"../MapLayersActionIds\";\n\nconst supportsMapFeatureInfo = (vp: ScreenViewport, isOverlay: boolean, mapLayerProps: MapLayerProps[]): boolean => {\n for (let mapLayerIndex = 0; mapLayerIndex < mapLayerProps.length; mapLayerIndex++) {\n if (mapLayerProps[mapLayerIndex].visible && mapLayerProps[mapLayerIndex].transparency !== 1.0) {\n const layerProvider = vp.getMapLayerImageryProvider({ index: mapLayerIndex, isOverlay });\n // eslint-disable-next-line @itwin/no-internal\n if (layerProvider?.supportsMapFeatureInfo) {\n return true;\n }\n }\n }\n return false;\n};\n\nconst isMapFeatureInfoSupported = (): boolean => {\n const vp = IModelApp.viewManager.selectedView;\n if (vp?.viewFlags.backgroundMap) {\n const backgroundLayers = vp.displayStyle.settings.mapImagery.backgroundLayers.map((value) => value.toJSON());\n if (supportsMapFeatureInfo(vp, false, backgroundLayers)) {\n return true;\n }\n const overlayLayers = vp.displayStyle.settings.mapImagery.overlayLayers.map((value) => value.toJSON());\n if (supportsMapFeatureInfo(vp, true, overlayLayers)) {\n return true;\n }\n }\n return false;\n};\n\nexport const getMapFeatureInfoToolItemDef = (): ToolItemDef =>\n new ToolItemDef({\n toolId: MapFeatureInfoTool.toolId,\n iconSpec: <SvgMapInfo />,\n label: MapLayersUI.localization.getLocalizedString(\"mapLayers:FeatureInfoWidget.Label\"),\n description: () => MapFeatureInfoTool.description,\n execute: async () => {\n await IModelApp.tools.run(MapFeatureInfoTool.toolId);\n },\n isHidden: new ConditionalBooleanValue(() => {\n // Hide the MapFeatureInfoTool if the Map Layers toggle is off or no ArcGISFeature layers are active\n return !isMapFeatureInfoSupported();\n }, [MapLayersSyncUiEventId.MapImageryChanged]),\n });\n\nexport class FeatureInfoUiItemsProvider implements UiItemsProvider {\n // eslint-disable-line deprecation/deprecation\n public readonly id = \"FeatureInfoUiItemsProvider\";\n public static readonly widgetId = \"map-layers:mapFeatureInfoWidget\";\n\n public constructor(private _featureInfoOpts: MapFeatureInfoOptions) {}\n\n public provideToolbarItems(\n _stageId: string,\n stageUsage: string,\n toolbarUsage: ToolbarUsage,\n toolbarOrientation: ToolbarOrientation,\n ): ReadonlyArray<ToolbarItem> {\n if (\n !this._featureInfoOpts?.disableDefaultFeatureInfoTool &&\n stageUsage === StageUsage.General &&\n toolbarUsage === ToolbarUsage.ContentManipulation &&\n toolbarOrientation === ToolbarOrientation.Vertical\n ) {\n return [ToolbarHelper.createToolbarItemFromItemDef(60, getMapFeatureInfoToolItemDef())];\n }\n\n return [];\n }\n\n public provideWidgets(_stageId: string, stageUsage: string, location: StagePanelLocation, section?: StagePanelSection) {\n const widgets = [];\n\n const tmpSection = section ?? StagePanelSection.End;\n if (tmpSection === StagePanelSection.End && stageUsage === StageUsage.General && location === StagePanelLocation.Right) {\n widgets.push({\n id: FeatureInfoUiItemsProvider.widgetId,\n label: MapLayersUI.localization.getLocalizedString(\"mapLayers:FeatureInfoWidget.Label\"),\n icon: <SvgMapInfo />,\n content: <MapFeatureInfoWidget featureInfoOpts={this._featureInfoOpts} />,\n defaultState: WidgetState.Hidden,\n });\n }\n\n return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B,mCAAQ,GAAG,iCAAiC,AAApC,CAAqC","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 { ConditionalBooleanValue } from \"@itwin/appui-abstract\";\nimport { StagePanelLocation, StagePanelSection, StageUsage, ToolbarItemUtilities, ToolbarOrientation, ToolbarUsage, WidgetState } from \"@itwin/appui-react\";\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport { SvgMapInfo } from \"@itwin/itwinui-icons-react\";\nimport { MapFeatureInfoTool } from \"@itwin/map-layers-formats\";\nimport { MapLayersUI } from \"../mapLayers\";\nimport { MapLayersSyncUiEventId } from \"../MapLayersActionIds\";\nimport { MapFeatureInfoWidget } from \"./widget/FeatureInfoWidget\";\n\nimport type { ToolbarActionItem, ToolbarItem, UiItemsProvider } from \"@itwin/appui-react\";\nimport type { ScreenViewport } from \"@itwin/core-frontend\";\nimport type { MapLayerProps } from \"@itwin/core-common\";\nimport type { MapFeatureInfoOptions } from \"./Interfaces\";\nconst supportsMapFeatureInfo = (vp: ScreenViewport, isOverlay: boolean, mapLayerProps: MapLayerProps[]): boolean => {\n for (let mapLayerIndex = 0; mapLayerIndex < mapLayerProps.length; mapLayerIndex++) {\n if (mapLayerProps[mapLayerIndex].visible && mapLayerProps[mapLayerIndex].transparency !== 1.0) {\n const layerProvider = vp.getMapLayerImageryProvider({ index: mapLayerIndex, isOverlay });\n if (layerProvider?.supportsMapFeatureInfo) {\n return true;\n }\n }\n }\n return false;\n};\n\nconst isMapFeatureInfoSupported = (): boolean => {\n const vp = IModelApp.viewManager.selectedView;\n if (vp?.viewFlags.backgroundMap) {\n const backgroundLayers = vp.displayStyle.settings.mapImagery.backgroundLayers.map((value) => value.toJSON());\n if (supportsMapFeatureInfo(vp, false, backgroundLayers)) {\n return true;\n }\n const overlayLayers = vp.displayStyle.settings.mapImagery.overlayLayers.map((value) => value.toJSON());\n if (supportsMapFeatureInfo(vp, true, overlayLayers)) {\n return true;\n }\n }\n return false;\n};\n\nexport const getMapFeatureInfoToolItemDef = (itemPriority: number): ToolbarActionItem => {\n return ToolbarItemUtilities.createActionItem({\n id: MapFeatureInfoTool.toolId,\n icon: <SvgMapInfo />, // TODO: Update to iconNode when moving to 5.x appui-react\n label: MapLayersUI.localization.getLocalizedString(\"mapLayers:FeatureInfoWidget.Label\"),\n description: MapFeatureInfoTool.description,\n itemPriority,\n execute: async () => {\n await IModelApp.tools.run(MapFeatureInfoTool.toolId);\n },\n isHidden: new ConditionalBooleanValue(() => {\n // Hide the MapFeatureInfoTool if the Map Layers toggle is off or no ArcGISFeature layers are active\n return !isMapFeatureInfoSupported();\n }, [MapLayersSyncUiEventId.MapImageryChanged]),\n layouts: {\n standard: {\n orientation: ToolbarOrientation.Vertical,\n usage: ToolbarUsage.ContentManipulation,\n }\n }\n });\n};\n\nexport class FeatureInfoUiItemsProvider implements UiItemsProvider {\n public readonly id = \"FeatureInfoUiItemsProvider\";\n public static readonly widgetId = \"map-layers:mapFeatureInfoWidget\";\n\n public constructor(private _featureInfoOpts: MapFeatureInfoOptions) {}\n\n public getToolbarItems(): ReadonlyArray<ToolbarItem> {\n if (!this._featureInfoOpts?.disableDefaultFeatureInfoTool) {\n return [getMapFeatureInfoToolItemDef(60)];\n }\n\n return [];\n }\n\n public provideWidgets(_stageId: string, stageUsage: string, location: StagePanelLocation, section?: StagePanelSection) {\n const widgets = [];\n\n const tmpSection = section ?? StagePanelSection.End;\n if (tmpSection === StagePanelSection.End && stageUsage === StageUsage.General && location === StagePanelLocation.Right) {\n widgets.push({\n id: FeatureInfoUiItemsProvider.widgetId,\n label: MapLayersUI.localization.getLocalizedString(\"mapLayers:FeatureInfoWidget.Label\"),\n icon: <SvgMapInfo />,\n content: <MapFeatureInfoWidget featureInfoOpts={this._featureInfoOpts} />,\n defaultState: WidgetState.Hidden,\n });\n }\n\n return widgets;\n }\n}\n"]}
@@ -41,7 +41,7 @@ export interface MapLayerOptions {
41
41
  export interface MapFeatureInfoPropertyGridOptions {
42
42
  isPropertySelectionEnabled?: boolean;
43
43
  }
44
- export declare type MapHitEvent = BeEvent<(hit: HitDetail) => void>;
44
+ export type MapHitEvent = BeEvent<(hit: HitDetail) => void>;
45
45
  export interface MapFeatureInfoOptions {
46
46
  disableDefaultFeatureInfoTool?: boolean;
47
47
  showLoadProgressAnimation?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"Interfaces.d.ts","sourceRoot":"","sources":["../../../src/ui/Interfaces.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACjF,OAAO,KAAK,EAAE,SAAS,EAAE,uBAAuB,EAAE,+BAA+B,EAAE,MAAM,sBAAsB,CAAC;AAEhH,MAAM,WAAW,qBAAqB;IACpC,WAAW;IACX,IAAI,EAAE,MAAM,CAAC;IACb,qFAAqF;IACrF,MAAM,EAAE,MAAM,CAAC;IACf,mCAAmC;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc,EAAE,+BAA+B,CAAC;IAChD,2MAA2M;IAC3M,YAAY,EAAE,MAAM,CAAC;IACrB,6BAA6B;IAC7B,qBAAqB,EAAE,OAAO,CAAC;IAC/B,qCAAqC;IACrC,SAAS,EAAE,OAAO,CAAC;IACnB,kCAAkC;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,8BAA8B;IAC9B,SAAS,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC/B,iCAAiC;IACjC,aAAa,EAAE,OAAO,CAAC;IACvB,uEAAuE;IACvE,QAAQ,CAAC,EAAE,uBAAuB,CAAC;IAEnC,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IACjC,Q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AAI;aACrE,CAAC,CAAC;SACJ;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;CACF","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
+ {"version":3,"file":"MapLayersUiItemsProvider.js","sourceRoot":"","sources":["../../../src/ui/MapLayersUiItemsProvider.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACvF,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE3D,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,MAAM,OAAO,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,iBAAiB,CAAC,KAAK,CAAC;QACtD,IAAI,UAAU,KAAK,UAAU,CAAC,OAAO,IAAI,QAAQ,KAAK,kBAAkB,CAAC,KAAK,IAAI,UAAU,KAAK,iBAAiB,CAAC,KAAK,EAAE,CAAC;YACzH,OAAO,CAAC,IAAI,CAAC;gBACX,EAAE,EAAE,4BAA4B;gBAChC,KAAK,EAAE,WAAW,CAAC,YAAY,CAAC,kBAAkB,CAAC,wBAAwB,CAAC;gBAC5E,IAAI,EAAE,UAAU;gBAChB,OAAO,EAAE,KAAC,eAAe,IAAC,eAAe,EAAE,IAAI,CAAC,gBAAgB,GAAI;aACrE,CAAC,CAAC;QACL,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;CACF","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,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  /** @internal */
3
2
  export declare enum AttachLayerButtonType {
4
3
  Primary = 0,
@@ -11,5 +10,5 @@ export interface AttachLayerPopupButtonProps {
11
10
  disabled?: boolean;
12
11
  }
13
12
  /** @internal */
14
- export declare function AttachLayerPopupButton(props: AttachLayerPopupButtonProps): JSX.Element;
13
+ export declare function AttachLayerPopupButton(props: AttachLayerPopupButtonProps): import("react/jsx-runtime").JSX.Element;
15
14
  //# sourceMappingURL=AttachLayerPopupButton.d.ts.map
@@ -1 +1 @@
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
+ {"version":3,"file":"AttachLayerPopupButton.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/AttachLayerPopupButton.tsx"],"names":[],"mappings":"AAogBA,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;AAChB,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,2BAA2B,2CAgIxE"}
@@ -8,8 +8,8 @@ import { RelativePosition } from "@itwin/appui-abstract";
8
8
  import { UiFramework } from "@itwin/appui-react";
9
9
  import { IModelApp, MapLayerSource, MapLayerSourceStatus, NotifyMessageDetails, OutputMessagePriority } from "@itwin/core-frontend";
10
10
  import * as UiCore from "@itwin/core-react";
11
- import { SvgAdd } from "@itwin/itwinui-icons-react";
12
- import { Button, IconButton, Input } from "@itwin/itwinui-react";
11
+ import { SvgAdd, SvgDelete, SvgEdit } from "@itwin/itwinui-icons-react";
12
+ import { Button, IconButton, Input, List, ListItem, ProgressRadial, Text } from "@itwin/itwinui-react";
13
13
  import { MapLayerPreferences } from "../../MapLayerPreferences";
14
14
  import { MapLayersUI } from "../../mapLayers";
15
15
  import { ConfirmMessageDialog } from "./ConfirmMessageDialog";
@@ -22,7 +22,6 @@ var LayerAction;
22
22
  LayerAction[LayerAction["New"] = 0] = "New";
23
23
  LayerAction[LayerAction["Edit"] = 1] = "Edit";
24
24
  })(LayerAction || (LayerAction = {}));
25
- // eslint-disable-next-line @typescript-eslint/naming-convention
26
25
  function AttachLayerPanel({ isOverlay, onLayerAttached, onHandleOutsideClick }) {
27
26
  const [layerNameToAdd, setLayerNameToAdd] = React.useState();
28
27
  const [sourceFilterString, setSourceFilterString] = React.useState();
@@ -274,19 +273,6 @@ function AttachLayerPanel({ isOverlay, onLayerAttached, onHandleOutsideClick })
274
273
  const handleAttach = React.useCallback((mapName) => {
275
274
  setLayerNameToAdd(mapName);
276
275
  }, []);
277
- const handleKeypressOnSourceList = React.useCallback((event) => {
278
- const key = event.key;
279
- if (key === "Enter") {
280
- event.preventDefault();
281
- const mapName = event.currentTarget?.dataset?.value;
282
- if (mapName && mapName.length) {
283
- handleAttach(mapName);
284
- }
285
- }
286
- }, [handleAttach]);
287
- const onListboxValueChange = React.useCallback((mapName) => {
288
- setLayerNameToAdd(mapName);
289
- }, []);
290
276
  const handleNoConfirmation = React.useCallback((_layerName) => {
291
277
  UiFramework.dialogs.modal.close();
292
278
  resumeOutsideClick();
@@ -299,7 +285,7 @@ function AttachLayerPanel({ isOverlay, onLayerAttached, onHandleOutsideClick })
299
285
  const msg = MapLayersUI.localization.getLocalizedString("mapLayers:CustomAttach.RemoveLayerDefSuccess", { layerName });
300
286
  IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, msg));
301
287
  }
302
- catch (err) {
288
+ catch {
303
289
  const msg = MapLayersUI.localization.getLocalizedString("mapLayers:CustomAttach.RemoveLayerDefError", { layerName });
304
290
  IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, msg));
305
291
  }
@@ -314,7 +300,7 @@ function AttachLayerPanel({ isOverlay, onLayerAttached, onHandleOutsideClick })
314
300
  event.stopPropagation(); // We don't want the owning ListBox to react on mouse click.
315
301
  const layerName = source.name;
316
302
  const msg = MapLayersUI.localization.getLocalizedString("mapLayers:CustomAttach.RemoveLayerDefDialogMessage", { layerName });
317
- UiFramework.dialogs.modal.open(_jsx(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) }));
303
+ UiFramework.dialogs.modal.open(_jsx(ConfirmMessageDialog, { className: "map-sources-delete-confirmation", title: removeLayerDefDialogTitle, message: msg, maxWidth: 400, opened: true, onYesResult: async () => handleYesConfirmation(source), onNoResult: () => handleNoConfirmation(layerName) }));
318
304
  if (onHandleOutsideClick) {
319
305
  onHandleOutsideClick(false);
320
306
  }
@@ -324,7 +310,7 @@ function AttachLayerPanel({ isOverlay, onLayerAttached, onHandleOutsideClick })
324
310
  */
325
311
  const onItemEditButtonClicked = React.useCallback((event) => {
326
312
  event.stopPropagation(); // We don't want the owning ListBox to react on mouse click.
327
- const targetLayerName = event?.currentTarget?.parentNode?.dataset?.value;
313
+ const targetLayerName = event?.currentTarget?.parentNode?.textContent;
328
314
  const matchingSource = sources.find((layerSource) => layerSource.name === targetLayerName);
329
315
  // we expect a single layer source matching this name
330
316
  if (matchingSource === undefined) {
@@ -335,14 +321,12 @@ function AttachLayerPanel({ isOverlay, onLayerAttached, onHandleOutsideClick })
335
321
  onHandleOutsideClick(false);
336
322
  }
337
323
  }, [activeViewport, handleModalUrlDialogCancel, handleModalUrlDialogOk, isOverlay, mapLayerOptions, onHandleOutsideClick, sources]);
338
- return (_jsxs("div", { className: "map-manager-header", children: [(loading || loadingSources) && _jsx(UiCore.LoadingSpinner, { message: loadingMapSources }), _jsxs("div", { className: "map-manager-source-listbox-header", children: [_jsx(Input, { type: "text", className: "map-manager-source-list-filter", placeholder: placeholderLabel, value: sourceFilterString, onChange: handleFilterTextChanged, size: "small" }), _jsx(Button, { className: "map-manager-add-source-button", title: addCustomLayerToolTip, onClick: handleAddNewMapSource, children: addCustomLayerLabel })] }), _jsx("div", { className: "map-manager-sources", children: _jsx(UiCore.Listbox, { id: "map-sources", selectedValue: layerNameToAdd, className: "map-manager-source-list", onKeyPress: handleKeypressOnSourceList, onListboxValueChange: onListboxValueChange, children: filteredOptions?.map((source) => (
339
- // eslint-disable-next-line @itwin/no-internal
340
- _jsxs(UiCore.ListboxItem, { className: "map-source-list-entry", value: source.name, onMouseEnter: () => setLayerNameUnderCursor(source.name), onMouseLeave: () => setLayerNameUnderCursor(undefined), children: [_jsx("span", { className: "map-source-list-entry-name", title: source.name, children: source.name }),
324
+ return (_jsxs("div", { className: "map-manager-header", children: [(loading || loadingSources) && (_jsx(ProgressRadial, { as: "div", children: _jsx(Text, { variant: 'small', children: loadingMapSources }) })), _jsxs("div", { className: "map-manager-source-listbox-header", children: [_jsx(Input, { type: "text", className: "map-manager-source-list-filter", placeholder: placeholderLabel, value: sourceFilterString, onChange: handleFilterTextChanged, size: "small" }), _jsx(Button, { className: "map-manager-add-source-button", title: addCustomLayerToolTip, onClick: handleAddNewMapSource, children: addCustomLayerLabel })] }), _jsx("div", { className: "map-manager-sources", children: _jsx(List, { id: "map-sources", as: "div", className: "map-manager-source-list", children: filteredOptions?.map((source) => (_jsxs(ListItem, { as: "div", className: "map-source-list-entry", actionable: true, onClick: () => handleAttach(source.name), onMouseEnter: () => setLayerNameUnderCursor(source.name), onMouseLeave: () => setLayerNameUnderCursor(undefined), children: [_jsx(ListItem.Content, { children: source.name }),
341
325
  // Display the delete icon only when the mouse over a specific item
342
326
  // otherwise list feels cluttered.
343
- !!iTwinId && layerNameUnderCursor && layerNameUnderCursor === source.name && (_jsxs(_Fragment, { children: [_jsx(Button, { size: "small", styleType: "borderless", className: "map-source-list-entry-button", title: editLayerDefButtonTitle, onClick: onItemEditButtonClicked, children: _jsx(UiCore.Icon, { iconSpec: "icon-edit" }) }), _jsx(Button, { size: "small", styleType: "borderless", className: "map-source-list-entry-button", title: removeLayerDefButtonTitle, onClick: (event) => {
327
+ !!iTwinId && layerNameUnderCursor && layerNameUnderCursor === source.name && (_jsxs(_Fragment, { children: [_jsx(Button, { size: "small", styleType: "borderless", className: "map-source-list-entry-button", title: editLayerDefButtonTitle, onClick: onItemEditButtonClicked, children: _jsx(SvgEdit, {}) }), _jsx(Button, { size: "small", styleType: "borderless", className: "map-source-list-entry-button", title: removeLayerDefButtonTitle, onClick: (event) => {
344
328
  onItemRemoveButtonClicked(source, event);
345
- }, children: _jsx(UiCore.Icon, { iconSpec: "icon-delete" }) })] }))] }, source.name))) }) })] }));
329
+ }, children: _jsx(SvgDelete, {}) })] }))] }, source.name))) }) })] }));
346
330
  }
347
331
  /** @internal */
348
332
  export var AttachLayerButtonType;
@@ -352,7 +336,6 @@ export var AttachLayerButtonType;
352
336
  AttachLayerButtonType[AttachLayerButtonType["Icon"] = 2] = "Icon";
353
337
  })(AttachLayerButtonType || (AttachLayerButtonType = {}));
354
338
  /** @internal */
355
- // eslint-disable-next-line @typescript-eslint/naming-convention
356
339
  export function AttachLayerPopupButton(props) {
357
340
  const { showAttachLayerLabel, hideAttachLayerLabel, addCustomLayerButtonLabel } = React.useMemo(() => {
358
341
  return {
@@ -406,7 +389,7 @@ export function AttachLayerPopupButton(props) {
406
389
  function renderButton() {
407
390
  let button;
408
391
  if (props.buttonType === undefined || props.buttonType === AttachLayerButtonType.Icon) {
409
- button = (_jsx(IconButton, { disabled: props.disabled, size: "small", styleType: "borderless", ref: buttonRef, className: "map-manager-attach-layer-button", title: popupOpen ? hideAttachLayerLabel : showAttachLayerLabel, onClick: togglePopup, children: _jsx(SvgAdd, {}) }));
392
+ button = (_jsx(IconButton, { disabled: props.disabled, size: "small", styleType: "borderless", ref: buttonRef, className: "map-manager-attach-layer-button", label: popupOpen ? hideAttachLayerLabel : showAttachLayerLabel, onClick: togglePopup, children: _jsx(SvgAdd, {}) }));
410
393
  }
411
394
  else {
412
395
  const determineStyleType = () => {
@@ -423,6 +406,7 @@ export function AttachLayerPopupButton(props) {
423
406
  }
424
407
  return button;
425
408
  }
426
- return (_jsxs(_Fragment, { children: [renderButton(), _jsx(UiCore.Popup, { isOpen: popupOpen, position: RelativePosition.BottomRight, onClose: handleClosePopup, onOutsideClick: onHandleOutsideClick, closeOnWheel: false, target: buttonRef.current, closeOnEnter: false, closeOnContextMenu: false, children: _jsx("div", { ref: panelRef, className: "map-sources-popup-panel", children: _jsx(AttachLayerPanel, { isOverlay: props.isOverlay, onLayerAttached: handleLayerAttached, onHandleOutsideClick: setHandleOutsideClick }) }) })] }));
409
+ return (_jsxs(_Fragment, { children: [renderButton(), _jsx(UiCore.Popup // TODO: Replace all deprecated UiCore components with iTwinUI components
410
+ , { isOpen: popupOpen, position: RelativePosition.BottomRight, onClose: handleClosePopup, onOutsideClick: onHandleOutsideClick, closeOnWheel: false, target: buttonRef.current, closeOnEnter: false, closeOnContextMenu: false, children: _jsx("div", { ref: panelRef, className: "map-sources-popup-panel", children: _jsx(AttachLayerPanel, { isOverlay: props.isOverlay, onLayerAttached: handleLayerAttached, onHandleOutsideClick: setHandleOutsideClick }) }) })] }));
427
411
  }
428
412
  //# sourceMappingURL=AttachLayerPopupButton.js.map