@itwin/map-layers 5.4.2 → 5.4.4
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 +19 -2
- package/lib/cjs/BrowserStorage.d.ts +1 -1
- package/lib/cjs/BrowserStorage.js +1 -1
- package/lib/cjs/BrowserStorage.js.map +1 -1
- package/lib/cjs/CustomParamUtils.d.ts.map +1 -1
- package/lib/cjs/CustomParamUtils.js +13 -5
- package/lib/cjs/CustomParamUtils.js.map +1 -1
- package/lib/cjs/PreferencesBrowserStorage.d.ts +1 -1
- package/lib/cjs/ui/widget/CustomParamsSettings.js +1 -1
- package/lib/cjs/ui/widget/CustomParamsSettings.js.map +1 -1
- package/lib/cjs/ui/widget/FeatureInfoDataProvider.d.ts +1 -0
- package/lib/cjs/ui/widget/FeatureInfoDataProvider.d.ts.map +1 -1
- package/lib/cjs/ui/widget/FeatureInfoDataProvider.js +14 -3
- package/lib/cjs/ui/widget/FeatureInfoDataProvider.js.map +1 -1
- package/lib/cjs/ui/widget/FeatureInfoWidget.d.ts.map +1 -1
- package/lib/cjs/ui/widget/FeatureInfoWidget.js +12 -1
- package/lib/cjs/ui/widget/FeatureInfoWidget.js.map +1 -1
- package/lib/cjs/ui/widget/MapLayerManager.js +2 -2
- package/lib/cjs/ui/widget/MapLayerManager.js.map +1 -1
- package/lib/cjs/ui/widget/MapUrlDialog.d.ts.map +1 -1
- package/lib/cjs/ui/widget/MapUrlDialog.js +23 -17
- package/lib/cjs/ui/widget/MapUrlDialog.js.map +1 -1
- package/lib/cjs/ui/widget/SelectApiKey.js +1 -1
- package/lib/cjs/ui/widget/SelectApiKey.js.map +1 -1
- package/lib/cjs/ui/widget/SelectCustomParam.js +1 -1
- package/lib/cjs/ui/widget/SelectCustomParam.js.map +1 -1
- package/lib/esm/BrowserStorage.d.ts +1 -1
- package/lib/esm/BrowserStorage.js +1 -1
- package/lib/esm/BrowserStorage.js.map +1 -1
- package/lib/esm/CustomParamUtils.d.ts.map +1 -1
- package/lib/esm/CustomParamUtils.js +13 -5
- package/lib/esm/CustomParamUtils.js.map +1 -1
- package/lib/esm/PreferencesBrowserStorage.d.ts +1 -1
- package/lib/esm/ui/widget/CustomParamsSettings.js +1 -1
- package/lib/esm/ui/widget/CustomParamsSettings.js.map +1 -1
- package/lib/esm/ui/widget/FeatureInfoDataProvider.d.ts +1 -0
- package/lib/esm/ui/widget/FeatureInfoDataProvider.d.ts.map +1 -1
- package/lib/esm/ui/widget/FeatureInfoDataProvider.js +14 -3
- package/lib/esm/ui/widget/FeatureInfoDataProvider.js.map +1 -1
- package/lib/esm/ui/widget/FeatureInfoWidget.d.ts.map +1 -1
- package/lib/esm/ui/widget/FeatureInfoWidget.js +12 -1
- package/lib/esm/ui/widget/FeatureInfoWidget.js.map +1 -1
- package/lib/esm/ui/widget/MapLayerManager.js +2 -2
- package/lib/esm/ui/widget/MapLayerManager.js.map +1 -1
- package/lib/esm/ui/widget/MapUrlDialog.d.ts.map +1 -1
- package/lib/esm/ui/widget/MapUrlDialog.js +23 -17
- package/lib/esm/ui/widget/MapUrlDialog.js.map +1 -1
- package/lib/esm/ui/widget/SelectApiKey.js +1 -1
- package/lib/esm/ui/widget/SelectApiKey.js.map +1 -1
- package/lib/esm/ui/widget/SelectCustomParam.js +1 -1
- package/lib/esm/ui/widget/SelectCustomParam.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,29 @@
|
|
|
1
1
|
# Change Log - @itwin/map-layers
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Tue, 21 May 2024 13:26:08 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 5.4.4
|
|
8
|
+
|
|
9
|
+
Tue, 21 May 2024 13:26:08 GMT
|
|
10
|
+
|
|
11
|
+
### Patches
|
|
12
|
+
|
|
13
|
+
- Url scheme validation when adding a new map layer and fix an issue with usersPreferences and browser storage. ([#836](https://github.com/iTwin/viewer-components-react/pull/836))
|
|
14
|
+
- Added copy property value button in Map Layers Info widget ([#834](https://github.com/iTwin/viewer-components-react/pull/834))
|
|
15
|
+
|
|
16
|
+
## 5.4.3
|
|
17
|
+
|
|
18
|
+
Thu, 04 Apr 2024 14:19:35 GMT
|
|
19
|
+
|
|
20
|
+
### Patches
|
|
21
|
+
|
|
22
|
+
- Clear MapFeatureInfo Widget when active tool changes ([#803](https://github.com/iTwin/viewer-components-react/pull/803))
|
|
23
|
+
|
|
7
24
|
## 5.4.2
|
|
8
25
|
|
|
9
|
-
Mon, 11 Mar 2024 18:18:
|
|
26
|
+
Mon, 11 Mar 2024 18:18:16 GMT
|
|
10
27
|
|
|
11
28
|
### Patches
|
|
12
29
|
|
|
@@ -15,7 +15,7 @@ export declare class BrowserStorage<Type> {
|
|
|
15
15
|
private readonly _throwOnDeleteMissingKey;
|
|
16
16
|
constructor(opts: BrowserStorageOptions);
|
|
17
17
|
private loadFromStorage;
|
|
18
|
-
get(key: string | undefined): Type[] | undefined;
|
|
18
|
+
get(key: string | undefined): Type | Type[] | undefined;
|
|
19
19
|
getContent(): KeyContentProps<Type> | undefined;
|
|
20
20
|
delete(key: string): void;
|
|
21
21
|
deleteMatchingContent(content: Type): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BrowserStorage.js","sourceRoot":"","sources":["../../src/BrowserStorage.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAgB/F,MAAa,cAAc;IAKzB,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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AAI,CAAC,eAAe,EAAE,CAAC;QACnC,IAAI,GAAG,KAAK,SAAS,EAAE;YACrB,OAAO;SACR;QACD,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QAC5C,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;YAC9C,IAAI,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,WAAW;gBACvC,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC;SACnB;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;YACnB,GAAG,GAAG,EAAE,CAAC;QAEX,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;AAvFD,wCAuFC","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\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 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 if (key) {\n if (!Object.keys(map).includes(key))\n return undefined;\n\n return map[key];\n } else { // 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 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 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 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 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.d.ts","sourceRoot":"","sources":["../../src/CustomParamUtils.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"CustomParamUtils.d.ts","sourceRoot":"","sources":["../../src/CustomParamUtils.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAItD,qBAAa,gBAAgB;WACb,qBAAqB,CAAC,MAAM,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,EAAE;CAyBvF"}
|
|
@@ -6,17 +6,25 @@ class CustomParamUtils {
|
|
|
6
6
|
static setSourceCustomParams(source, customParamNames) {
|
|
7
7
|
const cpStorage = new CustomParamsStorage_1.CustomParamsStorage();
|
|
8
8
|
customParamNames.forEach((paramName) => {
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
const paramFromStorage = cpStorage.get(paramName);
|
|
10
|
+
let customParam;
|
|
11
|
+
if (Array.isArray(paramFromStorage)) {
|
|
12
|
+
if (paramFromStorage.length > 0)
|
|
13
|
+
customParam = paramFromStorage[0];
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
customParam = paramFromStorage;
|
|
17
|
+
}
|
|
18
|
+
if (customParam && source) {
|
|
19
|
+
if (customParam.secret) {
|
|
12
20
|
if (!source.unsavedQueryParams)
|
|
13
21
|
source.unsavedQueryParams = {};
|
|
14
|
-
source.unsavedQueryParams[customParam
|
|
22
|
+
source.unsavedQueryParams[customParam.key] = customParam.value;
|
|
15
23
|
}
|
|
16
24
|
else {
|
|
17
25
|
if (!source.savedQueryParams)
|
|
18
26
|
source.savedQueryParams = {};
|
|
19
|
-
source.savedQueryParams[customParam
|
|
27
|
+
source.savedQueryParams[customParam.key] = customParam.value;
|
|
20
28
|
}
|
|
21
29
|
}
|
|
22
30
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomParamUtils.js","sourceRoot":"","sources":["../../src/CustomParamUtils.ts"],"names":[],"mappings":";;;AAKA,+DAA4D;
|
|
1
|
+
{"version":3,"file":"CustomParamUtils.js","sourceRoot":"","sources":["../../src/CustomParamUtils.ts"],"names":[],"mappings":";;;AAKA,+DAA4D;AAG5D,MAAa,gBAAgB;IACpB,MAAM,CAAC,qBAAqB,CAAC,MAAsB,EAAE,gBAA0B;QACpF,MAAM,SAAS,GAAG,IAAI,yCAAmB,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;oBAC7B,WAAW,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC;aACrC;iBAAM;gBACL,WAAW,GAAE,gBAAgB,CAAC;aAC/B;YAED,IAAI,WAAW,IAAI,MAAM,EAAE;gBACzB,IAAI,WAAW,CAAC,MAAM,EAAE;oBACtB,IAAI,CAAC,MAAM,CAAC,kBAAkB;wBAC5B,MAAM,CAAC,kBAAkB,GAAG,EAAE,CAAC;oBACjC,MAAM,CAAC,kBAAkB,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC,KAAK,CAAC;iBAChE;qBAAM;oBACL,IAAI,CAAC,MAAM,CAAC,gBAAgB;wBAC1B,MAAM,CAAC,gBAAgB,GAAG,EAAE,CAAC;oBAC/B,MAAM,CAAC,gBAAgB,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC,KAAK,CAAC;iBAC9D;aACF;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AA1BD,4CA0BC","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 { MapLayerSource } from \"@itwin/core-frontend\";\nimport { CustomParamsStorage } from \"./CustomParamsStorage\";\nimport { 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 } else {\n customParam =paramFromStorage;\n }\n\n if (customParam && source) {\n if (customParam.secret) {\n if (!source.unsavedQueryParams)\n source.unsavedQueryParams = {};\n source.unsavedQueryParams[customParam.key] = customParam.value;\n } else {\n if (!source.savedQueryParams)\n source.savedQueryParams = {};\n source.savedQueryParams[customParam.key] = customParam.value;\n }\n }\n });\n }\n}\n"]}
|
|
@@ -35,7 +35,7 @@ export declare class PreferencesBrowserStorage implements UserPreferencesAccess
|
|
|
35
35
|
constructor(storageItemKeyPrefix: string, opts?: PreferencesBrowserStorageOptions);
|
|
36
36
|
private getStorageItemKey;
|
|
37
37
|
private static getPreferenceKey;
|
|
38
|
-
get(arg: PreferenceKeyArg & ITwinIdArg): Promise<KeyContentProps[] | undefined>;
|
|
38
|
+
get(arg: PreferenceKeyArg & ITwinIdArg): Promise<KeyContentProps | KeyContentProps[] | undefined>;
|
|
39
39
|
delete(arg: PreferenceKeyArg & ITwinIdArg): Promise<void>;
|
|
40
40
|
save(arg: PreferenceArg & ITwinIdArg): Promise<void>;
|
|
41
41
|
}
|
|
@@ -23,7 +23,7 @@ function CustomParamsSettingsPanel() {
|
|
|
23
23
|
const [params, setParams] = React.useState(() => {
|
|
24
24
|
const paramsMap = {};
|
|
25
25
|
const paramsList = storage.get(undefined);
|
|
26
|
-
if (paramsList) {
|
|
26
|
+
if (Array.isArray(paramsList)) {
|
|
27
27
|
for (const param of paramsList)
|
|
28
28
|
paramsMap[param.name] = param;
|
|
29
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomParamsSettings.js","sourceRo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cAAc;gBACxH,oBAAC,4BAAM,OAAE,CACE,CACT;QACN,6BAAK,SAAS,EAAC,8BAA8B;YAC3C,oBAAC,oBAAO,IACN,aAAa,EAAE,aAAa,EAC5B,oBAAoB,EAAE,oBAAoB,EAC1C,SAAS,EAAC,sCAAsC,IAE9C,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAClC,oBAAC,wBAAW,IACV,GAAG,EAAE,OAAO,EACZ,SAAS,EAAC,oCAAoC,EAC9C,KAAK,EAAE,OAAO,EACd,YAAY,EAAE,GAAG,EAAE,CAAC,sBAAsB,CAAC,OAAO,CAAC,EACnD,YAAY,EAAE,GAAG,EAAE,CAAC,sBAAsB,CAAC,SAAS,CAAC;gBAErD,8BAAM,SAAS,EAAC,yCAAyC,EAAC,KAAK,EAAE,OAAO,IAAG,OAAO,CAAQ;gBAExF,CAAC,mBAAmB,IAAI,mBAAmB,KAAK,OAAO,CAAC;oBACxD;wBACE,oBAAC,0BAAU,IACT,IAAI,EAAC,OAAO,EACZ,SAAS,EAAC,YAAY,EACtB,SAAS,EAAC,8BAA8B,EACxC,KAAK,EAAE,uBAAW,CAAC,SAAS,CAAC,qCAAqC,CAAC;4BACnE,oBAAC,6BAAO,OAAE,CACC;wBACb,oBAAC,0BAAU,IACT,IAAI,EAAC,OAAO,EACZ,SAAS,EAAC,YAAY,EACtB,SAAS,EAAC,2CAA2C,EACrD,KAAK,EAAE,uBAAW,CAAC,SAAS,CAAC,uCAAuC,CAAC,EACrE,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,GAAE,yBAAyB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAA,CAAC;4BAChE,oBAAC,+BAAS,OAAE,CACD,CACZ,CACO,CACf,CAEK,CACN,CACF,CACP,CAAC;AACJ,CAAC;AAvJD,8DAuJC","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 \"./CustomParamsSettings.scss\";\nimport * as React from \"react\";\nimport { UiFramework } from \"@itwin/appui-react\";\nimport { Listbox, ListboxItem, ListboxValue } from \"@itwin/core-react\";\nimport { SvgTechnicalPreviewMini } from \"@itwin/itwinui-icons-color-react\";\nimport { SvgAdd, SvgDelete, SvgEdit } from \"@itwin/itwinui-icons-react\";\nimport { Icon, IconButton } from \"@itwin/itwinui-react\";\nimport { CustomParamsMappingStorage } from \"../../CustomParamsMappingStorage\";\nimport { CustomParamsStorage } from \"../../CustomParamsStorage\";\nimport { MapLayersUI } from \"../../mapLayers\";\nimport { CustomParamItem } from \"../Interfaces\";\nimport { CustomParamEditDialog } from \"./CustomParamEditDialog\";\n\ninterface CustomParamsMap {\n [paramName: string]: CustomParamItem;\n}\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function CustomParamsSettingsPanel() {\n\n const [storage] = React.useState(() => new CustomParamsStorage());\n const [mappingStorage] = React.useState(() => new CustomParamsMappingStorage());\n\n const [params, setParams] = React.useState<CustomParamsMap>(() => {\n const paramsMap: CustomParamsMap ={};\n const paramsList = storage.get(undefined);\n if (paramsList) {\n for (const param of paramsList)\n paramsMap[param.name] = param;\n }\n return paramsMap;\n });\n\n const [listItemUnderCursor, setListItemUnderCursor] = React.useState<string | undefined>();\n const [selectedValue, setSelectedValue] = React.useState<string | undefined>();\n\n const deleteMapping = React.useCallback((name: string) => {\n const tmpParams = {...params};\n delete tmpParams[name];\n setParams(tmpParams);\n storage.delete(name);\n\n // Cascade delete to api key mapping\n const mappingContent = mappingStorage.getContent();\n if (mappingContent) {\n for (const itemKey of Object.keys(mappingContent)) {\n if (mappingContent[itemKey].customParamNames.includes(name)) {\n const newParamNames = mappingContent[itemKey].customParamNames.filter((value) => value !== name);\n newParamNames.length > 0 ? mappingStorage.save(itemKey, {customParamNames: newParamNames}) : mappingStorage.delete(itemKey);\n }\n }\n }\n }, [mappingStorage, params, storage]);\n\n /*\n Handle Remove layer button clicked\n */\n const onItemRemoveButtonClicked = React.useCallback((name: string, event) => {\n event.stopPropagation(); // We don't want the owning ListBox to react on mouse click.\n deleteMapping(name);\n }, [deleteMapping]);\n\n const onCancelEdit = React.useCallback(() => {\n UiFramework.dialogs.modal.close();\n setSelectedValue(undefined); // clear listbox focus\n }, []);\n\n const onOkEdit = React.useCallback((newItem: CustomParamItem, oldItem?: CustomParamItem) => {\n\n UiFramework.dialogs.modal.close();\n\n // If the edited item has a new name, delete the entry first.\n const tmpParams = {...params};\n if (oldItem && oldItem.name !== newItem.name) {\n delete tmpParams[oldItem.name];\n setParams(tmpParams);\n storage.delete(oldItem.name);\n\n const mappingContent = mappingStorage.getContent();\n if (mappingContent) {\n for (const itemKey of Object.keys(mappingContent)) {\n if (mappingContent[itemKey].customParamNames.includes(oldItem.name )) {\n const newParamNames = mappingContent[itemKey].customParamNames.filter((value) => value !== oldItem.name);\n newParamNames.push(newItem.name);\n mappingStorage.save(itemKey, {customParamNames: newParamNames});\n }\n }\n }\n }\n storage.save(newItem.name, newItem);\n\n tmpParams[newItem.name] = newItem;\n setParams(tmpParams);\n setSelectedValue(undefined); // clear listbox focus\n }, [mappingStorage, params, storage]);\n\n const handleAddClick = React.useCallback(() => {\n UiFramework.dialogs.modal.open(\n <CustomParamEditDialog\n onOkResult={onOkEdit}\n onCancelResult={onCancelEdit}\n />);\n return;\n }, [onCancelEdit, onOkEdit]);\n\n const onListboxValueChange = React.useCallback((newValue: ListboxValue, _isControlOrCommandPressed?: boolean)=> {\n const item = params[newValue];\n if (item)\n UiFramework.dialogs.modal.open(<CustomParamEditDialog item={item} onOkResult={onOkEdit} onCancelResult={onCancelEdit}/>);\n\n setSelectedValue(newValue);\n return;\n }, [params, onCancelEdit, onOkEdit]);\n\n return (\n <div className=\"customParamsSettings-container\">\n <div className=\"customParamsSettings-header\">\n <span className=\"customParamsSettings-header-label\">\n {MapLayersUI.translate(\"CustomParamSettings.SectionLabel\")}\n <div title={MapLayersUI.translate(\"Labels.TechPreviewBadgeTooltip\")} className=\"customParamsSettings-previewBadge\">\n <Icon size=\"small\"><SvgTechnicalPreviewMini /></Icon>\n </div>\n </span>\n\n <IconButton size=\"small\" styleType=\"borderless\" className=\"customParamsSettings-header-add-button\" onClick={handleAddClick}>\n <SvgAdd/>\n </IconButton>\n </div>\n <div className=\"customParamsSettings-content\">\n <Listbox\n selectedValue={selectedValue}\n onListboxValueChange={onListboxValueChange}\n className=\"customParamsSettings-content-listbox\" >\n {\n Object.keys(params).map((keyName) =>\n <ListboxItem\n key={keyName}\n className=\"customParamsSettings-content-entry\"\n value={keyName}\n onMouseEnter={() => setListItemUnderCursor(keyName)}\n onMouseLeave={() => setListItemUnderCursor(undefined)}\n >\n <span className=\"customParamsSettings-content-entry-name\" title={keyName}>{keyName}</span>\n { // Display the delete icon only when the mouse over a specific item otherwise list feels cluttered.\n (listItemUnderCursor && listItemUnderCursor === keyName) &&\n <>\n <IconButton\n size=\"small\"\n styleType=\"borderless\"\n className=\"map-source-list-entry-button\"\n title={MapLayersUI.translate(\"CustomParamSettings.EditButtonTitle\")}>\n <SvgEdit/>\n </IconButton>\n <IconButton\n size=\"small\"\n styleType=\"borderless\"\n className=\"customParamsSettings-content-entry-button\"\n title={MapLayersUI.translate(\"CustomParamSettings.DeleteButtonTitle\")}\n onClick={(event) => {onItemRemoveButtonClicked(keyName, event);}}>\n <SvgDelete/>\n </IconButton>\n </>}\n </ListboxItem>\n )\n }\n </Listbox>\n </div>\n </div>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"CustomParamsSettings.js","sourceRoot":"","sources":["../../../../src/ui/widget/CustomParamsSettings.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,uCAAqC;AACrC,+BAA+B;AAC/B,oDAAiD;AACjD,kDAAuE;AACvE,gFAA2E;AAC3E,oEAAwE;AACxE,wDAAwD;AACxD,iFAA8E;AAC9E,mEAAgE;AACh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E9C,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAClC,oBAAC,wBAAW,IACV,GAAG,EAAE,OAAO,EACZ,SAAS,EAAC,oCAAoC,EAC9C,KAAK,EAAE,OAAO,EACd,YAAY,EAAE,GAAG,EAAE,CAAC,sBAAsB,CAAC,OAAO,CAAC,EACnD,YAAY,EAAE,GAAG,EAAE,CAAC,sBAAsB,CAAC,SAAS,CAAC;gBAErD,8BAAM,SAAS,EAAC,yCAAyC,EAAC,KAAK,EAAE,OAAO,IAAG,OAAO,CAAQ;gBAExF,CAAC,mBAAmB,IAAI,mBAAmB,KAAK,OAAO,CAAC;oBACxD;wBACE,oBAAC,0BAAU,IACT,IAAI,EAAC,OAAO,EACZ,SAAS,EAAC,YAAY,EACtB,SAAS,EAAC,8BAA8B,EACxC,KAAK,EAAE,uBAAW,CAAC,SAAS,CAAC,qCAAqC,CAAC;4BACnE,oBAAC,6BAAO,OAAE,CACC;wBACb,oBAAC,0BAAU,IACT,IAAI,EAAC,OAAO,EACZ,SAAS,EAAC,YAAY,EACtB,SAAS,EAAC,2CAA2C,EACrD,KAAK,EAAE,uBAAW,CAAC,SAAS,CAAC,uCAAuC,CAAC,EACrE,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,GAAE,yBAAyB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAA,CAAC;4BAChE,oBAAC,+BAAS,OAAE,CACD,CACZ,CACO,CACf,CAEK,CACN,CACF,CACP,CAAC;AACJ,CAAC;AAvJD,8DAuJC","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 \"./CustomParamsSettings.scss\";\nimport * as React from \"react\";\nimport { UiFramework } from \"@itwin/appui-react\";\nimport { Listbox, ListboxItem, ListboxValue } from \"@itwin/core-react\";\nimport { SvgTechnicalPreviewMini } from \"@itwin/itwinui-icons-color-react\";\nimport { SvgAdd, SvgDelete, SvgEdit } from \"@itwin/itwinui-icons-react\";\nimport { Icon, IconButton } from \"@itwin/itwinui-react\";\nimport { CustomParamsMappingStorage } from \"../../CustomParamsMappingStorage\";\nimport { CustomParamsStorage } from \"../../CustomParamsStorage\";\nimport { MapLayersUI } from \"../../mapLayers\";\nimport { CustomParamItem } from \"../Interfaces\";\nimport { CustomParamEditDialog } from \"./CustomParamEditDialog\";\n\ninterface CustomParamsMap {\n [paramName: string]: CustomParamItem;\n}\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function CustomParamsSettingsPanel() {\n\n const [storage] = React.useState(() => new CustomParamsStorage());\n const [mappingStorage] = React.useState(() => new CustomParamsMappingStorage());\n\n const [params, setParams] = React.useState<CustomParamsMap>(() => {\n const paramsMap: CustomParamsMap ={};\n const paramsList = storage.get(undefined);\n if (Array.isArray(paramsList)) {\n for (const param of paramsList)\n paramsMap[param.name] = param;\n }\n return paramsMap;\n });\n\n const [listItemUnderCursor, setListItemUnderCursor] = React.useState<string | undefined>();\n const [selectedValue, setSelectedValue] = React.useState<string | undefined>();\n\n const deleteMapping = React.useCallback((name: string) => {\n const tmpParams = {...params};\n delete tmpParams[name];\n setParams(tmpParams);\n storage.delete(name);\n\n // Cascade delete to api key mapping\n const mappingContent = mappingStorage.getContent();\n if (mappingContent) {\n for (const itemKey of Object.keys(mappingContent)) {\n if (mappingContent[itemKey].customParamNames.includes(name)) {\n const newParamNames = mappingContent[itemKey].customParamNames.filter((value) => value !== name);\n newParamNames.length > 0 ? mappingStorage.save(itemKey, {customParamNames: newParamNames}) : mappingStorage.delete(itemKey);\n }\n }\n }\n }, [mappingStorage, params, storage]);\n\n /*\n Handle Remove layer button clicked\n */\n const onItemRemoveButtonClicked = React.useCallback((name: string, event) => {\n event.stopPropagation(); // We don't want the owning ListBox to react on mouse click.\n deleteMapping(name);\n }, [deleteMapping]);\n\n const onCancelEdit = React.useCallback(() => {\n UiFramework.dialogs.modal.close();\n setSelectedValue(undefined); // clear listbox focus\n }, []);\n\n const onOkEdit = React.useCallback((newItem: CustomParamItem, oldItem?: CustomParamItem) => {\n\n UiFramework.dialogs.modal.close();\n\n // If the edited item has a new name, delete the entry first.\n const tmpParams = {...params};\n if (oldItem && oldItem.name !== newItem.name) {\n delete tmpParams[oldItem.name];\n setParams(tmpParams);\n storage.delete(oldItem.name);\n\n const mappingContent = mappingStorage.getContent();\n if (mappingContent) {\n for (const itemKey of Object.keys(mappingContent)) {\n if (mappingContent[itemKey].customParamNames.includes(oldItem.name )) {\n const newParamNames = mappingContent[itemKey].customParamNames.filter((value) => value !== oldItem.name);\n newParamNames.push(newItem.name);\n mappingStorage.save(itemKey, {customParamNames: newParamNames});\n }\n }\n }\n }\n storage.save(newItem.name, newItem);\n\n tmpParams[newItem.name] = newItem;\n setParams(tmpParams);\n setSelectedValue(undefined); // clear listbox focus\n }, [mappingStorage, params, storage]);\n\n const handleAddClick = React.useCallback(() => {\n UiFramework.dialogs.modal.open(\n <CustomParamEditDialog\n onOkResult={onOkEdit}\n onCancelResult={onCancelEdit}\n />);\n return;\n }, [onCancelEdit, onOkEdit]);\n\n const onListboxValueChange = React.useCallback((newValue: ListboxValue, _isControlOrCommandPressed?: boolean)=> {\n const item = params[newValue];\n if (item)\n UiFramework.dialogs.modal.open(<CustomParamEditDialog item={item} onOkResult={onOkEdit} onCancelResult={onCancelEdit}/>);\n\n setSelectedValue(newValue);\n return;\n }, [params, onCancelEdit, onOkEdit]);\n\n return (\n <div className=\"customParamsSettings-container\">\n <div className=\"customParamsSettings-header\">\n <span className=\"customParamsSettings-header-label\">\n {MapLayersUI.translate(\"CustomParamSettings.SectionLabel\")}\n <div title={MapLayersUI.translate(\"Labels.TechPreviewBadgeTooltip\")} className=\"customParamsSettings-previewBadge\">\n <Icon size=\"small\"><SvgTechnicalPreviewMini /></Icon>\n </div>\n </span>\n\n <IconButton size=\"small\" styleType=\"borderless\" className=\"customParamsSettings-header-add-button\" onClick={handleAddClick}>\n <SvgAdd/>\n </IconButton>\n </div>\n <div className=\"customParamsSettings-content\">\n <Listbox\n selectedValue={selectedValue}\n onListboxValueChange={onListboxValueChange}\n className=\"customParamsSettings-content-listbox\" >\n {\n Object.keys(params).map((keyName) =>\n <ListboxItem\n key={keyName}\n className=\"customParamsSettings-content-entry\"\n value={keyName}\n onMouseEnter={() => setListItemUnderCursor(keyName)}\n onMouseLeave={() => setListItemUnderCursor(undefined)}\n >\n <span className=\"customParamsSettings-content-entry-name\" title={keyName}>{keyName}</span>\n { // Display the delete icon only when the mouse over a specific item otherwise list feels cluttered.\n (listItemUnderCursor && listItemUnderCursor === keyName) &&\n <>\n <IconButton\n size=\"small\"\n styleType=\"borderless\"\n className=\"map-source-list-entry-button\"\n title={MapLayersUI.translate(\"CustomParamSettings.EditButtonTitle\")}>\n <SvgEdit/>\n </IconButton>\n <IconButton\n size=\"small\"\n styleType=\"borderless\"\n className=\"customParamsSettings-content-entry-button\"\n title={MapLayersUI.translate(\"CustomParamSettings.DeleteButtonTitle\")}\n onClick={(event) => {onItemRemoveButtonClicked(keyName, event);}}>\n <SvgDelete/>\n </IconButton>\n </>}\n </ListboxItem>\n )\n }\n </Listbox>\n </div>\n </div>\n );\n}\n"]}
|
|
@@ -9,6 +9,7 @@ export declare class FeatureInfoDataProvider implements IPropertyDataProvider {
|
|
|
9
9
|
private readonly _detachToolAdminListener;
|
|
10
10
|
onDataChanged: PropertyDataChangeEvent;
|
|
11
11
|
private _data;
|
|
12
|
+
private _isActive;
|
|
12
13
|
constructor();
|
|
13
14
|
private handleActiveToolChanged;
|
|
14
15
|
private handleOnInfoReadyChanged;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FeatureInfoDataProvider.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/FeatureInfoDataProvider.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;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AAG,MAAM;IAMrD,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAO7C,WAAW,CAAC,cAAc,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI;IAUvE,cAAc,CAAC,cAAc,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO;IAe5E,eAAe,CAAC,cAAc,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,cAAc,GAAG,OAAO;IAclG,OAAO,IAAI,OAAO,CAAC,YAAY,CAAC;CAG9C"}
|
|
@@ -27,16 +27,27 @@ class FeatureInfoDataProvider {
|
|
|
27
27
|
constructor() {
|
|
28
28
|
this.onDataChanged = new components_react_1.PropertyDataChangeEvent();
|
|
29
29
|
this._data = new SimplePropertyData();
|
|
30
|
+
this._isActive = false;
|
|
30
31
|
this.handleActiveToolChanged = (tool, _start) => {
|
|
31
|
-
if (this._detachActiveToolListener)
|
|
32
|
+
if (this._detachActiveToolListener)
|
|
32
33
|
this._detachActiveToolListener();
|
|
33
|
-
|
|
34
|
-
}
|
|
34
|
+
this._detachActiveToolListener = undefined;
|
|
35
35
|
if (tool.toolId === map_layers_formats_1.MapFeatureInfoTool.toolId) {
|
|
36
36
|
const mapInfoTool = tool;
|
|
37
37
|
this._detachActiveToolListener = mapInfoTool.onInfoReady.addListener(this.handleOnInfoReadyChanged);
|
|
38
|
+
if (this._isActive) {
|
|
39
|
+
// This is a tool reset, simply clear previous data
|
|
40
|
+
this._data = new SimplePropertyData();
|
|
41
|
+
this.onDataChanged.raiseEvent();
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
this._isActive = true;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
38
48
|
this._data = new SimplePropertyData();
|
|
39
49
|
this.onDataChanged.raiseEvent();
|
|
50
|
+
this._isActive = false;
|
|
40
51
|
}
|
|
41
52
|
};
|
|
42
53
|
this.handleOnInfoReadyChanged = (data) => {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I,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE,SAAS,CAAC,CAAC;YACxF,MAAM,GAAG,IAAI,CAAC;SACf;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAEM,KAAK,CAAC,OAAO;QAClB,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;CACF;AAhKD,0DAgKC","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 { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { IPropertyDataProvider, PropertyCategory, PropertyData, PropertyDataChangeEvent } from \"@itwin/components-react\";\nimport { IModelApp, MapFeatureInfo, MapLayerFeatureRecord, MapSubLayerFeatureInfo, StartOrResume, Tool } from \"@itwin/core-frontend\";\nimport { MapFeatureInfoTool, MapFeatureInfoToolData } from \"@itwin/map-layers-formats\";\n\n/**\n * Implementation of [IPropertyDataProvider] that uses an associative array.\n * @internal\n */\n\nclass SimplePropertyData implements PropertyData {\n public label: PropertyRecord = PropertyRecord.fromString(\"\");\n public description?: string;\n public categories: PropertyCategory[] = [];\n public records: { [categoryName: string]: PropertyRecord[] } = {};\n}\n\n/**\n * @internal\n */\nexport class FeatureInfoDataProvider implements IPropertyDataProvider {\n private _detachActiveToolListener: VoidFunction | undefined;\n private readonly _detachToolAdminListener: VoidFunction;\n\n public onDataChanged = new PropertyDataChangeEvent();\n private _data = new SimplePropertyData();\n\n constructor() {\n this._detachToolAdminListener = IModelApp.toolAdmin.activeToolChanged.addListener(this.handleActiveToolChanged);\n }\n\n private handleActiveToolChanged = (tool: Tool, _start: StartOrResume) => {\n if (this._detachActiveToolListener) {\n this._detachActiveToolListener();\n this._detachActiveToolListener = undefined;\n }\n\n if (tool.toolId === MapFeatureInfoTool.toolId) {\n const mapInfoTool = tool as MapFeatureInfoTool;\n this._detachActiveToolListener = mapInfoTool.onInfoReady.addListener(this.handleOnInfoReadyChanged);\n this._data = new SimplePropertyData();\n this.onDataChanged.raiseEvent();\n }\n };\n\n private handleOnInfoReadyChanged = (data: MapFeatureInfoToolData) => {\n void this.setInfo(data.mapInfo).then(); // No need to wait for data parsing.\n };\n\n private generateLayerCategoryName(subLayerName: string) {\n return `_layer_${subLayerName}`;\n }\n\n private generateSubLayerCategoryName(subLayerName: string) {\n return `_subLayer_${subLayerName}`;\n }\n\n public onUnload() {\n this._detachToolAdminListener();\n if (this._detachActiveToolListener) {\n this._detachActiveToolListener();\n this._detachActiveToolListener = undefined;\n }\n }\n\n public get hasRecords() {\n return this._data.categories.length > 0;\n }\n\n private async setInfo(mapInfo?: MapFeatureInfo) {\n this._data = new SimplePropertyData();\n\n if (mapInfo?.layerInfos) {\n for (const curLayerInfo of mapInfo.layerInfos) {\n const categoryName = this.generateLayerCategoryName(curLayerInfo.layerName);\n const layerCatIdx = this.findCategoryIndexByName(categoryName);\n let nbRecords = 0;\n\n const layerCategory =\n layerCatIdx === -1 ? { name: categoryName, label: curLayerInfo.layerName, expand: true, childCategories: [] } : this._data.categories[layerCatIdx];\n\n if (curLayerInfo.subLayerInfos) {\n for (const subLayerInfo of curLayerInfo.subLayerInfos) {\n this.addSubLayerCategory(subLayerInfo, layerCategory);\n\n // Add every feature records for this sub-layer\n for (const feature of subLayerInfo.features) {\n nbRecords++;\n for (const attribute of feature.attributes) {\n // Always use the string value for now\n this.addProperty(MapLayerFeatureRecord.createRecordFromAttribute(attribute), this.generateSubLayerCategoryName(subLayerInfo.subLayerName));\n }\n }\n }\n if (layerCatIdx === -1 && nbRecords > 0) this.addCategory(layerCategory);\n }\n }\n }\n\n this.onDataChanged.raiseEvent();\n }\n\n public addSubLayerCategory(subLayerInfo: MapSubLayerFeatureInfo, layerCategory: PropertyCategory) {\n const subLayerName = this.generateSubLayerCategoryName(subLayerInfo.subLayerName);\n const subCatIdx = layerCategory.childCategories?.findIndex((testCategory: PropertyCategory) => {\n return testCategory.name === subLayerName;\n });\n\n let subLayerCategory;\n if (subCatIdx === -1) {\n subLayerCategory = { name: subLayerName, label: subLayerInfo.subLayerName, expand: true };\n this.addSubCategory(subLayerName);\n layerCategory.childCategories?.push(subLayerCategory);\n }\n }\n public addSubCategory(categoryName: string) {\n this._data.records[categoryName] = [];\n }\n\n public addCategory(category: PropertyCategory): number {\n const categoryIdx = this._data.categories.push(category) - 1;\n this._data.records[this._data.categories[categoryIdx].name] = [];\n return categoryIdx;\n }\n\n public findCategoryIndex(category: PropertyCategory): number {\n const index = this._data.categories.findIndex((testCategory: PropertyCategory) => {\n return testCategory.name === category.name;\n });\n return index;\n }\n public findCategoryIndexByName(name: string): number {\n const index = this._data.categories.findIndex((testCategory: PropertyCategory) => {\n return testCategory.name === name;\n });\n return index;\n }\n\n public addProperty(propertyRecord: PropertyRecord, categoryName: string): void {\n const idx = this._data.records[categoryName].findIndex((prop) => prop.property.name === propertyRecord.property.name);\n if (idx === -1) {\n this._data.records[categoryName].push(propertyRecord);\n } else {\n this._data.records[categoryName][idx].isMerged = true;\n this._data.records[categoryName][idx].isReadonly = true;\n }\n }\n\n public removeProperty(propertyRecord: PropertyRecord, categoryIdx: number): boolean {\n const index = this._data.records[this._data.categories[categoryIdx].name].findIndex((record: PropertyRecord) => {\n return record === propertyRecord;\n });\n\n let result = false;\n\n if (index >= 0) {\n this._data.records[this._data.categories[categoryIdx].name].splice(index, 1);\n this.onDataChanged.raiseEvent();\n result = true;\n }\n return result;\n }\n\n public replaceProperty(propertyRecord: PropertyRecord, categoryIdx: number, newRecord: PropertyRecord): boolean {\n const index = this._data.records[this._data.categories[categoryIdx].name].findIndex((record: PropertyRecord) => {\n return record === propertyRecord;\n });\n\n let result = false;\n\n if (index >= 0) {\n this._data.records[this._data.categories[categoryIdx].name].splice(index, 1, newRecord);\n result = true;\n }\n return result;\n }\n\n public async getData(): Promise<PropertyData> {\n return this._data;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"FeatureInfoDataProvider.js","sourceRoot":"","sources":["../../../../src/ui/widget/FeatureInfoDataProvider.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,0DAAuD;AACvD,8DAAyH;AACzH,wDAAqI;AACrI,kEAAuF;AAEvF;;;GAGG;AAEH,MAAM,kBAAkB;IAAxB;QACS,UAAK,GAAmB,+BAAc,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;QAEtD,eAAU,GAAuB,EAAE,CAAC;QACpC,YAAO,GAAiD,EAAE,CAAC;IACpE,CAAC;CAAA;AAED;;GAEG;AACH,MAAa,uBAAuB;IAQlC;QAJO,kBAAa,GAAG,IAAI,0CAAuB,EAAE,CAAC;QAC7C,UAAK,GAAG,IAAI,kBAAkB,EAAE,CAAC;QACjC,cAAS,GAAG,KAAK,CAAC;QAMlB,4BAAuB,GAAG,CAAC,IAAU,EAAE,MAAqB,EAAE,EAAE;YAEtE,IAAI,IAAI,CAAC,yBAAyB;gBAChC,IAAI,CAAC,yBAAyB,EAAE,CAAC;YACnC,IAAI,CAAC,yBAAyB,GAAG,SAAS,CAAC;YAE3C,IAAI,IAAI,CAAC,MAAM,KAAK,uCAAkB,CAAC,MAAM,EAAE;gBAC7C,MAAM,WAAW,GAAG,IAA0B,CAAC;gBAE/C,IAAI,CAAC,yBAAyB,GAAG,WAAW,CAAC,WAAW,CAAC,WAAW,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;gBAEpG,IAAI,IAAI,CAAC,SAAS,EAAE;oBAClB,mDAAmD;oBACnD,IAAI,CAAC,KAAK,GAAG,IAAI,kBAAkB,EAAE,CAAC;oBACtC,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,CAAC;iBACjC;qBAAM;oBACL,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;iBACvB;aACF;iBAAM;gBACL,IAAI,CAAC,KAAK,G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AmB,EAAE,SAAyB;QACnG,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,CAAC,MAAsB,EAAE,EAAE;YAC7G,OAAO,MAAM,KAAK,cAAc,CAAC;QACnC,CAAC,CAAC,CAAC;QAEH,IAAI,MAAM,GAAG,KAAK,CAAC;QAEnB,IAAI,KAAK,IAAI,CAAC,EAAE;YACd,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE,SAAS,CAAC,CAAC;YACxF,MAAM,GAAG,IAAI,CAAC;SACf;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAEM,KAAK,CAAC,OAAO;QAClB,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;CACF;AA5KD,0DA4KC","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 { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { IPropertyDataProvider, PropertyCategory, PropertyData, PropertyDataChangeEvent } from \"@itwin/components-react\";\nimport { IModelApp, MapFeatureInfo, MapLayerFeatureRecord, MapSubLayerFeatureInfo, StartOrResume, Tool } from \"@itwin/core-frontend\";\nimport { MapFeatureInfoTool, MapFeatureInfoToolData } from \"@itwin/map-layers-formats\";\n\n/**\n * Implementation of [IPropertyDataProvider] that uses an associative array.\n * @internal\n */\n\nclass SimplePropertyData implements PropertyData {\n public label: PropertyRecord = PropertyRecord.fromString(\"\");\n public description?: string;\n public categories: PropertyCategory[] = [];\n public records: { [categoryName: string]: PropertyRecord[] } = {};\n}\n\n/**\n * @internal\n */\nexport class FeatureInfoDataProvider implements IPropertyDataProvider {\n private _detachActiveToolListener: VoidFunction | undefined;\n private readonly _detachToolAdminListener: VoidFunction;\n\n public onDataChanged = new PropertyDataChangeEvent();\n private _data = new SimplePropertyData();\n private _isActive = false;\n\n constructor() {\n this._detachToolAdminListener = IModelApp.toolAdmin.activeToolChanged.addListener(this.handleActiveToolChanged);\n }\n\n private handleActiveToolChanged = (tool: Tool, _start: StartOrResume) => {\n\n if (this._detachActiveToolListener)\n this._detachActiveToolListener();\n this._detachActiveToolListener = undefined;\n\n if (tool.toolId === MapFeatureInfoTool.toolId) {\n const mapInfoTool = tool as MapFeatureInfoTool;\n\n this._detachActiveToolListener = mapInfoTool.onInfoReady.addListener(this.handleOnInfoReadyChanged);\n\n if (this._isActive) {\n // This is a tool reset, simply clear previous data\n this._data = new SimplePropertyData();\n this.onDataChanged.raiseEvent();\n } else {\n this._isActive = true;\n }\n } else {\n this._data = new SimplePropertyData();\n this.onDataChanged.raiseEvent();\n this._isActive = false;\n }\n };\n\n private handleOnInfoReadyChanged = (data: MapFeatureInfoToolData) => {\n void this.setInfo(data.mapInfo).then(); // No need to wait for data parsing.\n };\n\n private generateLayerCategoryName(subLayerName: string) {\n return `_layer_${subLayerName}`;\n }\n\n private generateSubLayerCategoryName(subLayerName: string) {\n return `_subLayer_${subLayerName}`;\n }\n\n public onUnload() {\n this._detachToolAdminListener();\n if (this._detachActiveToolListener) {\n this._detachActiveToolListener();\n this._detachActiveToolListener = undefined;\n }\n }\n\n public get hasRecords() {\n return this._data.categories.length > 0;\n }\n\n private async setInfo(mapInfo?: MapFeatureInfo) {\n this._data = new SimplePropertyData();\n\n if (mapInfo?.layerInfos) {\n for (const curLayerInfo of mapInfo.layerInfos) {\n const categoryName = this.generateLayerCategoryName(curLayerInfo.layerName);\n const layerCatIdx = this.findCategoryIndexByName(categoryName);\n let nbRecords = 0;\n\n const layerCategory =\n layerCatIdx === -1 ? { name: categoryName, label: curLayerInfo.layerName, expand: true, childCategories: [] } : this._data.categories[layerCatIdx];\n\n if (curLayerInfo.subLayerInfos) {\n for (const subLayerInfo of curLayerInfo.subLayerInfos) {\n this.addSubLayerCategory(subLayerInfo, layerCategory);\n\n // Add every feature records for this sub-layer\n for (const feature of subLayerInfo.features) {\n nbRecords++;\n for (const attribute of feature.attributes) {\n // Always use the string value for now\n this.addProperty(MapLayerFeatureRecord.createRecordFromAttribute(attribute), this.generateSubLayerCategoryName(subLayerInfo.subLayerName));\n }\n }\n }\n if (layerCatIdx === -1 && nbRecords > 0) this.addCategory(layerCategory);\n }\n }\n }\n\n this.onDataChanged.raiseEvent();\n }\n\n public addSubLayerCategory(subLayerInfo: MapSubLayerFeatureInfo, layerCategory: PropertyCategory) {\n const subLayerName = this.generateSubLayerCategoryName(subLayerInfo.subLayerName);\n const subCatIdx = layerCategory.childCategories?.findIndex((testCategory: PropertyCategory) => {\n return testCategory.name === subLayerName;\n });\n\n let subLayerCategory;\n if (subCatIdx === -1) {\n subLayerCategory = { name: subLayerName, label: subLayerInfo.subLayerName, expand: true };\n this.addSubCategory(subLayerName);\n layerCategory.childCategories?.push(subLayerCategory);\n }\n }\n public addSubCategory(categoryName: string) {\n this._data.records[categoryName] = [];\n }\n\n public addCategory(category: PropertyCategory): number {\n const categoryIdx = this._data.categories.push(category) - 1;\n this._data.records[this._data.categories[categoryIdx].name] = [];\n return categoryIdx;\n }\n\n public findCategoryIndex(category: PropertyCategory): number {\n const index = this._data.categories.findIndex((testCategory: PropertyCategory) => {\n return testCategory.name === category.name;\n });\n return index;\n }\n public findCategoryIndexByName(name: string): number {\n const index = this._data.categories.findIndex((testCategory: PropertyCategory) => {\n return testCategory.name === name;\n });\n return index;\n }\n\n public addProperty(propertyRecord: PropertyRecord, categoryName: string): void {\n const idx = this._data.records[categoryName].findIndex((prop) => prop.property.name === propertyRecord.property.name);\n if (idx === -1) {\n this._data.records[categoryName].push(propertyRecord);\n } else {\n this._data.records[categoryName][idx].isMerged = true;\n this._data.records[categoryName][idx].isReadonly = true;\n }\n }\n\n public removeProperty(propertyRecord: PropertyRecord, categoryIdx: number): boolean {\n const index = this._data.records[this._data.categories[categoryIdx].name].findIndex((record: PropertyRecord) => {\n return record === propertyRecord;\n });\n\n let result = false;\n\n if (index >= 0) {\n this._data.records[this._data.categories[categoryIdx].name].splice(index, 1);\n this.onDataChanged.raiseEvent();\n result = true;\n }\n return result;\n }\n\n public replaceProperty(propertyRecord: PropertyRecord, categoryIdx: number, newRecord: PropertyRecord): boolean {\n const index = this._data.records[this._data.categories[categoryIdx].name].findIndex((record: PropertyRecord) => {\n return record === propertyRecord;\n });\n\n let result = false;\n\n if (index >= 0) {\n this._data.records[this._data.categories[categoryIdx].name].splice(index, 1, newRecord);\n result = true;\n }\n return result;\n }\n\n public async getData(): Promise<PropertyData> {\n return this._data;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FeatureInfoWidget.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/FeatureInfoWidget.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"FeatureInfoWidget.d.ts","sourceRoot":"","sources":["../../../../src/ui/widget/FeatureInfoWidget.tsx"],"names":[],"mappings":";AAaA,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAGtD,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,MAAM,sDAG9C;AAGD,UAAU,yBAAyB;IACjC,eAAe,EAAE,qBAAqB,CAAC;CACxC;AAGD,wBAAgB,oBAAoB,CAAC,EAAE,eAAe,EAAE,EAAE,yBAAyB,eAyElF"}
|
|
@@ -9,6 +9,8 @@ const React = require("react");
|
|
|
9
9
|
const appui_react_1 = require("@itwin/appui-react");
|
|
10
10
|
const components_react_1 = require("@itwin/components-react");
|
|
11
11
|
const core_react_1 = require("@itwin/core-react");
|
|
12
|
+
const itwinui_icons_react_1 = require("@itwin/itwinui-icons-react");
|
|
13
|
+
const itwinui_react_1 = require("@itwin/itwinui-react");
|
|
12
14
|
const mapLayers_1 = require("../../mapLayers");
|
|
13
15
|
const FeatureInfoUiItemsProvider_1 = require("../FeatureInfoUiItemsProvider");
|
|
14
16
|
const FeatureInfoDataProvider_1 = require("./FeatureInfoDataProvider");
|
|
@@ -46,9 +48,18 @@ function MapFeatureInfoWidget({ featureInfoOpts }) {
|
|
|
46
48
|
const handleResize = React.useCallback((w, h) => {
|
|
47
49
|
setSize({ width: w, height: h });
|
|
48
50
|
}, []);
|
|
51
|
+
const copyButton = React.useCallback((props) => props.isPropertyHovered &&
|
|
52
|
+
React.createElement("div", null,
|
|
53
|
+
React.createElement(itwinui_react_1.IconButton, { styleType: "borderless", onClick: () => {
|
|
54
|
+
const value = props.property.value;
|
|
55
|
+
if (value !== undefined && value.hasOwnProperty("displayValue"))
|
|
56
|
+
navigator.clipboard.writeText(value.displayValue ?? "").catch((_) => { });
|
|
57
|
+
} },
|
|
58
|
+
React.createElement(itwinui_icons_react_1.SvgCopy, null))), []);
|
|
49
59
|
if (hasData && dataProvider.current) {
|
|
50
60
|
return (React.createElement(core_react_1.ResizableContainerObserver, { onResize: handleResize },
|
|
51
|
-
React.createElement(components_react_1.VirtualizedPropertyGridWithDataProvider, { width: width, height: height, dataProvider: dataProvider.current, orientation: core_react_1.Orientation.Vertical, isPropertySelectionEnabled: featureInfoOpts?.propertyGridOptions?.isPropertySelectionEnabled
|
|
61
|
+
React.createElement(components_react_1.VirtualizedPropertyGridWithDataProvider, { width: width, height: height, dataProvider: dataProvider.current, orientation: core_react_1.Orientation.Vertical, isPropertySelectionEnabled: featureInfoOpts?.propertyGridOptions?.isPropertySelectionEnabled, isPropertyHoverEnabled // This need to be turned on to have the action button appears only when property hovered
|
|
62
|
+
: true, actionButtonRenderers: [copyButton] })));
|
|
52
63
|
}
|
|
53
64
|
else {
|
|
54
65
|
return (React.createElement(core_react_1.FillCentered, null,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FeatureInfoWidget.js","sourceRoot":"","sources":["../../../../src/ui/widget/FeatureInfoWidget.tsx"],"names":[],"mappings":";;;AAAA;;;gGAGgG;AAChG,+BAA+B;
|
|
1
|
+
{"version":3,"file":"FeatureInfoWidget.js","sourceRoot":"","sources":["../../../../src/ui/widget/FeatureInfoWidget.tsx"],"names":[],"mappings":";;;AAAA;;;gGAGgG;AAChG,+BAA+B;AAE/B,oDAAyE;AACzE,8DAA6G;AAC7G,kDAA0F;AAC1F,oEAAqD;AACrD,wDAAkD;AAClD,+CAA8C;AAC9C,8EAA2E;AAE3E,uEAAoE;AAEpE,SAAgB,oBAAoB,CAAC,EAAU;IAC7C,MAAM,aAAa,GAAG,IAAA,oCAAsB,GAAE,CAAC;IAC/C,OAAO,aAAa,EAAE,aAAa,CAAC,EAAE,CAAC,CAAC;AAC1C,CAAC;AAHD,oDAGC;AAOD,gEAAgE;AAChE,SAAgB,oBAAoB,CAAC,EAAE,eAAe,EAA6B;IAEjF,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,EAA2B,CAAC;IAC7D,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAU,KAAK,CAAC,CAAC;IAE7D,MAAM,CAAC,gBAAgB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,uBAAW,CAAC,YAAY,CAAC,kBAAkB,CAAC,uCAAuC,CAAC,CAAC,CAAC;IAEhI,MAAM,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC;IAE7E,MAAM,SAAS,GAAG,oBAAoB,CAAC,uDAA0B,CAAC,QAAQ,CAAC,CAAC;IAC5E,MAAM,iBAAiB,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE;QAC/C,MAAM,aAAa,GAAG,YAAY,CAAC,OAAO,KAAK,SAAS,IAAI,YAAY,CAAC,OAAO,C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KAAK,SAAS,IAAI,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;wBAC7D,SAAS,CAAC,SAAS,CAAC,SAAS,CAAE,KAAwB,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC;gBAClG,CAAC;gBACC,oBAAC,6BAAO,OAAE,CACC,CACT,EACR,EAAE,CACH,CAAC;IAEF,IAAI,OAAO,IAAI,YAAY,CAAC,OAAO,EAAE;QACnC,OAAO,CACL,oBAAC,uCAA0B,IAAC,QAAQ,EAAE,YAAY;YAChD,oBAAC,0DAAuC,IACtC,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,YAAY,CAAC,OAAO,EAClC,WAAW,EAAE,wBAAW,CAAC,QAAQ,EACjC,0BAA0B,EAAE,eAAe,EAAE,mBAAmB,EAAE,0BAA0B,EAC5F,sBAAsB,CAAG,yFAAyF;wBAClH,qBAAqB,EAAE,CAAC,UAAU,CAAC,GACnC,CACyB,CAC9B,CAAC;KACH;SAAM;QACL,OAAO,CACL,oBAAC,yBAAY;YACX;gBACE,+BAAI,gBAAgB,CAAK,CACpB,CACM,CAChB,CAAC;KACH;AACH,CAAC;AAzED,oDAyEC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\nimport * as React from \"react\";\nimport { PrimitiveValue } from \"@itwin/appui-abstract\";\nimport { useActiveFrontstageDef, WidgetState } from \"@itwin/appui-react\";\nimport { ActionButtonRendererProps, VirtualizedPropertyGridWithDataProvider } from \"@itwin/components-react\";\nimport { FillCentered, Orientation, ResizableContainerObserver } from \"@itwin/core-react\";\nimport { SvgCopy } from \"@itwin/itwinui-icons-react\";\nimport { IconButton } from \"@itwin/itwinui-react\";\nimport { MapLayersUI } from \"../../mapLayers\";\nimport { FeatureInfoUiItemsProvider } from \"../FeatureInfoUiItemsProvider\";\nimport { MapFeatureInfoOptions } from \"../Interfaces\";\nimport { FeatureInfoDataProvider } from \"./FeatureInfoDataProvider\";\n\nexport function useSpecificWidgetDef(id: string) {\n const frontstageDef = useActiveFrontstageDef();\n return frontstageDef?.findWidgetDef(id);\n}\n\n// MapFeatureInfoWidgetProps\ninterface MapFeatureInfoWidgetProps {\n featureInfoOpts: MapFeatureInfoOptions;\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function MapFeatureInfoWidget({ featureInfoOpts }: MapFeatureInfoWidgetProps) {\n\n const dataProvider = React.useRef<FeatureInfoDataProvider>();\n const [hasData, setHasData] = React.useState<boolean>(false);\n\n const [noRecordsMessage] = React.useState(MapLayersUI.localization.getLocalizedString(\"mapLayers:FeatureInfoWidget.NoRecords\"));\n\n const [{ width, height }, setSize] = React.useState({ width: 0, height: 0 });\n\n const widgetDef = useSpecificWidgetDef(FeatureInfoUiItemsProvider.widgetId);\n const handleDataChanged = React.useCallback(() => {\n const dataAvailable = dataProvider.current !== undefined && dataProvider.current.hasRecords;\n setHasData(dataAvailable);\n if (widgetDef) {\n widgetDef.setWidgetState(dataAvailable ? WidgetState.Open : WidgetState.Hidden);\n }\n }, [widgetDef]);\n\n React.useEffect(() => {\n dataProvider.current = new FeatureInfoDataProvider();\n return () => {\n dataProvider?.current?.onUnload();\n };\n }, []);\n\n React.useEffect(() => {\n dataProvider.current?.onDataChanged.addListener(handleDataChanged);\n return () => {\n dataProvider.current?.onDataChanged.removeListener(handleDataChanged);\n };\n }, [handleDataChanged]);\n\n const handleResize = React.useCallback((w: number, h: number) => {\n setSize({ width: w, height: h });\n }, []);\n\n const copyButton = React.useCallback(\n (props: ActionButtonRendererProps) => props.isPropertyHovered &&\n <div>\n <IconButton styleType=\"borderless\" onClick={() => {\n const value = props.property.value;\n if (value !== undefined && value.hasOwnProperty(\"displayValue\"))\n navigator.clipboard.writeText((value as PrimitiveValue).displayValue ?? \"\").catch((_) => { });\n }}>\n <SvgCopy/>\n </IconButton>\n </div>,\n [],\n );\n\n if (hasData && dataProvider.current) {\n return (\n <ResizableContainerObserver onResize={handleResize}>\n <VirtualizedPropertyGridWithDataProvider\n width={width}\n height={height}\n dataProvider={dataProvider.current}\n orientation={Orientation.Vertical}\n isPropertySelectionEnabled={featureInfoOpts?.propertyGridOptions?.isPropertySelectionEnabled}\n isPropertyHoverEnabled // This need to be turned on to have the action button appears only when property hovered\n actionButtonRenderers={[copyButton]}\n />\n </ResizableContainerObserver>\n );\n } else {\n return (\n <FillCentered>\n <span>\n <i>{noRecordsMessage}</i>\n </span>\n </FillCentered>\n );\n }\n}\n"]}
|
|
@@ -196,8 +196,8 @@ function MapLayerManager(props) {
|
|
|
196
196
|
// Find existing entries to avoid adding duplicated sources
|
|
197
197
|
if (!sources.find((curSource) => source.name === curSource.name)) {
|
|
198
198
|
const cpMapping = cpMappingStorage.get(source.url.toLowerCase());
|
|
199
|
-
if (cpMapping && cpMapping
|
|
200
|
-
CustomParamUtils_1.CustomParamUtils.setSourceCustomParams(source, cpMapping
|
|
199
|
+
if (cpMapping && !Array.isArray(cpMapping)) {
|
|
200
|
+
CustomParamUtils_1.CustomParamUtils.setSourceCustomParams(source, cpMapping.customParamNames);
|
|
201
201
|
}
|
|
202
202
|
addSource(source);
|
|
203
203
|
}
|