@itwin/map-layers 5.4.4 → 5.6.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.
- package/CHANGELOG.md +18 -2
- package/README.md +7 -7
- package/lib/cjs/BrowserStorage.d.ts.map +1 -1
- package/lib/cjs/BrowserStorage.js +23 -13
- package/lib/cjs/BrowserStorage.js.map +1 -1
- package/lib/cjs/CustomParamUtils.d.ts +1 -1
- package/lib/cjs/CustomParamUtils.d.ts.map +1 -1
- package/lib/cjs/CustomParamUtils.js +6 -3
- package/lib/cjs/CustomParamUtils.js.map +1 -1
- package/lib/cjs/CustomParamsMappingStorage.d.ts +1 -1
- package/lib/cjs/CustomParamsMappingStorage.d.ts.map +1 -1
- package/lib/cjs/CustomParamsMappingStorage.js +3 -3
- package/lib/cjs/CustomParamsMappingStorage.js.map +1 -1
- package/lib/cjs/CustomParamsStorage.d.ts +1 -1
- package/lib/cjs/CustomParamsStorage.d.ts.map +1 -1
- package/lib/cjs/CustomParamsStorage.js +3 -3
- package/lib/cjs/CustomParamsStorage.js.map +1 -1
- package/lib/cjs/MapLayerPreferences.d.ts +2 -1
- package/lib/cjs/MapLayerPreferences.d.ts.map +1 -1
- package/lib/cjs/MapLayerPreferences.js +50 -25
- package/lib/cjs/MapLayerPreferences.js.map +1 -1
- package/lib/cjs/MapLayersActionIds.d.ts +5 -0
- package/lib/cjs/MapLayersActionIds.d.ts.map +1 -0
- package/lib/cjs/MapLayersActionIds.js +10 -0
- package/lib/cjs/MapLayersActionIds.js.map +1 -0
- package/lib/cjs/MapLayersPrefBrowserStorage.d.ts.map +1 -1
- package/lib/cjs/MapLayersPrefBrowserStorage.js +4 -5
- package/lib/cjs/MapLayersPrefBrowserStorage.js.map +1 -1
- package/lib/cjs/PreferencesBrowserStorage.d.ts +17 -17
- package/lib/cjs/PreferencesBrowserStorage.d.ts.map +1 -1
- package/lib/cjs/PreferencesBrowserStorage.js +14 -14
- package/lib/cjs/PreferencesBrowserStorage.js.map +1 -1
- package/lib/cjs/map-layers.d.ts +1 -0
- package/lib/cjs/map-layers.d.ts.map +1 -1
- package/lib/cjs/map-layers.js +4 -3
- package/lib/cjs/map-layers.js.map +1 -1
- package/lib/cjs/mapLayers.d.ts +2 -2
- package/lib/cjs/mapLayers.d.ts.map +1 -1
- package/lib/cjs/mapLayers.js.map +1 -1
- package/lib/cjs/public/locales/en/mapLayers.json +179 -184
- package/lib/cjs/ui/FeatureInfoUiItemsProvider.d.ts +3 -4
- package/lib/cjs/ui/FeatureInfoUiItemsProvider.d.ts.map +1 -1
- package/lib/cjs/ui/FeatureInfoUiItemsProvider.js +48 -18
- package/lib/cjs/ui/FeatureInfoUiItemsProvider.js.map +1 -1
- package/lib/cjs/ui/Interfaces.d.ts +3 -3
- package/lib/cjs/ui/Interfaces.d.ts.map +1 -1
- package/lib/cjs/ui/Interfaces.js.map +1 -1
- package/lib/cjs/ui/MapLayersUiItemsProvider.d.ts +3 -2
- package/lib/cjs/ui/MapLayersUiItemsProvider.d.ts.map +1 -1
- package/lib/cjs/ui/MapLayersUiItemsProvider.js +2 -6
- package/lib/cjs/ui/MapLayersUiItemsProvider.js.map +1 -1
- package/lib/cjs/ui/widget/AttachLayerPopupButton.d.ts.map +1 -1
- package/lib/cjs/ui/widget/AttachLayerPopupButton.js +81 -46
- package/lib/cjs/ui/widget/AttachLayerPopupButton.js.map +1 -1
- package/lib/cjs/ui/widget/BasemapPanel.d.ts.map +1 -1
- package/lib/cjs/ui/widget/BasemapPanel.js +44 -25
- package/lib/cjs/ui/widget/BasemapPanel.js.map +1 -1
- package/lib/cjs/ui/widget/BasemapPanel.scss +2 -4
- package/lib/cjs/ui/widget/ConfirmMessageDialog.d.ts +1 -1
- package/lib/cjs/ui/widget/ConfirmMessageDialog.d.ts.map +1 -1
- package/lib/cjs/ui/widget/ConfirmMessageDialog.js +31 -8
- package/lib/cjs/ui/widget/ConfirmMessageDialog.js.map +1 -1
- package/lib/cjs/ui/widget/CustomParamEditDialog.d.ts +1 -1
- package/lib/cjs/ui/widget/CustomParamEditDialog.d.ts.map +1 -1
- package/lib/cjs/ui/widget/CustomParamEditDialog.js +34 -20
- package/lib/cjs/ui/widget/CustomParamEditDialog.js.map +1 -1
- package/lib/cjs/ui/widget/CustomParamEditDialog.scss +1 -2
- package/lib/cjs/ui/widget/CustomParamsSettings.d.ts.map +1 -1
- package/lib/cjs/ui/widget/CustomParamsSettings.js +42 -27
- package/lib/cjs/ui/widget/CustomParamsSettings.js.map +1 -1
- package/lib/cjs/ui/widget/CustomParamsSettings.scss +7 -9
- package/lib/cjs/ui/widget/FeatureInfoDataProvider.d.ts +3 -2
- package/lib/cjs/ui/widget/FeatureInfoDataProvider.d.ts.map +1 -1
- package/lib/cjs/ui/widget/FeatureInfoDataProvider.js +4 -2
- package/lib/cjs/ui/widget/FeatureInfoDataProvider.js.map +1 -1
- package/lib/cjs/ui/widget/FeatureInfoWidget.d.ts +1 -1
- package/lib/cjs/ui/widget/FeatureInfoWidget.d.ts.map +1 -1
- package/lib/cjs/ui/widget/FeatureInfoWidget.js +34 -15
- package/lib/cjs/ui/widget/FeatureInfoWidget.js.map +1 -1
- package/lib/cjs/ui/widget/MapLayerActionButtons.d.ts +1 -1
- package/lib/cjs/ui/widget/MapLayerActionButtons.d.ts.map +1 -1
- package/lib/cjs/ui/widget/MapLayerActionButtons.js +30 -17
- package/lib/cjs/ui/widget/MapLayerActionButtons.js.map +1 -1
- package/lib/cjs/ui/widget/MapLayerDroppable.d.ts +2 -2
- package/lib/cjs/ui/widget/MapLayerDroppable.d.ts.map +1 -1
- package/lib/cjs/ui/widget/MapLayerDroppable.js +64 -50
- package/lib/cjs/ui/widget/MapLayerDroppable.js.map +1 -1
- package/lib/cjs/ui/widget/MapLayerManager.d.ts +2 -2
- package/lib/cjs/ui/widget/MapLayerManager.d.ts.map +1 -1
- package/lib/cjs/ui/widget/MapLayerManager.js +158 -84
- package/lib/cjs/ui/widget/MapLayerManager.js.map +1 -1
- package/lib/cjs/ui/widget/MapLayerManager.scss +3 -6
- package/lib/cjs/ui/widget/MapLayerSettingsMenu.d.ts +2 -2
- package/lib/cjs/ui/widget/MapLayerSettingsMenu.d.ts.map +1 -1
- package/lib/cjs/ui/widget/MapLayerSettingsMenu.js +33 -13
- package/lib/cjs/ui/widget/MapLayerSettingsMenu.js.map +1 -1
- package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.d.ts.map +1 -1
- package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.js +36 -14
- package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.js.map +1 -1
- package/lib/cjs/ui/widget/MapLayerSettingsPopupButton.scss +5 -5
- package/lib/cjs/ui/widget/MapLayersWidget.d.ts +1 -1
- package/lib/cjs/ui/widget/MapLayersWidget.d.ts.map +1 -1
- package/lib/cjs/ui/widget/MapLayersWidget.js +34 -11
- package/lib/cjs/ui/widget/MapLayersWidget.js.map +1 -1
- package/lib/cjs/ui/widget/MapManagerMapLayersHeader.d.ts.map +1 -1
- package/lib/cjs/ui/widget/MapManagerMapLayersHeader.js +5 -8
- package/lib/cjs/ui/widget/MapManagerMapLayersHeader.js.map +1 -1
- package/lib/cjs/ui/widget/MapManagerSettings.d.ts.map +1 -1
- package/lib/cjs/ui/widget/MapManagerSettings.js +55 -56
- package/lib/cjs/ui/widget/MapManagerSettings.js.map +1 -1
- package/lib/cjs/ui/widget/MapManagerSettings.scss +1 -1
- package/lib/cjs/ui/widget/MapSelectFeaturesDialog.d.ts +2 -2
- package/lib/cjs/ui/widget/MapSelectFeaturesDialog.d.ts.map +1 -1
- package/lib/cjs/ui/widget/MapSelectFeaturesDialog.js +33 -18
- package/lib/cjs/ui/widget/MapSelectFeaturesDialog.js.map +1 -1
- package/lib/cjs/ui/widget/MapSelectFeaturesDialog.scss +1 -3
- package/lib/cjs/ui/widget/MapUrlDialog.d.ts +4 -3
- package/lib/cjs/ui/widget/MapUrlDialog.d.ts.map +1 -1
- package/lib/cjs/ui/widget/MapUrlDialog.js +104 -81
- package/lib/cjs/ui/widget/MapUrlDialog.js.map +1 -1
- package/lib/cjs/ui/widget/MapUrlDialog.scss +6 -7
- package/lib/cjs/ui/widget/SelectApiKey.d.ts.map +1 -1
- package/lib/cjs/ui/widget/SelectApiKey.js +38 -10
- package/lib/cjs/ui/widget/SelectApiKey.js.map +1 -1
- package/lib/cjs/ui/widget/SelectCustomParam.d.ts.map +1 -1
- package/lib/cjs/ui/widget/SelectCustomParam.js +40 -11
- package/lib/cjs/ui/widget/SelectCustomParam.js.map +1 -1
- package/lib/cjs/ui/widget/SelectMapFormat.d.ts +3 -3
- package/lib/cjs/ui/widget/SelectMapFormat.d.ts.map +1 -1
- package/lib/cjs/ui/widget/SelectMapFormat.js +36 -16
- package/lib/cjs/ui/widget/SelectMapFormat.js.map +1 -1
- package/lib/cjs/ui/widget/SubLayersDataProvider.d.ts +2 -2
- package/lib/cjs/ui/widget/SubLayersDataProvider.d.ts.map +1 -1
- package/lib/cjs/ui/widget/SubLayersDataProvider.js +13 -9
- package/lib/cjs/ui/widget/SubLayersDataProvider.js.map +1 -1
- package/lib/cjs/ui/widget/SubLayersPopupButton.d.ts +1 -1
- package/lib/cjs/ui/widget/SubLayersPopupButton.d.ts.map +1 -1
- package/lib/cjs/ui/widget/SubLayersPopupButton.js +30 -12
- package/lib/cjs/ui/widget/SubLayersPopupButton.js.map +1 -1
- package/lib/cjs/ui/widget/SubLayersTree.d.ts +2 -2
- package/lib/cjs/ui/widget/SubLayersTree.d.ts.map +1 -1
- package/lib/cjs/ui/widget/SubLayersTree.js +83 -45
- package/lib/cjs/ui/widget/SubLayersTree.js.map +1 -1
- package/lib/cjs/ui/widget/SubLayersTree.scss +4 -7
- package/lib/cjs/ui/widget/TransparencyPopupButton.d.ts.map +1 -1
- package/lib/cjs/ui/widget/TransparencyPopupButton.js +33 -16
- package/lib/cjs/ui/widget/TransparencyPopupButton.js.map +1 -1
- package/lib/cjs/ui/widget/TransparencyPopupButton.scss +1 -2
- package/lib/cjs/ui/widget/UserPreferencesStorageOptions.d.ts +1 -1
- package/lib/cjs/ui/widget/UserPreferencesStorageOptions.d.ts.map +1 -1
- package/lib/cjs/ui/widget/UserPreferencesStorageOptions.js +2 -8
- package/lib/cjs/ui/widget/UserPreferencesStorageOptions.js.map +1 -1
- package/lib/esm/BrowserStorage.d.ts.map +1 -1
- package/lib/esm/BrowserStorage.js +23 -13
- package/lib/esm/BrowserStorage.js.map +1 -1
- package/lib/esm/CustomParamUtils.d.ts +1 -1
- package/lib/esm/CustomParamUtils.d.ts.map +1 -1
- package/lib/esm/CustomParamUtils.js +6 -3
- package/lib/esm/CustomParamUtils.js.map +1 -1
- package/lib/esm/CustomParamsMappingStorage.d.ts +1 -1
- package/lib/esm/CustomParamsMappingStorage.d.ts.map +1 -1
- package/lib/esm/CustomParamsMappingStorage.js +3 -3
- package/lib/esm/CustomParamsMappingStorage.js.map +1 -1
- package/lib/esm/CustomParamsStorage.d.ts +1 -1
- package/lib/esm/CustomParamsStorage.d.ts.map +1 -1
- package/lib/esm/CustomParamsStorage.js +3 -3
- package/lib/esm/CustomParamsStorage.js.map +1 -1
- package/lib/esm/MapLayerPreferences.d.ts +2 -1
- package/lib/esm/MapLayerPreferences.d.ts.map +1 -1
- package/lib/esm/MapLayerPreferences.js +50 -25
- package/lib/esm/MapLayerPreferences.js.map +1 -1
- package/lib/esm/MapLayersActionIds.d.ts +5 -0
- package/lib/esm/MapLayersActionIds.d.ts.map +1 -0
- package/lib/esm/MapLayersActionIds.js +7 -0
- package/lib/esm/MapLayersActionIds.js.map +1 -0
- package/lib/esm/MapLayersPrefBrowserStorage.d.ts.map +1 -1
- package/lib/esm/MapLayersPrefBrowserStorage.js +4 -5
- package/lib/esm/MapLayersPrefBrowserStorage.js.map +1 -1
- package/lib/esm/PreferencesBrowserStorage.d.ts +17 -17
- package/lib/esm/PreferencesBrowserStorage.d.ts.map +1 -1
- package/lib/esm/PreferencesBrowserStorage.js +14 -14
- package/lib/esm/PreferencesBrowserStorage.js.map +1 -1
- package/lib/esm/map-layers.d.ts +1 -0
- package/lib/esm/map-layers.d.ts.map +1 -1
- package/lib/esm/map-layers.js +4 -3
- package/lib/esm/map-layers.js.map +1 -1
- package/lib/esm/mapLayers.d.ts +2 -2
- package/lib/esm/mapLayers.d.ts.map +1 -1
- package/lib/esm/mapLayers.js.map +1 -1
- package/lib/esm/public/locales/en/mapLayers.json +179 -184
- package/lib/esm/ui/FeatureInfoUiItemsProvider.d.ts +3 -4
- package/lib/esm/ui/FeatureInfoUiItemsProvider.d.ts.map +1 -1
- package/lib/esm/ui/FeatureInfoUiItemsProvider.js +48 -18
- package/lib/esm/ui/FeatureInfoUiItemsProvider.js.map +1 -1
- package/lib/esm/ui/Interfaces.d.ts +3 -3
- package/lib/esm/ui/Interfaces.d.ts.map +1 -1
- package/lib/esm/ui/Interfaces.js.map +1 -1
- package/lib/esm/ui/MapLayersUiItemsProvider.d.ts +3 -2
- package/lib/esm/ui/MapLayersUiItemsProvider.d.ts.map +1 -1
- package/lib/esm/ui/MapLayersUiItemsProvider.js +2 -6
- package/lib/esm/ui/MapLayersUiItemsProvider.js.map +1 -1
- package/lib/esm/ui/widget/AttachLayerPopupButton.d.ts.map +1 -1
- package/lib/esm/ui/widget/AttachLayerPopupButton.js +57 -45
- package/lib/esm/ui/widget/AttachLayerPopupButton.js.map +1 -1
- package/lib/esm/ui/widget/BasemapPanel.d.ts.map +1 -1
- package/lib/esm/ui/widget/BasemapPanel.js +19 -23
- package/lib/esm/ui/widget/BasemapPanel.js.map +1 -1
- package/lib/esm/ui/widget/BasemapPanel.scss +2 -4
- package/lib/esm/ui/widget/ConfirmMessageDialog.d.ts +1 -1
- package/lib/esm/ui/widget/ConfirmMessageDialog.d.ts.map +1 -1
- package/lib/esm/ui/widget/ConfirmMessageDialog.js +5 -5
- package/lib/esm/ui/widget/ConfirmMessageDialog.js.map +1 -1
- package/lib/esm/ui/widget/CustomParamEditDialog.d.ts +1 -1
- package/lib/esm/ui/widget/CustomParamEditDialog.d.ts.map +1 -1
- package/lib/esm/ui/widget/CustomParamEditDialog.js +9 -18
- package/lib/esm/ui/widget/CustomParamEditDialog.js.map +1 -1
- package/lib/esm/ui/widget/CustomParamEditDialog.scss +1 -2
- package/lib/esm/ui/widget/CustomParamsSettings.d.ts.map +1 -1
- package/lib/esm/ui/widget/CustomParamsSettings.js +17 -25
- package/lib/esm/ui/widget/CustomParamsSettings.js.map +1 -1
- package/lib/esm/ui/widget/CustomParamsSettings.scss +7 -9
- package/lib/esm/ui/widget/FeatureInfoDataProvider.d.ts +3 -2
- package/lib/esm/ui/widget/FeatureInfoDataProvider.d.ts.map +1 -1
- package/lib/esm/ui/widget/FeatureInfoDataProvider.js +4 -2
- package/lib/esm/ui/widget/FeatureInfoDataProvider.js.map +1 -1
- package/lib/esm/ui/widget/FeatureInfoWidget.d.ts +1 -1
- package/lib/esm/ui/widget/FeatureInfoWidget.d.ts.map +1 -1
- package/lib/esm/ui/widget/FeatureInfoWidget.js +10 -14
- package/lib/esm/ui/widget/FeatureInfoWidget.js.map +1 -1
- package/lib/esm/ui/widget/MapLayerActionButtons.d.ts +1 -1
- package/lib/esm/ui/widget/MapLayerActionButtons.d.ts.map +1 -1
- package/lib/esm/ui/widget/MapLayerActionButtons.js +6 -16
- package/lib/esm/ui/widget/MapLayerActionButtons.js.map +1 -1
- package/lib/esm/ui/widget/MapLayerDroppable.d.ts +2 -2
- package/lib/esm/ui/widget/MapLayerDroppable.d.ts.map +1 -1
- package/lib/esm/ui/widget/MapLayerDroppable.js +38 -47
- package/lib/esm/ui/widget/MapLayerDroppable.js.map +1 -1
- package/lib/esm/ui/widget/MapLayerManager.d.ts +2 -2
- package/lib/esm/ui/widget/MapLayerManager.d.ts.map +1 -1
- package/lib/esm/ui/widget/MapLayerManager.js +134 -83
- package/lib/esm/ui/widget/MapLayerManager.js.map +1 -1
- package/lib/esm/ui/widget/MapLayerManager.scss +3 -6
- package/lib/esm/ui/widget/MapLayerSettingsMenu.d.ts +2 -2
- package/lib/esm/ui/widget/MapLayerSettingsMenu.d.ts.map +1 -1
- package/lib/esm/ui/widget/MapLayerSettingsMenu.js +9 -12
- package/lib/esm/ui/widget/MapLayerSettingsMenu.js.map +1 -1
- package/lib/esm/ui/widget/MapLayerSettingsPopupButton.d.ts.map +1 -1
- package/lib/esm/ui/widget/MapLayerSettingsPopupButton.js +11 -12
- package/lib/esm/ui/widget/MapLayerSettingsPopupButton.js.map +1 -1
- package/lib/esm/ui/widget/MapLayerSettingsPopupButton.scss +5 -5
- package/lib/esm/ui/widget/MapLayersWidget.d.ts +1 -1
- package/lib/esm/ui/widget/MapLayersWidget.d.ts.map +1 -1
- package/lib/esm/ui/widget/MapLayersWidget.js +9 -9
- package/lib/esm/ui/widget/MapLayersWidget.js.map +1 -1
- package/lib/esm/ui/widget/MapManagerMapLayersHeader.d.ts.map +1 -1
- package/lib/esm/ui/widget/MapManagerMapLayersHeader.js +5 -8
- package/lib/esm/ui/widget/MapManagerMapLayersHeader.js.map +1 -1
- package/lib/esm/ui/widget/MapManagerSettings.d.ts.map +1 -1
- package/lib/esm/ui/widget/MapManagerSettings.js +29 -53
- package/lib/esm/ui/widget/MapManagerSettings.js.map +1 -1
- package/lib/esm/ui/widget/MapManagerSettings.scss +1 -1
- package/lib/esm/ui/widget/MapSelectFeaturesDialog.d.ts +2 -2
- package/lib/esm/ui/widget/MapSelectFeaturesDialog.d.ts.map +1 -1
- package/lib/esm/ui/widget/MapSelectFeaturesDialog.js +7 -15
- package/lib/esm/ui/widget/MapSelectFeaturesDialog.js.map +1 -1
- package/lib/esm/ui/widget/MapSelectFeaturesDialog.scss +1 -3
- package/lib/esm/ui/widget/MapUrlDialog.d.ts +4 -3
- package/lib/esm/ui/widget/MapUrlDialog.d.ts.map +1 -1
- package/lib/esm/ui/widget/MapUrlDialog.js +79 -79
- package/lib/esm/ui/widget/MapUrlDialog.js.map +1 -1
- package/lib/esm/ui/widget/MapUrlDialog.scss +6 -7
- package/lib/esm/ui/widget/SelectApiKey.d.ts.map +1 -1
- package/lib/esm/ui/widget/SelectApiKey.js +12 -7
- package/lib/esm/ui/widget/SelectApiKey.js.map +1 -1
- package/lib/esm/ui/widget/SelectCustomParam.d.ts.map +1 -1
- package/lib/esm/ui/widget/SelectCustomParam.js +14 -8
- package/lib/esm/ui/widget/SelectCustomParam.js.map +1 -1
- package/lib/esm/ui/widget/SelectMapFormat.d.ts +3 -3
- package/lib/esm/ui/widget/SelectMapFormat.d.ts.map +1 -1
- package/lib/esm/ui/widget/SelectMapFormat.js +11 -14
- package/lib/esm/ui/widget/SelectMapFormat.js.map +1 -1
- package/lib/esm/ui/widget/SubLayersDataProvider.d.ts +2 -2
- package/lib/esm/ui/widget/SubLayersDataProvider.d.ts.map +1 -1
- package/lib/esm/ui/widget/SubLayersDataProvider.js +13 -9
- package/lib/esm/ui/widget/SubLayersDataProvider.js.map +1 -1
- package/lib/esm/ui/widget/SubLayersPopupButton.d.ts +1 -1
- package/lib/esm/ui/widget/SubLayersPopupButton.d.ts.map +1 -1
- package/lib/esm/ui/widget/SubLayersPopupButton.js +6 -11
- package/lib/esm/ui/widget/SubLayersPopupButton.js.map +1 -1
- package/lib/esm/ui/widget/SubLayersTree.d.ts +2 -2
- package/lib/esm/ui/widget/SubLayersTree.d.ts.map +1 -1
- package/lib/esm/ui/widget/SubLayersTree.js +59 -44
- package/lib/esm/ui/widget/SubLayersTree.js.map +1 -1
- package/lib/esm/ui/widget/SubLayersTree.scss +4 -7
- package/lib/esm/ui/widget/TransparencyPopupButton.d.ts.map +1 -1
- package/lib/esm/ui/widget/TransparencyPopupButton.js +8 -14
- package/lib/esm/ui/widget/TransparencyPopupButton.js.map +1 -1
- package/lib/esm/ui/widget/TransparencyPopupButton.scss +1 -2
- package/lib/esm/ui/widget/UserPreferencesStorageOptions.d.ts +1 -1
- package/lib/esm/ui/widget/UserPreferencesStorageOptions.d.ts.map +1 -1
- package/lib/esm/ui/widget/UserPreferencesStorageOptions.js +2 -8
- package/lib/esm/ui/widget/UserPreferencesStorageOptions.js.map +1 -1
- package/lib/public/locales/en/mapLayers.json +179 -184
- package/package.json +9 -21
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*---------------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
-
*--------------------------------------------------------------------------------------------*/
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
import { BrowserStorage } from "./BrowserStorage";
|
|
6
6
|
export class CustomParamsMappingStorage extends BrowserStorage {
|
|
7
7
|
constructor() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomParamsMappingStorage.js","sourceRoot":"","sources":["../../src/CustomParamsMappingStorage.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"CustomParamsMappingStorage.js","sourceRoot":"","sources":["../../src/CustomParamsMappingStorage.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD,MAAM,OAAO,0BAA2B,SAAQ,cAAuC;IACrF;QACE,KAAK,CAAC,EAAE,WAAW,EAAE,uCAAuC,EAAE,CAAC,CAAC;IAClE,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 { BrowserStorage } from \"./BrowserStorage\";\nimport type { CustomParamsMappingItem } from \"./ui/Interfaces\";\n\nexport class CustomParamsMappingStorage extends BrowserStorage<CustomParamsMappingItem> {\n constructor() {\n super({ itemKeyName: \"itwinjs.mapLayers.customParamsMapping\" });\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomParamsStorage.d.ts","sourceRoot":"","sources":["../../src/CustomParamsStorage.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"CustomParamsStorage.d.ts","sourceRoot":"","sources":["../../src/CustomParamsStorage.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD,qBAAa,mBAAoB,SAAQ,cAAc,CAAC,eAAe,CAAC;;CAIvE"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*---------------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
-
*--------------------------------------------------------------------------------------------*/
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
import { BrowserStorage } from "./BrowserStorage";
|
|
6
6
|
export class CustomParamsStorage extends BrowserStorage {
|
|
7
7
|
constructor() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomParamsStorage.js","sourceRoot":"","sources":["../../src/CustomParamsStorage.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"CustomParamsStorage.js","sourceRoot":"","sources":["../../src/CustomParamsStorage.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD,MAAM,OAAO,mBAAoB,SAAQ,cAA+B;IACtE;QACE,KAAK,CAAC,EAAE,WAAW,EAAE,gCAAgC,EAAE,CAAC,CAAC;IAC3D,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 { BrowserStorage } from \"./BrowserStorage\";\nimport type { CustomParamItem } from \"./ui/Interfaces\";\n\nexport class CustomParamsStorage extends BrowserStorage<CustomParamItem> {\n constructor() {\n super({ itemKeyName: \"itwinjs.mapLayers.customParams\" });\n }\n}\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { MapLayerSource } from "@itwin/core-frontend";
|
|
2
|
-
import {
|
|
2
|
+
import type { GuidString } from "@itwin/core-bentley";
|
|
3
|
+
import { BeEvent } from "@itwin/core-bentley";
|
|
3
4
|
/** @internal */
|
|
4
5
|
export interface MapLayerPreferencesContent {
|
|
5
6
|
url: string;
|
|
@@ -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,EAAE,OAAO,EAAE,
|
|
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;AAG9C,gBAAgB;AAChB,MAAM,WAAW,0BAA0B;IACzC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,qBAAqB,EAAE,OAAO,GAAG,SAAS,CAAC;CAC5C;AAED,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}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*---------------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
-
*--------------------------------------------------------------------------------------------*/
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
import { IModelApp, MapLayerSource, NotifyMessageDetails, OutputMessagePriority } from "@itwin/core-frontend";
|
|
6
6
|
import { BeEvent } from "@itwin/core-bentley";
|
|
7
7
|
import { MapLayersUI } from "./mapLayers";
|
|
@@ -27,12 +27,14 @@ export class MapLayerPreferences {
|
|
|
27
27
|
* @param storeOnIModel if true store the settings object on the model, if false store it on the project
|
|
28
28
|
*/
|
|
29
29
|
static async storeSource(source, iTwinId, iModelId, storeOnIModel) {
|
|
30
|
-
if (!MapLayersUI.iTwinConfig)
|
|
30
|
+
if (!MapLayersUI.iTwinConfig) {
|
|
31
31
|
return false;
|
|
32
|
-
|
|
32
|
+
}
|
|
33
|
+
const accessToken = undefined !== IModelApp.authorizationClient ? await IModelApp.authorizationClient.getAccessToken() : undefined;
|
|
33
34
|
const sourceJSON = source.toJSON();
|
|
34
|
-
if (!sourceJSON.formatId)
|
|
35
|
+
if (!sourceJSON.formatId) {
|
|
35
36
|
return false;
|
|
37
|
+
}
|
|
36
38
|
const mapLayerSetting = {
|
|
37
39
|
url: sourceJSON.url,
|
|
38
40
|
name: sourceJSON.name,
|
|
@@ -66,9 +68,10 @@ export class MapLayerPreferences {
|
|
|
66
68
|
* @param iModelId
|
|
67
69
|
*/
|
|
68
70
|
static async replaceSource(oldSource, newSource, iTwinId, iModelId) {
|
|
69
|
-
if (!MapLayersUI.iTwinConfig)
|
|
71
|
+
if (!MapLayersUI.iTwinConfig) {
|
|
70
72
|
return;
|
|
71
|
-
|
|
73
|
+
}
|
|
74
|
+
const accessToken = undefined !== IModelApp.authorizationClient ? await IModelApp.authorizationClient.getAccessToken() : undefined;
|
|
72
75
|
let storeOnIModel = false;
|
|
73
76
|
try {
|
|
74
77
|
await MapLayersUI.iTwinConfig.delete({
|
|
@@ -111,9 +114,10 @@ export class MapLayerPreferences {
|
|
|
111
114
|
* @param iModelId
|
|
112
115
|
*/
|
|
113
116
|
static async deleteByName(source, iTwinId, iModelId) {
|
|
114
|
-
if (!MapLayersUI.iTwinConfig)
|
|
117
|
+
if (!MapLayersUI.iTwinConfig) {
|
|
115
118
|
return;
|
|
116
|
-
|
|
119
|
+
}
|
|
120
|
+
const accessToken = undefined !== IModelApp.authorizationClient ? await IModelApp.authorizationClient.getAccessToken() : undefined;
|
|
117
121
|
try {
|
|
118
122
|
await MapLayersUI.iTwinConfig.delete({
|
|
119
123
|
accessToken,
|
|
@@ -147,9 +151,10 @@ export class MapLayerPreferences {
|
|
|
147
151
|
* @param storeOnIModel
|
|
148
152
|
*/
|
|
149
153
|
static async delete(url, name, iTwinId, iModelId, storeOnIModel) {
|
|
150
|
-
if (!MapLayersUI.iTwinConfig)
|
|
154
|
+
if (!MapLayersUI.iTwinConfig) {
|
|
151
155
|
return true;
|
|
152
|
-
|
|
156
|
+
}
|
|
157
|
+
const accessToken = undefined !== IModelApp.authorizationClient ? await IModelApp.authorizationClient.getAccessToken() : undefined;
|
|
153
158
|
const iTwinPreferenceByName = await MapLayersUI.iTwinConfig.get({
|
|
154
159
|
accessToken,
|
|
155
160
|
namespace: MapLayerPreferences._preferenceNamespace,
|
|
@@ -157,7 +162,9 @@ export class MapLayerPreferences {
|
|
|
157
162
|
iTwinId,
|
|
158
163
|
});
|
|
159
164
|
if (undefined !== iTwinPreferenceByName && storeOnIModel) {
|
|
160
|
-
const errorMessage = IModelApp.localization.getLocalizedString("mapLayers:CustomAttach.LayerExistsAsProjectSetting", {
|
|
165
|
+
const errorMessage = IModelApp.localization.getLocalizedString("mapLayers:CustomAttach.LayerExistsAsProjectSetting", {
|
|
166
|
+
layer: iTwinPreferenceByName.name,
|
|
167
|
+
});
|
|
161
168
|
IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, errorMessage));
|
|
162
169
|
return false;
|
|
163
170
|
}
|
|
@@ -174,12 +181,19 @@ export class MapLayerPreferences {
|
|
|
174
181
|
// check if setting with url already exists, if it does, delete it
|
|
175
182
|
const settingFromUrl = await MapLayerPreferences.getByUrl(url, iTwinId, undefined);
|
|
176
183
|
if (settingFromUrl && storeOnIModel) {
|
|
177
|
-
const errorMessage = IModelApp.localization.getLocalizedString("mapLayers:CustomAttach.LayerWithUrlExistsAsProjectSetting", {
|
|
184
|
+
const errorMessage = IModelApp.localization.getLocalizedString("mapLayers:CustomAttach.LayerWithUrlExistsAsProjectSetting", {
|
|
185
|
+
url: settingFromUrl.url,
|
|
186
|
+
name: settingFromUrl.name,
|
|
187
|
+
});
|
|
178
188
|
IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Error, errorMessage));
|
|
179
189
|
return false;
|
|
180
190
|
}
|
|
181
191
|
else if (settingFromUrl) {
|
|
182
|
-
const infoMessage = IModelApp.localization.getLocalizedString("mapLayers:CustomAttach.LayerWithUrlExistsOverwriting", {
|
|
192
|
+
const infoMessage = IModelApp.localization.getLocalizedString("mapLayers:CustomAttach.LayerWithUrlExistsOverwriting", {
|
|
193
|
+
url: settingFromUrl.url,
|
|
194
|
+
oldName: settingFromUrl.name,
|
|
195
|
+
newName: name,
|
|
196
|
+
});
|
|
183
197
|
IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, infoMessage));
|
|
184
198
|
await MapLayersUI.iTwinConfig.delete({
|
|
185
199
|
accessToken,
|
|
@@ -188,7 +202,8 @@ export class MapLayerPreferences {
|
|
|
188
202
|
iTwinId,
|
|
189
203
|
});
|
|
190
204
|
}
|
|
191
|
-
if (iModelId) {
|
|
205
|
+
if (iModelId) {
|
|
206
|
+
// delete any settings on model so user can update them if theres collisions
|
|
192
207
|
const settingOnIModelFromName = await MapLayersUI.iTwinConfig.get({
|
|
193
208
|
accessToken,
|
|
194
209
|
namespace: MapLayerPreferences._preferenceNamespace,
|
|
@@ -209,7 +224,11 @@ export class MapLayerPreferences {
|
|
|
209
224
|
});
|
|
210
225
|
}
|
|
211
226
|
if (settingFromUrlOnIModel) {
|
|
212
|
-
const infoMessage = IModelApp.localization.getLocalizedString("mapLayers:CustomAttach.LayerWithUrlExistsOverwriting", {
|
|
227
|
+
const infoMessage = IModelApp.localization.getLocalizedString("mapLayers:CustomAttach.LayerWithUrlExistsOverwriting", {
|
|
228
|
+
url: settingFromUrlOnIModel.url,
|
|
229
|
+
oldName: settingFromUrlOnIModel.name,
|
|
230
|
+
newName: name,
|
|
231
|
+
});
|
|
213
232
|
IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, infoMessage));
|
|
214
233
|
await MapLayersUI.iTwinConfig.delete({
|
|
215
234
|
accessToken,
|
|
@@ -228,9 +247,10 @@ export class MapLayerPreferences {
|
|
|
228
247
|
* @param iModelId
|
|
229
248
|
*/
|
|
230
249
|
static async getByUrl(url, iTwinId, iModelId) {
|
|
231
|
-
if (!MapLayersUI.iTwinConfig)
|
|
250
|
+
if (!MapLayersUI.iTwinConfig) {
|
|
232
251
|
return undefined;
|
|
233
|
-
|
|
252
|
+
}
|
|
253
|
+
const accessToken = undefined !== IModelApp.authorizationClient ? await IModelApp.authorizationClient.getAccessToken() : undefined;
|
|
234
254
|
const settingResponse = await MapLayersUI.iTwinConfig.get({
|
|
235
255
|
accessToken,
|
|
236
256
|
namespace: MapLayerPreferences._preferenceNamespace,
|
|
@@ -238,8 +258,9 @@ export class MapLayerPreferences {
|
|
|
238
258
|
iTwinId,
|
|
239
259
|
iModelId,
|
|
240
260
|
});
|
|
241
|
-
if (undefined === settingResponse || 0 === settingResponse.length)
|
|
261
|
+
if (undefined === settingResponse || 0 === settingResponse.length) {
|
|
242
262
|
return undefined;
|
|
263
|
+
}
|
|
243
264
|
let savedMapLayer;
|
|
244
265
|
settingResponse.settingsMap?.forEach((savedLayer) => {
|
|
245
266
|
if (savedLayer.url === url) {
|
|
@@ -254,9 +275,10 @@ export class MapLayerPreferences {
|
|
|
254
275
|
* @throws if any of the calls to grab settings fail.
|
|
255
276
|
*/
|
|
256
277
|
static async getSources(iTwinId, iModelId) {
|
|
257
|
-
if (!MapLayersUI.iTwinConfig)
|
|
278
|
+
if (!MapLayersUI.iTwinConfig) {
|
|
258
279
|
return [];
|
|
259
|
-
|
|
280
|
+
}
|
|
281
|
+
const accessToken = undefined !== IModelApp.authorizationClient ? await IModelApp.authorizationClient.getAccessToken() : undefined;
|
|
260
282
|
const mapLayerList = [];
|
|
261
283
|
try {
|
|
262
284
|
const userResultByProject = await MapLayersUI.iTwinConfig.get({
|
|
@@ -265,8 +287,9 @@ export class MapLayerPreferences {
|
|
|
265
287
|
key: "",
|
|
266
288
|
iTwinId,
|
|
267
289
|
});
|
|
268
|
-
if (undefined !== userResultByProject)
|
|
290
|
+
if (undefined !== userResultByProject) {
|
|
269
291
|
mapLayerList.push(userResultByProject);
|
|
292
|
+
}
|
|
270
293
|
}
|
|
271
294
|
catch (err) {
|
|
272
295
|
throw new Error(IModelApp.localization.getLocalizedString("mapLayers:CustomAttach.ErrorRetrieveUserProject", { errorMessage: err }));
|
|
@@ -279,8 +302,9 @@ export class MapLayerPreferences {
|
|
|
279
302
|
iTwinId,
|
|
280
303
|
iModelId,
|
|
281
304
|
});
|
|
282
|
-
if (undefined !== userResultByIModel)
|
|
305
|
+
if (undefined !== userResultByIModel) {
|
|
283
306
|
mapLayerList.push(userResultByIModel);
|
|
307
|
+
}
|
|
284
308
|
}
|
|
285
309
|
catch (err) {
|
|
286
310
|
throw new Error(IModelApp.localization.getLocalizedString("mapLayers:CustomAttach.ErrorRetrieveUserProject", { errorMessage: err }));
|
|
@@ -289,8 +313,9 @@ export class MapLayerPreferences {
|
|
|
289
313
|
for (const mapLayer of mapLayerList) {
|
|
290
314
|
mapLayer.forEach((savedLayer) => {
|
|
291
315
|
const mapLayerSource = MapLayerSource.fromJSON(savedLayer);
|
|
292
|
-
if (mapLayerSource)
|
|
316
|
+
if (mapLayerSource) {
|
|
293
317
|
savedMapLayerSources.push(mapLayerSource);
|
|
318
|
+
}
|
|
294
319
|
});
|
|
295
320
|
}
|
|
296
321
|
return savedMapLayerSources;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapLayerPreferences.js","sourceRoot":"","sources":["../../src/MapLayerPreferences.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC9G,OAAO,EAAE,OAAO,EAAc,MAAM,qBAAqB,CAAC;AAC1D,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;IAU9B;;;;;;OAMG;IACI,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,MAAsB,EAAE,OAAmB,EAAE,QAAqB,EAAE,aAAuB;QACzH,IAAI,CAAC,WAAW,CAAC,WAAW;YAC1B,OAAO,KAAK,CAAC;QACf,MAAM,WAAW,GAAG,SAAS,KAAK,SAAS,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,MAAM,SAAS,CAAC,mBAAmB,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAErI,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC;QACnC,IAAI,CAAC,UAAU,CAAC,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AK,CAAC,SAAS,CAAC,YAAY,CAAC,kBAAkB,CAAC,iDAAiD,EAAE,EAAE,YAAY,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;SACtI;QAED,MAAM,oBAAoB,GAAqB,EAAE,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;oBAChB,oBAAoB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;YAC9C,CAAC,CAAC,CAAC;SACJ;QACD,OAAO,oBAAoB,CAAC;IAC9B,CAAC;IAEO,MAAM,KAAK,oBAAoB;QACrC,OAAO,gCAAgC,CAAC;IAC1C,CAAC;;AAlTD;;;;;;GAMG;AACoB,wCAAoB,GAAG,IAAI,OAAO,EAA0G,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 { BeEvent, GuidString } 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<(changeType: MapLayerSourceChangeType, oldSource?: MapLayerSource, newSource?: MapLayerSource) => void>(); // 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 const accessToken = undefined !== IModelApp.authorizationClient ? (await IModelApp.authorizationClient.getAccessToken()) : undefined;\n\n const sourceJSON = source.toJSON();\n if (!sourceJSON.formatId)\n return false;\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 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 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 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\", { layer: iTwinPreferenceByName.name });\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\", { url: settingFromUrl.url, name: settingFromUrl.name });\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\", { url: settingFromUrl.url, oldName: settingFromUrl.name, newName: name });\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) { // 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\", { url: settingFromUrlOnIModel.url, oldName: settingFromUrlOnIModel.name, newName: name });\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 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 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 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 } 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 } 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 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,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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,GAAG,EAAE,CAAC,CAAC,CAAC;SACtI;QAED,MAAM,oBAAoB,GAAqB,EAAE,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"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MapLayersActionIds.d.ts","sourceRoot":"","sources":["../../src/MapLayersActionIds.ts"],"names":[],"mappings":"AAEA,oBAAY,sBAAsB;IAChC,0DAA0D;IAC1D,iBAAiB,sBAAsB;CACxC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
2
|
+
export var MapLayersSyncUiEventId;
|
|
3
|
+
(function (MapLayersSyncUiEventId) {
|
|
4
|
+
/** The display style settings map imagery has changed. */
|
|
5
|
+
MapLayersSyncUiEventId["MapImageryChanged"] = "mapimagerychanged";
|
|
6
|
+
})(MapLayersSyncUiEventId || (MapLayersSyncUiEventId = {}));
|
|
7
|
+
//# sourceMappingURL=MapLayersActionIds.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MapLayersActionIds.js","sourceRoot":"","sources":["../../src/MapLayersActionIds.ts"],"names":[],"mappings":"AAAA,oEAAoE;AAEpE,MAAM,CAAN,IAAY,sBAGX;AAHD,WAAY,sBAAsB;IAChC,0DAA0D;IAC1D,iEAAuC,CAAA;AACzC,CAAC,EAHW,sBAAsB,KAAtB,sBAAsB,QAGjC","sourcesContent":["// Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n\nexport enum MapLayersSyncUiEventId {\n /** The display style settings map imagery has changed. */\n MapImageryChanged = \"mapimagerychanged\",\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapLayersPrefBrowserStorage.d.ts","sourceRoot":"","sources":["../../src/MapLayersPrefBrowserStorage.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAExE,qBAAa,2BAA4B,SAAQ,yBAAyB;;
|
|
1
|
+
{"version":3,"file":"MapLayersPrefBrowserStorage.d.ts","sourceRoot":"","sources":["../../src/MapLayersPrefBrowserStorage.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAExE,qBAAa,2BAA4B,SAAQ,yBAAyB;;CAOzE"}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
/*---------------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
-
*--------------------------------------------------------------------------------------------*/
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
import { PreferencesBrowserStorage } from "./PreferencesBrowserStorage";
|
|
6
6
|
export class MapLayersPrefBrowserStorage extends PreferencesBrowserStorage {
|
|
7
7
|
constructor() {
|
|
8
|
-
super("itwinjs.mapLayers", { throwOnDeleteMissingKey: true }
|
|
9
|
-
);
|
|
8
|
+
super("itwinjs.mapLayers", { throwOnDeleteMissingKey: true });
|
|
10
9
|
}
|
|
11
10
|
}
|
|
12
11
|
//# sourceMappingURL=MapLayersPrefBrowserStorage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapLayersPrefBrowserStorage.js","sourceRoot":"","sources":["../../src/MapLayersPrefBrowserStorage.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"MapLayersPrefBrowserStorage.js","sourceRoot":"","sources":["../../src/MapLayersPrefBrowserStorage.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAExE,MAAM,OAAO,2BAA4B,SAAQ,yBAAyB;IACxE;QACE,KAAK,CACH,mBAAmB,EACnB,EAAE,uBAAuB,EAAE,IAAI,EAAE,CAClC,CAAC;IACJ,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 { PreferencesBrowserStorage } from \"./PreferencesBrowserStorage\";\n\nexport class MapLayersPrefBrowserStorage extends PreferencesBrowserStorage {\n constructor() {\n super(\n \"itwinjs.mapLayers\",\n { throwOnDeleteMissingKey: true }, // 'MapLayerPreferences.replaceSource' expect 'delete' to throw when there is no match for the provided key.\n );\n }\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ITwinIdArg, PreferenceArg, PreferenceKeyArg, UserPreferencesAccess } from "@itwin/core-frontend";
|
|
1
|
+
import type { ITwinIdArg, PreferenceArg, PreferenceKeyArg, UserPreferencesAccess } from "@itwin/core-frontend";
|
|
2
2
|
/** Index signature holding preferences content
|
|
3
3
|
*
|
|
4
4
|
* @internal
|
|
@@ -7,28 +7,28 @@ interface KeyContentProps {
|
|
|
7
7
|
[preferenceKey: string]: any;
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
|
-
* @beta
|
|
11
|
-
*/
|
|
10
|
+
* @beta
|
|
11
|
+
*/
|
|
12
12
|
export interface PreferencesBrowserStorageOptions {
|
|
13
13
|
/** indicate whether or not delete function should throw an error if the provided key cannot be found. */
|
|
14
14
|
throwOnDeleteMissingKey?: boolean;
|
|
15
15
|
}
|
|
16
16
|
/** User preferences implementation using browser's local storage.
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
17
|
+
* It creates storage item key in the form of:
|
|
18
|
+
* <storageItemKeyPrefix>.<itwin_guid?>.<imodel_guid?>
|
|
19
|
+
*
|
|
20
|
+
* <itwin_guid> and <imodel_guid> being optional.
|
|
21
|
+
*
|
|
22
|
+
* Each entry in the storage is a serialized JSON of the following index signature:
|
|
23
|
+
* {
|
|
24
|
+
* "<preference_namespace?>.<preference_key>": {
|
|
25
|
+
* ...
|
|
26
|
+
* <preferences_json_content>
|
|
27
|
+
* },
|
|
28
|
+
* ...
|
|
29
|
+
* }
|
|
30
30
|
* @beta
|
|
31
|
-
*/
|
|
31
|
+
*/
|
|
32
32
|
export declare class PreferencesBrowserStorage implements UserPreferencesAccess {
|
|
33
33
|
private readonly _options;
|
|
34
34
|
private readonly _storageItemKeyPrefix;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PreferencesBrowserStorage.d.ts","sourceRoot":"","sources":["../../src/PreferencesBrowserStorage.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"PreferencesBrowserStorage.d.ts","sourceRoot":"","sources":["../../src/PreferencesBrowserStorage.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAG/G;;;GAGG;AACH,UAAU,eAAe;IACvB,CAAC,aAAa,EAAE,MAAM,GAAG,GAAG,CAAC;CAC9B;AAED;;GAEG;AACH,MAAM,WAAW,gCAAgC;IAC/C,yGAAyG;IACzG,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC;AAED;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,yBAA0B,YAAW,qBAAqB;IACrE,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA+C;IACxE,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAS;gBAEnC,oBAAoB,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,gCAAgC;IAKjF,OAAO,CAAC,iBAAiB;IAMzB,OAAO,CAAC,MAAM,CAAC,gBAAgB;IASlB,GAAG,CAAC,GAAG,EAAE,gBAAgB,GAAG,UAAU;IAKtC,MAAM,CAAC,GAAG,EAAE,gBAAgB,GAAG,UAAU;IAKzC,IAAI,CAAC,GAAG,EAAE,aAAa,GAAG,UAAU;CAIlD"}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { BrowserStorage } from "./BrowserStorage";
|
|
2
2
|
/** User preferences implementation using browser's local storage.
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
3
|
+
* It creates storage item key in the form of:
|
|
4
|
+
* <storageItemKeyPrefix>.<itwin_guid?>.<imodel_guid?>
|
|
5
|
+
*
|
|
6
|
+
* <itwin_guid> and <imodel_guid> being optional.
|
|
7
|
+
*
|
|
8
|
+
* Each entry in the storage is a serialized JSON of the following index signature:
|
|
9
|
+
* {
|
|
10
|
+
* "<preference_namespace?>.<preference_key>": {
|
|
11
|
+
* ...
|
|
12
|
+
* <preferences_json_content>
|
|
13
|
+
* },
|
|
14
|
+
* ...
|
|
15
|
+
* }
|
|
16
16
|
* @beta
|
|
17
|
-
*/
|
|
17
|
+
*/
|
|
18
18
|
export class PreferencesBrowserStorage {
|
|
19
19
|
constructor(storageItemKeyPrefix, opts) {
|
|
20
20
|
this._options = opts;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PreferencesBrowserStorage.js","sourceRoot":"","sources":["../../src/PreferencesBrowserStorage.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAkBlD;;;;;;;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,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"]}
|
package/lib/esm/map-layers.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map-layers.d.ts","sourceRoot":"","sources":["../../src/map-layers.ts"],"names":[],"mappings":"AAIA,cAAc,aAAa,CAAC;AAC5B,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iBAAiB,CAAC;AAChC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,CAAC"}
|
|
1
|
+
{"version":3,"file":"map-layers.d.ts","sourceRoot":"","sources":["../../src/map-layers.ts"],"names":[],"mappings":"AAIA,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iBAAiB,CAAC;AAChC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,CAAC"}
|
package/lib/esm/map-layers.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/*---------------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
-
*--------------------------------------------------------------------------------------------*/
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
export * from "./mapLayers";
|
|
6
|
+
export * from "./MapLayersActionIds";
|
|
6
7
|
export * from "./MapLayersPrefBrowserStorage";
|
|
7
8
|
export * from "./ui/Interfaces";
|
|
8
9
|
export * from "./ui/MapLayersUiItemsProvider";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map-layers.js","sourceRoot":"","sources":["../../src/map-layers.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"map-layers.js","sourceRoot":"","sources":["../../src/map-layers.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iBAAiB,CAAC;AAChC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,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 *--------------------------------------------------------------------------------------------*/\nexport * from \"./mapLayers\";\nexport * from \"./MapLayersActionIds\";\nexport * from \"./MapLayersPrefBrowserStorage\";\nexport * from \"./ui/Interfaces\";\nexport * from \"./ui/MapLayersUiItemsProvider\";\nexport * from \"./ui/FeatureInfoUiItemsProvider\";\nexport * from \"./ui/widget/MapLayersWidget\";\n"]}
|
package/lib/esm/mapLayers.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Localization, TranslationOptions } from "@itwin/core-common";
|
|
2
|
-
import { UserPreferencesAccess } from "@itwin/core-frontend";
|
|
1
|
+
import type { Localization, TranslationOptions } from "@itwin/core-common";
|
|
2
|
+
import type { UserPreferencesAccess } from "@itwin/core-frontend";
|
|
3
3
|
export interface MapLayersConfig {
|
|
4
4
|
localization?: Localization;
|
|
5
5
|
/** If an iTwinConfig is provided, it will be used to load the MapLayerSources that are stored. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapLayers.d.ts","sourceRoot":"","sources":["../../src/mapLayers.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"mapLayers.d.ts","sourceRoot":"","sources":["../../src/mapLayers.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAGlE,MAAM,WAAW,eAAe;IAC9B,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,kGAAkG;IAClG,WAAW,CAAC,EAAE,qBAAqB,CAAC;CACrC;AAED;;;;;GAKG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,MAAM,CAAC,UAAU,CAAe;IACxC,OAAc,YAAY,EAAE,YAAY,CAAC;IACzC,OAAO,CAAC,MAAM,CAAC,mBAAmB,CAAgB;IAClD,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,CAAwB;IAEpD,WAAkB,WAAW,IAAI,qBAAqB,GAAG,SAAS,CAEjE;IAED,wCAAwC;WACpB,UAAU,CAAC,MAAM,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IAQvE,4EAA4E;WAC9D,SAAS;IAIvB,kDAAkD;IAClD,WAAkB,qBAAqB,IAAI,MAAM,CAEhD;WAEa,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,MAAM;CAGtF"}
|